Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

authored by

Daniel Stone and committed by
Heiko Stuebner
4e39740d 33cbeea6

+15 -9
+15 -9
drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
··· 1003 1003 struct drm_rect *src = &pstate->src; 1004 1004 int min_scale = FRAC_16_16(1, 8); 1005 1005 int max_scale = FRAC_16_16(8, 1); 1006 + int src_x, src_w, src_h; 1007 + int dest_w, dest_h; 1006 1008 int format; 1007 1009 int ret; 1008 1010 ··· 1032 1030 if (format < 0) 1033 1031 return format; 1034 1032 1035 - if (drm_rect_width(src) >> 16 < 4 || drm_rect_height(src) >> 16 < 4 || 1036 - drm_rect_width(dest) < 4 || drm_rect_width(dest) < 4) { 1033 + /* Co-ordinates have now been clipped */ 1034 + src_x = src->x1 >> 16; 1035 + src_w = drm_rect_width(src) >> 16; 1036 + src_h = drm_rect_height(src) >> 16; 1037 + dest_w = drm_rect_width(dest); 1038 + dest_h = drm_rect_height(dest); 1039 + 1040 + if (src_w < 4 || src_h < 4 || dest_w < 4 || dest_h < 4) { 1037 1041 drm_dbg_kms(vop2->drm, "Invalid size: %dx%d->%dx%d, min size is 4x4\n", 1038 - drm_rect_width(src) >> 16, drm_rect_height(src) >> 16, 1039 - drm_rect_width(dest), drm_rect_height(dest)); 1042 + src_w, src_h, dest_w, dest_h); 1040 1043 return -EINVAL; 1041 1044 } 1042 1045 1043 - if (drm_rect_width(src) >> 16 > vop2_data->max_input.width || 1044 - drm_rect_height(src) >> 16 > vop2_data->max_input.height) { 1046 + if (src_w > vop2_data->max_input.width || 1047 + src_h > vop2_data->max_input.height) { 1045 1048 drm_dbg_kms(vop2->drm, "Invalid source: %dx%d. max input: %dx%d\n", 1046 - drm_rect_width(src) >> 16, 1047 - drm_rect_height(src) >> 16, 1049 + src_w, src_h, 1048 1050 vop2_data->max_input.width, 1049 1051 vop2_data->max_input.height); 1050 1052 return -EINVAL; ··· 1058 1052 * Src.x1 can be odd when do clip, but yuv plane start point 1059 1053 * need align with 2 pixel. 1060 1054 */ 1061 - if (fb->format->is_yuv && ((pstate->src.x1 >> 16) % 2)) { 1055 + if (fb->format->is_yuv && src_x % 2) { 1062 1056 drm_dbg_kms(vop2->drm, "Invalid Source: Yuv format not support odd xpos\n"); 1063 1057 return -EINVAL; 1064 1058 }