#include "vl/vl_defines.h"
#include "vl/vl_video_buffer.h"
#include "vl/vl_deint_filter.h"
+#include "vl/vl_winsys.h"
#include "va_private.h"
bool scale = false;
bool grab = false;
unsigned i;
+ struct pipe_screen *pscreen = drv->vscreen->pscreen;
- if ((src->buffer_format == PIPE_FORMAT_B8G8R8A8_UNORM ||
- src->buffer_format == PIPE_FORMAT_B8G8R8X8_UNORM) &&
+ if ((src->buffer_format == PIPE_FORMAT_B8G8R8X8_UNORM ||
+ src->buffer_format == PIPE_FORMAT_B8G8R8A8_UNORM ||
+ src->buffer_format == PIPE_FORMAT_R8G8B8X8_UNORM ||
+ src->buffer_format == PIPE_FORMAT_R8G8B8A8_UNORM) &&
!src->interlaced)
grab = true;
dst_rect.x1 = dst_region->x + dst_region->width;
dst_rect.y1 = dst_region->y + dst_region->height;
- if (grab) {
+ if (grab && !pscreen->get_video_param(pscreen, PIPE_VIDEO_PROFILE_UNKNOWN,
+ PIPE_VIDEO_ENTRYPOINT_ENCODE,
+ PIPE_VIDEO_CAP_EFC_SUPPORTED)) {
vl_compositor_convert_rgb_to_yuv(&drv->cstate, &drv->compositor, 0,
((struct vl_video_buffer *)src)->resources[0],
dst, &src_rect, &dst_rect);
blit.mask = PIPE_MASK_RGBA;
blit.filter = PIPE_TEX_MIPFILTER_LINEAR;
- if (drv->pipe->screen->get_param(drv->pipe->screen,
+ if (!grab && drv->pipe->screen->get_param(drv->pipe->screen,
PIPE_CAP_PREFER_COMPUTE_FOR_MULTIMEDIA))
util_compute_blit(drv->pipe, &blit, &context->blit_cs, !drv->compositor.deinterlace);
else
struct pipe_video_buffer *src, *dst;
vlVaSurface *src_surface, *dst_surface;
unsigned i;
+ struct pipe_screen *pscreen;
if (!drv || !context)
return VA_STATUS_ERROR_INVALID_CONTEXT;
src_surface = handle_table_get(drv->htab, param->surface);
dst_surface = handle_table_get(drv->htab, context->target_id);
+ pscreen = drv->vscreen->pscreen;
+
+ if (src_surface->buffer->buffer_format != dst_surface->buffer->buffer_format &&
+ pscreen->get_video_param(pscreen, PIPE_VIDEO_PROFILE_UNKNOWN, PIPE_VIDEO_ENTRYPOINT_ENCODE, PIPE_VIDEO_CAP_EFC_SUPPORTED)) {
+
+ // EFC will convert the buffer to a format the encoder accepts
+ dst_surface->encoder_format = dst_surface->buffer->buffer_format;
+
+ vlVaSurface *surf;
+
+ surf = handle_table_get(drv->htab, context->target_id);
+ surf->templat.interlaced = src_surface->templat.interlaced;
+ surf->templat.buffer_format = src_surface->templat.buffer_format;
+ surf->buffer->destroy(surf->buffer);
+
+ if (vlVaHandleSurfaceAllocate(drv, surf, &surf->templat, NULL, 0) != VA_STATUS_SUCCESS)
+ return VA_STATUS_ERROR_ALLOCATION_FAILED;
+
+ context->target = surf->buffer;
+ }
+
if (!src_surface || !src_surface->buffer)
return VA_STATUS_ERROR_INVALID_SURFACE;
if (context->target->buffer_format != PIPE_FORMAT_NV12 &&
context->target->buffer_format != PIPE_FORMAT_P010 &&
- context->target->buffer_format != PIPE_FORMAT_P016)
+ context->target->buffer_format != PIPE_FORMAT_P016 &&
+ context->target->buffer_format != PIPE_FORMAT_B8G8R8X8_UNORM &&
+ context->target->buffer_format != PIPE_FORMAT_B8G8R8A8_UNORM &&
+ context->target->buffer_format != PIPE_FORMAT_R8G8B8X8_UNORM &&
+ context->target->buffer_format != PIPE_FORMAT_R8G8B8A8_UNORM)
return vlVaPostProcCompositor(drv, context, src_region, dst_region,
src, context->target, deinterlace);
else