[PATCH RESEND] drm/armada: Fill in GEM object for each color plane

Doug Brown doug at schmorgal.com
Thu Mar 9 23:09:30 UTC 2023


This driver uses a single GEM object even when there are multiple
planes. Starting with commit 746b9c62cc86 ("drm/gem: Ignore color planes
that are unused by framebuffer format"), multiple plane support was
broken on armada because the object pointers for the additional planes
were empty and drm_gem_plane_helper_prepare_fb was returning -EINVAL.

Restore functionality by pointing to the same GEM object on all planes.

Signed-off-by: Doug Brown <doug at schmorgal.com>
---
 drivers/gpu/drm/armada/armada_fb.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/armada/armada_fb.c b/drivers/gpu/drm/armada/armada_fb.c
index b87c71703c85..341ad4d422de 100644
--- a/drivers/gpu/drm/armada/armada_fb.c
+++ b/drivers/gpu/drm/armada/armada_fb.c
@@ -21,9 +21,10 @@ static const struct drm_framebuffer_funcs armada_fb_funcs = {
 struct armada_framebuffer *armada_framebuffer_create(struct drm_device *dev,
 	const struct drm_mode_fb_cmd2 *mode, struct armada_gem_object *obj)
 {
+	const struct drm_format_info *info = drm_get_format_info(dev, mode);
 	struct armada_framebuffer *dfb;
 	uint8_t format, config;
-	int ret;
+	int ret, i;
 
 	switch (mode->pixel_format) {
 #define FMT(drm, fmt, mod)		\
@@ -63,7 +64,8 @@ struct armada_framebuffer *armada_framebuffer_create(struct drm_device *dev,
 
 	dfb->fmt = format;
 	dfb->mod = config;
-	dfb->fb.obj[0] = &obj->obj;
+	for (i = 0; i < info->num_planes; i++)
+		dfb->fb.obj[i] = &obj->obj;
 
 	drm_helper_mode_fill_fb_struct(dev, &dfb->fb, mode);
 
@@ -79,7 +81,8 @@ struct armada_framebuffer *armada_framebuffer_create(struct drm_device *dev,
 	 * the above call, but the caller will drop their reference
 	 * to it.  Hence we need to take our own reference.
 	 */
-	drm_gem_object_get(&obj->obj);
+	for (i = 0; i < info->num_planes; i++)
+		drm_gem_object_get(&obj->obj);
 
 	return dfb;
 }
-- 
2.34.1



More information about the dri-devel mailing list