All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 36/36] drm/omapdrm: use bpp instead of cpp for drm_format_info
@ 2019-09-23 12:54 ` Sandy Huang
  0 siblings, 0 replies; 2+ messages in thread
From: Sandy Huang @ 2019-09-23 12:54 UTC (permalink / raw)
  To: dri-devel, Tomi Valkeinen, 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/omapdrm/omap_fb.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c b/drivers/gpu/drm/omapdrm/omap_fb.c
index 1b8b510..d18aafa 100644
--- a/drivers/gpu/drm/omapdrm/omap_fb.c
+++ b/drivers/gpu/drm/omapdrm/omap_fb.c
@@ -87,7 +87,7 @@ static u32 get_linear_addr(struct drm_framebuffer *fb,
 	u32 offset;
 
 	offset = fb->offsets[n]
-	       + (x * format->cpp[n] / (n == 0 ? 1 : format->hsub))
+	       + (x * format->bpp[n] / 8 / (n == 0 ? 1 : format->hsub))
 	       + (y * fb->pitches[n] / (n == 0 ? 1 : format->vsub));
 
 	return plane->dma_addr + offset;
@@ -206,7 +206,7 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb,
 	}
 
 	/* convert to pixels: */
-	info->screen_width /= format->cpp[0];
+	info->screen_width /= format->bpp[0] / 8;
 
 	if (fb->format->format == DRM_FORMAT_NV12) {
 		plane = &omap_fb->planes[1];
@@ -382,10 +382,10 @@ struct drm_framebuffer *omap_framebuffer_init(struct drm_device *dev,
 		goto fail;
 	}
 
-	if (pitch % format->cpp[0]) {
+	if (pitch % (format->bpp[0] / 8)) {
 		dev_dbg(dev->dev,
 			"buffer pitch (%u bytes) is not a multiple of pixel size (%u bytes)\n",
-			pitch, format->cpp[0]);
+			pitch, format->bpp[0] / 8);
 		ret = -EINVAL;
 		goto fail;
 	}
-- 
2.7.4




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

* [PATCH 36/36] drm/omapdrm: use bpp instead of cpp for drm_format_info
@ 2019-09-23 12:54 ` Sandy Huang
  0 siblings, 0 replies; 2+ messages in thread
From: Sandy Huang @ 2019-09-23 12:54 UTC (permalink / raw)
  To: dri-devel, Tomi Valkeinen, David Airlie, Daniel Vetter; +Cc: 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/omapdrm/omap_fb.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c b/drivers/gpu/drm/omapdrm/omap_fb.c
index 1b8b510..d18aafa 100644
--- a/drivers/gpu/drm/omapdrm/omap_fb.c
+++ b/drivers/gpu/drm/omapdrm/omap_fb.c
@@ -87,7 +87,7 @@ static u32 get_linear_addr(struct drm_framebuffer *fb,
 	u32 offset;
 
 	offset = fb->offsets[n]
-	       + (x * format->cpp[n] / (n == 0 ? 1 : format->hsub))
+	       + (x * format->bpp[n] / 8 / (n == 0 ? 1 : format->hsub))
 	       + (y * fb->pitches[n] / (n == 0 ? 1 : format->vsub));
 
 	return plane->dma_addr + offset;
@@ -206,7 +206,7 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb,
 	}
 
 	/* convert to pixels: */
-	info->screen_width /= format->cpp[0];
+	info->screen_width /= format->bpp[0] / 8;
 
 	if (fb->format->format == DRM_FORMAT_NV12) {
 		plane = &omap_fb->planes[1];
@@ -382,10 +382,10 @@ struct drm_framebuffer *omap_framebuffer_init(struct drm_device *dev,
 		goto fail;
 	}
 
-	if (pitch % format->cpp[0]) {
+	if (pitch % (format->bpp[0] / 8)) {
 		dev_dbg(dev->dev,
 			"buffer pitch (%u bytes) is not a multiple of pixel size (%u bytes)\n",
-			pitch, format->cpp[0]);
+			pitch, format->bpp[0] / 8);
 		ret = -EINVAL;
 		goto fail;
 	}
-- 
2.7.4



_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-23 12:54 [PATCH 36/36] drm/omapdrm: use bpp instead of cpp for drm_format_info Sandy Huang
2019-09-23 12:54 ` Sandy Huang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.