vlsurface->device = dev;
memset(&res_tmpl, 0, sizeof(res_tmpl));
-
res_tmpl.target = PIPE_TEXTURE_2D;
res_tmpl.format = FormatRGBAToPipe(rgba_format);
res_tmpl.width0 = width;
res_tmpl.array_size = 1;
res_tmpl.bind = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET;
res_tmpl.usage = frequently_accessed ? PIPE_USAGE_DYNAMIC : PIPE_USAGE_STATIC;
+
+ pipe_mutex_lock(dev->mutex);
res = pipe->screen->resource_create(pipe->screen, &res_tmpl);
if (!res) {
+ pipe_mutex_unlock(dev->mutex);
FREE(dev);
return VDP_STATUS_RESOURCES;
}
vlVdpDefaultSamplerViewTemplate(&sv_templ, res);
vlsurface->sampler_view = pipe->create_sampler_view(pipe, res, &sv_templ);
+
+ pipe_resource_reference(&res, NULL);
+ pipe_mutex_unlock(dev->mutex);
+
if (!vlsurface->sampler_view) {
- pipe_resource_reference(&res, NULL);
FREE(dev);
return VDP_STATUS_RESOURCES;
}
*surface = vlAddDataHTAB(vlsurface);
if (*surface == 0) {
- pipe_resource_reference(&res, NULL);
FREE(dev);
return VDP_STATUS_ERROR;
}
- pipe_resource_reference(&res, NULL);
-
return VDP_STATUS_OK;
}
if (!vlsurface)
return VDP_STATUS_INVALID_HANDLE;
- vlVdpResolveDelayedRendering(vlsurface->device, NULL, NULL);
-
+ pipe_mutex_lock(vlsurface->device->mutex);
pipe_sampler_view_reference(&vlsurface->sampler_view, NULL);
+ pipe_mutex_unlock(vlsurface->device->mutex);
vlRemoveDataHTAB(surface);
FREE(vlsurface);
pipe = vlsurface->device->context;
+ pipe_mutex_lock(vlsurface->device->mutex);
+
vlVdpResolveDelayedRendering(vlsurface->device, NULL, NULL);
dst_box = RectToPipeBox(destination_rect, vlsurface->sampler_view->texture);
pipe->transfer_inline_write(pipe, vlsurface->sampler_view->texture, 0,
PIPE_TRANSFER_WRITE, &dst_box, *source_data,
*source_pitches, 0);
+
+ pipe_mutex_unlock(vlsurface->device->mutex);
+
return VDP_STATUS_OK;
}
pipe = dev->context;
screen = dev->vscreen->pscreen;
+
+ pipe_mutex_lock(dev->mutex);
+
supported = screen->get_video_param
(
screen,
p_profile,
PIPE_VIDEO_CAP_SUPPORTED
);
- if (!supported)
+ if (!supported) {
+ pipe_mutex_unlock(dev->mutex);
return VDP_STATUS_INVALID_DECODER_PROFILE;
+ }
vldecoder = CALLOC(1,sizeof(vlVdpDecoder));
- if (!vldecoder)
+ if (!vldecoder) {
+ pipe_mutex_unlock(dev->mutex);
return VDP_STATUS_RESOURCES;
+ }
vldecoder->device = dev;
ret = VDP_STATUS_ERROR;
goto error_handle;
}
+ pipe_mutex_unlock(dev->mutex);
return VDP_STATUS_OK;
error_handle:
-
vldecoder->decoder->destroy(vldecoder->decoder);
error_decoder:
+ pipe_mutex_unlock(dev->mutex);
FREE(vldecoder);
return ret;
}
if (!vldecoder)
return VDP_STATUS_INVALID_HANDLE;
+ pipe_mutex_lock(vldecoder->device->mutex);
vldecoder->decoder->destroy(vldecoder->decoder);
+ pipe_mutex_unlock(vldecoder->device->mutex);
FREE(vldecoder);
// TODO: Recreate decoder with correct chroma
return VDP_STATUS_INVALID_CHROMA_TYPE;
+ pipe_mutex_lock(vlsurf->device->mutex);
+
buffer_support[0] = screen->get_video_param(screen, dec->profile, PIPE_VIDEO_CAP_SUPPORTS_PROGRESSIVE);
buffer_support[1] = screen->get_video_param(screen, dec->profile, PIPE_VIDEO_CAP_SUPPORTS_INTERLACED);
vlsurf->video_buffer = dec->context->create_video_buffer(dec->context, &vlsurf->templat);
/* still no luck? get me out of here... */
- if (!vlsurf->video_buffer)
+ if (!vlsurf->video_buffer) {
+ pipe_mutex_unlock(vlsurf->device->mutex);
return VDP_STATUS_NO_IMPLEMENTATION;
+ }
}
memset(&desc, 0, sizeof(desc));
ret = vlVdpDecoderRenderH264(&desc.h264, (VdpPictureInfoH264 *)picture_info);
break;
default:
+ pipe_mutex_unlock(vlsurf->device->mutex);
return VDP_STATUS_INVALID_DECODER_PROFILE;
}
- if (ret != VDP_STATUS_OK)
+ if (ret != VDP_STATUS_OK) {
+ pipe_mutex_unlock(vlsurf->device->mutex);
return ret;
+ }
for (i = 0; i < bitstream_buffer_count; ++i) {
buffers[i] = bitstream_buffers[i].bitstream;
dec->begin_frame(dec, vlsurf->video_buffer, &desc.base);
dec->decode_bitstream(dec, vlsurf->video_buffer, &desc.base, bitstream_buffer_count, buffers, sizes);
dec->end_frame(dec, vlsurf->video_buffer, &desc.base);
+ pipe_mutex_unlock(vlsurf->device->mutex);
return ret;
}
}
vl_compositor_init(&dev->compositor, dev->context);
+ pipe_mutex_init(dev->mutex);
*get_proc_address = &vlVdpGetProcAddress;
vlVdpDevice *dev = vlGetDataHTAB(device);
if (!dev)
return VDP_STATUS_INVALID_HANDLE;
-
+
+ pipe_mutex_destroy(dev->mutex);
vl_compositor_cleanup(&dev->compositor);
dev->context->destroy(dev->context);
vl_screen_destroy(dev->vscreen);
return VDP_STATUS_RESOURCES;
vmixer->device = dev;
+
+ pipe_mutex_lock(dev->mutex);
+
vl_compositor_init_state(&vmixer->cstate, dev->context);
vl_csc_get_matrix(VL_CSC_COLOR_STANDARD_BT_601, NULL, true, &vmixer->csc);
}
vmixer->luma_key_min = 0.f;
vmixer->luma_key_max = 1.f;
+ pipe_mutex_unlock(dev->mutex);
return VDP_STATUS_OK;
no_handle:
vl_compositor_cleanup_state(&vmixer->cstate);
+ pipe_mutex_unlock(dev->mutex);
FREE(vmixer);
return ret;
}
if (!vmixer)
return VDP_STATUS_INVALID_HANDLE;
+ pipe_mutex_lock(vmixer->device->mutex);
+
vlVdpResolveDelayedRendering(vmixer->device, NULL, NULL);
vlRemoveDataHTAB(mixer);
vl_matrix_filter_cleanup(vmixer->sharpness.filter);
FREE(vmixer->sharpness.filter);
}
+ pipe_mutex_unlock(vmixer->device->mutex);
FREE(vmixer);
if (!vmixer)
return VDP_STATUS_INVALID_HANDLE;
- vlVdpResolveDelayedRendering(vmixer->device, NULL, NULL);
-
compositor = &vmixer->device->compositor;
surf = vlGetDataHTAB(video_surface_current);
if (!dst)
return VDP_STATUS_INVALID_HANDLE;
+ pipe_mutex_lock(vmixer->device->mutex);
+ vlVdpResolveDelayedRendering(vmixer->device, NULL, NULL);
if (background_surface != VDP_INVALID_HANDLE) {
vlVdpOutputSurface *bg = vlGetDataHTAB(background_surface);
- if (!bg)
+ if (!bg) {
+ pipe_mutex_unlock(vmixer->device->mutex);
return VDP_STATUS_INVALID_HANDLE;
+ }
vl_compositor_set_rgba_layer(&vmixer->cstate, compositor, layer++, bg->sampler_view,
RectToPipe(background_source_rect, &rect), NULL, NULL);
}
break;
default:
+ pipe_mutex_unlock(vmixer->device->mutex);
return VDP_STATUS_INVALID_VIDEO_MIXER_PICTURE_STRUCTURE;
};
vl_compositor_set_buffer_layer(&vmixer->cstate, compositor, layer, surf->video_buffer,
for (i = 0; i < layer_count; ++i) {
vlVdpOutputSurface *src = vlGetDataHTAB(layers->source_surface);
- if (!src)
+ if (!src) {
+ pipe_mutex_unlock(vmixer->device->mutex);
return VDP_STATUS_INVALID_HANDLE;
+ }
assert(layers->struct_version == VDP_LAYER_VERSION);
vl_matrix_filter_render(vmixer->sharpness.filter,
dst->sampler_view, dst->surface);
}
+ pipe_mutex_unlock(vmixer->device->mutex);
return VDP_STATUS_OK;
}
if (!vmixer)
return VDP_STATUS_INVALID_HANDLE;
+ pipe_mutex_lock(vmixer->device->mutex);
for (i = 0; i < feature_count; ++i) {
switch (features[i]) {
/* they are valid, but we doesn't support them */
break;
default:
+ pipe_mutex_unlock(vmixer->device->mutex);
return VDP_STATUS_INVALID_VIDEO_MIXER_FEATURE;
}
}
+ pipe_mutex_unlock(vmixer->device->mutex);
return VDP_STATUS_OK;
}
if (!vmixer)
return VDP_STATUS_INVALID_HANDLE;
+ pipe_mutex_lock(vmixer->device->mutex);
for (i = 0; i < attribute_count; ++i) {
switch (attributes[i]) {
case VDP_VIDEO_MIXER_ATTRIBUTE_BACKGROUND_COLOR:
vmixer->skip_chroma_deint = *(uint8_t*)attribute_values[i];
break;
default:
+ pipe_mutex_unlock(vmixer->device->mutex);
return VDP_STATUS_INVALID_VIDEO_MIXER_ATTRIBUTE;
}
}
+ pipe_mutex_unlock(vmixer->device->mutex);
return VDP_STATUS_OK;
}
if (!vmixer)
return VDP_STATUS_INVALID_HANDLE;
+ pipe_mutex_lock(vmixer->device->mutex);
for (i = 0; i < attribute_count; ++i) {
switch (attributes[i]) {
case VDP_VIDEO_MIXER_ATTRIBUTE_BACKGROUND_COLOR:
*(uint8_t*)attribute_values[i] = vmixer->skip_chroma_deint;
break;
default:
+ pipe_mutex_unlock(vmixer->device->mutex);
return VDP_STATUS_INVALID_VIDEO_MIXER_ATTRIBUTE;
}
}
+ pipe_mutex_unlock(vmixer->device->mutex);
return VDP_STATUS_OK;
}
res_tmpl.bind = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET;
res_tmpl.usage = PIPE_USAGE_STATIC;
+ pipe_mutex_lock(dev->mutex);
res = pipe->screen->resource_create(pipe->screen, &res_tmpl);
if (!res) {
+ pipe_mutex_unlock(dev->mutex);
FREE(dev);
return VDP_STATUS_ERROR;
}
vlsurface->sampler_view = pipe->create_sampler_view(pipe, res, &sv_templ);
if (!vlsurface->sampler_view) {
pipe_resource_reference(&res, NULL);
+ pipe_mutex_unlock(dev->mutex);
FREE(dev);
return VDP_STATUS_ERROR;
}
vlsurface->surface = pipe->create_surface(pipe, res, &surf_templ);
if (!vlsurface->surface) {
pipe_resource_reference(&res, NULL);
+ pipe_mutex_unlock(dev->mutex);
FREE(dev);
return VDP_STATUS_ERROR;
}
*surface = vlAddDataHTAB(vlsurface);
if (*surface == 0) {
pipe_resource_reference(&res, NULL);
+ pipe_mutex_unlock(dev->mutex);
FREE(dev);
return VDP_STATUS_ERROR;
}
vl_compositor_init_state(&vlsurface->cstate, pipe);
vl_compositor_reset_dirty_area(&vlsurface->dirty_area);
+ pipe_mutex_unlock(dev->mutex);
return VDP_STATUS_OK;
}
if (!vlsurface)
return VDP_STATUS_INVALID_HANDLE;
+ 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);
vl_compositor_cleanup_state(&vlsurface->cstate);
+ pipe_mutex_unlock(vlsurface->device->mutex);
vlRemoveDataHTAB(surface);
FREE(vlsurface);
if (!pipe)
return VDP_STATUS_INVALID_HANDLE;
+ pipe_mutex_lock(vlsurface->device->mutex);
vlVdpResolveDelayedRendering(vlsurface->device, NULL, NULL);
res = vlsurface->sampler_view->texture;
box = RectToPipeBox(source_rect, res);
transfer = pipe->get_transfer(pipe, res, 0, PIPE_TRANSFER_READ, &box);
- if (transfer == NULL)
+ if (transfer == NULL) {
+ pipe_mutex_unlock(vlsurface->device->mutex);
return VDP_STATUS_RESOURCES;
+ }
map = pipe_transfer_map(pipe, transfer);
if (map == NULL) {
pipe_transfer_destroy(pipe, transfer);
+ pipe_mutex_unlock(vlsurface->device->mutex);
return VDP_STATUS_RESOURCES;
}
pipe_transfer_unmap(pipe, transfer);
pipe_transfer_destroy(pipe, transfer);
+ pipe_mutex_unlock(vlsurface->device->mutex);
return VDP_STATUS_OK;
}
if (!pipe)
return VDP_STATUS_INVALID_HANDLE;
+ pipe_mutex_lock(vlsurface->device->mutex);
vlVdpResolveDelayedRendering(vlsurface->device, NULL, NULL);
dst_box = RectToPipeBox(destination_rect, vlsurface->sampler_view->texture);
pipe->transfer_inline_write(pipe, vlsurface->sampler_view->texture, 0,
PIPE_TRANSFER_WRITE, &dst_box, *source_data,
*source_pitches, 0);
+ pipe_mutex_unlock(vlsurface->device->mutex);
return VDP_STATUS_OK;
}
if (!vlsurface)
return VDP_STATUS_INVALID_HANDLE;
- vlVdpResolveDelayedRendering(vlsurface->device, NULL, NULL);
-
context = vlsurface->device->context;
compositor = &vlsurface->device->compositor;
cstate = &vlsurface->cstate;
res_tmpl.usage = PIPE_USAGE_STAGING;
res_tmpl.bind = PIPE_BIND_SAMPLER_VIEW;
+ pipe_mutex_lock(vlsurface->device->mutex);
+ vlVdpResolveDelayedRendering(vlsurface->device, NULL, NULL);
+
res = context->screen->resource_create(context->screen, &res_tmpl);
if (!res)
goto error_resource;
pipe_sampler_view_reference(&sv_idx, NULL);
pipe_sampler_view_reference(&sv_tbl, NULL);
+ pipe_mutex_unlock(vlsurface->device->mutex);
return VDP_STATUS_OK;
error_resource:
pipe_sampler_view_reference(&sv_idx, NULL);
pipe_sampler_view_reference(&sv_tbl, NULL);
+ pipe_mutex_unlock(vlsurface->device->mutex);
return VDP_STATUS_RESOURCES;
}
if (!vlsurface)
return VDP_STATUS_INVALID_HANDLE;
- vlVdpResolveDelayedRendering(vlsurface->device, NULL, NULL);
pipe = vlsurface->device->context;
compositor = &vlsurface->device->compositor;
if (!source_data || !source_pitches)
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 = PIPE_VIDEO_CHROMA_FORMAT_420;
}
vbuffer = pipe->create_video_buffer(pipe, &vtmpl);
- if (!vbuffer)
+ if (!vbuffer) {
+ pipe_mutex_unlock(vlsurface->device->mutex);
return VDP_STATUS_RESOURCES;
+ }
sampler_views = vbuffer->get_sampler_view_planes(vbuffer);
if (!sampler_views) {
vbuffer->destroy(vbuffer);
+ pipe_mutex_unlock(vlsurface->device->mutex);
return VDP_STATUS_RESOURCES;
}
vl_compositor_render(cstate, compositor, vlsurface->surface, NULL);
vbuffer->destroy(vbuffer);
+ pipe_mutex_unlock(vlsurface->device->mutex);
return VDP_STATUS_OK;
}
if (dst_vlsurface->device != src_vlsurface->device)
return VDP_STATUS_HANDLE_DEVICE_MISMATCH;
+ pipe_mutex_lock(dst_vlsurface->device->mutex);
vlVdpResolveDelayedRendering(dst_vlsurface->device, NULL, NULL);
context = dst_vlsurface->device->context;
vl_compositor_render(cstate, compositor, dst_vlsurface->surface, NULL);
context->delete_blend_state(context, blend);
+ pipe_mutex_unlock(dst_vlsurface->device->mutex);
return VDP_STATUS_OK;
}
if (dst_vlsurface->device != src_vlsurface->device)
return VDP_STATUS_HANDLE_DEVICE_MISMATCH;
- vlVdpResolveDelayedRendering(dst_vlsurface->device, NULL, NULL);
-
context = dst_vlsurface->device->context;
compositor = &dst_vlsurface->device->compositor;
cstate = &dst_vlsurface->cstate;
+ pipe_mutex_lock(dst_vlsurface->device->mutex);
+ vlVdpResolveDelayedRendering(dst_vlsurface->device, NULL, NULL);
+
blend = BlenderToPipe(context, blend_state);
vl_compositor_clear_layers(cstate);
vl_compositor_render(cstate, compositor, dst_vlsurface->surface, NULL);
context->delete_blend_state(context, blend);
+ pipe_mutex_unlock(dst_vlsurface->device->mutex);
return VDP_STATUS_OK;
}
pq->device = dev;
pq->drawable = pqt->drawable;
+ pipe_mutex_lock(dev->mutex);
if (!vl_compositor_init_state(&pq->cstate, dev->context)) {
+ pipe_mutex_unlock(dev->mutex);
ret = VDP_STATUS_ERROR;
goto no_compositor;
}
+ pipe_mutex_unlock(dev->mutex);
*presentation_queue = vlAddDataHTAB(pq);
if (*presentation_queue == 0) {
if (!pq)
return VDP_STATUS_INVALID_HANDLE;
+ pipe_mutex_lock(pq->device->mutex);
vl_compositor_cleanup_state(&pq->cstate);
+ pipe_mutex_unlock(pq->device->mutex);
vlRemoveDataHTAB(presentation_queue);
FREE(pq);
color.f[2] = background_color->blue;
color.f[3] = background_color->alpha;
+ pipe_mutex_lock(pq->device->mutex);
vl_compositor_set_clear_color(&pq->cstate, &color);
+ pipe_mutex_unlock(pq->device->mutex);
return VDP_STATUS_OK;
}
if (!pq)
return VDP_STATUS_INVALID_HANDLE;
+ pipe_mutex_lock(pq->device->mutex);
vl_compositor_get_clear_color(&pq->cstate, &color);
+ pipe_mutex_unlock(pq->device->mutex);
background_color->red = color.f[0];
background_color->green = color.f[1];
if (!pq)
return VDP_STATUS_INVALID_HANDLE;
+ pipe_mutex_lock(pq->device->mutex);
*current_time = vl_screen_get_timestamp(pq->device->vscreen, pq->drawable);
+ pipe_mutex_unlock(pq->device->mutex);
return VDP_STATUS_OK;
}
if (!pq)
return VDP_STATUS_INVALID_HANDLE;
+ surf = vlGetDataHTAB(surface);
+ if (!surf)
+ return VDP_STATUS_INVALID_HANDLE;
pipe = pq->device->context;
compositor = &pq->device->compositor;
cstate = &pq->cstate;
+ pipe_mutex_lock(pq->device->mutex);
tex = vl_screen_texture_from_drawable(pq->device->vscreen, pq->drawable);
- if (!tex)
+ if (!tex) {
+ pipe_mutex_unlock(pq->device->mutex);
return VDP_STATUS_INVALID_HANDLE;
+ }
dirty_area = vl_screen_get_dirty_area(pq->device->vscreen);
surf_templ.usage = PIPE_BIND_RENDER_TARGET;
surf_draw = pipe->create_surface(pipe, tex, &surf_templ);
- surf = vlGetDataHTAB(surface);
- if (!surf)
- return VDP_STATUS_INVALID_HANDLE;
-
surf->timestamp = (vlVdpTime)earliest_presentation_time;
dst_clip.x0 = 0;
pipe_resource_reference(&tex, NULL);
pipe_surface_reference(&surf_draw, NULL);
+ pipe_mutex_unlock(pq->device->mutex);
return VDP_STATUS_OK;
}
if (!surf)
return VDP_STATUS_INVALID_HANDLE;
+ pipe_mutex_lock(pq->device->mutex);
if (surf->fence) {
screen = pq->device->vscreen->pscreen;
screen->fence_finish(screen, surf->fence, 0);
}
+ pipe_mutex_unlock(pq->device->mutex);
return vlVdpPresentationQueueGetTime(presentation_queue, first_presentation_time);
}
if (!surf->fence) {
*status = VDP_PRESENTATION_QUEUE_STATUS_IDLE;
} else {
+ pipe_mutex_lock(pq->device->mutex);
screen = pq->device->vscreen->pscreen;
if (screen->fence_signalled(screen, surf->fence)) {
screen->fence_reference(screen, &surf->fence, NULL);
} else {
*status = VDP_PRESENTATION_QUEUE_STATUS_QUEUED;
}
+ pipe_mutex_unlock(pq->device->mutex);
}
return VDP_STATUS_OK;
if (!pscreen)
return VDP_STATUS_RESOURCES;
+ pipe_mutex_lock(dev->mutex);
+
/* XXX: Current limits */
*is_supported = true;
if (surface_chroma_type != VDP_CHROMA_TYPE_420)
*is_supported = false;
max_2d_texture_level = pscreen->get_param(pscreen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS);
+ pipe_mutex_unlock(dev->mutex);
if (!max_2d_texture_level)
return VDP_STATUS_RESOURCES;
if (!pscreen)
return VDP_STATUS_RESOURCES;
+ pipe_mutex_lock(dev->mutex);
*is_supported = pscreen->is_video_format_supported
(
pscreen,
FormatYCBCRToPipe(bits_ycbcr_format),
PIPE_VIDEO_PROFILE_UNKNOWN
);
+ pipe_mutex_unlock(dev->mutex);
return VDP_STATUS_OK;
}
return VDP_STATUS_OK;
}
+ pipe_mutex_lock(dev->mutex);
*is_supported = pscreen->get_video_param(pscreen, p_profile, PIPE_VIDEO_CAP_SUPPORTED);
if (*is_supported) {
*max_width = pscreen->get_video_param(pscreen, p_profile, PIPE_VIDEO_CAP_MAX_WIDTH);
*max_level = 0;
*max_macroblocks = 0;
}
+ pipe_mutex_unlock(dev->mutex);
return VDP_STATUS_OK;
}
if (!(is_supported && max_width && max_height))
return VDP_STATUS_INVALID_POINTER;
+ pipe_mutex_lock(dev->mutex);
*is_supported = pscreen->is_format_supported
(
pscreen, format, PIPE_TEXTURE_3D, 1,
uint32_t max_2d_texture_level = pscreen->get_param(
pscreen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS);
- if (!max_2d_texture_level)
+ if (!max_2d_texture_level) {
+ pipe_mutex_unlock(dev->mutex);
return VDP_STATUS_ERROR;
+ }
*max_width = *max_height = pow(2, max_2d_texture_level - 1);
} else {
*max_width = 0;
*max_height = 0;
}
+ pipe_mutex_unlock(dev->mutex);
return VDP_STATUS_OK;
}
if (!is_supported)
return VDP_STATUS_INVALID_POINTER;
+ pipe_mutex_lock(dev->mutex);
*is_supported = pscreen->is_format_supported
(
pscreen, format, PIPE_TEXTURE_2D, 1,
PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET
);
+ pipe_mutex_unlock(dev->mutex);
return VDP_STATUS_OK;
}
if (!is_supported)
return VDP_STATUS_INVALID_POINTER;
+ pipe_mutex_lock(dev->mutex);
*is_supported = pscreen->is_format_supported
(
pscreen, rgba_format, PIPE_TEXTURE_2D, 1,
pscreen, colortbl_format, PIPE_TEXTURE_1D, 1,
PIPE_BIND_SAMPLER_VIEW
);
+ pipe_mutex_unlock(dev->mutex);
return VDP_STATUS_OK;
}
if (!is_supported)
return VDP_STATUS_INVALID_POINTER;
+ pipe_mutex_lock(dev->mutex);
*is_supported = pscreen->is_format_supported
(
pscreen, rgba_format, PIPE_TEXTURE_2D, 1,
pscreen, ycbcr_format,
PIPE_VIDEO_PROFILE_UNKNOWN
);
+ pipe_mutex_unlock(dev->mutex);
return VDP_STATUS_OK;
}
if (!(is_supported && max_width && max_height))
return VDP_STATUS_INVALID_POINTER;
+ pipe_mutex_lock(dev->mutex);
*is_supported = pscreen->is_format_supported
(
pscreen, format, PIPE_TEXTURE_3D, 1,
uint32_t max_2d_texture_level = pscreen->get_param(
pscreen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS);
- if (!max_2d_texture_level)
+ if (!max_2d_texture_level) {
+ pipe_mutex_unlock(dev->mutex);
return VDP_STATUS_ERROR;
+ }
*max_width = *max_height = pow(2, max_2d_texture_level - 1);
} else {
*max_width = 0;
*max_height = 0;
}
+ pipe_mutex_unlock(dev->mutex);
return VDP_STATUS_OK;
}
vlVdpDevice *dev = vlGetDataHTAB(device);
struct pipe_screen *screen;
enum pipe_video_profile prof = PIPE_VIDEO_PROFILE_UNKNOWN;
+
if (!dev)
return VDP_STATUS_INVALID_HANDLE;
if (!(min_value && max_value))
return VDP_STATUS_INVALID_POINTER;
+
+ pipe_mutex_lock(dev->mutex);
screen = dev->vscreen->pscreen;
switch (parameter) {
case VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_WIDTH:
case VDP_VIDEO_MIXER_PARAMETER_CHROMA_TYPE:
default:
+ pipe_mutex_unlock(dev->mutex);
return VDP_STATUS_INVALID_VIDEO_MIXER_PARAMETER;
}
+ pipe_mutex_unlock(dev->mutex);
return VDP_STATUS_OK;
}
p_surf->device = dev;
pipe = dev->context;
+ pipe_mutex_lock(dev->mutex);
memset(&p_surf->templat, 0, sizeof(p_surf->templat));
p_surf->templat.buffer_format = pipe->screen->get_video_param
(
PIPE_VIDEO_CAP_PREFERS_INTERLACED
);
p_surf->video_buffer = pipe->create_video_buffer(pipe, &p_surf->templat);
+ pipe_mutex_unlock(dev->mutex);
*surface = vlAddDataHTAB(p_surf);
if (*surface == 0) {
if (!p_surf)
return VDP_STATUS_INVALID_HANDLE;
+ pipe_mutex_lock(p_surf->device->mutex);
if (p_surf->video_buffer)
p_surf->video_buffer->destroy(p_surf->video_buffer);
+ pipe_mutex_unlock(p_surf->device->mutex);
FREE(p_surf);
return VDP_STATUS_OK;
if (vlsurface->video_buffer == NULL || format != vlsurface->video_buffer->buffer_format)
return VDP_STATUS_NO_IMPLEMENTATION; /* TODO We don't support conversion (yet) */
+ pipe_mutex_lock(vlsurface->device->mutex);
sampler_views = vlsurface->video_buffer->get_sampler_view_planes(vlsurface->video_buffer);
- if (!sampler_views)
+ if (!sampler_views) {
+ pipe_mutex_unlock(vlsurface->device->mutex);
return VDP_STATUS_RESOURCES;
+ }
for (i = 0; i < 3; ++i) {
struct pipe_sampler_view *sv = sampler_views[i];
uint8_t *map;
transfer = pipe->get_transfer(pipe, sv->texture, 0, PIPE_TRANSFER_READ, &box);
- if (transfer == NULL)
+ if (transfer == NULL) {
+ pipe_mutex_unlock(vlsurface->device->mutex);
return VDP_STATUS_RESOURCES;
+ }
map = pipe_transfer_map(pipe, transfer);
if (map == NULL) {
pipe_transfer_destroy(pipe, transfer);
+ pipe_mutex_unlock(vlsurface->device->mutex);
return VDP_STATUS_RESOURCES;
}
pipe_transfer_destroy(pipe, transfer);
}
}
+ pipe_mutex_unlock(vlsurface->device->mutex);
return VDP_STATUS_OK;
}
if (!pipe)
return VDP_STATUS_INVALID_HANDLE;
+ pipe_mutex_lock(p_surf->device->mutex);
if (p_surf->video_buffer == NULL || pformat != p_surf->video_buffer->buffer_format) {
/* destroy the old one */
p_surf->video_buffer = pipe->create_video_buffer(pipe, &p_surf->templat);
/* stil no luck? ok forget it we don't support it */
- if (!p_surf->video_buffer)
+ if (!p_surf->video_buffer) {
+ pipe_mutex_unlock(p_surf->device->mutex);
return VDP_STATUS_NO_IMPLEMENTATION;
+ }
}
sampler_views = p_surf->video_buffer->get_sampler_view_planes(p_surf->video_buffer);
- if (!sampler_views)
+ if (!sampler_views) {
+ pipe_mutex_unlock(p_surf->device->mutex);
return VDP_STATUS_RESOURCES;
+ }
for (i = 0; i < 3; ++i) {
struct pipe_sampler_view *sv = sampler_views[i];
0);
}
}
+ pipe_mutex_unlock(p_surf->device->mutex);
return VDP_STATUS_OK;
}
#include "util/u_debug.h"
#include "util/u_rect.h"
+#include "os/os_thread.h"
#include "vl/vl_compositor.h"
#include "vl/vl_csc.h"
struct vl_screen *vscreen;
struct pipe_context *context;
struct vl_compositor compositor;
+ pipe_mutex mutex;
struct {
struct vl_compositor_state *cstate;