[PATCH] drm/nouveau: Fix fbcon corruption with font width not divisible by 8

Stefan Bader stefan.bader at canonical.com
Wed Oct 13 10:23:44 BST 2010


Patch depends on this simple change which I pulled into the drm33 tree:

Author: Matt Turner <mattst88 at gmail.com>
Date:   Wed Feb 24 23:27:10 2010 -0500

    drm/nouveau: use ALIGN instead of open coding it

    CC: Ben Skeggs <bskeggs at redhat.com>
    Signed-off-by: Matt Turner <mattst88 at gmail.com>
    Signed-off-by: Ben Skeggs <bskeggs at redhat.com>

diff --git a/drivers/gpu/drm/nouveau/nv04_fbcon.c b/drivers/gpu/drm/nouveau/nv04
index fd01caa..3da90c2 100644
--- a/drivers/gpu/drm/nouveau/nv04_fbcon.c
+++ b/drivers/gpu/drm/nouveau/nv04_fbcon.c
@@ -118,7 +118,7 @@ nv04_fbcon_imageblit(struct fb_info *info, const struct fb_i
                return;
        }

-       width = (image->width + 31) & ~31;
+       width = ALIGN(image->width, 32);
        dsize = (width * image->height) >> 5;

        if (info->fix.visual == FB_VISUAL_TRUECOLOR ||
diff --git a/drivers/gpu/drm/nouveau/nv50_fbcon.c b/drivers/gpu/drm/nouveau/nv50
index 0f57cdf..993c712 100644
--- a/drivers/gpu/drm/nouveau/nv50_fbcon.c
+++ b/drivers/gpu/drm/nouveau/nv50_fbcon.c
@@ -109,7 +109,7 @@ nv50_fbcon_imageblit(struct fb_info *info, const struct fb_i
                return;
        }

-       width = (image->width + 31) & ~31;
+       width = ALIGN(image->width, 32);
        dwords = (width * image->height) >> 5;

        BEGIN_RING(chan, NvSub2D, 0x0814, 2);
diff --git a/drivers/gpu/drm/nouveau/nv50_instmem.c b/drivers/gpu/drm/nouveau/nv
index f0dc4e3..de1f5b0 100644
--- a/drivers/gpu/drm/nouveau/nv50_instmem.c
+++ b/drivers/gpu/drm/nouveau/nv50_instmem.c
@@ -390,7 +390,7 @@ nv50_instmem_populate(struct drm_device *dev, struct nouveau
        if (gpuobj->im_backing)
                return -EINVAL;

-       *sz = (*sz + (NV50_INSTMEM_PAGE_SIZE-1)) & ~(NV50_INSTMEM_PAGE_SIZE-1);
+       *sz = ALIGN(*sz, NV50_INSTMEM_PAGE_SIZE);
        if (*sz == 0)
                return -EINVAL;





More information about the kernel-team mailing list