mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 18:18:06 +02:00
st/vdpau: remove the delayed rendering hack(v1.1)
the hack was introduced to avoid an extra copying but now with dri3 we don't need it anymore v1.1: rebasing Signed-off-by: Nayan Deshmukh <nayan26deshmukh@gmail.com> Acked-by: Christian König <christian.koenig@amd.com>
This commit is contained in:
parent
15bfdea99c
commit
3a8f316e7b
6 changed files with 55 additions and 144 deletions
|
|
@ -198,8 +198,6 @@ vlVdpBitmapSurfacePutBitsNative(VdpBitmapSurface surface,
|
|||
|
||||
pipe_mutex_lock(vlsurface->device->mutex);
|
||||
|
||||
vlVdpResolveDelayedRendering(vlsurface->device, NULL, NULL);
|
||||
|
||||
dst_box = RectToPipeBox(destination_rect, vlsurface->sampler_view->texture);
|
||||
pipe->texture_subdata(pipe, vlsurface->sampler_view->texture, 0,
|
||||
PIPE_TRANSFER_WRITE, &dst_box, *source_data,
|
||||
|
|
|
|||
|
|
@ -327,53 +327,3 @@ vlVdpDefaultSamplerViewTemplate(struct pipe_sampler_view *templ, struct pipe_res
|
|||
if (desc->swizzle[3] == PIPE_SWIZZLE_0)
|
||||
templ->swizzle_a = PIPE_SWIZZLE_1;
|
||||
}
|
||||
|
||||
void
|
||||
vlVdpResolveDelayedRendering(vlVdpDevice *dev, struct pipe_surface *surface, struct u_rect *dirty_area)
|
||||
{
|
||||
struct vl_compositor_state *cstate;
|
||||
vlVdpOutputSurface *vlsurface;
|
||||
|
||||
assert(dev);
|
||||
|
||||
cstate = dev->delayed_rendering.cstate;
|
||||
if (!cstate)
|
||||
return;
|
||||
|
||||
vlsurface = vlGetDataHTAB(dev->delayed_rendering.surface);
|
||||
if (!vlsurface)
|
||||
return;
|
||||
|
||||
if (!surface) {
|
||||
surface = vlsurface->surface;
|
||||
dirty_area = &vlsurface->dirty_area;
|
||||
}
|
||||
|
||||
vl_compositor_render(cstate, &dev->compositor, surface, dirty_area, true);
|
||||
|
||||
dev->delayed_rendering.surface = VDP_INVALID_HANDLE;
|
||||
dev->delayed_rendering.cstate = NULL;
|
||||
|
||||
/* test if we need to create a new sampler for the just filled texture */
|
||||
if (surface->texture != vlsurface->sampler_view->texture) {
|
||||
struct pipe_resource *res = surface->texture;
|
||||
struct pipe_sampler_view sv_templ;
|
||||
|
||||
vlVdpDefaultSamplerViewTemplate(&sv_templ, res);
|
||||
pipe_sampler_view_reference(&vlsurface->sampler_view, NULL);
|
||||
vlsurface->sampler_view = dev->context->create_sampler_view(dev->context, res, &sv_templ);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
vlVdpSave4DelayedRendering(vlVdpDevice *dev, VdpOutputSurface surface, struct vl_compositor_state *cstate)
|
||||
{
|
||||
assert(dev);
|
||||
|
||||
vlVdpResolveDelayedRendering(dev, NULL, NULL);
|
||||
|
||||
dev->delayed_rendering.surface = surface;
|
||||
dev->delayed_rendering.cstate = cstate;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -193,8 +193,6 @@ vlVdpVideoMixerDestroy(VdpVideoMixer mixer)
|
|||
|
||||
pipe_mutex_lock(vmixer->device->mutex);
|
||||
|
||||
vlVdpResolveDelayedRendering(vmixer->device, NULL, NULL);
|
||||
|
||||
vlRemoveDataHTAB(mixer);
|
||||
|
||||
vl_compositor_cleanup_state(&vmixer->cstate);
|
||||
|
|
@ -293,7 +291,6 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer,
|
|||
}
|
||||
|
||||
pipe_mutex_lock(vmixer->device->mutex);
|
||||
vlVdpResolveDelayedRendering(vmixer->device, NULL, NULL);
|
||||
|
||||
vl_compositor_clear_layers(&vmixer->cstate);
|
||||
|
||||
|
|
@ -403,64 +400,60 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer,
|
|||
++layers;
|
||||
}
|
||||
|
||||
if (!vmixer->noise_reduction.filter && !vmixer->sharpness.filter && !vmixer->bicubic.filter)
|
||||
vlVdpSave4DelayedRendering(vmixer->device, destination_surface, &vmixer->cstate);
|
||||
else {
|
||||
vl_compositor_render(&vmixer->cstate, compositor, surface, &dirty_area, true);
|
||||
vl_compositor_render(&vmixer->cstate, compositor, surface, &dirty_area, true);
|
||||
|
||||
if (vmixer->noise_reduction.filter) {
|
||||
if (!vmixer->sharpness.filter && !vmixer->bicubic.filter) {
|
||||
vl_median_filter_render(vmixer->noise_reduction.filter,
|
||||
sampler_view, dst->surface);
|
||||
} else {
|
||||
res = pipe->screen->resource_create(pipe->screen, &res_tmpl);
|
||||
struct pipe_sampler_view *sampler_view_temp = pipe->create_sampler_view(pipe, res, &sv_templ);
|
||||
struct pipe_surface *surface_temp = pipe->create_surface(pipe, res, &surf_templ);
|
||||
pipe_resource_reference(&res, NULL);
|
||||
if (vmixer->noise_reduction.filter) {
|
||||
if (!vmixer->sharpness.filter && !vmixer->bicubic.filter) {
|
||||
vl_median_filter_render(vmixer->noise_reduction.filter,
|
||||
sampler_view, dst->surface);
|
||||
} else {
|
||||
res = pipe->screen->resource_create(pipe->screen, &res_tmpl);
|
||||
struct pipe_sampler_view *sampler_view_temp = pipe->create_sampler_view(pipe, res, &sv_templ);
|
||||
struct pipe_surface *surface_temp = pipe->create_surface(pipe, res, &surf_templ);
|
||||
pipe_resource_reference(&res, NULL);
|
||||
|
||||
vl_median_filter_render(vmixer->noise_reduction.filter,
|
||||
sampler_view, surface_temp);
|
||||
vl_median_filter_render(vmixer->noise_reduction.filter,
|
||||
sampler_view, surface_temp);
|
||||
|
||||
pipe_sampler_view_reference(&sampler_view, NULL);
|
||||
pipe_surface_reference(&surface, NULL);
|
||||
|
||||
sampler_view = sampler_view_temp;
|
||||
surface = surface_temp;
|
||||
}
|
||||
}
|
||||
|
||||
if (vmixer->sharpness.filter) {
|
||||
if (!vmixer->bicubic.filter) {
|
||||
vl_matrix_filter_render(vmixer->sharpness.filter,
|
||||
sampler_view, dst->surface);
|
||||
} else {
|
||||
res = pipe->screen->resource_create(pipe->screen, &res_tmpl);
|
||||
struct pipe_sampler_view *sampler_view_temp = pipe->create_sampler_view(pipe, res, &sv_templ);
|
||||
struct pipe_surface *surface_temp = pipe->create_surface(pipe, res, &surf_templ);
|
||||
pipe_resource_reference(&res, NULL);
|
||||
|
||||
vl_matrix_filter_render(vmixer->sharpness.filter,
|
||||
sampler_view, surface_temp);
|
||||
|
||||
pipe_sampler_view_reference(&sampler_view, NULL);
|
||||
pipe_surface_reference(&surface, NULL);
|
||||
|
||||
sampler_view = sampler_view_temp;
|
||||
surface = surface_temp;
|
||||
}
|
||||
}
|
||||
|
||||
if (vmixer->bicubic.filter)
|
||||
vl_bicubic_filter_render(vmixer->bicubic.filter,
|
||||
sampler_view, dst->surface,
|
||||
RectToPipe(destination_video_rect, &rect),
|
||||
RectToPipe(destination_rect, &clip));
|
||||
|
||||
if(surface != dst->surface) {
|
||||
pipe_sampler_view_reference(&sampler_view, NULL);
|
||||
pipe_surface_reference(&surface, NULL);
|
||||
|
||||
sampler_view = sampler_view_temp;
|
||||
surface = surface_temp;
|
||||
}
|
||||
}
|
||||
|
||||
if (vmixer->sharpness.filter) {
|
||||
if (!vmixer->bicubic.filter) {
|
||||
vl_matrix_filter_render(vmixer->sharpness.filter,
|
||||
sampler_view, dst->surface);
|
||||
} else {
|
||||
res = pipe->screen->resource_create(pipe->screen, &res_tmpl);
|
||||
struct pipe_sampler_view *sampler_view_temp = pipe->create_sampler_view(pipe, res, &sv_templ);
|
||||
struct pipe_surface *surface_temp = pipe->create_surface(pipe, res, &surf_templ);
|
||||
pipe_resource_reference(&res, NULL);
|
||||
|
||||
vl_matrix_filter_render(vmixer->sharpness.filter,
|
||||
sampler_view, surface_temp);
|
||||
|
||||
pipe_sampler_view_reference(&sampler_view, NULL);
|
||||
pipe_surface_reference(&surface, NULL);
|
||||
|
||||
sampler_view = sampler_view_temp;
|
||||
surface = surface_temp;
|
||||
}
|
||||
}
|
||||
|
||||
if (vmixer->bicubic.filter)
|
||||
vl_bicubic_filter_render(vmixer->bicubic.filter,
|
||||
sampler_view, dst->surface,
|
||||
RectToPipe(destination_video_rect, &rect),
|
||||
RectToPipe(destination_rect, &clip));
|
||||
|
||||
if(surface != dst->surface) {
|
||||
pipe_sampler_view_reference(&sampler_view, NULL);
|
||||
pipe_surface_reference(&surface, NULL);
|
||||
}
|
||||
pipe_mutex_unlock(vmixer->device->mutex);
|
||||
|
||||
return VDP_STATUS_OK;
|
||||
|
|
|
|||
|
|
@ -146,7 +146,6 @@ vlVdpOutputSurfaceDestroy(VdpOutputSurface surface)
|
|||
pipe = vlsurface->device->context;
|
||||
|
||||
pipe_mutex_lock(vlsurface->device->mutex);
|
||||
vlVdpResolveDelayedRendering(vlsurface->device, NULL, NULL);
|
||||
|
||||
pipe_surface_reference(&vlsurface->surface, NULL);
|
||||
pipe_sampler_view_reference(&vlsurface->sampler_view, NULL);
|
||||
|
|
@ -211,7 +210,6 @@ vlVdpOutputSurfaceGetBitsNative(VdpOutputSurface surface,
|
|||
return VDP_STATUS_INVALID_POINTER;
|
||||
|
||||
pipe_mutex_lock(vlsurface->device->mutex);
|
||||
vlVdpResolveDelayedRendering(vlsurface->device, NULL, NULL);
|
||||
|
||||
res = vlsurface->sampler_view->texture;
|
||||
box = RectToPipeBox(source_rect, res);
|
||||
|
|
@ -256,7 +254,6 @@ vlVdpOutputSurfacePutBitsNative(VdpOutputSurface surface,
|
|||
return VDP_STATUS_INVALID_POINTER;
|
||||
|
||||
pipe_mutex_lock(vlsurface->device->mutex);
|
||||
vlVdpResolveDelayedRendering(vlsurface->device, NULL, NULL);
|
||||
|
||||
dst_box = RectToPipeBox(destination_rect, vlsurface->sampler_view->texture);
|
||||
pipe->texture_subdata(pipe, vlsurface->sampler_view->texture, 0,
|
||||
|
|
@ -334,7 +331,6 @@ vlVdpOutputSurfacePutBitsIndexed(VdpOutputSurface surface,
|
|||
res_tmpl.bind = PIPE_BIND_SAMPLER_VIEW;
|
||||
|
||||
pipe_mutex_lock(vlsurface->device->mutex);
|
||||
vlVdpResolveDelayedRendering(vlsurface->device, NULL, NULL);
|
||||
|
||||
if (!CheckSurfaceParams(context->screen, &res_tmpl))
|
||||
goto error_resource;
|
||||
|
|
@ -452,7 +448,6 @@ vlVdpOutputSurfacePutBitsYCbCr(VdpOutputSurface surface,
|
|||
return VDP_STATUS_INVALID_POINTER;
|
||||
|
||||
pipe_mutex_lock(vlsurface->device->mutex);
|
||||
vlVdpResolveDelayedRendering(vlsurface->device, NULL, NULL);
|
||||
memset(&vtmpl, 0, sizeof(vtmpl));
|
||||
vtmpl.buffer_format = format;
|
||||
vtmpl.chroma_format = FormatYCBCRToPipeChroma(source_ycbcr_format);
|
||||
|
|
@ -671,7 +666,6 @@ vlVdpOutputSurfaceRenderOutputSurface(VdpOutputSurface destination_surface,
|
|||
}
|
||||
|
||||
pipe_mutex_lock(dst_vlsurface->device->mutex);
|
||||
vlVdpResolveDelayedRendering(dst_vlsurface->device, NULL, NULL);
|
||||
|
||||
context = dst_vlsurface->device->context;
|
||||
compositor = &dst_vlsurface->device->compositor;
|
||||
|
|
@ -746,7 +740,6 @@ vlVdpOutputSurfaceRenderBitmapSurface(VdpOutputSurface destination_surface,
|
|||
cstate = &dst_vlsurface->cstate;
|
||||
|
||||
pipe_mutex_lock(dst_vlsurface->device->mutex);
|
||||
vlVdpResolveDelayedRendering(dst_vlsurface->device, NULL, NULL);
|
||||
|
||||
blend = BlenderToPipe(context, blend_state);
|
||||
|
||||
|
|
@ -774,7 +767,6 @@ struct pipe_resource *vlVdpOutputSurfaceGallium(VdpOutputSurface surface)
|
|||
return NULL;
|
||||
|
||||
pipe_mutex_lock(vlsurface->device->mutex);
|
||||
vlVdpResolveDelayedRendering(vlsurface->device, NULL, NULL);
|
||||
vlsurface->device->context->flush(vlsurface->device->context, NULL, 0);
|
||||
pipe_mutex_unlock(vlsurface->device->mutex);
|
||||
|
||||
|
|
@ -796,7 +788,6 @@ VdpStatus vlVdpOutputSurfaceDMABuf(VdpOutputSurface surface,
|
|||
return VDP_STATUS_INVALID_HANDLE;
|
||||
|
||||
pipe_mutex_lock(vlsurface->device->mutex);
|
||||
vlVdpResolveDelayedRendering(vlsurface->device, NULL, NULL);
|
||||
vlsurface->device->context->flush(vlsurface->device->context, NULL, 0);
|
||||
|
||||
memset(&whandle, 0, sizeof(struct winsys_handle));
|
||||
|
|
|
|||
|
|
@ -251,27 +251,15 @@ vlVdpPresentationQueueDisplay(VdpPresentationQueue presentation_queue,
|
|||
dst_clip.x1 = clip_width ? clip_width : surf_draw->width;
|
||||
dst_clip.y1 = clip_height ? clip_height : surf_draw->height;
|
||||
|
||||
if (pq->device->delayed_rendering.surface == surface &&
|
||||
dst_clip.x1 == surf_draw->width && dst_clip.y1 == surf_draw->height) {
|
||||
src_rect.x0 = 0;
|
||||
src_rect.y0 = 0;
|
||||
src_rect.x1 = surf_draw->width;
|
||||
src_rect.y1 = surf_draw->height;
|
||||
|
||||
// TODO: we correctly support the clipping here, but not the pq background color in the clipped area....
|
||||
cstate = pq->device->delayed_rendering.cstate;
|
||||
vl_compositor_set_dst_clip(cstate, &dst_clip);
|
||||
vlVdpResolveDelayedRendering(pq->device, surf_draw, dirty_area);
|
||||
|
||||
} else {
|
||||
vlVdpResolveDelayedRendering(pq->device, NULL, NULL);
|
||||
|
||||
src_rect.x0 = 0;
|
||||
src_rect.y0 = 0;
|
||||
src_rect.x1 = surf_draw->width;
|
||||
src_rect.y1 = surf_draw->height;
|
||||
|
||||
vl_compositor_clear_layers(cstate);
|
||||
vl_compositor_set_rgba_layer(cstate, compositor, 0, surf->sampler_view, &src_rect, NULL, NULL);
|
||||
vl_compositor_set_dst_clip(cstate, &dst_clip);
|
||||
vl_compositor_render(cstate, compositor, surf_draw, dirty_area, true);
|
||||
}
|
||||
vl_compositor_clear_layers(cstate);
|
||||
vl_compositor_set_rgba_layer(cstate, compositor, 0, surf->sampler_view, &src_rect, NULL, NULL);
|
||||
vl_compositor_set_dst_clip(cstate, &dst_clip);
|
||||
vl_compositor_render(cstate, compositor, surf_draw, dirty_area, true);
|
||||
}
|
||||
|
||||
vscreen->set_next_timestamp(vscreen, earliest_presentation_time);
|
||||
|
|
|
|||
|
|
@ -351,11 +351,6 @@ typedef struct
|
|||
struct vl_compositor compositor;
|
||||
struct pipe_sampler_view *dummy_sv;
|
||||
pipe_mutex mutex;
|
||||
|
||||
struct {
|
||||
struct vl_compositor_state *cstate;
|
||||
VdpOutputSurface surface;
|
||||
} delayed_rendering;
|
||||
} vlVdpDevice;
|
||||
|
||||
typedef struct
|
||||
|
|
@ -458,10 +453,6 @@ VdpDeviceCreateX11 vdp_imp_device_create_x11;
|
|||
|
||||
void vlVdpDefaultSamplerViewTemplate(struct pipe_sampler_view *templ, struct pipe_resource *res);
|
||||
|
||||
/* Delayed rendering funtionality */
|
||||
void vlVdpResolveDelayedRendering(vlVdpDevice *dev, struct pipe_surface *surface, struct u_rect *dirty_area);
|
||||
void vlVdpSave4DelayedRendering(vlVdpDevice *dev, VdpOutputSurface surface, struct vl_compositor_state *cstate);
|
||||
|
||||
/* Internal function pointers */
|
||||
VdpGetErrorString vlVdpGetErrorString;
|
||||
VdpDeviceDestroy vlVdpDeviceDestroy;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue