VAImage *img;
struct pipe_screen *screen;
struct pipe_surface **surfaces;
+ struct pipe_video_buffer *new_buffer = NULL;
int w;
int h;
int i;
if (!surf || !surf->buffer)
return VA_STATUS_ERROR_INVALID_SURFACE;
- if (surf->buffer->interlaced)
- return VA_STATUS_ERROR_OPERATION_FAILED;
-
surfaces = surf->buffer->get_surfaces(surf->buffer);
if (!surfaces || !surfaces[0]->texture)
return VA_STATUS_ERROR_ALLOCATION_FAILED;
case VA_FOURCC('N','V','1','2'):
case VA_FOURCC('P','0','1','0'):
case VA_FOURCC('P','0','1','6'):
+ if (surf->buffer->interlaced) {
+ struct u_rect src_rect, dst_rect;
+ struct pipe_video_buffer new_template;
+
+ new_template = surf->templat;
+ new_template.interlaced = false;
+ new_buffer = drv->pipe->create_video_buffer(drv->pipe, &new_template);
+
+ /* convert the interlaced to the progressive */
+ src_rect.x0 = dst_rect.x0 = 0;
+ src_rect.x1 = dst_rect.x1 = surf->templat.width;
+ src_rect.y0 = dst_rect.y0 = 0;
+ src_rect.y1 = dst_rect.y1 = surf->templat.height;
+
+ vl_compositor_yuv_deint_full(&drv->cstate, &drv->compositor,
+ surf->buffer, new_buffer,
+ &src_rect, &dst_rect,
+ VL_COMPOSITOR_WEAVE);
+
+ /* recalculate the values now that we have a new surface */
+ surfaces = surf->buffer->get_surfaces(new_buffer);
+ if (screen->resource_get_info) {
+ screen->resource_get_info(screen, surfaces[0]->texture, &stride,
+ &offset);
+ if (!stride)
+ offset = 0;
+ }
+
+ w = align(new_buffer->width, 2);
+ h = align(new_buffer->height, 2);
+ }
+
img->num_planes = 2;
img->pitches[0] = stride > 0 ? stride : w;
img->pitches[1] = stride > 0 ? stride : w;
img_buf->num_elements = 1;
pipe_resource_reference(&img_buf->derived_surface.resource, surfaces[0]->texture);
+ img_buf->derived_image_buffer = new_buffer;
img->buf = handle_table_add(VL_VA_DRIVER(ctx)->htab, img_buf);
mtx_unlock(&drv->mutex);