drm/rockchip: vop2: make sure the bpp is not zero

The bpp should not be a zero value.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Change-Id: I1a1f9214087639f63c101d0d5c68ee470c852649
This commit is contained in:
Andy Yan
2023-10-31 15:23:19 +08:00
committed by Tao Huang
parent 4fec67500f
commit 3f00c490d3
2 changed files with 7 additions and 7 deletions
@@ -56,7 +56,7 @@ static int get_afbc_size(uint32_t width, uint32_t height, uint32_t bpp)
int rockchip_drm_dump_plane_buffer(struct vop_dump_info *dump_info, int frame_count)
{
int flags;
int bpp = 32;
int bpp;
const char *ptr;
char file_name[100];
int width;
@@ -70,6 +70,10 @@ int rockchip_drm_dump_plane_buffer(struct vop_dump_info *dump_info, int frame_co
drm_get_format_name(dump_info->format->format, &format_name);
strscpy(format, format_name.str, 5);
bpp = rockchip_drm_get_bpp(dump_info->format);
if (!bpp) {
DRM_WARN("invalid bpp %d\n", bpp);
return 0;
}
if (dump_info->yuv_format) {
u8 hsub = dump_info->format->hsub;
+2 -6
View File
@@ -5142,7 +5142,7 @@ static void vop2_win_atomic_update(struct vop2_win *win, struct drm_rect *src, s
actual_w = drm_rect_width(src) >> 16;
actual_h = drm_rect_height(src) >> 16;
if (!actual_w || !actual_h) {
if (!actual_w || !actual_h || !bpp) {
vop2_win_disable(win, true);
return;
}
@@ -5263,10 +5263,6 @@ static void vop2_win_atomic_update(struct vop2_win *win, struct drm_rect *src, s
/* AFBC pic_vir_width is count by pixel, this is different
* with WIN_VIR_STRIDE.
*/
if (!bpp) {
WARN(1, "bpp is zero\n");
bpp = 1;
}
stride = (fb->pitches[0] << 3) / bpp;
if ((stride & 0x3f) &&
(vpstate->xmirror_en || vpstate->rotate_90_en || vpstate->rotate_270_en))
@@ -6586,7 +6582,7 @@ static size_t vop2_plane_line_bandwidth(struct drm_plane_state *pstate)
size_t bandwidth;
if (src_width <= 0 || src_height <= 0 || dst_width <= 0 ||
dst_height <= 0)
dst_height <= 0 || !bpp)
return 0;
bandwidth = src_width * bpp / 8;