summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Figa <tfiga@chromium.org>2016-08-02 20:07:55 +0900
committerSumit Semwal <sumit.semwal@linaro.org>2018-04-20 21:58:28 +0530
commit8a463f7ca0dda84ce34ddb0a31087134653e4b3d (patch)
treec632ee0b7f6121298ccc22937e441d9c682dd560
parent367bafc7c153611b39bb41145a9601e5f1cb4934 (diff)
FROMLIST: egl/android: Make drm_gralloc headers optional (v2)
Make the code at least compile when being built without drm_gralloc headers. v2: Replaced #ifdefs with stubs for gralloc_drm_get_gem_handle() and GRALLOC_MODULE_PERFORM_GET_DRM_FD. Removed explicit render node probing code. Signed-off-by: Tomasz Figa <tfiga@chromium.org> (am from https://patchwork.freedesktop.org/patch/102547/) BUG=b:29036398 TEST=No significant regressions in dEQP inside the container Test: No significant regressions in dEQP inside the container Change-Id: Id7b5087aaeb001cdcd6f384e7543da3aa6956ea6 (cherry picked from commit a038dd14dba799fa228b7781085b61e0605da8c2) Reviewed-on: https://chromium-review.googlesource.com/367206 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> Commit-Queue: Tomasz Figa <tfiga@chromium.org> Tested-by: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
-rw-r--r--src/egl/Android.mk1
-rw-r--r--src/egl/drivers/dri2/egl_dri2.h2
-rw-r--r--src/egl/drivers/dri2/platform_android.c2
-rw-r--r--src/egl/drivers/dri2/platform_android_gralloc_drm.h41
4 files changed, 44 insertions, 2 deletions
diff --git a/src/egl/Android.mk b/src/egl/Android.mk
index bfd56a744df..72ec02a23d6 100644
--- a/src/egl/Android.mk
+++ b/src/egl/Android.mk
@@ -41,6 +41,7 @@ LOCAL_SRC_FILES := \
LOCAL_CFLAGS := \
-D_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_ANDROID \
-D_EGL_BUILT_IN_DRIVER_DRI2 \
+ -DHAS_GRALLOC_DRM_HEADERS \
-DHAVE_ANDROID_PLATFORM
LOCAL_C_INCLUDES := \
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index f3437e2b5a2..1b351f544dd 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -64,8 +64,8 @@
# include <ui/android_native_buffer.h>
#endif
+#include "platform_android_gralloc_drm.h"
#include <hardware/gralloc.h>
-#include <gralloc_drm_handle.h>
#include <cutils/log.h>
#endif /* HAVE_ANDROID_PLATFORM */
diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
index 511b696192a..bb2482d2ebb 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -40,7 +40,7 @@
#include "loader.h"
#include "egl_dri2.h"
#include "egl_dri2_fallbacks.h"
-#include "gralloc_drm.h"
+#include "platform_android_gralloc_drm.h"
#define ALIGN(val, align) (((val) + (align) - 1) & ~((align) - 1))
diff --git a/src/egl/drivers/dri2/platform_android_gralloc_drm.h b/src/egl/drivers/dri2/platform_android_gralloc_drm.h
new file mode 100644
index 00000000000..6757d1ba628
--- /dev/null
+++ b/src/egl/drivers/dri2/platform_android_gralloc_drm.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2016 Google Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#pragma once
+
+#ifdef HAS_GRALLOC_DRM_HEADERS
+
+#include <gralloc_drm.h>
+#include <gralloc_drm_handle.h>
+
+#else
+
+#define GRALLOC_MODULE_PERFORM_GET_DRM_FD 0x0FD4DEAD
+
+static inline int gralloc_drm_get_gem_handle(buffer_handle_t handle)
+{
+ return 0; /* Not supported, return invalid handle. */
+}
+
+#endif