Guys, can you please try these patches? They should fix it for gallium
drivers (not i965).

Marek

On Fri, Sep 25, 2015 at 10:35 PM, Marek Olšák <mar...@gmail.com> wrote:
> On Fri, Sep 25, 2015 at 5:43 PM, Chih-Wei Huang <cwhu...@android-x86.org> 
> wrote:
>> CC to mesa-dev for help.
>>
>> 2015-09-25 22:12 GMT+08:00 Chih-Wei Huang <cwhu...@android-x86.org>:
>>> 2015-09-25 16:21 GMT+08:00 Chih-Wei Huang <cwhu...@android-x86.org>:
>>>> Actually I'm testing your mesa 11.0 branch
>>>> to see if it is acceptable.
>>>> The major issue I found is the
>>>> Camera and Youtube crashing in mesa.
>>>
>>> OK, I can almost confirm this is a known issue
>>> I reported to mesa devs before.
>>> It is caused by this commit:
>>>
>>> commit c636284ee8ee95bb3f3ad31aaf26a9512ec5006c
>>> Author: Chad Versace <chad.vers...@intel.com>
>>> Date:   Tue May 5 19:05:32 2015 -0700
>>>
>>>     i965/sync: Implement DRI2_Fence extension
>>>
>>> By reverting it the crashing is gone.
>>>
>>> However, I still hope we can find
>>> a correct fix.
>>
>> After some debugging, it crashed in
>> dri2_client_wait_sync() of
>> ...src/egl/drivers/dri2/egl_dri2.c
>> The ctx returned by _eglGetCurrentContext()
>> is NULL.
>>
>> static EGLint
>> dri2_client_wait_sync(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync,
>>                       EGLint flags, EGLTime timeout)
>> {
>>    _EGLContext *ctx = _eglGetCurrentContext();
>>
>> ==> ctx is NULL
>>
>>    if (dri2_dpy->fence->client_wait_sync(dri2_ctx->dri_context,  <== OOPS!
>>                                          dri2_sync->fence, wait_flags,
>>                                          timeout))
>>
>>
>> Why does _eglGetCurrentContext() return NULL?
>
> Yes, we should fix this. A context isn't required here.
>
> Marek
From 2b758a97d3d0751696c85c456530e5dfc26f0476 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= <marek.ol...@amd.com>
Date: Fri, 25 Sep 2015 22:44:41 +0200
Subject: [PATCH 1/2] st/dri: don't use _ctx in client_wait_sync

Not needed and it can be NULL.

Cc: 10.6 11.0 <mesa-sta...@lists.freedesktop.org>
---
 src/gallium/state_trackers/dri/dri2.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c
index 91b4431..ab940e4 100644
--- a/src/gallium/state_trackers/dri/dri2.c
+++ b/src/gallium/state_trackers/dri/dri2.c
@@ -1293,6 +1293,7 @@ dri2_load_opencl_interop(struct dri_screen *screen)
 }
 
 struct dri2_fence {
+   struct dri_screen *driscreen;
    struct pipe_fence_handle *pipe_fence;
    void *cl_event;
 };
@@ -1313,6 +1314,7 @@ dri2_create_fence(__DRIcontext *_ctx)
       return NULL;
    }
 
+   fence->driscreen = dri_screen(_ctx->driScreenPriv);
    return fence;
 }
 
@@ -1360,9 +1362,9 @@ static GLboolean
 dri2_client_wait_sync(__DRIcontext *_ctx, void *_fence, unsigned flags,
                       uint64_t timeout)
 {
-   struct dri_screen *driscreen = dri_screen(_ctx->driScreenPriv);
-   struct pipe_screen *screen = driscreen->base.screen;
    struct dri2_fence *fence = (struct dri2_fence*)_fence;
+   struct dri_screen *driscreen = fence->driscreen;
+   struct pipe_screen *screen = driscreen->base.screen;
 
    /* No need to flush. The context was flushed when the fence was created. */
 
-- 
2.1.4

From 3dcd0dff251ff61660eee61c7f8d8260d6ad01c0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= <marek.ol...@amd.com>
Date: Fri, 25 Sep 2015 22:48:00 +0200
Subject: [PATCH 2/2] egl/dri2: don't require a context for ClientWaitSync

Cc: 10.6 11.0 <mesa-sta...@lists.freedesktop.org>
---
 src/egl/drivers/dri2/egl_dri2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 1740ee3..7d8977e 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -2430,7 +2430,7 @@ dri2_client_wait_sync(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync,
    /* the sync object should take a reference while waiting */
    dri2_egl_ref_sync(dri2_sync);
 
-   if (dri2_dpy->fence->client_wait_sync(dri2_ctx->dri_context,
+   if (dri2_dpy->fence->client_wait_sync(dri2_ctx ? dri2_ctx->dri_context : NULL,
                                          dri2_sync->fence, wait_flags,
                                          timeout))
       dri2_sync->base.SyncStatus = EGL_SIGNALED_KHR;
-- 
2.1.4

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to