linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 06/36] drm/amd: use bpp instead of cpp for drm_format_info
@ 2019-09-23 12:41 Sandy Huang
  2019-09-23 12:41 ` [PATCH 07/36] drm/gma500: " Sandy Huang
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Sandy Huang @ 2019-09-23 12:41 UTC (permalink / raw)
  To: dri-devel, Alex Deucher, Christian König,
	David (ChunMing) Zhou, David Airlie, Daniel Vetter,
	Harry Wentland, Leo Li, Paul Kocialkowski, Maxime Ripard,
	Emil Velikov, Sam Ravnborg, Sandy Huang, Huang Rui,
	Laurent Pinchart, Ville Syrjälä,
	Russell King, Jani Nikula, Colin Ian King, Nicholas Kazlauskas,
	Bhawanpreet Lakha, David Francis, Mario Kleiner
  Cc: Daniel Vetter, amd-gfx, linux-kernel

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

Signed-off-by: Sandy Huang <hjc@rock-chips.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c            | 2 +-
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            | 2 +-
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            | 2 +-
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             | 2 +-
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             | 2 +-
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 6 +++---
 6 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
index eb3569b..895a54c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
@@ -133,7 +133,7 @@ static int amdgpufb_create_pinned_object(struct amdgpu_fbdev *rfbdev,
 	u32 cpp;
 
 	info = drm_get_format_info(adev->ddev, mode_cmd);
-	cpp = info->cpp[0];
+	cpp = info->bpp[0] / 8;
 
 	/* need to align pitch with crtc limits */
 	mode_cmd->pitches[0] = amdgpu_align_pitch(adev, mode_cmd->width, cpp,
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
index 1ffd196..ebf548c 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
@@ -2034,7 +2034,7 @@ static int dce_v10_0_crtc_do_set_base(struct drm_crtc *crtc,
 	WREG32(mmGRPH_X_END + amdgpu_crtc->crtc_offset, target_fb->width);
 	WREG32(mmGRPH_Y_END + amdgpu_crtc->crtc_offset, target_fb->height);
 
-	fb_pitch_pixels = target_fb->pitches[0] / target_fb->format->cpp[0];
+	fb_pitch_pixels = target_fb->pitches[0] / target_fb->format->bpp[0] / 8;
 	WREG32(mmGRPH_PITCH + amdgpu_crtc->crtc_offset, fb_pitch_pixels);
 
 	dce_v10_0_grph_enable(crtc, true);
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
index 9e0782b..4400a59 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
@@ -2076,7 +2076,7 @@ static int dce_v11_0_crtc_do_set_base(struct drm_crtc *crtc,
 	WREG32(mmGRPH_X_END + amdgpu_crtc->crtc_offset, target_fb->width);
 	WREG32(mmGRPH_Y_END + amdgpu_crtc->crtc_offset, target_fb->height);
 
-	fb_pitch_pixels = target_fb->pitches[0] / target_fb->format->cpp[0];
+	fb_pitch_pixels = target_fb->pitches[0] / target_fb->format->bpp[0] / 8;
 	WREG32(mmGRPH_PITCH + amdgpu_crtc->crtc_offset, fb_pitch_pixels);
 
 	dce_v11_0_grph_enable(crtc, true);
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
index 4bf453e..fc74153 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
@@ -1969,7 +1969,7 @@ static int dce_v6_0_crtc_do_set_base(struct drm_crtc *crtc,
 	WREG32(mmGRPH_X_END + amdgpu_crtc->crtc_offset, target_fb->width);
 	WREG32(mmGRPH_Y_END + amdgpu_crtc->crtc_offset, target_fb->height);
 
-	fb_pitch_pixels = target_fb->pitches[0] / target_fb->format->cpp[0];
+	fb_pitch_pixels = target_fb->pitches[0] / target_fb->format->bpp[0] / 8;
 	WREG32(mmGRPH_PITCH + amdgpu_crtc->crtc_offset, fb_pitch_pixels);
 
 	dce_v6_0_grph_enable(crtc, true);
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
index b23418c..94dfb4f 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
@@ -1943,7 +1943,7 @@ static int dce_v8_0_crtc_do_set_base(struct drm_crtc *crtc,
 	WREG32(mmGRPH_X_END + amdgpu_crtc->crtc_offset, target_fb->width);
 	WREG32(mmGRPH_Y_END + amdgpu_crtc->crtc_offset, target_fb->height);
 
-	fb_pitch_pixels = target_fb->pitches[0] / target_fb->format->cpp[0];
+	fb_pitch_pixels = target_fb->pitches[0] / target_fb->format->bpp[0] / 8;
 	WREG32(mmGRPH_PITCH + amdgpu_crtc->crtc_offset, fb_pitch_pixels);
 
 	dce_v8_0_grph_enable(crtc, true);
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 760af66..d11ab18 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -2746,7 +2746,7 @@ fill_plane_buffer_attributes(struct amdgpu_device *adev,
 		plane_size->grph.surface_size.width = fb->width;
 		plane_size->grph.surface_size.height = fb->height;
 		plane_size->grph.surface_pitch =
-			fb->pitches[0] / fb->format->cpp[0];
+			fb->pitches[0] / fb->format->bpp[0] / 8;
 
 		address->type = PLN_ADDR_TYPE_GRAPHICS;
 		address->grph.addr.low_part = lower_32_bits(afb->address);
@@ -2759,7 +2759,7 @@ fill_plane_buffer_attributes(struct amdgpu_device *adev,
 		plane_size->video.luma_size.width = fb->width;
 		plane_size->video.luma_size.height = fb->height;
 		plane_size->video.luma_pitch =
-			fb->pitches[0] / fb->format->cpp[0];
+			fb->pitches[0] / fb->format->bpp[0] / 8;
 
 		plane_size->video.chroma_size.x = 0;
 		plane_size->video.chroma_size.y = 0;
@@ -2768,7 +2768,7 @@ fill_plane_buffer_attributes(struct amdgpu_device *adev,
 		plane_size->video.chroma_size.height = fb->height / 2;
 
 		plane_size->video.chroma_pitch =
-			fb->pitches[1] / fb->format->cpp[1];
+			fb->pitches[1] / fb->format->bpp[1] / 8;
 
 		address->type = PLN_ADDR_TYPE_VIDEO_PROGRESSIVE;
 		address->video_progressive.luma_addr.low_part =
-- 
2.7.4




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 07/36] drm/gma500: use bpp instead of cpp for drm_format_info
  2019-09-23 12:41 [PATCH 06/36] drm/amd: use bpp instead of cpp for drm_format_info Sandy Huang
@ 2019-09-23 12:41 ` Sandy Huang
  2019-09-23 12:41 ` [PATCH 08/36] drm/msm: " Sandy Huang
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Sandy Huang @ 2019-09-23 12:41 UTC (permalink / raw)
  To: dri-devel, Patrik Jakobsson, David Airlie, Daniel Vetter
  Cc: hjc, linux-kernel

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

Signed-off-by: Sandy Huang <hjc@rock-chips.com>
---
 drivers/gpu/drm/gma500/framebuffer.c         | 4 ++--
 drivers/gpu/drm/gma500/gma_display.c         | 4 ++--
 drivers/gpu/drm/gma500/mdfld_intel_display.c | 6 +++---
 drivers/gpu/drm/gma500/oaktrail_crtc.c       | 4 ++--
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/gma500/framebuffer.c b/drivers/gpu/drm/gma500/framebuffer.c
index 218f3bb..97e9274 100644
--- a/drivers/gpu/drm/gma500/framebuffer.c
+++ b/drivers/gpu/drm/gma500/framebuffer.c
@@ -61,7 +61,7 @@ static int psbfb_setcolreg(unsigned regno, unsigned red, unsigned green,
 	    (transp << info->var.transp.offset);
 
 	if (regno < 16) {
-		switch (fb->format->cpp[0] * 8) {
+		switch (fb->format->bpp[0]) {
 		case 16:
 			((uint32_t *) info->pseudo_palette)[regno] = v;
 			break;
@@ -221,7 +221,7 @@ static int psb_framebuffer_init(struct drm_device *dev,
 	 * 4 bytes per pixel.
 	 */
 	info = drm_get_format_info(dev, mode_cmd);
-	if (!info || !info->depth || info->cpp[0] > 4)
+	if (!info || !info->depth || info->bpp[0] > 32)
 		return -EINVAL;
 
 	if (mode_cmd->pitches[0] & 63)
diff --git a/drivers/gpu/drm/gma500/gma_display.c b/drivers/gpu/drm/gma500/gma_display.c
index e20ccb5..95e975e 100644
--- a/drivers/gpu/drm/gma500/gma_display.c
+++ b/drivers/gpu/drm/gma500/gma_display.c
@@ -78,14 +78,14 @@ int gma_pipe_set_base(struct drm_crtc *crtc, int x, int y,
 	if (ret < 0)
 		goto gma_pipe_set_base_exit;
 	start = gtt->offset;
-	offset = y * fb->pitches[0] + x * fb->format->cpp[0];
+	offset = y * fb->pitches[0] + x * fb->format->bpp[0] / 8;
 
 	REG_WRITE(map->stride, fb->pitches[0]);
 
 	dspcntr = REG_READ(map->cntr);
 	dspcntr &= ~DISPPLANE_PIXFORMAT_MASK;
 
-	switch (fb->format->cpp[0] * 8) {
+	switch (fb->format->bpp[0]) {
 	case 8:
 		dspcntr |= DISPPLANE_8BPP;
 		break;
diff --git a/drivers/gpu/drm/gma500/mdfld_intel_display.c b/drivers/gpu/drm/gma500/mdfld_intel_display.c
index b8bfb96..5564472 100644
--- a/drivers/gpu/drm/gma500/mdfld_intel_display.c
+++ b/drivers/gpu/drm/gma500/mdfld_intel_display.c
@@ -139,7 +139,7 @@ static int check_fb(struct drm_framebuffer *fb)
 	if (!fb)
 		return 0;
 
-	switch (fb->format->cpp[0] * 8) {
+	switch (fb->format->bpp[0]) {
 	case 8:
 	case 16:
 	case 24:
@@ -187,13 +187,13 @@ static int mdfld__intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
 		return 0;
 
 	start = to_gtt_range(fb->obj[0])->offset;
-	offset = y * fb->pitches[0] + x * fb->format->cpp[0];
+	offset = y * fb->pitches[0] + x * fb->format->bpp[0] / 8;
 
 	REG_WRITE(map->stride, fb->pitches[0]);
 	dspcntr = REG_READ(map->cntr);
 	dspcntr &= ~DISPPLANE_PIXFORMAT_MASK;
 
-	switch (fb->format->cpp[0] * 8) {
+	switch (fb->format->bpp[0]) {
 	case 8:
 		dspcntr |= DISPPLANE_8BPP;
 		break;
diff --git a/drivers/gpu/drm/gma500/oaktrail_crtc.c b/drivers/gpu/drm/gma500/oaktrail_crtc.c
index 167c107..8278dfb 100644
--- a/drivers/gpu/drm/gma500/oaktrail_crtc.c
+++ b/drivers/gpu/drm/gma500/oaktrail_crtc.c
@@ -607,14 +607,14 @@ static int oaktrail_pipe_set_base(struct drm_crtc *crtc,
 		return 0;
 
 	start = to_gtt_range(fb->obj[0])->offset;
-	offset = y * fb->pitches[0] + x * fb->format->cpp[0];
+	offset = y * fb->pitches[0] + x * fb->format->bpp[0] / 8;
 
 	REG_WRITE(map->stride, fb->pitches[0]);
 
 	dspcntr = REG_READ(map->cntr);
 	dspcntr &= ~DISPPLANE_PIXFORMAT_MASK;
 
-	switch (fb->format->cpp[0] * 8) {
+	switch (fb->format->bpp[0]) {
 	case 8:
 		dspcntr |= DISPPLANE_8BPP;
 		break;
-- 
2.7.4




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 08/36] drm/msm: use bpp instead of cpp for drm_format_info
  2019-09-23 12:41 [PATCH 06/36] drm/amd: use bpp instead of cpp for drm_format_info Sandy Huang
  2019-09-23 12:41 ` [PATCH 07/36] drm/gma500: " Sandy Huang
