summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/sun4i/sun4i_crtc.c
diff options
context:
space:
mode:
authorChen-Yu Tsai <wens@csie.org>2017-02-23 16:05:38 +0800
committerMaxime Ripard <maxime.ripard@free-electrons.com>2017-03-07 22:18:23 +0100
commitdcd215801b0279f0a021516526cf7c0b67d5302e (patch)
treefd3463cb32215a5aa15b10b974953b03aa0fac53 /drivers/gpu/drm/sun4i/sun4i_crtc.c
parent46cce6dac316a707309b374d9b6786b4269e7274 (diff)
downloadblackbird-obmc-linux-dcd215801b0279f0a021516526cf7c0b67d5302e.tar.gz
blackbird-obmc-linux-dcd215801b0279f0a021516526cf7c0b67d5302e.zip
drm/sun4i: Drop primary layer pointer from sun4i_drv
The current layer init code keeps a pointer to the primary plane layer in sun4i_drv. When we eventually support multiple display pipelines, this would force us to keep track of primary planes for all crtcs. And these pointers only get used at bind time. Instead, have the crtc init code iterate through the returned layers to find the primary and cursor layers. And drop the pointer from the sun4i_drv structure. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Diffstat (limited to 'drivers/gpu/drm/sun4i/sun4i_crtc.c')
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_crtc.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/drivers/gpu/drm/sun4i/sun4i_crtc.c b/drivers/gpu/drm/sun4i/sun4i_crtc.c
index bcc1c9533d67..81dcd5eee003 100644
--- a/drivers/gpu/drm/sun4i/sun4i_crtc.c
+++ b/drivers/gpu/drm/sun4i/sun4i_crtc.c
@@ -143,7 +143,8 @@ struct sun4i_crtc *sun4i_crtc_init(struct drm_device *drm)
{
struct sun4i_drv *drv = drm->dev_private;
struct sun4i_crtc *scrtc;
- int ret;
+ struct drm_plane *primary = NULL, *cursor = NULL;
+ int ret, i;
scrtc = devm_kzalloc(drm->dev, sizeof(*scrtc), GFP_KERNEL);
if (!scrtc)
@@ -154,12 +155,28 @@ struct sun4i_crtc *sun4i_crtc_init(struct drm_device *drm)
scrtc->layers = sun4i_layers_init(drm);
if (IS_ERR(scrtc->layers)) {
dev_err(drm->dev, "Couldn't create the planes\n");
- return ERR_CAST(scrtc->layers);
+ return NULL;
+ }
+
+ /* find primary and cursor planes for drm_crtc_init_with_planes */
+ for (i = 0; scrtc->layers[i]; i++) {
+ struct sun4i_layer *layer = scrtc->layers[i];
+
+ switch (layer->plane.type) {
+ case DRM_PLANE_TYPE_PRIMARY:
+ primary = &layer->plane;
+ break;
+ case DRM_PLANE_TYPE_CURSOR:
+ cursor = &layer->plane;
+ break;
+ default:
+ break;
+ }
}
ret = drm_crtc_init_with_planes(drm, &scrtc->crtc,
- drv->primary,
- NULL,
+ primary,
+ cursor,
&sun4i_crtc_funcs,
NULL);
if (ret) {
OpenPOWER on IntegriCloud