VdpGetProcAddress **get_proc_address)
{
struct pipe_screen *pscreen;
+ struct pipe_resource *res, res_tmpl;
+ struct pipe_sampler_view sv_tmpl;
vlVdpDevice *dev = NULL;
VdpStatus ret;
goto no_context;
}
+ memset(&res_tmpl, 0, sizeof(res_tmpl));
+
+ res_tmpl.target = PIPE_TEXTURE_2D;
+ res_tmpl.format = PIPE_FORMAT_R8G8B8A8_UNORM;
+ res_tmpl.width0 = 1;
+ res_tmpl.height0 = 1;
+ res_tmpl.depth0 = 1;
+ res_tmpl.array_size = 1;
+ res_tmpl.bind = PIPE_BIND_SAMPLER_VIEW;
+ res_tmpl.usage = PIPE_USAGE_DEFAULT;
+
+ if (!CheckSurfaceParams(pscreen, &res_tmpl)) {
+ ret = VDP_STATUS_NO_IMPLEMENTATION;
+ goto no_resource;
+ }
+
+ res = pscreen->resource_create(pscreen, &res_tmpl);
+ if (!res) {
+ ret = VDP_STATUS_RESOURCES;
+ goto no_resource;
+ }
+
+ memset(&sv_tmpl, 0, sizeof(sv_tmpl));
+ u_sampler_view_default_template(&sv_tmpl, res, res->format);
+
+ sv_tmpl.swizzle_r = PIPE_SWIZZLE_ONE;
+ sv_tmpl.swizzle_g = PIPE_SWIZZLE_ONE;
+ sv_tmpl.swizzle_b = PIPE_SWIZZLE_ONE;
+ sv_tmpl.swizzle_a = PIPE_SWIZZLE_ONE;
+
+ dev->dummy_sv = dev->context->create_sampler_view(dev->context, res, &sv_tmpl);
+ pipe_resource_reference(&res, NULL);
+ if (!dev->dummy_sv) {
+ ret = VDP_STATUS_RESOURCES;
+ goto no_resource;
+ }
+
*device = vlAddDataHTAB(dev);
if (*device == 0) {
ret = VDP_STATUS_ERROR;
return VDP_STATUS_OK;
no_handle:
+ pipe_sampler_view_reference(&dev->dummy_sv, NULL);
+no_resource:
dev->context->destroy(dev->context);
- /* Destroy vscreen */
no_context:
vl_screen_destroy(dev->vscreen);
no_vscreen:
{
pipe_mutex_destroy(dev->mutex);
vl_compositor_cleanup(&dev->compositor);
+ pipe_sampler_view_reference(&dev->dummy_sv, NULL);
dev->context->destroy(dev->context);
vl_screen_destroy(dev->vscreen);
FREE(dev);
uint32_t flags)
{
vlVdpOutputSurface *dst_vlsurface;
- vlVdpOutputSurface *src_vlsurface;
struct pipe_context *context;
+ struct pipe_sampler_view *src_sv;
struct vl_compositor *compositor;
struct vl_compositor_state *cstate;
if (!dst_vlsurface)
return VDP_STATUS_INVALID_HANDLE;
- src_vlsurface = vlGetDataHTAB(source_surface);
- if (!src_vlsurface)
- return VDP_STATUS_INVALID_HANDLE;
+ if (source_surface == VDP_INVALID_HANDLE) {
+ src_sv = dst_vlsurface->device->dummy_sv;
+
+ } else {
+ vlVdpOutputSurface *src_vlsurface = vlGetDataHTAB(source_surface);
+ if (!src_vlsurface)
+ return VDP_STATUS_INVALID_HANDLE;
- if (dst_vlsurface->device != src_vlsurface->device)
- return VDP_STATUS_HANDLE_DEVICE_MISMATCH;
+ if (dst_vlsurface->device != src_vlsurface->device)
+ return VDP_STATUS_HANDLE_DEVICE_MISMATCH;
+
+ src_sv = src_vlsurface->sampler_view;
+ }
pipe_mutex_lock(dst_vlsurface->device->mutex);
vlVdpResolveDelayedRendering(dst_vlsurface->device, NULL, NULL);
vl_compositor_clear_layers(cstate);
vl_compositor_set_layer_blend(cstate, 0, blend, false);
- vl_compositor_set_rgba_layer(cstate, compositor, 0, src_vlsurface->sampler_view,
+ vl_compositor_set_rgba_layer(cstate, compositor, 0, src_sv,
RectToPipe(source_rect, &src_rect), NULL,
ColorsToPipe(colors, flags, vlcolors));
STATIC_ASSERT(VL_COMPOSITOR_ROTATE_0 == VDP_OUTPUT_SURFACE_RENDER_ROTATE_0);
uint32_t flags)
{
vlVdpOutputSurface *dst_vlsurface;
- vlVdpBitmapSurface *src_vlsurface;
struct pipe_context *context;
+ struct pipe_sampler_view *src_sv;
struct vl_compositor *compositor;
struct vl_compositor_state *cstate;
if (!dst_vlsurface)
return VDP_STATUS_INVALID_HANDLE;
- src_vlsurface = vlGetDataHTAB(source_surface);
- if (!src_vlsurface)
- return VDP_STATUS_INVALID_HANDLE;
+ if (source_surface == VDP_INVALID_HANDLE) {
+ src_sv = dst_vlsurface->device->dummy_sv;
+
+ } else {
+ vlVdpBitmapSurface *src_vlsurface = vlGetDataHTAB(source_surface);
+ if (!src_vlsurface)
+ return VDP_STATUS_INVALID_HANDLE;
- if (dst_vlsurface->device != src_vlsurface->device)
- return VDP_STATUS_HANDLE_DEVICE_MISMATCH;
+ if (dst_vlsurface->device != src_vlsurface->device)
+ return VDP_STATUS_HANDLE_DEVICE_MISMATCH;
+
+ src_sv = src_vlsurface->sampler_view;
+ }
context = dst_vlsurface->device->context;
compositor = &dst_vlsurface->device->compositor;
vl_compositor_clear_layers(cstate);
vl_compositor_set_layer_blend(cstate, 0, blend, false);
- vl_compositor_set_rgba_layer(cstate, compositor, 0, src_vlsurface->sampler_view,
+ vl_compositor_set_rgba_layer(cstate, compositor, 0, src_sv,
RectToPipe(source_rect, &src_rect), NULL,
ColorsToPipe(colors, flags, vlcolors));
vl_compositor_set_layer_rotation(cstate, 0, flags & 3);