Message ID | 1425515144-12497-3-git-send-email-laurent.pinchart@ideasonboard.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Thu, Mar 05, 2015 at 02:25:44AM +0200, Laurent Pinchart wrote: > Drivers implementing the universal planes API report the list of > supported pixel formats for the primary plane. Make sure the fb passed > to the setcrtc ioctl is compatible. > > Drivers not implementing the universal planes API will have no format > reported for the primary plane, skip the check in that case. > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > --- > drivers/gpu/drm/drm_crtc.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c > index d794bcf..09ac312 100644 > --- a/drivers/gpu/drm/drm_crtc.c > +++ b/drivers/gpu/drm/drm_crtc.c > @@ -2807,6 +2807,22 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data, > > drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V); > > + /* > + * Check whether the primary plane supports the fb pixel format. > + * Drivers not implementing the universal planes API will have > + * no format reported for the primary plane, skip the check in > + * that case. > + */ > + if (crtc->primary->format_count) { The compat helpers create a primary plane for you, and they fill out the format list with 2 hopefully save ones. I think we need to add some boolean to drm_plane which drm_primary_helper_create_plane sets when no explicit format list is passed in. And I guess we should make drm_primary_helper_create_plane static while at it. I've pulled in your first patch into drm-misc, with a slightly extended docbook text. Thanks, Daniel > + ret = drm_plane_check_pixel_format(crtc->primary, > + fb->pixel_format); > + if (ret) { > + DRM_DEBUG_KMS("Invalid pixel format %s\n", > + drm_get_format_name(fb->pixel_format)); > + goto out; > + } > + } > + > ret = drm_crtc_check_viewport(crtc, crtc_req->x, crtc_req->y, > mode, fb); > if (ret) > -- > 2.0.5 >
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index d794bcf..09ac312 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -2807,6 +2807,22 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data, drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V); + /* + * Check whether the primary plane supports the fb pixel format. + * Drivers not implementing the universal planes API will have + * no format reported for the primary plane, skip the check in + * that case. + */ + if (crtc->primary->format_count) { + ret = drm_plane_check_pixel_format(crtc->primary, + fb->pixel_format); + if (ret) { + DRM_DEBUG_KMS("Invalid pixel format %s\n", + drm_get_format_name(fb->pixel_format)); + goto out; + } + } + ret = drm_crtc_check_viewport(crtc, crtc_req->x, crtc_req->y, mode, fb); if (ret)
Drivers implementing the universal planes API report the list of supported pixel formats for the primary plane. Make sure the fb passed to the setcrtc ioctl is compatible. Drivers not implementing the universal planes API will have no format reported for the primary plane, skip the check in that case. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> --- drivers/gpu/drm/drm_crtc.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)