Mesa (18.2): egl/android: fix regression in drm_gralloc path (v2)
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Aug 22 14:04:32 UTC 2018
Module: Mesa
Branch: 18.2
Commit: b1e0876a6b87f96f3721410b735bfef6aa961dcf
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b1e0876a6b87f96f3721410b735bfef6aa961dcf
Author: Mauro Rossi <issor.oruam at gmail.com>
Date: Tue Aug 14 15:10:54 2018 +0200
egl/android: fix regression in drm_gralloc path (v2)
This patch fixes a regression in mesa 18.2 and mesa-dev branches
for HAVE_DRM_GRALLOC code path which is causing black screen on Android
and prevents boot due to SIGSEGV MAPERR crash related to unproper handling
of drm_gralloc drm FD in new droid_open_device() path.
Problem is due to c7bb82136b ("egl/android: Add DRM node probing and filtering")
To avoid the crash the former existing working droid_open_device() is restored,
renamed droid_open_device_drm_gralloc() and kept within HAVE_DRM_GRALLOC braces.
Tested with mesa-dev and mesa 18.2 branch and oreo-x86 bootanimation
and Androdi GUI booting is fixed with i965, nouveau, radeon.
The changes are compatible with gbm_gralloc, I've tested build with hwc too.
(v2) remove indentation from HAVE_DRM_GRALLOC pre-processor directive
NOTE: Definition of enum{} for GRALLOC_MODULE_PERFORM_GET_DRM_FD
is not necessary and it's actually causing a redefinition building error,
because in HAVE_DRM_GRALLOC path gralloc_drm.h is already exported
by libgralloc_drm which is currently still a dependency.
Fixes: c7bb82136b ("egl/android: Add DRM node probing and filtering")
Cc: "18.2" <mesa-stable at lists.freedesktop.org>
Signed-off-by: Mauro Rossi <issor.oruam at gmail.com>
(cherry picked from commit 73b342c7a52a93d283799800824311639f372de0)
---
src/egl/drivers/dri2/platform_android.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
index cc16fd8118..ac4fc56bd7 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -1134,6 +1134,25 @@ droid_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *dpy)
return (config_count != 0);
}
+#ifdef HAVE_DRM_GRALLOC
+static int
+droid_open_device_drm_gralloc(struct dri2_egl_display *dri2_dpy)
+{
+ int fd = -1, err = -EINVAL;
+
+ if (dri2_dpy->gralloc->perform)
+ err = dri2_dpy->gralloc->perform(dri2_dpy->gralloc,
+ GRALLOC_MODULE_PERFORM_GET_DRM_FD,
+ &fd);
+ if (err || fd < 0) {
+ _eglLog(_EGL_WARNING, "fail to get drm fd");
+ fd = -1;
+ }
+
+ return (fd >= 0) ? fcntl(fd, F_DUPFD_CLOEXEC, 3) : -1;
+}
+#endif /* HAVE_DRM_GRALLOC */
+
static const struct dri2_egl_display_vtbl droid_display_vtbl = {
.authenticate = NULL,
.create_window_surface = droid_create_window_surface,
@@ -1384,7 +1403,11 @@ dri2_initialize_android(_EGLDriver *drv, _EGLDisplay *disp)
disp->DriverData = (void *) dri2_dpy;
+#ifdef HAVE_DRM_GRALLOC
+ dri2_dpy->fd = droid_open_device_drm_gralloc(dri2_dpy);
+#else
dri2_dpy->fd = droid_open_device(disp);
+#endif
if (dri2_dpy->fd < 0) {
err = "DRI2: failed to open device";
goto cleanup;
More information about the mesa-commit
mailing list