Re: [PATCH 7/7] drm: plane: Check that the fb pixel format is supported by the plane

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 11 Nov 2011 18:04:07 +0200
ville.syrjala@xxxxxxxxxxxxxxx wrote:

> From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
> ---
>  drivers/gpu/drm/drm_crtc.c |   11 +++++++++++
>  1 files changed, 11 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 27d46b1..04680bc 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -1655,6 +1655,7 @@ int drm_mode_setplane(struct drm_device *dev, void *data,
>  	struct drm_framebuffer *fb;
>  	int ret = 0;
>  	unsigned int fb_width, fb_height;
> +	int i;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_MODESET))
>  		return -EINVAL;
> @@ -1703,6 +1704,16 @@ int drm_mode_setplane(struct drm_device *dev, void *data,
>  	}
>  	fb = obj_to_fb(obj);
>  
> +	/* Check whether this plane supports the fb pixel format. */
> +	for (i = 0; i < plane->format_count; i++)
> +		if (fb->pixel_format == plane->format_types[i])
> +			break;
> +	if (i == plane->format_count) {
> +		DRM_DEBUG_KMS("Invalid pixel format %x\n", fb->pixel_format);
> +		ret = -EINVAL;
> +		goto out;
> +	}
> +
>  	fb_width = fb->width << 16;
>  	fb_height = fb->height << 16;
>  

Yeah it's reasonable to hoist this up into generic code.

Thanks,
-- 
Jesse Barnes, Intel Open Source Technology Center

Attachment: signature.asc
Description: PGP signature

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel

[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux