diff mbox

[RFC] drm_hwcomposer: Rework platformdrmgeneric.cpp to use libdrm's gralloc handle

Message ID 1521236915-21187-1-git-send-email-john.stultz@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

John Stultz March 16, 2018, 9:48 p.m. UTC
Rework the platformdrmgeneric buffer importer to use the libdrm
generic gralloc handle definition.

This is just to get the drm_hwcomposer project building in AOSP
along with the libdrm freedesktop/master branch. Similar changes
may also be needed to gbm_gralloc and other projects not used
in AOSP.

Mostly just sending this out for review feedback.

Cc: Robert Foss <robert.foss@collabora.com>
Cc: Rob Herring <rob.herring@linaro.org>
Cc: Sean Paul <seanpaul@google.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
 Android.mk             |  2 +-
 platformdrmgeneric.cpp | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

Comments

Stefan Schake March 18, 2018, 1:30 a.m. UTC | #1
Hey John,

On Fri, Mar 16, 2018 at 10:48 PM, John Stultz <john.stultz@linaro.org> wrote:
>  LOCAL_C_INCLUDES := \
> -       external/drm_gralloc \
> +       external/libdrm/android \
>         system/core/libsync

This shouldn't be necessary if libdrm correctly exports its headers, but
it seems that it only did for the static variant of the library. I've sent
a patch to fix that, then the explicit path here can be dropped.

Thanks,
Stefan
John Stultz March 19, 2018, 8:46 a.m. UTC | #2
On Sun, Mar 18, 2018 at 9:30 AM, Stefan Schake <stschake@gmail.com> wrote:
> Hey John,
>
> On Fri, Mar 16, 2018 at 10:48 PM, John Stultz <john.stultz@linaro.org> wrote:
>>  LOCAL_C_INCLUDES := \
>> -       external/drm_gralloc \
>> +       external/libdrm/android \
>>         system/core/libsync
>
> This shouldn't be necessary if libdrm correctly exports its headers, but
> it seems that it only did for the static variant of the library. I've sent
> a patch to fix that, then the explicit path here can be dropped.

Sounds good.  I've reworked my patch stack to include your change to
libdrm and dropped this bit from this patch.

thanks
-john
diff mbox

Patch

diff --git a/Android.mk b/Android.mk
index 1add286..383de1c 100644
--- a/Android.mk
+++ b/Android.mk
@@ -47,7 +47,7 @@  LOCAL_SHARED_LIBRARIES := \
 LOCAL_STATIC_LIBRARIES := libdrmhwc_utils
 
 LOCAL_C_INCLUDES := \
-	external/drm_gralloc \
+	external/libdrm/android \
 	system/core/libsync
 
 LOCAL_SRC_FILES := \
diff --git a/platformdrmgeneric.cpp b/platformdrmgeneric.cpp
index 741d42b..2a6773c 100644
--- a/platformdrmgeneric.cpp
+++ b/platformdrmgeneric.cpp
@@ -25,7 +25,7 @@ 
 #include <xf86drmMode.h>
 
 #include <cutils/log.h>
-#include <gralloc_drm_handle.h>
+#include <gralloc_handle.h>
 #include <hardware/gralloc.h>
 #include <EGL/eglext.h>
 
@@ -85,23 +85,23 @@  uint32_t DrmGenericImporter::ConvertHalFormatToDrm(uint32_t hal_format) {
 }
 
 EGLImageKHR DrmGenericImporter::ImportImage(EGLDisplay egl_display, buffer_handle_t handle) {
-  gralloc_drm_handle_t *gr_handle = gralloc_drm_handle(handle);
+  gralloc_handle_t *gr_handle = gralloc_handle(handle);
   if (!gr_handle)
     return NULL;
   EGLint attr[] = {
-    EGL_WIDTH, gr_handle->width,
-    EGL_HEIGHT, gr_handle->height,
+    EGL_WIDTH, (EGLint)gr_handle->width,
+    EGL_HEIGHT, (EGLint)gr_handle->height,
     EGL_LINUX_DRM_FOURCC_EXT, (EGLint)ConvertHalFormatToDrm(gr_handle->format),
     EGL_DMA_BUF_PLANE0_FD_EXT, gr_handle->prime_fd,
     EGL_DMA_BUF_PLANE0_OFFSET_EXT, 0,
-    EGL_DMA_BUF_PLANE0_PITCH_EXT, gr_handle->stride,
+    EGL_DMA_BUF_PLANE0_PITCH_EXT, (EGLint)gr_handle->stride,
     EGL_NONE,
   };
   return eglCreateImageKHR(egl_display, EGL_NO_CONTEXT, EGL_LINUX_DMA_BUF_EXT, NULL, attr);
 }
 
 int DrmGenericImporter::ImportBuffer(buffer_handle_t handle, hwc_drm_bo_t *bo) {
-  gralloc_drm_handle_t *gr_handle = gralloc_drm_handle(handle);
+  gralloc_handle_t *gr_handle = gralloc_handle(handle);
   if (!gr_handle)
     return -EINVAL;