[PATCH] drm: Reject getfb for multi-plane framebuffers
Rob Clark
robdclark at gmail.com
Wed Mar 21 01:01:11 UTC 2018
On Tue, Mar 20, 2018 at 6:58 PM, Daniel Stone <daniels at collabora.com> wrote:
> 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,
Reviewed-by: Rob Clark <robdclark at gmail.com>
> Signed-off-by: Daniel Stone <daniels at collabora.com>
> Reported-by: Daniel van Vugt <daniel.van.vugt at canonical.com>
> 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(+)
>
> diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
> index 7df025669067..ad67203de715 100644
> --- a/drivers/gpu/drm/drm_framebuffer.c
> +++ b/drivers/gpu/drm/drm_framebuffer.c
> @@ -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
>
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
More information about the dri-devel
mailing list