<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Am 29.06.2016 um 14:46 schrieb Leo Liu:<br>
    </div>
    <blockquote cite="mid:5773C30E.9090805@amd.com" type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <br>
      <br>
      <div class="moz-cite-prefix">On 06/28/2016 05:07 AM, Christian
        König wrote:<br>
      </div>
      <blockquote cite="mid:57723E4D.3080800@vodafone.de" type="cite">
        <div class="moz-cite-prefix">Hi Leo,<br>
          <br>
          nice catch patch is Reviewed-by: Christian König <a
            moz-do-not-send="true" class="moz-txt-link-rfc2396E"
            href="mailto:christian.koenig@amd.com"><a class="moz-txt-link-rfc2396E" href="mailto:christian.koenig@amd.com"><christian.koenig@amd.com></a></a>.<br>
          <br>
          <blockquote type="cite">
            <p>But we still need to fix transcoding issue with
              interlaced as true. Our transcode support tunneling, basic
              the decode buffer will be used directly for encode.</p>
          </blockquote>
          Ah, yes of course. Sorry I was a bit fast with giving my rb on
          that, should have thought about it more.<br>
          <br>
          The problem is that the VCE engine can only handle progressive
          frames and not the interlaced memory layout.<br>
          <br>
          What we should do is implementing interlaced -> progressive
          conversion in the omx state tracker tunneling handling when
          that happens. Then set interlaced to false in the template and
          reallocate the video buffer for the next trancoding round.<br>
          <br>
          The weave filter from the compositor could be used for
          interlaced -> progressive conversion. And btw: We are going
          to have the same problem with the VA-API state tracker.<br>
        </div>
      </blockquote>
      <br>
      Just concern this may cause performance compromised. How about we
      add a environment variable at the same time to false the
      interlaced, so that it's up to user to choose either way.<br>
    </blockquote>
    <br>
    That shouldn't cause any performance issues, except for a slightly
    overhead on startup. See after reallocating the surfaces to a
    progressive format they will be reused over and over again.<br>
    <br>
    Alternative we could detect that case while setting up the tunnel.
    E.g. figure out the format wanted by the decoder, figure out the
    format wanted by the encoder and get the intersection of both.<br>
    <br>
    The problem is just that when you decode you don't necessary knew
    what the surface will be used for.<br>
    <br>
    Regards,<br>
    Christian.<br>
    <br>
    <blockquote cite="mid:5773C30E.9090805@amd.com" type="cite"> <br>
      Regards,<br>
      Leo<br>
       <br>
      <blockquote cite="mid:57723E4D.3080800@vodafone.de" type="cite">
        <div class="moz-cite-prefix"> <br>
          Regards,<br>
          Christian.<br>
          <br>
          Am 28.06.2016 um 09:01 schrieb Julien Isorce:<br>
        </div>
        <blockquote
cite="mid:CAHWPjbUDu_xX1+43hF82CYn4BsEw48rbyd+SUtgEfKn+91K+tg@mail.gmail.com"
          type="cite">
          <div dir="ltr">
            <div>Thx Leo.<br>
            </div>
            <div>
              <div>I confirm it works with nouveau driver so your fix
                is:<br>
                Tested-by: Julien Isorce <<a moz-do-not-send="true"
                  href="mailto:j.isorce@samsung.com">j.isorce@samsung.com</a>><br>
              </div>
            </div>
          </div>
          <div class="gmail_extra"><br>
            <div class="gmail_quote">On 28 June 2016 at 02:27, Liu, Leo
              <span dir="ltr"><<a moz-do-not-send="true"
                  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">
                <div>
                  <div
style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
                    <p>Hi Julien and Christian,</p>
                    <p><br>
                    </p>
                    <p>I got a patch attached to fix the "fillout"
                      problem, and please review.</p>
                    <p><br>
                    </p>
                    <p>But we still need to fix transcoding issue with
                      interlaced as true. Our transcode support
                      tunneling, basic the decode buffer will be used
                      directly for encode.</p>
                    <p><br>
                    </p>
                    <p>Thanks,</p>
                    <p>Leo</p>
                    <p><br>
                    </p>
                    <p><br>
                    </p>
                  </div>
                  <hr style="display:inline-block;width:98%">
                  <div dir="ltr"><font style="font-size:11pt"
                      color="#000000" face="Calibri, sans-serif"><b>From:</b>
                      Julien Isorce <<a moz-do-not-send="true"
                        href="mailto:julien.isorce@gmail.com"
                        target="_blank">julien.isorce@gmail.com</a>><br>
                      <b>Sent:</b> June 27, 2016 4:54:07 PM<br>
                      <b>To:</b> Liu, Leo<br>
                      <b>Cc:</b> ML mesa-dev; Gurkirpal Singh; Koenig,
                      Christian<br>
                      <b>Subject:</b> Re: [Mesa-dev] [PATCH 2/3] st/omx:
                      add support for nouveau / interlaced</font>
                    <div> </div>
                  </div>
                  <div>
                    <div class="h5">
                      <div>
                        <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
                                moz-do-not-send="true"
                                class="moz-txt-link-abbreviated"
                                href="mailto:leo.liu@amd.com"><a class="moz-txt-link-abbreviated" href="mailto:leo.liu@amd.com">leo.liu@amd.com</a></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>
                                <div><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
                                      moz-do-not-send="true"
                                      class="moz-txt-link-abbreviated"
                                      href="mailto:j.isorce@samsung.com"><a class="moz-txt-link-abbreviated" href="mailto:j.isorce@samsung.com">j.isorce@samsung.com</a></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>
                      </div>
                    </div>
                  </div>
                </div>
              </blockquote>
            </div>
            <br>
          </div>
          <br>
          <fieldset class="mimeAttachmentHeader"></fieldset>
          <br>
          <pre wrap="">_______________________________________________
mesa-dev mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a>
</pre>
        </blockquote>
        <br>
      </blockquote>
      <br>
    </blockquote>
    <br>
  </body>
</html>