Message ID | 1e43eba23f3a73ed4c18ec4516869a5abc39a475.1688570702.git.geert+renesas@glider.be (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Add support for DRM_FORMAT_NV{24,42} | expand |
Hi Geert, Thank you for the patch. On Wed, Jul 05, 2023 at 05:26:17PM +0200, Geert Uytterhoeven wrote: > Add support for creating buffers using semi-planar YUV formats with > non-subsampled chroma planes. > > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> > --- > tests/modetest/buffers.c | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > > diff --git a/tests/modetest/buffers.c b/tests/modetest/buffers.c > index 0b55aeddfef9a854..0605b12552bb8eec 100644 > --- a/tests/modetest/buffers.c > +++ b/tests/modetest/buffers.c > @@ -129,6 +129,8 @@ bo_create(int fd, unsigned int format, > case DRM_FORMAT_NV21: > case DRM_FORMAT_NV16: > case DRM_FORMAT_NV61: > + case DRM_FORMAT_NV24: > + case DRM_FORMAT_NV42: > case DRM_FORMAT_YUV420: > case DRM_FORMAT_YVU420: > bpp = 8; > @@ -208,6 +210,11 @@ bo_create(int fd, unsigned int format, > virtual_height = height * 2; > break; > > + case DRM_FORMAT_NV24: > + case DRM_FORMAT_NV42: > + virtual_height = height * 3; > + break; > + > default: > virtual_height = height; > break; > @@ -255,6 +262,19 @@ bo_create(int fd, unsigned int format, > planes[1] = virtual + offsets[1]; > break; > > + case DRM_FORMAT_NV24: > + case DRM_FORMAT_NV42: > + offsets[0] = 0; > + handles[0] = bo->handle; > + pitches[0] = bo->pitch; > + pitches[1] = pitches[0] * 2; > + offsets[1] = pitches[0] * height; > + handles[1] = bo->handle; > + > + planes[0] = virtual; > + planes[1] = virtual + offsets[1]; > + break; > + > case DRM_FORMAT_YUV420: > case DRM_FORMAT_YVU420: > offsets[0] = 0;
diff --git a/tests/modetest/buffers.c b/tests/modetest/buffers.c index 0b55aeddfef9a854..0605b12552bb8eec 100644 --- a/tests/modetest/buffers.c +++ b/tests/modetest/buffers.c @@ -129,6 +129,8 @@ bo_create(int fd, unsigned int format, case DRM_FORMAT_NV21: case DRM_FORMAT_NV16: case DRM_FORMAT_NV61: + case DRM_FORMAT_NV24: + case DRM_FORMAT_NV42: case DRM_FORMAT_YUV420: case DRM_FORMAT_YVU420: bpp = 8; @@ -208,6 +210,11 @@ bo_create(int fd, unsigned int format, virtual_height = height * 2; break; + case DRM_FORMAT_NV24: + case DRM_FORMAT_NV42: + virtual_height = height * 3; + break; + default: virtual_height = height; break; @@ -255,6 +262,19 @@ bo_create(int fd, unsigned int format, planes[1] = virtual + offsets[1]; break; + case DRM_FORMAT_NV24: + case DRM_FORMAT_NV42: + offsets[0] = 0; + handles[0] = bo->handle; + pitches[0] = bo->pitch; + pitches[1] = pitches[0] * 2; + offsets[1] = pitches[0] * height; + handles[1] = bo->handle; + + planes[0] = virtual; + planes[1] = virtual + offsets[1]; + break; + case DRM_FORMAT_YUV420: case DRM_FORMAT_YVU420: offsets[0] = 0;
Add support for creating buffers using semi-planar YUV formats with non-subsampled chroma planes. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> --- tests/modetest/buffers.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)