<div dir="ltr"><div><div><div><div>Hi Leo,<br><br></div>Sorry for the inconvenience, could you let me know how to reproduce the problem ?<br></div>I have been playing with some gst pipelines and they all work but I can only test with nouveau driver.<br><br></div>Cheers<br></div>Julien<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On 27 June 2016 at 21:35, Leo Liu <span dir="ltr"><<a href="mailto:leo.liu@amd.com" target="_blank">leo.liu@amd.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This patch break omx decode to file, it got seg fault. Will take look further.<br>
<br>
Regards,<br>
Leo<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
On 06/27/2016 04:16 AM, Julien Isorce wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Signed-off-by: Julien Isorce <<a href="mailto:j.isorce@samsung.com" target="_blank">j.isorce@samsung.com</a>><br>
---<br>
  src/gallium/state_trackers/omx/vid_dec.c | 51 ++++++++++++++++----------------<br>
  1 file changed, 26 insertions(+), 25 deletions(-)<br>
<br>
diff --git a/src/gallium/state_trackers/omx/vid_dec.c b/src/gallium/state_trackers/omx/vid_dec.c<br>
index 564ca2f..85ffb88 100644<br>
--- a/src/gallium/state_trackers/omx/vid_dec.c<br>
+++ b/src/gallium/state_trackers/omx/vid_dec.c<br>
@@ -48,6 +48,7 @@<br>
  #include "pipe/p_video_codec.h"<br>
  #include "util/u_memory.h"<br>
  #include "util/u_surface.h"<br>
+#include "vl/vl_video_buffer.h"<br>
  #include "vl/vl_vlc.h"<br>
    #include "entrypoint.h"<br>
@@ -515,34 +516,34 @@ static void vid_dec_FillOutput(vid_dec_PrivateType *priv, struct pipe_video_buff<br>
     OMX_VIDEO_PORTDEFINITIONTYPE *def = &port->sPortParam.format.video;<br>
       struct pipe_sampler_view **views;<br>
-   struct pipe_transfer *transfer;<br>
-   struct pipe_box box = { };<br>
-   uint8_t *src, *dst;<br>
+   unsigned i, j;<br>
+   unsigned width, height;<br>
       views = buf->get_sampler_view_planes(buf);<br>
  -   dst = output->pBuffer;<br>
-<br>
-   box.width = def->nFrameWidth;<br>
-   box.height = def->nFrameHeight;<br>
-   box.depth = 1;<br>
-<br>
-   src = priv->pipe->transfer_map(priv->pipe, views[0]->texture, 0,<br>
-                                  PIPE_TRANSFER_READ, &box, &transfer);<br>
-   util_copy_rect(dst, views[0]->texture->format, def->nStride, 0, 0,<br>
-                  box.width, box.height, src, transfer->stride, 0, 0);<br>
-   pipe_transfer_unmap(priv->pipe, transfer);<br>
-<br>
-   dst = ((uint8_t*)output->pBuffer) + (def->nStride * box.height);<br>
-<br>
-   box.width = def->nFrameWidth / 2;<br>
-   box.height = def->nFrameHeight / 2;<br>
-<br>
-   src = priv->pipe->transfer_map(priv->pipe, views[1]->texture, 0,<br>
-                                  PIPE_TRANSFER_READ, &box, &transfer);<br>
-   util_copy_rect(dst, views[1]->texture->format, def->nStride, 0, 0,<br>
-                  box.width, box.height, src, transfer->stride, 0, 0);<br>
-   pipe_transfer_unmap(priv->pipe, transfer);<br>
+   for (i = 0; i < 2 /* NV12 */; i++) {<br>
+      if (!views[i]) continue;<br>
+      width = buf->width;<br>
+      height = buf->height;<br>
+      vl_video_buffer_adjust_size(&width, &height, i, buf->interlaced, buf->chroma_format);<br>
+      for (j = 0; j < views[i]->texture->array_size; ++j) {<br>
+         struct pipe_box box = {0, 0, j, width, height, 1};<br>
+         struct pipe_transfer *transfer;<br>
+         uint8_t *map, *dst;<br>
+         map = priv->pipe->transfer_map(priv->pipe, views[i]->texture, 0,<br>
+                  PIPE_TRANSFER_READ, &box, &transfer);<br>
+         if (!map)<br>
+            return;<br>
+<br>
+         dst = ((uint8_t*)output->pBuffer + output->nOffset) + j * def->nStride + i * buf->width * buf->height;<br>
+         util_copy_rect(dst,<br>
+            views[i]->texture->format,<br>
+            def->nStride * views[i]->texture->array_size, 0, 0,<br>
+            box.width, box.height, map, transfer->stride, 0, 0);<br>
+<br>
+         pipe_transfer_unmap(priv->pipe, transfer);<br>
+      }<br>
+   }<br>
  }<br>
    static void vid_dec_FrameDecoded(OMX_COMPONENTTYPE *comp, OMX_BUFFERHEADERTYPE* input,<br>
</blockquote>
<br>
</div></div></blockquote></div><br></div>