All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH libdrm 2/5] modetest: Fix pitches, somewhat
Date: Thu, 18 Apr 2013 15:45:29 +0200	[thread overview]
Message-ID: <10216951.c4KTvrsAZh@avalon> (raw)
In-Reply-To: <1366226285-13282-2-git-send-email-ville.syrjala@linux.intel.com>

On Wednesday 17 April 2013 22:18:02 ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> libkms only has the xrgb8888 format, so we're overallocating the bo by
> quite a lot in some cases. But we still need to get the pitch from the
> libkms since it's the driver that decides how to align it.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

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

> ---
>  tests/modetest/buffers.c | 34 ++++++++++------------------------
>  1 file changed, 10 insertions(+), 24 deletions(-)
> 
> diff --git a/tests/modetest/buffers.c b/tests/modetest/buffers.c
> index 6b117b4..7f534a1 100644
> --- a/tests/modetest/buffers.c
> +++ b/tests/modetest/buffers.c
> @@ -948,9 +948,9 @@ create_test_buffer(struct kms_driver *kms, unsigned int
> format, case DRM_FORMAT_VYUY:
>  	case DRM_FORMAT_YUYV:
>  	case DRM_FORMAT_YVYU:
> -		pitches[0] = width * 2;
>  		offsets[0] = 0;
>  		kms_bo_get_prop(bo, KMS_HANDLE, &handles[0]);
> +		kms_bo_get_prop(bo, KMS_PITCH, &pitches[0]);
> 
>  		planes[0] = virtual;
>  		break;
> @@ -959,11 +959,11 @@ create_test_buffer(struct kms_driver *kms, unsigned
> int format, case DRM_FORMAT_NV21:
>  	case DRM_FORMAT_NV16:
>  	case DRM_FORMAT_NV61:
> -		pitches[0] = width;
>  		offsets[0] = 0;
>  		kms_bo_get_prop(bo, KMS_HANDLE, &handles[0]);
> -		pitches[1] = width;
> -		offsets[1] = width * height;
> +		kms_bo_get_prop(bo, KMS_PITCH, &pitches[0]);
> +		pitches[1] = pitches[0];
> +		offsets[1] = pitches[0] * height;
>  		kms_bo_get_prop(bo, KMS_HANDLE, &handles[1]);
> 
>  		planes[0] = virtual;
> @@ -971,14 +971,14 @@ create_test_buffer(struct kms_driver *kms, unsigned
> int format, break;
> 
>  	case DRM_FORMAT_YVU420:
> -		pitches[0] = width;
>  		offsets[0] = 0;
>  		kms_bo_get_prop(bo, KMS_HANDLE, &handles[0]);
> -		pitches[1] = width / 2;
> -		offsets[1] = width * height;
> +		kms_bo_get_prop(bo, KMS_PITCH, &pitches[0]);
> +		pitches[1] = pitches[0] / 2;
> +		offsets[1] = pitches[0] * height;
>  		kms_bo_get_prop(bo, KMS_HANDLE, &handles[1]);
> -		pitches[2] = width / 2;
> -		offsets[2] = offsets[1] + (width * height) / 4;
> +		pitches[2] = pitches[1];
> +		offsets[2] = offsets[1] + pitches[1] * height / 2;
>  		kms_bo_get_prop(bo, KMS_HANDLE, &handles[2]);
> 
>  		planes[0] = virtual;
> @@ -989,29 +989,15 @@ create_test_buffer(struct kms_driver *kms, unsigned
> int format, case DRM_FORMAT_RGB565:
>  	case DRM_FORMAT_ARGB1555:
>  	case DRM_FORMAT_XRGB1555:
> -		pitches[0] = width * 2;
> -		offsets[0] = 0;
> -		kms_bo_get_prop(bo, KMS_HANDLE, &handles[0]);
> -
> -		planes[0] = virtual;
> -		break;
> -
>  	case DRM_FORMAT_BGR888:
>  	case DRM_FORMAT_RGB888:
> -		pitches[0] = width * 3;
> -		offsets[0] = 0;
> -		kms_bo_get_prop(bo, KMS_HANDLE, &handles[0]);
> -
> -		planes[0] = virtual;
> -		break;
> -
>  	case DRM_FORMAT_ARGB8888:
>  	case DRM_FORMAT_BGRA8888:
>  	case DRM_FORMAT_XRGB8888:
>  	case DRM_FORMAT_BGRX8888:
> -		pitches[0] = width * 4;
>  		offsets[0] = 0;
>  		kms_bo_get_prop(bo, KMS_HANDLE, &handles[0]);
> +		kms_bo_get_prop(bo, KMS_PITCH, &pitches[0]);
> 
>  		planes[0] = virtual;
>  		break;
-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2013-04-18 13:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-17 19:18 [PATCH libdrm 1/5] modetest: Make RGB565 pwetty too ville.syrjala
2013-04-17 19:18 ` [PATCH libdrm 2/5] modetest: Fix pitches, somewhat ville.syrjala
2013-04-18 13:45   ` Laurent Pinchart [this message]
2013-04-17 19:18 ` [PATCH libdrm 3/5] modetest: Add support for all 16/32 bpp RGB formats ville.syrjala
2013-04-18 13:56   ` Laurent Pinchart
2013-04-17 19:18 ` [PATCH libdrm 4/5] modetest: Print possible_crtcs for planes ville.syrjala
2013-04-18 13:46   ` Laurent Pinchart
2013-04-17 19:18 ` [PATCH libdrm 5/5] modetest: Reduce the length of the connector type string ville.syrjala
2013-04-18 13:46   ` Laurent Pinchart
2013-04-18 13:43 ` [PATCH libdrm 1/5] modetest: Make RGB565 pwetty too Laurent Pinchart
2013-04-18 14:06   ` Ville Syrjälä
2013-04-18 14:19     ` Laurent Pinchart
2013-04-18 14:37       ` Ville Syrjälä

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=10216951.c4KTvrsAZh@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=dri-devel@lists.freedesktop.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.