@ 2019-09-23 12:41 ` Sandy Huang
  2019-09-23 16:53   ` Rob Clark
  2019-09-23 12:41 ` [PATCH 09/36] dm/vmwgfx: " Sandy Huang
  2019-09-23 12:41 ` [PATCH 10/36] drm/arm: " Sandy Huang
  3 siblings, 1 reply; 6+ messages in thread
From: Sandy Huang @ 2019-09-23 12:41 UTC (permalink / raw)
  To: dri-devel, Rob Clark, Sean Paul, David Airlie, Daniel Vetter,
	Jeykumar Sankaran, Bruce Wang, Jordan Crouse,
	Sravanthi Kollukuduru, Maxime Ripard, Sam Ravnborg,
	Maarten Lankhorst, Thomas Gleixner, Mamta Shukla, Shayenne Moura,
	Paul Kocialkowski, Emil Velikov, Allison Randal, Sandy Huang
  Cc: Sean Paul, Rob Clark, Daniel Vetter, Philipp Zabel,
	linux-arm-msm, freedreno, linux-kernel

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

Signed-off-by: Sandy Huang <hjc@rock-chips.com>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c  | 4 ++--
 drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 2 +-
 drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c  | 2 +-
 drivers/gpu/drm/msm/msm_fb.c              | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index b3417d5..c57731c 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -1148,8 +1148,8 @@ static int _dpu_debugfs_status_show(struct seq_file *s, void *data)
 				fb->base.id, (char *) &fb->format->format,
 				fb->width, fb->height);
 			for (i = 0; i < ARRAY_SIZE(fb->format->cpp); ++i)
