Hi,

I tried zero-copy decoding with the following scheme:
"nouveau" HW decoding -> dmabuf -> intel GL
but it showed garbage. Colors looked okish but not pixel positions.

(note that nouveau dec -> dmabuf -> nouveau GL and  intel dec -> dmabuf ->
intel GL are both working)

So I was thinking a problem with the layout. So the hack from attached
patch made it work :)
EGL_EXT_image_dma_buf_import does not mention anything about layout, only
some hints for YUVs.

I would appreciate any feedback on this. Thx

Infos:
Linux 4.4
Mesa latest master
GPU1: GeForce GT 750M
GPU2: Haswell

Cheers
Julien

PS: Note that in all cases, there is an extra step to convert NV12 to RGBX
which is done in HW (through VA-API - Post Processing)
Indeed vaAcquireBufferHandle only allow to export contiguous memory which
is not the case for nouveau (templ.target = PIPE_TEXTURE_2D_ARRAY)
From e47d127a891b1469f1255c11d0a2ed2a0b477c0e Mon Sep 17 00:00:00 2001
From: Julien Isorce <j.iso...@samsung.com>
Date: Mon, 23 Nov 2015 09:20:14 +0000
Subject: [PATCH] WIP: force linear layout for RGBA/RGBX

Signed-off-by: Julien Isorce <j.iso...@samsung.com>
---
 src/gallium/auxiliary/vl/vl_video_buffer.c      | 10 +++++++++-
 src/gallium/drivers/nouveau/nouveau_vp3_video.c |  3 +++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/vl/vl_video_buffer.c b/src/gallium/auxiliary/vl/vl_video_buffer.c
index 6cd2557..c683afb 100644
--- a/src/gallium/auxiliary/vl/vl_video_buffer.c
+++ b/src/gallium/auxiliary/vl/vl_video_buffer.c
@@ -114,8 +114,9 @@ vl_video_buffer_formats(struct pipe_screen *screen, enum pipe_format format)
    case PIPE_FORMAT_B8G8R8A8_UNORM:
       return const_resource_formats_VUYA;
 
+   // XXX: submit this separately
    case PIPE_FORMAT_R8G8B8X8_UNORM:
-      return const_resource_formats_VUYX;
+      return const_resource_formats_YUVX;
 
    case PIPE_FORMAT_B8G8R8X8_UNORM:
       return const_resource_formats_VUYX;
@@ -253,6 +254,13 @@ vl_video_buffer_template(struct pipe_resource *templ,
    templ->bind = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET;
    templ->usage = usage;
 
+   // XXX. This is a hack to force linear layout.
+   if (tmpl->buffer_format == PIPE_FORMAT_B8G8R8A8_UNORM  ||
+       tmpl->buffer_format == PIPE_FORMAT_R8G8B8A8_UNORM  ||
+       tmpl->buffer_format == PIPE_FORMAT_B8G8R8X8_UNORM  ||
+       tmpl->buffer_format == PIPE_FORMAT_R8G8B8X8_UNORM)
+      templ->bind |= PIPE_BIND_LINEAR;
+
    if (plane > 0) {
       if (tmpl->chroma_format == PIPE_VIDEO_CHROMA_FORMAT_420) {
          templ->width0 /= 2;
diff --git a/src/gallium/drivers/nouveau/nouveau_vp3_video.c b/src/gallium/drivers/nouveau/nouveau_vp3_video.c
index d76d932..5e1d327 100644
--- a/src/gallium/drivers/nouveau/nouveau_vp3_video.c
+++ b/src/gallium/drivers/nouveau/nouveau_vp3_video.c
@@ -83,6 +83,9 @@ nouveau_vp3_video_buffer_create(struct pipe_context *pipe,
    struct pipe_sampler_view sv_templ;
    struct pipe_surface surf_templ;
 
+   // XXX Note that NVC0_RESOURCE_FLAG_VIDEO is lost when calling
+   // nvc0_video_buffer_create -> nouveau_vp3_video_buffer_create
+   // -> vl_video_buffer_create if format is not NV12.
    if (getenv("XVMC_VL") || templat->buffer_format != PIPE_FORMAT_NV12)
       return vl_video_buffer_create(pipe, templat);
 
-- 
1.9.1

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to