drm/msm: update writeback to request max mixer of given modes
Update writeback to request max number of mixers of all given
modes specified in WB config ioctl. To support dynamic
mode/resolution change, worst case resource should be allocated
to avoid out of resource during transition.
Change-Id: I90d9f1e8461dff25fd1d36385bc580958dbc736b
Signed-off-by: Alan Kwong <akwong@codeaurora.org>
diff --git a/drivers/gpu/drm/msm/dp/dp_drm.c b/drivers/gpu/drm/msm/dp/dp_drm.c
index 254343a..170734f 100644
--- a/drivers/gpu/drm/msm/dp/dp_drm.c
+++ b/drivers/gpu/drm/msm/dp/dp_drm.c
@@ -306,7 +306,7 @@
}
int dp_connector_get_mode_info(const struct drm_display_mode *drm_mode,
- struct msm_mode_info *mode_info, u32 max_mixer_width)
+ struct msm_mode_info *mode_info, u32 max_mixer_width, void *display)
{
const u32 dual_lm = 2;
const u32 single_lm = 1;
diff --git a/drivers/gpu/drm/msm/dp/dp_drm.h b/drivers/gpu/drm/msm/dp/dp_drm.h
index 53570f5..eb78e71 100644
--- a/drivers/gpu/drm/msm/dp/dp_drm.h
+++ b/drivers/gpu/drm/msm/dp/dp_drm.h
@@ -78,11 +78,12 @@
* @drm_mode: Display mode set for the display
* @mode_info: Out parameter. Information of the mode
* @max_mixer_width: max width supported by HW layer mixer
+ * @display: Pointer to private display structure
* Returns: zero on success
*/
int dp_connector_get_mode_info(const struct drm_display_mode *drm_mode,
struct msm_mode_info *mode_info,
- u32 max_mixer_width);
+ u32 max_mixer_width, void *display);
int dp_connector_get_info(struct msm_display_info *info, void *display);
diff --git a/drivers/gpu/drm/msm/dsi-staging/dsi_drm.c b/drivers/gpu/drm/msm/dsi-staging/dsi_drm.c
index af721eb..cee667d 100644
--- a/drivers/gpu/drm/msm/dsi-staging/dsi_drm.c
+++ b/drivers/gpu/drm/msm/dsi-staging/dsi_drm.c
@@ -297,7 +297,7 @@
int dsi_conn_get_mode_info(const struct drm_display_mode *drm_mode,
struct msm_mode_info *mode_info,
- u32 max_mixer_width)
+ u32 max_mixer_width, void *display)
{
struct dsi_display_mode dsi_mode;
struct dsi_mode_info *timing;
diff --git a/drivers/gpu/drm/msm/dsi-staging/dsi_drm.h b/drivers/gpu/drm/msm/dsi-staging/dsi_drm.h
index 9700e68..828e65d 100644
--- a/drivers/gpu/drm/msm/dsi-staging/dsi_drm.h
+++ b/drivers/gpu/drm/msm/dsi-staging/dsi_drm.h
@@ -76,10 +76,12 @@
* @drm_mode: Display mode set for the display
* @mode_info: Out parameter. information of the mode.
* @max_mixer_width: max width supported by HW layer mixer
+ * @display: Pointer to private display structure
* Returns: Zero on success
*/
int dsi_conn_get_mode_info(const struct drm_display_mode *drm_mode,
- struct msm_mode_info *mode_info, u32 max_mixer_width);
+ struct msm_mode_info *mode_info, u32 max_mixer_width,
+ void *display);
/**
* dsi_conn_mode_valid - callback to determine if specified mode is valid
diff --git a/drivers/gpu/drm/msm/sde/sde_connector.h b/drivers/gpu/drm/msm/sde/sde_connector.h
index beeeb4c..35aec8c 100644
--- a/drivers/gpu/drm/msm/sde/sde_connector.h
+++ b/drivers/gpu/drm/msm/sde/sde_connector.h
@@ -134,11 +134,12 @@
* @drm_mode: Display mode set for the display
* @mode_info: Out parameter. information of the display mode
* @max_mixer_width: max width supported by HW layer mixer
+ * @display: Pointer to private display structure
* Returns: Zero on success
*/
int (*get_mode_info)(const struct drm_display_mode *drm_mode,
struct msm_mode_info *mode_info,
- u32 max_mixer_width);
+ u32 max_mixer_width, void *display);
/**
* enable_event - notify display of event registration/unregistration
diff --git a/drivers/gpu/drm/msm/sde/sde_encoder.c b/drivers/gpu/drm/msm/sde/sde_encoder.c
index 55173e3..62aff20 100644
--- a/drivers/gpu/drm/msm/sde/sde_encoder.c
+++ b/drivers/gpu/drm/msm/sde/sde_encoder.c
@@ -749,7 +749,8 @@
ret = sde_conn->ops.get_mode_info(adj_mode,
&sde_enc->mode_info,
- sde_kms->catalog->max_mixer_width);
+ sde_kms->catalog->max_mixer_width,
+ sde_conn->display);
if (ret) {
SDE_ERROR_ENC(sde_enc,
"failed to get mode info, rc = %d\n", ret);
@@ -1917,7 +1918,8 @@
sde_conn = to_sde_connector(conn);
if (sde_conn) {
ret = sde_conn->ops.get_mode_info(adj_mode, &sde_enc->mode_info,
- sde_kms->catalog->max_mixer_width);
+ sde_kms->catalog->max_mixer_width,
+ sde_conn->display);
if (ret) {
SDE_ERROR_ENC(sde_enc,
"invalid topology for the mode\n");
diff --git a/drivers/gpu/drm/msm/sde/sde_wb.c b/drivers/gpu/drm/msm/sde/sde_wb.c
index 576a8f3..80d3cdf 100644
--- a/drivers/gpu/drm/msm/sde/sde_wb.c
+++ b/drivers/gpu/drm/msm/sde/sde_wb.c
@@ -289,22 +289,30 @@
}
int sde_wb_get_mode_info(const struct drm_display_mode *drm_mode,
- struct msm_mode_info *mode_info, u32 max_mixer_width)
+ struct msm_mode_info *mode_info, u32 max_mixer_width, void *display)
{
const u32 dual_lm = 2;
const u32 single_lm = 1;
const u32 single_intf = 1;
const u32 no_enc = 0;
struct msm_display_topology *topology;
+ struct sde_wb_device *wb_dev = display;
+ u16 hdisplay;
+ int i;
- if (!drm_mode || !mode_info || !max_mixer_width) {
+ if (!drm_mode || !mode_info || !max_mixer_width || !display) {
pr_err("invalid params\n");
return -EINVAL;
}
+ hdisplay = drm_mode->hdisplay;
+
+ /* find maximum display width to support */
+ for (i = 0; i < wb_dev->count_modes; i++)
+ hdisplay = max(hdisplay, wb_dev->modes[i].hdisplay);
+
topology = &mode_info->topology;
- topology->num_lm = (max_mixer_width <= drm_mode->hdisplay) ?
- dual_lm : single_lm;
+ topology->num_lm = (max_mixer_width <= hdisplay) ? dual_lm : single_lm;
topology->num_enc = no_enc;
topology->num_intf = single_intf;
diff --git a/drivers/gpu/drm/msm/sde/sde_wb.h b/drivers/gpu/drm/msm/sde/sde_wb.h
index aa57d3e..c3f9e06 100644
--- a/drivers/gpu/drm/msm/sde/sde_wb.h
+++ b/drivers/gpu/drm/msm/sde/sde_wb.h
@@ -190,10 +190,12 @@
* @drm_mode: Display mode set for the display
* @mode_info: Out parameter. information of the mode.
* @max_mixer_width: max width supported by HW layer mixer
+ * @display: Pointer to private display structure
* Returns: zero on success
*/
int sde_wb_get_mode_info(const struct drm_display_mode *drm_mode,
- struct msm_mode_info *mode_info, u32 max_mixer_width);
+ struct msm_mode_info *mode_info, u32 max_mixer_width,
+ void *display);
/**
* sde_wb_connector_get_wb - retrieve writeback device of the given connector