diff options
author | Christian König <[email protected]> | 2012-02-25 23:34:31 +0100 |
---|---|---|
committer | Christian König <[email protected]> | 2012-03-02 13:14:21 +0100 |
commit | f8ac7e034803a1c873bf156c012fede6d2640097 (patch) | |
tree | 2f396c39f3b69b96987ce27a04ab5b8c89b1b55b /src/gallium/state_trackers/vdpau/device.c | |
parent | 14766f820069ca987543918bce96410c481e5d20 (diff) |
st/vdpau: avoid an unnessasary copy
Delay the actual mixer rendering until we really
know which surface is the real destination.
Signed-off-by: Christian König <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/vdpau/device.c')
-rw-r--r-- | src/gallium/state_trackers/vdpau/device.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/vdpau/device.c b/src/gallium/state_trackers/vdpau/device.c index f4a3dc04bfb..482b71e9a0d 100644 --- a/src/gallium/state_trackers/vdpau/device.c +++ b/src/gallium/state_trackers/vdpau/device.c @@ -29,6 +29,7 @@ #include "util/u_memory.h" #include "util/u_debug.h" +#include "util/u_sampler.h" #include "vl_winsys.h" @@ -237,3 +238,54 @@ vlVdpGetErrorString (VdpStatus status) default: return "Unknown Error"; } } + +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); + + 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; + + memset(&sv_templ, 0, sizeof(sv_templ)); + u_sampler_view_default_template(&sv_templ, res, res->format); + pipe_sampler_view_reference(&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; +} |