drm/msm/dsi: set VIDEO_COMPRESSION_MODE_CTRL_WC (fix video mode DSC)
Subsystems (4)
PATCH 1/4 drm/msm/dsi: set VIDEO_COMPRESSION_MODE_CTRL_WC (fix video mode DSC)
Video mode DSC won't work if this field is not set correctly. Set it to fix video mode DSC (for slice_per_pkt==1 cases at least).
--- drivers/gpu/drm/msm/dsi/dsi_host.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/msm/dsi/dsi_host.c +3 -0
@@ -847,6 +847,7 @@ static void dsi_update_dsc_timing(struct msm_dsi_host *msm_host, bool is_cmd_modu32 slice_per_intf, total_bytes_per_intf;u32 pkt_per_line;u32 eol_byte_num; +u32 bytes_per_pkt;/* first calculate dsc parameters and then program * compress mode registers
@@ -854,6 +855,7 @@ static void dsi_update_dsc_timing(struct msm_dsi_host *msm_host, bool is_cmd_mod slice_per_intf =msm_dsc_get_slices_per_intf (dsc, hdisplay); total_bytes_per_intf = dsc->slice_chunk_size * slice_per_intf; + bytes_per_pkt = dsc->slice_chunk_size;/* * slice_per_pkt; */ eol_byte_num = total_bytes_per_intf %3 ;
@@ -891,6 +893,7 @@ static void dsi_update_dsc_timing(struct msm_dsi_host *msm_host, bool is_cmd_moddsi_write (msm_host,REG_DSI_COMMAND_COMPRESSION_MODE_CTRL , reg_ctrl);dsi_write (msm_host,REG_DSI_COMMAND_COMPRESSION_MODE_CTRL2 , reg_ctrl2); }else { + reg |=DSI_VIDEO_COMPRESSION_MODE_CTRL_WC (bytes_per_pkt);dsi_write (msm_host,REG_DSI_VIDEO_COMPRESSION_MODE_CTRL , reg); } }
Signature · 1 line
2.26.1
PATCH 2/4 drm/msm/dsi: add a comment to explain pkt_per_line encoding
Make it clear why the pkt_per_line value is being "divided by 2".
--- drivers/gpu/drm/msm/dsi/dsi_host.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/msm/dsi/dsi_host.c +2 -0
@@ -875,6 +875,8 @@ static void dsi_update_dsc_timing(struct msm_dsi_host *msm_host, bool is_cmd_mod/* DSI_VIDEO_COMPRESSION_MODE & DSI_COMMAND_COMPRESSION_MODE * registers have similar offsets, so for below common code use * DSI_VIDEO_COMPRESSION_MODE_XXXX for setting bits +* +* pkt_per_line is log2 encoded, >>1 works for supported values (1,2,4) */ reg |=DSI_VIDEO_COMPRESSION_MODE_CTRL_PKT_PER_LINE (pkt_per_line >>1 ); reg |=DSI_VIDEO_COMPRESSION_MODE_CTRL_EOL_BYTE_NUM (eol_byte_num);
Signature · 1 line
2.26.1
PATCH 3/4 drm/msm/dsi: support DSC configurations with slice_per_pkt > 1
In reply to Jonathan MarekAdd a dsc_slice_per_pkt field to mipi_dsi_device struct and the necessary changes to msm driver to support this field.
Note that the removed "pkt_per_line = slice_per_intf * slice_per_pkt" comment is incorrect.
--- drivers/gpu/drm/msm/dsi/dsi_host.c | 25 ++++++++++--------------- include/drm/drm_mipi_dsi.h | 1 + 2 files changed, 11 insertions(+), 15 deletions(-)
drivers/gpu/drm/msm/dsi/dsi_host.c +10 -15
@@ -161,6 +161,7 @@ struct msm_dsi_host {struct drm_display_mode *mode;struct drm_dsc_config *dsc; +unsigned int dsc_slice_per_pkt;/* connected device info */ unsigned int channel;
@@ -855,17 +856,10 @@ static void dsi_update_dsc_timing(struct msm_dsi_host *msm_host, bool is_cmd_mod slice_per_intf =msm_dsc_get_slices_per_intf (dsc, hdisplay); total_bytes_per_intf = dsc->slice_chunk_size * slice_per_intf; - bytes_per_pkt = dsc->slice_chunk_size;/* * slice_per_pkt; */ + bytes_per_pkt = dsc->slice_chunk_size * msm_host->dsc_slice_per_pkt; eol_byte_num = total_bytes_per_intf %3 ; - -/* -* Typically, pkt_per_line = slice_per_intf * slice_per_pkt. -* -* Since the current driver only supports slice_per_pkt = 1, -* pkt_per_line will be equal to slice per intf for now. -*/ - pkt_per_line = slice_per_intf; + pkt_per_line = slice_per_intf / msm_host->dsc_slice_per_pkt;if (is_cmd_mode)/* packet data type */ reg =DSI_COMMAND_COMPRESSION_MODE_CTRL_STREAM0_DATATYPE (MIPI_DSI_DCS_LONG_WRITE );
@@ -1002,12 +996,8 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi)else /* * When DSC is enabled, WC = slice_chunk_size * slice_per_pkt + 1. -* Currently, the driver only supports default value of slice_per_pkt = 1 -* -* TODO: Expand mipi_dsi_device struct to hold slice_per_pkt info -* and adjust DSC math to account for slice_per_pkt. */ - wc = msm_host->dsc->slice_chunk_size +1 ; + wc = msm_host->dsc->slice_chunk_size * msm_host->dsc_slice_per_pkt +1 ; dsi_write(msm_host, REG_DSI_CMD_MDP_STREAM0_CTRL, DSI_CMD_MDP_STREAM0_CTRL_WORD_COUNT(wc) |
@@ -1634,8 +1624,13 @@ static int dsi_host_attach(struct mipi_dsi_host *host, msm_host->lanes = dsi->lanes; msm_host->format = dsi->format; msm_host->mode_flags = dsi->mode_flags; -if (dsi->dsc) +if (dsi->dsc) { msm_host->dsc = dsi->dsc; + msm_host->dsc_slice_per_pkt = dsi->dsc_slice_per_pkt; +/* for backwards compatibility, assume 1 if not set */ +if (!msm_host->dsc_slice_per_pkt) + msm_host->dsc_slice_per_pkt =1 ; + }/* Some gpios defined in panel DT need to be controlled by host */ ret =dsi_host_init_panel_gpios (msm_host, &dsi->dev);
include/drm/drm_mipi_dsi.h +1 -0
@@ -193,6 +193,7 @@ struct mipi_dsi_device {unsigned long hs_rate;unsigned long lp_rate;struct drm_dsc_config *dsc; +unsigned int dsc_slice_per_pkt; };#define MIPI_DSI_MODULE_PREFIX "mipi-dsi:"
Signature · 1 line
2.26.1
PATCH 4/4 drm/msm/dsi: fix DSC for the bonded DSI case
In reply to Jonathan MarekFor the bonded DSI case, DSC pic_width and timing calculations should use the width of a single panel instead of the total combined width.
--- drivers/gpu/drm/msm/dsi/dsi.h | 3 ++- drivers/gpu/drm/msm/dsi/dsi_host.c | 20 +++++++++++--------- drivers/gpu/drm/msm/dsi/dsi_manager.c | 2 +- 3 files changed, 14 insertions(+), 11 deletions(-)
drivers/gpu/drm/msm/dsi/dsi.h +2 -1
@@ -93,7 +93,8 @@ int msm_dsi_host_power_off(struct mipi_dsi_host *host);int msm_dsi_host_set_display_mode (struct mipi_dsi_host *host,const struct drm_display_mode *mode);enum drm_mode_status msm_dsi_host_check_dsc (struct mipi_dsi_host *host, -const struct drm_display_mode *mode); +const struct drm_display_mode *mode, +bool is_bonded_dsi);unsigned long msm_dsi_host_get_mode_flags (struct mipi_dsi_host *host);int msm_dsi_host_register (struct mipi_dsi_host *host);void msm_dsi_host_unregister (struct mipi_dsi_host *host);
drivers/gpu/drm/msm/dsi/dsi_host.c +11 -9
@@ -938,8 +938,7 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi) mode->hdisplay, mode->vdisplay);return ; } - - dsc->pic_width = mode->hdisplay; + dsc->pic_width = hdisplay; dsc->pic_height = mode->vdisplay;DBG ("Mode %dx%d\n" , dsc->pic_width, dsc->pic_height);
@@ -950,6 +949,11 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi)if (ret)return ; +if (msm_host->mode_flags &MIPI_DSI_MODE_VIDEO ) +dsi_update_dsc_timing (msm_host, false, hdisplay); +else +dsi_update_dsc_timing (msm_host, true, hdisplay); +/* Divide the display by 3 but keep back/font porch and * pulse width same */
@@ -966,9 +970,6 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi) }if (msm_host->mode_flags &MIPI_DSI_MODE_VIDEO ) { -if (msm_host->dsc) -dsi_update_dsc_timing (msm_host, false, mode->hdisplay); -dsi_write (msm_host,REG_DSI_ACTIVE_H ,DSI_ACTIVE_H_START (ha_start) |DSI_ACTIVE_H_END (ha_end));
@@ -987,9 +988,6 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi)DSI_ACTIVE_VSYNC_VPOS_START (vs_start) | DSI_ACTIVE_VSYNC_VPOS_END(vs_end)); }else {/* command mode */ -if (msm_host->dsc) -dsi_update_dsc_timing (msm_host, true, mode->hdisplay); -/* image data and 1 byte write_memory_start cmd */ if (!msm_host->dsc) wc = hdisplay *dsi_get_bpp (msm_host->format) /8 +1 ;
@@ -2487,7 +2485,8 @@ int msm_dsi_host_set_display_mode(struct mipi_dsi_host *host, }enum drm_mode_status msm_dsi_host_check_dsc (struct mipi_dsi_host *host, -const struct drm_display_mode *mode) +const struct drm_display_mode *mode, +bool is_bonded_dsi) {struct msm_dsi_host *msm_host =to_msm_dsi_host (host);struct drm_dsc_config *dsc = msm_host->dsc;
@@ -2497,6 +2496,9 @@ enum drm_mode_status msm_dsi_host_check_dsc(struct mipi_dsi_host *host,if (!msm_host->dsc)return MODE_OK ; +if (is_bonded_dsi) + pic_width = mode->hdisplay /2 ; +if (pic_width % dsc->slice_width) {pr_err ("DSI: pic_width %d has to be multiple of slice %d\n" , pic_width, dsc->slice_width);
drivers/gpu/drm/msm/dsi/dsi_manager.c +1 -1
@@ -455,7 +455,7 @@ static enum drm_mode_status dsi_mgr_bridge_mode_valid(struct drm_bridge *bridge,return MODE_ERROR ; } -return msm_dsi_host_check_dsc (host, mode); +return msm_dsi_host_check_dsc (host, mode,IS_BONDED_DSI ()); }static const struct drm_bridge_funcs dsi_mgr_bridge_funcs = {
Signature · 1 line
2.26.1
Marijn Suijten
reviewerRe: [PATCH 4/4] drm/msm/dsi: fix DSC for the bonded DSI case
On what hardware have you been testing this? Dmitry and I have a stack of patches to resolve support for Active CTL programming on newer hardware (DPU 5.0+ IIRC), where a single CTL is responsible for programming multiple INTF and DSC blocks as used in bonded DSI.
Quoted 29 lines · Jonathan Marek
For the bonded DSI case, DSC
pic_widthand timing calculations should use the width of a single panel instead of the total combined width.Signed-off-by Jonathan Marek <[email protected]>--- drivers/gpu/drm/msm/dsi/dsi.h | 3 ++- drivers/gpu/drm/msm/dsi/dsi_host.c | 20 +++++++++++--------- drivers/gpu/drm/msm/dsi/dsi_manager.c | 2 +- 3 files changed, 14 insertions(+), 11 deletions(-)drivers/gpu/drm/msm/dsi/dsi.h +2
-1@@ -93,7 +93,8 @@ int msm_dsi_host_power_off(struct mipi_dsi_host *host);int msm_dsi_host_set_display_mode (struct mipi_dsi_host *host,const struct drm_display_mode *mode);enum drm_mode_status msm_dsi_host_check_dsc (struct mipi_dsi_host *host, -const struct drm_display_mode *mode); +const struct drm_display_mode *mode, +bool is_bonded_dsi);unsigned long msm_dsi_host_get_mode_flags (struct mipi_dsi_host *host);int msm_dsi_host_register (struct mipi_dsi_host *host);void msm_dsi_host_unregister (struct mipi_dsi_host *host);drivers/gpu/drm/msm/dsi/dsi_host.c +0
-0
drivers/gpu/drm/msm/dsi/dsi_host.c static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi) · line 941
Quoted 6 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +1
-2@@ -938,8 +938,7 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi) mode->hdisplay, mode->vdisplay);return ; } - - dsc->pic_width = mode->hdisplay; + dsc->pic_width = hdisplay;
In my testing and debugging on CMDmode panels downstream this value/register was always programmed to the _full_ width of the bonded panel. Is that maybe different for video mode?
drivers/gpu/drm/msm/dsi/dsi_host.c static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi) · line 956
Quoted 12 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +5
-0dsc->pic_height = mode->vdisplay;DBG ("Mode %dx%d\n" , dsc->pic_width, dsc->pic_height);@@ -950,6 +949,11 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi)if (ret)return ; +if (msm_host->mode_flags &MIPI_DSI_MODE_VIDEO ) +dsi_update_dsc_timing (msm_host, false, hdisplay); +else +dsi_update_dsc_timing (msm_host, true, hdisplay); +
Such cleanups (which appear unrelated) should probably be posted as separate patches.
- Marijn
Quoted 59 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +5
-7/* Divide the display by 3 but keep back/font porch and * pulse width same */ @@ -966,9 +970,6 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi) }if (msm_host->mode_flags &MIPI_DSI_MODE_VIDEO ) { -if (msm_host->dsc) -dsi_update_dsc_timing (msm_host, false, mode->hdisplay); -dsi_write (msm_host,REG_DSI_ACTIVE_H ,DSI_ACTIVE_H_START (ha_start) |DSI_ACTIVE_H_END (ha_end));@@ -987,9 +988,6 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi)DSI_ACTIVE_VSYNC_VPOS_START (vs_start) | DSI_ACTIVE_VSYNC_VPOS_END(vs_end)); }else {/* command mode */ -if (msm_host->dsc) -dsi_update_dsc_timing (msm_host, true, mode->hdisplay); -/* image data and 1 byte write_memory_start cmd */ if (!msm_host->dsc) wc = hdisplay *dsi_get_bpp (msm_host->format) /8 +1 ;@@ -2487,7 +2485,8 @@ int msm_dsi_host_set_display_mode(struct mipi_dsi_host *host, }enum drm_mode_status msm_dsi_host_check_dsc (struct mipi_dsi_host *host, -const struct drm_display_mode *mode) +const struct drm_display_mode *mode, +bool is_bonded_dsi) {struct msm_dsi_host *msm_host =to_msm_dsi_host (host);struct drm_dsc_config *dsc = msm_host->dsc;@@ -2497,6 +2496,9 @@ enum drm_mode_status msm_dsi_host_check_dsc(struct mipi_dsi_host *host,if (!msm_host->dsc)return MODE_OK ; +if (is_bonded_dsi) + pic_width = mode->hdisplay /2 ; +if (pic_width % dsc->slice_width) {pr_err ("DSI: pic_width %d has to be multiple of slice %d\n" , pic_width, dsc->slice_width);drivers/gpu/drm/msm/dsi/dsi_manager.c +1
-1@@ -455,7 +455,7 @@ static enum drm_mode_status dsi_mgr_bridge_mode_valid(struct drm_bridge *bridge,return MODE_ERROR ; } -return msm_dsi_host_check_dsc (host, mode); +return msm_dsi_host_check_dsc (host, mode,IS_BONDED_DSI ()); }static const struct drm_bridge_funcs dsi_mgr_bridge_funcs = {Signature · 1 line
2.26.1
Re: [PATCH 4/4] drm/msm/dsi: fix DSC for the bonded DSI case
Quoted 5 lines · Marijn Suijten
On what hardware have you been testing this? Dmitry and I have a stack of patches to resolve support for Active CTL programming on newer hardware (DPU 5.0+ IIRC), where a single CTL is responsible for programming multiple INTF and DSC blocks as used in bonded DSI.
I am also using DPU 6+ but I won't be posting patches for DPU to support this as I am not using the upstream DPU codebase.
Quoted 32 lines · Jonathan Marek
Quoted 31 lines
For the bonded DSI case, DSC
pic_widthand timing calculations should use the width of a single panel instead of the total combined width.Signed-off-by Jonathan Marek <[email protected]>--- drivers/gpu/drm/msm/dsi/dsi.h | 3 ++- drivers/gpu/drm/msm/dsi/dsi_host.c | 20 +++++++++++--------- drivers/gpu/drm/msm/dsi/dsi_manager.c | 2 +- 3 files changed, 14 insertions(+), 11 deletions(-)drivers/gpu/drm/msm/dsi/dsi.h +2
-1@@ -93,7 +93,8 @@ int msm_dsi_host_power_off(struct mipi_dsi_host *host);int msm_dsi_host_set_display_mode (struct mipi_dsi_host *host,const struct drm_display_mode *mode);enum drm_mode_status msm_dsi_host_check_dsc (struct mipi_dsi_host *host, -const struct drm_display_mode *mode); +const struct drm_display_mode *mode, +bool is_bonded_dsi);unsigned long msm_dsi_host_get_mode_flags (struct mipi_dsi_host *host);int msm_dsi_host_register (struct mipi_dsi_host *host);void msm_dsi_host_unregister (struct mipi_dsi_host *host);drivers/gpu/drm/msm/dsi/dsi_host.c +0
-0@@ -938,8 +938,7 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi) mode->hdisplay, mode->vdisplay);return ;
Quoted 9 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 941
Quoted 4 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +1
-2} - - dsc->pic_width = mode->hdisplay; + dsc->pic_width = hdisplay;In my testing and debugging on CMDmode panels downstream this value/register was always programmed to the _full_ width of the bonded panel. Is that maybe different for video mode?
downstream dual DSI panel timings are specified for a single panel ("qcom,mdss-dsi-panel-width" is for a single panel, not both panels)
Quoted 16 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 956
Quoted 12 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +5
-0dsc->pic_height = mode->vdisplay;DBG ("Mode %dx%d\n" , dsc->pic_width, dsc->pic_height);@@ -950,6 +949,11 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi)if (ret)return ; +if (msm_host->mode_flags &MIPI_DSI_MODE_VIDEO ) +dsi_update_dsc_timing (msm_host, false, hdisplay); +else +dsi_update_dsc_timing (msm_host, true, hdisplay); +Such cleanups (which appear unrelated) should probably be posted as separate patches.
Quoted 2 lines
- Marijn
Its not unrelated, dsi_update_dsc_timing call is moved up so it can use the single-panel "hdisplay" value before it gets adjusted for DSC.
Quoted 59 lines
Quoted 59 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +5
-7/* Divide the display by 3 but keep back/font porch and * pulse width same */ @@ -966,9 +970,6 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi) }if (msm_host->mode_flags &MIPI_DSI_MODE_VIDEO ) { -if (msm_host->dsc) -dsi_update_dsc_timing (msm_host, false, mode->hdisplay); -dsi_write (msm_host,REG_DSI_ACTIVE_H ,DSI_ACTIVE_H_START (ha_start) |DSI_ACTIVE_H_END (ha_end));@@ -987,9 +988,6 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi)DSI_ACTIVE_VSYNC_VPOS_START (vs_start) | DSI_ACTIVE_VSYNC_VPOS_END(vs_end)); }else {/* command mode */ -if (msm_host->dsc) -dsi_update_dsc_timing (msm_host, true, mode->hdisplay); -/* image data and 1 byte write_memory_start cmd */ if (!msm_host->dsc) wc = hdisplay *dsi_get_bpp (msm_host->format) /8 +1 ;@@ -2487,7 +2485,8 @@ int msm_dsi_host_set_display_mode(struct mipi_dsi_host *host, }enum drm_mode_status msm_dsi_host_check_dsc (struct mipi_dsi_host *host, -const struct drm_display_mode *mode) +const struct drm_display_mode *mode, +bool is_bonded_dsi) {struct msm_dsi_host *msm_host =to_msm_dsi_host (host);struct drm_dsc_config *dsc = msm_host->dsc;@@ -2497,6 +2496,9 @@ enum drm_mode_status msm_dsi_host_check_dsc(struct mipi_dsi_host *host,if (!msm_host->dsc)return MODE_OK ; +if (is_bonded_dsi) + pic_width = mode->hdisplay /2 ; +if (pic_width % dsc->slice_width) {pr_err ("DSI: pic_width %d has to be multiple of slice %d\n" , pic_width, dsc->slice_width);drivers/gpu/drm/msm/dsi/dsi_manager.c +1
-1@@ -455,7 +455,7 @@ static enum drm_mode_status dsi_mgr_bridge_mode_valid(struct drm_bridge *bridge,return MODE_ERROR ; } -return msm_dsi_host_check_dsc (host, mode); +return msm_dsi_host_check_dsc (host, mode,IS_BONDED_DSI ()); }static const struct drm_bridge_funcs dsi_mgr_bridge_funcs = {Signature · 1 line
2.26.1
Marijn Suijten
reviewerRe: [PATCH 4/4] drm/msm/dsi: fix DSC for the bonded DSI case
Quoted 9 lines · Jonathan Marek
Quoted 5 lines · Marijn Suijten
On what hardware have you been testing this? Dmitry and I have a stack of patches to resolve support for Active CTL programming on newer hardware (DPU 5.0+ IIRC), where a single CTL is responsible for programming multiple INTF and DSC blocks as used in bonded DSI.
I am also using DPU 6+ but I won't be posting patches for DPU to support this as I am not using the upstream DPU codebase.
Oh that is an odd situation! At least glad to hear we aren't completely duplicating our efforts :)
Quoted 42 lines
Quoted 32 lines · Jonathan Marek
Quoted 31 lines
For the bonded DSI case, DSC
pic_widthand timing calculations should use the width of a single panel instead of the total combined width.Signed-off-by Jonathan Marek <[email protected]>--- drivers/gpu/drm/msm/dsi/dsi.h | 3 ++- drivers/gpu/drm/msm/dsi/dsi_host.c | 20 +++++++++++--------- drivers/gpu/drm/msm/dsi/dsi_manager.c | 2 +- 3 files changed, 14 insertions(+), 11 deletions(-)drivers/gpu/drm/msm/dsi/dsi.h +2
-1@@ -93,7 +93,8 @@ int msm_dsi_host_power_off(struct mipi_dsi_host *host);int msm_dsi_host_set_display_mode (struct mipi_dsi_host *host,const struct drm_display_mode *mode);enum drm_mode_status msm_dsi_host_check_dsc (struct mipi_dsi_host *host, -const struct drm_display_mode *mode); +const struct drm_display_mode *mode, +bool is_bonded_dsi);unsigned long msm_dsi_host_get_mode_flags (struct mipi_dsi_host *host);int msm_dsi_host_register (struct mipi_dsi_host *host);void msm_dsi_host_unregister (struct mipi_dsi_host *host);drivers/gpu/drm/msm/dsi/dsi_host.c +0
-0@@ -938,8 +938,7 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi) mode->hdisplay, mode->vdisplay);return ;Quoted 9 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 941
Quoted 4 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +1
-2} - - dsc->pic_width = mode->hdisplay; + dsc->pic_width = hdisplay;In my testing and debugging on CMDmode panels downstream this value/register was always programmed to the _full_ width of the bonded panel. Is that maybe different for video mode?
Quoted 2 lines
downstream dual DSI panel timings are specified for a single panel ("qcom,mdss-dsi-panel-width" is for a single panel, not both panels)
_dual panels_? In my case I have a "single panel" that is driven by two "bonded" DSI hosts, just to achieve enough bandwidth.
Indeed my downstream DTS has qcom,mdss-dsi-panel-width set to half the total panel width, but I recall seeing the full width in the register dump. I'll scan through my logs and see if I can back this up.
Quoted 11 lines
Quoted 11 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 955
Quoted 11 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +4
-0dsc->pic_height = mode->vdisplay;DBG ("Mode %dx%d\n" , dsc->pic_width, dsc->pic_height);@@ -950,6 +949,11 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi)if (ret)return ; +if (msm_host->mode_flags &MIPI_DSI_MODE_VIDEO ) +dsi_update_dsc_timing (msm_host, false, hdisplay); +else +dsi_update_dsc_timing (msm_host, true, hdisplay);
Another thought: it's probably clearer to write:
bool is_cmd_mode = msm_host->mode_flags & MIPI_DSI_MODE_VIDEO; dsi_update_dsc_timing(msm_host, is_cmd_mode, hdisplay);
Quoted 10 lines
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 956
Quoted 1 line
drivers/gpu/drm/msm/dsi/dsi_host.c +1
-0+Such cleanups (which appear unrelated) should probably be posted as separate patches.
- Marijn
Its not unrelated,
dsi_update_dsc_timingcall is moved up so it can use the single-panel "hdisplay" value before it gets adjusted for DSC.
This reply was mostly expected after not looking at the original code folded in the diff, and pretty much solidifies my point: it's a hidden semantical change that's not immediately obvious from reading the patch, and why I'd like to see this split up in a few smaller patches.
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +0
-3/* Divide the display by 3 but keep back/font porch and * pulse width same */ @@ -966,9 +970,6 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi) }if (msm_host->mode_flags &MIPI_DSI_MODE_VIDEO ) { -if (msm_host->dsc) -dsi_update_dsc_timing (msm_host, false, mode->hdisplay); -dsi_write (msm_host,REG_DSI_ACTIVE_H ,DSI_ACTIVE_H_START (ha_start) |DSI_ACTIVE_H_END (ha_end));@@ -987,9 +988,6 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi) DSI_ACTIVE_VSYNC_VPOS_START(vs_start) |
Quoted 8 lines
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 993
Quoted 8 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +0
-3DSI_ACTIVE_VSYNC_VPOS_END(vs_end)); }else {/* command mode */ -if (msm_host->dsc) -dsi_update_dsc_timing (msm_host, true, mode->hdisplay); -/* image data and 1 byte write_memory_start cmd */ if (!msm_host->dsc) wc = hdisplay *dsi_get_bpp (msm_host->format) /8 +1 ;
Regarding another patch: cmdmode calculates and uses word count here, but video mode does it as part of timing calculations?
- Marijn
Quoted 36 lines
Quoted 36 lines
Quoted 36 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +5
-1@@ -2487,7 +2485,8 @@ int msm_dsi_host_set_display_mode(struct mipi_dsi_host *host, }enum drm_mode_status msm_dsi_host_check_dsc (struct mipi_dsi_host *host, -const struct drm_display_mode *mode) +const struct drm_display_mode *mode, +bool is_bonded_dsi) {struct msm_dsi_host *msm_host =to_msm_dsi_host (host);struct drm_dsc_config *dsc = msm_host->dsc;@@ -2497,6 +2496,9 @@ enum drm_mode_status msm_dsi_host_check_dsc(struct mipi_dsi_host *host,if (!msm_host->dsc)return MODE_OK ; +if (is_bonded_dsi) + pic_width = mode->hdisplay /2 ; +if (pic_width % dsc->slice_width) {pr_err ("DSI: pic_width %d has to be multiple of slice %d\n" , pic_width, dsc->slice_width);drivers/gpu/drm/msm/dsi/dsi_manager.c +1
-1@@ -455,7 +455,7 @@ static enum drm_mode_status dsi_mgr_bridge_mode_valid(struct drm_bridge *bridge,return MODE_ERROR ; } -return msm_dsi_host_check_dsc (host, mode); +return msm_dsi_host_check_dsc (host, mode,IS_BONDED_DSI ()); }static const struct drm_bridge_funcs dsi_mgr_bridge_funcs = {Signature · 1 line
2.26.1