Path: blob/master/dep/ffmpeg/include/libavutil/hwcontext_drm.h
4216 views
/*1* This file is part of FFmpeg.2*3* FFmpeg is free software; you can redistribute it and/or4* modify it under the terms of the GNU Lesser General Public5* License as published by the Free Software Foundation; either6* version 2.1 of the License, or (at your option) any later version.7*8* FFmpeg is distributed in the hope that it will be useful,9* but WITHOUT ANY WARRANTY; without even the implied warranty of10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU11* Lesser General Public License for more details.12*13* You should have received a copy of the GNU Lesser General Public14* License along with FFmpeg; if not, write to the Free Software15* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA16*/1718#ifndef AVUTIL_HWCONTEXT_DRM_H19#define AVUTIL_HWCONTEXT_DRM_H2021#include <stddef.h>22#include <stdint.h>2324/**25* @file26* API-specific header for AV_HWDEVICE_TYPE_DRM.27*28* Internal frame allocation is not currently supported - all frames29* must be allocated by the user. Thus AVHWFramesContext is always30* NULL, though this may change if support for frame allocation is31* added in future.32*/3334enum {35/**36* The maximum number of layers/planes in a DRM frame.37*/38AV_DRM_MAX_PLANES = 439};4041/**42* DRM object descriptor.43*44* Describes a single DRM object, addressing it as a PRIME file45* descriptor.46*/47typedef struct AVDRMObjectDescriptor {48/**49* DRM PRIME fd for the object.50*/51int fd;52/**53* Total size of the object.54*55* (This includes any parts not which do not contain image data.)56*/57size_t size;58/**59* Format modifier applied to the object (DRM_FORMAT_MOD_*).60*61* If the format modifier is unknown then this should be set to62* DRM_FORMAT_MOD_INVALID.63*/64uint64_t format_modifier;65} AVDRMObjectDescriptor;6667/**68* DRM plane descriptor.69*70* Describes a single plane of a layer, which is contained within71* a single object.72*/73typedef struct AVDRMPlaneDescriptor {74/**75* Index of the object containing this plane in the objects76* array of the enclosing frame descriptor.77*/78int object_index;79/**80* Offset within that object of this plane.81*/82ptrdiff_t offset;83/**84* Pitch (linesize) of this plane.85*/86ptrdiff_t pitch;87} AVDRMPlaneDescriptor;8889/**90* DRM layer descriptor.91*92* Describes a single layer within a frame. This has the structure93* defined by its format, and will contain one or more planes.94*/95typedef struct AVDRMLayerDescriptor {96/**97* Format of the layer (DRM_FORMAT_*).98*/99uint32_t format;100/**101* Number of planes in the layer.102*103* This must match the number of planes required by format.104*/105int nb_planes;106/**107* Array of planes in this layer.108*/109AVDRMPlaneDescriptor planes[AV_DRM_MAX_PLANES];110} AVDRMLayerDescriptor;111112/**113* DRM frame descriptor.114*115* This is used as the data pointer for AV_PIX_FMT_DRM_PRIME frames.116* It is also used by user-allocated frame pools - allocating in117* AVHWFramesContext.pool must return AVBufferRefs which contain118* an object of this type.119*120* The fields of this structure should be set such it can be121* imported directly by EGL using the EGL_EXT_image_dma_buf_import122* and EGL_EXT_image_dma_buf_import_modifiers extensions.123* (Note that the exact layout of a particular format may vary between124* platforms - we only specify that the same platform should be able125* to import it.)126*127* The total number of planes must not exceed AV_DRM_MAX_PLANES, and128* the order of the planes by increasing layer index followed by129* increasing plane index must be the same as the order which would130* be used for the data pointers in the equivalent software format.131*/132typedef struct AVDRMFrameDescriptor {133/**134* Number of DRM objects making up this frame.135*/136int nb_objects;137/**138* Array of objects making up the frame.139*/140AVDRMObjectDescriptor objects[AV_DRM_MAX_PLANES];141/**142* Number of layers in the frame.143*/144int nb_layers;145/**146* Array of layers in the frame.147*/148AVDRMLayerDescriptor layers[AV_DRM_MAX_PLANES];149} AVDRMFrameDescriptor;150151/**152* DRM device.153*154* Allocated as AVHWDeviceContext.hwctx.155*/156typedef struct AVDRMDeviceContext {157/**158* File descriptor of DRM device.159*160* This is used as the device to create frames on, and may also be161* used in some derivation and mapping operations.162*163* If no device is required, set to -1.164*/165int fd;166} AVDRMDeviceContext;167168#endif /* AVUTIL_HWCONTEXT_DRM_H */169170171