1cabdff1aSopenharmony_ci/* 2cabdff1aSopenharmony_ci * This file is part of FFmpeg. 3cabdff1aSopenharmony_ci * 4cabdff1aSopenharmony_ci * FFmpeg is free software; you can redistribute it and/or 5cabdff1aSopenharmony_ci * modify it under the terms of the GNU Lesser General Public 6cabdff1aSopenharmony_ci * License as published by the Free Software Foundation; either 7cabdff1aSopenharmony_ci * version 2.1 of the License, or (at your option) any later version. 8cabdff1aSopenharmony_ci * 9cabdff1aSopenharmony_ci * FFmpeg is distributed in the hope that it will be useful, 10cabdff1aSopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of 11cabdff1aSopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12cabdff1aSopenharmony_ci * Lesser General Public License for more details. 13cabdff1aSopenharmony_ci * 14cabdff1aSopenharmony_ci * You should have received a copy of the GNU Lesser General Public 15cabdff1aSopenharmony_ci * License along with FFmpeg; if not, write to the Free Software 16cabdff1aSopenharmony_ci * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17cabdff1aSopenharmony_ci */ 18cabdff1aSopenharmony_ci 19cabdff1aSopenharmony_ci#ifndef AVUTIL_HWCONTEXT_VAAPI_H 20cabdff1aSopenharmony_ci#define AVUTIL_HWCONTEXT_VAAPI_H 21cabdff1aSopenharmony_ci 22cabdff1aSopenharmony_ci#include <va/va.h> 23cabdff1aSopenharmony_ci 24cabdff1aSopenharmony_ci/** 25cabdff1aSopenharmony_ci * @file 26cabdff1aSopenharmony_ci * API-specific header for AV_HWDEVICE_TYPE_VAAPI. 27cabdff1aSopenharmony_ci * 28cabdff1aSopenharmony_ci * Dynamic frame pools are supported, but note that any pool used as a render 29cabdff1aSopenharmony_ci * target is required to be of fixed size in order to be be usable as an 30cabdff1aSopenharmony_ci * argument to vaCreateContext(). 31cabdff1aSopenharmony_ci * 32cabdff1aSopenharmony_ci * For user-allocated pools, AVHWFramesContext.pool must return AVBufferRefs 33cabdff1aSopenharmony_ci * with the data pointer set to a VASurfaceID. 34cabdff1aSopenharmony_ci */ 35cabdff1aSopenharmony_ci 36cabdff1aSopenharmony_cienum { 37cabdff1aSopenharmony_ci /** 38cabdff1aSopenharmony_ci * The quirks field has been set by the user and should not be detected 39cabdff1aSopenharmony_ci * automatically by av_hwdevice_ctx_init(). 40cabdff1aSopenharmony_ci */ 41cabdff1aSopenharmony_ci AV_VAAPI_DRIVER_QUIRK_USER_SET = (1 << 0), 42cabdff1aSopenharmony_ci /** 43cabdff1aSopenharmony_ci * The driver does not destroy parameter buffers when they are used by 44cabdff1aSopenharmony_ci * vaRenderPicture(). Additional code will be required to destroy them 45cabdff1aSopenharmony_ci * separately afterwards. 46cabdff1aSopenharmony_ci */ 47cabdff1aSopenharmony_ci AV_VAAPI_DRIVER_QUIRK_RENDER_PARAM_BUFFERS = (1 << 1), 48cabdff1aSopenharmony_ci 49cabdff1aSopenharmony_ci /** 50cabdff1aSopenharmony_ci * The driver does not support the VASurfaceAttribMemoryType attribute, 51cabdff1aSopenharmony_ci * so the surface allocation code will not try to use it. 52cabdff1aSopenharmony_ci */ 53cabdff1aSopenharmony_ci AV_VAAPI_DRIVER_QUIRK_ATTRIB_MEMTYPE = (1 << 2), 54cabdff1aSopenharmony_ci 55cabdff1aSopenharmony_ci /** 56cabdff1aSopenharmony_ci * The driver does not support surface attributes at all. 57cabdff1aSopenharmony_ci * The surface allocation code will never pass them to surface allocation, 58cabdff1aSopenharmony_ci * and the results of the vaQuerySurfaceAttributes() call will be faked. 59cabdff1aSopenharmony_ci */ 60cabdff1aSopenharmony_ci AV_VAAPI_DRIVER_QUIRK_SURFACE_ATTRIBUTES = (1 << 3), 61cabdff1aSopenharmony_ci}; 62cabdff1aSopenharmony_ci 63cabdff1aSopenharmony_ci/** 64cabdff1aSopenharmony_ci * VAAPI connection details. 65cabdff1aSopenharmony_ci * 66cabdff1aSopenharmony_ci * Allocated as AVHWDeviceContext.hwctx 67cabdff1aSopenharmony_ci */ 68cabdff1aSopenharmony_citypedef struct AVVAAPIDeviceContext { 69cabdff1aSopenharmony_ci /** 70cabdff1aSopenharmony_ci * The VADisplay handle, to be filled by the user. 71cabdff1aSopenharmony_ci */ 72cabdff1aSopenharmony_ci VADisplay display; 73cabdff1aSopenharmony_ci /** 74cabdff1aSopenharmony_ci * Driver quirks to apply - this is filled by av_hwdevice_ctx_init(), 75cabdff1aSopenharmony_ci * with reference to a table of known drivers, unless the 76cabdff1aSopenharmony_ci * AV_VAAPI_DRIVER_QUIRK_USER_SET bit is already present. The user 77cabdff1aSopenharmony_ci * may need to refer to this field when performing any later 78cabdff1aSopenharmony_ci * operations using VAAPI with the same VADisplay. 79cabdff1aSopenharmony_ci */ 80cabdff1aSopenharmony_ci unsigned int driver_quirks; 81cabdff1aSopenharmony_ci} AVVAAPIDeviceContext; 82cabdff1aSopenharmony_ci 83cabdff1aSopenharmony_ci/** 84cabdff1aSopenharmony_ci * VAAPI-specific data associated with a frame pool. 85cabdff1aSopenharmony_ci * 86cabdff1aSopenharmony_ci * Allocated as AVHWFramesContext.hwctx. 87cabdff1aSopenharmony_ci */ 88cabdff1aSopenharmony_citypedef struct AVVAAPIFramesContext { 89cabdff1aSopenharmony_ci /** 90cabdff1aSopenharmony_ci * Set by the user to apply surface attributes to all surfaces in 91cabdff1aSopenharmony_ci * the frame pool. If null, default settings are used. 92cabdff1aSopenharmony_ci */ 93cabdff1aSopenharmony_ci VASurfaceAttrib *attributes; 94cabdff1aSopenharmony_ci int nb_attributes; 95cabdff1aSopenharmony_ci /** 96cabdff1aSopenharmony_ci * The surfaces IDs of all surfaces in the pool after creation. 97cabdff1aSopenharmony_ci * Only valid if AVHWFramesContext.initial_pool_size was positive. 98cabdff1aSopenharmony_ci * These are intended to be used as the render_targets arguments to 99cabdff1aSopenharmony_ci * vaCreateContext(). 100cabdff1aSopenharmony_ci */ 101cabdff1aSopenharmony_ci VASurfaceID *surface_ids; 102cabdff1aSopenharmony_ci int nb_surfaces; 103cabdff1aSopenharmony_ci} AVVAAPIFramesContext; 104cabdff1aSopenharmony_ci 105cabdff1aSopenharmony_ci/** 106cabdff1aSopenharmony_ci * VAAPI hardware pipeline configuration details. 107cabdff1aSopenharmony_ci * 108cabdff1aSopenharmony_ci * Allocated with av_hwdevice_hwconfig_alloc(). 109cabdff1aSopenharmony_ci */ 110cabdff1aSopenharmony_citypedef struct AVVAAPIHWConfig { 111cabdff1aSopenharmony_ci /** 112cabdff1aSopenharmony_ci * ID of a VAAPI pipeline configuration. 113cabdff1aSopenharmony_ci */ 114cabdff1aSopenharmony_ci VAConfigID config_id; 115cabdff1aSopenharmony_ci} AVVAAPIHWConfig; 116cabdff1aSopenharmony_ci 117cabdff1aSopenharmony_ci#endif /* AVUTIL_HWCONTEXT_VAAPI_H */ 118