Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:mantarimay:mesa:git
Mesa
_service:download_url:26165.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:download_url:26165.patch of Package Mesa
From 0b6b9cb00d8ae814b9a3c90ba811f1e9cec24d32 Mon Sep 17 00:00:00 2001 From: Hannes Mann <hannesmann2000@gmail.com> Date: Mon, 20 Nov 2023 23:16:50 +0100 Subject: [PATCH 1/2] gallium/pipe: Add contiguous planes per-surface attribute Attribute is set when textures are created by compatible drivers, but not when importing from DMA-BUF. --- src/gallium/auxiliary/vl/vl_video_buffer.c | 1 + src/gallium/drivers/d3d12/d3d12_video_buffer.cpp | 1 + src/gallium/drivers/r600/r600_uvd.c | 1 + src/gallium/frontends/va/image.c | 5 +++-- src/gallium/include/pipe/p_video_codec.h | 1 + 5 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gallium/auxiliary/vl/vl_video_buffer.c b/src/gallium/auxiliary/vl/vl_video_buffer.c index 4d95f762510ca..686e8b0aede7b 100644 --- a/src/gallium/auxiliary/vl/vl_video_buffer.c +++ b/src/gallium/auxiliary/vl/vl_video_buffer.c @@ -535,5 +535,6 @@ vl_video_buffer_create_as_resource(struct pipe_context *pipe, struct pipe_video_buffer vidtemplate = *tmpl; vidtemplate.width = templ.width0; vidtemplate.height = templ.height0 * array_size; + vidtemplate.contiguous_planes = true; return vl_video_buffer_create_ex2(pipe, &vidtemplate, resources); } diff --git a/src/gallium/drivers/d3d12/d3d12_video_buffer.cpp b/src/gallium/drivers/d3d12/d3d12_video_buffer.cpp index dffb038e3a330..ea8c7ee121b4d 100644 --- a/src/gallium/drivers/d3d12/d3d12_video_buffer.cpp +++ b/src/gallium/drivers/d3d12/d3d12_video_buffer.cpp @@ -59,6 +59,7 @@ d3d12_video_buffer_create_impl(struct pipe_context *pipe, pD3D12VideoBuffer->base.width = tmpl->width; pD3D12VideoBuffer->base.height = tmpl->height; pD3D12VideoBuffer->base.interlaced = tmpl->interlaced; + pD3D12VideoBuffer->base.contiguous_planes = true; pD3D12VideoBuffer->base.associated_data = nullptr; pD3D12VideoBuffer->base.bind = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET | PIPE_BIND_DISPLAY_TARGET | PIPE_BIND_CUSTOM; diff --git a/src/gallium/drivers/r600/r600_uvd.c b/src/gallium/drivers/r600/r600_uvd.c index 6f893bdb339db..57a74156ba681 100644 --- a/src/gallium/drivers/r600/r600_uvd.c +++ b/src/gallium/drivers/r600/r600_uvd.c @@ -78,6 +78,7 @@ struct pipe_video_buffer *r600_video_buffer_create(struct pipe_context *pipe, template = *tmpl; template.width = align(tmpl->width, VL_MACROBLOCK_WIDTH); template.height = align(tmpl->height / array_size, VL_MACROBLOCK_HEIGHT); + template.contiguous_planes = true; vl_video_buffer_template(&templ, &template, resource_formats[0], 1, array_size, PIPE_USAGE_DEFAULT, 0, chroma_format); diff --git a/src/gallium/frontends/va/image.c b/src/gallium/frontends/va/image.c index 98d423f2a4d97..65f66af00e827 100644 --- a/src/gallium/frontends/va/image.c +++ b/src/gallium/frontends/va/image.c @@ -277,9 +277,10 @@ vlVaDeriveImage(VADriverContextP ctx, VASurfaceID surface, VAImage *image) PIPE_VIDEO_CAP_SUPPORTS_PROGRESSIVE)) return VA_STATUS_ERROR_OPERATION_FAILED; } else if (util_format_get_num_planes(surf->buffer->buffer_format) >= 2 && - !screen->get_video_param(screen, PIPE_VIDEO_PROFILE_UNKNOWN, + (!screen->get_video_param(screen, PIPE_VIDEO_PROFILE_UNKNOWN, PIPE_VIDEO_ENTRYPOINT_BITSTREAM, - PIPE_VIDEO_CAP_SUPPORTS_CONTIGUOUS_PLANES_MAP)) { + PIPE_VIDEO_CAP_SUPPORTS_CONTIGUOUS_PLANES_MAP) || + !surf->buffer->contiguous_planes)) { return VA_STATUS_ERROR_OPERATION_FAILED; } diff --git a/src/gallium/include/pipe/p_video_codec.h b/src/gallium/include/pipe/p_video_codec.h index c94c699e29855..5facab197e506 100644 --- a/src/gallium/include/pipe/p_video_codec.h +++ b/src/gallium/include/pipe/p_video_codec.h @@ -212,6 +212,7 @@ struct pipe_video_buffer unsigned height; bool interlaced; unsigned bind; + bool contiguous_planes; /** * destroy this video buffer -- GitLab From eff9f33d49db7e7562ed5b93551dcf21b78b916a Mon Sep 17 00:00:00 2001 From: Hannes Mann <hannesmann2000@gmail.com> Date: Mon, 20 Nov 2023 23:17:31 +0100 Subject: [PATCH 2/2] frontends/va: Only export one handle for contiguous planes If the driver stores all planes contiguously in memory, only one BO needs to be exported from vaExportSurfaceHandle. This is required for Chromium's VaapiVideoDecoder to work on radeonsi and r600. --- src/gallium/frontends/va/surface.c | 64 +++++++++++++++++++----------- 1 file changed, 41 insertions(+), 23 deletions(-) diff --git a/src/gallium/frontends/va/surface.c b/src/gallium/frontends/va/surface.c index 2f153abde644e..48eb7ca1b0f43 100644 --- a/src/gallium/frontends/va/surface.c +++ b/src/gallium/frontends/va/surface.c @@ -1619,8 +1619,11 @@ vlVaExportSurfaceHandle(VADriverContextP ctx, #else VADRMPRIMESurfaceDescriptor *desc = descriptor; desc->fourcc = PipeFormatToVaFourcc(surf->buffer->buffer_format); - desc->width = surf->templat.width; + desc->width = surf->templat.width; desc->height = surf->templat.height; + desc->num_objects = 0; + + bool supports_contiguous_planes = screen->resource_get_info && surf->buffer->contiguous_planes; for (p = 0; p < ARRAY_SIZE(desc->objects); p++) { struct winsys_handle whandle; @@ -1638,37 +1641,52 @@ vlVaExportSurfaceHandle(VADriverContextP ctx, goto fail; } - memset(&whandle, 0, sizeof(whandle)); - whandle.type = WINSYS_HANDLE_TYPE_FD; + /* If the driver stores all planes contiguously in memory, only one + * handle needs to be exported. resource_get_info is used to obtain + * pitch and offset for each layer. */ + if (!desc->num_objects || !supports_contiguous_planes) { + memset(&whandle, 0, sizeof(whandle)); + whandle.type = WINSYS_HANDLE_TYPE_FD; - if (!screen->resource_get_handle(screen, drv->pipe, resource, - &whandle, usage)) { - ret = VA_STATUS_ERROR_INVALID_SURFACE; - goto fail; - } + if (!screen->resource_get_handle(screen, drv->pipe, resource, + &whandle, usage)) { + ret = VA_STATUS_ERROR_INVALID_SURFACE; + goto fail; + } - desc->objects[p].fd = (int)whandle.handle; - /* As per VADRMPRIMESurfaceDescriptor documentation, size must be the - * "Total size of this object (may include regions which are not part - * of the surface)."" */ - desc->objects[p].size = (uint32_t) whandle.size; - desc->objects[p].drm_format_modifier = whandle.modifier; + desc->objects[desc->num_objects].fd = (int) whandle.handle; + /* As per VADRMPRIMESurfaceDescriptor documentation, size must be the + * "Total size of this object (may include regions which are not part + * of the surface)."" */ + desc->objects[desc->num_objects].size = (uint32_t) whandle.size; + desc->objects[desc->num_objects].drm_format_modifier = whandle.modifier; + + desc->num_objects++; + } if (flags & VA_EXPORT_SURFACE_COMPOSED_LAYERS) { - desc->layers[0].object_index[p] = p; - desc->layers[0].offset[p] = whandle.offset; - desc->layers[0].pitch[p] = whandle.stride; + desc->layers[0].object_index[p] = desc->num_objects - 1; + + if (supports_contiguous_planes) { + screen->resource_get_info(screen, resource, &desc->layers[0].pitch[p], &desc->layers[0].offset[p]); + } else { + desc->layers[0].pitch[p] = whandle.stride; + desc->layers[0].offset[p] = whandle.offset; + } } else { desc->layers[p].drm_format = drm_format; desc->layers[p].num_planes = 1; - desc->layers[p].object_index[0] = p; - desc->layers[p].offset[0] = whandle.offset; - desc->layers[p].pitch[0] = whandle.stride; + desc->layers[p].object_index[0] = desc->num_objects - 1; + + if (supports_contiguous_planes) { + screen->resource_get_info(screen, resource, &desc->layers[p].pitch[0], &desc->layers[p].offset[0]); + } else { + desc->layers[p].pitch[0] = whandle.stride; + desc->layers[p].offset[0] = whandle.offset; + } } } - desc->num_objects = p; - if (flags & VA_EXPORT_SURFACE_COMPOSED_LAYERS) { uint32_t drm_format = pipe_format_to_drm_format(surf->buffer->buffer_format); if (drm_format == DRM_FORMAT_INVALID) { @@ -1690,7 +1708,7 @@ vlVaExportSurfaceHandle(VADriverContextP ctx, fail: #ifndef _WIN32 - for (i = 0; i < p; i++) + for (i = 0; i < desc->num_objects; i++) close(desc->objects[i].fd); #else if(whandle.handle) -- GitLab
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor