At the moment we calculate the buffer's pitch with:

  pitch = width * DIV_ROUND_UP(bpp, 8)

For CLUT modes with bpp of 1/2/4/8 this gives wrong result, and the
correct pitch is:

  pitch = DIV_ROUND_UP(width * bpp, 8)

In practice this doesn't change anything, as we don't support CLUT
modes, but it's better to have the pitch calculation correct.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen at ti.com>

diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c 
b/drivers/gpu/drm/omapdrm/omap_fbdev.c
index cb6af7757720..42831b8c46b9 100644
--- a/drivers/gpu/drm/omapdrm/omap_fbdev.c
+++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c
@@ -125,8 +125,8 @@ static int omap_fbdev_create(struct drm_fb_helper *helper,
        mode_cmd.width = sizes->surface_width;
        mode_cmd.height = sizes->surface_height;

-       mode_cmd.pitches[0] = mode_cmd.width *
-               DIV_ROUND_UP(sizes->surface_bpp, 8);
+       mode_cmd.pitches[0] =
+                       DIV_ROUND_UP(mode_cmd.width * sizes->surface_bpp, 8);

        fbdev->ywrap_enabled = priv->has_dmm && ywrap_enabled;
        if (fbdev->ywrap_enabled) {
diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c 
b/drivers/gpu/drm/omapdrm/omap_gem.c
index 7ea1e00d8ca6..23af01eb1773 100644
--- a/drivers/gpu/drm/omapdrm/omap_gem.c
+++ b/drivers/gpu/drm/omapdrm/omap_gem.c
@@ -660,7 +660,7 @@ int omap_gem_dumb_create(struct drm_file *file, struct 
drm_device *dev,
 {
        union omap_gem_size gsize;

-       args->pitch = args->width * DIV_ROUND_UP(args->bpp, 8);
+       args->pitch = DIV_ROUND_UP(args->width * args->bpp, 8);

        args->size = PAGE_ALIGN(args->pitch * args->height);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160419/2005f9eb/attachment.sig>

Reply via email to