From: Ben Skeggs <[email protected]>

Depending on the visual, the colours handed to us in fillrect() can either be
an actual colour, or an index into the pseudo-palette.

Signed-off-by: Ben Skeggs <[email protected]>

 drivers/gpu/drm/nouveau/nv04_fbcon.c |    7 +++++--
 drivers/gpu/drm/nouveau/nv50_fbcon.c |    7 +++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

---

http://git.linuxtv.org/v4l-dvb.git?a=commitdiff;h=bf5302b9496b25fe80ffa8a4fd191ad95c217864

diff --git a/drivers/gpu/drm/nouveau/nv04_fbcon.c 
b/drivers/gpu/drm/nouveau/nv04_fbcon.c
index d2d7f08..bd08a0d 100644
--- a/drivers/gpu/drm/nouveau/nv04_fbcon.c
+++ b/drivers/gpu/drm/nouveau/nv04_fbcon.c
@@ -62,7 +62,6 @@ nv04_fbcon_fillrect(struct fb_info *info, const struct 
fb_fillrect *rect)
        struct drm_device *dev = par->dev;
        struct drm_nouveau_private *dev_priv = dev->dev_private;
        struct nouveau_channel *chan = dev_priv->channel;
-       uint32_t color = ((uint32_t *) info->pseudo_palette)[rect->color];
 
        if (info->state != FBINFO_STATE_RUNNING)
                return;
@@ -80,7 +79,11 @@ nv04_fbcon_fillrect(struct fb_info *info, const struct 
fb_fillrect *rect)
        BEGIN_RING(chan, NvSubGdiRect, 0x02fc, 1);
        OUT_RING(chan, (rect->rop != ROP_COPY) ? 1 : 3);
        BEGIN_RING(chan, NvSubGdiRect, 0x03fc, 1);
-       OUT_RING(chan, color);
+       if (info->fix.visual == FB_VISUAL_TRUECOLOR ||
+           info->fix.visual == FB_VISUAL_DIRECTCOLOR)
+               OUT_RING(chan, ((uint32_t *)info->pseudo_palette)[rect->color]);
+       else
+               OUT_RING(chan, rect->color);
        BEGIN_RING(chan, NvSubGdiRect, 0x0400, 2);
        OUT_RING(chan, (rect->dx << 16) | rect->dy);
        OUT_RING(chan, (rect->width << 16) | rect->height);
diff --git a/drivers/gpu/drm/nouveau/nv50_fbcon.c 
b/drivers/gpu/drm/nouveau/nv50_fbcon.c
index c966ef8..cc34356 100644
--- a/drivers/gpu/drm/nouveau/nv50_fbcon.c
+++ b/drivers/gpu/drm/nouveau/nv50_fbcon.c
@@ -10,7 +10,6 @@ nv50_fbcon_fillrect(struct fb_info *info, const struct 
fb_fillrect *rect)
        struct drm_device *dev = par->dev;
        struct drm_nouveau_private *dev_priv = dev->dev_private;
        struct nouveau_channel *chan = dev_priv->channel;
-       uint32_t color = ((uint32_t *) info->pseudo_palette)[rect->color];
 
        if (info->state != FBINFO_STATE_RUNNING)
                return;
@@ -32,7 +31,11 @@ nv50_fbcon_fillrect(struct fb_info *info, const struct 
fb_fillrect *rect)
                OUT_RING(chan, 1);
        }
        BEGIN_RING(chan, NvSub2D, 0x0588, 1);
-       OUT_RING(chan, color);
+       if (info->fix.visual == FB_VISUAL_TRUECOLOR ||
+           info->fix.visual == FB_VISUAL_DIRECTCOLOR)
+               OUT_RING(chan, ((uint32_t *)info->pseudo_palette)[rect->color]);
+       else
+               OUT_RING(chan, rect->color);
        BEGIN_RING(chan, NvSub2D, 0x0600, 4);
        OUT_RING(chan, rect->dx);
        OUT_RING(chan, rect->dy);

_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to