drm/msm/dsi: Document DSC related pclk_rate and hdisplay calculations
PATCH v2 1/1 drm/msm/dsi: Document DSC related pclk_rate and hdisplay calculations
Provide actual documentation for the pclk and hdisplay calculations in the case of DSC compression being used.
---
Changes since v1:
- Converted dsi_adjust_pclk_for_compression() into kerneldoc (Marijn)
- Added a pointer from dsi_timing_setup() docs to dsi_adjust_pclk_for_compression() (Marijn)
- Fixed two typo (Marijn)
--- drivers/gpu/drm/msm/dsi/dsi_host.c | 40 ++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/dsi/dsi_host.c +38 -2
@@ -528,6 +528,25 @@ void dsi_link_clk_disable_v2(struct msm_dsi_host *msm_host)clk_disable_unprepare (msm_host->byte_clk); } +/** +* dsi_adjust_pclk_for_compression() - Adjust the pclk rate for compression case +* @mode: the selected mode for the DSI output +* @dsc: DRM DSC configuration for this DSI output +* +* Adjust the pclk rate by calculating a new hdisplay proportional to +* the compression ratio such that: +* new_hdisplay = old_hdisplay * compressed_bpp / uncompressed_bpp +* +* Porches do not need to be adjusted: +* - For the VIDEO mode they are not compressed by DSC and are passed as is. +* - For the CMD mode there are no actual porches. Instead these fields +* currently represent the overhead to the image data transfer. As such, they +* are calculated for the final mode parameters (after the compression) and +* are not to be adjusted too. +* +* FIXME: Reconsider this if/when CMD mode handling is rewritten to use +* refresh rate and data overhead as a starting point of the calculations. +*/ static unsigned long dsi_adjust_pclk_for_compression (const struct drm_display_mode *mode,const struct drm_dsc_config *dsc) {
@@ -926,8 +945,25 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi)if (ret)return ; -/* Divide the display by 3 but keep back/font porch and -* pulse width same +/* +* DPU sends 3 bytes per pclk cycle to DSI. If compression is +* not used, a single pixel is transferred at each pulse, no +* matter what bpp or pixel format is used. In case of DSC +* compression this results (due to data alignment +* requirements) in a transfer of 3 compressed pixel per pclk +* cycle. +* +* If widebus is enabled, bus width is extended to 6 bytes. +* This way the DPU can transfer 6 compressed pixels with bpp +* less or equal to 8 or 3 compressed pixels in case bpp is +* greater than 8. +* +* The back/font porch and pulse width are kept intact. They +* represent timing parameters rather than actual data +* transfer. See the documentation of +* dsi_adjust_pclk_for_compression(). +* +* XXX: widebus is not supported by the driver (yet). */ h_total -= hdisplay; hdisplay =DIV_ROUND_UP (msm_dsc_get_bytes_per_line (msm_host->dsc),3 );
Signature · 1 line
2.39.2
Marijn Suijten
reviewerQuoted 21 lines · Dmitry Baryshkov
Provide actual documentation for the pclk and hdisplay calculations in the case of DSC compression being used.
Signed-off-by Dmitry Baryshkov <[email protected]>---
Changes since v1:
- Converteddsi_adjust_pclk_for_compression()into kerneldoc (Marijn)
- Added a pointer fromdsi_timing_setup()docs todsi_adjust_pclk_for_compression()(Marijn)
- Fixed two typo (Marijn)--- drivers/gpu/drm/msm/dsi/dsi_host.c | 40 ++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-)drivers/gpu/drm/msm/dsi/dsi_host.c +0
-0
drivers/gpu/drm/msm/dsi/dsi_host.c void dsi_link_clk_disable_v2(struct msm_dsi_host *msm_host) · line 533
Quoted 6 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +3
-0@@ -528,6 +528,25 @@ void dsi_link_clk_disable_v2(struct msm_dsi_host *msm_host)clk_disable_unprepare (msm_host->byte_clk); } +/** +* dsi_adjust_pclk_for_compression() - Adjust the pclk rate for compression case +* @mode: the selected mode for the DSI output
The
drivers/gpu/drm/msm/dsi/dsi_host.c void dsi_link_clk_disable_v2(struct msm_dsi_host *msm_host) · line 538
Quoted 5 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +5
-0+* @dsc: DRM DSC configuration for this DSI output +* +* Adjust the pclk rate by calculating a new hdisplay proportional to +* the compression ratio such that: +* new_hdisplay = old_hdisplay * compressed_bpp / uncompressed_bpp
And in v1 you explained that it is _not_ about bpp...
drivers/gpu/drm/msm/dsi/dsi_host.c void dsi_link_clk_disable_v2(struct msm_dsi_host *msm_host) · line 542
Quoted 4 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +4
-0+* +* Porches do not need to be adjusted: +* - For the VIDEO mode they are not compressed by DSC and are passed as is. +* - For the CMD mode there are no actual porches. Instead these fields
I feel like "For VIDEO mode" and "For CMD mode" reads more naturally, no need for "the", but I don't know the grammar rule that states so.
drivers/gpu/drm/msm/dsi/dsi_host.c void dsi_link_clk_disable_v2(struct msm_dsi_host *msm_host) · line 548
Quoted 6 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +6
-0+* currently represent the overhead to the image data transfer. As such, they +* are calculated for the final mode parameters (after the compression) and +* are not to be adjusted too. +* +* FIXME: Reconsider this if/when CMD mode handling is rewritten to use +* refresh rate and data overhead as a starting point of the calculations.
Nit: well, refresh rate is already part of this calculation (that's how drm_display_mode's clock member comes to be, and how drm_mode_vrefresh() figures out fps after the fact). It's all about the per-CMD transfer overhead in bytes that is currently not part of the calculation.
drivers/gpu/drm/msm/dsi/dsi_host.c static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi) · line 949
Quoted 12 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +3
-2+*/ static unsigned long dsi_adjust_pclk_for_compression (const struct drm_display_mode *mode,const struct drm_dsc_config *dsc) {@@ -926,8 +945,25 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi)if (ret)return ; -/* Divide the display by 3 but keep back/font porch and -* pulse width same +/* +* DPU sends 3 bytes per pclk cycle to DSI. If compression is
Should this be pixels (1 pixel), not bytes, just like in the compressed scenario?
drivers/gpu/drm/msm/dsi/dsi_host.c static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi) · line 959
Quoted 10 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +10
-0+* not used, a single pixel is transferred at each pulse, no +* matter what bpp or pixel format is used. In case of DSC +* compression this results (due to data alignment +* requirements) in a transfer of 3 compressed pixel per pclk +* cycle. +* +* If widebus is enabled, bus width is extended to 6 bytes. +* This way the DPU can transfer 6 compressed pixels with bpp +* less or equal to 8 or 3 compressed pixels in case bpp is +* greater than 8.
Okay, so one can not send more than 6 pixels even if the bpp is less than 8, is what this comes down to.
drivers/gpu/drm/msm/dsi/dsi_host.c static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi) · line 964
Quoted 5 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +5
-0+* +* The back/font porch and pulse width are kept intact. They +* represent timing parameters rather than actual data +* transfer. See the documentation of +* dsi_adjust_pclk_for_compression().
Nit: note that this is only for VIDEO mode, h_total and ha_end are accurately unused in the CMDmode path below.
- Marijn
Quoted 8 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +2
-0+* +* XXX: widebus is not supported by the driver (yet). */ h_total -= hdisplay; hdisplay =DIV_ROUND_UP (msm_dsc_get_bytes_per_line (msm_host->dsc),3 );Signature · 1 line
2.39.2
Quoted 31 lines · Marijn Suijten
Quoted 21 lines · Dmitry Baryshkov
Provide actual documentation for the pclk and hdisplay calculations in the case of DSC compression being used.
Signed-off-by Dmitry Baryshkov <[email protected]>---
Changes since v1:
- Converteddsi_adjust_pclk_for_compression()into kerneldoc (Marijn)
- Added a pointer fromdsi_timing_setup()docs todsi_adjust_pclk_for_compression()(Marijn)
- Fixed two typo (Marijn)--- drivers/gpu/drm/msm/dsi/dsi_host.c | 40 ++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-)drivers/gpu/drm/msm/dsi/dsi_host.c +0
-0drivers/gpu/drm/msm/dsi/dsi_host.c void dsi_link_clk_disable_v2(struct msm_dsi_host *msm_host) · line 533
Quoted 6 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +3
-0@@ -528,6 +528,25 @@ void dsi_link_clk_disable_v2(struct msm_dsi_host *msm_host)clk_disable_unprepare (msm_host->byte_clk); } +/** +* dsi_adjust_pclk_for_compression() - Adjust the pclk rate for compression case +* @mode: the selected mode for the DSI output The
Quoted 7 lines
drivers/gpu/drm/msm/dsi/dsi_host.c void dsi_link_clk_disable_v2(struct msm_dsi_host *msm_host) · line 538
Quoted 5 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +5
-0+* @dsc: DRM DSC configuration for this DSI output +* +* Adjust the pclk rate by calculating a new hdisplay proportional to +* the compression ratio such that: +* new_hdisplay = old_hdisplay * compressed_bpp / uncompressed_bpp And in v1 you explained that it is _not_ about bpp...
Hmm, this bit stayed intact, so I'm slightly confused here.
This function is about BPP and compressed rate. dsi_timing_setup() is
about bytes.
Quoted 8 lines
drivers/gpu/drm/msm/dsi/dsi_host.c void dsi_link_clk_disable_v2(struct msm_dsi_host *msm_host) · line 542
Quoted 5 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +4
-0+* +* Porches do not need to be adjusted: +* - For the VIDEO mode they are not compressed by DSC and are passed as is. +* - For the CMD mode there are no actual porches. Instead these fields I feel like "For VIDEO mode" and "For CMD mode" reads more naturally, no need for "the", but I don't know the grammar rule that states so.
Ack
Quoted 8 lines
drivers/gpu/drm/msm/dsi/dsi_host.c void dsi_link_clk_disable_v2(struct msm_dsi_host *msm_host) · line 548
Quoted 7 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +6
-0+* currently represent the overhead to the image data transfer. As such, they +* are calculated for the final mode parameters (after the compression) and +* are not to be adjusted too. +* +* FIXME: Reconsider this if/when CMD mode handling is rewritten to use +* refresh rate and data overhead as a starting point of the calculations.
Quoted 4 lines
Nit: well, refresh rate is already part of this calculation (that's how drm_display_mode's clock member comes to be, and how
drm_mode_vrefresh()figures out fps after the fact). It's all about the per-CMD transfer overhead in bytes that is currently not part of the calculation.
Please correct me if I'm wrong, we start from mode->clock. Refresh rate isn't even a part of struct drm_display_mode.
Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +1
-0+*/ static unsigned long dsi_adjust_pclk_for_compression (const struct drm_display_mode *mode,const struct drm_dsc_config *dsc) {@@ -926,8 +945,25 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi)if (ret)return ;
Quoted 7 lines
drivers/gpu/drm/msm/dsi/dsi_host.c static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi) · line 949
Quoted 4 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +2
-2-/* Divide the display by 3 but keep back/font porch and -* pulse width same +/* +* DPU sends 3 bytes per pclk cycle to DSI. If compression is Should this be pixels (1 pixel), not bytes, just like in the compressed scenario?
No.
Quoted 14 lines
drivers/gpu/drm/msm/dsi/dsi_host.c static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi) · line 959
Quoted 11 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +10
-0+* not used, a single pixel is transferred at each pulse, no +* matter what bpp or pixel format is used. In case of DSC +* compression this results (due to data alignment +* requirements) in a transfer of 3 compressed pixel per pclk +* cycle. +* +* If widebus is enabled, bus width is extended to 6 bytes. +* This way the DPU can transfer 6 compressed pixels with bpp +* less or equal to 8 or 3 compressed pixels in case bpp is +* greater than 8. Okay, so one can not send more than 6 pixels even if the bpp is less than 8, is what this comes down to.
Yes.
Quoted 20 lines
drivers/gpu/drm/msm/dsi/dsi_host.c static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi) · line 964
Quoted 6 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +5
-0+* +* The back/font porch and pulse width are kept intact. They +* represent timing parameters rather than actual data +* transfer. See the documentation of +* dsi_adjust_pclk_for_compression(). Nit: note that this is only for VIDEO mode,
h_totalandha_endare accurately unused in the CMDmode path below.- Marijn
Quoted 8 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +2
-0+* +* XXX: widebus is not supported by the driver (yet). */ h_total -= hdisplay; hdisplay =DIV_ROUND_UP (msm_dsc_get_bytes_per_line (msm_host->dsc),3 );Signature · 1 line
2.39.2
Signature · 2 lines
With best wishes Dmitry
Marijn Suijten
reviewerQuoted 38 lines · Dmitry Baryshkov
Quoted 37 lines · Marijn Suijten
Quoted 21 lines · Dmitry Baryshkov
Provide actual documentation for the pclk and hdisplay calculations in the case of DSC compression being used.
Signed-off-by Dmitry Baryshkov <[email protected]>---
Changes since v1:
- Converteddsi_adjust_pclk_for_compression()into kerneldoc (Marijn)
- Added a pointer fromdsi_timing_setup()docs todsi_adjust_pclk_for_compression()(Marijn)
- Fixed two typo (Marijn)--- drivers/gpu/drm/msm/dsi/dsi_host.c | 40 ++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-)drivers/gpu/drm/msm/dsi/dsi_host.c +0
-0drivers/gpu/drm/msm/dsi/dsi_host.c void dsi_link_clk_disable_v2(struct msm_dsi_host *msm_host) · line 533
Quoted 6 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +3
-0@@ -528,6 +528,25 @@ void dsi_link_clk_disable_v2(struct msm_dsi_host *msm_host)clk_disable_unprepare (msm_host->byte_clk); } +/** +* dsi_adjust_pclk_for_compression() - Adjust the pclk rate for compression case +* @mode: the selected mode for the DSI output The
Quoted 5 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +5
-0+* @dsc: DRM DSC configuration for this DSI output +* +* Adjust the pclk rate by calculating a new hdisplay proportional to +* the compression ratio such that: +* new_hdisplay = old_hdisplay * compressed_bpp / uncompressed_bpp
Quoted 3 lines
Quoted 1 line
And in v1 you explained that it is _not_ about bpp...
Hmm, this bit stayed intact, so I'm slightly confused here.
It did, because no-one bothered to respond to my questions about this BPP rate versus "pixels/bytes per pclk" inquiry. So I just keep repeating it every patch that touches/mentions it, until someone replies.
Quoted 2 lines
This function is about BPP and compressed rate.
dsi_timing_setup()is
about bytes.
The question is whether that is _correct_. The discussion all this time is about pclk - even for compressed mode - counting the number of pixels, not the bpp ratio.
Quoted 18 lines
Quoted 7 lines
drivers/gpu/drm/msm/dsi/dsi_host.c void dsi_link_clk_disable_v2(struct msm_dsi_host *msm_host) · line 542
Quoted 4 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +4
-0+* +* Porches do not need to be adjusted: +* - For the VIDEO mode they are not compressed by DSC and are passed as is. +* - For the CMD mode there are no actual porches. Instead these fields I feel like "For VIDEO mode" and "For CMD mode" reads more naturally, no need for "the", but I don't know the grammar rule that states so.
Ack
Quoted 8 lines
Quoted 7 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +6
-0+* currently represent the overhead to the image data transfer. As such, they +* are calculated for the final mode parameters (after the compression) and +* are not to be adjusted too. +* +* FIXME: Reconsider this if/when CMD mode handling is rewritten to use +* refresh rate and data overhead as a starting point of the calculations.
Quoted 7 lines
Quoted 4 lines
Nit: well, refresh rate is already part of this calculation (that's how drm_display_mode's clock member comes to be, and how
drm_mode_vrefresh()figures out fps after the fact). It's all about the per-CMD transfer overhead in bytes that is currently not part of the calculation.Please correct me if I'm wrong, we start from
mode->clock. Refresh rate isn't even a part of structdrm_display_mode.
It is not a separate field because it is _embedded in mode->clock_ (see how drm_mode_vrefresh() is implemented to divide ->clock by htotal and vtotal to get the fps again), and hence already part of the values used in this calculation.
Quoted 16 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +1
-0+*/ static unsigned long dsi_adjust_pclk_for_compression (const struct drm_display_mode *mode,const struct drm_dsc_config *dsc) {@@ -926,8 +945,25 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi)if (ret)return ;Quoted 7 lines
drivers/gpu/drm/msm/dsi/dsi_host.c static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi) · line 949
Quoted 4 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +2
-2-/* Divide the display by 3 but keep back/font porch and -* pulse width same +/* +* DPU sends 3 bytes per pclk cycle to DSI. If compression is Should this be pixels (1 pixel), not bytes, just like in the compressed scenario?
Quoted 1 line
No.
So if the uncomrpessed BPP changes, pclk _also changes_?
- Marijn
Quoted 41 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +5
-0+* not used, a single pixel is transferred at each pulse, no +* matter what bpp or pixel format is used. In case of DSC +* compression this results (due to data alignment +* requirements) in a transfer of 3 compressed pixel per pclk +* cycle. Quoted 8 lines
drivers/gpu/drm/msm/dsi/dsi_host.c static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi) · line 959
Quoted 5 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +5
-0+* +* If widebus is enabled, bus width is extended to 6 bytes. +* This way the DPU can transfer 6 compressed pixels with bpp +* less or equal to 8 or 3 compressed pixels in case bpp is +* greater than 8. Okay, so one can not send more than 6 pixels even if the bpp is less than 8, is what this comes down to.
Yes.
Quoted 20 lines
drivers/gpu/drm/msm/dsi/dsi_host.c static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi) · line 964
Quoted 6 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +5
-0+* +* The back/font porch and pulse width are kept intact. They +* represent timing parameters rather than actual data +* transfer. See the documentation of +* dsi_adjust_pclk_for_compression(). Nit: note that this is only for VIDEO mode,
h_totalandha_endare accurately unused in the CMDmode path below.- Marijn
Quoted 8 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +2
-0+* +* XXX: widebus is not supported by the driver (yet). */ h_total -= hdisplay; hdisplay =DIV_ROUND_UP (msm_dsc_get_bytes_per_line (msm_host->dsc),3 );Signature · 1 line
2.39.2Signature · 2 lines
With best wishes Dmitry
Quoted 35 lines · Dmitry Baryshkov
Provide actual documentation for the pclk and hdisplay calculations in the case of DSC compression being used.
Signed-off-by Dmitry Baryshkov <[email protected]>---
Changes since v1:
- Converteddsi_adjust_pclk_for_compression()into kerneldoc (Marijn)
- Added a pointer fromdsi_timing_setup()docs todsi_adjust_pclk_for_compression()(Marijn)
- Fixed two typo (Marijn)--- drivers/gpu/drm/msm/dsi/dsi_host.c | 40 ++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-)drivers/gpu/drm/msm/dsi/dsi_host.c +11
-0@@ -528,6 +528,25 @@ void dsi_link_clk_disable_v2(struct msm_dsi_host *msm_host)clk_disable_unprepare (msm_host->byte_clk); } +/** +* dsi_adjust_pclk_for_compression() - Adjust the pclk rate for compression case +* @mode: the selected mode for the DSI output +* @dsc: DRM DSC configuration for this DSI output +* +* Adjust the pclk rate by calculating a new hdisplay proportional to +* the compression ratio such that: +* new_hdisplay = old_hdisplay * compressed_bpp / uncompressed_bpp +* +* Porches do not need to be adjusted: +* - For the VIDEO mode they are not compressed by DSC and are passed as is.
drivers/gpu/drm/msm/dsi/dsi_host.c void dsi_link_clk_disable_v2(struct msm_dsi_host *msm_host) · line 551
Quoted 10 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +8
-0+* - For the CMD mode there are no actual porches. Instead these fields +* currently represent the overhead to the image data transfer. As such, they +* are calculated for the final mode parameters (after the compression) and +* are not to be adjusted too. +* +* FIXME: Reconsider this if/when CMD mode handling is rewritten to use +* refresh rate and data overhead as a starting point of the calculations. +*/ static unsigned long dsi_adjust_pclk_for_compression (const struct drm_display_mode *mode,const struct drm_dsc_config *dsc)
I am fine with this part of the doc.
Quoted 5 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +0
-0{@@ -926,8 +945,25 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi)if (ret)return ;
drivers/gpu/drm/msm/dsi/dsi_host.c static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi) · line 955
Quoted 10 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +8
-2-/* Divide the display by 3 but keep back/font porch and -* pulse width same +/* +* DPU sends 3 bytes per pclk cycle to DSI. If compression is +* not used, a single pixel is transferred at each pulse, no +* matter what bpp or pixel format is used. In case of DSC +* compression this results (due to data alignment +* requirements) in a transfer of 3 compressed pixel per pclk +* cycle. +*
I dont want to talk about data alignment nor formats and I will not ack any references to those.
I would like to keep this simple and say that DPU sends 3 bytes of compressed data / pclk (6 with widebus enabled) and all this math is doing is that its calculating number of bytes and diving it by 3 OR 6 with widebus to calculate the pclk cycles. Thats it.
drivers/gpu/drm/msm/dsi/dsi_host.c static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi) · line 964
Quoted 9 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +9
-0+* If widebus is enabled, bus width is extended to 6 bytes. +* This way the DPU can transfer 6 compressed pixels with bpp +* less or equal to 8 or 3 compressed pixels in case bpp is +* greater than 8. +* +* The back/font porch and pulse width are kept intact. They +* represent timing parameters rather than actual data +* transfer. See the documentation of +* dsi_adjust_pclk_for_compression().
this part is fine.
Quoted 5 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +2
-0+* +* XXX: widebus is not supported by the driver (yet). */ h_total -= hdisplay; hdisplay =DIV_ROUND_UP (msm_dsc_get_bytes_per_line (msm_host->dsc),3 );
Quoted 74 lines · Abhinav Kumar
Quoted 42 lines · Dmitry Baryshkov
Provide actual documentation for the pclk and hdisplay calculations in the case of DSC compression being used.
Signed-off-by Dmitry Baryshkov <[email protected]>---
Changes since v1:
- Converteddsi_adjust_pclk_for_compression()into kerneldoc (Marijn)
- Added a pointer fromdsi_timing_setup()docs todsi_adjust_pclk_for_compression()(Marijn)
- Fixed two typo (Marijn)---
drivers/gpu/drm/msm/dsi/dsi_host.c| 40 ++++++++++++++++++++++++++++--1 file changed, 38 insertions(+), 2 deletions(-)drivers/gpu/drm/msm/dsi/dsi_host.c +2
-0@@ -528,6 +528,25 @@ void dsi_link_clk_disable_v2(struct msm_dsi_host *msm_host) clk_disable_unprepare(msm_host->byte_clk); } +/** +* dsi_adjust_pclk_for_compression() - Adjust the pclk rate for compression case
+ * @mode: the selected mode for the DSI output
+ * @dsc: DRM DSC configuration for this DSI output
+ *
+ * Adjust the pclk rate by calculating a new hdisplay proportional to
+ * the compression ratio such that:
+ *new_hdisplay=old_hdisplay*compressed_bpp/uncompressed_bpp
+ *
+ * Porches do not need to be adjusted:
+ * - For the VIDEO mode they are not compressed by DSC and are passed as is.
+ * - For the CMD mode there are no actual porches. Instead these fields
+ * currently represent the overhead to the image data transfer. As such, they
+ * are calculated for the final mode parameters (after the compression) andQuoted 8 lines
+ * are not to be adjusted too.
+ *
+ * FIXME: Reconsider this if/when CMD mode handling is rewritten to use
+ * refresh rate and data overhead as a starting point of the
calculations.
+ */
static unsigned longdsi_adjust_pclk_for_compression(const struct drm_display_mode *mode, const struct drm_dsc_config *dsc)I am fine with this part of the doc.
Quoted 5 lines
{
drivers/gpu/drm/msm/dsi/dsi_host.c +0
-0@@ -926,8 +945,25 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi) if (ret) return;drivers/gpu/drm/msm/dsi/dsi_host.c static void dsi_timing_setup(struct msm_dsi_host · line 955
Quoted 10 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +8
-2- /* Divide the display by 3 but keep back/font porch and -* pulse width same + /* +* DPU sends 3 bytes per pclk cycle to DSI. If compression is +* not used, a single pixel is transferred at each pulse, no +* matter what bpp or pixel format is used. In case of DSC +* compression this results (due to data alignment +* requirements) in a transfer of 3 compressed pixel per pclk +* cycle. +* I dont want to talk about data alignment nor formats and I will not ack any references to those.
Quoted 1 line
I would like to keep this simple and say that DPU sends 3 bytes of compressed data / pclk (6 with widebus enabled) and all this math is doing is that its calculating number of bytes and diving it by 3 OR 6 with widebus to calculate the pclk cycles. Thats it.
This makes it unclear, why do we simply by 3 rather than doing * dsc_bpp / 24. My description might be inaccurate as I don't have hw docs at hand, but simple description is not enough.
Quoted 18 lines
drivers/gpu/drm/msm/dsi/dsi_host.c static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi) · line 964
Quoted 10 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +9
-0+ * If widebus is enabled, bus width is extended to 6 bytes. + * This way the DPU can transfer 6 compressed pixels with bpp + * less or equal to 8 or 3 compressed pixels in case bpp is + * greater than 8. + * + * The back/font porch and pulse width are kept intact. They + * represent timing parameters rather than actual data + * transfer. See the documentation of + * dsi_adjust_pclk_for_compression().this part is fine.
Quoted 5 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +2
-0+* +* XXX: widebus is not supported by the driver (yet). */ h_total -= hdisplay; hdisplay = DIV_ROUND_UP(msm_dsc_get_bytes_per_line(msm_host->dsc), 3);
Signature · 2 lines
With best wishes Dmitry
Quoted 76 lines · Dmitry Baryshkov
Quoted 75 lines · Abhinav Kumar
Quoted 43 lines · Dmitry Baryshkov
Provide actual documentation for the pclk and hdisplay calculations in the case of DSC compression being used.
Signed-off-by Dmitry Baryshkov <[email protected]>---
Changes since v1:
- Converteddsi_adjust_pclk_for_compression()into kerneldoc (Marijn)
- Added a pointer fromdsi_timing_setup()docs todsi_adjust_pclk_for_compression()(Marijn)
- Fixed two typo (Marijn)---
drivers/gpu/drm/msm/dsi/dsi_host.c| 40 ++++++++++++++++++++++++++++--1 file changed, 38 insertions(+), 2 deletions(-)drivers/gpu/drm/msm/dsi/dsi_host.c +2
-0@@ -528,6 +528,25 @@ void dsi_link_clk_disable_v2(struct msm_dsi_host *msm_host) clk_disable_unprepare(msm_host->byte_clk); } +/** +* dsi_adjust_pclk_for_compression() - Adjust the pclk rate for compression case
+ * @mode: the selected mode for the DSI output
+ * @dsc: DRM DSC configuration for this DSI output
+ *
+ * Adjust the pclk rate by calculating a new hdisplay proportional to
+ * the compression ratio such that:
+ *new_hdisplay=old_hdisplay*compressed_bpp/uncompressed_bpp
+ *
+ * Porches do not need to be adjusted:
+ * - For the VIDEO mode they are not compressed by DSC and are passed as is.
+ * - For the CMD mode there are no actual porches. Instead these fields
+ * currently represent the overhead to the image data transfer. As such, they
+ * are calculated for the final mode parameters (after the compression) and
+ * are not to be adjusted too.Quoted 8 lines
+ *
+ * FIXME: Reconsider this if/when CMD mode handling is rewritten to
use
+ * refresh rate and data overhead as a starting point of the
calculations.
+ */
static unsigned longdsi_adjust_pclk_for_compression(const struct drm_display_mode *mode, const struct drm_dsc_config *dsc)I am fine with this part of the doc.
Quoted 5 lines
{
drivers/gpu/drm/msm/dsi/dsi_host.c +0
-0@@ -926,8 +945,25 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi) if (ret) return;drivers/gpu/drm/msm/dsi/dsi_host.c static void dsi_timing_setup(struct msm_dsi_host · line 955
Quoted 10 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +8
-2- /* Divide the display by 3 but keep back/font porch and -* pulse width same + /* +* DPU sends 3 bytes per pclk cycle to DSI. If compression is +* not used, a single pixel is transferred at each pulse, no +* matter what bpp or pixel format is used. In case of DSC +* compression this results (due to data alignment +* requirements) in a transfer of 3 compressed pixel per pclk +* cycle. +* I dont want to talk about data alignment nor formats and I will not ack any references to those.
Quoted 4 lines
Quoted 1 line
I would like to keep this simple and say that DPU sends 3 bytes of compressed data / pclk (6 with widebus enabled) and all this math is doing is that its calculating number of bytes and diving it by 3 OR 6 with widebus to calculate the pclk cycles. Thats it.
This makes it unclear, why do we simply by 3 rather than doing *
dsc_bpp/ 24. My description might be inaccurate as I don't have hw docs at hand, but simple description is not enough.
Why is it unclear? With compression, we are saying we process at 3 compressed bytes / pclk and this math is accurately giving the pclk cycles.
You are once again trying to arrive at 3 with compression factor in mind by calculating target_bpp / src_bpp.
I am saying that its independent of that. Whenever we do compression rate is 3 bytes of compressed data (and 6 with widebus) irrespective of what your dsc_bpp was.
Quoted 19 lines
Quoted 18 lines
drivers/gpu/drm/msm/dsi/dsi_host.c static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi) · line 964
Quoted 10 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +9
-0+ * If widebus is enabled, bus width is extended to 6 bytes. + * This way the DPU can transfer 6 compressed pixels with bpp + * less or equal to 8 or 3 compressed pixels in case bpp is + * greater than 8. + * + * The back/font porch and pulse width are kept intact. They + * represent timing parameters rather than actual data + * transfer. See the documentation of + * dsi_adjust_pclk_for_compression().this part is fine.
Quoted 5 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +2
-0+* +* XXX: widebus is not supported by the driver (yet). */ h_total -= hdisplay; hdisplay = DIV_ROUND_UP(msm_dsc_get_bytes_per_line(msm_host->dsc), 3);
Quoted 83 lines · Abhinav Kumar
Quoted 80 lines · Dmitry Baryshkov
Quoted 78 lines · Abhinav Kumar
Quoted 45 lines · Dmitry Baryshkov
Provide actual documentation for the pclk and hdisplay calculations in the case of DSC compression being used.
Signed-off-by Dmitry Baryshkov <[email protected]>---
Changes since v1:
- Converteddsi_adjust_pclk_for_compression()into kerneldoc (Marijn)
- Added a pointer fromdsi_timing_setup()docs todsi_adjust_pclk_for_compression()(Marijn)
- Fixed two typo (Marijn)---
drivers/gpu/drm/msm/dsi/dsi_host.c| 40
++++++++++++++++++++++++++++--1 file changed, 38 insertions(+), 2 deletions(-)drivers/gpu/drm/msm/dsi/dsi_host.c +2
-0@@ -528,6 +528,25 @@ void dsi_link_clk_disable_v2(struct msm_dsi_host *msm_host) clk_disable_unprepare(msm_host->byte_clk); } +/** +* dsi_adjust_pclk_for_compression() - Adjust the pclk rate for compression case
+ * @mode: the selected mode for the DSI output
+ * @dsc: DRM DSC configuration for this DSI output
+ *
+ * Adjust the pclk rate by calculating a new hdisplay proportional to
+ * the compression ratio such that:
+ *new_hdisplay=old_hdisplay*compressed_bpp/uncompressed_bpp
+ *
+ * Porches do not need to be adjusted:
+ * - For the VIDEO mode they are not compressed by DSC and are passed as is.
+ * - For the CMD mode there are no actual porches. Instead these fields
+ * currently represent the overhead to the image data transfer. As such, they
+ * are calculated for the final mode parameters (after the compression) and
+ * are not to be adjusted too.Quoted 8 lines
+ *
+ * FIXME: Reconsider this if/when CMD mode handling is rewritten
to use
+ * refresh rate and data overhead as a starting point of the
calculations.
+ */
static unsigned longdsi_adjust_pclk_for_compression(const struct drm_display_mode *mode, const struct drm_dsc_config *dsc)I am fine with this part of the doc.
Quoted 5 lines
{
drivers/gpu/drm/msm/dsi/dsi_host.c +0
-0@@ -926,8 +945,25 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi) if (ret) return;drivers/gpu/drm/msm/dsi/dsi_host.c static void dsi_timing_setup(struct · line 955
Quoted 10 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +8
-2- /* Divide the display by 3 but keep back/font porch and -* pulse width same + /* +* DPU sends 3 bytes per pclk cycle to DSI. If compression is +* not used, a single pixel is transferred at each pulse, no +* matter what bpp or pixel format is used. In case of DSC +* compression this results (due to data alignment +* requirements) in a transfer of 3 compressed pixel per pclk +* cycle. +* I dont want to talk about data alignment nor formats and I will not ack any references to those.
I would like to keep this simple and say that DPU sends 3 bytes of compressed data / pclk (6 with widebus enabled) and all this math is doing is that its calculating number of bytes and diving it by 3 OR 6 with widebus to calculate the pclk cycles. Thats it.
Quoted 8 lines
Quoted 2 lines
This makes it unclear, why do we simply by 3 rather than doing *
dsc_bpp/ 24. My description might be inaccurate as I don't have hw docs at hand, but simple description is not enough.Why is it unclear? With compression, we are saying we process at 3 compressed bytes / pclk and this math is accurately giving the pclk cycles.
You are once again trying to arrive at 3 with compression factor in mind by calculating
target_bpp/src_bpp.I am saying that its independent of that. Whenever we do compression rate is 3 bytes of compressed data (and 6 with widebus) irrespective of what your
dsc_bppwas.
3 bytes of compressed data = 4 * 6bpp pixels. So hdisplay should have been divided by 4 in such case. So, this is not just about bytes.
Quoted 20 lines
Quoted 20 lines
Quoted 19 lines
drivers/gpu/drm/msm/dsi/dsi_host.c static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi) · line 964
Quoted 11 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +9
-0+ * If widebus is enabled, bus width is extended to 6 bytes. + * This way the DPU can transfer 6 compressed pixels with bpp + * less or equal to 8 or 3 compressed pixels in case bpp is + * greater than 8. + * + * The back/font porch and pulse width are kept intact. They + * represent timing parameters rather than actual data + * transfer. See the documentation of + * dsi_adjust_pclk_for_compression().this part is fine.
Quoted 5 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +2
-0+* +* XXX: widebus is not supported by the driver (yet). */ h_total -= hdisplay; hdisplay = DIV_ROUND_UP(msm_dsc_get_bytes_per_line(msm_host->dsc), 3);
Signature · 2 lines
With best wishes Dmitry
Marijn Suijten
reviewerQuoted 95 lines · Abhinav Kumar
Quoted 79 lines · Dmitry Baryshkov
Quoted 78 lines · Abhinav Kumar
Quoted 45 lines · Dmitry Baryshkov
Provide actual documentation for the pclk and hdisplay calculations in the case of DSC compression being used.
Signed-off-by Dmitry Baryshkov <[email protected]>---
Changes since v1:
- Converteddsi_adjust_pclk_for_compression()into kerneldoc (Marijn)
- Added a pointer fromdsi_timing_setup()docs todsi_adjust_pclk_for_compression()(Marijn)
- Fixed two typo (Marijn)---
drivers/gpu/drm/msm/dsi/dsi_host.c| 40 ++++++++++++++++++++++++++++--1 file changed, 38 insertions(+), 2 deletions(-)drivers/gpu/drm/msm/dsi/dsi_host.c +2
-0@@ -528,6 +528,25 @@ void dsi_link_clk_disable_v2(struct msm_dsi_host *msm_host) clk_disable_unprepare(msm_host->byte_clk); } +/** +* dsi_adjust_pclk_for_compression() - Adjust the pclk rate for compression case
+ * @mode: the selected mode for the DSI output
+ * @dsc: DRM DSC configuration for this DSI output
+ *
+ * Adjust the pclk rate by calculating a new hdisplay proportional to
+ * the compression ratio such that:
+ *new_hdisplay=old_hdisplay*compressed_bpp/uncompressed_bpp
+ *
+ * Porches do not need to be adjusted:
+ * - For the VIDEO mode they are not compressed by DSC and are passed as is.
+ * - For the CMD mode there are no actual porches. Instead these fields
+ * currently represent the overhead to the image data transfer. As such, they
+ * are calculated for the final mode parameters (after the compression) and
+ * are not to be adjusted too.
+ *Quoted 8 lines
+ * FIXME: Reconsider this if/when CMD mode handling is rewritten to use
+ * refresh rate and data overhead as a starting point of the calculations.
+ */
static unsigned long dsi_adjust_pclk_for_compression(const structdrm_display_mode*mode,
const structdrm_dsc_config*dsc)I am fine with this part of the doc.
Quoted 5 lines
{
drivers/gpu/drm/msm/dsi/dsi_host.c +0
-0@@ -926,8 +945,25 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi) if (ret) return;drivers/gpu/drm/msm/dsi/dsi_host.c static void dsi_timing_setup(struct msm_dsi_host · line 955
Quoted 10 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +8
-2- /* Divide the display by 3 but keep back/font porch and -* pulse width same + /* +* DPU sends 3 bytes per pclk cycle to DSI. If compression is +* not used, a single pixel is transferred at each pulse, no +* matter what bpp or pixel format is used. In case of DSC +* compression this results (due to data alignment +* requirements) in a transfer of 3 compressed pixel per pclk +* cycle. +* I dont want to talk about data alignment nor formats and I will not ack any references to those.
Quoted 9 lines
Quoted 4 lines
I would like to keep this simple and say that DPU sends 3 bytes of compressed data / pclk (6 with widebus enabled) and all this math is doing is that its calculating number of bytes and diving it by 3 OR 6 with widebus to calculate the pclk cycles. Thats it.
This makes it unclear, why do we simply by 3 rather than doing *
dsc_bpp/ 24. My description might be inaccurate as I don't have hw docs at hand, but simple description is not enough.Why is it unclear? With compression, we are saying we process at 3 compressed bytes / pclk and this math is accurately giving the pclk cycles.
Quoted 6 lines
You are once again trying to arrive at 3 with compression factor in mind by calculating
target_bpp/src_bpp.I am saying that its independent of that. Whenever we do compression rate is 3 bytes of compressed data (and 6 with widebus) irrespective of what your
dsc_bppwas.
Abhinav, this is exactly what the confusion the pclk series is about. There it was said (and committed to mainline now!) that pclk is based on the compression factor of target_bpp / src_bpp. Now you are saying there is a fixed number of bytes sent by the (wide)bus between DPU-DSC and DSI.
Is pclk used for more purposes besides just ticking for the data transfer between DPU and DSI?
- Marijn
Quoted 103 lines · Marijn Suijten
Quoted 95 lines · Abhinav Kumar
Quoted 79 lines · Dmitry Baryshkov
Quoted 78 lines · Abhinav Kumar
Quoted 45 lines · Dmitry Baryshkov
Provide actual documentation for the pclk and hdisplay calculations in the case of DSC compression being used.
Signed-off-by Dmitry Baryshkov <[email protected]>---
Changes since v1:
- Converteddsi_adjust_pclk_for_compression()into kerneldoc (Marijn)
- Added a pointer fromdsi_timing_setup()docs todsi_adjust_pclk_for_compression()(Marijn)
- Fixed two typo (Marijn)--- drivers/gpu/drm/msm/dsi/dsi_host.c | 40 ++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-)drivers/gpu/drm/msm/dsi/dsi_host.c +2
-0@@ -528,6 +528,25 @@ void dsi_link_clk_disable_v2(struct msm_dsi_host *msm_host) clk_disable_unprepare(msm_host->byte_clk); } +/** +* dsi_adjust_pclk_for_compression() - Adjust the pclk rate for compression case
+ * @mode: the selected mode for the DSI output
+ * @dsc: DRM DSC configuration for this DSI output
+ *
+ * Adjust the pclk rate by calculating a new hdisplay proportional to
+ * the compression ratio such that:
+ *new_hdisplay=old_hdisplay*compressed_bpp/uncompressed_bpp
+ *
+ * Porches do not need to be adjusted:
+ * - For the VIDEO mode they are not compressed by DSC and are passed as is.
+ * - For the CMD mode there are no actual porches. Instead these fields
+ * currently represent the overhead to the image data transfer. As such, they
+ * are calculated for the final mode parameters (after the compression) and
+ * are not to be adjusted too.
+ *Quoted 8 lines
+ * FIXME: Reconsider this if/when CMD mode handling is rewritten to use
+ * refresh rate and data overhead as a starting point of the calculations.
+ */
static unsigned long dsi_adjust_pclk_for_compression(const structdrm_display_mode*mode,
const structdrm_dsc_config*dsc)I am fine with this part of the doc.
Quoted 5 lines
{
drivers/gpu/drm/msm/dsi/dsi_host.c +0
-0@@ -926,8 +945,25 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi) if (ret) return;drivers/gpu/drm/msm/dsi/dsi_host.c static void dsi_timing_setup(struct msm_dsi_host · line 955
Quoted 10 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +8
-2- /* Divide the display by 3 but keep back/font porch and -* pulse width same + /* +* DPU sends 3 bytes per pclk cycle to DSI. If compression is +* not used, a single pixel is transferred at each pulse, no +* matter what bpp or pixel format is used. In case of DSC +* compression this results (due to data alignment +* requirements) in a transfer of 3 compressed pixel per pclk +* cycle. +* I dont want to talk about data alignment nor formats and I will not ack any references to those.
Quoted 9 lines
Quoted 4 lines
I would like to keep this simple and say that DPU sends 3 bytes of compressed data / pclk (6 with widebus enabled) and all this math is doing is that its calculating number of bytes and diving it by 3 OR 6 with widebus to calculate the pclk cycles. Thats it.
This makes it unclear, why do we simply by 3 rather than doing *
dsc_bpp/ 24. My description might be inaccurate as I don't have hw docs at hand, but simple description is not enough.Why is it unclear? With compression, we are saying we process at 3 compressed bytes / pclk and this math is accurately giving the pclk cycles.
Quoted 6 lines
You are once again trying to arrive at 3 with compression factor in mind by calculating
target_bpp/src_bpp.I am saying that its independent of that. Whenever we do compression rate is 3 bytes of compressed data (and 6 with widebus) irrespective of what your
dsc_bppwas.
Quoted 9 lines
Abhinav, this is exactly what the confusion the pclk series is about. There it was said (and committed to mainline now!) that pclk is based on the compression factor of
target_bpp/src_bpp. Now you are saying there is a fixed number of bytes sent by the (wide)bus between DPU-DSC and DSI.Is pclk used for more purposes besides just ticking for the data transfer between DPU and DSI?
There is no confusion between what was said earlier and now.
This line is calculating the number of pclks needed to transmit one line of the compressed data:
hdisplay = DIV_ROUND_UP(msm_dsc_get_bytes_per_line(msm_host->dsc), 3);
msm_dsc_get_bytes_per_line() is calculating the number of compressed bytes as it uses the target bits_per_pixel
126 * @bits_per_pixel:
127 * Target bits per pixel with 4 fractional bits, bits_per_pixel << 4
128 */
129 u16 bits_per_pixel;
(like I have said a few times, hdisplay is perhaps confusing us)
If you calculate the bytes this way you are already accounting for the compression, so where is the confusion.
The pclk calculation does the same thing of using the ratio instead.
Quoted 1 line
- Marijn
Marijn Suijten
reviewerQuoted 131 lines · Abhinav Kumar
Quoted 103 lines · Marijn Suijten
Quoted 95 lines · Abhinav Kumar
Quoted 79 lines · Dmitry Baryshkov
Quoted 78 lines · Abhinav Kumar
Quoted 45 lines · Dmitry Baryshkov
Provide actual documentation for the pclk and hdisplay calculations in the case of DSC compression being used.
Signed-off-by Dmitry Baryshkov <[email protected]>---
Changes since v1:
- Converteddsi_adjust_pclk_for_compression()into kerneldoc (Marijn)
- Added a pointer fromdsi_timing_setup()docs todsi_adjust_pclk_for_compression()(Marijn)
- Fixed two typo (Marijn)--- drivers/gpu/drm/msm/dsi/dsi_host.c | 40 ++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-)drivers/gpu/drm/msm/dsi/dsi_host.c +2
-0@@ -528,6 +528,25 @@ void dsi_link_clk_disable_v2(struct msm_dsi_host *msm_host) clk_disable_unprepare(msm_host->byte_clk); } +/** +* dsi_adjust_pclk_for_compression() - Adjust the pclk rate for compression case
+ * @mode: the selected mode for the DSI output
+ * @dsc: DRM DSC configuration for this DSI output
+ *
+ * Adjust the pclk rate by calculating a new hdisplay proportional to
+ * the compression ratio such that:
+ *new_hdisplay=old_hdisplay*compressed_bpp/uncompressed_bpp
+ *
+ * Porches do not need to be adjusted:
+ * - For the VIDEO mode they are not compressed by DSC and are passed as is.
+ * - For the CMD mode there are no actual porches. Instead these fields
+ * currently represent the overhead to the image data transfer. As such, they
+ * are calculated for the final mode parameters (after the compression) and
+ * are not to be adjusted too.
+ *Quoted 8 lines
+ * FIXME: Reconsider this if/when CMD mode handling is rewritten to use
+ * refresh rate and data overhead as a starting point of the calculations.
+ */
static unsigned long dsi_adjust_pclk_for_compression(const structdrm_display_mode*mode,
const structdrm_dsc_config*dsc)I am fine with this part of the doc.
Quoted 5 lines
{
drivers/gpu/drm/msm/dsi/dsi_host.c +0
-0@@ -926,8 +945,25 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi) if (ret) return;drivers/gpu/drm/msm/dsi/dsi_host.c static void dsi_timing_setup(struct msm_dsi_host · line 955
Quoted 10 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +8
-2- /* Divide the display by 3 but keep back/font porch and -* pulse width same + /* +* DPU sends 3 bytes per pclk cycle to DSI. If compression is +* not used, a single pixel is transferred at each pulse, no +* matter what bpp or pixel format is used. In case of DSC +* compression this results (due to data alignment +* requirements) in a transfer of 3 compressed pixel per pclk +* cycle. +* I dont want to talk about data alignment nor formats and I will not ack any references to those.
Quoted 9 lines
Quoted 4 lines
I would like to keep this simple and say that DPU sends 3 bytes of compressed data / pclk (6 with widebus enabled) and all this math is doing is that its calculating number of bytes and diving it by 3 OR 6 with widebus to calculate the pclk cycles. Thats it.
This makes it unclear, why do we simply by 3 rather than doing *
dsc_bpp/ 24. My description might be inaccurate as I don't have hw docs at hand, but simple description is not enough.Why is it unclear? With compression, we are saying we process at 3 compressed bytes / pclk and this math is accurately giving the pclk cycles.
Quoted 6 lines
You are once again trying to arrive at 3 with compression factor in mind by calculating
target_bpp/src_bpp.I am saying that its independent of that. Whenever we do compression rate is 3 bytes of compressed data (and 6 with widebus) irrespective of what your
dsc_bppwas.Quoted 9 lines
Abhinav, this is exactly what the confusion the pclk series is about. There it was said (and committed to mainline now!) that pclk is based on the compression factor of
target_bpp/src_bpp. Now you are saying there is a fixed number of bytes sent by the (wide)bus between DPU-DSC and DSI.Is pclk used for more purposes besides just ticking for the data transfer between DPU and DSI?
There is no confusion between what was said earlier and now.
This line is calculating the number of pclks needed to transmit one line of the compressed data:
hdisplay =
DIV_ROUND_UP(msm_dsc_get_bytes_per_line(msm_host->dsc), 3);
msm_dsc_get_bytes_per_line()is calculating the number of compressed bytes as it uses the targetbits_per_pixel126 * @bits_per_pixel:
127 * Target bits per pixel with 4 fractional bits,bits_per_pixel<< 4
128 */
129 u16bits_per_pixel;
Quoted 6 lines
(like I have said a few times, hdisplay is perhaps confusing us)
If you calculate the bytes this way you are already accounting for the compression, so where is the confusion.
The pclk calculation does the same thing of using the ratio instead.
This is not answering my question whether the ratio for pclk calculation should also be adjusted to account for widebus. And if the ratio is fixed, why use a fixed factor here but the ratio between src_bpp:target_bpp here? It only adds extra confusion.
- Marijn
Quoted 137 lines · Marijn Suijten
Quoted 136 lines · Abhinav Kumar
Quoted 103 lines · Marijn Suijten
Quoted 95 lines · Abhinav Kumar
Quoted 79 lines · Dmitry Baryshkov
Quoted 78 lines · Abhinav Kumar
Quoted 45 lines · Dmitry Baryshkov
Provide actual documentation for the pclk and hdisplay calculations in the case of DSC compression being used.
Signed-off-by Dmitry Baryshkov <[email protected]>---
Changes since v1:
- Converteddsi_adjust_pclk_for_compression()into kerneldoc (Marijn)
- Added a pointer fromdsi_timing_setup()docs todsi_adjust_pclk_for_compression()(Marijn)
- Fixed two typo (Marijn)--- drivers/gpu/drm/msm/dsi/dsi_host.c | 40 ++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-)drivers/gpu/drm/msm/dsi/dsi_host.c +2
-0@@ -528,6 +528,25 @@ void dsi_link_clk_disable_v2(struct msm_dsi_host *msm_host) clk_disable_unprepare(msm_host->byte_clk); } +/** +* dsi_adjust_pclk_for_compression() - Adjust the pclk rate for compression case
+ * @mode: the selected mode for the DSI output
+ * @dsc: DRM DSC configuration for this DSI output
+ *
+ * Adjust the pclk rate by calculating a new hdisplay proportional to
+ * the compression ratio such that:
+ *new_hdisplay=old_hdisplay*compressed_bpp/uncompressed_bpp
+ *
+ * Porches do not need to be adjusted:
+ * - For the VIDEO mode they are not compressed by DSC and are passed as is.
+ * - For the CMD mode there are no actual porches. Instead these fields
+ * currently represent the overhead to the image data transfer. As such, they
+ * are calculated for the final mode parameters (after the compression) and
+ * are not to be adjusted too.
+ *Quoted 8 lines
+ * FIXME: Reconsider this if/when CMD mode handling is rewritten to use
+ * refresh rate and data overhead as a starting point of the calculations.
+ */
static unsigned long dsi_adjust_pclk_for_compression(const structdrm_display_mode*mode,
const structdrm_dsc_config*dsc)I am fine with this part of the doc.
Quoted 5 lines
{drivers/gpu/drm/msm/dsi/dsi_host.c +0
-0@@ -926,8 +945,25 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi) if (ret) return;drivers/gpu/drm/msm/dsi/dsi_host.c static void dsi_timing_setup(struct msm_dsi_host · line 955
Quoted 10 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +8
-2- /* Divide the display by 3 but keep back/font porch and -* pulse width same + /* +* DPU sends 3 bytes per pclk cycle to DSI. If compression is +* not used, a single pixel is transferred at each pulse, no +* matter what bpp or pixel format is used. In case of DSC +* compression this results (due to data alignment +* requirements) in a transfer of 3 compressed pixel per pclk +* cycle. +* I dont want to talk about data alignment nor formats and I will not ack any references to those.
Quoted 9 lines
Quoted 4 lines
I would like to keep this simple and say that DPU sends 3 bytes of compressed data / pclk (6 with widebus enabled) and all this math is doing is that its calculating number of bytes and diving it by 3 OR 6 with widebus to calculate the pclk cycles. Thats it.
This makes it unclear, why do we simply by 3 rather than doing *
dsc_bpp/ 24. My description might be inaccurate as I don't have hw docs at hand, but simple description is not enough.Why is it unclear? With compression, we are saying we process at 3 compressed bytes / pclk and this math is accurately giving the pclk cycles.
Quoted 6 lines
You are once again trying to arrive at 3 with compression factor in mind by calculating
target_bpp/src_bpp.I am saying that its independent of that. Whenever we do compression rate is 3 bytes of compressed data (and 6 with widebus) irrespective of what your
dsc_bppwas.Quoted 9 lines
Abhinav, this is exactly what the confusion the pclk series is about. There it was said (and committed to mainline now!) that pclk is based on the compression factor of
target_bpp/src_bpp. Now you are saying there is a fixed number of bytes sent by the (wide)bus between DPU-DSC and DSI.Is pclk used for more purposes besides just ticking for the data transfer between DPU and DSI?
There is no confusion between what was said earlier and now.
This line is calculating the number of pclks needed to transmit one line of the compressed data:
hdisplay =
DIV_ROUND_UP(msm_dsc_get_bytes_per_line(msm_host->dsc), 3);
msm_dsc_get_bytes_per_line()is calculating the number of compressed bytes as it uses the targetbits_per_pixel126 * @bits_per_pixel:
127 * Target bits per pixel with 4 fractional bits,bits_per_pixel<< 4
128 */
129 u16bits_per_pixel;(like I have said a few times, hdisplay is perhaps confusing us)
If you calculate the bytes this way you are already accounting for the compression, so where is the confusion.
Quoted 6 lines
Quoted 1 line
The pclk calculation does the same thing of using the ratio instead.
This is not answering my question whether the ratio for pclk calculation should also be adjusted to account for widebus. And if the ratio is fixed, why use a fixed factor here but the ratio between src_bpp:target_bpp here? It only adds extra confusion.
Wide bus is dicussed separately. I think the question you are trying to ask is "why are we not using msm_dsc_get_bytes_per_line() in dsi_adjust_pclk_for_compression()?"
Signature · 2 lines
With best wishes Dmitry
Marijn Suijten
reviewerOn 2023-06-23 23:10:56, Dmitry Baryshkov wrote:
<snip>
Quoted 22 lines
Quoted 22 lines
Quoted 21 lines
There is no confusion between what was said earlier and now.
This line is calculating the number of pclks needed to transmit one line of the compressed data:
hdisplay =
DIV_ROUND_UP(msm_dsc_get_bytes_per_line(msm_host->dsc), 3);
msm_dsc_get_bytes_per_line()is calculating the number of compressed bytes as it uses the targetbits_per_pixel126 * @bits_per_pixel:
127 * Target bits per pixel with 4 fractional bits,bits_per_pixel<< 4
128 */
129 u16bits_per_pixel;(like I have said a few times, hdisplay is perhaps confusing us)
If you calculate the bytes this way you are already accounting for the compression, so where is the confusion.
The pclk calculation does the same thing of using the ratio instead.
Quoted 8 lines
Quoted 4 lines
This is not answering my question whether the ratio for pclk calculation should also be adjusted to account for widebus. And if the ratio is fixed, why use a fixed factor here but the ratio between src_bpp:target_bpp here? It only adds extra confusion.
Wide bus is dicussed separately. I think the question you are trying to ask is "why are we not using
msm_dsc_get_bytes_per_line()indsi_adjust_pclk_for_compression()?"
I have asked that question before, and the answer was something incomprehensible. But indeed, it would look more natural if dsi_adjust_pclk_for_compression() replaces:
int new_hdisplay = DIV_ROUND_UP(mode->hdisplay * drm_dsc_get_bpp_int(dsc),
dsc->bits_per_component * 3)With:
int new_hdisplay = DIV_ROUND_UP(msm_dsc_get_bytes_per_line(dsc), 3);
Which is the same value as we have here.
And then it becomes more clear how widebus affects this calculation.
- Marijn
Quoted 42 lines · Marijn Suijten
On 2023-06-23 23:10:56, Dmitry Baryshkov wrote:
<snip>Quoted 22 lines
Quoted 22 lines
Quoted 21 lines
There is no confusion between what was said earlier and now.
This line is calculating the number of pclks needed to transmit one line of the compressed data:
hdisplay =
DIV_ROUND_UP(msm_dsc_get_bytes_per_line(msm_host->dsc), 3);
msm_dsc_get_bytes_per_line()is calculating the number of compressed bytes as it uses the targetbits_per_pixel126 * @bits_per_pixel:
127 * Target bits per pixel with 4 fractional bits,bits_per_pixel<< 4
128 */
129 u16bits_per_pixel;(like I have said a few times, hdisplay is perhaps confusing us)
If you calculate the bytes this way you are already accounting for the compression, so where is the confusion.
The pclk calculation does the same thing of using the ratio instead.
Quoted 8 lines
Quoted 4 lines
This is not answering my question whether the ratio for pclk calculation should also be adjusted to account for widebus. And if the ratio is fixed, why use a fixed factor here but the ratio between src_bpp:target_bpp here? It only adds extra confusion.
Wide bus is dicussed separately. I think the question you are trying to ask is "why are we not using
msm_dsc_get_bytes_per_line()indsi_adjust_pclk_for_compression()?"I have asked that question before, and the answer was something incomprehensible. But indeed, it would look more natural if
dsi_adjust_pclk_for_compression()replaces:int new_hdisplay = DIV_ROUND_UP(mode->hdisplay * drm_dsc_get_bpp_int(dsc), dsc->bits_per_component * 3)With:
Quoted 7 lines
int new_hdisplay = DIV_ROUND_UP(msm_dsc_get_bytes_per_line(dsc), 3);Which is the same value as we have here.
And then it becomes more clear how widebus affects this calculation.
- Marijn
Ok, I finally got your question I think. That "why don't we account for widebus in the pixel clock calculation but only for calculating pclk cycles for REG_DSI_CMD_MDP_STREAM0_TOTAL"
Even though DPU shall transmit 48 bits worth of data , DSI will be able to consume only one uncompressed pixel worth of data. Thats the rule.
Hence even though we are able to account for widebus in the stream0_total to indicate DPU's increased data transfer rate with widebus, since DSI is still going to consume only one uncompressed pixel worth of data, we can only scale the pixel clock with compression ratio.
Hope that clarifies it.