[PATCH 23/36] drm/cirrus: use bpp instead of cpp for drm_format_info

Sandy Huang hjc at rock-chips.com
Mon Sep 23 12:51:46 UTC 2019


cpp[BytePerPlane] can't describe the 10bit data format correctly,
So we use bpp[BitPerPlane] to instead cpp.

Signed-off-by: Sandy Huang <hjc at rock-chips.com>
---
 drivers/gpu/drm/cirrus/cirrus.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/cirrus/cirrus.c b/drivers/gpu/drm/cirrus/cirrus.c
index 89d9e6f..ba47fdf 100644
--- a/drivers/gpu/drm/cirrus/cirrus.c
+++ b/drivers/gpu/drm/cirrus/cirrus.c
@@ -121,7 +121,7 @@ static void wreg_hdr(struct cirrus_device *cirrus, u8 val)
 
 static int cirrus_convert_to(struct drm_framebuffer *fb)
 {
-	if (fb->format->cpp[0] == 4 && fb->pitches[0] > CIRRUS_MAX_PITCH) {
+	if (fb->format->bpp[0] == 32 && fb->pitches[0] > CIRRUS_MAX_PITCH) {
 		if (fb->width * 3 <= CIRRUS_MAX_PITCH)
 			/* convert from XR24 to RG24 */
 			return 3;
@@ -138,7 +138,7 @@ static int cirrus_cpp(struct drm_framebuffer *fb)
 
 	if (convert_cpp)
 		return convert_cpp;
-	return fb->format->cpp[0];
+	return fb->format->bpp[0] / 8;
 }
 
 static int cirrus_pitch(struct drm_framebuffer *fb)
@@ -306,16 +306,16 @@ static int cirrus_fb_blit_rect(struct drm_framebuffer *fb,
 	if (!vmap)
 		return -ENOMEM;
 
-	if (cirrus->cpp == fb->format->cpp[0])
+	if (cirrus->cpp == fb->format->bpp[0] / 8)
 		drm_fb_memcpy_dstclip(cirrus->vram,
 				      vmap, fb, rect);
 
-	else if (fb->format->cpp[0] == 4 && cirrus->cpp == 2)
+	else if (fb->format->bpp[0] == 32 && cirrus->cpp == 2)
 		drm_fb_xrgb8888_to_rgb565_dstclip(cirrus->vram,
 						  cirrus->pitch,
 						  vmap, fb, rect, false);
 
-	else if (fb->format->cpp[0] == 4 && cirrus->cpp == 3)
+	else if (fb->format->bpp[0] == 32 && cirrus->cpp == 3)
 		drm_fb_xrgb8888_to_rgb888_dstclip(cirrus->vram,
 						  cirrus->pitch,
 						  vmap, fb, rect);
-- 
2.7.4





More information about the dri-devel mailing list