frontends/va: Allow creating DRM PRIME surfaces without surface descriptor

If we don't have surface descriptor, treat this as a hint from
application that it will export the surface later.
This matches Intel driver behavior.

Reviewed-by: Leo Liu <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32970>
This commit is contained in:
David Rosca
2025-01-10 12:24:44 +01:00
committed by Marge Bot
parent 10e424f586
commit 5a5628284a

View File

@@ -1099,7 +1099,7 @@ vlVaCreateSurfaces2(VADriverContextP ctx, unsigned int format,
const VADRMFormatModifierList *modifier_list;
#endif
#endif
struct pipe_video_buffer templat;
struct pipe_video_buffer templat = {0};
struct pipe_screen *pscreen;
int i;
int memory_type;
@@ -1228,18 +1228,20 @@ vlVaCreateSurfaces2(VADriverContextP ctx, unsigned int format,
break;
case VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2:
case VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_3:
if (!prime_desc)
return VA_STATUS_ERROR_INVALID_PARAMETER;
expected_fourcc = prime_desc->fourcc;
/* If we don't have surface descriptor, use it as a hint
* that application will export the surface later. */
if (!prime_desc) {
templat.bind |= PIPE_BIND_SHARED;
memory_type = VA_SURFACE_ATTRIB_MEM_TYPE_VA;
} else {
expected_fourcc = prime_desc->fourcc;
}
break;
#endif
default:
assert(0);
}
memset(&templat, 0, sizeof(templat));
if (!modifiers)
templat.interlaced =
!pscreen->get_video_param(pscreen, PIPE_VIDEO_PROFILE_UNKNOWN,