[PATCH 10/24] drm/msm: add the get_dsc_config callback to msm_display

From: Dmitry Baryshkov

Date: Wed Jul 22 2026 - 02:40:34 EST


dpu_encoder_get_dsc_config() special-cases INTF_DSI to fetch the DSC
config from the concrete DSI sub-block via msm_dsi_get_dsc_config().

Add a mandatory get_dsc_config() callback to struct msm_display_funcs; DSI
returns its host DSC config, DP and HDMI return NULL. The DPU encoder now
uses the generic display lookup and the callback, dropping the
interface-type special case.

No functional change intended.

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxxxxxxxx>
---
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 8 ++++----
drivers/gpu/drm/msm/dp/dp_display.c | 6 ++++++
drivers/gpu/drm/msm/dsi/dsi.c | 5 ++++-
drivers/gpu/drm/msm/hdmi/hdmi.c | 6 ++++++
drivers/gpu/drm/msm/msm_drv.h | 8 ++------
5 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
index 09bf959b2ca7..569f3759d02c 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
@@ -666,12 +666,12 @@ bool dpu_encoder_use_dsc_merge(struct drm_encoder *drm_enc)
*/
struct drm_dsc_config *dpu_encoder_get_dsc_config(struct drm_encoder *drm_enc)
{
- struct msm_drm_private *priv = drm_enc->dev->dev_private;
struct dpu_encoder_virt *dpu_enc = to_dpu_encoder_virt(drm_enc);
- int index = dpu_enc->disp_info.h_tile_instance[0];
+ struct msm_display *display = dpu_encoder_get_display(drm_enc->dev,
+ &dpu_enc->disp_info);

- if (dpu_enc->disp_info.intf_type == INTF_DSI)
- return msm_dsi_get_dsc_config(priv->kms->dsi[index]);
+ if (display)
+ return display->funcs->get_dsc_config(display);

return NULL;
}
diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
index 425526db7ef9..047295d46c02 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.c
+++ b/drivers/gpu/drm/msm/dp/dp_display.c
@@ -1374,12 +1374,18 @@ static bool msm_dp_display_is_cmd_mode(struct msm_display *display)
return false;
}

+static struct drm_dsc_config *msm_dp_display_get_dsc_config(struct msm_display *display)
+{
+ return NULL;
+}
+
static const struct msm_display_funcs msm_dp_display_funcs = {
.modeset_init = msm_dp_modeset_init,
.snapshot = msm_dp_snapshot,
.wide_bus_enabled = msm_dp_display_wide_bus_enabled,
.needs_periph_flush = msm_dp_display_needs_periph_flush,
.is_cmd_mode = msm_dp_display_is_cmd_mode,
+ .get_dsc_config = msm_dp_display_get_dsc_config,
};

struct msm_display *msm_dp_get_display(struct msm_dp *msm_dp_display)
diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c
index bda778dbcc5b..e42f5b929b84 100644
--- a/drivers/gpu/drm/msm/dsi/dsi.c
+++ b/drivers/gpu/drm/msm/dsi/dsi.c
@@ -13,8 +13,10 @@ static bool msm_dsi_is_cmd_mode(struct msm_display *display)
return !(host_flags & MIPI_DSI_MODE_VIDEO);
}

-struct drm_dsc_config *msm_dsi_get_dsc_config(struct msm_dsi *msm_dsi)
+static struct drm_dsc_config *msm_dsi_get_dsc_config(struct msm_display *display)
{
+ struct msm_dsi *msm_dsi = container_of(display, struct msm_dsi, display);
+
return msm_dsi_host_get_dsc_config(msm_dsi->host);
}

@@ -291,6 +293,7 @@ static const struct msm_display_funcs msm_dsi_display_funcs = {
.wide_bus_enabled = msm_dsi_wide_bus_enabled,
.needs_periph_flush = msm_dsi_needs_periph_flush,
.is_cmd_mode = msm_dsi_is_cmd_mode,
+ .get_dsc_config = msm_dsi_get_dsc_config,
};

struct msm_display *msm_dsi_get_display(struct msm_dsi *msm_dsi)
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c
index 828cb89ebf9a..918fc9c88a19 100644
--- a/drivers/gpu/drm/msm/hdmi/hdmi.c
+++ b/drivers/gpu/drm/msm/hdmi/hdmi.c
@@ -244,12 +244,18 @@ static bool msm_hdmi_is_cmd_mode(struct msm_display *display)
return false;
}

+static struct drm_dsc_config *msm_hdmi_get_dsc_config(struct msm_display *display)
+{
+ return NULL;
+}
+
static const struct msm_display_funcs msm_hdmi_display_funcs = {
.modeset_init = msm_hdmi_modeset_init,
.snapshot = msm_hdmi_snapshot,
.wide_bus_enabled = msm_hdmi_wide_bus_enabled,
.needs_periph_flush = msm_hdmi_needs_periph_flush,
.is_cmd_mode = msm_hdmi_is_cmd_mode,
+ .get_dsc_config = msm_hdmi_get_dsc_config,
};

struct msm_display *msm_hdmi_get_display(struct hdmi *hdmi)
diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index 5320e4977af9..cda9849811b1 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -287,6 +287,7 @@ struct msm_disp_state;
* mandatory.
* @needs_periph_flush: whether @mode requires a peripheral flush; mandatory.
* @is_cmd_mode: whether the sub-block runs in command mode; mandatory.
+ * @get_dsc_config: return the DSC config for the sub-block, or NULL; mandatory.
*/
struct msm_display_funcs {
int (*modeset_init)(struct msm_display *display, struct drm_device *dev,
@@ -297,6 +298,7 @@ struct msm_display_funcs {
bool (*needs_periph_flush)(struct msm_display *display,
const struct drm_display_mode *mode);
bool (*is_cmd_mode)(struct msm_display *display);
+ struct drm_dsc_config *(*get_dsc_config)(struct msm_display *display);
};

/**
@@ -334,7 +336,6 @@ void __exit msm_dsi_unregister(void);
struct msm_display *msm_dsi_get_display(struct msm_dsi *msm_dsi);
bool msm_dsi_is_bonded_dsi(struct msm_dsi *msm_dsi);
bool msm_dsi_is_master_dsi(struct msm_dsi *msm_dsi);
-struct drm_dsc_config *msm_dsi_get_dsc_config(struct msm_dsi *msm_dsi);
const char *msm_dsi_get_te_source(struct msm_dsi *msm_dsi);
#else
static inline void __init msm_dsi_register(void)
@@ -356,11 +357,6 @@ static inline bool msm_dsi_is_master_dsi(struct msm_dsi *msm_dsi)
return false;
}

-static inline struct drm_dsc_config *msm_dsi_get_dsc_config(struct msm_dsi *msm_dsi)
-{
- return NULL;
-}
-
static inline const char *msm_dsi_get_te_source(struct msm_dsi *msm_dsi)
{
return NULL;

--
2.47.3