Skip to contentSkip to conversation

libdrm: gralloc_handle.h: Fix build issue with Android

RFC PATCH In review John Stultz 2 participants 2 messages Mar 6, 2018 – Mar 7, 2018

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 libdrm: gralloc_handle.h: Fix build issue with Android

In trying to integrate the new gralloc_handle.h with the drm_hwcomposer, I started seeing the following compilation errors:

In file included from external/drm_hwcomposer/platformdrmgeneric.cpp:28:
external/libdrm/android/gralloc_handle.h:108:9: error: cannot initialize return object of type 'native_handle_t *' (aka 'native_handle *') with an lvalue of type 'struct gralloc_handle_t *'

        return handle;
               ^~~~~~

1 error generated.

This seems to be due to the gralloc_handle_create() definition claiming to return a native_handle_t * type, rather then a gralloc_handle_t *, which is what the code actually returns.

This function isn't actually used in the current drm_hwcomposer, so I'm not totally sure that this fix is correct (rather then returning the gralloc_handle_t's embadedded native_handle_t ptr).

But it seems something like this is needed.

Cc Robert Foss <[email protected]>
Cc Rob Herring <[email protected]>
---
 android/gralloc_handle.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
android/gralloc_handle.h +1 -2
index 9cb5a5d..6e925c9 100644
@@ -84,7 +84,7 @@ static inline struct gralloc_handle_t *gralloc_handle(buffer_handle_t handle)
 /**
  * Create a buffer handle.
  */
-static inline native_handle_t *gralloc_handle_create(int32_t width,
+static inline gralloc_handle_t *gralloc_handle_create(int32_t width,
                                                      int32_t height,
                                                      int32_t hal_format,
                                                      int32_t usage)
@@ -107,5 +107,4 @@ static inline native_handle_t *gralloc_handle_create(int32_t width,
 
 	return handle;
 }
-
 #endif
Signature · 6 lines
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

Hey John,

Yeah, the return type should be changed.

robher: Do you have any preferences?

Rob.

Quoted 42 lines · John Stultz

In trying to integrate the new gralloc_handle.h with the drm_hwcomposer, I started seeing the following compilation errors:

In file included from external/drm_hwcomposer/platformdrmgeneric.cpp:28:
external/libdrm/android/gralloc_handle.h:108:9: error: cannot initialize return object of type 'native_handle_t *' (aka 'native_handle *') with an lvalue of type 'struct gralloc_handle_t *'

         return handle;
                ^~~~~~

1 error generated.

This seems to be due to the gralloc_handle_create() definition claiming to return a native_handle_t * type, rather then a gralloc_handle_t *, which is what the code actually returns.

This function isn't actually used in the current drm_hwcomposer, so I'm not totally sure that this fix is correct (rather then returning the gralloc_handle_t's embadedded native_handle_t ptr).

But it seems something like this is needed.

Cc Robert Foss <[email protected]>
Cc Rob Herring <[email protected]>
---
  android/gralloc_handle.h | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
android/gralloc_handle.h +1 -1
index 9cb5a5d..6e925c9 100644
@@ -84,7 +84,7 @@ static inline struct gralloc_handle_t *gralloc_handle(buffer_handle_t handle)
  /**
   * Create a buffer handle.
   */
-static inline native_handle_t *gralloc_handle_create(int32_t width,
+static inline gralloc_handle_t *gralloc_handle_create(int32_t width,
                                                       int32_t height,
                                                       int32_t hal_format,
                                                       int32_t usage)

android/gralloc_handle.h static inline native_handle_t *gralloc_handle_create(int32_t width, · line 110

Quoted 5 lines
android/gralloc_handle.h +0 -1
@@ -107,5 +107,4 @@ static inline native_handle_t *gralloc_handle_create(int32_t width,
 
  	return handle;
  }
-
  #endif

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel