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>
This commit is contained in:

committed by
Tomi Valkeinen

parent
00b30e794f
commit
e48f9f16a1
@@ -167,6 +167,8 @@ static void omap_disconnect_pipelines(struct drm_device *ddev)
|
||||
pipe->display = NULL;
|
||||
}
|
||||
|
||||
memset(&priv->channels, 0, sizeof(priv->channels));
|
||||
|
||||
priv->num_pipes = 0;
|
||||
}
|
||||
|
||||
@@ -186,6 +188,7 @@ static int omap_connect_pipelines(struct drm_device *ddev)
|
||||
{
|
||||
struct omap_drm_private *priv = ddev->dev_private;
|
||||
struct omap_dss_device *output = NULL;
|
||||
unsigned int i;
|
||||
int r;
|
||||
|
||||
if (!omapdss_stack_is_ready())
|
||||
@@ -218,6 +221,22 @@ static int omap_connect_pipelines(struct drm_device *ddev)
|
||||
sort(priv->pipes, priv->num_pipes, sizeof(priv->pipes[0]),
|
||||
omap_compare_pipes, NULL);
|
||||
|
||||
/*
|
||||
* Populate the pipeline lookup table by DISPC channel. Only one display
|
||||
* is allowed per channel.
|
||||
*/
|
||||
for (i = 0; i < priv->num_pipes; ++i) {
|
||||
struct omap_drm_pipeline *pipe = &priv->pipes[i];
|
||||
enum omap_channel channel = pipe->output->dispc_channel;
|
||||
|
||||
if (WARN_ON(priv->channels[channel] != NULL)) {
|
||||
r = -EINVAL;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
priv->channels[channel] = pipe;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
cleanup:
|
||||
|
Reference in New Issue
Block a user