Skip to contentSkip to conversation

drm/i915: fix intel_framebuffer_pitch_for_width for <8bpp

PATCH In review Jesse Barnes 2 participants 2 messages Apr 2, 2013

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

PATCH 1/1 drm/i915: fix intel_framebuffer_pitch_for_width for <8bpp

As Imre pointed out, this will do the wrong thing.

---
 drivers/gpu/drm/i915/intel_drv.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_drv.h +1 -1
index 37f4bb3..18f0547 100644
@@ -137,7 +137,7 @@ struct intel_framebuffer {
 inline static u32
 intel_framebuffer_pitch_for_width(int width, int bpp)
 {
-	u32 pitch = DIV_ROUND_UP(width * bpp, 8);
+	u32 pitch = width * DIV_ROUND_UP(bpp, 8);
 	return ALIGN(pitch, 64);
 }
 
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 4 lines · Jesse Barnes

As Imre pointed out, this will do the wrong thing.

We don't actually support anything w/ bpp%8!=0, so either works. Actually, for something like bpp=4, the original code might even be more correct. But I don't really want to think about <8bpp stuff, so I won't object to the patch.

Quoted 24 lines
---
 drivers/gpu/drm/i915/intel_drv.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_drv.h +1 -1
index 37f4bb3..18f0547 100644
@@ -137,7 +137,7 @@ struct intel_framebuffer {
 inline static u32
 intel_framebuffer_pitch_for_width(int width, int bpp)
 {
-	u32 pitch = DIV_ROUND_UP(width * bpp, 8);
+	u32 pitch = width * DIV_ROUND_UP(bpp, 8);
 	return ALIGN(pitch, 64);
 }
 
Signature · 6 lines
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä
Intel OTC