Re: [Mesa-dev] [PATCH 00/10] egl/android: Improve the Android EGL backend

2016-07-20 Thread Tomasz Figa
On Wed, Jul 20, 2016 at 10:43 PM, Rob Herring  wrote:
> On Mon, Jul 18, 2016 at 11:29 PM, Tomasz Figa  wrote:
>> On Tue, Jul 19, 2016 at 12:35 PM, Rob Herring  wrote:
>>> On Fri, Jul 15, 2016 at 2:53 AM, Tomasz Figa  wrote:
 Hi,

 This series is a collection of various fixes and extensions we came up
 with during our attempt to use Mesa for Android.

 Fixes included in this series:
  - added mandatory EGL_MAX_PBUFFER_WIDTH and _HEIGHT attributes to EGL
configs,
  - fixed multiple issues with handling pbuffers in the backend,
  - found and fixed a DRI image leak,
  - made the implementation of DRI image loader .getBuffers callback
conform better to the extension semantics.

 New features added by this series:
  - possibility to build the Android EGL platform without drm_gralloc
headers,
  - support for creating EGL images from Android native buffers with
YV12 pixel format (prime-only),
  - fallback to kms_swrast driver when no hardware driver can be loaded
but there is still some usable DRI node present in the system.
  - more logging in case of errors to help diagnosing problems.

 Testing was done using classic i965 (gen 8) and gallium softpipe drivers
 on an internal build of Android, based on gralloc backed by a DRM render
 node and sharing buffers by PRIME FDs.
>>>
>>> I've tested out patches 1-6 with virgl and I don't get anything
>>> displayed. I get this message:
>>>
>>> EGL-DRI2: Front buffer is not supported for window surfaces
>>>
>>> That's as far as I investigated. I'll look into it some more tomorrow.
>>
>> Thanks a lot for testing!
>>
>> It looks like somehow your driver (or gallium) is triggering a call to
>> DRI image loader getBuffers() callback with front buffer bit set in
>> the image mask, but window surfaces on Android provide only back
>> buffers.
>
> I've debugged this a bit more, but still am not sure what's going on.
> Reverting #6 fixes things though. I don't see how a specific driver
> would cause the issue here. Here's the call stack for where the
> warning is printed:
>
> 07-19 21:30:37.750  2153  2153 F DEBUG   : #00 pc fc8d
>  /system/lib64/egl/libGLES_mesa.so (droid_image_get_buffers+77)
> 07-19 21:30:37.750  2153  2153 F DEBUG   : #01 pc 00319554
>  /system/lib64/dri/gallium_dri.so (dri2_allocate_textures+660)
> 07-19 21:30:37.750  2153  2153 F DEBUG   : #02 pc 003157c6
>  /system/lib64/dri/gallium_dri.so (dri_st_framebuffer_validate+566)
> 07-19 21:30:37.750  2153  2153 F DEBUG   : #03 pc 004eadf3
>  /system/lib64/dri/gallium_dri.so (st_framebuffer_validate+115)
> 07-19 21:30:37.750  2153  2153 F DEBUG   : #04 pc 004ead4e
>  /system/lib64/dri/gallium_dri.so
> (st_manager_validate_framebuffers+78)
> 07-19 21:30:37.750  2153  2153 F DEBUG   : #05 pc 004c7450
>  /system/lib64/dri/gallium_dri.so (st_validate_state+352)
> 07-19 21:30:37.750  2153  2153 F DEBUG   : #06 pc 004e6d5c
>  /system/lib64/dri/gallium_dri.so (st_draw_vbo+172)
> 07-19 21:30:37.750  2153  2153 F DEBUG   : #07 pc 004acc31
>  /system/lib64/dri/gallium_dri.so (vbo_draw_arrays+289)
> 07-19 21:30:37.750  2153  2153 F DEBUG   : #08 pc 00044dce
>  /system/lib64/libsurfaceflinger.so
> (android::GLES20RenderEngine::drawMesh(android::Mesh const&)+254)
> 07-19 21:30:37.750  2153  2153 F DEBUG   : #09 pc 00025af9
>  /system/lib64/libsurfaceflinger.so
> (android::Layer::drawWithOpenGL(android::sp const> const&, android::Region const&, bool) const+329)
>
>> My understanding of the semantics was that the callback should deny
>> such requests, so that's how I implemented it. However it isn't really
>> well documented, so potentially it should only provide buffers that
>> are available and ignore the rest without bailing out. Could someone
>> more familiar with this extension comment on this?

