Skip to contentSkip to conversation

nouveau: nv50: fix ->pseudo_palette usage

PATCH In review Alexey Dobriyan 3 participants 4 messages Jan 3, 2010 – Jan 9, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nouveau: nv50: fix ->pseudo_palette usage

Sometimes struct fb_fillrect::color is color, sometimes palette index.

Steps to reproduce:

make menuconfig

Blue background will have quite random black color.

---

 drivers/gpu/drm/nouveau/nv50_fbcon.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nv50_fbcon.c +7 -1
@@ -10,6 +10,7 @@ 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;
 
 	if (info->state != FBINFO_STATE_RUNNING)
 		return;
@@ -31,7 +32,12 @@ 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, rect->color);
+	if (info->fix.visual == FB_VISUAL_TRUECOLOR ||
+	    info->fix.visual == FB_VISUAL_DIRECTCOLOR) {
+		color = ((uint32_t *)info->pseudo_palette)[rect->color];
+	} else
+		color = rect->color;
+	OUT_RING(chan, color);
 	BEGIN_RING(chan, NvSub2D, 0x0600, 4);
 	OUT_RING(chan, rect->dx);
 	OUT_RING(chan, rect->dy);
#1 lore raw
Quoted 1 line · Alexey Dobriyan

Sometimes struct fb_fillrect::color is color, sometimes palette index.

This doesn't apply on current git, which already has a similar (though, not quite the same) patch applied. We may yet need some additional fixes from your patch, I'll look at testing that soon.

Ben.

Quoted 41 lines

Steps to reproduce:

make menuconfig

Blue background will have quite random black color.

---

 drivers/gpu/drm/nouveau/nv50_fbcon.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nv50_fbcon.c +7 -1
@@ -10,6 +10,7 @@ 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;
 
 	if (info->state != FBINFO_STATE_RUNNING)
 		return;
@@ -31,7 +32,12 @@ 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, rect->color);
+	if (info->fix.visual == FB_VISUAL_TRUECOLOR ||
+	    info->fix.visual == FB_VISUAL_DIRECTCOLOR) {
+		color = ((uint32_t *)info->pseudo_palette)[rect->color];
+	} else
+		color = rect->color;
+	OUT_RING(chan, color);
 	BEGIN_RING(chan, NvSub2D, 0x0600, 4);
 	OUT_RING(chan, rect->dx);
 	OUT_RING(chan, rect->dy);

_______________________________________________
Nouveau mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

#2 lore raw
Quoted 5 lines · Ben Skeggs
Quoted 1 line · Alexey Dobriyan

Sometimes struct fb_fillrect::color is color, sometimes palette index.

This doesn't apply on current git, which already has a similar (though, not quite the same) patch applied. We may yet need some additional fixes from your patch, I'll look at testing that soon.

Ehh?
They're the same except I haven't changed nv04, because of no hardware.

Quoted 22 lines
Quoted 22 lines
drivers/gpu/drm/nouveau/nv50_fbcon.c +7 -1
@@ -10,6 +10,7 @@ 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;
 
 	if (info->state != FBINFO_STATE_RUNNING)
 		return;
@@ -31,7 +32,12 @@ 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, rect->color);
+	if (info->fix.visual == FB_VISUAL_TRUECOLOR ||
+	    info->fix.visual == FB_VISUAL_DIRECTCOLOR) {
+		color = ((uint32_t *)info->pseudo_palette)[rect->color];
+	} else
+		color = rect->color;
+	OUT_RING(chan, color);
 	BEGIN_RING(chan, NvSub2D, 0x0600, 4);
#3 lore raw

This is the patch
http://cgit.freedesktop.org/nouveau/linux-2.6/commit/?id=aac125bb84c73a7637de5e85a6cc23ab81357552

Maybe a rebased patch went upstream (no idea if this happened already)?

Maarten.

Quoted 37 lines · Alexey Dobriyan
Quoted 5 lines · Ben Skeggs
Quoted 1 line · Alexey Dobriyan

Sometimes struct fb_fillrect::color is color, sometimes palette index.

This doesn't apply on current git, which already has a similar (though, not quite the same) patch applied.  We may yet need some additional fixes from your patch, I'll look at testing that soon.

Ehh?
They're the same except I haven't changed nv04, because of no hardware.

Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/nouveau/nv50_fbcon.c +1 -0
@@ -10,6 +10,7 @@ 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;
 
Quoted 14 lines
Quoted 4 lines
drivers/gpu/drm/nouveau/nv50_fbcon.c +0 -0
     if (info->state != FBINFO_STATE_RUNNING)
             return;
@@ -31,7 +32,12 @@ nv50_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
             OUT_RING(chan, 1);

drivers/gpu/drm/nouveau/nv50_fbcon.c nv50_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect) · line 41

Quoted 10 lines
drivers/gpu/drm/nouveau/nv50_fbcon.c +6 -1
     }
     BEGIN_RING(chan, NvSub2D, 0x0588, 1);
-   OUT_RING(chan, rect->color);
+   if (info->fix.visual == FB_VISUAL_TRUECOLOR ||
+       info->fix.visual == FB_VISUAL_DIRECTCOLOR) {
+           color = ((uint32_t *)info->pseudo_palette)[rect->color];
+   } else
+           color = rect->color;
+   OUT_RING(chan, color);
     BEGIN_RING(chan, NvSub2D, 0x0600, 4);

_______________________________________________
Nouveau mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau