psb_surface_gralloc.c revision 6d37ae34fcae80f2e898b61e2506ed8e887bd16a
1f31d5416a60f83e184b0906a7ec77ba021840531hding/* 2f31d5416a60f83e184b0906a7ec77ba021840531hding * Copyright (c) 2011 Intel Corporation. All Rights Reserved. 3f31d5416a60f83e184b0906a7ec77ba021840531hding * 4f31d5416a60f83e184b0906a7ec77ba021840531hding * Permission is hereby granted, free of charge, to any person obtaining a 5f31d5416a60f83e184b0906a7ec77ba021840531hding * copy of this software and associated documentation files (the 6f31d5416a60f83e184b0906a7ec77ba021840531hding * "Software"), to deal in the Software without restriction, including 7f31d5416a60f83e184b0906a7ec77ba021840531hding * without limitation the rights to use, copy, modify, merge, publish, 8f31d5416a60f83e184b0906a7ec77ba021840531hding * distribute, sub license, and/or sell copies of the Software, and to 9f31d5416a60f83e184b0906a7ec77ba021840531hding * permit persons to whom the Software is furnished to do so, subject to 10f31d5416a60f83e184b0906a7ec77ba021840531hding * the following conditions: 11f31d5416a60f83e184b0906a7ec77ba021840531hding * 12f31d5416a60f83e184b0906a7ec77ba021840531hding * The above copyright notice and this permission notice (including the 13f31d5416a60f83e184b0906a7ec77ba021840531hding * next paragraph) shall be included in all copies or substantial portions 14f31d5416a60f83e184b0906a7ec77ba021840531hding * of the Software. 15f31d5416a60f83e184b0906a7ec77ba021840531hding * 16f31d5416a60f83e184b0906a7ec77ba021840531hding * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17f31d5416a60f83e184b0906a7ec77ba021840531hding * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18f31d5416a60f83e184b0906a7ec77ba021840531hding * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 19f31d5416a60f83e184b0906a7ec77ba021840531hding * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR 20f31d5416a60f83e184b0906a7ec77ba021840531hding * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21f31d5416a60f83e184b0906a7ec77ba021840531hding * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22f31d5416a60f83e184b0906a7ec77ba021840531hding * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23f31d5416a60f83e184b0906a7ec77ba021840531hding * 24f31d5416a60f83e184b0906a7ec77ba021840531hding */ 25f31d5416a60f83e184b0906a7ec77ba021840531hding 26f31d5416a60f83e184b0906a7ec77ba021840531hding#include <sys/mman.h> 27f31d5416a60f83e184b0906a7ec77ba021840531hding#include <va/va_tpi.h> 28f31d5416a60f83e184b0906a7ec77ba021840531hding#include "psb_drv_video.h" 29f31d5416a60f83e184b0906a7ec77ba021840531hding#include "psb_drv_debug.h" 30f31d5416a60f83e184b0906a7ec77ba021840531hding#include "psb_surface.h" 31f31d5416a60f83e184b0906a7ec77ba021840531hding 32f31d5416a60f83e184b0906a7ec77ba021840531hding#include <gralloc.h> 33f31d5416a60f83e184b0906a7ec77ba021840531hding#include "android/psb_gralloc.h" 34f31d5416a60f83e184b0906a7ec77ba021840531hding#include "android/psb_android_glue.h" 35f31d5416a60f83e184b0906a7ec77ba021840531hding 36f31d5416a60f83e184b0906a7ec77ba021840531hding#define INIT_DRIVER_DATA psb_driver_data_p driver_data = (psb_driver_data_p) ctx->pDriverData; 37f31d5416a60f83e184b0906a7ec77ba021840531hding#define CONFIG(id) ((object_config_p) object_heap_lookup( &driver_data->config_heap, id )) 38f31d5416a60f83e184b0906a7ec77ba021840531hding#define CONTEXT(id) ((object_context_p) object_heap_lookup( &driver_data->context_heap, id )) 39f31d5416a60f83e184b0906a7ec77ba021840531hding#define SURFACE(id) ((object_surface_p) object_heap_lookup( &driver_data->surface_heap, id )) 40f31d5416a60f83e184b0906a7ec77ba021840531hding#define BUFFER(id) ((object_buffer_p) object_heap_lookup( &driver_data->buffer_heap, id )) 41f31d5416a60f83e184b0906a7ec77ba021840531hding 422db64e390f8b1a9ac4cfea98d89f45ec94d11d65Jason Hu/*FIXME: include hal_public.h instead of define it here*/ 432db64e390f8b1a9ac4cfea98d89f45ec94d11d65Jason Huenum { 442db64e390f8b1a9ac4cfea98d89f45ec94d11d65Jason Hu GRALLOC_SUB_BUFFER0 = 0, 452db64e390f8b1a9ac4cfea98d89f45ec94d11d65Jason Hu GRALLOC_SUB_BUFFER1, 462db64e390f8b1a9ac4cfea98d89f45ec94d11d65Jason Hu GRALLOC_SUB_BUFFER2, 472db64e390f8b1a9ac4cfea98d89f45ec94d11d65Jason Hu GRALLOC_SUB_BUFFER_MAX, 482db64e390f8b1a9ac4cfea98d89f45ec94d11d65Jason Hu}; 49f31d5416a60f83e184b0906a7ec77ba021840531hding 50f31d5416a60f83e184b0906a7ec77ba021840531hdingVAStatus psb_DestroySurfaceGralloc(object_surface_p obj_surface) 51f31d5416a60f83e184b0906a7ec77ba021840531hding{ 522db64e390f8b1a9ac4cfea98d89f45ec94d11d65Jason Hu void *vaddr[GRALLOC_SUB_BUFFER_MAX]; 53f31d5416a60f83e184b0906a7ec77ba021840531hding int usage = GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_HW_COMPOSER; 54f31d5416a60f83e184b0906a7ec77ba021840531hding buffer_handle_t handle = obj_surface->psb_surface->buf.handle; 55f31d5416a60f83e184b0906a7ec77ba021840531hding if (!gralloc_lock(handle, usage, 0, 0, 562db64e390f8b1a9ac4cfea98d89f45ec94d11d65Jason Hu obj_surface->width, obj_surface->height, (void **)&vaddr[GRALLOC_SUB_BUFFER0])){ 572db64e390f8b1a9ac4cfea98d89f45ec94d11d65Jason Hu if (vaddr[GRALLOC_SUB_BUFFER1] == obj_surface->share_info) { 58f31d5416a60f83e184b0906a7ec77ba021840531hding memset(obj_surface->share_info, 0, sizeof(struct psb_surface_share_info_s)); 59f31d5416a60f83e184b0906a7ec77ba021840531hding } 60f31d5416a60f83e184b0906a7ec77ba021840531hding gralloc_unlock(handle); 61f31d5416a60f83e184b0906a7ec77ba021840531hding } 62f31d5416a60f83e184b0906a7ec77ba021840531hding 63f31d5416a60f83e184b0906a7ec77ba021840531hding return VA_STATUS_SUCCESS; 64f31d5416a60f83e184b0906a7ec77ba021840531hding} 65f31d5416a60f83e184b0906a7ec77ba021840531hding 66f31d5416a60f83e184b0906a7ec77ba021840531hdingVAStatus psb_CreateSurfacesFromGralloc( 67f31d5416a60f83e184b0906a7ec77ba021840531hding VADriverContextP ctx, 68f31d5416a60f83e184b0906a7ec77ba021840531hding int width, 69f31d5416a60f83e184b0906a7ec77ba021840531hding int height, 70f31d5416a60f83e184b0906a7ec77ba021840531hding int format, 71f31d5416a60f83e184b0906a7ec77ba021840531hding int num_surfaces, 72f31d5416a60f83e184b0906a7ec77ba021840531hding VASurfaceID *surface_list, /* out */ 73f31d5416a60f83e184b0906a7ec77ba021840531hding VASurfaceAttributeTPI *attribute_tpi 74f31d5416a60f83e184b0906a7ec77ba021840531hding) 75f31d5416a60f83e184b0906a7ec77ba021840531hding{ 76f31d5416a60f83e184b0906a7ec77ba021840531hding INIT_DRIVER_DATA 77f31d5416a60f83e184b0906a7ec77ba021840531hding VAStatus vaStatus = VA_STATUS_SUCCESS; 78f31d5416a60f83e184b0906a7ec77ba021840531hding int i, height_origin, usage, buffer_stride = 0; 79f31d5416a60f83e184b0906a7ec77ba021840531hding int protected = (VA_RT_FORMAT_PROTECTED & format); 80f31d5416a60f83e184b0906a7ec77ba021840531hding unsigned long fourcc; 81f31d5416a60f83e184b0906a7ec77ba021840531hding VASurfaceAttributeTPI *external_buffers = NULL; 82f31d5416a60f83e184b0906a7ec77ba021840531hding unsigned int handle; 83f31d5416a60f83e184b0906a7ec77ba021840531hding unsigned int *tmp_nativebuf_handle = NULL; 84f31d5416a60f83e184b0906a7ec77ba021840531hding int size = num_surfaces * sizeof(unsigned int); 852db64e390f8b1a9ac4cfea98d89f45ec94d11d65Jason Hu void *vaddr[GRALLOC_SUB_BUFFER_MAX]; 86f31d5416a60f83e184b0906a7ec77ba021840531hding 87f31d5416a60f83e184b0906a7ec77ba021840531hding 88f31d5416a60f83e184b0906a7ec77ba021840531hding /* follow are gralloc-buffers */ 89f31d5416a60f83e184b0906a7ec77ba021840531hding format = format & (~VA_RT_FORMAT_PROTECTED); 905ed159b49cff6b05d923bcf00d09c67ee2ce1f80hding driver_data->protected = protected; 915ed159b49cff6b05d923bcf00d09c67ee2ce1f80hding 926d37ae34fcae80f2e898b61e2506ed8e887bd16anguo CHECK_INVALID_PARAM(num_surfaces <= 0); 936d37ae34fcae80f2e898b61e2506ed8e887bd16anguo CHECK_SURFACE(surface_list); 94f31d5416a60f83e184b0906a7ec77ba021840531hding 95f31d5416a60f83e184b0906a7ec77ba021840531hding external_buffers = attribute_tpi; 96f31d5416a60f83e184b0906a7ec77ba021840531hding 97f31d5416a60f83e184b0906a7ec77ba021840531hding /* We only support one format */ 98f31d5416a60f83e184b0906a7ec77ba021840531hding if ((VA_RT_FORMAT_YUV420 != format) 99f31d5416a60f83e184b0906a7ec77ba021840531hding && (VA_RT_FORMAT_YUV422 != format)) { 100f31d5416a60f83e184b0906a7ec77ba021840531hding vaStatus = VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT; 101f31d5416a60f83e184b0906a7ec77ba021840531hding DEBUG_FAILURE; 102f31d5416a60f83e184b0906a7ec77ba021840531hding return vaStatus; 103f31d5416a60f83e184b0906a7ec77ba021840531hding } 104f31d5416a60f83e184b0906a7ec77ba021840531hding 105f31d5416a60f83e184b0906a7ec77ba021840531hding /* 106f31d5416a60f83e184b0906a7ec77ba021840531hding vaStatus = psb__checkSurfaceDimensions(driver_data, width, height); 1076d37ae34fcae80f2e898b61e2506ed8e887bd16anguo CHECK_VASTATUS(); 108f31d5416a60f83e184b0906a7ec77ba021840531hding */ 109f31d5416a60f83e184b0906a7ec77ba021840531hding /* Adjust height to be a multiple of 32 (height of macroblock in interlaced mode) */ 110f31d5416a60f83e184b0906a7ec77ba021840531hding height_origin = height; 111f31d5416a60f83e184b0906a7ec77ba021840531hding height = (height + 0x1f) & ~0x1f; 112f31d5416a60f83e184b0906a7ec77ba021840531hding 1136d37ae34fcae80f2e898b61e2506ed8e887bd16anguo CHECK_INVALID_PARAM(external_buffers == NULL); 1146d37ae34fcae80f2e898b61e2506ed8e887bd16anguo 115f31d5416a60f83e184b0906a7ec77ba021840531hding /* get native window from the reserved field */ 116f31d5416a60f83e184b0906a7ec77ba021840531hding driver_data->native_window = (void *)external_buffers->reserved[0]; 117f31d5416a60f83e184b0906a7ec77ba021840531hding 118f31d5416a60f83e184b0906a7ec77ba021840531hding tmp_nativebuf_handle = calloc(1, size); 1196d37ae34fcae80f2e898b61e2506ed8e887bd16anguo CHECK_ALLOCATION(tmp_nativebuf_handle); 1206d37ae34fcae80f2e898b61e2506ed8e887bd16anguo 121f31d5416a60f83e184b0906a7ec77ba021840531hding memcpy(tmp_nativebuf_handle, external_buffers->buffers, size); 122f31d5416a60f83e184b0906a7ec77ba021840531hding 123f31d5416a60f83e184b0906a7ec77ba021840531hding for (i = 0; i < num_surfaces; i++) { 124f31d5416a60f83e184b0906a7ec77ba021840531hding int surfaceID; 125f31d5416a60f83e184b0906a7ec77ba021840531hding object_surface_p obj_surface; 126f31d5416a60f83e184b0906a7ec77ba021840531hding psb_surface_p psb_surface; 127f31d5416a60f83e184b0906a7ec77ba021840531hding 128f31d5416a60f83e184b0906a7ec77ba021840531hding surfaceID = object_heap_allocate(&driver_data->surface_heap); 129f31d5416a60f83e184b0906a7ec77ba021840531hding obj_surface = SURFACE(surfaceID); 130f31d5416a60f83e184b0906a7ec77ba021840531hding if (NULL == obj_surface) { 131f31d5416a60f83e184b0906a7ec77ba021840531hding vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED; 132f31d5416a60f83e184b0906a7ec77ba021840531hding DEBUG_FAILURE; 133f31d5416a60f83e184b0906a7ec77ba021840531hding break; 134f31d5416a60f83e184b0906a7ec77ba021840531hding } 135f31d5416a60f83e184b0906a7ec77ba021840531hding MEMSET_OBJECT(obj_surface, struct object_surface_s); 136f31d5416a60f83e184b0906a7ec77ba021840531hding 137f31d5416a60f83e184b0906a7ec77ba021840531hding obj_surface->surface_id = surfaceID; 138f31d5416a60f83e184b0906a7ec77ba021840531hding surface_list[i] = surfaceID; 139f31d5416a60f83e184b0906a7ec77ba021840531hding obj_surface->context_id = -1; 140f31d5416a60f83e184b0906a7ec77ba021840531hding obj_surface->width = width; 141f31d5416a60f83e184b0906a7ec77ba021840531hding obj_surface->height = height; 142f31d5416a60f83e184b0906a7ec77ba021840531hding obj_surface->width_r = width; 143f31d5416a60f83e184b0906a7ec77ba021840531hding obj_surface->height_r = height; 144f31d5416a60f83e184b0906a7ec77ba021840531hding obj_surface->height_origin = height_origin; 145f31d5416a60f83e184b0906a7ec77ba021840531hding 146f31d5416a60f83e184b0906a7ec77ba021840531hding psb_surface = (psb_surface_p) calloc(1, sizeof(struct psb_surface_s)); 147f31d5416a60f83e184b0906a7ec77ba021840531hding if (NULL == psb_surface) { 148f31d5416a60f83e184b0906a7ec77ba021840531hding object_heap_free(&driver_data->surface_heap, (object_base_p) obj_surface); 149f31d5416a60f83e184b0906a7ec77ba021840531hding obj_surface->surface_id = VA_INVALID_SURFACE; 150f31d5416a60f83e184b0906a7ec77ba021840531hding 151f31d5416a60f83e184b0906a7ec77ba021840531hding vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED; 152f31d5416a60f83e184b0906a7ec77ba021840531hding 153f31d5416a60f83e184b0906a7ec77ba021840531hding DEBUG_FAILURE; 154f31d5416a60f83e184b0906a7ec77ba021840531hding break; 155f31d5416a60f83e184b0906a7ec77ba021840531hding } 156f31d5416a60f83e184b0906a7ec77ba021840531hding 157f31d5416a60f83e184b0906a7ec77ba021840531hding switch (format) { 158f31d5416a60f83e184b0906a7ec77ba021840531hding case VA_RT_FORMAT_YUV422: 159f31d5416a60f83e184b0906a7ec77ba021840531hding fourcc = VA_FOURCC_YV16; 160f31d5416a60f83e184b0906a7ec77ba021840531hding break; 161f31d5416a60f83e184b0906a7ec77ba021840531hding case VA_RT_FORMAT_YUV420: 162f31d5416a60f83e184b0906a7ec77ba021840531hding default: 163f31d5416a60f83e184b0906a7ec77ba021840531hding fourcc = VA_FOURCC_NV12; 164f31d5416a60f83e184b0906a7ec77ba021840531hding break; 165f31d5416a60f83e184b0906a7ec77ba021840531hding } 1662db64e390f8b1a9ac4cfea98d89f45ec94d11d65Jason Hu 167f31d5416a60f83e184b0906a7ec77ba021840531hding /*hard code the gralloc buffer usage*/ 168f31d5416a60f83e184b0906a7ec77ba021840531hding usage = GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_HW_COMPOSER; 169f31d5416a60f83e184b0906a7ec77ba021840531hding handle = (unsigned int)external_buffers->buffers[i]; 1702db64e390f8b1a9ac4cfea98d89f45ec94d11d65Jason Hu if (gralloc_lock(handle, usage, 0, 0, width, height, (void **)&vaddr[GRALLOC_SUB_BUFFER0])) { 171f31d5416a60f83e184b0906a7ec77ba021840531hding vaStatus = VA_STATUS_ERROR_UNKNOWN; 172f31d5416a60f83e184b0906a7ec77ba021840531hding } else { 173f31d5416a60f83e184b0906a7ec77ba021840531hding vaStatus = psb_surface_create_from_ub(driver_data, width, height, fourcc, 1742db64e390f8b1a9ac4cfea98d89f45ec94d11d65Jason Hu external_buffers, psb_surface, vaddr[GRALLOC_SUB_BUFFER0], 1755ed159b49cff6b05d923bcf00d09c67ee2ce1f80hding PSB_USER_BUFFER_UNCACHED); 176f31d5416a60f83e184b0906a7ec77ba021840531hding psb_surface->buf.handle = handle; 1772db64e390f8b1a9ac4cfea98d89f45ec94d11d65Jason Hu obj_surface->share_info = (psb_surface_share_info_t *)vaddr[GRALLOC_SUB_BUFFER1]; 178f31d5416a60f83e184b0906a7ec77ba021840531hding memset(obj_surface->share_info, 0, sizeof(struct psb_surface_share_info_s)); 179f31d5416a60f83e184b0906a7ec77ba021840531hding obj_surface->share_info->force_output_method = protected ? OUTPUT_FORCE_OVERLAY : 0; 180f31d5416a60f83e184b0906a7ec77ba021840531hding#ifdef PSBVIDEO_MSVDX_DEC_TILING 181f31d5416a60f83e184b0906a7ec77ba021840531hding obj_surface->share_info->tiling = external_buffers->tiling; 182f31d5416a60f83e184b0906a7ec77ba021840531hding#endif 183f31d5416a60f83e184b0906a7ec77ba021840531hding obj_surface->share_info->width = obj_surface->width; 184f31d5416a60f83e184b0906a7ec77ba021840531hding obj_surface->share_info->height = obj_surface->height; 185f31d5416a60f83e184b0906a7ec77ba021840531hding 186f31d5416a60f83e184b0906a7ec77ba021840531hding obj_surface->share_info->luma_stride = psb_surface->stride; 187f31d5416a60f83e184b0906a7ec77ba021840531hding obj_surface->share_info->chroma_u_stride = psb_surface->stride; 188f31d5416a60f83e184b0906a7ec77ba021840531hding obj_surface->share_info->chroma_v_stride = psb_surface->stride; 189f31d5416a60f83e184b0906a7ec77ba021840531hding obj_surface->share_info->format = VA_FOURCC_NV12; 190f31d5416a60f83e184b0906a7ec77ba021840531hding 191f31d5416a60f83e184b0906a7ec77ba021840531hding obj_surface->share_info->khandle = (uint32_t)(wsbmKBufHandle(wsbmKBuf(psb_surface->buf.drm_buf))); 192f31d5416a60f83e184b0906a7ec77ba021840531hding 193f31d5416a60f83e184b0906a7ec77ba021840531hding obj_surface->share_info->renderStatus = 0; 194f31d5416a60f83e184b0906a7ec77ba021840531hding obj_surface->share_info->used_by_widi = 0; 195f31d5416a60f83e184b0906a7ec77ba021840531hding 196f31d5416a60f83e184b0906a7ec77ba021840531hding drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s : Create graphic buffer success" 197f31d5416a60f83e184b0906a7ec77ba021840531hding "surface_id= 0x%x, vaddr[0] (0x%x), vaddr[1] (0x%x)\n", 1982db64e390f8b1a9ac4cfea98d89f45ec94d11d65Jason Hu __FUNCTION__, surfaceID, vaddr[GRALLOC_SUB_BUFFER0], vaddr[GRALLOC_SUB_BUFFER1]); 199f31d5416a60f83e184b0906a7ec77ba021840531hding gralloc_unlock(handle); 200f31d5416a60f83e184b0906a7ec77ba021840531hding } 201f31d5416a60f83e184b0906a7ec77ba021840531hding 202f31d5416a60f83e184b0906a7ec77ba021840531hding if (VA_STATUS_SUCCESS != vaStatus) { 203f31d5416a60f83e184b0906a7ec77ba021840531hding free(psb_surface); 204f31d5416a60f83e184b0906a7ec77ba021840531hding object_heap_free(&driver_data->surface_heap, (object_base_p) obj_surface); 205f31d5416a60f83e184b0906a7ec77ba021840531hding obj_surface->surface_id = VA_INVALID_SURFACE; 206f31d5416a60f83e184b0906a7ec77ba021840531hding 207f31d5416a60f83e184b0906a7ec77ba021840531hding DEBUG_FAILURE; 208f31d5416a60f83e184b0906a7ec77ba021840531hding break; 209f31d5416a60f83e184b0906a7ec77ba021840531hding } 210f31d5416a60f83e184b0906a7ec77ba021840531hding buffer_stride = psb_surface->stride; 211f31d5416a60f83e184b0906a7ec77ba021840531hding /* by default, surface fourcc is NV12 */ 212f31d5416a60f83e184b0906a7ec77ba021840531hding psb_surface->extra_info[4] = fourcc; 213f31d5416a60f83e184b0906a7ec77ba021840531hding#ifdef PSBVIDEO_MSVDX_DEC_TILING 214f31d5416a60f83e184b0906a7ec77ba021840531hding psb_surface->extra_info[7] = external_buffers->tiling; 215f31d5416a60f83e184b0906a7ec77ba021840531hding#endif 216f31d5416a60f83e184b0906a7ec77ba021840531hding obj_surface->psb_surface = psb_surface; 217f31d5416a60f83e184b0906a7ec77ba021840531hding } 218f31d5416a60f83e184b0906a7ec77ba021840531hding 219f31d5416a60f83e184b0906a7ec77ba021840531hding /* Error recovery */ 220f31d5416a60f83e184b0906a7ec77ba021840531hding if (VA_STATUS_SUCCESS != vaStatus) { 221f31d5416a60f83e184b0906a7ec77ba021840531hding /* surface_list[i-1] was the last successful allocation */ 222f31d5416a60f83e184b0906a7ec77ba021840531hding for (; i--;) { 223f31d5416a60f83e184b0906a7ec77ba021840531hding object_surface_p obj_surface = SURFACE(surface_list[i]); 224f31d5416a60f83e184b0906a7ec77ba021840531hding psb__destroy_surface(driver_data, obj_surface); 225f31d5416a60f83e184b0906a7ec77ba021840531hding surface_list[i] = VA_INVALID_SURFACE; 226f31d5416a60f83e184b0906a7ec77ba021840531hding } 227f31d5416a60f83e184b0906a7ec77ba021840531hding drv_debug_msg(VIDEO_DEBUG_ERROR, "CreateSurfaces failed\n"); 228f31d5416a60f83e184b0906a7ec77ba021840531hding 229f31d5416a60f83e184b0906a7ec77ba021840531hding if (tmp_nativebuf_handle) 230f31d5416a60f83e184b0906a7ec77ba021840531hding free(tmp_nativebuf_handle); 231f31d5416a60f83e184b0906a7ec77ba021840531hding 232f31d5416a60f83e184b0906a7ec77ba021840531hding return vaStatus; 233f31d5416a60f83e184b0906a7ec77ba021840531hding } 234f31d5416a60f83e184b0906a7ec77ba021840531hding 235f31d5416a60f83e184b0906a7ec77ba021840531hding return vaStatus; 236f31d5416a60f83e184b0906a7ec77ba021840531hding} 237