<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Dec 20, 2017 at 12:41 PM, Miguel Angel Vico <span dir="ltr"><<a href="mailto:mvicomoya@nvidia.com" target="_blank">mvicomoya@nvidia.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Inline.<br>
<span class=""><br>
On Wed, 20 Dec 2017 11:54:10 -0800<br>
Kristian Høgsberg <<a href="mailto:hoegsberg@gmail.com">hoegsberg@gmail.com</a>> wrote:<br>
<br>
> On Wed, Dec 20, 2017 at 11:51 AM, Daniel Vetter <<a href="mailto:daniel@ffwll.ch">daniel@ffwll.ch</a>> wrote:<br>
> > Since this also involves the kernel let's add dri-devel ...<br>
<br>
</span>Yeah, I forgot. Thanks Daniel!<br>
<div><div class="h5"><br>
> ><br>
> > On Wed, Dec 20, 2017 at 5:51 PM, Miguel Angel Vico <<a href="mailto:mvicomoya@nvidia.com">mvicomoya@nvidia.com</a>> wrote:<br>
> >> Hi all,<br>
> >><br>
> >> As many of you already know, I've been working with James Jones on the<br>
> >> Generic Device Allocator project lately. He started a discussion thread<br>
> >> some weeks ago seeking feedback on the current prototype of the library<br>
> >> and advice on how to move all this forward, from a prototype stage to<br>
> >> production. For further reference, see:<br>
> >><br>
> >> <a href="https://lists.freedesktop.org/archives/mesa-dev/2017-November/177632.html" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>archives/mesa-dev/2017-<wbr>November/177632.html</a><br>
> >><br>
> >> From the thread above, we came up with very interesting high level<br>
> >> design ideas for one of the currently missing parts in the library:<br>
> >> Usage transitions. That's something I'll personally work on during the<br>
> >> following weeks.<br>
> >><br>
> >><br>
> >> In the meantime, I've been working on putting together an open source<br>
> >> implementation of the allocator mechanisms using the Nouveau driver for<br>
> >> all to be able to play with.<br>
> >><br>
> >> Below I'm seeking feedback on a bunch of changes I had to make to<br>
> >> different components of the graphics stack:<br>
> >><br>
> >> ** Allocator **<br>
> >><br>
> >> An allocator driver implementation on top of Nouveau. The current<br>
> >> implementation only handles pitch linear layouts, but that's enough<br>
> >> to have the kmscube port working using the allocator and Nouveau<br>
> >> drivers.<br>
> >><br>
> >> You can pull these changes from<br>
> >><br>
> >> <a href="https://github.com/mvicomoya/allocator/tree/wip/mvicomoya/nouveau-driver" rel="noreferrer" target="_blank">https://github.com/mvicomoya/<wbr>allocator/tree/wip/mvicomoya/<wbr>nouveau-driver</a><br>
> >><br>
> >> ** Mesa **<br>
> >><br>
> >> James's kmscube port to use the allocator relies on the<br>
> >> EXT_external_objects extension to import allocator allocations to<br>
> >> OpenGL as a texture object. However, the Nouveau implementation of<br>
> >> these mechanisms is missing in Mesa, so I went ahead and added them.<br>
> >><br>
> >> You can pull these changes from<br>
> >><br>
> >> <a href="https://github.com/mvicomoya/mesa/tree/wip/mvicomoya/EXT_external_objects-nouveau" rel="noreferrer" target="_blank">https://github.com/mvicomoya/<wbr>mesa/tree/wip/mvicomoya/EXT_<wbr>external_objects-nouveau</a><br>
> >><br>
> >> Also, James's kmscube port uses the NVX_unix_allocator_import<br>
> >> extension to attach allocator metadata to texture objects so the<br>
> >> driver knows how to deal with the imported memory.<br>
> >><br>
> >> Note that there isn't a formal spec for this extension yet. For now,<br>
> >> it just serves as an experimental mechanism to import allocator<br>
> >> memory in OpenGL, and attach metadata to texture objects.<br>
> >><br>
> >> You can pull these changes (written on top of the above) from:<br>
> >><br>
> >> <a href="https://github.com/mvicomoya/mesa/tree/wip/mvicomoya/NVX_unix_allocator_import" rel="noreferrer" target="_blank">https://github.com/mvicomoya/<wbr>mesa/tree/wip/mvicomoya/NVX_<wbr>unix_allocator_import</a><br>
> >><br>
> >> ** kmscube **<br>
> >><br>
> >> Mostly minor fixes and improvements on top of James's port to use the<br>
> >> allocator. Main thing is the allocator initialization path will use<br>
> >> EGL_MESA_platform_surfaceless if EGLDevice platform isn't supported<br>
> >> by the underlying EGL implementation.<br>
> >><br>
> >> You can pull these changes from:<br>
> >><br>
> >> <a href="https://github.com/mvicomoya/kmscube/tree/wip/mvicomoya/allocator-nouveau" rel="noreferrer" target="_blank">https://github.com/mvicomoya/<wbr>kmscube/tree/wip/mvicomoya/<wbr>allocator-nouveau</a><br>
> >><br>
> >><br>
> >> With all the above you should be able to get kmscube working using the<br>
> >> allocator on top of the Nouveau driver.<br>
> >><br>
> >><br>
> >> Another of the missing pieces before we can move this to production is<br>
> >> importing allocations to DRM FB objects. This is probably one of the<br>
> >> most sensitive parts of the project as it requires modification/addition<br>
> >> of kernel driver interfaces.<br>
> >><br>
> >> At XDC2017, James had several hallway conversations with several people<br>
> >> about this, all having different opinions. I'd like to take this<br>
> >> opportunity to also start a discussion about what's the best option to<br>
> >> create a path to get allocator allocations added as DRM FB objects.<br>
> >><br>
> >> These are the few options we've considered to start with:<br>
> >><br>
> >> A) Have vendor-private ioctls to set properties on GEM objects that<br>
> >> are inherited by the FB objects. This is how our (NVIDIA) desktop<br>
> >> DRM driver currently works. This would require every vendor to add<br>
> >> their own ioctl to process allocator metadata, but the metadata is<br>
> >> actually a vendor-agnostic object more like DRM modifiers. We'd<br>
> >> like to come up with a vendor-agnostic solutions that can be<br>
> >> integrated to core DRM.<br>
> >><br>
> >> B) Add a new drmModeAddFBWithMetadata() command that takes allocator<br>
> >> metadata blobs for each plane of the FB. Some people in the<br>
> >> community have mentioned this is their preferred design. This,<br>
> >> however, means we'd have to go through the exercise of adding<br>
> >> another metadata mechanism to the whole graphics stack.<br>
> >><br>
> >> C) Shove allocator metadata into DRM by defining it to be a separate<br>
> >> plane in the image, and using the existing DRM modifiers mechanism<br>
> >> to indicate there is another plane for each "real" plane added. It<br>
> >> isn't clear how this scales to surfaces that already need several<br>
> >> planes, but there are some people that see this as the only way<br>
> >> forward. Also, we would have to create a separate GEM buffer for<br>
> >> the metadatada itself, which seems excessive.<br>
> >><br>
> >> We personally like option (B) better, and have already started to<br>
> >> prototype the new path (which is actually very similar to the<br>
> >> drmModeAddFB2() one). You can take a look at the new interfaces here:<br>
> >><br>
> >> <a href="https://github.com/mvicomoya/linux/tree/wip/mvicomoya/drm_addfb_with_metadata__4.14-rc8" rel="noreferrer" target="_blank">https://github.com/mvicomoya/<wbr>linux/tree/wip/mvicomoya/drm_<wbr>addfb_with_metadata__4.14-rc8</a><br>
> >><br>
> >> There may be other options that haven't been explored yet that could be<br>
> >> a better choice than the above, so any suggestion will be greatly<br>
> >> appreciated.<br>
> ><br>
> > What kind of metadata are we talking about here? Addfb has tons of<br>
> > stuff already that's "metadata". The only thing I've spotted is<br>
> > PITCH_ALIGNMENT, which is maybe something we want drm drivers to tell<br>
> > userspace, but definitely not something addfb ever needs. addfb only<br>
> > needs the resulting pitch that we actually allocated (and might decide<br>
> > it doesn't like that, but that's a different issue).<br>
<br>
</div></div>Sorry I failed to make it clearer. Metadata here refers to all<br>
allocation parameters the generic allocator was given to allocate<br>
memory. That currently means the final capability set used for<br>
the allocation, including all constraints (such as memory alignment,<br>
pitch alignment, and others) and capabilities, describing allocation<br>
properties like tiling formats, compression, and such.<br>
<span class=""><br>
> ><br>
> > And since there's no patches for nouveau itself I can't really say<br>
> > anything beyond that.<br>
<br>
</span>I can work on implementing these interfaces for nouveau, maybe<br>
partially, if that's going to help. I just thought it'd be better to<br>
first start a discussion on what would be the right way to pass<br>
allocator metadata to display drivers before starting to seriously<br>
implement any of the proposed options.<br>
<span class=""><br>
><br>
> I'd like to see concrete examples of actual display controllers<br>
> supporting more format layouts than what can be specified with a 64<br>
> bit modifier.<br>
<br>
</span>The main problem is our tiling and other metadata parameters can't<br>
generally fit in a modifier, so we find passing a blob of metadata a<br>
more suitable mechanism.<br></blockquote><div><br></div><div>I understand that you may have n knobs with a total of more than a total of 56 bits that configure your tiling/swizzling for color buffers. What I don't buy is that you need all those combinations when passing buffers around between codecs, cameras and display controllers. Even if you're sharing between the same 3D drivers in different processes, I expect just locking down, say, 64 different combinations (you can add more over time) and assigning each a modifier would be sufficient. I doubt you'd extract meaningful performance gains from going all the way to a blob.</div><div><br></div><div>If you want us the redesign KMS and the rest of the eco system around blobs instead of the modifiers that are now moderately pervasive, you have to justify it a little better than just "we didn't find it suitable".</div><div><br></div><div>Kristian</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Thanks.<br>
<span class=""><br>
><br>
> Kristian<br>
><br>
> > -Daniel<br>
> > --<br>
> > Daniel Vetter<br>
> > Software Engineer, Intel Corporation<br>
> > <a href="tel:%2B41%20%280%29%2079%20365%2057%2048" value="+41793655748">+41 (0) 79 365 57 48</a> - <a href="http://blog.ffwll.ch" rel="noreferrer" target="_blank">http://blog.ffwll.ch</a><br>
> > ______________________________<wbr>_________________<br>
> > dri-devel mailing list<br>
> > <a href="mailto:dri-devel@lists.freedesktop.org">dri-devel@lists.freedesktop.<wbr>org</a><br>
> > <a href="https://lists.freedesktop.org/mailman/listinfo/dri-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/dri-devel</a><br>
</span>> ______________________________<wbr>_________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
--<br>
Miguel<br>
<br>
<br>
</font></span></blockquote></div><br></div></div>