drm_hwcomposer: Move eglCreateImageKHR into Importer
Since NV has a "special" nonstandard way to get an EGLImage from a
handle, move this into Importer where the other NV specialness is
abstracted. For the platformdrmgeneric case, use the dmabuf EGL
Extension.
Change-Id: I5353f4c95f55174df55ba92931cdc9a9eab80dca
Signed-off-by: Robert Foss <robert.foss@collabora.com>
diff --git a/platformnv.cpp b/platformnv.cpp
index 084d4f0..4a3a957 100644
--- a/platformnv.cpp
+++ b/platformnv.cpp
@@ -28,6 +28,10 @@
#include <cutils/log.h>
#include <hardware/gralloc.h>
+#ifndef EGL_NATIVE_HANDLE_ANDROID_NVX
+#define EGL_NATIVE_HANDLE_ANDROID_NVX 0x322A
+#endif
+
namespace android {
#ifdef USE_NVIDIA_IMPORTER
@@ -68,6 +72,13 @@
return 0;
}
+
+EGLImageKHR NvImporter::ImportImage(EGLDisplay egl_display, buffer_handle_t handle) {
+ return eglCreateImageKHR(
+ egl_display, EGL_NO_CONTEXT, EGL_NATIVE_HANDLE_ANDROID_NVX,
+ (EGLClientBuffer)handle, NULL /* no attribs */);
+}
+
int NvImporter::ImportBuffer(buffer_handle_t handle, hwc_drm_bo_t *bo) {
memset(bo, 0, sizeof(hwc_drm_bo_t));
NvBuffer_t *buf = GrallocGetNvBuffer(handle);