Skip to contentSkip to conversation

lib/igt_chamelium: Create pixman image with bytes per pixel, not bits

PATCH In review Paul Kocialkowski 2 participants 2 messages Jun 16, 2017 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib/igt_chamelium: Create pixman image with bytes per pixel, not bits

The pixman_image_create_bits function expects bytes per pixels as fifth argument, not bits per pixels.

This divides the PIXMAN_FORMAT_BPP macro's result by 8 to get it in bytes per pixels instead of bits per pixels.

---
 lib/igt_chamelium.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/igt_chamelium.c +1 -1
index 2315ce60..4a2af796 100644
@@ -967,7 +967,7 @@ static pixman_image_t *convert_frame_format(pixman_image_t *src,
 	int w = pixman_image_get_width(src), h = pixman_image_get_height(src);
 
 	converted = pixman_image_create_bits(format, w, h, NULL,
-					     PIXMAN_FORMAT_BPP(format) * w);
+					     PIXMAN_FORMAT_BPP(format) / 8 * w);
 	pixman_image_composite(PIXMAN_OP_ADD, src, NULL, converted,
 			       0, 0, 0, 0, 0, 0, w, h);
 
Signature · 6 lines
2.13.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

RB'd and pushed, thanks!

Quoted 29 lines · Paul Kocialkowski

The pixman_image_create_bits function expects bytes per pixels as fifth
argument, not bits per pixels.

This divides the PIXMAN_FORMAT_BPP macro's result by 8 to get it in bytes per pixels instead of bits per pixels.

---
 lib/igt_chamelium.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
lib/igt_chamelium.c +0 -0
index 2315ce60..4a2af796 100644
@@ -967,7 +967,7 @@ static pixman_image_t
 *convert_frame_format(pixman_image_t *src,

  int w = pixman_image_get_width(src), h = pixman_image_get_height(src);

  converted = pixman_image_create_bits(format, w, h, NULL,

lib/igt_chamelium.c +0 -1
-					     PIXMAN_FORMAT_BPP(forma

t) * w);

lib/igt_chamelium.c +1 -0
+					     PIXMAN_FORMAT_BPP(forma

t) / 8 * w);
  pixman_image_composite(PIXMAN_OP_ADD, src, NULL, converted, 0, 0, 0, 0, 0, 0, w, h);

Signature · 6 lines
Cheers,
	Lyude
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx