attribs[i].value.value.p = NULL; /* ignore */
i++;
+#ifdef HAVE_VA_SURFACE_ATTRIB_DRM_FORMAT_MODIFIERS
+ if (drv->pipe->create_video_buffer_with_modifiers) {
+ attribs[i].type = VASurfaceAttribDRMFormatModifiers;
+ attribs[i].value.type = VAGenericValueTypePointer;
+ attribs[i].flags = VA_SURFACE_ATTRIB_SETTABLE;
+ attribs[i].value.value.p = NULL; /* ignore */
+ i++;
+ }
+#endif
+
if (config->entrypoint != PIPE_VIDEO_ENTRYPOINT_UNKNOWN) {
attribs[i].type = VASurfaceAttribMaxWidth;
attribs[i].value.type = VAGenericValueTypeInteger;
VAStatus
vlVaHandleSurfaceAllocate(vlVaDriver *drv, vlVaSurface *surface,
- struct pipe_video_buffer *templat)
+ struct pipe_video_buffer *templat,
+ const uint64_t *modifiers,
+ unsigned int modifiers_count)
{
struct pipe_surface **surfaces;
unsigned i;
- surface->buffer = drv->pipe->create_video_buffer(drv->pipe, templat);
+ if (modifiers_count > 0) {
+ if (!drv->pipe->create_video_buffer_with_modifiers)
+ return VA_STATUS_ERROR_ATTR_NOT_SUPPORTED;
+ surface->buffer =
+ drv->pipe->create_video_buffer_with_modifiers(drv->pipe, templat,
+ modifiers,
+ modifiers_count);
+ } else {
+ surface->buffer = drv->pipe->create_video_buffer(drv->pipe, templat);
+ }
if (!surface->buffer)
return VA_STATUS_ERROR_ALLOCATION_FAILED;
{
vlVaDriver *drv;
VASurfaceAttribExternalBuffers *memory_attribute;
+#ifdef HAVE_VA_SURFACE_ATTRIB_DRM_FORMAT_MODIFIERS
+ const VADRMFormatModifierList *modifier_list;
+#endif
struct pipe_video_buffer templat;
struct pipe_screen *pscreen;
int i;
VAStatus vaStatus;
vlVaSurface *surf;
bool protected;
+ const uint64_t *modifiers;
+ unsigned int modifiers_count;
if (!ctx)
return VA_STATUS_ERROR_INVALID_CONTEXT;
memory_attribute = NULL;
memory_type = VA_SURFACE_ATTRIB_MEM_TYPE_VA;
expected_fourcc = 0;
+ modifiers = NULL;
+ modifiers_count = 0;
for (i = 0; i < num_attribs && attrib_list; i++) {
if (!(attrib_list[i].flags & VA_SURFACE_ATTRIB_SETTABLE))
return VA_STATUS_ERROR_INVALID_PARAMETER;
memory_attribute = (VASurfaceAttribExternalBuffers *)attrib_list[i].value.value.p;
break;
+#ifdef HAVE_VA_SURFACE_ATTRIB_DRM_FORMAT_MODIFIERS
+ case VASurfaceAttribDRMFormatModifiers:
+ if (attrib_list[i].value.type != VAGenericValueTypePointer)
+ return VA_STATUS_ERROR_INVALID_PARAMETER;
+ modifier_list = attrib_list[i].value.value.p;
+ modifiers = modifier_list->modifiers;
+ modifiers_count = modifier_list->num_modifiers;
+ break;
+#endif
default:
return VA_STATUS_ERROR_ATTR_NOT_SUPPORTED;
}
case VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME:
if (!memory_attribute)
return VA_STATUS_ERROR_INVALID_PARAMETER;
+ if (modifiers)
+ return VA_STATUS_ERROR_INVALID_PARAMETER;
expected_fourcc = memory_attribute->pixel_format;
break;
PIPE_VIDEO_ENTRYPOINT_BITSTREAM,
PIPE_VIDEO_CAP_PREFERED_FORMAT
);
- templat.interlaced = pscreen->get_video_param(
- pscreen,
- PIPE_VIDEO_PROFILE_UNKNOWN,
- PIPE_VIDEO_ENTRYPOINT_BITSTREAM,
- PIPE_VIDEO_CAP_PREFERS_INTERLACED
- );
+
+ if (modifiers)
+ templat.interlaced = false;
+ else
+ templat.interlaced =
+ pscreen->get_video_param(pscreen, PIPE_VIDEO_PROFILE_UNKNOWN,
+ PIPE_VIDEO_ENTRYPOINT_BITSTREAM,
+ PIPE_VIDEO_CAP_PREFERS_INTERLACED);
if (expected_fourcc) {
enum pipe_format expected_format = VaFourccToPipeFormat(expected_fourcc);
!(memory_attribute->flags & VA_SURFACE_EXTBUF_DESC_ENABLE_TILING))
templat.bind = PIPE_BIND_LINEAR | PIPE_BIND_SHARED;
- vaStatus = vlVaHandleSurfaceAllocate(drv, surf, &templat);
+ vaStatus = vlVaHandleSurfaceAllocate(drv, surf, &templat, modifiers,
+ modifiers_count);
if (vaStatus != VA_STATUS_SUCCESS)
goto free_surf;
break;
surf->templat.interlaced = false;
- ret = vlVaHandleSurfaceAllocate(drv, surf, &surf->templat);
+ ret = vlVaHandleSurfaceAllocate(drv, surf, &surf->templat, NULL, 0);
if (ret != VA_STATUS_SUCCESS) {
mtx_unlock(&drv->mutex);
return VA_STATUS_ERROR_ALLOCATION_FAILED;