<p dir="ltr"></p>
<p dir="ltr">On Oct 19, 2016 8:24 AM, "Daniel Vetter" <<a href="mailto:daniel@ffwll.ch">daniel@ffwll.ch</a>> wrote:<br>
><br>
> On Wed, Oct 19, 2016 at 1:40 AM, Marek Olšák <<a href="mailto:maraeo@gmail.com">maraeo@gmail.com</a>> wrote:<br>
> > - The producer-consumer interop API doesn't know about the metadata.<br>
> > All you need to pass around is a buffer handle. (KMS, DMABUF, etc.)<br>
> >   * There was a note during the talk that DMABUF doesn't have any<br>
> > metadata. Well, I just told you that it has, but it's private to<br>
> > amdgpu and possibly accessible to other kernel drivers too.<br>
> >   * We can build upon this idea. I think the worst thing to do would<br>
> > be to add metadata handling to driver-agnostic userspace APIs. Really,<br>
> > driver-agnostic APIs shouldn't know about that, because they can't<br>
> > understand all the hw-specific information encoded in the metadata.<br>
> > Also, when you want to change the metadata format, you only have to<br>
> > update the affected drivers, not userspace APIs.<br>
><br>
> That's a bit a surprise to hear, since "can't we just add a bit of<br>
> opaque metadata to dma-buf" came up all the time over the past years,<br>
> and died all the time again. dma-buf shouldn't imo be just yet another<br>
> linux IPC mechanism and protocol, which is pretty much what you end up<br>
> doing when you add this stuff. DRM runs all kinds of compositors with<br>
> all kinds of existing userspace proto, and with reasonable ones like<br>
> Wayland vendors can add whatever extensions they want. Plus there's<br>
> all the interop with v4l and every other kernel subsytem. Trying to<br>
> standardize that into some blob that works for everyone is imo nigh<br>
> impossible.<br>
><br>
> On top of that dma-buf is the wrong thing - you don't want this on<br>
> buffers, but on surfaces. At least when it's time to reallocate. And<br>
> oh dear I have seen what happens when soc vendors extend this design<br>
> to cover that use-case, plus dynamic reallocation and all that. Imo<br>
> there should be no way at all this ever comes close to dma-buf itself.<br>
><br>
> And tbh I think it's a bit silly that amd snuck this in through<br>
> amdgpu. But as long as you don't expect this to spread I guess it'll<br>
> be fine.</p>
<p dir="ltr">LOL. It's not per DMABUF, it's per buffer, so you need a KMS handle to access it from userspace.</p>
<p dir="ltr">We've had per buffer metadata in Radeon since KMS, which I believe first appeared in 2009. It's 4 bytes large and is used to communicate tiling flags between Mesa, DDX, and the kernel display code. It was a widely accepted solution back then and Red Hat was the main developer. So yeah, pretty much all people except Intel were collaborating on "sneaking" this in in 2009. I think radeon driver developers deserve an apology for that language.</p>
<p dir="ltr">Amdgpu extended that metadata to 8 bytes and it's used in the same way as radeon. Additionally, amdgpu added opaque metadata having 256 bytes for use by userspace drivers only. The kernel driver isn't supposed to read it or parse it. The format is negotiated between userspace driver developers for sharing of more complex allocations than 2D displayable surfaces.</p>
<p dir="ltr">Marek<br><br><br></p>
<p dir="ltr">> -Daniel<br>
> --<br>
> Daniel Vetter<br>
> Software Engineer, Intel Corporation<br>
> +41 (0) 79 365 57 48 - <a href="http://blog.ffwll.ch">http://blog.ffwll.ch</a><br></p>