All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hyun Kwon <hyun.kwon@xilinx.com>
To: dri-devel@lists.freedesktop.org
Cc: Hyun Kwon <hyun.kwon@xilinx.com>
Subject: [PATCH libdrm 2/3] modetest: Add support for YUV422 and YUV444
Date: Sat, 7 Jul 2018 19:35:32 -0700	[thread overview]
Message-ID: <1531017333-1483-3-git-send-email-hyun.kwon@xilinx.com> (raw)
In-Reply-To: <1531017333-1483-1-git-send-email-hyun.kwon@xilinx.com>

This allows dumb buffer allocation for YUV422 and YUV444 with correct
subsampling values.

Signed-off-by: Hyun Kwon <hyun.kwon@xilinx.com>
---
 tests/modetest/buffers.c | 29 ++++++++++++++++++++++++++---
 1 file changed, 26 insertions(+), 3 deletions(-)

diff --git a/tests/modetest/buffers.c b/tests/modetest/buffers.c
index 9b635c0..769399e 100644
--- a/tests/modetest/buffers.c
+++ b/tests/modetest/buffers.c
@@ -127,7 +127,7 @@ bo_create(int fd, unsigned int format,
 	  unsigned int handles[4], unsigned int pitches[4],
 	  unsigned int offsets[4], enum util_fill_pattern pattern)
 {
-	unsigned int virtual_height;
+	unsigned int virtual_height, hsub, vsub;
 	struct bo *bo;
 	unsigned int bpp;
 	void *planes[3] = { 0, };
@@ -141,6 +141,10 @@ bo_create(int fd, unsigned int format,
 	case DRM_FORMAT_NV61:
 	case DRM_FORMAT_YUV420:
 	case DRM_FORMAT_YVU420:
+	case DRM_FORMAT_YUV422:
+	case DRM_FORMAT_YVU422:
+	case DRM_FORMAT_YUV444:
+	case DRM_FORMAT_YVU444:
 		bpp = 8;
 		break;
 
@@ -204,15 +208,30 @@ bo_create(int fd, unsigned int format,
 	case DRM_FORMAT_YUV420:
 	case DRM_FORMAT_YVU420:
 		virtual_height = height * 3 / 2;
+		hsub = 2;
+		vsub = 2;
 		break;
 
 	case DRM_FORMAT_NV16:
 	case DRM_FORMAT_NV61:
+	case DRM_FORMAT_YUV422:
+	case DRM_FORMAT_YVU422:
 		virtual_height = height * 2;
+		hsub = 2;
+		vsub = 1;
+		break;
+
+	case DRM_FORMAT_YUV444:
+	case DRM_FORMAT_YVU444:
+		virtual_height = height * 3;
+		hsub = 1;
+		vsub = 1;
 		break;
 
 	default:
 		virtual_height = height;
+		hsub = 1;
+		vsub = 1;
 		break;
 	}
 
@@ -260,14 +279,18 @@ bo_create(int fd, unsigned int format,
 
 	case DRM_FORMAT_YUV420:
 	case DRM_FORMAT_YVU420:
+	case DRM_FORMAT_YUV422:
+	case DRM_FORMAT_YVU422:
+	case DRM_FORMAT_YUV444:
+	case DRM_FORMAT_YVU444:
 		offsets[0] = 0;
 		handles[0] = bo->handle;
 		pitches[0] = bo->pitch;
-		pitches[1] = pitches[0] / 2;
+		pitches[1] = pitches[0] / hsub;
 		offsets[1] = pitches[0] * height;
 		handles[1] = bo->handle;
 		pitches[2] = pitches[1];
-		offsets[2] = offsets[1] + pitches[1] * height / 2;
+		offsets[2] = offsets[1] + pitches[1] * height / vsub;
 		handles[2] = bo->handle;
 
 		planes[0] = virtual;
-- 
2.7.4

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

  parent reply	other threads:[~2018-07-08  2:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-08  2:35 [PATCH libdrm 0/3] Enable more formats in modetest Hyun Kwon
2018-07-08  2:35 ` [PATCH libdrm 1/3] tests: util: pattern: Use 64bit RGB samples Hyun Kwon
2018-07-08  2:35 ` Hyun Kwon [this message]
2018-07-08  2:35 ` [PATCH libdrm 3/3] tests: util: Add support for YUV422 and YUV444 Hyun Kwon
  -- strict thread matches above, loose matches on Subject: below --
2018-05-04 23:40 [PATCH LIBDRM 0/3] Enable more formats in modetest Hyun Kwon
2018-05-04 23:40 ` [PATCH LIBDRM 2/3] modetest: Add support for YUV422 and YUV444 Hyun Kwon

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=1531017333-1483-3-git-send-email-hyun.kwon@xilinx.com \
    --to=hyun.kwon@xilinx.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.