memset(&res_tmpl, 0, sizeof(res_tmpl));
+ /*
+ * The output won't look correctly when this buffer is send to X,
+ * if the VDPAU RGB component order doesn't match the X11 one so
+ * we only allow the X11 format
+ */
+ vlsurface->send_to_X = rgba_format == VDP_RGBA_FORMAT_B8G8R8A8;
+
res_tmpl.target = PIPE_TEXTURE_2D;
res_tmpl.format = VdpFormatRGBAToPipe(rgba_format);
res_tmpl.width0 = width;
vscreen = pq->device->vscreen;
pipe_mutex_lock(pq->device->mutex);
- if (vscreen->set_back_texture_from_output)
+ if (vscreen->set_back_texture_from_output && surf->send_to_X)
vscreen->set_back_texture_from_output(vscreen, surf->surface->texture, clip_width, clip_height);
tex = vscreen->texture_from_drawable(vscreen, (void *)pq->drawable);
if (!tex) {
return VDP_STATUS_INVALID_HANDLE;
}
- if (!vscreen->set_back_texture_from_output) {
+ if (!vscreen->set_back_texture_from_output || !surf->send_to_X) {
dirty_area = vscreen->get_dirty_area(vscreen);
memset(&surf_templ, 0, sizeof(surf_templ));
framenum++;
}
- if (!vscreen->set_back_texture_from_output) {
+ if (!vscreen->set_back_texture_from_output || !surf->send_to_X) {
pipe_resource_reference(&tex, NULL);
pipe_surface_reference(&surf_draw, NULL);
}