diff options
author | Fei Jiang <fei.jiang@intel.com> | 2011-12-19 04:55:04 +0800 |
---|---|---|
committer | Patrick Tjin <pattjin@google.com> | 2014-07-21 22:05:58 -0700 |
commit | fa6f2e9012a890942a47eae9f6f1a0ddcd97e9a4 (patch) | |
tree | 1b5e55750ea1ee86fa243d851f644ba709b2301b /src/psb_surface.c | |
parent | 5e116884381ae450b82c3d7e6c6372214e03ae29 (diff) | |
download | psb_video-fa6f2e9012a890942a47eae9f6f1a0ddcd97e9a4.tar.gz |
video: enable ICS graphic buffer decoding and rendering.
BZ: 18370
This patch enabled to use external buffer for video decoding, will wrap a gralloc buffer to TTM buffer.
Change-Id: I06c5746c22b94c46fb0e7194c554c9d798743ff5
Reviewed-on: http://android.intel.com:8080/28068
Reviewed-by: Yuan, Shengquan <shengquan.yuan@intel.com>
Reviewed-by: Ding, Haitao <haitao.ding@intel.com>
Tested-by: Ding, Haitao <haitao.ding@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
Diffstat (limited to 'src/psb_surface.c')
-rw-r--r-- | src/psb_surface.c | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/src/psb_surface.c b/src/psb_surface.c index e8f0073..6c936ff 100644 --- a/src/psb_surface.c +++ b/src/psb_surface.c @@ -44,7 +44,7 @@ VAStatus psb_surface_create(psb_driver_data_p driver_data, int ret = 0; if (fourcc == VA_FOURCC_NV12) { - if ((width <= 0) || (width > 5120) || (height <= 0) || (height > 5120)) { + if ((width <= 0) || (width * height > 5120 * 5120) || (height <= 0)) { return VA_STATUS_ERROR_ALLOCATION_FAILED; } @@ -104,6 +104,59 @@ VAStatus psb_surface_create(psb_driver_data_p driver_data, return ret ? VA_STATUS_ERROR_ALLOCATION_FAILED : VA_STATUS_SUCCESS; } +/* + * Create surface + */ +VAStatus psb_surface_create_from_ub(psb_driver_data_p driver_data, + int width, int height, int fourcc, VAExternalMemoryBuffers *graphic_buffers, + psb_surface_p psb_surface, /* out */ + void *vaddr + ) +{ + int ret = 0; + + if (fourcc == VA_FOURCC_NV12) { + if ((width <= 0) || (width * height > 5120 * 5120) || (height <= 0)) { + return VA_STATUS_ERROR_ALLOCATION_FAILED; + } + + if (0) { + ; + } else if (512 >= width) { + psb_surface->stride_mode = STRIDE_512; + psb_surface->stride = 512; + } else if (1024 >= width) { + psb_surface->stride_mode = STRIDE_1024; + psb_surface->stride = 1024; + } else if (1280 >= width) { + psb_surface->stride_mode = STRIDE_1280; + psb_surface->stride = 1280; + } else if (2048 >= width) { + psb_surface->stride_mode = STRIDE_2048; + psb_surface->stride = 2048; + } else if (4096 >= width) { + psb_surface->stride_mode = STRIDE_4096; + psb_surface->stride = 4096; + } else { + psb_surface->stride_mode = STRIDE_NA; + psb_surface->stride = (width + 0x1f) & ~0x1f; + } + if (psb_surface->stride != graphic_buffers->luma_stride) { + return VA_STATUS_ERROR_ALLOCATION_FAILED; + } + + psb_surface->luma_offset = 0; + psb_surface->chroma_offset = psb_surface->stride * height; + psb_surface->size = (psb_surface->stride * height * 3) / 2; + psb_surface->extra_info[4] = VA_FOURCC_NV12; + } else { + return VA_STATUS_ERROR_ALLOCATION_FAILED; + } + + ret = psb_buffer_create_from_ub(driver_data, psb_surface->size, psb_bt_surface, &psb_surface->buf, vaddr); + + return ret ? VA_STATUS_ERROR_ALLOCATION_FAILED : VA_STATUS_SUCCESS; +} VAStatus psb_surface_create_for_userptr( psb_driver_data_p driver_data, |