-				seq_printf(s, "cpp[%d]:%u ",
-						i, fb->format->cpp[i]);
+				seq_printf(s, "bpp[%d]:%u ",
+						i, fb->format->bpp[i]);
 			seq_puts(s, "\n\t");
 
 			seq_printf(s, "modifier:%8llu ", fb->modifier);
diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
index ff14555..61ab4dc 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
@@ -790,7 +790,7 @@ static void mdp5_crtc_restore_cursor(struct drm_crtc *crtc)
 	width = mdp5_crtc->cursor.width;
 	height = mdp5_crtc->cursor.height;
 
-	stride = width * info->cpp[0];
+	stride = width * info->bpp[0] / 8;
 
 	get_roi(crtc, &roi_w, &roi_h);
 
diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c
index 776337f..992477d 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c
@@ -147,7 +147,7 @@ uint32_t mdp5_smp_calculate(struct mdp5_smp *smp,
 	for (i = 0; i < nplanes; i++) {
 		int n, fetch_stride, cpp;
 
-		cpp = info->cpp[i];
+		cpp = info->bpp[i] / 8;
 		fetch_stride = width * cpp / (i ? hsub : 1);
 
 		n = DIV_ROUND_UP(fetch_stride * nlines, smp->blk_size);
diff --git a/drivers/gpu/drm/msm/msm_fb.c b/drivers/gpu/drm/msm/msm_fb.c
index 5bcd5e5..4545fa1 100644
--- a/drivers/gpu/drm/msm/msm_fb.c
+++ b/drivers/gpu/drm/msm/msm_fb.c
@@ -172,7 +172,7 @@ static struct drm_framebuffer *msm_framebuffer_init(struct drm_device *dev,
 		unsigned int min_size;
 
 		min_size = (height - 1) * mode_cmd->pitches[i]
-			 + width * info->cpp[i]
+			 + width * info->bpp[i] / 8
 			 + mode_cmd->offsets[i];
 
 		if (bos[i]->size < min_size) {
-- 
2.7.4




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 09/36] dm/vmwgfx: use bpp instead of cpp for drm_format_info
  2019-09-23 12:41 [PATCH 06/36] drm/amd: use bpp instead of cpp for drm_format_info Sandy Huang
  2019-09-23 12:41 ` [PATCH 07/36] drm/gma500: " Sandy Huang
  2019-09-23 12:41 ` [PATCH 08/36] drm/msm: " Sandy Huang
@ 2019-09-23 12:41 ` Sandy Huang
  2019-09-23 12:41 ` [PATCH 10/36] drm/arm: " Sandy Huang
  3 siblings, 0 replies; 6+ messages in thread
From: Sandy Huang @ 2019-09-23 12:41 UTC (permalink / raw)
  To: dri-devel, VMware Graphics, Thomas Hellstrom, David Airlie,
	Daniel Vetter
  Cc: hjc, linux-kernel

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

Signed-off-by: Sandy Huang <hjc@rock-chips.com>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_fb.c   | 4 ++--
 drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c  | 4 ++--
 drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 4 ++--
 drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
index 972e8fd..c516c40 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
@@ -91,7 +91,7 @@ static int vmw_fb_setcolreg(unsigned regno, unsigned red, unsigned green,
 	default:
 		DRM_ERROR("Bad depth %u, bpp %u.\n",
 			  par->set_fb->format->depth,
-			  par->set_fb->format->cpp[0] * 8);
+			  par->set_fb->format->bpp[0]);
 		return 1;
 	}
 
@@ -211,7 +211,7 @@ static void vmw_fb_dirty_flush(struct work_struct *work)
 	 * Handle panning when copying from vmalloc to framebuffer.
 	 * Clip dirty area to framebuffer.
 	 */
-	cpp = cur_fb->format->cpp[0];
+	cpp = cur_fb->format->bpp[0] / 8;
 	max_x = par->fb_x + cur_fb->width;
 	max_y = par->fb_y + cur_fb->height;
 
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
index 25e6343..e9b4b44 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
@@ -98,7 +98,7 @@ static int vmw_ldu_commit_list(struct vmw_private *dev_priv)
 		fb = entry->base.crtc.primary->state->fb;
 
 		return vmw_kms_write_svga(dev_priv, w, h, fb->pitches[0],
-					  fb->format->cpp[0] * 8,
+					  fb->format->bpp[0],
 					  fb->format->depth);
 	}
 
@@ -107,7 +107,7 @@ static int vmw_ldu_commit_list(struct vmw_private *dev_priv)
 		fb = entry->base.crtc.primary->state->fb;
 
 		vmw_kms_write_svga(dev_priv, fb->width, fb->height, fb->pitches[0],
-				   fb->format->cpp[0] * 8, fb->format->depth);
+				   fb->format->bpp[0], fb->format->depth);
 	}
 
 	/* Make sure we always show something. */
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
index 9a2a383..79a79e2 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
@@ -487,7 +487,7 @@ static uint32_t vmw_sou_bo_define_gmrfb(struct vmw_du_update_plane *update,
 
 	gmr->header = SVGA_CMD_DEFINE_GMRFB;
 
-	gmr->body.format.bitsPerPixel = update->vfb->base.format->cpp[0] * 8;
+	gmr->body.format.bitsPerPixel = update->vfb->base.format->bpp[0];
 	gmr->body.format.colorDepth = depth;
 	gmr->body.format.reserved = 0;
 	gmr->body.bytesPerLine = update->vfb->base.pitches[0];
@@ -997,7 +997,7 @@ static int do_bo_define_gmrfb(struct vmw_private *dev_priv,
 		return -ENOMEM;
 
 	cmd->header = SVGA_CMD_DEFINE_GMRFB;
-	cmd->body.format.bitsPerPixel = framebuffer->base.format->cpp[0] * 8;
+	cmd->body.format.bitsPerPixel = framebuffer->base.format->bpp[0];
 	cmd->body.format.colorDepth = depth;
 	cmd->body.format.reserved = 0;
 	cmd->body.bytesPerLine = framebuffer->base.pitches[0];
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
index f803bb5..52f0003 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
@@ -1074,7 +1074,7 @@ vmw_stdu_primary_plane_prepare_fb(struct drm_plane *plane,
 		 */
 		if (new_content_type == SEPARATE_BO) {
 
-			switch (new_fb->format->cpp[0]*8) {
+			switch (new_fb->format->bpp[0]) {
 			case 32:
 				content_srf.format = SVGA3D_X8R8G8B8;
 				break;
-- 
2.7.4




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 10/36] drm/arm: use bpp instead of cpp for drm_format_info
  2019-09-23 12:41 [PATCH 06/36] drm/amd: use bpp instead of cpp for drm_format_info Sandy Huang
                   ` (2 preceding siblings ...)
  2019-09-23 12:41 ` [PATCH 09/36] dm/vmwgfx: " Sandy Huang
@ 2019-09-23 12:41 ` Sandy Huang
  3 siblings, 0 replies; 6+ messages in thread
From: Sandy Huang @ 2019-09-23 12:41 UTC (permalink / raw)
  To: dri-devel, James (Qian) Wang, Liviu Dudau, Brian Starkey,
	David Airlie, Daniel Vetter
  Cc: hjc, linux-kernel

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

Signed-off-by: Sandy Huang <hjc@rock-chips.com>
---
 drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c | 2 +-
 drivers/gpu/drm/arm/malidp_hw.c                         | 2 +-
 drivers/gpu/drm/arm/malidp_planes.c                     | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c b/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
index 3b0a70e..d02dfc6 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
@@ -89,7 +89,7 @@ komeda_fb_afbc_size_check(struct komeda_fb *kfb, struct drm_file *file,
 				    alignment_header);
 
 	kfb->afbc_size = kfb->offset_payload + n_blocks *
-			 ALIGN(info->cpp[0] * AFBC_SUPERBLK_PIXELS,
+			 ALIGN(info->bpp[0] / 8 * AFBC_SUPERBLK_PIXELS,
 			       AFBC_SUPERBLK_ALIGNMENT);
 	min_size = kfb->afbc_size + fb->offsets[0];
 	if (min_size > obj->size) {
diff --git a/drivers/gpu/drm/arm/malidp_hw.c b/drivers/gpu/drm/arm/malidp_hw.c
index bd8265f..54be8d1 100644
--- a/drivers/gpu/drm/arm/malidp_hw.c
+++ b/drivers/gpu/drm/arm/malidp_hw.c
@@ -384,7 +384,7 @@ static void malidp500_modeset(struct malidp_hw_device *hwdev, struct videomode *
 int malidp_format_get_bpp(u32 fmt)
 {
 	const struct drm_format_info *info = drm_format_info(fmt);
-	int bpp = info->cpp[0] * 8;
+	int bpp = info->bpp[0];
 
 	if (bpp == 0) {
 		switch (fmt) {
diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c
index 3c70a53..628f325 100644
--- a/drivers/gpu/drm/arm/malidp_planes.c
+++ b/drivers/gpu/drm/arm/malidp_planes.c
@@ -225,7 +225,7 @@ bool malidp_format_mod_supported(struct drm_device *drm,
 
 	if (modifier & AFBC_SPLIT) {
 		if (!info->is_yuv) {
-			if (info->cpp[0] <= 2) {
+			if (info->bpp[0] <= 16) {
 				DRM_DEBUG_KMS("RGB formats <= 16bpp are not supported with SPLIT\n");
 				return false;
 			}
-- 
2.7.4




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 08/36] drm/msm: use bpp instead of cpp for drm_format_info
  2019-09-23 12:41 ` [PATCH 08/36] drm/msm: " Sandy Huang
@ 2019-09-23 16:53   ` Rob Clark
  0 siblings, 0 replies; 6+ messages in thread
From: Rob Clark @ 2019-09-23 16:53 UTC (permalink / raw)
  To: Sandy Huang
  Cc: dri-devel, Sean Paul, David Airlie, Daniel Vetter,
	Jeykumar Sankaran, Bruce Wang, Jordan Crouse,
	Sravanthi Kollukuduru, Maxime Ripard, Sam Ravnborg,
	Maarten Lankhorst, Thomas Gleixner, Mamta Shukla, Shayenne Moura,
	Paul Kocialkowski, Emil Velikov, Allison Randal, Sean Paul,
	Rob Clark, Daniel Vetter, Philipp Zabel, linux-arm-msm,
	freedreno, Linux Kernel Mailing List

On Mon, Sep 23, 2019 at 5:44 AM Sandy Huang <hjc@rock-chips.com> wrote:
>
> cpp[BytePerPlane] can't describe the 10bit data format correctly,
> So we use bpp[BitPerPlane] to instead cpp.
>
> Signed-off-by: Sandy Huang <hjc@rock-chips.com>
> ---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c  | 4 ++--
>  drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 2 +-
>  drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c  | 2 +-
>  drivers/gpu/drm/msm/msm_fb.c              | 2 +-
>  4 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> index b3417d5..c57731c 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> @@ -1148,8 +1148,8 @@ static int _dpu_debugfs_status_show(struct seq_file *s, void *data)
>                                 fb->base.id, (char *) &fb->format->format,
>                                 fb->width, fb->height);
>                         for (i = 0; i < ARRAY_SIZE(fb->format->cpp); ++i)
> -                               seq_printf(s, "cpp[%d]:%u ",
> -                                               i, fb->format->cpp[i]);
> +                               seq_printf(s, "bpp[%d]:%u ",
> +                                               i, fb->format->bpp[i]);
>                         seq_puts(s, "\n\t");
>
>                         seq_printf(s, "modifier:%8llu ", fb->modifier);
> diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
> index ff14555..61ab4dc 100644
> --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
> +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
> @@ -790,7 +790,7 @@ static void mdp5_crtc_restore_cursor(struct drm_crtc *crtc)
>         width = mdp5_crtc->cursor.width;
>         height = mdp5_crtc->cursor.height;
>
> -       stride = width * info->cpp[0];
> +       stride = width * info->bpp[0] / 8;
>
>         get_roi(crtc, &roi_w, &roi_h);
>
> diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c
> index 776337f..992477d 100644
> --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c
> +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c
> @@ -147,7 +147,7 @@ uint32_t mdp5_smp_calculate(struct mdp5_smp *smp,
>         for (i = 0; i < nplanes; i++) {
>                 int n, fetch_stride, cpp;
>
> -               cpp = info->cpp[i];
> +               cpp = info->bpp[i] / 8;

Unless I missed something in your first patch, I don't think this
series is bisectable, ie. replacing cpp w/ bpp would cause everything
else not to compile.  Looks like there was an alternative proposal on
the first patch, but if we do end up going this route, I think you
should add bpp in the first patch, and remove cpp in the last patch.
(And also probably sprinkle around WARN_ON(info->bpp[n] % 8) in places
were it is expected to be a multiple of 8)

BR,
-R


>                 fetch_stride = width * cpp / (i ? hsub : 1);
>
>                 n = DIV_ROUND_UP(fetch_stride * nlines, smp->blk_size);
> diff --git a/drivers/gpu/drm/msm/msm_fb.c b/drivers/gpu/drm/msm/msm_fb.c
> index 5bcd5e5..4545fa1 100644
> --- a/drivers/gpu/drm/msm/msm_fb.c
> +++ b/drivers/gpu/drm/msm/msm_fb.c
> @@ -172,7 +172,7 @@ static struct drm_framebuffer *msm_framebuffer_init(struct drm_device *dev,
>                 unsigned int min_size;
>
>                 min_size = (height - 1) * mode_cmd->pitches[i]
> -                        + width * info->cpp[i]
> +                        + width * info->bpp[i] / 8
>                          + mode_cmd->offsets[i];
>
>                 if (bos[i]->size < min_size) {
> --
> 2.7.4
>
>
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-09-23 16:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-23 12:41 [PATCH 06/36] drm/amd: use bpp instead of cpp for drm_format_info Sandy Huang
2019-09-23 12:41 ` [PATCH 07/36] drm/gma500: " Sandy Huang
2019-09-23 12:41 ` [PATCH 08/36] drm/msm: " Sandy Huang
2019-09-23 16:53   ` Rob Clark
2019-09-23 12:41 ` [PATCH 09/36] dm/vmwgfx: " Sandy Huang
2019-09-23 12:41 ` [PATCH 10/36] drm/arm: " Sandy Huang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).