Revert "egl: Allow creation of per surface out fence"
This reverts commit 13c23b19d0
.
Mesa CI was brought down by this commit, with:
mesa/drivers/dri/i965/brw_sync.c:491: brw_dri_create_fence_fd:
Assertion `brw->screen->has_exec_fence' failed.
This commit is contained in:
parent
783f2b70c0
commit
8c9df0daf2
|
@ -1388,45 +1388,6 @@ dri2_destroy_context(_EGLDriver *drv, _EGLDisplay *disp, _EGLContext *ctx)
|
||||||
return EGL_TRUE;
|
return EGL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
EGLBoolean
|
|
||||||
dri2_init_surface(_EGLSurface *surf, _EGLDisplay *dpy, EGLint type,
|
|
||||||
_EGLConfig *conf, const EGLint *attrib_list, EGLBoolean enable_out_fence)
|
|
||||||
{
|
|
||||||
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf);
|
|
||||||
struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy);
|
|
||||||
|
|
||||||
dri2_surf->out_fence_fd = -1;
|
|
||||||
dri2_surf->enable_out_fence = false;
|
|
||||||
if (dri2_dpy->fence && dri2_dpy->fence->base.version >= 2 &&
|
|
||||||
dri2_dpy->fence->get_capabilities &&
|
|
||||||
(dri2_dpy->fence->get_capabilities(dri2_dpy->dri_screen) &
|
|
||||||
__DRI_FENCE_CAP_NATIVE_FD)) {
|
|
||||||
dri2_surf->enable_out_fence = enable_out_fence;
|
|
||||||
}
|
|
||||||
|
|
||||||
return _eglInitSurface(surf, dpy, type, conf, attrib_list);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
dri2_surface_set_out_fence_fd( _EGLSurface *surf, int fence_fd)
|
|
||||||
{
|
|
||||||
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf);
|
|
||||||
|
|
||||||
if (dri2_surf->out_fence_fd >=0)
|
|
||||||
close(dri2_surf->out_fence_fd);
|
|
||||||
|
|
||||||
dri2_surf->out_fence_fd = fence_fd;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
dri2_fini_surface(_EGLSurface *surf)
|
|
||||||
{
|
|
||||||
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf);
|
|
||||||
|
|
||||||
dri2_surface_set_out_fence_fd(surf, -1);
|
|
||||||
dri2_surf->enable_out_fence = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
static EGLBoolean
|
static EGLBoolean
|
||||||
dri2_destroy_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf)
|
dri2_destroy_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf)
|
||||||
{
|
{
|
||||||
|
@ -1438,28 +1399,6 @@ dri2_destroy_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf)
|
||||||
return dri2_dpy->vtbl->destroy_surface(drv, dpy, surf);
|
return dri2_dpy->vtbl->destroy_surface(drv, dpy, surf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
dri2_surf_update_fence_fd(_EGLContext *ctx,
|
|
||||||
_EGLDisplay *dpy, _EGLSurface *surf)
|
|
||||||
{
|
|
||||||
__DRIcontext *dri_ctx = dri2_egl_context(ctx)->dri_context;
|
|
||||||
struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy);
|
|
||||||
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf);
|
|
||||||
int fence_fd = -1;
|
|
||||||
void *fence;
|
|
||||||
|
|
||||||
if (!dri2_surf->enable_out_fence)
|
|
||||||
return;
|
|
||||||
|
|
||||||
fence = dri2_dpy->fence->create_fence_fd(dri_ctx, -1);
|
|
||||||
if (fence) {
|
|
||||||
fence_fd = dri2_dpy->fence->get_fence_fd(dri2_dpy->dri_screen,
|
|
||||||
fence);
|
|
||||||
dri2_dpy->fence->destroy_fence(dri2_dpy->dri_screen, fence);
|
|
||||||
}
|
|
||||||
dri2_surface_set_out_fence_fd(surf, fence_fd);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called via eglMakeCurrent(), drv->API.MakeCurrent().
|
* Called via eglMakeCurrent(), drv->API.MakeCurrent().
|
||||||
*/
|
*/
|
||||||
|
@ -1496,8 +1435,6 @@ dri2_make_current(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *dsurf,
|
||||||
|
|
||||||
if (old_ctx) {
|
if (old_ctx) {
|
||||||
__DRIcontext *old_cctx = dri2_egl_context(old_ctx)->dri_context;
|
__DRIcontext *old_cctx = dri2_egl_context(old_ctx)->dri_context;
|
||||||
if (old_dsurf)
|
|
||||||
dri2_surf_update_fence_fd(old_ctx, disp, old_dsurf);
|
|
||||||
dri2_dpy->core->unbindContext(old_cctx);
|
dri2_dpy->core->unbindContext(old_cctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1636,10 +1573,6 @@ static EGLBoolean
|
||||||
dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf)
|
dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf)
|
||||||
{
|
{
|
||||||
struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy);
|
struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy);
|
||||||
_EGLContext *ctx = _eglGetCurrentContext();
|
|
||||||
|
|
||||||
if (ctx && surf)
|
|
||||||
dri2_surf_update_fence_fd(ctx, dpy, surf);
|
|
||||||
return dri2_dpy->vtbl->swap_buffers(drv, dpy, surf);
|
return dri2_dpy->vtbl->swap_buffers(drv, dpy, surf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1649,10 +1582,6 @@ dri2_swap_buffers_with_damage(_EGLDriver *drv, _EGLDisplay *dpy,
|
||||||
const EGLint *rects, EGLint n_rects)
|
const EGLint *rects, EGLint n_rects)
|
||||||
{
|
{
|
||||||
struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy);
|
struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy);
|
||||||
_EGLContext *ctx = _eglGetCurrentContext();
|
|
||||||
|
|
||||||
if (ctx && surf)
|
|
||||||
dri2_surf_update_fence_fd(ctx, dpy, surf);
|
|
||||||
return dri2_dpy->vtbl->swap_buffers_with_damage(drv, dpy, surf,
|
return dri2_dpy->vtbl->swap_buffers_with_damage(drv, dpy, surf,
|
||||||
rects, n_rects);
|
rects, n_rects);
|
||||||
}
|
}
|
||||||
|
|
|
@ -327,8 +327,6 @@ struct dri2_egl_surface
|
||||||
__DRIimage *front;
|
__DRIimage *front;
|
||||||
unsigned int visual;
|
unsigned int visual;
|
||||||
#endif
|
#endif
|
||||||
int out_fence_fd;
|
|
||||||
EGLBoolean enable_out_fence;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct dri2_egl_config
|
struct dri2_egl_config
|
||||||
|
@ -464,11 +462,4 @@ dri2_egl_surface_alloc_local_buffer(struct dri2_egl_surface *dri2_surf,
|
||||||
void
|
void
|
||||||
dri2_egl_surface_free_local_buffers(struct dri2_egl_surface *dri2_surf);
|
dri2_egl_surface_free_local_buffers(struct dri2_egl_surface *dri2_surf);
|
||||||
|
|
||||||
EGLBoolean
|
|
||||||
dri2_init_surface(_EGLSurface *surf, _EGLDisplay *dpy, EGLint type,
|
|
||||||
_EGLConfig *conf, const EGLint *attrib_list, EGLBoolean enable_out_fence);
|
|
||||||
|
|
||||||
void
|
|
||||||
dri2_fini_surface(_EGLSurface *surf);
|
|
||||||
|
|
||||||
#endif /* EGL_DRI2_INCLUDED */
|
#endif /* EGL_DRI2_INCLUDED */
|
||||||
|
|
|
@ -229,18 +229,19 @@ droid_window_enqueue_buffer(_EGLDisplay *disp, struct dri2_egl_surface *dri2_sur
|
||||||
*/
|
*/
|
||||||
mtx_unlock(&disp->Mutex);
|
mtx_unlock(&disp->Mutex);
|
||||||
|
|
||||||
/* Queue the buffer with stored out fence fd. The ANativeWindow or buffer
|
/* Queue the buffer without a sync fence. This informs the ANativeWindow
|
||||||
* consumer may choose to wait for the fence to signal before accessing
|
* that it may access the buffer immediately.
|
||||||
* it. If fence fd value is -1, buffer can be accessed by consumer
|
|
||||||
* immediately. Consumer or application shouldn't rely on timestamp
|
|
||||||
* associated with fence if the fence fd is -1.
|
|
||||||
*
|
*
|
||||||
* Ownership of fd is transferred to consumer after queueBuffer and the
|
* From ANativeWindow::dequeueBuffer:
|
||||||
* consumer is responsible for closing it. Caller must not use the fd
|
*
|
||||||
* after passing it to queueBuffer.
|
* The fenceFd argument specifies a libsync fence file descriptor for
|
||||||
|
* a fence that must signal before the buffer can be accessed. If
|
||||||
|
* the buffer can be accessed immediately then a value of -1 should
|
||||||
|
* be used. The caller must not use the file descriptor after it
|
||||||
|
* is passed to queueBuffer, and the ANativeWindow implementation
|
||||||
|
* is responsible for closing it.
|
||||||
*/
|
*/
|
||||||
int fence_fd = dri2_surf->out_fence_fd;
|
int fence_fd = -1;
|
||||||
dri2_surf->out_fence_fd = -1;
|
|
||||||
dri2_surf->window->queueBuffer(dri2_surf->window, dri2_surf->buffer,
|
dri2_surf->window->queueBuffer(dri2_surf->window, dri2_surf->buffer,
|
||||||
fence_fd);
|
fence_fd);
|
||||||
|
|
||||||
|
@ -262,11 +263,8 @@ static void
|
||||||
droid_window_cancel_buffer(struct dri2_egl_surface *dri2_surf)
|
droid_window_cancel_buffer(struct dri2_egl_surface *dri2_surf)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
int fence_fd = dri2_surf->out_fence_fd;
|
|
||||||
|
|
||||||
dri2_surf->out_fence_fd = -1;
|
ret = dri2_surf->window->cancelBuffer(dri2_surf->window, dri2_surf->buffer, -1);
|
||||||
ret = dri2_surf->window->cancelBuffer(dri2_surf->window,
|
|
||||||
dri2_surf->buffer, fence_fd);
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
_eglLog(_EGL_WARNING, "ANativeWindow::cancelBuffer failed");
|
_eglLog(_EGL_WARNING, "ANativeWindow::cancelBuffer failed");
|
||||||
dri2_surf->base.Lost = EGL_TRUE;
|
dri2_surf->base.Lost = EGL_TRUE;
|
||||||
|
@ -291,7 +289,7 @@ droid_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dri2_init_surface(&dri2_surf->base, disp, type, conf, attrib_list, true))
|
if (!_eglInitSurface(&dri2_surf->base, disp, type, conf, attrib_list))
|
||||||
goto cleanup_surface;
|
goto cleanup_surface;
|
||||||
|
|
||||||
if (type == EGL_WINDOW_BIT) {
|
if (type == EGL_WINDOW_BIT) {
|
||||||
|
@ -391,7 +389,6 @@ droid_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
|
||||||
|
|
||||||
dri2_dpy->core->destroyDrawable(dri2_surf->dri_drawable);
|
dri2_dpy->core->destroyDrawable(dri2_surf->dri_drawable);
|
||||||
|
|
||||||
dri2_fini_surface(surf);
|
|
||||||
free(dri2_surf);
|
free(dri2_surf);
|
||||||
|
|
||||||
return EGL_TRUE;
|
return EGL_TRUE;
|
||||||
|
|
|
@ -110,7 +110,7 @@ dri2_drm_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dri2_init_surface(&dri2_surf->base, disp, EGL_WINDOW_BIT, conf, attrib_list, false))
|
if (!_eglInitSurface(&dri2_surf->base, disp, EGL_WINDOW_BIT, conf, attrib_list))
|
||||||
goto cleanup_surf;
|
goto cleanup_surf;
|
||||||
|
|
||||||
surf = gbm_dri_surface(surface);
|
surf = gbm_dri_surface(surface);
|
||||||
|
@ -178,7 +178,6 @@ dri2_drm_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
|
||||||
|
|
||||||
dri2_egl_surface_free_local_buffers(dri2_surf);
|
dri2_egl_surface_free_local_buffers(dri2_surf);
|
||||||
|
|
||||||
dri2_fini_surface(surf);
|
|
||||||
free(surf);
|
free(surf);
|
||||||
|
|
||||||
return EGL_TRUE;
|
return EGL_TRUE;
|
||||||
|
|
|
@ -124,7 +124,7 @@ dri2_surfaceless_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dri2_init_surface(&dri2_surf->base, disp, type, conf, attrib_list, false))
|
if (!_eglInitSurface(&dri2_surf->base, disp, type, conf, attrib_list))
|
||||||
goto cleanup_surface;
|
goto cleanup_surface;
|
||||||
|
|
||||||
config = dri2_get_dri_config(dri2_conf, type,
|
config = dri2_get_dri_config(dri2_conf, type,
|
||||||
|
@ -165,7 +165,6 @@ surfaceless_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *sur
|
||||||
|
|
||||||
dri2_dpy->core->destroyDrawable(dri2_surf->dri_drawable);
|
dri2_dpy->core->destroyDrawable(dri2_surf->dri_drawable);
|
||||||
|
|
||||||
dri2_fini_surface(surf);
|
|
||||||
free(dri2_surf);
|
free(dri2_surf);
|
||||||
return EGL_TRUE;
|
return EGL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,7 +142,7 @@ dri2_wl_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dri2_init_surface(&dri2_surf->base, disp, EGL_WINDOW_BIT, conf, attrib_list, false))
|
if (!_eglInitSurface(&dri2_surf->base, disp, EGL_WINDOW_BIT, conf, attrib_list))
|
||||||
goto cleanup_surf;
|
goto cleanup_surf;
|
||||||
|
|
||||||
if (dri2_dpy->wl_dmabuf || dri2_dpy->wl_drm) {
|
if (dri2_dpy->wl_dmabuf || dri2_dpy->wl_drm) {
|
||||||
|
@ -295,7 +295,6 @@ dri2_wl_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
|
||||||
wl_proxy_wrapper_destroy(dri2_surf->wl_drm_wrapper);
|
wl_proxy_wrapper_destroy(dri2_surf->wl_drm_wrapper);
|
||||||
wl_event_queue_destroy(dri2_surf->wl_queue);
|
wl_event_queue_destroy(dri2_surf->wl_queue);
|
||||||
|
|
||||||
dri2_fini_surface(surf);
|
|
||||||
free(surf);
|
free(surf);
|
||||||
|
|
||||||
return EGL_TRUE;
|
return EGL_TRUE;
|
||||||
|
|
|
@ -232,7 +232,7 @@ dri2_x11_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dri2_init_surface(&dri2_surf->base, disp, type, conf, attrib_list, false))
|
if (!_eglInitSurface(&dri2_surf->base, disp, type, conf, attrib_list))
|
||||||
goto cleanup_surf;
|
goto cleanup_surf;
|
||||||
|
|
||||||
dri2_surf->region = XCB_NONE;
|
dri2_surf->region = XCB_NONE;
|
||||||
|
@ -394,7 +394,6 @@ dri2_x11_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
|
||||||
if (surf->Type == EGL_PBUFFER_BIT)
|
if (surf->Type == EGL_PBUFFER_BIT)
|
||||||
xcb_free_pixmap (dri2_dpy->conn, dri2_surf->drawable);
|
xcb_free_pixmap (dri2_dpy->conn, dri2_surf->drawable);
|
||||||
|
|
||||||
dri2_fini_surface(surf);
|
|
||||||
free(surf);
|
free(surf);
|
||||||
|
|
||||||
return EGL_TRUE;
|
return EGL_TRUE;
|
||||||
|
|
|
@ -101,7 +101,6 @@ dri3_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
|
||||||
|
|
||||||
loader_dri3_drawable_fini(&dri3_surf->loader_drawable);
|
loader_dri3_drawable_fini(&dri3_surf->loader_drawable);
|
||||||
|
|
||||||
dri2_fini_surface(surf);
|
|
||||||
free(surf);
|
free(surf);
|
||||||
|
|
||||||
return EGL_TRUE;
|
return EGL_TRUE;
|
||||||
|
@ -138,7 +137,7 @@ dri3_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dri2_init_surface(&dri3_surf->base, disp, type, conf, attrib_list, false))
|
if (!_eglInitSurface(&dri3_surf->base, disp, type, conf, attrib_list))
|
||||||
goto cleanup_surf;
|
goto cleanup_surf;
|
||||||
|
|
||||||
if (type == EGL_PBUFFER_BIT) {
|
if (type == EGL_PBUFFER_BIT) {
|
||||||
|
|
Loading…
Reference in New Issue