Skip to contentSkip to conversation

libdrm: gralloc_handle.h: Fix build issue with Android

PATCH In review John Stultz 2 participants 3 messages Apr 3, 2018

lore
Share & tools
lore
#0 lore raw

PATCH v2 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 needs to return a native_handle_t * type, rather then a gralloc_handle_t *, which is what the code actually returns.

After talking w/ Rob Herring, having the code return the native handle should be the proper fix, so that is what this patch changes.

Cc Chih-Wei Huang <[email protected]>
Cc Stefan Schake <[email protected]>
Cc Robert Foss <[email protected]>
Cc Sean Paul <[email protected]>
Cc Rob Herring <[email protected]>

---
v2: Change fix to return nhandle instead of changing the
function definition

---
 android/gralloc_handle.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
android/gralloc_handle.h +1 -1
index 9cb5a5d..bcf753d 100644
@@ -105,7 +105,7 @@ static inline native_handle_t *gralloc_handle_create(int32_t width,
 	handle->usage = usage;
 	handle->prime_fd = -1;
 
-	return handle;
+	return nhandle;
 }
 
 #endif
Signature · 6 lines
2.7.4

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

Hey John,

This looks good to me, feel free to add my:

Quoted 37 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 needs to return a native_handle_t * type, rather then a gralloc_handle_t *, which is what the code actually returns.

After talking w/ Rob Herring, having the code return the native handle should be the proper fix, so that is what this patch changes.

Cc Chih-Wei Huang <[email protected]>
Cc Stefan Schake <[email protected]>
Cc Robert Foss <[email protected]>
Cc Sean Paul <[email protected]>
Cc Rob Herring <[email protected]>

---
v2: Change fix to return nhandle instead of changing the
function definition

---
  android/gralloc_handle.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
android/gralloc_handle.h +0 -0
index 9cb5a5d..bcf753d 100644

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

Quoted 8 lines
android/gralloc_handle.h +1 -1
@@ -105,7 +105,7 @@ static inline native_handle_t *gralloc_handle_create(int32_t width,
  	handle->usage = usage;
  	handle->prime_fd = -1;
 
-	return handle;
+	return nhandle;
  }
 
  #endif

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

#2 lore raw

Hey again,

Actually, I might as well just push this fix.
Pushed!

Rob.

Quoted 37 lines · Robert Foss

Hey John,

This looks good to me, feel free to add my:

Quoted 31 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 needs to return a native_handle_t * type, rather then a gralloc_handle_t *, which is what the code actually returns.

After talking w/ Rob Herring, having the code return the native handle should be the proper fix, so that is what this patch changes.

Cc Chih-Wei Huang <[email protected]>
Cc Stefan Schake <[email protected]>
Cc Robert Foss <[email protected]>
Cc Sean Paul <[email protected]>
Cc Rob Herring <[email protected]>

---
v2: Change fix to return nhandle instead of changing the function definition
---
  android/gralloc_handle.h | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines

android/gralloc_handle.h static inline native_handle_t · line 111

Quoted 13 lines
android/gralloc_handle.h +1 -1
index 9cb5a5d..bcf753d 100644
@@ -105,7 +105,7 @@ static inline native_handle_t 
 *gralloc_handle_create(int32_t width,
       handle->usage = usage;
       handle->prime_fd = -1;
-    return handle;
+    return nhandle;
   }
   #endif
 

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