2 * va_drmcommon.h - Common utilities for DRM-based drivers
4 * Copyright (c) 2012 Intel Corporation. All Rights Reserved.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 #ifndef VA_DRM_COMMON_H
28 #define VA_DRM_COMMON_H
33 /** \brief DRM authentication type. */
35 /** \brief Disconnected. */
38 * \brief Connected. Authenticated with DRI1 protocol.
41 * This is a deprecated authentication type. All DRI-based drivers have
42 * been migrated to use the DRI2 protocol. Newly written drivers shall
43 * use DRI2 protocol only, or a custom authentication means. e.g. opt
44 * for authenticating on the VA driver side, instead of libva side.
48 * \brief Connected. Authenticated with DRI2 protocol.
50 * This is only useful to VA/X11 drivers. The libva-x11 library provides
51 * a helper function VA_DRI2Authenticate() for authenticating the
52 * connection. However, DRI2 conformant drivers don't need to call that
53 * function since authentication happens on the libva side, implicitly.
57 * \brief Connected. Authenticated with some alternate raw protocol.
59 * This authentication mode is mainly used in non-VA/X11 drivers.
60 * Authentication happens through some alternative method, at the
61 * discretion of the VA driver implementation.
63 VA_DRM_AUTH_CUSTOM = 3
66 /** \brief Base DRM state. */
68 /** \brief DRM connection descriptor. */
70 /** \brief DRM authentication type. */
72 /** \brief Reserved bytes for future use, must be zero */
76 /** \brief Kernel DRM buffer memory type. */
77 #define VA_SURFACE_ATTRIB_MEM_TYPE_KERNEL_DRM 0x10000000
78 /** \brief DRM PRIME memory type (old version)
80 * This supports only single objects with restricted memory layout.
81 * Used with VASurfaceAttribExternalBuffers.
83 #define VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME 0x20000000
84 /** \brief DRM PRIME memory type
86 * Used with VADRMPRIMESurfaceDescriptor.
88 #define VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2 0x40000000
91 * \brief External buffer descriptor for a DRM PRIME surface.
93 * This can currently only be used for export.
95 * For export, call vaExportSurfaceHandle() with mem_type set to
96 * VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2 and pass a pointer to an
97 * instance of this structure to fill.
98 * If VA_EXPORT_SURFACE_SEPARATE_LAYERS is specified on export, each
99 * layer will contain exactly one plane. For example, an NV12
100 * surface will be exported as two layers, one of DRM_FORMAT_R8 and
101 * one of DRM_FORMAT_GR88.
102 * If VA_EXPORT_SURFACE_COMPOSED_LAYERS is specified on export,
103 * there will be exactly one layer.
105 typedef struct _VADRMPRIMESurfaceDescriptor {
106 /** Pixel format fourcc of the whole surface (VA_FOURCC_*). */
108 /** Width of the surface in pixels. */
110 /** Height of the surface in pixels. */
112 /** Number of distinct DRM objects making up the surface. */
113 uint32_t num_objects;
114 /** Description of each object. */
116 /** DRM PRIME file descriptor for this object. */
118 /** Total size of this object (may include regions which are
119 * not part of the surface). */
121 /** Format modifier applied to this object. */
122 uint64_t drm_format_modifier;
124 /** Number of layers making up the surface. */
126 /** Description of each layer in the surface. */
128 /** DRM format fourcc of this layer (DRM_FOURCC_*). */
130 /** Number of planes in this layer. */
132 /** Index in the objects array of the object containing each
134 uint32_t object_index[4];
135 /** Offset within the object of each plane. */
137 /** Pitch of each plane. */
140 } VADRMPRIMESurfaceDescriptor;
143 #endif /* VA_DRM_COMMON_H */