aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/xorg
diff options
context:
space:
mode:
authorChristian König <[email protected]>2012-02-15 17:20:50 +0100
committerChristian König <[email protected]>2012-02-25 12:14:14 +0100
commit1448e829e86981e6144410ba6a3d0f16357fb2b3 (patch)
tree18a95fc6ebab9afd59837d419f2e5ab96130624b /src/gallium/state_trackers/xorg
parentb34c35a5243e0f4a23721891dbbccff8863b7d4c (diff)
vl: rework winsys interface
Throw out all the old and now unneeded stuff. Signed-off-by: Christian König <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/xorg')
-rw-r--r--src/gallium/state_trackers/xorg/xvmc/context.c28
-rw-r--r--src/gallium/state_trackers/xorg/xvmc/subpicture.c8
-rw-r--r--src/gallium/state_trackers/xorg/xvmc/surface.c24
-rw-r--r--src/gallium/state_trackers/xorg/xvmc/xvmc_private.h5
4 files changed, 33 insertions, 32 deletions
diff --git a/src/gallium/state_trackers/xorg/xvmc/context.c b/src/gallium/state_trackers/xorg/xvmc/context.c
index b11f10fe402..e9ba06ba909 100644
--- a/src/gallium/state_trackers/xorg/xvmc/context.c
+++ b/src/gallium/state_trackers/xorg/xvmc/context.c
@@ -190,7 +190,7 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id,
unsigned short subpic_max_h = 0;
Status ret;
struct vl_screen *vscreen;
- struct vl_context *vctx;
+ struct pipe_context *pipe;
XvMCContextPrivate *context_priv;
float csc[16];
@@ -236,18 +236,17 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id,
return BadAlloc;
}
- vctx = vl_video_create(vscreen);
- if (!vctx) {
+ pipe = vscreen->pscreen->context_create(vscreen->pscreen, vscreen);
+ if (!pipe) {
XVMC_MSG(XVMC_ERR, "[XvMC] Could not create VL context.\n");
vl_screen_destroy(vscreen);
FREE(context_priv);
return BadAlloc;
}
- context_priv->decoder = vctx->pipe->create_video_decoder
+ context_priv->decoder = pipe->create_video_decoder
(
- vctx->pipe,
- ProfileToPipe(mc_type),
+ pipe, ProfileToPipe(mc_type),
(mc_type & XVMC_IDCT) ? PIPE_VIDEO_ENTRYPOINT_IDCT : PIPE_VIDEO_ENTRYPOINT_MC,
FormatToPipe(chroma_format),
width, height, 2,
@@ -256,16 +255,16 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id,
if (!context_priv->decoder) {
XVMC_MSG(XVMC_ERR, "[XvMC] Could not create VL decoder.\n");
- vl_video_destroy(vctx);
+ pipe->destroy(pipe);
vl_screen_destroy(vscreen);
FREE(context_priv);
return BadAlloc;
}
- if (!vl_compositor_init(&context_priv->compositor, vctx->pipe)) {
+ if (!vl_compositor_init(&context_priv->compositor, pipe)) {
XVMC_MSG(XVMC_ERR, "[XvMC] Could not create VL compositor.\n");
context_priv->decoder->destroy(context_priv->decoder);
- vl_video_destroy(vctx);
+ pipe->destroy(pipe);
vl_screen_destroy(vscreen);
FREE(context_priv);
return BadAlloc;
@@ -283,7 +282,8 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id,
);
vl_compositor_set_csc_matrix(&context_priv->compositor, csc);
- context_priv->vctx = vctx;
+ context_priv->vscreen = vscreen;
+ context_priv->pipe = pipe;
context_priv->subpicture_max_width = subpic_max_w;
context_priv->subpicture_max_height = subpic_max_h;
@@ -305,8 +305,6 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id,
PUBLIC
Status XvMCDestroyContext(Display *dpy, XvMCContext *context)
{
- struct vl_screen *vscreen;
- struct vl_context *vctx;
XvMCContextPrivate *context_priv;
XVMC_MSG(XVMC_TRACE, "[XvMC] Destroying context %p.\n", context);
@@ -317,13 +315,11 @@ Status XvMCDestroyContext(Display *dpy, XvMCContext *context)
return XvMCBadContext;
context_priv = context->privData;
- vctx = context_priv->vctx;
- vscreen = vctx->vscreen;
pipe_surface_reference(&context_priv->drawable_surface, NULL);
context_priv->decoder->destroy(context_priv->decoder);
vl_compositor_cleanup(&context_priv->compositor);
- vl_video_destroy(vctx);
- vl_screen_destroy(vscreen);
+ context_priv->pipe->destroy(context_priv->pipe);
+ vl_screen_destroy(context_priv->vscreen);
FREE(context_priv);
context->privData = NULL;
diff --git a/src/gallium/state_trackers/xorg/xvmc/subpicture.c b/src/gallium/state_trackers/xorg/xvmc/subpicture.c
index c5aa0c35213..d6be28ea3cd 100644
--- a/src/gallium/state_trackers/xorg/xvmc/subpicture.c
+++ b/src/gallium/state_trackers/xorg/xvmc/subpicture.c
@@ -210,7 +210,7 @@ Status XvMCCreateSubpicture(Display *dpy, XvMCContext *context, XvMCSubpicture *
return XvMCBadContext;
context_priv = context->privData;
- pipe = context_priv->vctx->pipe;
+ pipe = context_priv->pipe;
if (!subpicture)
return XvMCBadSubpicture;
@@ -321,7 +321,7 @@ Status XvMCClearSubpicture(Display *dpy, XvMCSubpicture *subpicture, short x, sh
subpicture_priv = subpicture->privData;
context_priv = subpicture_priv->context->privData;
- pipe = context_priv->vctx->pipe;
+ pipe = context_priv->pipe;
dst = subpicture_priv->sampler;
/* TODO: Assert clear rect is within bounds? Or clip? */
@@ -371,7 +371,7 @@ Status XvMCCompositeSubpicture(Display *dpy, XvMCSubpicture *subpicture, XvImage
subpicture_priv = subpicture->privData;
context_priv = subpicture_priv->context->privData;
- pipe = context_priv->vctx->pipe;
+ pipe = context_priv->pipe;
/* clipping should be done by upload_sampler and regardles what the documentation
says image->pitches[0] doesn't seems to be in bytes, so don't use it */
@@ -421,7 +421,7 @@ Status XvMCSetSubpicturePalette(Display *dpy, XvMCSubpicture *subpicture, unsign
subpicture_priv = subpicture->privData;
context_priv = subpicture_priv->context->privData;
- pipe = context_priv->vctx->pipe;
+ pipe = context_priv->pipe;
dst_box.width = subpicture->num_palette_entries;
diff --git a/src/gallium/state_trackers/xorg/xvmc/surface.c b/src/gallium/state_trackers/xorg/xvmc/surface.c
index 7f7eeadcbc6..293e7ad22a4 100644
--- a/src/gallium/state_trackers/xorg/xvmc/surface.c
+++ b/src/gallium/state_trackers/xorg/xvmc/surface.c
@@ -168,7 +168,7 @@ Status XvMCCreateSurface(Display *dpy, XvMCContext *context, XvMCSurface *surfac
return XvMCBadSurface;
context_priv = context->privData;
- pipe = context_priv->vctx->pipe;
+ pipe = context_priv->pipe;
surface_priv = CALLOC(1, sizeof(XvMCSurfacePrivate));
if (!surface_priv)
@@ -373,17 +373,25 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable,
assert(srcy + srch - 1 < surface->height);
subpicture_priv = surface_priv->subpicture ? surface_priv->subpicture->privData : NULL;
- pipe = context_priv->vctx->pipe;
+ pipe = context_priv->pipe;
compositor = &context_priv->compositor;
if (!context_priv->drawable_surface ||
context_priv->dst_rect.x != dst_rect.x || context_priv->dst_rect.y != dst_rect.y ||
context_priv->dst_rect.w != dst_rect.w || context_priv->dst_rect.h != dst_rect.h) {
+ struct pipe_surface surf_templ;
+ struct pipe_resource *tex = vl_screen_texture_from_drawable(
+ context_priv->vscreen, drawable);
+
pipe_surface_reference(&context_priv->drawable_surface, NULL);
- context_priv->drawable_surface = vl_drawable_surface_get(context_priv->vctx, drawable);
- context_priv->dst_rect = dst_rect;
+
+ memset(&surf_templ, 0, sizeof(surf_templ));
+ surf_templ.format = tex->format;
+ surf_templ.usage = PIPE_BIND_RENDER_TARGET;
+ context_priv->drawable_surface = pipe->create_surface(pipe, tex, &surf_templ);
vl_compositor_reset_dirty_area(&context_priv->dirty_area);
+ context_priv->dst_rect = dst_rect;
}
if (!context_priv->drawable_surface)
@@ -436,10 +444,8 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable,
pipe->screen->flush_frontbuffer
(
- pipe->screen,
- context_priv->drawable_surface->texture,
- 0, 0,
- vl_contextprivate_get(context_priv->vctx, context_priv->drawable_surface)
+ pipe->screen, context_priv->drawable_surface->texture, 0, 0,
+ vl_screen_get_private(context_priv->vscreen)
);
if(dump_window == -1) {
@@ -476,7 +482,7 @@ Status XvMCGetSurfaceStatus(Display *dpy, XvMCSurface *surface, int *status)
surface_priv = surface->privData;
context_priv = surface_priv->context->privData;
- pipe = context_priv->vctx->pipe;
+ pipe = context_priv->pipe;
*status = 0;
diff --git a/src/gallium/state_trackers/xorg/xvmc/xvmc_private.h b/src/gallium/state_trackers/xorg/xvmc/xvmc_private.h
index daddba5fe54..b9519a7e65d 100644
--- a/src/gallium/state_trackers/xorg/xvmc/xvmc_private.h
+++ b/src/gallium/state_trackers/xorg/xvmc/xvmc_private.h
@@ -43,8 +43,6 @@
#define BLOCK_SIZE_SAMPLES 64
#define BLOCK_SIZE_BYTES (BLOCK_SIZE_SAMPLES * 2)
-struct vl_context;
-
struct pipe_video_decoder;
struct pipe_video_buffer;
@@ -53,7 +51,8 @@ struct pipe_fence_handle;
typedef struct
{
- struct vl_context *vctx;
+ struct vl_screen *vscreen;
+ struct pipe_context *pipe;
struct pipe_video_decoder *decoder;
enum VL_CSC_COLOR_STANDARD color_standard;