dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH libdrm 1/3] modetest: Pass format_info to fill_tiles functions
@ 2013-04-18 15:26 ville.syrjala
  2013-04-18 15:26 ` [PATCH v2 libdrm 2/3] modetest: Make RGB565 pwetty too ville.syrjala
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: ville.syrjala @ 2013-04-18 15:26 UTC (permalink / raw)
  To: dri-devel; +Cc: Laurent Pinchart

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

The fourcc is inside the format_info structure, so if we want to use
it inside the various fill_tiles functions, we need to pass down the
whole format_info, not just the rgb/yuv infos.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 tests/modetest/buffers.c | 27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/tests/modetest/buffers.c b/tests/modetest/buffers.c
index b249f1f..2f3adf8 100644
--- a/tests/modetest/buffers.c
+++ b/tests/modetest/buffers.c
@@ -702,11 +702,12 @@ make_pwetty(void *data, int width, int height, int stride)
 }
 
 static void
-fill_tiles_yuv_planar(const struct yuv_info *yuv,
+fill_tiles_yuv_planar(const struct format_info *info,
 		      unsigned char *y_mem, unsigned char *u_mem,
 		      unsigned char *v_mem, unsigned int width,
 		      unsigned int height, unsigned int stride)
 {
+	const struct yuv_info *yuv = &info->yuv;
 	unsigned int cs = yuv->chroma_stride;
 	unsigned int xsub = yuv->xsub;
 	unsigned int ysub = yuv->ysub;
@@ -736,10 +737,11 @@ fill_tiles_yuv_planar(const struct yuv_info *yuv,
 }
 
 static void
-fill_tiles_yuv_packed(const struct yuv_info *yuv, unsigned char *mem,
+fill_tiles_yuv_packed(const struct format_info *info, unsigned char *mem,
 		      unsigned int width, unsigned int height,
 		      unsigned int stride)
 {
+	const struct yuv_info *yuv = &info->yuv;
 	unsigned char *y_mem = (yuv->order & YUV_YC) ? mem : mem + 1;
 	unsigned char *c_mem = (yuv->order & YUV_CY) ? mem : mem + 1;
 	unsigned int u = (yuv->order & YUV_YCrCb) ? 2 : 0;
@@ -768,9 +770,10 @@ fill_tiles_yuv_packed(const struct yuv_info *yuv, unsigned char *mem,
 }
 
 static void
-fill_tiles_rgb16(const struct rgb_info *rgb, unsigned char *mem,
+fill_tiles_rgb16(const struct format_info *info, unsigned char *mem,
 		 unsigned int width, unsigned int height, unsigned int stride)
 {
+	const struct rgb_info *rgb = &info->rgb;
 	unsigned int x, y;
 
 	for (y = 0; y < height; ++y) {
@@ -790,9 +793,10 @@ fill_tiles_rgb16(const struct rgb_info *rgb, unsigned char *mem,
 }
 
 static void
-fill_tiles_rgb24(const struct rgb_info *rgb, unsigned char *mem,
+fill_tiles_rgb24(const struct format_info *info, unsigned char *mem,
 		 unsigned int width, unsigned int height, unsigned int stride)
 {
+	const struct rgb_info *rgb = &info->rgb;
 	unsigned int x, y;
 
 	for (y = 0; y < height; ++y) {
@@ -811,9 +815,10 @@ fill_tiles_rgb24(const struct rgb_info *rgb, unsigned char *mem,
 }
 
 static void
-fill_tiles_rgb32(const struct rgb_info *rgb, unsigned char *mem,
+fill_tiles_rgb32(const struct format_info *info, unsigned char *mem,
 		 unsigned int width, unsigned int height, unsigned int stride)
 {
+	const struct rgb_info *rgb = &info->rgb;
 	unsigned char *mem_base = mem;
 	unsigned int x, y;
 
@@ -846,7 +851,7 @@ fill_tiles(const struct format_info *info, void *planes[3], unsigned int width,
 	case DRM_FORMAT_VYUY:
 	case DRM_FORMAT_YUYV:
 	case DRM_FORMAT_YVYU:
-		return fill_tiles_yuv_packed(&info->yuv, planes[0],
+		return fill_tiles_yuv_packed(info, planes[0],
 					     width, height, stride);
 
 	case DRM_FORMAT_NV12:
@@ -855,11 +860,11 @@ fill_tiles(const struct format_info *info, void *planes[3], unsigned int width,
 	case DRM_FORMAT_NV61:
 		u = info->yuv.order & YUV_YCbCr ? planes[1] : planes[1] + 1;
 		v = info->yuv.order & YUV_YCrCb ? planes[1] : planes[1] + 1;
-		return fill_tiles_yuv_planar(&info->yuv, planes[0], u, v,
+		return fill_tiles_yuv_planar(info, planes[0], u, v,
 					     width, height, stride);
 
 	case DRM_FORMAT_YVU420:
-		return fill_tiles_yuv_planar(&info->yuv, planes[0], planes[1],
+		return fill_tiles_yuv_planar(info, planes[0], planes[1],
 					     planes[2], width, height, stride);
 
 	case DRM_FORMAT_ARGB4444:
@@ -880,12 +885,12 @@ fill_tiles(const struct format_info *info, void *planes[3], unsigned int width,
 	case DRM_FORMAT_RGBX5551:
 	case DRM_FORMAT_BGRA5551:
 	case DRM_FORMAT_BGRX5551:
-		return fill_tiles_rgb16(&info->rgb, planes[0],
+		return fill_tiles_rgb16(info, planes[0],
 					width, height, stride);
 
 	case DRM_FORMAT_BGR888:
 	case DRM_FORMAT_RGB888:
-		return fill_tiles_rgb24(&info->rgb, planes[0],
+		return fill_tiles_rgb24(info, planes[0],
 					width, height, stride);
 	case DRM_FORMAT_ARGB8888:
 	case DRM_FORMAT_XRGB8888:
@@ -903,7 +908,7 @@ fill_tiles(const struct format_info *info, void *planes[3], unsigned int width,
 	case DRM_FORMAT_RGBX1010102:
 	case DRM_FORMAT_BGRA1010102:
 	case DRM_FORMAT_BGRX1010102:
-		return fill_tiles_rgb32(&info->rgb, planes[0],
+		return fill_tiles_rgb32(info, planes[0],
 					width, height, stride);
 	}
 }
-- 
1.8.1.5

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 libdrm 2/3] modetest: Make RGB565 pwetty too
  2013-04-18 15:26 [PATCH libdrm 1/3] modetest: Pass format_info to fill_tiles functions ville.syrjala
@ 2013-04-18 15:26 ` ville.syrjala
  2013-04-18 15:30   ` Laurent Pinchart
  2013-04-18 15:26 ` [PATCH libdrm 3/3] modetest: Add YUV420 support and fix YVU420 Cb/Cr ordering ville.syrjala
  2013-04-18 15:29 ` [PATCH libdrm 1/3] modetest: Pass format_info to fill_tiles functions Laurent Pinchart
  2 siblings, 1 reply; 5+ messages in thread
From: ville.syrjala @ 2013-04-18 15:26 UTC (permalink / raw)
  To: dri-devel; +Cc: Laurent Pinchart

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Render the crosshairs for 565 and x888/a888 formats.

v2: Use the drm format to determine cairo format

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 tests/modetest/buffers.c | 26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/tests/modetest/buffers.c b/tests/modetest/buffers.c
index 2f3adf8..abacea5 100644
--- a/tests/modetest/buffers.c
+++ b/tests/modetest/buffers.c
@@ -656,15 +656,32 @@ fill_smpte(const struct format_info *info, void *planes[3], unsigned int width,
 #define BLUE  0
 
 static void
-make_pwetty(void *data, int width, int height, int stride)
+make_pwetty(void *data, int width, int height, int stride, uint32_t format)
 {
 #ifdef HAVE_CAIRO
 	cairo_surface_t *surface;
 	cairo_t *cr;
 	int x, y;
+	cairo_format_t cairo_format;
+
+	/* we can ignore the order of R,G,B channels */
+	switch (format) {
+	case DRM_FORMAT_XRGB8888:
+	case DRM_FORMAT_ARGB8888:
+	case DRM_FORMAT_XBGR8888:
+	case DRM_FORMAT_ABGR8888:
+		cairo_format = CAIRO_FORMAT_ARGB32;
+		break;
+	case DRM_FORMAT_RGB565:
+	case DRM_FORMAT_BGR565:
+		cairo_format = CAIRO_FORMAT_RGB16_565;
+		break;
+	default:
+		return;
+	}
 
 	surface = cairo_image_surface_create_for_data(data,
-						      CAIRO_FORMAT_ARGB32,
+						      cairo_format,
 						      width, height,
 						      stride);
 	cr = cairo_create(surface);
@@ -774,6 +791,7 @@ fill_tiles_rgb16(const struct format_info *info, unsigned char *mem,
 		 unsigned int width, unsigned int height, unsigned int stride)
 {
 	const struct rgb_info *rgb = &info->rgb;
+	unsigned char *mem_base = mem;
 	unsigned int x, y;
 
 	for (y = 0; y < height; ++y) {
@@ -790,6 +808,8 @@ fill_tiles_rgb16(const struct format_info *info, unsigned char *mem,
 		}
 		mem += stride;
 	}
+
+	make_pwetty(mem_base, width, height, stride, info->format);
 }
 
 static void
@@ -837,7 +857,7 @@ fill_tiles_rgb32(const struct format_info *info, unsigned char *mem,
 		mem += stride;
 	}
 
-	make_pwetty(mem_base, width, height, stride);
+	make_pwetty(mem_base, width, height, stride, info->format);
 }
 
 static void
-- 
1.8.1.5

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH libdrm 3/3] modetest: Add YUV420 support and fix YVU420 Cb/Cr ordering
  2013-04-18 15:26 [PATCH libdrm 1/3] modetest: Pass format_info to fill_tiles functions ville.syrjala
  2013-04-18 15:26 ` [PATCH v2 libdrm 2/3] modetest: Make RGB565 pwetty too ville.syrjala
@ 2013-04-18 15:26 ` ville.syrjala
  2013-04-18 15:29 ` [PATCH libdrm 1/3] modetest: Pass format_info to fill_tiles functions Laurent Pinchart
  2 siblings, 0 replies; 5+ messages in thread
From: ville.syrjala @ 2013-04-18 15:26 UTC (permalink / raw)
  To: dri-devel; +Cc: Laurent Pinchart

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

YUV420 support is trivial to add since the code already supports
YVU420.

But it looks like the YVU420 support is a bit broken. The chroma
planes are passed in the wrong order to the fill functions, so
fix that while were at it.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
Note: I determined the the Cb/Cr ordering issue based on a very cursory
glance at the code, I didn't really read through the rendering code to make
sure I got it right. Also I couldn't test this since I don't have
hardware/driver support for planar formats currently.

 tests/modetest/buffers.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/tests/modetest/buffers.c b/tests/modetest/buffers.c
index abacea5..b75cca7 100644
--- a/tests/modetest/buffers.c
+++ b/tests/modetest/buffers.c
@@ -100,6 +100,7 @@ static const struct format_info format_info[] = {
 	{ DRM_FORMAT_NV16, "NV16", MAKE_YUV_INFO(YUV_YCbCr, 2, 1, 2) },
 	{ DRM_FORMAT_NV61, "NV61", MAKE_YUV_INFO(YUV_YCrCb, 2, 1, 2) },
 	/* YUV planar */
+	{ DRM_FORMAT_YUV420, "YU12", MAKE_YUV_INFO(YUV_YCbCr, 2, 2, 1) },
 	{ DRM_FORMAT_YVU420, "YV12", MAKE_YUV_INFO(YUV_YCrCb, 2, 2, 1) },
 	/* RGB16 */
 	{ DRM_FORMAT_ARGB4444, "AR12", MAKE_RGB_INFO(4, 8, 4, 4, 4, 0, 4, 12) },
@@ -600,10 +601,14 @@ fill_smpte(const struct format_info *info, void *planes[3], unsigned int width,
 		return fill_smpte_yuv_planar(&info->yuv, planes[0], u, v,
 					     width, height, stride);
 
-	case DRM_FORMAT_YVU420:
+	case DRM_FORMAT_YUV420:
 		return fill_smpte_yuv_planar(&info->yuv, planes[0], planes[1],
 					     planes[2], width, height, stride);
 
+	case DRM_FORMAT_YVU420:
+		return fill_smpte_yuv_planar(&info->yuv, planes[0], planes[2],
+					     planes[1], width, height, stride);
+
 	case DRM_FORMAT_ARGB4444:
 	case DRM_FORMAT_XRGB4444:
 	case DRM_FORMAT_ABGR4444:
@@ -883,10 +888,14 @@ fill_tiles(const struct format_info *info, void *planes[3], unsigned int width,
 		return fill_tiles_yuv_planar(info, planes[0], u, v,
 					     width, height, stride);
 
-	case DRM_FORMAT_YVU420:
+	case DRM_FORMAT_YUV420:
 		return fill_tiles_yuv_planar(info, planes[0], planes[1],
 					     planes[2], width, height, stride);
 
+	case DRM_FORMAT_YVU420:
+		return fill_tiles_yuv_planar(info, planes[0], planes[2],
+					     planes[1], width, height, stride);
+
 	case DRM_FORMAT_ARGB4444:
 	case DRM_FORMAT_XRGB4444:
 	case DRM_FORMAT_ABGR4444:
@@ -1075,6 +1084,7 @@ create_test_buffer(struct kms_driver *kms, unsigned int format,
 		planes[1] = virtual + offsets[1];
 		break;
 
+	case DRM_FORMAT_YUV420:
 	case DRM_FORMAT_YVU420:
 		offsets[0] = 0;
 		kms_bo_get_prop(bo, KMS_HANDLE, &handles[0]);
-- 
1.8.1.5

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH libdrm 1/3] modetest: Pass format_info to fill_tiles functions
  2013-04-18 15:26 [PATCH libdrm 1/3] modetest: Pass format_info to fill_tiles functions ville.syrjala
  2013-04-18 15:26 ` [PATCH v2 libdrm 2/3] modetest: Make RGB565 pwetty too ville.syrjala
  2013-04-18 15:26 ` [PATCH libdrm 3/3] modetest: Add YUV420 support and fix YVU420 Cb/Cr ordering ville.syrjala
@ 2013-04-18 15:29 ` Laurent Pinchart
  2 siblings, 0 replies; 5+ messages in thread
From: Laurent Pinchart @ 2013-04-18 15:29 UTC (permalink / raw)
  To: ville.syrjala; +Cc: dri-devel

On Thursday 18 April 2013 18:26:57 ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> The fourcc is inside the format_info structure, so if we want to use
> it inside the various fill_tiles functions, we need to pass down the
> whole format_info, not just the rgb/yuv infos.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  tests/modetest/buffers.c | 27 ++++++++++++++++-----------
>  1 file changed, 16 insertions(+), 11 deletions(-)
> 
> diff --git a/tests/modetest/buffers.c b/tests/modetest/buffers.c
> index b249f1f..2f3adf8 100644
> --- a/tests/modetest/buffers.c
> +++ b/tests/modetest/buffers.c
> @@ -702,11 +702,12 @@ make_pwetty(void *data, int width, int height, int
> stride) }
> 
>  static void
> -fill_tiles_yuv_planar(const struct yuv_info *yuv,
> +fill_tiles_yuv_planar(const struct format_info *info,
>  		      unsigned char *y_mem, unsigned char *u_mem,
>  		      unsigned char *v_mem, unsigned int width,
>  		      unsigned int height, unsigned int stride)
>  {
> +	const struct yuv_info *yuv = &info->yuv;
>  	unsigned int cs = yuv->chroma_stride;
>  	unsigned int xsub = yuv->xsub;
>  	unsigned int ysub = yuv->ysub;
> @@ -736,10 +737,11 @@ fill_tiles_yuv_planar(const struct yuv_info *yuv,
>  }
> 
>  static void
> -fill_tiles_yuv_packed(const struct yuv_info *yuv, unsigned char *mem,
> +fill_tiles_yuv_packed(const struct format_info *info, unsigned char *mem,
>  		      unsigned int width, unsigned int height,
>  		      unsigned int stride)
>  {
> +	const struct yuv_info *yuv = &info->yuv;
>  	unsigned char *y_mem = (yuv->order & YUV_YC) ? mem : mem + 1;
>  	unsigned char *c_mem = (yuv->order & YUV_CY) ? mem : mem + 1;
>  	unsigned int u = (yuv->order & YUV_YCrCb) ? 2 : 0;
> @@ -768,9 +770,10 @@ fill_tiles_yuv_packed(const struct yuv_info *yuv,
> unsigned char *mem, }
> 
>  static void
> -fill_tiles_rgb16(const struct rgb_info *rgb, unsigned char *mem,
> +fill_tiles_rgb16(const struct format_info *info, unsigned char *mem,
>  		 unsigned int width, unsigned int height, unsigned int stride)
>  {
> +	const struct rgb_info *rgb = &info->rgb;
>  	unsigned int x, y;
> 
>  	for (y = 0; y < height; ++y) {
> @@ -790,9 +793,10 @@ fill_tiles_rgb16(const struct rgb_info *rgb, unsigned
> char *mem, }
> 
>  static void
> -fill_tiles_rgb24(const struct rgb_info *rgb, unsigned char *mem,
> +fill_tiles_rgb24(const struct format_info *info, unsigned char *mem,
>  		 unsigned int width, unsigned int height, unsigned int stride)
>  {
> +	const struct rgb_info *rgb = &info->rgb;
>  	unsigned int x, y;
> 
>  	for (y = 0; y < height; ++y) {
> @@ -811,9 +815,10 @@ fill_tiles_rgb24(const struct rgb_info *rgb, unsigned
> char *mem, }
> 
>  static void
> -fill_tiles_rgb32(const struct rgb_info *rgb, unsigned char *mem,
> +fill_tiles_rgb32(const struct format_info *info, unsigned char *mem,
>  		 unsigned int width, unsigned int height, unsigned int stride)
>  {
> +	const struct rgb_info *rgb = &info->rgb;
>  	unsigned char *mem_base = mem;
>  	unsigned int x, y;
> 
> @@ -846,7 +851,7 @@ fill_tiles(const struct format_info *info, void
> *planes[3], unsigned int width, case DRM_FORMAT_VYUY:
>  	case DRM_FORMAT_YUYV:
>  	case DRM_FORMAT_YVYU:
> -		return fill_tiles_yuv_packed(&info->yuv, planes[0],
> +		return fill_tiles_yuv_packed(info, planes[0],
>  					     width, height, stride);
> 
>  	case DRM_FORMAT_NV12:
> @@ -855,11 +860,11 @@ fill_tiles(const struct format_info *info, void
> *planes[3], unsigned int width, case DRM_FORMAT_NV61:
>  		u = info->yuv.order & YUV_YCbCr ? planes[1] : planes[1] + 1;
>  		v = info->yuv.order & YUV_YCrCb ? planes[1] : planes[1] + 1;
> -		return fill_tiles_yuv_planar(&info->yuv, planes[0], u, v,
> +		return fill_tiles_yuv_planar(info, planes[0], u, v,
>  					     width, height, stride);
> 
>  	case DRM_FORMAT_YVU420:
> -		return fill_tiles_yuv_planar(&info->yuv, planes[0], planes[1],
> +		return fill_tiles_yuv_planar(info, planes[0], planes[1],
>  					     planes[2], width, height, stride);
> 
>  	case DRM_FORMAT_ARGB4444:
> @@ -880,12 +885,12 @@ fill_tiles(const struct format_info *info, void
> *planes[3], unsigned int width, case DRM_FORMAT_RGBX5551:
>  	case DRM_FORMAT_BGRA5551:
>  	case DRM_FORMAT_BGRX5551:
> -		return fill_tiles_rgb16(&info->rgb, planes[0],
> +		return fill_tiles_rgb16(info, planes[0],
>  					width, height, stride);
> 
>  	case DRM_FORMAT_BGR888:
>  	case DRM_FORMAT_RGB888:
> -		return fill_tiles_rgb24(&info->rgb, planes[0],
> +		return fill_tiles_rgb24(info, planes[0],
>  					width, height, stride);
>  	case DRM_FORMAT_ARGB8888:
>  	case DRM_FORMAT_XRGB8888:
> @@ -903,7 +908,7 @@ fill_tiles(const struct format_info *info, void
> *planes[3], unsigned int width, case DRM_FORMAT_RGBX1010102:
>  	case DRM_FORMAT_BGRA1010102:
>  	case DRM_FORMAT_BGRX1010102:
> -		return fill_tiles_rgb32(&info->rgb, planes[0],
> +		return fill_tiles_rgb32(info, planes[0],
>  					width, height, stride);
>  	}
>  }
-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 libdrm 2/3] modetest: Make RGB565 pwetty too
  2013-04-18 15:26 ` [PATCH v2 libdrm 2/3] modetest: Make RGB565 pwetty too ville.syrjala
@ 2013-04-18 15:30   ` Laurent Pinchart
  0 siblings, 0 replies; 5+ messages in thread
From: Laurent Pinchart @ 2013-04-18 15:30 UTC (permalink / raw)
  To: ville.syrjala; +Cc: dri-devel

On Thursday 18 April 2013 18:26:58 ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Render the crosshairs for 565 and x888/a888 formats.
> 
> v2: Use the drm format to determine cairo format
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  tests/modetest/buffers.c | 26 +++++++++++++++++++++++---
>  1 file changed, 23 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/modetest/buffers.c b/tests/modetest/buffers.c
> index 2f3adf8..abacea5 100644
> --- a/tests/modetest/buffers.c
> +++ b/tests/modetest/buffers.c
> @@ -656,15 +656,32 @@ fill_smpte(const struct format_info *info, void
> *planes[3], unsigned int width, #define BLUE  0
> 
>  static void
> -make_pwetty(void *data, int width, int height, int stride)
> +make_pwetty(void *data, int width, int height, int stride, uint32_t format)
> {
>  #ifdef HAVE_CAIRO
>  	cairo_surface_t *surface;
>  	cairo_t *cr;
>  	int x, y;
> +	cairo_format_t cairo_format;
> +
> +	/* we can ignore the order of R,G,B channels */
> +	switch (format) {
> +	case DRM_FORMAT_XRGB8888:
> +	case DRM_FORMAT_ARGB8888:
> +	case DRM_FORMAT_XBGR8888:
> +	case DRM_FORMAT_ABGR8888:
> +		cairo_format = CAIRO_FORMAT_ARGB32;
> +		break;
> +	case DRM_FORMAT_RGB565:
> +	case DRM_FORMAT_BGR565:
> +		cairo_format = CAIRO_FORMAT_RGB16_565;
> +		break;
> +	default:
> +		return;
> +	}
> 
>  	surface = cairo_image_surface_create_for_data(data,
> -						      CAIRO_FORMAT_ARGB32,
> +						      cairo_format,
>  						      width, height,
>  						      stride);
>  	cr = cairo_create(surface);
> @@ -774,6 +791,7 @@ fill_tiles_rgb16(const struct format_info *info,
> unsigned char *mem, unsigned int width, unsigned int height, unsigned int
> stride)
>  {
>  	const struct rgb_info *rgb = &info->rgb;
> +	unsigned char *mem_base = mem;
>  	unsigned int x, y;
> 
>  	for (y = 0; y < height; ++y) {
> @@ -790,6 +808,8 @@ fill_tiles_rgb16(const struct format_info *info,
> unsigned char *mem, }
>  		mem += stride;
>  	}
> +
> +	make_pwetty(mem_base, width, height, stride, info->format);
>  }
> 
>  static void
> @@ -837,7 +857,7 @@ fill_tiles_rgb32(const struct format_info *info,
> unsigned char *mem, mem += stride;
>  	}
> 
> -	make_pwetty(mem_base, width, height, stride);
> +	make_pwetty(mem_base, width, height, stride, info->format);
>  }
> 
>  static void
-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-04-18 15:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-18 15:26 [PATCH libdrm 1/3] modetest: Pass format_info to fill_tiles functions ville.syrjala
2013-04-18 15:26 ` [PATCH v2 libdrm 2/3] modetest: Make RGB565 pwetty too ville.syrjala
2013-04-18 15:30   ` Laurent Pinchart
2013-04-18 15:26 ` [PATCH libdrm 3/3] modetest: Add YUV420 support and fix YVU420 Cb/Cr ordering ville.syrjala
2013-04-18 15:29 ` [PATCH libdrm 1/3] modetest: Pass format_info to fill_tiles functions Laurent Pinchart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox