<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 05.04.2017 um 13:13 schrieb
      Christopher James Halse Rogers:<br>
    </div>
    <blockquote
cite="mid:CAPMmPEzNAZ9hRTQhBN-EWn2g+G+SdDWVLfuZxECzXTy9Vwo3QA@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_quote">
          <div dir="ltr">On Wed, Apr 5, 2017 at 8:14 PM Lucas Stach <<a
              moz-do-not-send="true"
              href="mailto:l.stach@pengutronix.de">l.stach@pengutronix.de</a>>
            wrote:<br>
          </div>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">Am
            Mittwoch, den 05.04.2017, 11:59 +0200 schrieb Daniel Vetter:<br
              class="gmail_msg">
            > On Wed, Apr 05, 2017 at 10:15:44AM +0200, Lucas Stach
            wrote:<br class="gmail_msg">
            > > Am Mittwoch, den 05.04.2017, 00:20 +0000 schrieb
            Christopher James Halse<br class="gmail_msg">
            > > Rogers:<br class="gmail_msg">
            > > ><br class="gmail_msg">
            > > ><br class="gmail_msg">
            > > > On Tue, Apr 4, 2017 at 9:53 PM Daniel Vetter
            <<a moz-do-not-send="true" href="mailto:daniel@ffwll.ch"
              class="gmail_msg" target="_blank">daniel@ffwll.ch</a>>
            wrote:<br class="gmail_msg">
            > > ><br class="gmail_msg">
            > > >         On Tue, Apr 4, 2017 at 12:43 PM,
            Lucas Stach<br class="gmail_msg">
            > > >         <<a moz-do-not-send="true"
              href="mailto:l.stach@pengutronix.de" class="gmail_msg"
              target="_blank">l.stach@pengutronix.de</a>> wrote:<br
              class="gmail_msg">
            > > >         >> If I could guarantee that
            I'd only ever run on<br class="gmail_msg">
            > > >         4.13-or-later kernels<br
              class="gmail_msg">
            > > >         >> (I think that's when the
            previous patches will land?), then<br class="gmail_msg">
            > > >         this would<br class="gmail_msg">
            > > >         >> indeed be mostly
            unnecessary. It would save me a bunch of<br
              class="gmail_msg">
            > > >         addfb calls<br class="gmail_msg">
            > > >         >> that would predictably fail,
            but they're cheap.<br class="gmail_msg">
            > > >         ><br class="gmail_msg">
            > > >         > I don't think we ever had caps
            for "things are working now,<br class="gmail_msg">
            > > >         as they are<br class="gmail_msg">
            > > >         > supposed to". i915 wasn't
            properly synchronizing on foreign<br class="gmail_msg">
            > > >         fences for a<br class="gmail_msg">
            > > >         > long time, yet we didn't gain a
            cap for "cross device sync<br class="gmail_msg">
            > > >         works now".<br class="gmail_msg">
            > > >         ><br class="gmail_msg">
            > > >         > If your distro use-case relies
            on those things working it's<br class="gmail_msg">
            > > >         probably<br class="gmail_msg">
            > > >         > best to just backport the
            relevant fixes.<br class="gmail_msg">
            > > ><br class="gmail_msg">
            > > >         The even better solution for this is
            to push the backports<br class="gmail_msg">
            > > >         through<br class="gmail_msg">
            > > >         upstream -stable kernels. This stuff
            here is simple enough<br class="gmail_msg">
            > > >         that we can<br class="gmail_msg">
            > > >         do it. Same could have been done for
            the fairly minimal<br class="gmail_msg">
            > > >         fencing fixes<br class="gmail_msg">
            > > >         for i915 (at least some of them, the
            ones in the page-flip).<br class="gmail_msg">
            > > ><br class="gmail_msg">
            > > >         Otherwise we'll end up with tons
            IM_NOT_BUGGY and<br class="gmail_msg">
            > > >         IM_SLIGHTLY_LESS_BUGGY and<br
              class="gmail_msg">
            > > >       
             IM_NOT_BUGGY_EXCEPT_THIS_BOTCHED_BACKPORT<br
              class="gmail_msg">
            > > >         flags where no one at all knows what
            they mean, usage between<br class="gmail_msg">
            > > >         different drivers and different
            userspace is entirely<br class="gmail_msg">
            > > >         inconsistent and<br class="gmail_msg">
            > > >         they just all add to the confusion.
            They're just bugs, lets<br class="gmail_msg">
            > > >         treat them<br class="gmail_msg">
            > > >         like that.<br class="gmail_msg">
            > > ><br class="gmail_msg">
            > > ><br class="gmail_msg">
            > > > It's not *quite*
            DRM_CAP_PRIME_SCANOUT_NOT_BUGGY - while the relevant<br
              class="gmail_msg">
            > > > hardware allegedly supports it,
            nouveau/radeon/amdgpu don't do scanout<br class="gmail_msg">
            > > > of GTT, so the lack of this cap indicates
            that there's no point in<br class="gmail_msg">
            > > > trying to call addfb2.<br class="gmail_msg">
            > > ><br class="gmail_msg">
            > > ><br class="gmail_msg">
            > > > But calling addfb2 and it failing is not
            expensive, so this is rather<br class="gmail_msg">
            > > > niche.<br class="gmail_msg">
            > > ><br class="gmail_msg">
            > > ><br class="gmail_msg">
            > > > In practice I can just restrict attempting to
            scanout of imported<br class="gmail_msg">
            > > > buffers to i915, as that's the only driver
            that it'll work on. By the<br class="gmail_msg">
            > > > time nouveau/radeon/amdgpu get patches to
            scanout of GTT the fixes<br class="gmail_msg">
            > > > should be old enough that I don't need to
            care about unfixed kernels.<br class="gmail_msg">
            > > ><br class="gmail_msg">
            > > So given that most discreet hardware won't ever be
            able to scanout from<br class="gmail_msg">
            > > GTT (latency and iso requirements will be hard to
            meet), can't we just<br class="gmail_msg">
            > > fix the case of the broken prime sharing when
            migrating to VRAM?<br class="gmail_msg">
          </blockquote>
          <div><br>
          </div>
          <div>At least some nouveau and AMD devs seem to think that
            their hardware is capable of doing it. Shrug. <br>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    Wow, wait a second. Recent AMD GPU can scanout from system memory,
    that's true.<br>
    <br>
    But you need to met quite a bunch of special allocation requirements
    to do this.<br>
    <br>
    When we are talking about sharing between AMD GPUs, (e.g. both
    exporter and importer are AMD hardware) than that might work.<br>
    <br>
    But I think it's unrealistic that an imported BO (created by an
    external driver stack) will ever meet those requirements.<br>
    <br>
    Christian.<br>
    <br>
    <blockquote
