<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Am 26.01.2017 um 12:16 schrieb Peter
      Frühberger:<br>
    </div>
    <blockquote
cite="mid:CAMQ1+vxP_vJRCHz0mTs8ikMcQ9XNJHA-MF7e0daiVv=ZTZDmMA@mail.gmail.com"
      type="cite">
      <div dir="ltr">Hi Christian,
        <div class="gmail_extra"><br>
          <div class="gmail_quote">2017-01-26 12:00 GMT+01:00 Christian
            König <span dir="ltr"><<a moz-do-not-send="true"
                href="mailto:deathsimple@vodafone.de" target="_blank">deathsimple@vodafone.de</a>></span>:<br>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px
              0.8ex;border-left:1px solid
              rgb(204,204,204);padding-left:1ex">Hi Peter,<span
                class="gmail-"><br>
                <br>
                Am 25.01.2017 um 19:45 schrieb Peter Frühberger:<br>
                <blockquote class="gmail_quote" style="margin:0px 0px
                  0px 0.8ex;border-left:1px solid
                  rgb(204,204,204);padding-left:1ex">
                  <br>
                  <br>
                      Peter, Rainer any idea what I'm missing here? Do
                  you guys use some<br>
                      modified ffmpeg for Kodi or how does that work for
                  you?<br>
                  <br>
                  <br>
                  do you set the format correctly, e.g.: <a
                    moz-do-not-send="true"
href="https://github.com/FernetMenta/kodi-agile/blob/master/xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp#L2697"
                    rel="noreferrer" target="_blank"><a class="moz-txt-link-freetext" href="https://github.com/FernetMenta">https://github.com/FernetMenta</a><wbr>/kodi-agile/blob/master/xbmc/<wbr>cores/VideoPlayer/DVDCodecs/<wbr>Video/VAAPI.cpp#L2697</a>
                  to create the surfaces?<br>
                </blockquote>
                <br>
              </span>
              Well the problem here is that the VA-API interface is not
              consistent and I'm not sure how to implement it correctly.<br>
              <br>
              See your code for example:<br>
              <blockquote class="gmail_quote" style="margin:0px 0px 0px
                0.8ex;border-left:1px solid
                rgb(204,204,204);padding-left:1ex">
                VASurfaceAttrib attribs[1], *attrib;<br>
                <br>
                attrib = attribs;<br>
                <br>
                attrib->flags = VA_SURFACE_ATTRIB_SETTABLE;<br>
                <br>
                attrib->type = VASurfaceAttribPixelFormat;<br>
                <br>
                attrib->value.type = VAGenericValueTypeInteger;<br>
                <br>
                attrib->value.value.i = VA_FOURCC_NV12;<br>
                <br>
                <br>
              </blockquote>
              <br>
              First Kodi specifies that NV12 should be used which
              implies that this is a 8bit surface.<br>
              <br>
              <blockquote class="gmail_quote" style="margin:0px 0px 0px
                0.8ex;border-left:1px solid
                rgb(204,204,204);padding-left:1ex">
                // create surfaces<br>
                <br>
                VASurfaceID surfaces[32];<br>
                <br>
                unsigned int format = VA_RT_FORMAT_YUV420;<br>
                <br>
                if (m_config.profile == VAProfileHEVCMain10)<br>
                <br>
                format = VA_RT_FORMAT_YUV420_10BPP;<br>
              </blockquote>
              But then Kodi requests a 10bit surface. Now what is the
              correct thing to do here?<br>
              <br>
              I can either create an NV12 surface, which would be 8bit
              but would result in either an error message or only 8bit
              dithering during decode.<br>
              <br>
              Or I can promote the surface to 10bit, which would result
              in a P010 or rather P016 format.<br>
              <br>
              Or and that is actually what I think would be best the
              VA-API driver should trow an error indicating that the
              application requested something impossible.</blockquote>
            <div><br>
            </div>
            <div>Yes you are right. Looks like a driver specific: <a
                moz-do-not-send="true"
