diff options
author | Leo Liu <[email protected]> | 2017-10-01 21:27:21 -0400 |
---|---|---|
committer | Leo Liu <[email protected]> | 2017-10-04 09:22:33 -0400 |
commit | 409491e778c979a5fbc59657cc54149c4ee7c2d6 (patch) | |
tree | d126bcd149fea8c1eee6a8b5da1e08033d4d6626 | |
parent | 0fa950ecd38d5025bb2393bbcb96a73152764cf4 (diff) |
st/va: add RGB support to vlVaPutSurface
Tested-by: Andy Furniss <[email protected]>
Reviewed-by: Christian König <[email protected]>
-rw-r--r-- | src/gallium/state_trackers/va/surface.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/gallium/state_trackers/va/surface.c b/src/gallium/state_trackers/va/surface.c index 643cdcd54ab..4c2f4b5452a 100644 --- a/src/gallium/state_trackers/va/surface.c +++ b/src/gallium/state_trackers/va/surface.c @@ -280,6 +280,7 @@ vlVaPutSurface(VADriverContextP ctx, VASurfaceID surface_id, void* draw, short s struct vl_screen *vscreen; struct u_rect src_rect, *dirty_area; struct u_rect dst_rect = {destx, destx + destw, desty, desty + desth}; + enum pipe_format format; VAStatus status; if (!ctx) @@ -318,8 +319,19 @@ vlVaPutSurface(VADriverContextP ctx, VASurfaceID surface_id, void* draw, short s src_rect.x1 = srcw + srcx; src_rect.y1 = srch + srcy; + format = surf->buffer->buffer_format; + vl_compositor_clear_layers(&drv->cstate); - vl_compositor_set_buffer_layer(&drv->cstate, &drv->compositor, 0, surf->buffer, &src_rect, NULL, VL_COMPOSITOR_WEAVE); + + if (format == PIPE_FORMAT_B8G8R8A8_UNORM || format == PIPE_FORMAT_B8G8R8X8_UNORM || + format == PIPE_FORMAT_R8G8B8A8_UNORM || format == PIPE_FORMAT_R8G8B8X8_UNORM) { + struct pipe_sampler_view **views; + + views = surf->buffer->get_sampler_view_planes(surf->buffer); + vl_compositor_set_rgba_layer(&drv->cstate, &drv->compositor, 0, views[0], &src_rect, NULL, NULL); + } else + vl_compositor_set_buffer_layer(&drv->cstate, &drv->compositor, 0, surf->buffer, &src_rect, NULL, VL_COMPOSITOR_WEAVE); + vl_compositor_set_layer_dst_area(&drv->cstate, 0, &dst_rect); vl_compositor_render(&drv->cstate, &drv->compositor, surf_draw, dirty_area, true); |