cite="mid:CAPMmPEzNAZ9hRTQhBN-EWn2g+G+SdDWVLfuZxECzXTy9Vwo3QA@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_quote">
          <div><br>
          </div>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            > ><br class="gmail_msg">
            > > I'm thinking about attaching an exclusive fence to
            the dma-buf when the<br class="gmail_msg">
            > > migration to VRAM happens, then when the GPU is
            done with the buffer we<br class="gmail_msg">
            > > can either write back any changes to GTT, or just
            drop the fence in case<br class="gmail_msg">
            > > the GPU didn't modify the buffer.<br
              class="gmail_msg">
            ><br class="gmail_msg">
            > We could, but someone needs to type the code for it.
            There's also the<br class="gmail_msg">
            > problem that you need to migrate back, and then doing
            all that behind<br class="gmail_msg">
            > userspaces back might not be the best idea.<br
              class="gmail_msg">
            <br class="gmail_msg">
            Drivers with separate VRAM and GTT are already doing a lot
            of migration<br class="gmail_msg">
            behind the userspaces back. The only issue with dma-buf
            migration to<br class="gmail_msg">
            VRAM is that you probably don't want to migrate the pages,
            but duplicate<br class="gmail_msg">
            them in VRAM, doubling memory consumption with possible OOM.
            But then<br class="gmail_msg">
            you could alloc the memory on addfb where you are able to
            return proper<br class="gmail_msg">
            errors.<br class="gmail_msg">
          </blockquote>
          <div><br>
          </div>
          <div>I would *love* for the driver to copy the pages for me
            into VRAM for scanout, rather than me having to spin up an
            EGL context and run the trivial blitting shader across an
            EGLImage.<br>
            <br>
          </div>
          <div>Are you offering to do it? :)<br>
            <br>
          </div>
          <div>I'll still need to, for the short term, assume that only
            i915 can do this without breaking, though.<br>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
dri-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:dri-devel@lists.freedesktop.org">dri-devel@lists.freedesktop.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freedesktop.org/mailman/listinfo/dri-devel">https://lists.freedesktop.org/mailman/listinfo/dri-devel</a>
</pre>
    </blockquote>
    <p><br>
    </p>
  </body>
</html>