egl/android: check PIPE_CAP_NATIVE_FENCE_FD directly

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30472>
This commit is contained in:
Mike Blumenkrantz
2024-07-29 10:01:55 -04:00
committed by Marge Bot
parent d86f39e7cf
commit c38b9aba0e
3 changed files with 5 additions and 2 deletions

View File

@@ -729,6 +729,9 @@ dri2_setup_screen(_EGLDisplay *disp)
dri2_dpy->has_modifiers = has_modifiers && util_bitcount(caps) == 2;
dri2_dpy->has_dmabuf_import = has_modifiers && caps & DRM_PRIME_CAP_IMPORT;
#endif
#ifdef HAVE_ANDROID_PLATFORM
dri2_dpy->has_native_fence_fd = get_screen_param(disp, PIPE_CAP_NATIVE_FENCE_FD);
#endif
/*
* EGL 1.5 specification defines the default value to 1. Moreover,

View File

@@ -317,6 +317,7 @@ struct dri2_egl_display {
struct u_gralloc *gralloc;
/* gralloc vendor usage bit for front rendering */
uint32_t front_rendering_usage;
bool has_native_fence_fd;
#endif
};

View File

@@ -123,8 +123,7 @@ handle_in_fence_fd(struct dri2_egl_surface *dri2_surf, __DRIimage *img)
validate_fence_fd(dri2_surf->in_fence_fd);
if (dri2_dpy->image->base.version >= 21 &&
dri2_dpy->image->setInFenceFd != NULL) {
if (dri2_dpy->has_native_fence_fd) {
dri2_set_in_fence_fd(img, dri2_surf->in_fence_fd);
} else {
sync_wait(dri2_surf->in_fence_fd, -1);