diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2015-03-05 02:25:43 +0200 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2015-03-10 09:59:35 +0100 |
commit | ead8610d42105a3d01f755522f11b96c60dc648f (patch) | |
tree | 7cbbdcbf073515c3e717edc1f128544148ddf62e /drivers/gpu/drm/drm_atomic.c | |
parent | 2a97acd6376922bb9d23b5f4421745d2a6690060 (diff) | |
download | linux-ead8610d42105a3d01f755522f11b96c60dc648f.tar.gz linux-ead8610d42105a3d01f755522f11b96c60dc648f.tar.bz2 linux-ead8610d42105a3d01f755522f11b96c60dc648f.zip |
drm: Share plane pixel format check code between legacy and atomic
Both the legacy and atomic helpers need to check whether a plane
supports a given pixel format. The code is currently duplicated, share
it.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
[danvet: Slightly extend the docbook.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/drm_atomic.c')
-rw-r--r-- | drivers/gpu/drm/drm_atomic.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index 7ca54cb6b15b..a6caaae40b9e 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -475,7 +475,7 @@ static int drm_atomic_plane_check(struct drm_plane *plane, struct drm_plane_state *state) { unsigned int fb_width, fb_height; - unsigned int i; + int ret; /* either *both* CRTC and FB must be set, or neither */ if (WARN_ON(state->crtc && !state->fb)) { @@ -497,13 +497,11 @@ static int drm_atomic_plane_check(struct drm_plane *plane, } /* Check whether this plane supports the fb pixel format. */ - for (i = 0; i < plane->format_count; i++) - if (state->fb->pixel_format == plane->format_types[i]) - break; - if (i == plane->format_count) { + ret = drm_plane_check_pixel_format(plane, state->fb->pixel_format); + if (ret) { DRM_DEBUG_ATOMIC("Invalid pixel format %s\n", drm_get_format_name(state->fb->pixel_format)); - return -EINVAL; + return ret; } /* Give drivers some help against integer overflows */ |