Commit message (Collapse)AuthorAgeFilesLines
* libdrm: gralloc_handle.h: Fix build issue with AndroidJohn Stultz2018-04-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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> Reviewed-by: Robert Foss <robert.foss@collabora.com>
* android: fix gralloc_handle_create() problemsRob Herring2018-02-201-18/+16
| | | | | | | | | | | | | | | | | There's a number of problems with gralloc_handle_create starting with it doesn't even compile. More importantly, it doesn't really create (i.e. allocate) a handle. It allocates a native_handle_t, copies it to a struct gralloc_handle_t on the stack and returns the struct (not a ptr). So the caller still has to allocate a struct gralloc_handle_t to hold the returned struct. Rework gralloc_handle_create() to allocate a new handle and return the pointer to the allocated handle. Callers should free the handle with native_handle_close() and native_handle_delete(). In the interest of making gralloc_handle_t opaque, return a native_handle_t ptr instead. Reviewed-by: Robert Foss <robert.foss@collabora.com> Signed-off-by: Rob Herring <robh@kernel.org>
* android: add helper to convert buffer_handle_t to gralloc_handle_t ptrRob Herring2018-02-201-0/+5
| | | | | | | | | Clients frequently need to convert a buffer_handle_t (aka native_handle_t *) to a gralloc_handle_t ptr. This is a simple cast, but add an inline function to do the conversion. Reviewed-by: Robert Foss <robert.foss@collabora.com> Signed-off-by: Rob Herring <robh@kernel.org>
* android: fix mis-named alloc_handle_tRob Herring2018-02-201-1/+1
| | | | | | | | | Fix a typo where alloc_handle_t should be gralloc_handle_t. One still remains in gralloc_handle_create, but a subsequent commit will fix that along with other problems in gralloc_handle_create. Reviewed-by: Robert Foss <robert.foss@collabora.com> Signed-off-by: Rob Herring <robh@kernel.org>
* android: revert making handle magic and version members constRob Herring2018-02-201-2/+2
| | | | | | | | Const members are problematic for dynamically allocating struct gralloc_handle_t, so just drop the const modifier. Reviewed-by: Robert Foss <robert.foss@collabora.com> Signed-off-by: Rob Herring <robh@kernel.org>
* android: Change gralloc_handle_t members to be fixed widthRobert Foss2018-02-141-9/+11
| | | | | | | | | | | In order to lessen future alignment issues, lets switch to fixed width integers where possible. This excludes the data_owner since it is a pid_t which in theory could be larger than 32 bits. Signed-off-by: Robert Foss <robert.foss@collabora.com> Reviewed-by: Rob Herring <robh@kernel.org>
* android: Remove member name from gralloc_handle_tRobert Foss2018-02-141-2/+1
| | | | | | | | The name member of gralloc_handle_t is no longer needed and has been removed. The version field has also been bumped. Signed-off-by: Robert Foss <robert.foss@collabora.com> Reviewed-by: Rob Herring <robh@kernel.org>
* android: Mark gralloc_handle_t magic variable as constRobert Foss2018-02-141-1/+1
| | | | | | | Mark magic member of gralloc_handle_t as const. Signed-off-by: Robert Foss <robert.foss@collabora.com> Reviewed-by: Rob Herring <robh@kernel.org>
* android: Add version variable to gralloc_handle_tRobert Foss2018-02-141-1/+7
| | | | | | | | The version variable will be used for versioning of this struct and the corresponding accessor functions. Signed-off-by: Robert Foss <robert.foss@collabora.com> Reviewed-by: Rob Herring <robh@kernel.org>
* android: Move gralloc handle struct to libdrmRobert Foss2018-02-141-0/+101
This struct is used in mesa and drm_hwcomposer. Versions of if have been implemented in several grallocs: drm_gralloc, gbm_gralloc, minigbm and intel-minigbm. Other than the 1:1 move of the struct a new generic name has been chosen and variables have had comments added to them. Signed-off-by: Robert Foss <robert.foss@collabora.com> Reviewed-by: Rob Herring <robh@kernel.org>