dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: ville.syrjala@linux.intel.com
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 libdrm 2/3] modetest: Make RGB565 pwetty too
Date: Thu, 18 Apr 2013 17:30:04 +0200	[thread overview]
Message-ID: <1859632.Re8rrHAmLF@avalon> (raw)
In-Reply-To: <1366298819-27290-2-git-send-email-ville.syrjala@linux.intel.com>

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

  reply	other threads:[~2013-04-18 15:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1859632.Re8rrHAmLF@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ville.syrjala@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox