aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/omapdrm/omap_drv.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2018-03-06 17:01:33 -0500
committerTomi Valkeinen <tomi.valkeinen@ti.com>2018-09-03 09:13:28 -0400
commite48f9f16a16a6ee1befda6d8e5486234ac3a5162 (patch)
tree0b8b7959b8e8c9dd884044dcaad2a568a548af66 /drivers/gpu/drm/omapdrm/omap_drv.c
parent00b30e794ffc3bd8f4c6dc357fe7e881ae6e5373 (diff)
drm/omap: Store CRTC lookup by channel table in omap_drm_private
The omap_crtcs global array is used to store pointers to omap_crtc indexed by DISPC channel number, in order to look them up in the dss_mgr operations. Store the information in the omap_drm_private structure in the form of an array of omap_drm_pipeline pointers. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/gpu/drm/omapdrm/omap_drv.c')
-rw-r--r--drivers/gpu/drm/omapdrm/omap_drv.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index bb9ee2c93eca..f2a69cfb6ebf 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -167,6 +167,8 @@ static void omap_disconnect_pipelines(struct drm_device *ddev)
167 pipe->display = NULL; 167 pipe->display = NULL;
168 } 168 }
169 169
170 memset(&priv->channels, 0, sizeof(priv->channels));
171
170 priv->num_pipes = 0; 172 priv->num_pipes = 0;
171} 173}
172 174
@@ -186,6 +188,7 @@ static int omap_connect_pipelines(struct drm_device *ddev)
186{ 188{
187 struct omap_drm_private *priv = ddev->dev_private; 189 struct omap_drm_private *priv = ddev->dev_private;
188 struct omap_dss_device *output = NULL; 190 struct omap_dss_device *output = NULL;
191 unsigned int i;
189 int r; 192 int r;
190 193
191 if (!omapdss_stack_is_ready()) 194 if (!omapdss_stack_is_ready())
@@ -218,6 +221,22 @@ static int omap_connect_pipelines(struct drm_device *ddev)
218 sort(priv->pipes, priv->num_pipes, sizeof(priv->pipes[0]), 221 sort(priv->pipes, priv->num_pipes, sizeof(priv->pipes[0]),
219 omap_compare_pipes, NULL); 222 omap_compare_pipes, NULL);
220 223
224 /*
225 * Populate the pipeline lookup table by DISPC channel. Only one display
226 * is allowed per channel.
227 */
228 for (i = 0; i < priv->num_pipes; ++i) {
229 struct omap_drm_pipeline *pipe = &priv->pipes[i];
230 enum omap_channel channel = pipe->output->dispc_channel;
231
232 if (WARN_ON(priv->channels[channel] != NULL)) {
233 r = -EINVAL;
234 goto cleanup;
235 }
236
237 priv->channels[channel] = pipe;
238 }
239
221 return 0; 240 return 0;
222 241
223cleanup: 242cleanup: