<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, Nov 25, 2017 at 1:20 PM, Rob Clark <span dir="ltr"><<a href="mailto:robdclark@gmail.com" target="_blank">robdclark@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Sat, Nov 25, 2017 at 12:46 PM, Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>> wrote:<br>
> On November 24, 2017 09:29:43 Rob Clark <<a href="mailto:robdclark@gmail.com">robdclark@gmail.com</a>> wrote:<br>
>><br>
>><br>
>> On Mon, Nov 20, 2017 at 8:11 PM, James Jones <<a href="mailto:jajones@nvidia.com">jajones@nvidia.com</a>> wrote:<br>
>>><br>
>>> As many here know at this point, I've been working on solving issues<br>
>>> related<br>
>>> to DMA-capable memory allocation for various devices for some time now.<br>
>>> I'd<br>
>>> like to take this opportunity to apologize for the way I handled the EGL<br>
>>> stream proposals.  I understand now that the development process followed<br>
>>> there was unacceptable to the community and likely offended many great<br>
>>> engineers.<br>
>>><br>
>>> Moving forward, I attempted to reboot talks in a more constructive manner<br>
>>> with the generic allocator library proposals & discussion forum at XDC<br>
>>> 2016.<br>
>>> Some great design ideas came out of that, and I've since been prototyping<br>
>>> some code to prove them out before bringing them back as official<br>
>>> proposals.<br>
>>> Again, I understand some people are growing concerned that I've been<br>
>>> doing<br>
>>> this off on the side in a github project that has primarily NVIDIA<br>
>>> contributors.  My goal was only to avoid wasting everyone's time with<br>
>>> unproven ideas.  The intent was never to dump the prototype code as-is on<br>
>>> the community and presume acceptance. It's just a public research<br>
>>> project.<br>
>>><br>
>>> Now the prototyping is nearing completion, and I'd like to renew<br>
>>> discussion<br>
>>> on whether and how the new mechanisms can be integrated with the Linux<br>
>>> graphics stack.<br>
>>><br>
>>> I'd be interested to know if more work is needed to demonstrate the<br>
>>> usefulness of the new mechanisms, or whether people think they have value<br>
>>> at<br>
>>> this point.<br>
>>><br>
>>> After talking with people on the hallway track at XDC this year, I've<br>
>>> heard<br>
>>> several proposals for incorporating the new mechanisms:<br>
>>><br>
>>> -Include ideas from the generic allocator design into GBM.  This could<br>
>>> take<br>
>>> the form of designing a "GBM 2.0" API, or incrementally adding to the<br>
>>> existing GBM API.<br>
>>><br>
>>> -Develop a library to replace GBM.  The allocator prototype code could be<br>
>>> massaged into something production worthy to jump start this process.<br>
>>><br>
>>> -Develop a library that sits beside or on top of GBM, using GBM for<br>
>>> low-level graphics buffer allocation, while supporting non-graphics<br>
>>> kernel<br>
>>> APIs directly.  The additional cross-device negotiation and sorting of<br>
>>> capabilities would be handled in this slightly higher-level API before<br>
>>> handing off to GBM and other APIs for actual allocation somehow.<br>
>><br>
>><br>
>> tbh, I kinda see GBM and $new_thing sitting side by side.. GBM is<br>
>> still the "winsys" for running on "bare metal" (ie. kms).  And we<br>
>> don't want to saddle $new_thing with aspects of that, but rather have<br>
>> it focus on being the thing that in multiple-"device"[1] scenarious<br>
>> figures out what sort of buffer can be allocated by who for sharing.<br>
>> Ie $new_thing should really not care about winsys level things like<br>
>> cursors or surfaces.. only buffers.<br>
>><br>
>> The mesa implementation of $new_thing could sit on top of GBM,<br>
>> although it could also just sit on top of the same internal APIs that<br>
>> GBM sits on top of.  That is an implementation detail.  It could be<br>
>> that GBM grows an API to return an instance of $new_thing for<br>
>> use-cases that involve sharing a buffer with the GPU.  Or perhaps that<br>
>> is exposed via some sort of EGL extension.  (We probably also need a<br>
>> way to get an instance from libdrm (?) for display-only KMS drivers,<br>
>> to cover cases like etnaviv sharing a buffer with a separate display<br>
>> driver.)<br>
>><br>
>> [1] where "devices" could be multiple GPUs or multiple APIs for one or<br>
>> more GPUs, but also includes non-GPU devices like camera, video<br>
>> decoder, "image processor" (which may or may not be part of camera),<br>
>> etc, etc<br>
><br>
><br>
> I'm not quite some sure what I think about this.  I think I would like to<br>
> see $new_thing at least replace the guts of GBM. Whether GBM becomes a<br>
> wrapper around $new_thing or $new_thing implements the GBM API, I'm not<br>
> sure.  What I don't think I want is to see GBM development continuing on<br>
> it's own so we have two competing solutions.<br>
<br>
</div></div>I don't really view them as competing.. there is *some* overlap, ie.<br>
allocating a buffer.. but even if you are using GBM w/out $new_thing<br>
you could allocate a buffer externally and import it.  I don't see<br>
$new_thing as that much different from GBM PoV.<br>
<br>
But things like surfaces (aka swap chains) seem a bit out of place<br>
when you are thinking about implementing $new_thing for non-gpu<br>
devices.  Plus EGL<->GBM tie-ins that seem out of place when talking<br>
about a (for ex.) camera.  I kinda don't want to throw out the baby<br>
with the bathwater here.<br></blockquote><div><br></div><div>Agreed.  GBM is very EGLish and we don't want the new allocator to be that.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
*maybe* GBM could be partially implemented on top of $new_thing.  I<br>
don't quite see how that would work.  Possibly we could deprecate<br>
parts of GBM that are no longer needed?  idk..  Either way, I fully<br>
expect that GBM and mesa's implementation of $new_thing could perhaps<br>
sit on to of some of the same set of internal APIs.  The public<br>
interface can be decoupled from the internal implementation.<span class=""><br></span></blockquote><div><br></div><div>Maybe I should restate things a bit.  My real point was that modifiers + $new_thing + Kernel blob should be a complete and more powerful replacement for GBM.  I don't know that we really can implement GBM on top of it because GBM has lots of wishy-washy concepts such as "cursor plane" which may not map well at least not without querying the kernel about specifc display planes.  In particular, I don't want someone to feel like they need to use $new_thing and GBM at the same time or together.  Ideally, I'd like them to never do that unless we decide gbm_bo is a useful abstraction for $new_thing.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
> I *think* I like the idea of having $new_thing implement GBM as a deprecated<br>
> legacy API.  Whether that means we start by pulling GBM out into it's own<br>
> project or we start over, I don't know.  My feeling is that the current<br>
> dri_interface is *not* what we want which is why starting with GBM makes me<br>
> nervous.<br>
<br>
</span>/me expects if we pull GBM out of mesa, the interface between GBM and<br>
mesa (or other GL drivers) is 'struct gbm_device'.. so "GBM the<br>
project" is just a thin shim plus some 'struct gbm_device' versioning.<br>
<br>
BR,<br>
-R<br>
<div class="HOEnZb"><div class="h5"><br>
> I need to go read through your code before I can provide a stronger or more<br>
> nuanced opinion.  That's not going to happen before the end of the year.<br>
><br>
>>> -I have also heard some general comments that regardless of the<br>
>>> relationship<br>
>>> between GBM and the new allocator mechanisms, it might be time to move<br>
>>> GBM<br>
>>> out of Mesa so it can be developed as a stand-alone project.  I'd be<br>
>>> interested what others think about that, as it would be something worth<br>
>>> coordinating with any other new development based on or inside of GBM.<br>
>><br>
>><br>
>> +1<br>
>><br>
>> We already have at least a couple different non-mesa implementations<br>
>> of GBM (which afaict tend to lag behind mesa's GBM and cause<br>
>> headaches).<br>
>><br>
>> The extracted part probably isn't much more than a header and shim.<br>
>> But probably does need to grow some versioning for the backend to know<br>
>> if, for example, gbm->bo_map() is supported.. at least it could<br>
>> provide stubs that return an error, rather than having link-time fail<br>
>> if building something w/ $vendor's old gbm implementation.<br>
>><br>
>>> And of course I'm open to any other ideas for integration.  Beyond just<br>
>>> where this code would live, there is much to debate about the mechanisms<br>
>>> themselves and all the implementation details.  I was just hoping to kick<br>
>>> things off with something high level to start.<br>
>><br>
>><br>
>> My $0.02, is that the place where devel happens and place to go for<br>
>> releases could be different.  Either way, I would like to see git tree<br>
>> for tagged release versions live on fd.o and use the common release<br>
>> process[2] for generating/uploading release tarballs that distros can<br>
>> use.<br>
><br>
><br>
> Agreed.  I think fd.o is the right place for such a project to live.  We can<br>
> have mirrors on GitHub and other places but fd.o is where Linux graphics<br>
> stack development currently happens.<br>
><br>
>> [2] <a href="https://cgit.freedesktop.org/xorg/util/modular/tree/release.sh" rel="noreferrer" target="_blank">https://cgit.freedesktop.org/<wbr>xorg/util/modular/tree/<wbr>release.sh</a><br>
>><br>
>>> For reference, the code Miguel and I have been developing for the<br>
>>> prototype<br>
>>> is here:<br>
>>><br>
>>>    <a href="https://github.com/cubanismo/allocator" rel="noreferrer" target="_blank">https://github.com/cubanismo/<wbr>allocator</a><br>
>>><br>
>>> And we've posted a port of kmscube that uses the new interfaces as a<br>
>>> demonstration here:<br>
>>><br>
>>>    <a href="https://github.com/cubanismo/kmscube" rel="noreferrer" target="_blank">https://github.com/cubanismo/<wbr>kmscube</a><br>
>>><br>
>>> There are still some proposed mechanisms (usage transitions mainly) that<br>
>>> aren't prototyped, but I think it makes sense to start discussing<br>
>>> integration while prototyping continues.<br>
>><br>
>><br>
>> btw, I think a nice end goal would be a gralloc implementation using<br>
>> this new API for sharing buffers in various use-cases.  That could<br>
>> mean converting gbm-gralloc, or perhaps it means something new.<br>
>><br>
>> AOSP has support for mesa + upstream kernel for some devices which<br>
>> also have upstream camera and/or video decoder in addition to just<br>
>> GPU.. and this is where you start hitting the limits of a GBM based<br>
>> gralloc.  In a lot of way, I view $new_thing as what gralloc *should*<br>
>> have been, but at least it provides a way to implement a generic<br>
>> gralloc.<br>
><br>
><br>
> +100<br>
><br>
><br>
>> Maybe that is getting a step ahead, there is a lot we can prototype<br>
>> with kmscube.  But gralloc gets us into interesting real-world<br>
>> use-cases that involve more than just GPUs.  Possibly this would be<br>
>> something that linaro might be interested in getting involved with?<br>
>><br>
>> BR,<br>
>> -R<br>
>><br>
>>> In addition, I'd like to note that NVIDIA is committed to providing open<br>
>>> source driver implementations of these mechanisms for our hardware, in<br>
>>> addition to support in our proprietary drivers.  In other words, wherever<br>
>>> modifications to the nouveau kernel & userspace drivers are needed to<br>
>>> implement the improved allocator mechanisms, we'll be contributing<br>
>>> patches<br>
>>> if no one beats us to it.<br>
>>><br>
>>> Thanks in advance for any feedback!<br>
>>><br>
>>> -James Jones<br>
>>> ______________________________<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>
>><br>
>> ______________________________<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>
><br>
><br>
><br>
</div></div></blockquote></div><br></div></div>