hardware/intel/common/libva
Revisión | f2ddc03d0b8f6ba3bb143a086687f1ad386046c6 (tree) |
---|---|
Tiempo | 2018-12-19 18:08:53 |
Autor | Mark Thompson <sw@jkqx...> |
Commiter | XinfengZhang |
Allow import of the DRM PRIME 2 memory type
This adds support for import using the VADRMPRIMESurfaceDescriptor
structure, which enables use of format modifiers (required for some
compressed surfaces).
Signed-off-by: Mark Thompson <sw@jkqxz.net>
@@ -1260,7 +1260,12 @@ typedef enum { | ||
1260 | 1260 | VASurfaceAttribMaxHeight, |
1261 | 1261 | /** \brief Surface memory type expressed in bit fields (int, read/write). */ |
1262 | 1262 | VASurfaceAttribMemoryType, |
1263 | - /** \brief External buffer descriptor (pointer, write). */ | |
1263 | + /** \brief External buffer descriptor (pointer, write). | |
1264 | + * | |
1265 | + * Refer to the documentation for the memory type being created to | |
1266 | + * determine what descriptor structure to pass here. If not otherwise | |
1267 | + * stated, the common VASurfaceAttribExternalBuffers should be used. | |
1268 | + */ | |
1264 | 1269 | VASurfaceAttribExternalBufferDescriptor, |
1265 | 1270 | /** \brief Surface usage hint, gives the driver a hint of intended usage |
1266 | 1271 | * to optimize allocation (e.g. tiling) (int, read/write). */ |
@@ -90,8 +90,6 @@ struct drm_state { | ||
90 | 90 | /** |
91 | 91 | * \brief External buffer descriptor for a DRM PRIME surface. |
92 | 92 | * |
93 | - * This can currently only be used for export. | |
94 | - * | |
95 | 93 | * For export, call vaExportSurfaceHandle() with mem_type set to |
96 | 94 | * VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2 and pass a pointer to an |
97 | 95 | * instance of this structure to fill. |
@@ -101,6 +99,23 @@ struct drm_state { | ||
101 | 99 | * one of DRM_FORMAT_GR88. |
102 | 100 | * If VA_EXPORT_SURFACE_COMPOSED_LAYERS is specified on export, |
103 | 101 | * there will be exactly one layer. |
102 | + * | |
103 | + * For import, call vaCreateSurfaces() with the MemoryType attribute | |
104 | + * set to VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2 and the | |
105 | + * ExternalBufferDescriptor attribute set to point to an array of | |
106 | + * num_surfaces instances of this structure. | |
107 | + * The number of planes which need to be provided for a given layer | |
108 | + * is dependent on both the format and the format modifier used for | |
109 | + * the objects containing it. For example, the format DRM_FORMAT_RGBA | |
110 | + * normally requires one plane, but with the format modifier | |
111 | + * I915_FORMAT_MOD_Y_TILED_CCS it requires two planes - the first | |
112 | + * being the main data plane and the second containing the color | |
113 | + * control surface. | |
114 | + * Note that a given driver may only support a subset of possible | |
115 | + * representations of a particular format. For example, it may only | |
116 | + * support NV12 surfaces when they are contained within a single DRM | |
117 | + * object, and therefore fail to create such surfaces if the two | |
118 | + * planes are in different DRM objects. | |
104 | 119 | */ |
105 | 120 | typedef struct _VADRMPRIMESurfaceDescriptor { |
106 | 121 | /** Pixel format fourcc of the whole surface (VA_FOURCC_*). */ |