<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Nov 28, 2013 at 2:14 AM,  <span dir="ltr"><<a href="mailto:davyaxel@free.fr" target="_blank">davyaxel@free.fr</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 27/11/2013, Zhigang Gong wrote :<br>
> On Tue, Nov 26, 2013 at 09:08:16PM +0100, <a href="mailto:davyaxel@free.fr" target="_blank">davyaxel@free.fr</a> wrote:<br>
><br>
>> I think the best approach is to consider we live in an argb8888 world (which seems a pretty good asumption right now).<br>
><br>
> Actually, just as you mentioned in last email glamor already faces this problem and uses this assumption too.<br>
> And it uses ARGB8888 for depth32.<br>
><br>
>><br>
>> We can't know which component order will result when allocating a texture with GL_BGRA of GL_RGBA.<br>
> Right, the actual internal texture format, the real pixel format, is hardware driver dependent.<br>
>> For example with gallium drivers, GL_RGBA (the one we use now for all textures) is ABGR8888.<br>
>> To ensure we use ARGB8888, the best to me seems to allocate an argb8888 gbm_bo, and create the texture from it (after converting to an image).<br>
> I agree with this solution.<br>
><br>
> Thanks,<br>
> Zhigang Gong.<br>
><br>
><br>
<br>
Thanks.<br>
<br>
Could you please tell what you think of the following to enable/handle dri3:<br>
<br>
. glamor_init has a new flag GLAMOR_ENABLE_DRI3.<br>
glamor_init would call a glamor_egl function to indicate to glamor_egl the user wants to enable dri3 support.<br>
<br>
. In glamor_egl_init, glamor_egl decides if the egl display is dri3 capable. It calls a glamor function that will enable<br>
dri3 support.<br>
<br>
. The user has access to a function to know if dri3 support is enabled.<br>
<br>
. If dri3 support is enabled, when creating a texture, glamor will first try to get the texture by calling<br>
a glamor_egl function to create a texture (and glamor_egl would use a gbm_bo for this).<br>
<br>
. glamor_egl can store the gbm_bo with its private pixmap key with the pixmap, to be able to avoid unnecessary steps when<br>
having to get an fd from a pixmap (it won't need to get the texture from glamor).<br>
<br>
. When a pixmap is destroyed, glamor will always call a glamor_egl function if dri3 support is enabled, to enable glamor_egl to delete the gbm_bo.<br>
<br>
. glamor defines a function to get the glamor_pixmap_type of a pixmap.<br>
<br>
. glamor_egl would define two functions to convert a pixmap to an fd and an fd to a pixmap. The behaviours and types would match exactly to what<br>
asks X Dri3 for the DDXs. The functions would do nothing if dri3 support isn't enabled.<br></blockquote><div><br></div><div>One major comment is, do we need to change the way of all pixmap's default creation behavior? I don't think we should do that. Only a few pixmaps will</div>
<div>be used as DRI3 buffer when it's referred by the two DRI3 APIs, we can convert it on demand. </div><div><br></div><div>For Get fd from pixmap: pixmap's texture --> image -->gbm_bo -->handle-->fd</div>
<div>For Get pixmap from fd: the same as you proposed .</div><div><br></div><div>This way we don't need to add a new option to the glamor_init. And we don't need to keep so many gbm_bos for each pixmap. And the libglamor.so</div>
<div>doesn't need to call any glamor_egl function directly. The reason why I split the library into libglamor.so and glamor_egl module is that the libglamor.so</div><div>maybe used by another gl context other than the egl. And at that time, one use case is the Xephyr. Although, I don't know whether it is still working</div>
<div>with xephyr now but it worked at the beginning. </div><div><br></div><div>As to the scan out pixmap, we may also need to remain the original method to let the DDX driver to allocate the buffer.</div><div><br></div><div>
What do you think?</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span><font color="#888888">
<br>
<br>
<br>
Axel Davy<br>
_______________________________________________<br>
Glamor mailing list<br>
<a href="mailto:Glamor@lists.freedesktop.org" target="_blank">Glamor@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/glamor" target="_blank">http://lists.freedesktop.org/mailman/listinfo/glamor</a><br>
</font></span></blockquote></div><br></div></div>