diff options
Diffstat (limited to 'moorefield_hdmi/include/pvr/hal/hal_public.h')
-rw-r--r-- | moorefield_hdmi/include/pvr/hal/hal_public.h | 204 |
1 files changed, 185 insertions, 19 deletions
diff --git a/moorefield_hdmi/include/pvr/hal/hal_public.h b/moorefield_hdmi/include/pvr/hal/hal_public.h index 04939a0..19910c1 100644 --- a/moorefield_hdmi/include/pvr/hal/hal_public.h +++ b/moorefield_hdmi/include/pvr/hal/hal_public.h @@ -21,29 +21,195 @@ * THE SOFTWARE. */ -#ifndef __HAL_PUBLIC_H -#define __HAL_PUBLIC_H +#ifndef HAL_PUBLIC_H +#define HAL_PUBLIC_H -#define PVR_ANDROID_NATIVE_WINDOW_HAS_SYNC +#define PVR_ANDROID_HAS_SET_BUFFERS_DATASPACE +#define PVR_ANDROID_HAS_SET_BUFFERS_DATASPACE_2 -#include "img_gralloc_public.h" +#include "img_gralloc_common_public.h" -#undef HAL_PIXEL_FORMAT_NV12 +/* Extension pixel formats used by Intel components */ -#define HAL_PIXEL_FORMAT_UYVY 0x107 -#define HAL_PIXEL_FORMAT_INTEL_YV12 0x108 -#define HAL_PIXEL_FORMAT_INTEL_ZSL 0x109 -#define HAL_PIXEL_FORMAT_NV12 0x3231564E -#define HAL_PIXEL_FORMAT_NV21 0x3132564E -#define HAL_PIXEL_FORMAT_I420 0x30323449 -#define HAL_PIXEL_FORMAT_YUY2 0x32595559 -#define HAL_PIXEL_FORMAT_NV12_VED 0x7FA00E00 -#define HAL_PIXEL_FORMAT_NV12_VEDT 0x7FA00F00 +#undef HAL_PIXEL_FORMAT_NV12 -#define GRALLOC_MODULE_GET_BUFFER_CPU_ADDRESSES_IMG 108 -#define GRALLOC_MODULE_PUT_BUFFER_CPU_ADDRESSES_IMG 109 +#define HAL_PIXEL_FORMAT_UYVY 0x107 +#define HAL_PIXEL_FORMAT_INTEL_YV12 0x108 +#define HAL_PIXEL_FORMAT_INTEL_ZSL 0x109 +#define HAL_PIXEL_FORMAT_NV12 0x3231564E +#define HAL_PIXEL_FORMAT_NV21 0x3132564E +#define HAL_PIXEL_FORMAT_I420 0x30323449 +#define HAL_PIXEL_FORMAT_YUY2 0x32595559 +#define HAL_PIXEL_FORMAT_NV12_VED 0x7FA00E00 +#define HAL_PIXEL_FORMAT_NV12_VEDT 0x7FA00F00 -#define GRALLOC_MODULE_GET_DISPLAY_DEVICE_IMG 1000 -#define GRALLOC_MODULE_GET_DISPLAY_STATUS_IMG 1001 +/* Extension API used by Intel components */ -#endif /* __HAL_PUBLIC_H */ +#define GRALLOC_GET_BUFFER_CPU_ADDRESSES_IMG 108 +#define GRALLOC_PUT_BUFFER_CPU_ADDRESSES_IMG 109 + +#define GRALLOC_GET_DISPLAY_DEVICE_IMG 1000 +#define GRALLOC_GET_DISPLAY_STATUS_IMG 1001 + +#include "img_gralloc.h" +#include "img_gralloc1.h" + +typedef const gralloc_module_t gralloc0_t; +typedef gralloc1_device_t gralloc1_t; + +static inline int gralloc_is_v1_img(const hw_module_t *m) +{ + return ((m->module_api_version >> 8) & 0xff) == 1; +} + +static inline int gralloc_open_img(const hw_device_t **d) +{ + const hw_module_t *m; + int err; + + err = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &m); + if (err) + return err; + + if (gralloc_is_v1_img(m)) + return gralloc1_open(m, (gralloc1_t **)d); + else + return gralloc_open(m, (alloc_device_t **)d); +} + +static inline int gralloc_close_img(const hw_device_t *d) +{ + if (gralloc_is_v1_img(d->module)) + return gralloc1_close((gralloc1_t *)d); + else + return gralloc_close((alloc_device_t *)d); +} + +static inline int gralloc_register_img + (const hw_device_t *d, buffer_handle_t handle) +{ + if (gralloc_is_v1_img(d->module)) + return gralloc1_register_img((gralloc1_t *)d, handle); + else + return gralloc0_register_img((gralloc0_t *)d->module, handle); +} + +static inline int gralloc_unregister_img + (const hw_device_t *d, buffer_handle_t handle) +{ + if (gralloc_is_v1_img(d->module)) + return gralloc1_unregister_img((gralloc1_t *)d, handle); + else + return gralloc0_unregister_img((gralloc0_t *)d->module, handle); +} + +static inline int gralloc_device_alloc_img + (const hw_device_t *d, int w, int h, int format, int usage, + buffer_handle_t *handle, int *stride) +{ + if (gralloc_is_v1_img(d->module)) { + usage = (usage | ((usage & 0x33) << 1)) & ~0x11; + return gralloc1_device_alloc_img((gralloc1_t *)d, w, h, format, + usage, handle, stride); + } else + return gralloc0_device_alloc_img((alloc_device_t *)d, w, h, format, + usage, handle, stride); +} + +static inline int gralloc_device_free_img + (const hw_device_t *d, buffer_handle_t handle) +{ + if (gralloc_is_v1_img(d->module)) + return gralloc1_device_free_img((gralloc1_t *)d, handle); + else + return gralloc0_device_free_img((alloc_device_t *)d, handle); +} + +static inline int gralloc_lock_async_img + (const hw_device_t *d, buffer_handle_t handle, int usage, + const gralloc1_rect_t *r, void **vaddr, int acquireFence) +{ + if (gralloc_is_v1_img(d->module)) { + usage = (usage | ((usage & 0x33) << 1)) & ~0x11; + return gralloc1_lock_async_img((gralloc1_t *)d, + handle, usage, r, vaddr, acquireFence); + } else + return gralloc0_lock_async_img((gralloc0_t *)d->module, + handle, usage, r, vaddr, acquireFence); +} + +static inline int gralloc_unlock_async_img + (const hw_device_t *d, buffer_handle_t handle, int *releaseFence) +{ + if (gralloc_is_v1_img(d->module)) + return gralloc1_unlock_async_img((gralloc1_t *)d, + handle, releaseFence); + else + return gralloc0_unlock_async_img((gralloc0_t *)d->module, + handle, releaseFence); +} + +static inline int gralloc_blit_handle_to_handle_img + (const hw_device_t *d, buffer_handle_t src, buffer_handle_t dest, + int w, int h, int x, int y, int transform, int input_fence, + int *output_fence) +{ + if (gralloc_is_v1_img(d->module)) + return gralloc1_blit_handle_to_handle_img((gralloc1_t *)d, + src, dest, w, h, x, y, + transform, input_fence, + output_fence); + else + return gralloc0_blit_handle_to_handle_img((gralloc0_t *)d->module, + src, dest, w, h, x, y, + transform, input_fence, + output_fence); +} + + +static inline int gralloc_get_buffer_cpu_addresses_img + (const hw_device_t *d, buffer_handle_t handle, void **vaddrs, + size_t *sizes) +{ + if (gralloc_is_v1_img(d->module)) + return gralloc1_get_buffer_cpu_addresses_img((gralloc1_t *)d, + handle, vaddrs, sizes); + else + return gralloc0_get_buffer_cpu_addresses_img((gralloc0_t *)d->module, + handle, vaddrs, sizes); +} + +static inline int gralloc_put_buffer_cpu_addresses_img + (const hw_device_t *d, buffer_handle_t handle) +{ + if (gralloc_is_v1_img(d->module)) + return gralloc1_put_buffer_cpu_addresses_img((gralloc1_t *)d, + handle); + else + return gralloc0_put_buffer_cpu_addresses_img((gralloc0_t *)d->module, + handle); +} + +static inline int gralloc_get_display_device_img + (const hw_device_t *d, void **ppvDispDev) +{ + if (gralloc_is_v1_img(d->module)) + return gralloc1_get_display_device_img((gralloc1_t *)d, + ppvDispDev); + else + return gralloc0_get_display_device_img((gralloc0_t *)d->module, + ppvDispDev); +} + +static inline int gralloc_get_display_status_img + (const hw_device_t *d, buffer_handle_t handle, uint32_t *pui32Status) +{ + if (gralloc_is_v1_img(d->module)) + return gralloc1_get_display_status_img((gralloc1_t *)d, + handle, pui32Status); + else + return gralloc0_get_display_status_img((gralloc0_t *)d->module, + handle, pui32Status); +} + +#endif /* HAL_PUBLIC_H */ |