<div dir="ltr">Hi Daniel,<br><div class="gmail_extra"><br><div class="gmail_quote">2016-05-13 18:49 GMT+08:00 Daniel Vetter <span dir="ltr"><<a href="mailto:daniel@ffwll.ch" target="_blank">daniel@ffwll.ch</a>></span>:<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 Fri, May 13, 2016 at 02:33:13PM +0800, Jammy Zhou wrote:<br>
> 2016-05-13 14:01 GMT+08:00 Nicolai Hähnle <<a href="mailto:nhaehnle@gmail.com">nhaehnle@gmail.com</a>>:<br>
><br>
> > On 13.05.2016 00:22, Jammy Zhou wrote:<br>
> ><br>
> >><br>
> >><br>
> >> 2016-05-13 12:39 GMT+08:00 Nicolai Hähnle <<a href="mailto:nhaehnle@gmail.com">nhaehnle@gmail.com</a><br>
> >> <mailto:<a href="mailto:nhaehnle@gmail.com">nhaehnle@gmail.com</a>>>:<br>
> >><br>
> >>     On 12.05.2016 20:20, Jammy Zhou wrote:<br>
> >><br>
> >><br>
> >><br>
> >>         2016-05-12 17:39 GMT+08:00 Michel Dänzer <<a href="mailto:michel@daenzer.net">michel@daenzer.net</a><br>
> >>         <mailto:<a href="mailto:michel@daenzer.net">michel@daenzer.net</a>><br>
> >>         <mailto:<a href="mailto:michel@daenzer.net">michel@daenzer.net</a> <mailto:<a href="mailto:michel@daenzer.net">michel@daenzer.net</a>>>>:<br>
> >><br>
> >><br>
> >>              On 12.05.2016 17:58, Yu, Qiang wrote:<br>
> >>              > Oh, what a crazy idea. So you mean it can work like this?<br>
> >>              ><br>
> >>              > 1. use the libgbm/gbm_dri/libEGL/libGLES from mesa which<br>
> >>         will load<br>
> >>              > radeonsi_dri.so<br>
> >>              ><br>
> >>              > 2. libGL/amdgpu_dri.so from amdgpu-pro<br>
> >><br>
> >>              glamor uses libEGL/GBM and libGL, so this could only work<br>
> >>         with Mesa's<br>
> >>              libGL (or the GLVND one in the future). Can amdgpu_dri.so<br>
> >>         work with<br>
> >>              Mesa's libGL right now?<br>
> >><br>
> >><br>
> >>         I think amdgpu_dri.so is not completely compatible with Mesa's<br>
> >> libGL<br>
> >>         (considering some special feature requirements for amdgpu-pro<br>
> >>         and Mesa's<br>
> >>         evolving). Another problem is that Mesa's libgbm cannot share<br>
> >>         necessary<br>
> >>         buffer attributes (such as tiling info, etc) with amdgpu_dri.so<br>
> >>         at this<br>
> >>         moment.<br>
> >><br>
> >><br>
> >>     I think the long-term plan for such attributes is passing them via<br>
> >>     amdgpu_bo_metadata (which is defined in libdrm's amdgpu.h). This<br>
> >>     metadata is read and written directly through libdrm_amdgpu, and so<br>
> >>     libgbm doesn't have to be involved as far as I can see.<br>
> >><br>
> >><br>
> >> Yes, amdgpu_bo_metadata is exactly one good place for such kind of<br>
> >> information. But IMHO there are still several things to take care. Did I<br>
> >> miss something?<br>
> >> - Same meta data definition ("umd_metadata" field) should be used by<br>
> >> radeonsi and amdgpu-pro.<br>
> >><br>
> ><br>
> > I absolutely agree that we need to coordinate on how the metadata fields<br>
> > are used.<br>
> ><br>
> > At this time, radeonsi uses and sets the explicit members of<br>
> > amdgpu_bo_metadata, i.e. tiling_info and size_metadata. As far as I can<br>
> > see, no flags have been defined - flags and umd_metadata are preserved by<br>
> > radeonsi if a different UMD were to set them, and are otherwise initialized<br>
> > to 0.<br>
> ><br>
> ><br>
> > - We need some way to translate gbm_bo or EGLImage into amdgpu_bo, so<br>
> >> that libdrm_amdgpu interfaces can be used.<br>
> >><br>
> ><br>
> > In general, how to do this kind of mapping depends on the situation. For<br>
> > example, for gbm_bo it is the GBM backend that allocates the gbm_bo<br>
> > structure, so C-style inheritance can be used. For example, the DRI backend<br>
> > has a type:<br>
> ><br>
> > struct gbm_dri_bo {<br>
> >    struct gbm_drm_bo base;<br>
> ><br>
> >    __DRIimage *image;<br>
> ><br>
> >    /* Used for cursors and the swrast front BO */<br>
> >    uint32_t handle, size;<br>
> >    void *map;<br>
> > };<br>
> ><br>
> > It will allocate a struct gbm_dri_bo, and pass a pointer to base back to<br>
> > the caller. Then, callbacks implemented by the backend cast the provided<br>
> > gbm_bo pointer to gbm_dri_bo. The GBM backend implementation in amdgpu-pro<br>
> > can use the same trick, and store whatever internal info it requires in the<br>
> > "derived" structure, e.g. an amdgpu_bo_handle.<br>
> ><br>
><br>
> To clarify, I was talking about retrieving the meta data from gbm_bo in<br>
> amdgpu-pro. This doesn't work if the DRI backend (radeonsi_dri.so) is used<br>
> with mesa libgbm, which was mentioned in previous discussion.<br>
<br>
</div></div>Randomly jumping in here with a few notes. I'm digging through the entire<br>
egl/gbm/wayland stack right now to figure out what metadata needs to be<br>
added so that we can describe buffers faithfully and completely, including<br>
tiling, compression and all that, in a generic way.<br></blockquote><div><br></div><div>That sounds good. How are you going to handle some vendor specific attributes? For example, different tiling formats may be defined by vendors for their own hardware.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
It will be just for color buffers (i.e. anything you might actually want<br>
to share), because that's the only thing we need to share across<br>
drivers/processes, but I think that's the same thing you need here. The<br>
basic idea is to add the fb_modifiers we have added to the kernel (and<br>
which are defined in drm_fourcc.h) to the DRIimage interfaces, both for<br>
exporting and importing. </blockquote><div><br></div><div>DRIimage is mesa specific concept. But I'm wondering how it can work with amdgpu-pro or some other non-mesa drivers.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">It's always been the idea that drm_fourcc.h could<br>
also contain fb_modifiers which are only useful for GL->GL sharing, so no<br>
requirement to have an in-kernel user for each define. E.g. when certain<br>
tiling layouts can't be scanned out.<br>
<br>
That should be enough that you could talk to 2 completely different dri<br>
drivers, and share buffers with them in a generic way.<br>
<br>
Cheers, Daniel<br>
<span class="HOEnZb"><font color="#888888">--<br>
Daniel Vetter<br>
Software Engineer, Intel Corporation<br>
<a href="http://blog.ffwll.ch" rel="noreferrer" target="_blank">http://blog.ffwll.ch</a><br>
</font></span></blockquote></div><br></div></div>