<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2017-04-04 0:54 GMT+02:00 Mauro Rossi <span dir="ltr"><<a href="mailto:issor.oruam@gmail.com" target="_blank">issor.oruam@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Tomasz,<div><div class="h5"><br><div class="gmail_extra"><br><div class="gmail_quote">2017-04-03 10:00 GMT+02:00 Tomasz Figa <span dir="ltr"><<a href="mailto:tfiga@chromium.org" target="_blank">tfiga@chromium.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Mauro,<br>
<div><div class="m_1702967716606725773h5"><br>
On Mon, Apr 3, 2017 at 2:48 AM, Mauro Rossi <<a href="mailto:issor.oruam@gmail.com" target="_blank">issor.oruam@gmail.com</a>> wrote:<br>
><br>
><br>
> 2017-03-31 13:05 GMT+02:00 Tapani Pälli <<a href="mailto:tapani.palli@intel.com" target="_blank">tapani.palli@intel.com</a>>:<br>
>><br>
>><br>
>><br>
>> On 03/31/2017 10:12 AM, Tapani Pälli wrote:<br>
>>><br>
>>><br>
>>><br>
>>> On 03/31/2017 09:06 AM, Tapani Pälli wrote:<br>
>>>><br>
>>>><br>
>>>><br>
>>>> On 03/31/2017 08:24 AM, Rob Clark wrote:<br>
>>>>><br>
>>>>> On Fri, Mar 31, 2017 at 12:22 AM, Tapani Pälli<br>
>>>>> <<a href="mailto:tapani.palli@intel.com" target="_blank">tapani.palli@intel.com</a>> wrote:<br>
>>>>>><br>
>>>>>><br>
>>>>>><br>
>>>>>> On 03/30/2017 05:57 PM, Emil Velikov wrote:<br>
>>>>>>><br>
>>>>>>><br>
>>>>>>> On 30 March 2017 at 15:30, Tomasz Figa <<a href="mailto:tfiga@chromium.org" target="_blank">tfiga@chromium.org</a>> wrote:<br>
>>>>>>>><br>
>>>>>>>><br>
>>>>>>>> On Thu, Mar 30, 2017 at 11:17 PM, Emil Velikov<br>
>>>>>>>> <<a href="mailto:emil.l.velikov@gmail.com" target="_blank">emil.l.velikov@gmail.com</a>><br>
>>>>>>>> wrote:<br>
>>>>>>>>><br>
>>>>>>>>><br>
>>>>>>>>><br>
>>>>>>>>> On 30 March 2017 at 11:55, Tomasz Figa <<a href="mailto:tfiga@chromium.org" target="_blank">tfiga@chromium.org</a>> wrote:<br>
>>>>>>>>>><br>
>>>>>>>>>><br>
>>>>>>>>>> Android buffer queues can be abandoned, which results in failing<br>
>>>>>>>>>> to<br>
>>>>>>>>>> dequeue next buffer. Currently this would fail somewhere deep<br>
>>>>>>>>>> within<br>
>>>>>>>>>> the DRI stack calling loader's getBuffers*(), without any error<br>
>>>>>>>>>> reporting to the client app. However Android framework code<br>
>>>>>>>>>> relies on<br>
>>>>>>>>>> proper signaling of this event, so we move buffer dequeue to<br>
>>>>>>>>>> createWindowSurface() and swapBuffers() call, which can generate<br>
>>>>>>>>>> proper<br>
>>>>>>>>>> EGL errors. To keep the performance benefits of delayed buffer<br>
>>>>>>>>>> handling,<br>
>>>>>>>>>> if any, fence wait and DRI image creation is kept delayed until<br>
>>>>>>>>>> getBuffers*() is called by the DRI driver.<br>
>>>>>>>>>><br>
>>>>>>>>> Thank you Tomasz.<br>
>>>>>>>>><br>
>>>>>>>>> I'm fairly confident that this should resolve the crash [in<br>
>>>>>>>>> swap_buffers] that Mauro was seeing.<br>
>>>>>>>>> Mauro can you give it a test ?<br>
>>>>>>>><br>
>>>>>>>><br>
>>>>>>>><br>
>>>>>>>> Ah, I actually noticed a problem with existing code, supposedly<br>
>>>>>>>> fixed<br>
>>>>>>>> by [1], but I'm afraid it's still wrong.<br>
>>>>>>>><br>
>>>>>>>> Current swap_buffers calls get_back_bo(), but doesn't call<br>
>>>>>>>> update_buffers(), which is the function that should be called before<br>
>>>>>>>> to actually dequeue a buffer from Android's buffer queue. Given<br>
>>>>>>>> that,<br>
>>>>>>>> get_back_bo() would simply fail with !dri2_surf->buffer, because no<br>
>>>>>>>> buffer was dequeued.<br>
>>>>>>>><br>
>>>>>>> Right - I was wondering why we don't hit that on EGL/GBM or<br>
>>>>>>> EGL/Wayland.<br>
>>>>>>> From a quick look - may be because EGL/Android drops the dpy mutex in<br>
>>>>>>> droid_window_enqueue_buffer().<br>
>>>>>>><br>
>>>>>>>> My patch removes update_buffers() and changes the buffer<br>
>>>>>>>> management so<br>
>>>>>>>> that there is always a buffer dequeued, starting from surface<br>
>>>>>>>> creation, unless there was an error somewhere.<br>
>>>>>>>><br>
>>>>>>> Of the top of your head - is there something stopping us from using<br>
>>>>>>> the same method on $other platforms?<br>
>>>>>>><br>
>>>>>>>> [1]<br>
>>>>>>>><br>
>>>>>>>> <a href="https://cgit.freedesktop.org/mesa/mesa/commit/src/egl/drivers/dri2/platform_android.c?id=4d4558411db166d2d66f8cec9cb581149dbe1597" rel="noreferrer" target="_blank">https://cgit.freedesktop.org/m<wbr>esa/mesa/commit/src/egl/driver<wbr>s/dri2/platform_android.c?id=4<wbr>d4558411db166d2d66f8cec9cb5811<wbr>49dbe1597</a><br>
>>>>>>>><br>
>>>>>>>><br>
>>>>>>>><br>
>>>>>>>>><br>
>>>>>>>>><br>
>>>>>>>>> Not that huge of an expert on the Android specifics, so just a<br>
>>>>>>>>> humble<br>
>>>>>>>>> request:<br>
>>>>>>>>> Can we seek the code resuffle (droid_{alloc,free}_local_buff<wbr>er,<br>
>>>>>>><br>
>>>>>>><br>
>>>>>>> Oops silly typo - s/seek/split/.<br>
>>>>>>><br>
>>>>>>>>> other?) separate from the functionality changes ?<br>
>>>>>>>><br>
>>>>>>>><br>
>>>>>>>><br>
>>>>>>>> Sure. Thanks for suggestion.<br>
>>>>>>>><br>
>>>>>>> Please give it a day or two for others to comment.<br>
>>>>>><br>
>>>>>><br>
>>>>>><br>
>>>>>> I'm trying to debug why this causes our homescreen (wallpaper) to be<br>
>>>>>> black.<br>
>>>>>> Otherwise I haven't seen any issues with these changes.<br>
>>>>>><br>
>>>>><br>
>>>>> wallpaper seems to be a special sorta hell.. I wonder if there is<br>
>>>>> somehow some sort of interaction with what I fixed / worked-around in<br>
>>>>> a5e733c6b52e93de3000647d075f5c<wbr>a2f55fcb71 ??<br>
>>>>><br>
>>>>> Maybe at least try commenting out the temp-pbuffer thing to get max<br>
>>>>> texture size, and see if that "fixes" things<br>
>>>><br>
>>>><br>
>>>> Can you give more details, I still live in la la land and don't know<br>
>>>> about 'temp-pbuffer thing'?<br>
>>>><br>
>>><br>
>>> aa I did not recall the problem, you mean the 'dummy pbuffer' in<br>
>>> SurfaceFlinger .. yes I will check if this is related.<br>
>>><br>
>><br>
>> If I take away that dummy pbuffer usage (which is useless anyway), couple<br>
>> of errors disappear from the log. They are:<br>
>><br>
>> SurfaceFlinger: releasePendingBuffer failed: Unknown error -1 (1)<br>
>> SurfaceFlinger: releasePendingBuffer failed: Unknown error -1 (1)<br>
>><br>
>> but otherwise the desktop still stays black, live wallpapers seem to work<br>
>> so there is something special about this default wallpaper. Will continue<br>
>> digging ..<br>
>><br>
>> // Tapani<br>
><br>
><br>
><br>
> Hi,<br>
><br>
> about the black wallpaper the only sign found in logcat is the following:<br>
><br>
> --------- beginning of main<br>
> 04-02 15:09:43.148<br>
> ...<br>
> 04-02 15:10:41.710 1414 1414 E Layer :<br>
> [com.android.systemui.ImageWal<wbr>lpaper] rejecting buffer: bufWidth=1024,<br>
> bufHeight=768, front.active.{w=1, h=1}<br>
> ...<br>
> 04-02 15:10:41.726 1414 1414 E Layer :<br>
> [com.android.systemui.ImageWal<wbr>lpaper] rejecting buffer: bufWidth=1024,<br>
> bufHeight=768, front.active.{w=1, h=1}<br>
><br>
> Are the expected width and height correct?<br>
><br>
> In dmesg at relative dmesg timestamp around 58 seconds there is no<br>
> signal/error,<br>
> just the selinux log (set to permissive):<br>
><br>
> [ 58.271833] type=1400 audit(1491145841.554:192): avc: denied { ioctl }<br>
> for pid=2141 comm="ndroid.systemui" path="/dev/dri/card0" dev="tmpfs"<br>
> ino=7199 ioctlcmd=6467 scontext=u:r:platform_app:s0:c<wbr>512,c768<br>
> tcontext=u:object_r:device:s0 tclass=chr_file permissive=1<br>
> [ 58.271879] type=1400 audit(1491145841.554:193): avc: denied { read write<br>
> } for pid=2141 comm="ndroid.systemui" path="/dev/dri/card0" dev="tmpfs"<br>
> ino=7199 scontext=u:r:platform_app:s0:c<wbr>512,c768<br>
> tcontext=u:object_r:device:s0 tclass=chr_file permissive=1<br>
><br>
> I hope these information may help<br>
<br>
</div></div>I found that the code was missing acquire fence wait in case of the<br>
DRI loader (droid_get_buffers_parse_attac<wbr>hments()). Would you be able<br>
to add the following chunk and check if the wallpaper is still broken?<br>
<br>
diff --git a/src/egl/drivers/dri2/platfor<wbr>m_android.c<br>
b/src/egl/drivers/dri2/platfor<wbr>m_android.c<br>
index 35aba3a7f0..dc29cc24b2 100644<br>
--- a/src/egl/drivers/dri2/platfor<wbr>m_android.c<br>
+++ b/src/egl/drivers/dri2/platfor<wbr>m_android.c<br>
@@ -917,6 +917,10 @@ droid_get_buffers_parse_attach<wbr>ments(struct<br>
dri2_egl_surface *dri2_surf,<br>
if (!dri2_surf->buffer)<br>
continue;<br>
<br>
+ /* Android might have given us an acquire fence to wait for. If so,<br>
+ * we need to wait for it and close the descriptor after that. */<br>
+ wait_and_close_acquire_fence(d<wbr>ri2_surf);<br>
+<br>
buf->attachment = attachments[i];<br>
buf->name = get_native_buffer_name(dri2_su<wbr>rf->buffer);<br>
buf->cpp = get_format_bpp(dri2_surf->buff<wbr>er->format);<br>
<br>
<br>
Best regards,<br>
Tomasz<br>
</blockquote></div><br></div></div></div><div class="gmail_extra">With this change applied the wallpaper is still black</div><span class="HOEnZb"><font color="#888888"><div class="gmail_extra">Mauro</div></font></span></div></blockquote><div><br></div><div>Is there some debug strategy or some ad hoc line of code I could apply to help assess the problem?</div><div><br></div><div>Or some apitrace/other tracing tool (like Android Studio's one in conjuction with some app) I could use to find the root cause of the issue?</div><div><br></div><div>Or some set of images to set as wallpaper I could try to use to assess if the problem is due to FourCC issue or to wallpaper size?</div><div><br></div><div>Thanks</div><div><br></div><div>Mauro</div></div><br></div></div>