summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/xvmc
diff options
context:
space:
mode:
authorChristian König <[email protected]>2012-02-25 13:09:17 +0100
committerChristian König <[email protected]>2012-03-02 13:14:20 +0100
commit32c4381d4a0479b3d9bfe305ce701be6b5ac8e18 (patch)
tree4ec14c7027256c368702e1c605190aa740de4ad1 /src/gallium/state_trackers/xvmc
parent834f515988ca894b3828a4929d36cafd349eade8 (diff)
vl/compositor: split shaders and state
Signed-off-by: Christian König <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/xvmc')
-rw-r--r--src/gallium/state_trackers/xvmc/attributes.c2
-rw-r--r--src/gallium/state_trackers/xvmc/context.c14
-rw-r--r--src/gallium/state_trackers/xvmc/surface.c13
-rw-r--r--src/gallium/state_trackers/xvmc/xvmc_private.h1
4 files changed, 23 insertions, 7 deletions
diff --git a/src/gallium/state_trackers/xvmc/attributes.c b/src/gallium/state_trackers/xvmc/attributes.c
index d40a7b1e6f4..da7b6493ba8 100644
--- a/src/gallium/state_trackers/xvmc/attributes.c
+++ b/src/gallium/state_trackers/xvmc/attributes.c
@@ -110,7 +110,7 @@ Status XvMCSetAttribute(Display *dpy, XvMCContext *context, Atom attribute, int
context_priv->color_standard,
&context_priv->procamp, true, csc
);
- vl_compositor_set_csc_matrix(&context_priv->compositor, csc);
+ vl_compositor_set_csc_matrix(&context_priv->cstate, csc);
XVMC_MSG(XVMC_TRACE, "[XvMC] Set attribute %s to value %d.\n", attr, value);
diff --git a/src/gallium/state_trackers/xvmc/context.c b/src/gallium/state_trackers/xvmc/context.c
index f5751515672..c598cad7455 100644
--- a/src/gallium/state_trackers/xvmc/context.c
+++ b/src/gallium/state_trackers/xvmc/context.c
@@ -270,6 +270,17 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id,
return BadAlloc;
}
+ if (!vl_compositor_init_state(&context_priv->cstate, pipe)) {
+ XVMC_MSG(XVMC_ERR, "[XvMC] Could not create VL compositor state.\n");
+ vl_compositor_cleanup(&context_priv->compositor);
+ context_priv->decoder->destroy(context_priv->decoder);
+ pipe->destroy(pipe);
+ vl_screen_destroy(vscreen);
+ FREE(context_priv);
+ return BadAlloc;
+ }
+
+
context_priv->color_standard =
debug_get_bool_option("G3DVL_NO_CSC", FALSE) ?
VL_CSC_COLOR_STANDARD_IDENTITY : VL_CSC_COLOR_STANDARD_BT_601;
@@ -280,7 +291,7 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id,
context_priv->color_standard,
&context_priv->procamp, true, csc
);
- vl_compositor_set_csc_matrix(&context_priv->compositor, csc);
+ vl_compositor_set_csc_matrix(&context_priv->cstate, csc);
context_priv->vscreen = vscreen;
context_priv->pipe = pipe;
@@ -316,6 +327,7 @@ Status XvMCDestroyContext(Display *dpy, XvMCContext *context)
context_priv = context->privData;
context_priv->decoder->destroy(context_priv->decoder);
+ vl_compositor_cleanup_state(&context_priv->cstate);
vl_compositor_cleanup(&context_priv->compositor);
context_priv->pipe->destroy(context_priv->pipe);
vl_screen_destroy(context_priv->vscreen);
diff --git a/src/gallium/state_trackers/xvmc/surface.c b/src/gallium/state_trackers/xvmc/surface.c
index c6f6ef593b4..47853cf6924 100644
--- a/src/gallium/state_trackers/xvmc/surface.c
+++ b/src/gallium/state_trackers/xvmc/surface.c
@@ -349,6 +349,7 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable,
struct pipe_context *pipe;
struct vl_compositor *compositor;
+ struct vl_compositor_state *cstate;
XvMCSurfacePrivate *surface_priv;
XvMCContextPrivate *context_priv;
@@ -379,6 +380,7 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable,
subpicture_priv = surface_priv->subpicture ? surface_priv->subpicture->privData : NULL;
pipe = context_priv->pipe;
compositor = &context_priv->compositor;
+ cstate = &context_priv->cstate;
tex = vl_screen_texture_from_drawable(context_priv->vscreen, drawable);
dirty_area = vl_screen_get_dirty_area(context_priv->vscreen);
@@ -407,8 +409,8 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable,
context_priv->decoder->flush(context_priv->decoder);
- vl_compositor_clear_layers(compositor);
- vl_compositor_set_buffer_layer(compositor, 0, surface_priv->video_buffer,
+ vl_compositor_clear_layers(cstate);
+ vl_compositor_set_buffer_layer(cstate, compositor, 0, surface_priv->video_buffer,
&src_rect, NULL, VL_COMPOSITOR_WEAVE);
if (subpicture_priv) {
@@ -417,10 +419,10 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable,
assert(subpicture_priv->surface == surface);
if (subpicture_priv->palette)
- vl_compositor_set_palette_layer(compositor, 1, subpicture_priv->sampler, subpicture_priv->palette,
+ vl_compositor_set_palette_layer(cstate, compositor, 1, subpicture_priv->sampler, subpicture_priv->palette,
&subpicture_priv->src_rect, &subpicture_priv->dst_rect, true);
else
- vl_compositor_set_rgba_layer(compositor, 1, subpicture_priv->sampler,
+ vl_compositor_set_rgba_layer(cstate, compositor, 1, subpicture_priv->sampler,
&subpicture_priv->src_rect, &subpicture_priv->dst_rect);
surface_priv->subpicture = NULL;
@@ -430,7 +432,8 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable,
// Workaround for r600g, there seems to be a bug in the fence refcounting code
pipe->screen->fence_reference(pipe->screen, &surface_priv->fence, NULL);
- vl_compositor_render(compositor, surf, &dst_rect, NULL, dirty_area);
+ vl_compositor_set_dst_area(cstate, &dst_rect);
+ vl_compositor_render(cstate, compositor, surf, dirty_area);
pipe->flush(pipe, &surface_priv->fence);
diff --git a/src/gallium/state_trackers/xvmc/xvmc_private.h b/src/gallium/state_trackers/xvmc/xvmc_private.h
index 4117f5bf689..26f874ad87a 100644
--- a/src/gallium/state_trackers/xvmc/xvmc_private.h
+++ b/src/gallium/state_trackers/xvmc/xvmc_private.h
@@ -57,6 +57,7 @@ typedef struct
enum VL_CSC_COLOR_STANDARD color_standard;
struct vl_procamp procamp;
struct vl_compositor compositor;
+ struct vl_compositor_state cstate;
unsigned short subpicture_max_width;
unsigned short subpicture_max_height;