[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20180727111112epcas5p35e49be90453d18c560207d6ab34661ec~FNVGm5QCq0042200422epcas5p3X@epcas5p3.samsung.com>
Date: Fri, 27 Jul 2018 16:41:02 +0530
From: Satendra Singh Thakur <satendra.t@...sung.com>
To: Gustavo Padovan <gustavo@...ovan.org>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Sean Paul <seanpaul@...omium.org>,
David Airlie <airlied@...ux.ie>,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Cc: vineet.j@...sung.com, hemanshu.s@...sung.com, sst2005@...il.com,
Satendra Singh Thakur <satendra.t@...sung.com>
Subject: [PATCH v1] drm/kms/atomic: Using existing func for checking
framebuffer dimensions
In the func drm_atomic_plane_check, the fb geometry checking code
can be replaced by func drm_framebuffer_check_src_coords, this will
remove several redundant lines of code.
Signed-off-by: Satendra Singh Thakur <satendra.t@...sung.com>
---
v1: Hi Mr Maarten, Thanks for the comments.
I have splitted them into two patches.
drivers/gpu/drm/drm_atomic.c | 22 ++++------------------
1 file changed, 4 insertions(+), 18 deletions(-)
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 895741e..953bd2a 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -909,7 +909,6 @@ plane_switching_crtc(struct drm_atomic_state *state,
static int drm_atomic_plane_check(struct drm_plane *plane,
struct drm_plane_state *state)
{
- unsigned int fb_width, fb_height;
int ret;
/* either *both* CRTC and FB must be set, or neither */
@@ -954,24 +953,11 @@ static int drm_atomic_plane_check(struct drm_plane *plane,
return -ERANGE;
}
- fb_width = state->fb->width << 16;
- fb_height = state->fb->height << 16;
-
/* Make sure source coordinates are inside the fb. */
- if (state->src_w > fb_width ||
- state->src_x > fb_width - state->src_w ||
- state->src_h > fb_height ||
- state->src_y > fb_height - state->src_h) {
- DRM_DEBUG_ATOMIC("Invalid source coordinates "
- "%u.%06ux%u.%06u+%u.%06u+%u.%06u (fb %ux%u)\n",
- state->src_w >> 16, ((state->src_w & 0xffff) * 15625) >> 10,
- state->src_h >> 16, ((state->src_h & 0xffff) * 15625) >> 10,
- state->src_x >> 16, ((state->src_x & 0xffff) * 15625) >> 10,
- state->src_y >> 16, ((state->src_y & 0xffff) * 15625) >> 10,
- state->fb->width, state->fb->height);
- return -ENOSPC;
- }
-
+ ret = drm_framebuffer_check_src_coords(state->src_x, state->src_y,
+ state->src_w, state->src_h, state->fb);
+ if (ret)
+ return ret;
if (plane_switching_crtc(state->state, plane, state)) {
DRM_DEBUG_ATOMIC("[PLANE:%d:%s] switching CRTC directly\n",
plane->base.id, plane->name);
--
2.7.4
Powered by blists - more mailing lists