href="https://cgit.freedesktop.org/vaapi/intel-driver/tree/src/i965_drv_video.c#n1338"><a class="moz-txt-link-freetext" href="https://cgit.freedesktop.org/vaapi/intel-driver/tree/src/i965_drv_video.c#n1338">https://cgit.freedesktop.org/vaapi/intel-driver/tree/src/i965_drv_video.c#n1338</a></a></div>
            <div><br>
            </div>
            <div>seems they use it as a hint to the subsampling: <span
                style="color:rgb(0,0,0);font-size:13.3333px">SUBSAMPLE_YUV420 </span>and
              then later compare with with the format again to choose.</div>
            <div><br>
            </div>
            <div>From code pov we should set the attribute to: <span
                style="color:rgb(0,0,0);font-size:13.3333px">VA_FOURCC_P010</span>,
              right?</div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    Yes, I think so.<br>
    <br>
    Christian.<br>
    <br>
    <blockquote
cite="mid:CAMQ1+vxP_vJRCHz0mTs8ikMcQ9XNJHA-MF7e0daiVv=ZTZDmMA@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">
            <div><br>
            </div>
            <div>Regards</div>
            <div>Peter</div>
            <div><span style="color:rgb(0,0,0);font-size:13.3333px"><br>
              </span></div>
            <div><span style="color:rgb(0,0,0);font-size:13.3333px"><br>
              </span></div>
            <div><br>
            </div>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px
              0.8ex;border-left:1px solid
              rgb(204,204,204);padding-left:1ex"><span class="gmail-"><br>
                <br>
                <blockquote class="gmail_quote" style="margin:0px 0px
                  0px 0.8ex;border-left:1px solid
                  rgb(204,204,204);padding-left:1ex">
                  <br>
                  afterwards we just do drm / egl interop, via:<br>
                  <a moz-do-not-send="true"
href="https://github.com/FernetMenta/kodi-agile/blob/master/xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp#L1374"
                    rel="noreferrer" target="_blank">https://github.com/FernetMenta<wbr>/kodi-agile/blob/master/xbmc/<wbr>cores/VideoPlayer/DVDCodecs/<wbr>Video/VAAPI.cpp#L1374</a>
                  <br>
                </blockquote>
                <br>
              </span>
              I'm not sure if that will ever work correctly. The problem
              is that VA-API leaks to the application what the data
              layout in the surface is. As soon as we turn on tilling
              that will only work with rather crude hacks.<br>
              <br>
              I will try to get it working, but probably need help from
              you guys as well.<br>
              <br>
              Regards,<br>
              Christian.<br>
              <br>
              <blockquote class="gmail_quote" style="margin:0px 0px 0px
                0.8ex;border-left:1px solid
                rgb(204,204,204);padding-left:1ex"><span class="gmail-">
                  You need ffmpeg 3.2.<br>
                  <br>
                  If you use vaPutSurface it will end up as RGBA32 or
                  something, which is why we use the above way.<br>
                  <br>
                  Best regards<br>
                  Peter<br>
                  <br>
                  <br>
                      Cheers,<br>
                      Christian.<br>
                  <br>
                  <br>
                  <br>
                  <br>
                  <br>
                  -- <br>
                                     Key-ID: 0x1A995A9B<br>
                </span>
                                   keyserver: <a moz-do-not-send="true"
                  href="http://pgp.mit.edu" rel="noreferrer"
                  target="_blank">pgp.mit.edu</a> <<a
                  moz-do-not-send="true" href="http://pgp.mit.edu"
                  rel="noreferrer" target="_blank"><a class="moz-txt-link-freetext" href="http://pgp.mit.edu">http://pgp.mit.edu</a></a>><span
                  class="gmail-"><br>
                  ==============================<wbr>==============================<wbr>==<br>
                  Fingerprint: 4606 DA19 EC2E 9A0B 0157  C81B DA07 CF63
                  1A99 5A9B<br>
                </span></blockquote>
              <br>
              <br>
            </blockquote>
          </div>
          <br>
          <br clear="all">
          <div><br>
          </div>
          -- <br>
          <div class="gmail_signature">                   Key-ID:    
            0x1A995A9B<br>
                               keyserver: <a moz-do-not-send="true"
              href="http://pgp.mit.edu" target="_blank">pgp.mit.edu</a><br>
==============================================================<br>
            Fingerprint: 4606 DA19 EC2E 9A0B 0157  C81B DA07 CF63 1A99
            5A9B</div>
        </div>
      </div>
    </blockquote>
    <p><br>
    </p>
  </body>
</html>