diff options
author | Vinil Cheeramvelil <vinil.cheeramvelil@intel.com> | 2015-06-02 15:23:47 -0700 |
---|---|---|
committer | Pat Tjin <pattjin@google.com> | 2015-06-16 23:09:16 +0000 |
commit | bacdfbde97131d12c92bf832ce9d7db6de4598d8 (patch) | |
tree | 2ed48442493398b2683fccffaacea049a78d3d70 | |
parent | 97499e0e66f97479df3f50345616e324f9ad3644 (diff) | |
download | android_hardware_intel_img_hwcomposer-bacdfbde97131d12c92bf832ce9d7db6de4598d8.tar.gz android_hardware_intel_img_hwcomposer-bacdfbde97131d12c92bf832ce9d7db6de4598d8.tar.bz2 android_hardware_intel_img_hwcomposer-bacdfbde97131d12c92bf832ce9d7db6de4598d8.zip |
IMG DDK1.5 HWC update: replace broken Intel HWC interface
Bug: 20914944
Bug: 20302101
Bug: 19412176
Bug: 21265944
Change-Id: I346848e040bf869d9e84016c05dd136f1cee397b
Signed-off-by: Pradeep Radhakrishna <pradeep.radhakrishna@intel.com>
-rw-r--r-- | moorefield_hdmi/Android.mk | 6 | ||||
-rw-r--r-- | moorefield_hdmi/include/pvr/hal/hal_public.h | 274 | ||||
-rw-r--r-- | moorefield_hdmi/include/pvr/hal/img_gralloc_public.h | 302 | ||||
-rwxr-xr-x | moorefield_hdmi/ips/tangier/TngDisplayContext.cpp | 3 | ||||
-rwxr-xr-x | moorefield_hdmi/ips/tangier/TngDisplayContext.h | 14 | ||||
-rw-r--r-- | moorefield_hdmi/ips/tangier/TngGrallocBufferMapper.cpp | 35 | ||||
-rw-r--r-- | moorefield_hdmi/ips/tangier/TngGrallocBufferMapper.h | 2 | ||||
-rwxr-xr-x | moorefield_hdmi/platforms/merrifield_plus/PlatfBufferManager.cpp | 10 |
8 files changed, 376 insertions, 270 deletions
diff --git a/moorefield_hdmi/Android.mk b/moorefield_hdmi/Android.mk index 1670d5c..2d70051 100644 --- a/moorefield_hdmi/Android.mk +++ b/moorefield_hdmi/Android.mk @@ -100,8 +100,10 @@ ifeq ($(TARGET_SUPPORT_HDMI_PRIMARY),true) LOCAL_CFLAGS += -DINTEL_SUPPORT_HDMI_PRIMARY endif -LOCAL_COPY_HEADERS:=include/pvr/hal/hal_public.h -LOCAL_COPY_HEADERS_TO:=pvr/hal +LOCAL_COPY_HEADERS := \ + include/pvr/hal/hal_public.h \ + include/pvr/hal/img_gralloc_public.h +LOCAL_COPY_HEADERS_TO := pvr/hal include $(BUILD_SHARED_LIBRARY) diff --git a/moorefield_hdmi/include/pvr/hal/hal_public.h b/moorefield_hdmi/include/pvr/hal/hal_public.h index 6de4a9b..5575719 100644 --- a/moorefield_hdmi/include/pvr/hal/hal_public.h +++ b/moorefield_hdmi/include/pvr/hal/hal_public.h @@ -21,262 +21,38 @@ * THE SOFTWARE. */ -#ifndef HAL_PUBLIC_H -#define HAL_PUBLIC_H - -/* Authors of third party hardware composer (HWC) modules will need to include - * this header to access functionality in the gralloc HAL. - */ +#ifndef __HAL_PUBLIC_H +#define __HAL_PUBLIC_H #define PVR_ANDROID_NATIVE_WINDOW_HAS_SYNC -//#define SUPPORT_ANDROID_MEMTRACK_HAL - -#include <hardware/gralloc.h> -#include <hardware/hwcomposer.h> - -#define ALIGN(x,a) (((x) + (a) - 1L) & ~((a) - 1L)) -#define HW_ALIGN 32 -#define CAMERA_ALIGN 64 - -/** YV12 specific (to handle different alignment) ****************************/ - -/* We must align YV12 to a multiple of 32bytes as NEON optimizations - * in stagefright require the YV12 planes to be 128bit aligned. - * while display controller requires 64 bytes alignement - */ -#define YV12_ALIGN 128 - -#define HAL_PIXEL_FORMAT_BGRX_8888 0x101 // Keep consistent with android_utils.h -enum { - HAL_PIXEL_FORMAT_NV12 = 0x3231564E, // YCrCb 4:2:0 SP - HAL_PIXEL_FORMAT_NV21 = 0x3132564E, // YCrCb 4:2:0 SP - HAL_PIXEL_FORMAT_I420 = 0x30323449, - HAL_PIXEL_FORMAT_YUY2 = 0x32595559, - HAL_PIXEL_FORMAT_UYVY = 0x59565955, - // Intel video decode formats - HAL_PIXEL_FORMAT_NV12_VED = 0x7FA00E00, //OMX_INTEL_COLOR_FormatYUV420PackedSemiPlanar - HAL_PIXEL_FORMAT_NV12_VEDT = 0x7FA00F00, //OMX_INTEL_COLOR_FormatYUV420PackedSemiPlanar_Tiled +#include "img_gralloc_public.h" - HAL_PIXEL_FORMAT_YCbCr_422_P = 0x12, // IYUV - HAL_PIXEL_FORMAT_YCbCr_420_P = 0x13, // YUV9 - HAL_PIXEL_FORMAT_YCbCr_420_I = 0x15, +#undef HAL_PIXEL_FORMAT_NV12 - HAL_PIXEL_FORMAT_INTEL_UYVY = 0x107, - HAL_PIXEL_FORMAT_YCbCr_420_SP = 0x108, - HAL_PIXEL_FORMAT_ZSL = 0x109, -}; - -/* This can be tuned down as appropriate for the SOC. - * - * IMG formats are usually a single sub-alloc. - * Some OEM video formats are two sub-allocs (Y, UV planes). - * Future OEM video formats might be three sub-allocs (Y, U, V planes). - */ -#define MAX_SUB_ALLOCS 3 - - -/* This defines the maximum server sync objects used per allocation. */ - -/* Note: It's unfortunate that we have to change the handle size dependent - * on a build option, but we have no choice because 'fd' fields must all - * be utilized so they are valid to be dup'ed, and we don't need some of - * the extra fds in a native_fence_sync build. - */ -#if defined(PVR_ANDROID_NATIVE_WINDOW_HAS_SYNC) -#define MAX_SRV_SYNC_OBJS 2 -#else -#define MAX_SRV_SYNC_OBJS 4 -#endif - -typedef struct -{ - native_handle_t base; - - /* These fields can be sent cross process. They are also valid - * to duplicate within the same process. - * - * A table is stored within psPrivateData on gralloc_module_t (this - * is obviously per-process) which maps stamps to a mapped - * PVRSRV_MEMDESC in that process. Each map entry has a lock - * count associated with it, satisfying the requirements of the - * Android API. This also prevents us from leaking maps/allocations. - * - * This table has entries inserted either by alloc() - * (alloc_device_t) or map() (gralloc_module_t). Entries are removed - * by free() (alloc_device_t) and unmap() (gralloc_module_t). - */ - -#define IMG_NATIVE_HANDLE_NUMFDS (MAX_SRV_SYNC_OBJS + MAX_SUB_ALLOCS) - /* The `syncfd' field is used to export PVRSRV_CLIENT_SYNC_PRIM to - * another process. Its producer/consumer rules should match the - * PVRSRV_MEMDESC handles, except that there is only one sync - * per N memdesc objects. - * - * This should be listed before `fd' because it is not variable - * width. The problem with variable width is that in the case we - * export framebuffer allocations, we may want to patch some of - * the fds to (unused) ints, so we can't leave gaps. - */ - int aiSyncFD[MAX_SRV_SYNC_OBJS]; - - /* The `fd' field is used to "export" a meminfo to another process. - * Therefore, it is allocated by alloc_device_t, and consumed by - * gralloc_module_t. - */ - int fd[MAX_SUB_ALLOCS]; - -#define IMG_NATIVE_HANDLE_NUMINTS ((sizeof(unsigned long long) / sizeof(int)) + 5) - /* A KERNEL unique identifier for any exported kernel meminfo. Each - * exported kernel meminfo will have a unique stamp, but note that in - * userspace, several meminfos across multiple processes could have - * the same stamp. As the native_handle can be dup(2)'d, there could be - * multiple handles with the same stamp but different file descriptors. - */ - unsigned long long ui64Stamp; - - /* This is used for buffer usage validation when locking a buffer, - * and also in WSEGL (for the composition bypass feature). - */ - int usage; - - /* In order to do efficient cache flushes we need the buffer dimensions - * and format. These are available on the ANativeWindowBuffer, - * but the platform doesn't pass them down to the graphics HAL. - * - * These fields are also used in the composition bypass. In this - * capacity, these are the "real" values for the backing allocation. - */ - int iWidth; - int iHeight; - int iFormat; - unsigned int uiBpp; -} -__attribute__((aligned(sizeof(int)),packed)) IMG_native_handle_t; - -typedef struct +typedef struct _IMG_gralloc_module_ { - int l, t, w, h; + IMG_gralloc_module_public_t base; + void *(*GetDisplayDevice)(struct _IMG_gralloc_module_ *psGrallocModule); + int (*GetDisplayStatus)(struct _IMG_gralloc_module_ *psGrallocModule, + buffer_handle_t handle, uint32_t *pui32Status); + int (*GetBufferCPUAddresses)(gralloc_module_t const* module, + buffer_handle_t buffer, + void **ppvCpuVirtAddr, size_t *puSize); + int (*PutBufferCPUAddresses)(gralloc_module_t const* module, + buffer_handle_t buffer); } -IMG_write_lock_rect_t; - -/* Keep this in sync with SGX */ -typedef int (*IMG_buffer_format_compute_params_pfn)( - unsigned int uiPlane, int *piWidth, int *piHeight, int *piStride, - int *piVStride, unsigned long *pulPlaneOffset); - -#define IMG_BFF_YUV (1 << 0) -#define IMG_BFF_UVCbCrORDERING (1 << 1) -#define IMG_BFF_CPU_CLEAR (1 << 2) -#define IMG_BFF_DONT_GPU_CLEAR (1 << 3) -#define IMG_BFF_PARTIAL_ALLOC (1 << 4) -#define IMG_BFF_NEVER_COMPRESS (1 << 5) - -/* Keep this in sync with SGX */ -typedef struct IMG_buffer_format_public_t -{ - /* Buffer formats are returned as a linked list */ - struct IMG_buffer_format_public_t *psNext; +IMG_gralloc_module_t; - /* HAL_PIXEL_FORMAT_... enumerant */ - int iHalPixelFormat; +#define HAL_PIXEL_FORMAT_UYVY 0x107 +#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 - /* IMG_PIXFMT_... enumerant */ - int iIMGPixelFormat; - - /* Friendly name for format */ - const char *const szName; - - /* Bits (not bytes) per pixel */ - unsigned int uiBpp; - - /* Supported HW usage bits. If this is GRALLOC_USAGE_HW_MASK, all usages - * are supported. Used for HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED. - */ - int iSupportedUsage; - - /* Allocation description flags */ - unsigned int uiFlags; - - /* Utility function for adjusting YUV per-plane parameters */ - IMG_buffer_format_compute_params_pfn pfnComputeParams; -} -IMG_buffer_format_public_t; - -#if defined(SUPPORT_ANDROID_MEMTRACK_HAL) - -#include <hardware/memtrack.h> - -typedef struct -{ - /* Base memtrack record, copied to caller */ - struct memtrack_record base; - - /* Record type, for filtering cached records */ - enum memtrack_type eType; - - /* Process ID, for filtering cached records */ - pid_t pid; -} -IMG_memtrack_record_public_t; - -#endif /* defined(SUPPORT_ANDROID_MEMTRACK_HAL) */ - -typedef struct -{ - /* The original hwc layer */ - hwc_layer_1_t *psLayer; - - /* Custom data for the display engine */ - uint32_t custom; -} -IMG_hwc_layer_t; - -typedef struct IMG_display_device_public_t { - int (*post)(struct IMG_display_device_public_t *dev, IMG_hwc_layer_t *layers, - int num_layers, int *releaseFenceFd); -} IMG_display_device_public_t; - -typedef struct IMG_gralloc_module_public_t -{ - gralloc_module_t base; - IMG_display_device_public_t *psDisplayDevice; - - /* Gets the head of the linked list of all registered formats */ - const IMG_buffer_format_public_t *(*GetBufferFormats)(void); - - /* Functionality before this point should be in sync with SGX. - * After this point will be different. - */ - - /* Custom-blit components in lieu of overlay hardware */ - int (*Blit)(struct IMG_gralloc_module_public_t const *module, - buffer_handle_t src, buffer_handle_t dest, - int w, int h, int x, int y, - int transform, - int async); - - int (*Blit3)(struct IMG_gralloc_module_public_t const *module, - unsigned long long ui64SrcStamp, int iSrcWidth, - int iSrcHeight, int iSrcFormat, int eSrcRotation, - buffer_handle_t dest, int eDestRotation); - -#if defined(SUPPORT_ANDROID_MEMTRACK_HAL) - int (*GetMemTrackRecords)(struct IMG_gralloc_module_public_t const *module, - IMG_memtrack_record_public_t **ppsRecords, - size_t *puNumRecords); -#endif /* defined(SUPPORT_ANDROID_MEMTRACK_HAL) */ - - /* Walk the above list and return only the specified format */ - const IMG_buffer_format_public_t *(*GetBufferFormat)(int iFormat); -/* intel hwc extension */ - int (*getCpuAddress)(struct IMG_gralloc_module_public_t const *module, - buffer_handle_t handle, - void **virt, uint32_t *size); - int (*putCpuAddress)(struct IMG_gralloc_module_public_t const *module, - buffer_handle_t handle); - IMG_display_device_public_t *(*getDisplayDevice)(struct IMG_gralloc_module_public_t *module); -} -IMG_gralloc_module_public_t; +#define GRALLOC_MODULE_GET_DISPLAY_STATUS_IMG 1001 -#endif /* HAL_PUBLIC_H */ +#endif /* __HAL_PUBLIC_H */ diff --git a/moorefield_hdmi/include/pvr/hal/img_gralloc_public.h b/moorefield_hdmi/include/pvr/hal/img_gralloc_public.h new file mode 100644 index 0000000..1b6ca50 --- /dev/null +++ b/moorefield_hdmi/include/pvr/hal/img_gralloc_public.h @@ -0,0 +1,302 @@ +/* Copyright (c) Imagination Technologies Ltd. + * + * The contents of this file are subject to the MIT license as set out below. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef HAL_PUBLIC_H +#define HAL_PUBLIC_H + +/* Authors of third party hardware composer (HWC) modules will need to include + * this header to access functionality in the gralloc HAL. + */ + +#include <hardware/gralloc.h> + +#define ALIGN(x,a) (((x) + (a) - 1L) & ~((a) - 1L)) +#define HW_ALIGN 32 + +/* Use bits [0-3] of "vendor format" bits as real format. Customers should + * use *only* the unassigned bits below for custom pixel formats, YUV or RGB. + * + * If there are no bits set in this part of the field, or other bits are set + * in the format outside of the "vendor format" mask, the non-extension format + * is used instead. Reserve 0 for this purpose. + */ + +#define HAL_PIXEL_FORMAT_VENDOR_EXT(fmt) (0x100 | (fmt & 0xF)) + +/* Reserved ** DO NOT USE ** HAL_PIXEL_FORMAT_VENDOR_EXT(0) */ +#define HAL_PIXEL_FORMAT_BGRX_8888 HAL_PIXEL_FORMAT_VENDOR_EXT(1) +#define HAL_PIXEL_FORMAT_sBGR_A_8888 HAL_PIXEL_FORMAT_VENDOR_EXT(2) +#define HAL_PIXEL_FORMAT_sBGR_X_8888 HAL_PIXEL_FORMAT_VENDOR_EXT(3) +/* HAL_PIXEL_FORMAT_RGB_565 HAL_PIXEL_FORMAT_VENDOR_EXT(4) */ +/* HAL_PIXEL_FORMAT_BGRA_8888 HAL_PIXEL_FORMAT_VENDOR_EXT(5) */ +#define HAL_PIXEL_FORMAT_NV12 HAL_PIXEL_FORMAT_VENDOR_EXT(6) +/* Free for customer use HAL_PIXEL_FORMAT_VENDOR_EXT(7) */ +/* Free for customer use HAL_PIXEL_FORMAT_VENDOR_EXT(8) */ +/* Free for customer use HAL_PIXEL_FORMAT_VENDOR_EXT(9) */ +/* Free for customer use HAL_PIXEL_FORMAT_VENDOR_EXT(10) */ +/* Free for customer use HAL_PIXEL_FORMAT_VENDOR_EXT(11) */ +/* Free for customer use HAL_PIXEL_FORMAT_VENDOR_EXT(12) */ +/* Free for customer use HAL_PIXEL_FORMAT_VENDOR_EXT(13) */ +/* Free for customer use HAL_PIXEL_FORMAT_VENDOR_EXT(14) */ +/* Free for customer use HAL_PIXEL_FORMAT_VENDOR_EXT(15) */ + +/* One of the below compression modes is OR'ed into bits [4-6] of the 8 bit + * "vendor format" field. If no bits are set in this "compression mask", the + * normal memory format for the pixel format is used. Otherwise the pixel + * data will be compressed in memory with the Rogue framebuffer compressor. + */ + +#define HAL_FB_COMPRESSION_NONE 0 +#define HAL_FB_COMPRESSION_DIRECT_8x8 1 +#define HAL_FB_COMPRESSION_DIRECT_16x4 2 +#define HAL_FB_COMPRESSION_DIRECT_32x2 3 +#define HAL_FB_COMPRESSION_INDIRECT_8x8 4 +#define HAL_FB_COMPRESSION_INDIRECT_16x4 5 +#define HAL_FB_COMPRESSION_INDIRECT_4TILE_8x8 6 +#define HAL_FB_COMPRESSION_INDIRECT_4TILE_16x4 7 + +/* The memory layout is OR'ed into bit 7 (top bit) of the 8 bit "vendor + * format" field. Only STRIDED and TWIDDLED are supported; there is no space + * for PAGETILED. + */ +#define HAL_FB_MEMLAYOUT_STRIDED 0 +#define HAL_FB_MEMLAYOUT_TWIDDLED 1 + +/* This can be tuned down as appropriate for the SOC. + * + * IMG formats are usually a single sub-alloc. + * Some OEM video formats are two sub-allocs (Y, UV planes). + * Future OEM video formats might be three sub-allocs (Y, U, V planes). + */ +#define MAX_SUB_ALLOCS (3) + +typedef struct +{ + native_handle_t base; + + /* These fields can be sent cross process. They are also valid + * to duplicate within the same process. + * + * A table is stored within psPrivateData on gralloc_module_t (this + * is obviously per-process) which maps stamps to a mapped + * PVRSRV_MEMDESC in that process. Each map entry has a lock + * count associated with it, satisfying the requirements of the + * Android API. This also prevents us from leaking maps/allocations. + * + * This table has entries inserted either by alloc() + * (alloc_device_t) or map() (gralloc_module_t). Entries are removed + * by free() (alloc_device_t) and unmap() (gralloc_module_t). + */ + +#define IMG_NATIVE_HANDLE_NUMFDS (MAX_SUB_ALLOCS) + /* The `fd' field is used to "export" a meminfo to another process. + * Therefore, it is allocated by alloc_device_t, and consumed by + * gralloc_module_t. + */ + int fd[IMG_NATIVE_HANDLE_NUMFDS]; + + /* This define should represent the number of packed 'int's required to + * represent the fields following it. If you add a data type that is + * 64-bit, for example using 'unsigned long long', you should write that + * as "sizeof(unsigned long long) / sizeof(int)". Please keep the order + * of the additions the same as the defined field order. + */ +#define IMG_NATIVE_HANDLE_NUMINTS \ + (sizeof(unsigned long long) / sizeof(int) + \ + 6 + MAX_SUB_ALLOCS + MAX_SUB_ALLOCS + \ + sizeof(unsigned long long) / sizeof(int) * MAX_SUB_ALLOCS + \ + 1) + /* A KERNEL unique identifier for any exported kernel meminfo. Each + * exported kernel meminfo will have a unique stamp, but note that in + * userspace, several meminfos across multiple processes could have + * the same stamp. As the native_handle can be dup(2)'d, there could be + * multiple handles with the same stamp but different file descriptors. + */ + unsigned long long ui64Stamp; + + /* This is used for buffer usage validation */ + int usage; + + /* In order to do efficient cache flushes we need the buffer dimensions, + * format and bits per pixel. There are ANativeWindow queries for the + * width, height and format, but the graphics HAL might have remapped the + * request to different values at allocation time. These are the 'true' + * values of the buffer allocation. + */ + int iWidth; + int iHeight; + int iFormat; + unsigned int uiBpp; + + /* Planes are not the same as the `fd' suballocs. A multi-planar YUV + * allocation has different planes (interleaved = 1, semi-planar = 2, + * fully-planar = 3) but might be spread across 1, 2 or 3 independent + * memory allocations (or not). + */ + int iPlanes; + + /* For multi-planar allocations, there will be multiple hstrides */ + int aiStride[MAX_SUB_ALLOCS]; + + /* For multi-planar allocations, there will be multiple vstrides */ + int aiVStride[MAX_SUB_ALLOCS]; + + /* These byte offsets are reconciled with the number of sub-allocs used + * for a multi-planar allocation. If there is a 1:1 mapping between the + * number of planes and the number of sub-allocs, these will all be zero. + * + * Otherwise, normally the zeroth entry will be zero, and the latter + * entries will be non-zero. + */ + unsigned long long aulPlaneOffset[MAX_SUB_ALLOCS]; + + /* This records the number of MAX_SUB_ALLOCS fds actually used by the + * buffer allocation. File descriptors up to fd[iNumSubAllocs - 1] are + * guaranteed to be valid. (This does not have any bearing on the aiStride, + * aiVStride or aulPlaneOffset fields, as `iPlanes' of those arrays should + * be initialized, not `iNumSubAllocs'.) + */ + int iNumSubAllocs; +} +__attribute__((aligned(sizeof(int)),packed)) IMG_native_handle_t; + +typedef struct +{ + int l, t, w, h; +} +IMG_write_lock_rect_t; + +#define IMG_BFF_YUV (1 << 0) +#define IMG_BFF_UVCbCrORDERING (1 << 1) +#define IMG_BFF_CPU_CLEAR (1 << 2) +#define IMG_BFF_DONT_GPU_CLEAR (1 << 3) +#define IMG_BFF_PARTIAL_ALLOC (1 << 4) +#define IMG_BFF_NEVER_COMPRESS (1 << 5) + +/* Keep this in sync with SGX */ +typedef struct IMG_buffer_format_public_t +{ + /* Buffer formats are returned as a linked list */ + struct IMG_buffer_format_public_t *psNext; + + /* HAL_PIXEL_FORMAT_... enumerant */ + int iHalPixelFormat; + + /* IMG_PIXFMT_... enumerant */ + int iIMGPixelFormat; + + /* Friendly name for format */ + const char *const szName; + + /* Bits (not bytes) per pixel */ + unsigned int uiBpp; + + /* Supported HW usage bits. If this is GRALLOC_USAGE_HW_MASK, all usages + * are supported. Used for HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED. + */ + int iSupportedUsage; + + /* Allocation description flags */ + unsigned int uiFlags; +} +IMG_buffer_format_public_t; + +/* NOTE: This interface is deprecated. Use module->perform() instead. */ +typedef struct IMG_gralloc_module_public_t +{ + gralloc_module_t base; + + /* Gets the head of the linked list of all registered formats */ + const IMG_buffer_format_public_t *(*GetBufferFormats)(void); + + /* Custom-blit components in lieu of overlay hardware */ + int (*Blit)(struct IMG_gralloc_module_public_t const *module, + buffer_handle_t src, buffer_handle_t dest, + int w, int h, int x, int y, int transform, + int iInputFenceFd, int *piOutputFenceFd); + + int (*Blit3)(struct IMG_gralloc_module_public_t const *module, + unsigned long long ui64SrcStamp, int iSrcWidth, + int iSrcHeight, int iSrcFormat, int iSrcStrideInPixels, + int eSrcRotation, buffer_handle_t dest, int eDestRotation, + int iInputFenceFd, int *piOutputFenceFd); + + /* Walk the above list and return only the specified format */ + const IMG_buffer_format_public_t *(*GetBufferFormat)(int iFormat); +} +IMG_gralloc_module_public_t; + +/* Helpers for using the non-type-safe perform() extension functions. Use + * these helpers instead of calling perform() directly in your application. + */ + +#define GRALLOC_MODULE_GET_BUFFER_FORMAT_IMG 1 +#define GRALLOC_MODULE_GET_BUFFER_FORMATS_IMG 2 +#define GRALLOC_MODULE_BLIT_HANDLE_TO_HANDLE_IMG 3 +#define GRALLOC_MODULE_BLIT_STAMP_TO_HANDLE_IMG 4 + +static inline int +gralloc_module_get_buffer_format_img(const gralloc_module_t *module, + int format, + const IMG_buffer_format_public_t **v) +{ + return module->perform(module, GRALLOC_MODULE_GET_BUFFER_FORMAT_IMG, + format, v); +} + +static inline int +gralloc_module_get_buffer_formats_img(const gralloc_module_t *module, + const IMG_buffer_format_public_t **v) +{ + return module->perform(module, GRALLOC_MODULE_GET_BUFFER_FORMATS_IMG, v); +} + +static inline int +gralloc_module_blit_handle_to_handle_img(const gralloc_module_t *module, + buffer_handle_t src, + buffer_handle_t dest, + int w, int h, int x, int y, + int transform, int input_fence, + int *output_fence) +{ + return module->perform(module, GRALLOC_MODULE_BLIT_HANDLE_TO_HANDLE_IMG, + src, dest, w, h, x, y, transform, input_fence, + output_fence); +} + +static inline int +gralloc_module_blit_stamp_to_handle(const gralloc_module_t *module, + unsigned long long src_stamp, + int src_width, int src_height, + int src_format, int src_stride_in_pixels, + int src_rotation, buffer_handle_t dest, + int dest_rotation, int input_fence, + int *output_fence) +{ + return module->perform(module, GRALLOC_MODULE_BLIT_STAMP_TO_HANDLE_IMG, + src_stamp, src_width, src_height, src_format, + src_stride_in_pixels, src_rotation, dest, + dest_rotation, input_fence, output_fence); +} + +#endif /* HAL_PUBLIC_H */ diff --git a/moorefield_hdmi/ips/tangier/TngDisplayContext.cpp b/moorefield_hdmi/ips/tangier/TngDisplayContext.cpp index f745700..285f408 100755 --- a/moorefield_hdmi/ips/tangier/TngDisplayContext.cpp +++ b/moorefield_hdmi/ips/tangier/TngDisplayContext.cpp @@ -21,7 +21,6 @@ #include <common/base/HwcLayerList.h> #include <ips/tangier/TngDisplayContext.h> - namespace android { namespace intel { @@ -51,7 +50,7 @@ bool TngDisplayContext::initialize() } // init IMG display device - mIMGDisplayDevice = (((IMG_gralloc_module_public_t *)module)->getDisplayDevice((IMG_gralloc_module_public_t *)module)); + mIMGDisplayDevice = (IMG_display_device_public_t *)(((IMG_gralloc_module_t *)module)->GetDisplayDevice((IMG_gralloc_module_t *)module)); if (!mIMGDisplayDevice) { ELOGTRACE("failed to get display device"); return false; diff --git a/moorefield_hdmi/ips/tangier/TngDisplayContext.h b/moorefield_hdmi/ips/tangier/TngDisplayContext.h index fa526d7..00bef17 100755 --- a/moorefield_hdmi/ips/tangier/TngDisplayContext.h +++ b/moorefield_hdmi/ips/tangier/TngDisplayContext.h @@ -19,6 +19,20 @@ #include <IDisplayContext.h> #include <hal_public.h> +typedef struct +{ + hwc_layer_1_t *psLayer; + uint32_t custom; +} +IMG_hwc_layer_t; + +typedef struct IMG_display_device_public +{ + int (*post)(struct IMG_display_device_public *dev, + IMG_hwc_layer_t *layers, int num_layers, int *releaseFenceFd); +} +IMG_display_device_public_t; + namespace android { namespace intel { diff --git a/moorefield_hdmi/ips/tangier/TngGrallocBufferMapper.cpp b/moorefield_hdmi/ips/tangier/TngGrallocBufferMapper.cpp index b5b103f..1495379 100644 --- a/moorefield_hdmi/ips/tangier/TngGrallocBufferMapper.cpp +++ b/moorefield_hdmi/ips/tangier/TngGrallocBufferMapper.cpp @@ -25,7 +25,7 @@ namespace intel { TngGrallocBufferMapper::TngGrallocBufferMapper(IMG_gralloc_module_public_t& module, DataBuffer& buffer) : GrallocBufferMapperBase(buffer), - mIMGGrallocModule(module), + mIMGGrallocModule(reinterpret_cast<IMG_gralloc_module_t&>(module)), mBufferObject(0) { CTRACE(); @@ -122,10 +122,11 @@ bool TngGrallocBufferMapper::map() CTRACE(); // get virtual address - err = mIMGGrallocModule.getCpuAddress(&mIMGGrallocModule, - (buffer_handle_t)mClonedHandle, - vaddr, - size); + err = mIMGGrallocModule.GetBufferCPUAddresses( + (gralloc_module_t const*)&mIMGGrallocModule, + (buffer_handle_t)mClonedHandle, + vaddr, + size); if (err) { ELOGTRACE("failed to map. err = %d", err); return false; @@ -161,8 +162,9 @@ bool TngGrallocBufferMapper::map() } } - err = mIMGGrallocModule.putCpuAddress(&mIMGGrallocModule, - (buffer_handle_t)mClonedHandle); + err = mIMGGrallocModule.PutBufferCPUAddresses( + (gralloc_module_t const*)&mIMGGrallocModule, + (buffer_handle_t)mClonedHandle); return false; } @@ -182,8 +184,9 @@ bool TngGrallocBufferMapper::unmap() mSize[i] = 0; } - err = mIMGGrallocModule.putCpuAddress(&mIMGGrallocModule, - (buffer_handle_t)mClonedHandle); + err = mIMGGrallocModule.PutBufferCPUAddresses( + (gralloc_module_t const*)&mIMGGrallocModule, + (buffer_handle_t)mClonedHandle); if (err) { ELOGTRACE("failed to unmap. err = %d", err); } @@ -236,10 +239,11 @@ uint32_t TngGrallocBufferMapper::getFbHandle(int subIndex) } // get virtual address - err = mIMGGrallocModule.getCpuAddress(&mIMGGrallocModule, - (buffer_handle_t)mClonedHandle, - vaddr, - size); + err = mIMGGrallocModule.GetBufferCPUAddresses( + (gralloc_module_t const*)&mIMGGrallocModule, + (buffer_handle_t)mClonedHandle, + vaddr, + size); if (err) { ELOGTRACE("failed to map. err = %d", err); return 0; @@ -250,8 +254,9 @@ uint32_t TngGrallocBufferMapper::getFbHandle(int subIndex) void TngGrallocBufferMapper::putFbHandle() { - int err = mIMGGrallocModule.putCpuAddress(&mIMGGrallocModule, - (buffer_handle_t)mClonedHandle); + int err = mIMGGrallocModule.PutBufferCPUAddresses( + (gralloc_module_t const*)&mIMGGrallocModule, + (buffer_handle_t)mClonedHandle); if (err) { ELOGTRACE("failed to unmap. err = %d", err); } diff --git a/moorefield_hdmi/ips/tangier/TngGrallocBufferMapper.h b/moorefield_hdmi/ips/tangier/TngGrallocBufferMapper.h index 6525c3c..e3c15a8 100644 --- a/moorefield_hdmi/ips/tangier/TngGrallocBufferMapper.h +++ b/moorefield_hdmi/ips/tangier/TngGrallocBufferMapper.h @@ -40,7 +40,7 @@ private: bool mapKhandle(); private: - IMG_gralloc_module_public_t& mIMGGrallocModule; + IMG_gralloc_module_t& mIMGGrallocModule; void* mBufferObject; native_handle_t* mClonedHandle; }; diff --git a/moorefield_hdmi/platforms/merrifield_plus/PlatfBufferManager.cpp b/moorefield_hdmi/platforms/merrifield_plus/PlatfBufferManager.cpp index 764c47b..69a30db 100755 --- a/moorefield_hdmi/platforms/merrifield_plus/PlatfBufferManager.cpp +++ b/moorefield_hdmi/platforms/merrifield_plus/PlatfBufferManager.cpp @@ -17,6 +17,7 @@ #include <platforms/merrifield_plus/PlatfBufferManager.h> #include <ips/tangier/TngGrallocBuffer.h> #include <ips/tangier/TngGrallocBufferMapper.h> +#include <sync/sync.h> namespace android { namespace intel { @@ -63,13 +64,20 @@ bool PlatfBufferManager::blitGrallocBuffer(uint32_t srcHandle, uint32_t dstHandl { IMG_gralloc_module_public_t *imgGrallocModule = (IMG_gralloc_module_public_t *) mGrallocModule; + int fenceFd; + if (imgGrallocModule->Blit(imgGrallocModule, (buffer_handle_t)srcHandle, (buffer_handle_t)dstHandle, srcCrop.w, srcCrop.h, srcCrop.x, - srcCrop.y, 0, async)) { + srcCrop.y, 0, -1, &fenceFd)) { ELOGTRACE("Blit failed"); return false; } + + if (!async) { + sync_wait(fenceFd, -1); + } + close(fenceFd); return true; } |