Skip to content

Commit 4e39740

Browse files
fooishbarmmind
authored andcommitted
drm/rockchip: Use temporary variables
Brevity is good. Signed-off-by: Daniel Stone <daniels@collabora.com> Signed-off-by: Heiko Stuebner <heiko@sntech.de> Link: https://lore.kernel.org/r/20251015110042.41273-6-daniels@collabora.com
1 parent 33cbeea commit 4e39740

1 file changed

Lines changed: 15 additions & 9 deletions

File tree

drivers/gpu/drm/rockchip/rockchip_drm_vop2.c

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,6 +1003,8 @@ static int vop2_plane_atomic_check(struct drm_plane *plane,
10031003
struct drm_rect *src = &pstate->src;
10041004
int min_scale = FRAC_16_16(1, 8);
10051005
int max_scale = FRAC_16_16(8, 1);
1006+
int src_x, src_w, src_h;
1007+
int dest_w, dest_h;
10061008
int format;
10071009
int ret;
10081010

@@ -1030,19 +1032,23 @@ static int vop2_plane_atomic_check(struct drm_plane *plane,
10301032
if (format < 0)
10311033
return format;
10321034

1033-
if (drm_rect_width(src) >> 16 < 4 || drm_rect_height(src) >> 16 < 4 ||
1034-
drm_rect_width(dest) < 4 || drm_rect_width(dest) < 4) {
1035+
/* Co-ordinates have now been clipped */
1036+
src_x = src->x1 >> 16;
1037+
src_w = drm_rect_width(src) >> 16;
1038+
src_h = drm_rect_height(src) >> 16;
1039+
dest_w = drm_rect_width(dest);
1040+
dest_h = drm_rect_height(dest);
1041+
1042+
if (src_w < 4 || src_h < 4 || dest_w < 4 || dest_h < 4) {
10351043
drm_dbg_kms(vop2->drm, "Invalid size: %dx%d->%dx%d, min size is 4x4\n",
1036-
drm_rect_width(src) >> 16, drm_rect_height(src) >> 16,
1037-
drm_rect_width(dest), drm_rect_height(dest));
1044+
src_w, src_h, dest_w, dest_h);
10381045
return -EINVAL;
10391046
}
10401047

1041-
if (drm_rect_width(src) >> 16 > vop2_data->max_input.width ||
1042-
drm_rect_height(src) >> 16 > vop2_data->max_input.height) {
1048+
if (src_w > vop2_data->max_input.width ||
1049+
src_h > vop2_data->max_input.height) {
10431050
drm_dbg_kms(vop2->drm, "Invalid source: %dx%d. max input: %dx%d\n",
1044-
drm_rect_width(src) >> 16,
1045-
drm_rect_height(src) >> 16,
1051+
src_w, src_h,
10461052
vop2_data->max_input.width,
10471053
vop2_data->max_input.height);
10481054
return -EINVAL;
@@ -1052,7 +1058,7 @@ static int vop2_plane_atomic_check(struct drm_plane *plane,
10521058
* Src.x1 can be odd when do clip, but yuv plane start point
10531059
* need align with 2 pixel.
10541060
*/
1055-
if (fb->format->is_yuv && ((pstate->src.x1 >> 16) % 2)) {
1061+
if (fb->format->is_yuv && src_x % 2) {
10561062
drm_dbg_kms(vop2->drm, "Invalid Source: Yuv format not support odd xpos\n");
10571063
return -EINVAL;
10581064
}

0 commit comments

Comments
 (0)