aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorNayan Deshmukh <[email protected]>2017-01-11 22:27:15 +0530
committerChristian König <[email protected]>2017-01-17 11:52:03 +0100
commit3a8f316e7b7f7dc5d913d117ec47e26587ce8177 (patch)
treeb60f24716606c2efd2fb10e318ccf4ea8a1453ae /src/gallium
parent15bfdea99c7b487d2c38d6dd7b88fb44810ef75a (diff)
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 <[email protected]> Acked-by: Christian König <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/state_trackers/vdpau/bitmap.c2
-rw-r--r--src/gallium/state_trackers/vdpau/device.c50
-rw-r--r--src/gallium/state_trackers/vdpau/mixer.c93
-rw-r--r--src/gallium/state_trackers/vdpau/output.c9
-rw-r--r--src/gallium/state_trackers/vdpau/presentation.c30
-rw-r--r--src/gallium/state_trackers/vdpau/vdpau_private.h9
6 files changed, 52 insertions, 141 deletions
diff --git a/src/gallium/state_trackers/vdpau/bitmap.c b/src/gallium/state_trackers/vdpau/bitmap.c
index fd67a986c61..d9ec60d20ad 100644
--- a/src/gallium/state_trackers/vdpau/bitmap.c
+++ b/src/gallium/state_trackers/vdpau/bitmap.c
@@ -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,
diff --git a/src/gallium/state_trackers/vdpau/device.c b/src/gallium/state_trackers/vdpau/device.c
index 8bae0647720..4f4ffdffe7d 100644
--- a/src/gallium/state_trackers/vdpau/device.c
+++ b/src/gallium/state_trackers/vdpau/device.c
@@ -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;
-}
diff --git a/src/gallium/state_trackers/vdpau/mixer.c b/src/gallium/state_trackers/vdpau/mixer.c
index 10141748968..37a6fcd91ce 100644
--- a/src/gallium/state_trackers/vdpau/mixer.c
+++ b/src/gallium/state_trackers/vdpau/mixer.c
@@ -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);
-
- 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);
-
- pipe_sampler_view_reference(&sampler_view, NULL);
- pipe_surface_reference(&surface, NULL);
-
- sampler_view = sampler_view_temp;
- surface = surface_temp;
- }
- }
+ vl_compositor_render(&vmixer->cstate, compositor, surface, &dirty_area, true);
- 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);
+ 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_matrix_filter_render(vmixer->sharpness.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);
+ pipe_sampler_view_reference(&sampler_view, NULL);
+ pipe_surface_reference(&surface, NULL);
- sampler_view = sampler_view_temp;
- surface = surface_temp;
- }
+ 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 (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);
- 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->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;
diff --git a/src/gallium/state_trackers/vdpau/output.c b/src/gallium/state_trackers/vdpau/output.c
index 8ddf2c1b55c..98a8011f0a6 100644
--- a/src/gallium/state_trackers/vdpau/output.c
+++ b/src/gallium/state_trackers/vdpau/output.c
@@ -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));
diff --git a/src/gallium/state_trackers/vdpau/presentation.c b/src/gallium/state_trackers/vdpau/presentation.c
index b2c8aea45c9..d4793692f90 100644
--- a/src/gallium/state_trackers/vdpau/presentation.c
+++ b/src/gallium/state_trackers/vdpau/presentation.c
@@ -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) {
-
- // 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);
- }
+ 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);
}
vscreen->set_next_timestamp(vscreen, earliest_presentation_time);
diff --git a/src/gallium/state_trackers/vdpau/vdpau_private.h b/src/gallium/state_trackers/vdpau/vdpau_private.h
index bcd4bb181c7..490a0bd308a 100644
--- a/src/gallium/state_trackers/vdpau/vdpau_private.h
+++ b/src/gallium/state_trackers/vdpau/vdpau_private.h
@@ -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;