It looks like the semantics might be different indeed. Let me fix the
patch. Thanks a lot for testing.

I wonder how it worked on softpipe, though. Generally the requested
attachment list depends on the st_framebuffer passed to
st_framebuffer_validate(). I'm not that much familiar with Mesa state
tracker unfortunately to be able to tell what's going on exactly.

Best regards,
Tomasz
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 00/10] egl/android: Improve the Android EGL backend

2016-07-20 Thread Emil Velikov
On 15 July 2016 at 08:53, Tomasz Figa  wrote:
> Hi,
>
> This series is a collection of various fixes and extensions we came up
> with during our attempt to use Mesa for Android.
>
> Fixes included in this series:
>  - added mandatory EGL_MAX_PBUFFER_WIDTH and _HEIGHT attributes to EGL
>configs,
>  - fixed multiple issues with handling pbuffers in the backend,
>  - found and fixed a DRI image leak,
>  - made the implementation of DRI image loader .getBuffers callback
>conform better to the extension semantics.
>
> New features added by this series:
>  - possibility to build the Android EGL platform without drm_gralloc
>headers,
>  - support for creating EGL images from Android native buffers with
>YV12 pixel format (prime-only),
>  - fallback to kms_swrast driver when no hardware driver can be loaded
>but there is still some usable DRI node present in the system.
>  - more logging in case of errors to help diagnosing problems.
>
> Testing was done using classic i965 (gen 8) and gallium softpipe drivers
> on an internal build of Android, based on gralloc backed by a DRM render
> node and sharing buffers by PRIME FDs.
>
> Haixia Shi (1):
>   egl/android: Set EGL_MAX_PBUFFER_WIDTH and EGL_MAX_PBUFFER_HEIGHT
>
> Nicolas Boichat (1):
>   egl/android: Fix support for pbuffers
>
> Tomasz Figa (8):
>   egl/android: Check return value of dri2_get_dri_config()
>   egl/android: Add some useful error messages
>   egl/android: Stop leaking DRI images
I've pushed the above three from this series as the rest either cause
issues or might need a bit of polish.
Thanks for sending these, and huge shout out to Eric for having a look :-)

Btw, I've also pushed your earlier (standalone) patches:
 gallium/dri: Add shared glapi to LIBADD on Android
 egl/android: Remove unused variables
 i965: store reference to the context within struct brw_fence (v2)

Thanks
Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 00/10] egl/android: Improve the Android EGL backend

2016-07-20 Thread Rob Herring
On Mon, Jul 18, 2016 at 11:29 PM, Tomasz Figa  wrote:
> On Tue, Jul 19, 2016 at 12:35 PM, Rob Herring  wrote:
>> On Fri, Jul 15, 2016 at 2:53 AM, Tomasz Figa  wrote:
>>> Hi,
>>>
>>> This series is a collection of various fixes and extensions we came up
>>> with during our attempt to use Mesa for Android.
>>>
>>> Fixes included in this series:
>>>  - added mandatory EGL_MAX_PBUFFER_WIDTH and _HEIGHT attributes to EGL
>>>configs,
>>>  - fixed multiple issues with handling pbuffers in the backend,
>>>  - found and fixed a DRI image leak,
>>>  - made the implementation of DRI image loader .getBuffers callback
>>>conform better to the extension semantics.
>>>
>>> New features added by this series:
>>>  - possibility to build the Android EGL platform without drm_gralloc
>>>headers,
>>>  - support for creating EGL images from Android native buffers with
>>>YV12 pixel format (prime-only),
>>>  - fallback to kms_swrast driver when no hardware driver can be loaded
>>>but there is still some usable DRI node present in the system.
>>>  - more logging in case of errors to help diagnosing problems.
>>>
>>> Testing was done using classic i965 (gen 8) and gallium softpipe drivers
>>> on an internal build of Android, based on gralloc backed by a DRM render
>>> node and sharing buffers by PRIME FDs.
>>
>> I've tested out patches 1-6 with virgl and I don't get anything
>> displayed. I get this message:
>>
>> EGL-DRI2: Front buffer is not supported for window surfaces
>>
>> That's as far as I investigated. I'll look into it some more tomorrow.
>
> Thanks a lot for testing!
>
> It looks like somehow your driver (or gallium) is triggering a call to
> DRI image loader getBuffers() callback with front buffer bit set in
> the image mask, but window surfaces on Android provide only back
> buffers.

I've debugged this a bit more, but still am not sure what's going on.
Reverting #6 fixes things though. I don't see how a specific driver
would cause the issue here. Here's the call stack for where the
warning is printed:

07-19 21:30:37.750  2153  2153 F DEBUG   : #00 pc fc8d
 /system/lib64/egl/libGLES_mesa.so (droid_image_get_buffers+77)
07-19 21:30:37.750  2153  2153 F DEBUG   : #01 pc 00319554
 /system/lib64/dri/gallium_dri.so (dri2_allocate_textures+660)
07-19 21:30:37.750  2153  2153 F DEBUG   : #02 pc 003157c6
 /system/lib64/dri/gallium_dri.so (dri_st_framebuffer_validate+566)
07-19 21:30:37.750  2153  2153 F DEBUG   : #03 pc 004eadf3
 /system/lib64/dri/gallium_dri.so (st_framebuffer_validate+115)
07-19 21:30:37.750  2153  2153 F DEBUG   : #04 pc 004ead4e
 /system/lib64/dri/gallium_dri.so
(st_manager_validate_framebuffers+78)
07-19 21:30:37.750  2153  2153 F DEBUG   : #05 pc 004c7450
 /system/lib64/dri/gallium_dri.so (st_validate_state+352)
07-19 21:30:37.750  2153  2153 F DEBUG   : #06 pc 004e6d5c
 /system/lib64/dri/gallium_dri.so (st_draw_vbo+172)
07-19 21:30:37.750  2153  2153 F DEBUG   : #07 pc 004acc31
 /system/lib64/dri/gallium_dri.so (vbo_draw_arrays+289)
07-19 21:30:37.750  2153  2153 F DEBUG   : #08 pc 00044dce
 /system/lib64/libsurfaceflinger.so
(android::GLES20RenderEngine::drawMesh(android::Mesh const&)+254)
07-19 21:30:37.750  2153  2153 F DEBUG   : #09 pc 00025af9
 /system/lib64/libsurfaceflinger.so
(android::Layer::drawWithOpenGL(android::sp const&, android::Region const&, bool) const+329)

> My understanding of the semantics was that the callback should deny
> such requests, so that's how I implemented it. However it isn't really
> well documented, so potentially it should only provide buffers that
> are available and ignore the rest without bailing out. Could someone
> more familiar with this extension comment on this?
>
>>
>> Patches 7-10 wouldn't apply. Do you have a git tree with the series?
>
> Hmm, I rebased them on Mesa master just before sending. Let me try to
> create a sandbox branch in our chromium tree.

Turns out to be something in my tree...

Rob
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 00/10] egl/android: Improve the Android EGL backend

2016-07-20 Thread Tomasz Figa
Hi Rob,

On Tue, Jul 19, 2016 at 1:29 PM, Tomasz Figa  wrote:
> On Tue, Jul 19, 2016 at 12:35 PM, Rob Herring  wrote:
>>
>> Patches 7-10 wouldn't apply. Do you have a git tree with the series?
>
> Hmm, I rebased them on Mesa master just before sending. Let me try to
> create a sandbox branch in our chromium tree.

https://chromium.googlesource.com/chromiumos/third_party/mesa tfiga/android-egl

Best regards,
Tomasz
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 00/10] egl/android: Improve the Android EGL backend

2016-07-18 Thread Tomasz Figa
On Tue, Jul 19, 2016 at 12:35 PM, Rob Herring  wrote:
> On Fri, Jul 15, 2016 at 2:53 AM, Tomasz Figa  wrote:
>> Hi,
>>
>> This series is a collection of various fixes and extensions we came up
>> with during our attempt to use Mesa for Android.
>>
>> Fixes included in this series:
>>  - added mandatory EGL_MAX_PBUFFER_WIDTH and _HEIGHT attributes to EGL
>>configs,
>>  - fixed multiple issues with handling pbuffers in the backend,
>>  - found and fixed a DRI image leak,
>>  - made the implementation of DRI image loader .getBuffers callback
>>conform better to the extension semantics.
>>
>> New features added by this series:
>>  - possibility to build the Android EGL platform without drm_gralloc
>>headers,
>>  - support for creating EGL images from Android native buffers with
>>YV12 pixel format (prime-only),
>>  - fallback to kms_swrast driver when no hardware driver can be loaded
>>but there is still some usable DRI node present in the system.
>>  - more logging in case of errors to help diagnosing problems.
>>
>> Testing was done using classic i965 (gen 8) and gallium softpipe drivers
>> on an internal build of Android, based on gralloc backed by a DRM render
>> node and sharing buffers by PRIME FDs.
>
> I've tested out patches 1-6 with virgl and I don't get anything
> displayed. I get this message:
>
> EGL-DRI2: Front buffer is not supported for window surfaces
>
> That's as far as I investigated. I'll look into it some more tomorrow.

Thanks a lot for testing!

It looks like somehow your driver (or gallium) is triggering a call to
DRI image loader getBuffers() callback with front buffer bit set in
the image mask, but window surfaces on Android provide only back
buffers.

My understanding of the semantics was that the callback should deny
such requests, so that's how I implemented it. However it isn't really
well documented, so potentially it should only provide buffers that
are available and ignore the rest without bailing out. Could someone
more familiar with this extension comment on this?

>
> Patches 7-10 wouldn't apply. Do you have a git tree with the series?

Hmm, I rebased them on Mesa master just before sending. Let me try to
create a sandbox branch in our chromium tree.

Best regards,
Tomasz
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 00/10] egl/android: Improve the Android EGL backend

2016-07-18 Thread Rob Herring
On Fri, Jul 15, 2016 at 2:53 AM, Tomasz Figa  wrote:
> Hi,
>
> This series is a collection of various fixes and extensions we came up
> with during our attempt to use Mesa for Android.
>
> Fixes included in this series:
>  - added mandatory EGL_MAX_PBUFFER_WIDTH and _HEIGHT attributes to EGL
>configs,
>  - fixed multiple issues with handling pbuffers in the backend,
>  - found and fixed a DRI image leak,
>  - made the implementation of DRI image loader .getBuffers callback
>conform better to the extension semantics.
>
> New features added by this series:
>  - possibility to build the Android EGL platform without drm_gralloc
>headers,
>  - support for creating EGL images from Android native buffers with
>YV12 pixel format (prime-only),
>  - fallback to kms_swrast driver when no hardware driver can be loaded
>but there is still some usable DRI node present in the system.
>  - more logging in case of errors to help diagnosing problems.
>
> Testing was done using classic i965 (gen 8) and gallium softpipe drivers
> on an internal build of Android, based on gralloc backed by a DRM render
> node and sharing buffers by PRIME FDs.

I've tested out patches 1-6 with virgl and I don't get anything
displayed. I get this message:

EGL-DRI2: Front buffer is not supported for window surfaces

That's as far as I investigated. I'll look into it some more tomorrow.

Patches 7-10 wouldn't apply. Do you have a git tree with the series?

Rob
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev