Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1586720 > unrolled thread
| Started by | Chen-Yu Tsai <wens@csie.org> |
|---|---|
| First post | 2017-02-23 09:20 +0100 |
| Last post | 2017-02-23 19:30 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 06/11] drm/sun4i: Drop primary layer pointer from sun4i_drv Chen-Yu Tsai <wens@csie.org> - 2017-02-23 09:20 +0100
Re: [PATCH 06/11] drm/sun4i: Drop primary layer pointer from sun4i_drv Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-02-23 19:30 +0100
| From | Chen-Yu Tsai <wens@csie.org> |
|---|---|
| Date | 2017-02-23 09:20 +0100 |
| Subject | [PATCH 06/11] drm/sun4i: Drop primary layer pointer from sun4i_drv |
| Message-ID | <tdWN4-731-35@gated-at.bofh.it> |
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>
---
drivers/gpu/drm/sun4i/sun4i_crtc.c | 25 +++++++++++++++++++++----
drivers/gpu/drm/sun4i/sun4i_drv.h | 1 -
drivers/gpu/drm/sun4i/sun4i_layer.c | 3 ---
3 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/sun4i/sun4i_crtc.c b/drivers/gpu/drm/sun4i/sun4i_crtc.c
index 1d01667fa45d..cb1a901bc389 100644
--- a/drivers/gpu/drm/sun4i/sun4i_crtc.c
+++ b/drivers/gpu/drm/sun4i/sun4i_crtc.c
@@ -119,7 +119,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)
@@ -130,12 +131,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) {
diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.h b/drivers/gpu/drm/sun4i/sun4i_drv.h
index 7a3345b7b6d1..5df50126ff52 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.h
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.h
@@ -20,7 +20,6 @@ struct sun4i_drv {
struct sun4i_backend *backend;
struct sun4i_tcon *tcon;
- struct drm_plane *primary;
struct drm_fbdev_cma *fbdev;
};
diff --git a/drivers/gpu/drm/sun4i/sun4i_layer.c b/drivers/gpu/drm/sun4i/sun4i_layer.c
index 0b703fb02656..9c0baee25fae 100644
--- a/drivers/gpu/drm/sun4i/sun4i_layer.c
+++ b/drivers/gpu/drm/sun4i/sun4i_layer.c
@@ -127,9 +127,6 @@ static struct sun4i_layer *sun4i_layer_init_one(struct drm_device *drm,
&sun4i_backend_layer_helper_funcs);
layer->drv = drv;
- if (plane->type == DRM_PLANE_TYPE_PRIMARY)
- drv->primary = &layer->plane;
-
return layer;
}
--
2.11.0
[toc] | [next] | [standalone]
| From | Maxime Ripard <maxime.ripard@free-electrons.com> |
|---|---|
| Date | 2017-02-23 19:30 +0100 |
| Subject | Re: [PATCH 06/11] drm/sun4i: Drop primary layer pointer from sun4i_drv |
| Message-ID | <te6jo-4Yu-7@gated-at.bofh.it> |
| In reply to | #1586720 |
[Multipart message — attachments visible in raw view] — view raw
On Thu, Feb 23, 2017 at 04:05:38PM +0800, Chen-Yu Tsai wrote: > 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> Applied, thanks! Maxime -- Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web