Skip to contentSkip to conversation

drm: Reject getfb for multi-plane framebuffers

PATCH In review Daniel Stone 4 participants 4 messages Mar 20, 2018 – Mar 21, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: Reject getfb for multi-plane framebuffers

getfb can only return a single plane, so reject attempts to use it with multi-plane framebuffers.

Fixes 308e5bcbdb10 ("drm: add an fb creation ioctl that takes a pixel format v5")

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105518

---
 drivers/gpu/drm/drm_framebuffer.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/drm_framebuffer.c +7 -0
index 7df025669067..ad67203de715 100644
@@ -462,6 +462,12 @@ int drm_mode_getfb(struct drm_device *dev,
 	if (!fb)
 		return -ENOENT;
 
+	/* Multi-planar framebuffers need getfb2. */
+	if (fb->format->num_planes > 1) {
+		ret = -EINVAL;
+		goto out;
+	}
+
 	r->height = fb->height;
 	r->width = fb->width;
 	r->depth = fb->format->depth;
@@ -485,6 +491,7 @@ int drm_mode_getfb(struct drm_device *dev,
 		ret = -ENODEV;
 	}
 
+out:
 	drm_framebuffer_put(fb);
 
 	return ret;
Signature · 6 lines
2.16.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Daniel Stone

getfb can only return a single plane, so reject attempts to use it with multi-plane framebuffers.

yeah, this seems like a pretty good idea,

Quoted 36 lines
Fixes 308e5bcbdb10 ("drm: add an fb creation ioctl that takes a pixel format v5")

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105518

---
 drivers/gpu/drm/drm_framebuffer.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/drm_framebuffer.c +7 -1
index 7df025669067..ad67203de715 100644
@@ -462,6 +462,12 @@ int drm_mode_getfb(struct drm_device *dev,
        if (!fb)
                return -ENOENT;
 
+       /* Multi-planar framebuffers need getfb2. */
+       if (fb->format->num_planes > 1) {
+               ret = -EINVAL;
+               goto out;
+       }
+
        r->height = fb->height;
        r->width = fb->width;
        r->depth = fb->format->depth;
@@ -485,6 +491,7 @@ int drm_mode_getfb(struct drm_device *dev,
                ret = -ENODEV;
        }
 
+out:
        drm_framebuffer_put(fb);
 
        return ret;
--

2.16.2

Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reviewed-by
#2 lore raw
Quoted 13 lines · Rob Clark
Quoted 3 lines · Daniel Stone

getfb can only return a single plane, so reject attempts to use it with multi-plane framebuffers.

yeah, this seems like a pretty good idea,

Quoted 4 lines
Fixes 308e5bcbdb10 ("drm: add an fb creation ioctl that takes a pixel format v5")

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105518

Please push to drm-misc-fixes and poke Gustavo to do a pull so it's not lost.
-Daniel

Quoted 40 lines
Quoted 32 lines
---
 drivers/gpu/drm/drm_framebuffer.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/drm_framebuffer.c +7 -1
index 7df025669067..ad67203de715 100644
@@ -462,6 +462,12 @@ int drm_mode_getfb(struct drm_device *dev,
        if (!fb)
                return -ENOENT;
 
+       /* Multi-planar framebuffers need getfb2. */
+       if (fb->format->num_planes > 1) {
+               ret = -EINVAL;
+               goto out;
+       }
+
        r->height = fb->height;
        r->width = fb->width;
        r->depth = fb->format->depth;
@@ -485,6 +491,7 @@ int drm_mode_getfb(struct drm_device *dev,
                ret = -ENODEV;
        }
 
+out:
        drm_framebuffer_put(fb);
 
        return ret;
--

2.16.2

Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw

Hi,

Quoted 15 lines · Daniel Vetter
Quoted 13 lines · Rob Clark
Quoted 3 lines · Daniel Stone

getfb can only return a single plane, so reject attempts to use it with multi-plane framebuffers.

yeah, this seems like a pretty good idea,

Quoted 4 lines
Fixes 308e5bcbdb10 ("drm: add an fb creation ioctl that takes a pixel format v5")

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105518

Quoted 5 lines

Please push to drm-misc-fixes and poke Gustavo to do a pull so it's not lost.

Thanks both, I've pushed now. I suspect Gustavo is still on a plane somewhere, but poked nevertheless.

Cheers,
aniel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel