diff mbox series

[v2] libdrm: gralloc_handle.h: Fix build issue with Android

Message ID 1522726653-19248-1-git-send-email-john.stultz@linaro.org
State New
Headers show
Series [v2] libdrm: gralloc_handle.h: Fix build issue with Android | expand

Commit Message

John Stultz April 3, 2018, 3:37 a.m. UTC
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 <cwhuang@android-x86.org>
Cc: Stefan Schake <stschake@gmail.com>
Cc: Robert Foss <robert.foss@collabora.com>
Cc: Sean Paul <seanpaul@google.com>
Cc: Rob Herring <robh@kernel.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>

---
v2: Change fix to return nhandle instead of changing the
    function definition
---
 android/gralloc_handle.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.7.4

Comments

Robert Foss April 3, 2018, 8:18 a.m. UTC | #1
Hey John,

This looks good to me, feel free to add my:
Reviewed-by: Robert Foss <robert.foss@collabora.com>

On 04/03/2018 05:37 AM, John Stultz wrote:
> 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 <cwhuang@android-x86.org>
> Cc: Stefan Schake <stschake@gmail.com>
> Cc: Robert Foss <robert.foss@collabora.com>
> Cc: Sean Paul <seanpaul@google.com>
> Cc: Rob Herring <robh@kernel.org>
> Signed-off-by: John Stultz <john.stultz@linaro.org>
> ---
> v2: Change fix to return nhandle instead of changing the
>      function definition
> ---
>   android/gralloc_handle.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/android/gralloc_handle.h b/android/gralloc_handle.h
> index 9cb5a5d..bcf753d 100644
> --- a/android/gralloc_handle.h
> +++ b/android/gralloc_handle.h
> @@ -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
>
Robert Foss April 3, 2018, 8:21 a.m. UTC | #2
Hey again,

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


Rob.

On 04/03/2018 10:18 AM, Robert Foss wrote:
> Hey John,
> 
> This looks good to me, feel free to add my:
> Reviewed-by: Robert Foss <robert.foss@collabora.com>
> 
> On 04/03/2018 05:37 AM, John Stultz wrote:
>> 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 <cwhuang@android-x86.org>
>> Cc: Stefan Schake <stschake@gmail.com>
>> Cc: Robert Foss <robert.foss@collabora.com>
>> Cc: Sean Paul <seanpaul@google.com>
>> Cc: Rob Herring <robh@kernel.org>
>> Signed-off-by: John Stultz <john.stultz@linaro.org>
>> ---
>> v2: Change fix to return nhandle instead of changing the
>>      function definition
>> ---
>>   android/gralloc_handle.h | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/android/gralloc_handle.h b/android/gralloc_handle.h
>> index 9cb5a5d..bcf753d 100644
>> --- a/android/gralloc_handle.h
>> +++ b/android/gralloc_handle.h
>> @@ -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
>>
diff mbox series

Patch

diff --git a/android/gralloc_handle.h b/android/gralloc_handle.h
index 9cb5a5d..bcf753d 100644
--- a/android/gralloc_handle.h
+++ b/android/gralloc_handle.h
@@ -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