mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 11:28:05 +02:00
st/va: remove fence handling v3
It's nonsense to drain the pipeline like this. v2: keep the drain for DMA-buf exports. v3: flush before the export and after compositing and add TODO comment. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Julien Isorce <j.isorce@samsung.com> Tested-by: Julien Isorce <j.isorce@samsung.com>
This commit is contained in:
parent
61cdb7665f
commit
a87a1420d6
5 changed files with 7 additions and 22 deletions
|
|
@ -212,6 +212,7 @@ VAStatus
|
|||
vlVaAcquireBufferHandle(VADriverContextP ctx, VABufferID buf_id,
|
||||
VABufferInfo *out_buf_info)
|
||||
{
|
||||
vlVaDriver *drv;
|
||||
uint32_t i;
|
||||
uint32_t mem_type;
|
||||
vlVaBuffer *buf ;
|
||||
|
|
@ -255,13 +256,9 @@ vlVaAcquireBufferHandle(VADriverContextP ctx, VABufferID buf_id,
|
|||
if (!buf->derived_surface.resource)
|
||||
return VA_STATUS_ERROR_INVALID_BUFFER;
|
||||
|
||||
drv = VL_VA_DRIVER(ctx);
|
||||
screen = VL_VA_PSCREEN(ctx);
|
||||
|
||||
if (buf->derived_surface.fence) {
|
||||
screen->fence_finish(screen, buf->derived_surface.fence, PIPE_TIMEOUT_INFINITE);
|
||||
screen->fence_reference(screen, &buf->derived_surface.fence, NULL);
|
||||
}
|
||||
|
||||
if (buf->export_refcount > 0) {
|
||||
if (buf->export_state.mem_type != mem_type)
|
||||
return VA_STATUS_ERROR_INVALID_PARAMETER;
|
||||
|
|
@ -272,6 +269,8 @@ vlVaAcquireBufferHandle(VADriverContextP ctx, VABufferID buf_id,
|
|||
case VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME: {
|
||||
struct winsys_handle whandle;
|
||||
|
||||
drv->pipe->flush(drv->pipe, NULL, 0);
|
||||
|
||||
memset(&whandle, 0, sizeof(whandle));
|
||||
whandle.type = DRM_API_HANDLE_TYPE_FD;
|
||||
|
||||
|
|
|
|||
|
|
@ -266,7 +266,6 @@ vlVaDeriveImage(VADriverContextP ctx, VASurfaceID surface, VAImage *image)
|
|||
img_buf->type = VAImageBufferType;
|
||||
img_buf->size = img->data_size;
|
||||
img_buf->num_elements = 1;
|
||||
img_buf->derived_surface.fence = surf->fence;
|
||||
|
||||
pipe_resource_reference(&img_buf->derived_surface.resource, surfaces[0]->texture);
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@ vlVaHandleVAProcPipelineParameterBufferType(vlVaDriver *drv, vlVaContext *contex
|
|||
vlVaSurface *src_surface;
|
||||
VAProcPipelineParameterBuffer *pipeline_param;
|
||||
struct pipe_surface **surfaces;
|
||||
struct pipe_screen *screen;
|
||||
struct pipe_surface *psurf;
|
||||
|
||||
if (!drv || !context)
|
||||
|
|
@ -77,8 +76,6 @@ vlVaHandleVAProcPipelineParameterBufferType(vlVaDriver *drv, vlVaContext *contex
|
|||
if (!surfaces || !surfaces[0])
|
||||
return VA_STATUS_ERROR_INVALID_SURFACE;
|
||||
|
||||
screen = drv->pipe->screen;
|
||||
|
||||
psurf = surfaces[0];
|
||||
|
||||
src_region = vlVaRegionDefault(pipeline_param->surface_region, src_surface->buffer, &def_src_region);
|
||||
|
|
@ -99,8 +96,8 @@ vlVaHandleVAProcPipelineParameterBufferType(vlVaDriver *drv, vlVaContext *contex
|
|||
vl_compositor_set_layer_dst_area(&drv->cstate, 0, &dst_rect);
|
||||
vl_compositor_render(&drv->cstate, &drv->compositor, psurf, NULL, false);
|
||||
|
||||
screen->fence_reference(screen, &src_surface->fence, NULL);
|
||||
drv->pipe->flush(drv->pipe, &src_surface->fence, 0);
|
||||
// TODO: figure out why this is necessary for DMA-buf sharing
|
||||
drv->pipe->flush(drv->pipe, NULL, 0);
|
||||
|
||||
return VA_STATUS_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,8 +72,6 @@ vlVaDestroySurfaces(VADriverContextP ctx, VASurfaceID *surface_list, int num_sur
|
|||
vlVaSurface *surf = handle_table_get(drv->htab, surface_list[i]);
|
||||
if (surf->buffer)
|
||||
surf->buffer->destroy(surf->buffer);
|
||||
if(surf->fence)
|
||||
drv->pipe->screen->fence_reference(drv->pipe->screen, &surf->fence, NULL);
|
||||
util_dynarray_fini(&surf->subpics);
|
||||
FREE(surf);
|
||||
handle_table_remove(drv->htab, surface_list[i]);
|
||||
|
|
@ -245,11 +243,6 @@ vlVaPutSurface(VADriverContextP ctx, VASurfaceID surface_id, void* draw, short s
|
|||
screen = drv->pipe->screen;
|
||||
vscreen = drv->vscreen;
|
||||
|
||||
if(surf->fence) {
|
||||
screen->fence_finish(screen, surf->fence, PIPE_TIMEOUT_INFINITE);
|
||||
screen->fence_reference(screen, &surf->fence, NULL);
|
||||
}
|
||||
|
||||
tex = vscreen->texture_from_drawable(vscreen, draw);
|
||||
if (!tex)
|
||||
return VA_STATUS_ERROR_INVALID_DISPLAY;
|
||||
|
|
@ -281,8 +274,7 @@ vlVaPutSurface(VADriverContextP ctx, VASurfaceID surface_id, void* draw, short s
|
|||
screen->flush_frontbuffer(screen, tex, 0, 0,
|
||||
vscreen->get_private(vscreen), NULL);
|
||||
|
||||
screen->fence_reference(screen, &surf->fence, NULL);
|
||||
drv->pipe->flush(drv->pipe, &surf->fence, 0);
|
||||
drv->pipe->flush(drv->pipe, NULL, 0);
|
||||
|
||||
pipe_resource_reference(&tex, NULL);
|
||||
pipe_surface_reference(&surf_draw, NULL);
|
||||
|
|
|
|||
|
|
@ -244,7 +244,6 @@ typedef struct {
|
|||
struct {
|
||||
struct pipe_resource *resource;
|
||||
struct pipe_transfer *transfer;
|
||||
struct pipe_fence_handle *fence;
|
||||
} derived_surface;
|
||||
unsigned int export_refcount;
|
||||
VABufferInfo export_state;
|
||||
|
|
@ -252,7 +251,6 @@ typedef struct {
|
|||
|
||||
typedef struct {
|
||||
struct pipe_video_buffer templat, *buffer;
|
||||
struct pipe_fence_handle *fence;
|
||||
struct util_dynarray subpics; /* vlVaSubpicture */
|
||||
} vlVaSurface;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue