aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2010-01-03 18:10:55 -0500
committerDave Airlie <airlied@redhat.com>2010-01-10 23:41:13 -0500
commit7de3643f938af910bef4c1f800176a3ebdc29502 (patch)
treec4355875502bcb83b55174843916160436f8cfb1
parentea911a1cf4f9c5bef18ff399ee2e2ec77792b650 (diff)
drm/nouveau: fix handling of fbcon colours in 8bpp
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 <bskeggs@redhat.com>
-rw-r--r--drivers/gpu/drm/nouveau/nv04_fbcon.c7
-rw-r--r--drivers/gpu/drm/nouveau/nv50_fbcon.c7
2 files changed, 10 insertions, 4 deletions
diff --git a/drivers/gpu/drm/nouveau/nv04_fbcon.c b/drivers/gpu/drm/nouveau/nv04_fbcon.c
index d2d7f0838dc9..bd08a0dc9841 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)
62 struct drm_device *dev = par->dev; 62 struct drm_device *dev = par->dev;
63 struct drm_nouveau_private *dev_priv = dev->dev_private; 63 struct drm_nouveau_private *dev_priv = dev->dev_private;
64 struct nouveau_channel *chan = dev_priv->channel; 64 struct nouveau_channel *chan = dev_priv->channel;
65 uint32_t color = ((uint32_t *) info->pseudo_palette)[rect->color];
66 65
67 if (info->state != FBINFO_STATE_RUNNING) 66 if (info->state != FBINFO_STATE_RUNNING)
68 return; 67 return;
@@ -80,7 +79,11 @@ nv04_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
80 BEGIN_RING(chan, NvSubGdiRect, 0x02fc, 1); 79 BEGIN_RING(chan, NvSubGdiRect, 0x02fc, 1);
81 OUT_RING(chan, (rect->rop != ROP_COPY) ? 1 : 3); 80 OUT_RING(chan, (rect->rop != ROP_COPY) ? 1 : 3);
82 BEGIN_RING(chan, NvSubGdiRect, 0x03fc, 1); 81 BEGIN_RING(chan, NvSubGdiRect, 0x03fc, 1);
83 OUT_RING(chan, color); 82 if (info->fix.visual == FB_VISUAL_TRUECOLOR ||
83 info->fix.visual == FB_VISUAL_DIRECTCOLOR)
84 OUT_RING(chan, ((uint32_t *)info->pseudo_palette)[rect->color]);
85 else
86 OUT_RING(chan, rect->color);
84 BEGIN_RING(chan, NvSubGdiRect, 0x0400, 2); 87 BEGIN_RING(chan, NvSubGdiRect, 0x0400, 2);
85 OUT_RING(chan, (rect->dx << 16) | rect->dy); 88 OUT_RING(chan, (rect->dx << 16) | rect->dy);
86 OUT_RING(chan, (rect->width << 16) | rect->height); 89 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 c966ef834853..cc34356ab0b5 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)
10 struct drm_device *dev = par->dev; 10 struct drm_device *dev = par->dev;
11 struct drm_nouveau_private *dev_priv = dev->dev_private; 11 struct drm_nouveau_private *dev_priv = dev->dev_private;
12 struct nouveau_channel *chan = dev_priv->channel; 12 struct nouveau_channel *chan = dev_priv->channel;
13 uint32_t color = ((uint32_t *) info->pseudo_palette)[rect->color];
14 13
15 if (info->state != FBINFO_STATE_RUNNING) 14 if (info->state != FBINFO_STATE_RUNNING)
16 return; 15 return;
@@ -32,7 +31,11 @@ nv50_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
32 OUT_RING(chan, 1); 31 OUT_RING(chan, 1);
33 } 32 }
34 BEGIN_RING(chan, NvSub2D, 0x0588, 1); 33 BEGIN_RING(chan, NvSub2D, 0x0588, 1);
35 OUT_RING(chan, color); 34 if (info->fix.visual == FB_VISUAL_TRUECOLOR ||
35 info->fix.visual == FB_VISUAL_DIRECTCOLOR)
36 OUT_RING(chan, ((uint32_t *)info->pseudo_palette)[rect->color]);
37 else
38 OUT_RING(chan, rect->color);
36 BEGIN_RING(chan, NvSub2D, 0x0600, 4); 39 BEGIN_RING(chan, NvSub2D, 0x0600, 4);
37 OUT_RING(chan, rect->dx); 40 OUT_RING(chan, rect->dx);
38 OUT_RING(chan, rect->dy); 41 OUT_RING(chan, rect->dy);