diff options
author | Christian König <[email protected]> | 2011-03-26 00:20:16 +0100 |
---|---|---|
committer | Christian König <[email protected]> | 2011-03-26 00:20:16 +0100 |
commit | 3d40d4f391e2fc319a03d8f171a2cfb9daf250c8 (patch) | |
tree | ee23fe5dbe9ebd6c235ccd8abb31c8da4b9415d8 | |
parent | 4a0b80f00dbc77d333027afd195daae7ef1e651c (diff) |
[g3dvl] throw out all unused parts of the interface
-rw-r--r-- | src/gallium/auxiliary/vl/vl_compositor.c | 14 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vl_compositor.h | 8 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vl_mpeg12_context.c | 122 | ||||
-rw-r--r-- | src/gallium/include/pipe/p_video_context.h | 92 | ||||
-rw-r--r-- | src/gallium/state_trackers/xorg/xvmc/context.c | 12 | ||||
-rw-r--r-- | src/gallium/state_trackers/xorg/xvmc/subpicture.c | 51 |
6 files changed, 75 insertions, 224 deletions
diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c index cef8b6992ab..278f86bc54a 100644 --- a/src/gallium/auxiliary/vl/vl_compositor.c +++ b/src/gallium/auxiliary/vl/vl_compositor.c @@ -345,8 +345,6 @@ bool vl_compositor_init(struct vl_compositor *compositor, struct pipe_context *p compositor->fb_state.width = 0; compositor->fb_state.height = 0; - compositor->bg = NULL; - compositor->dirty_bg = false; for (i = 0; i < VL_COMPOSITOR_MAX_LAYERS; ++i) compositor->layers[i] = NULL; compositor->dirty_layers = 0; @@ -484,16 +482,6 @@ static unsigned gen_data(struct vl_compositor *c, if (!vb) return 0; - if (c->dirty_bg) { - struct vertex2f bg_inv_size = {1.0f / c->bg->texture->width0, 1.0f / c->bg->texture->height0}; - gen_rect_verts(num_rects, &c->bg_src_rect, &bg_inv_size, NULL, NULL, vb); - textures[num_rects] = c->bg; - /* XXX: Hack */ - frag_shaders[num_rects] = c->fragment_shader.rgb_2_rgb; - ++num_rects; - c->dirty_bg = false; - } - { struct vertex2f src_inv_size = { 1.0f / src_surface->texture->width0, 1.0f / src_surface->texture->height0}; gen_rect_verts(num_rects, src_rect, &src_inv_size, dst_rect, &c->fb_inv_size, vb); @@ -613,7 +601,7 @@ void vl_compositor_render(struct vl_compositor *compositor, draw_layers(compositor, src_surface, src_area, dst_area); - assert(!compositor->dirty_bg && !compositor->dirty_layers); + assert(!compositor->dirty_layers); compositor->pipe->flush(compositor->pipe, fence); } diff --git a/src/gallium/auxiliary/vl/vl_compositor.h b/src/gallium/auxiliary/vl/vl_compositor.h index c2de98de0ef..8bea7ab39cf 100644 --- a/src/gallium/auxiliary/vl/vl_compositor.h +++ b/src/gallium/auxiliary/vl/vl_compositor.h @@ -57,9 +57,6 @@ struct vl_compositor void *vertex_elems_state; struct pipe_resource *fs_const_buf; - struct pipe_sampler_view *bg; - struct pipe_video_rect bg_src_rect; - bool dirty_bg; struct pipe_sampler_view *layers[VL_COMPOSITOR_MAX_LAYERS]; struct pipe_video_rect layer_src_rects[VL_COMPOSITOR_MAX_LAYERS]; struct pipe_video_rect layer_dst_rects[VL_COMPOSITOR_MAX_LAYERS]; @@ -72,11 +69,6 @@ bool vl_compositor_init(struct vl_compositor *compositor, struct pipe_context *p void vl_compositor_cleanup(struct vl_compositor *compositor); -#if 0 -void vl_compositor_set_background(struct vl_compositor *compositor, - struct pipe_surface *bg, struct pipe_video_rect *bg_src_rect); -#endif - void vl_compositor_set_layers(struct vl_compositor *compositor, struct pipe_sampler_view *layers[], struct pipe_video_rect *src_rects[], diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_context.c b/src/gallium/auxiliary/vl/vl_mpeg12_context.c index 185380ed216..af1079e480b 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_context.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_context.c @@ -365,105 +365,6 @@ vl_mpeg12_is_format_supported(struct pipe_video_context *vpipe, 0, usage); } -#if 0 -static void -vl_mpeg12_resource_copy_region(struct pipe_video_context *vpipe, - struct pipe_resource *dst, - unsigned dstx, unsigned dsty, unsigned dstz, - struct pipe_resource *src, - unsigned srcx, unsigned srcy, unsigned srcz, - unsigned width, unsigned height) -{ - struct vl_mpeg12_context *ctx = (struct vl_mpeg12_context*)vpipe; - - assert(vpipe); - assert(dst); - - struct pipe_box box; - box.x = srcx; - box.y = srcy; - box.z = srcz; - box.width = width; - box.height = height; - - if (ctx->pipe->resource_copy_region) - ctx->pipe->resource_copy_region(ctx->pipe, dst, 0, - dstx, dsty, dstz, - src, 0, &box); - else - util_resource_copy_region(ctx->pipe, dst, 0, - dstx, dsty, dstz, - src, 0, &box); -} - -static struct pipe_transfer* -vl_mpeg12_get_transfer(struct pipe_video_context *vpipe, - struct pipe_resource *resource, - unsigned level, - unsigned usage, /* a combination of PIPE_TRANSFER_x */ - const struct pipe_box *box) -{ - struct vl_mpeg12_context *ctx = (struct vl_mpeg12_context*)vpipe; - - assert(vpipe); - assert(resource); - assert(box); - - return ctx->pipe->get_transfer(ctx->pipe, resource, level, usage, box); -} - -static void -vl_mpeg12_transfer_destroy(struct pipe_video_context *vpipe, - struct pipe_transfer *transfer) -{ - struct vl_mpeg12_context *ctx = (struct vl_mpeg12_context*)vpipe; - - assert(vpipe); - assert(transfer); - - ctx->pipe->transfer_destroy(ctx->pipe, transfer); -} - -static void* -vl_mpeg12_transfer_map(struct pipe_video_context *vpipe, - struct pipe_transfer *transfer) -{ - struct vl_mpeg12_context *ctx = (struct vl_mpeg12_context*)vpipe; - - assert(vpipe); - assert(transfer); - - return ctx->pipe->transfer_map(ctx->pipe, transfer); -} - -static void -vl_mpeg12_transfer_flush_region(struct pipe_video_context *vpipe, - struct pipe_transfer *transfer, - const struct pipe_box *box) -{ - struct vl_mpeg12_context *ctx = (struct vl_mpeg12_context*)vpipe; - - assert(vpipe); - assert(transfer); - assert(box); - - ctx->pipe->transfer_flush_region(ctx->pipe, transfer, box); -} - -static void -vl_mpeg12_transfer_unmap(struct pipe_video_context *vpipe, - struct pipe_transfer *transfer) -{ - struct vl_mpeg12_context *ctx = (struct vl_mpeg12_context*)vpipe; - - assert(vpipe); - assert(transfer); - - ctx->pipe->transfer_unmap(ctx->pipe, transfer); -} - -#endif - static void vl_mpeg12_clear_sampler(struct pipe_video_context *vpipe, struct pipe_sampler_view *dst, @@ -558,22 +459,6 @@ vl_mpeg12_render_picture(struct pipe_video_context *vpipe, dst_surface, dst_area, fence); } -#if 0 -static void -vl_mpeg12_set_picture_background(struct pipe_video_context *vpipe, - struct pipe_surface *bg, - struct pipe_video_rect *bg_src_rect) -{ - struct vl_mpeg12_context *ctx = (struct vl_mpeg12_context*)vpipe; - - assert(vpipe); - assert(bg); - assert(bg_src_rect); - - vl_compositor_set_background(&ctx->compositor, bg, bg_src_rect); -} -#endif - static void vl_mpeg12_set_picture_layers(struct pipe_video_context *vpipe, struct pipe_sampler_view *layers[], @@ -759,14 +644,7 @@ vl_create_mpeg12_context(struct pipe_context *pipe, ctx->base.create_buffer = vl_mpeg12_create_buffer; ctx->base.render_picture = vl_mpeg12_render_picture; ctx->base.clear_sampler = vl_mpeg12_clear_sampler; - //ctx->base.resource_copy_region = vl_mpeg12_resource_copy_region; - //ctx->base.get_transfer = vl_mpeg12_get_transfer; - //ctx->base.transfer_destroy = vl_mpeg12_transfer_destroy; - //ctx->base.transfer_map = vl_mpeg12_transfer_map; - //ctx->base.transfer_flush_region = vl_mpeg12_transfer_flush_region; - //ctx->base.transfer_unmap = vl_mpeg12_transfer_unmap; ctx->base.upload_sampler = vl_mpeg12_upload_sampler; - //ctx->base.set_picture_background = vl_mpeg12_set_picture_background; ctx->base.set_picture_layers = vl_mpeg12_set_picture_layers; ctx->base.set_csc_matrix = vl_mpeg12_set_csc_matrix; diff --git a/src/gallium/include/pipe/p_video_context.h b/src/gallium/include/pipe/p_video_context.h index be40c36366a..49b1038eea7 100644 --- a/src/gallium/include/pipe/p_video_context.h +++ b/src/gallium/include/pipe/p_video_context.h @@ -85,6 +85,11 @@ struct pipe_video_context const struct pipe_surface *templ); /** + * sampler view handling, used for subpictures for example + */ + /*@{*/ + + /** * create a sampler view of a texture, for subpictures for example */ struct pipe_sampler_view *(*create_sampler_view)(struct pipe_video_context *vpipe, @@ -92,6 +97,22 @@ struct pipe_video_context const struct pipe_sampler_view *templ); /** + * upload image data to a sampler + */ + void (*upload_sampler)(struct pipe_video_context *vpipe, + struct pipe_sampler_view *dst, + const struct pipe_box *dst_box, + const void *src, unsigned src_stride, + unsigned src_x, unsigned src_y); + + /** + * clear a sampler with a specific rgba color + */ + void (*clear_sampler)(struct pipe_video_context *vpipe, + struct pipe_sampler_view *dst, + const struct pipe_box *dst_box, + const float *rgba); + /** * Creates a buffer as decoding target */ struct pipe_video_buffer *(*create_buffer)(struct pipe_video_context *vpipe); @@ -101,12 +122,14 @@ struct pipe_video_context */ #if 0 - /*@{*/ void (*decode_bitstream)(struct pipe_video_context *vpipe, unsigned num_bufs, struct pipe_buffer **bitstream_buf); #endif + /** + * render a video buffer to the frontbuffer + */ void (*render_picture)(struct pipe_video_context *vpipe, struct pipe_video_buffer *src_surface, struct pipe_video_rect *src_area, @@ -115,68 +138,22 @@ struct pipe_video_context struct pipe_video_rect *dst_area, struct pipe_fence_handle **fence); -#if 0 - void (*resource_copy_region)(struct pipe_video_context *vpipe, - struct pipe_resource *dst, - unsigned dstx, unsigned dsty, unsigned dstz, - struct pipe_resource *src, - unsigned srcx, unsigned srcy, unsigned srcz, - unsigned width, unsigned height); - - struct pipe_transfer *(*get_transfer)(struct pipe_video_context *vpipe, - struct pipe_resource *resource, - unsigned level, - unsigned usage, /* a combination of PIPE_TRANSFER_x */ - const struct pipe_box *box); - - void (*transfer_destroy)(struct pipe_video_context *vpipe, - struct pipe_transfer *transfer); - - void* (*transfer_map)(struct pipe_video_context *vpipe, - struct pipe_transfer *transfer); - - void (*transfer_flush_region)(struct pipe_video_context *vpipe, - struct pipe_transfer *transfer, - const struct pipe_box *box); - - void (*transfer_unmap)(struct pipe_video_context *vpipe, - struct pipe_transfer *transfer); -#endif - - void (*upload_sampler)(struct pipe_video_context *vpipe, - struct pipe_sampler_view *dst, - const struct pipe_box *dst_box, - const void *src, unsigned src_stride, - unsigned src_x, unsigned src_y); - - void (*clear_sampler)(struct pipe_video_context *vpipe, - struct pipe_sampler_view *dst, - const struct pipe_box *dst_box, - const float *rgba); - /*@}*/ /** * Parameter-like states (or properties) */ /*@{*/ -#if 0 - void (*set_picture_background)(struct pipe_video_context *vpipe, - struct pipe_surface *bg, - struct pipe_video_rect *bg_src_rect); -#endif + /** + * set overlay samplers + */ void (*set_picture_layers)(struct pipe_video_context *vpipe, struct pipe_sampler_view *layers[], struct pipe_video_rect *src_rects[], struct pipe_video_rect *dst_rects[], unsigned num_layers); -#if 0 - void (*set_picture_desc)(struct pipe_video_context *vpipe, - const struct pipe_picture_desc *desc); -#endif - void (*set_csc_matrix)(struct pipe_video_context *vpipe, const float *mat); /* TODO: Interface for scaling modes, post-processing, etc. */ @@ -187,16 +164,31 @@ struct pipe_video_buffer { struct pipe_video_context* context; + /** + * destroy this video buffer + */ void (*destroy)(struct pipe_video_buffer *buffer); + /** + * map the buffer into memory before calling add_macroblocks + */ void (*map)(struct pipe_video_buffer *buffer); + /** + * add macroblocks to buffer for decoding + */ void (*add_macroblocks)(struct pipe_video_buffer *buffer, unsigned num_macroblocks, struct pipe_macroblock *macroblocks); + /** + * unmap buffer before flushing + */ void (*unmap)(struct pipe_video_buffer *buffer); + /** + * flush buffer to video hardware + */ void (*flush)(struct pipe_video_buffer *buffer, struct pipe_video_buffer *ref_frames[2], struct pipe_fence_handle **fence); diff --git a/src/gallium/state_trackers/xorg/xvmc/context.c b/src/gallium/state_trackers/xorg/xvmc/context.c index 06a1633288b..b1d17cc9149 100644 --- a/src/gallium/state_trackers/xorg/xvmc/context.c +++ b/src/gallium/state_trackers/xorg/xvmc/context.c @@ -177,12 +177,12 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id, int width, int height, int flags, XvMCContext *context) { bool found_port; - int scrn; - int chroma_format; - int mc_type; - int surface_flags; - unsigned short subpic_max_w; - unsigned short subpic_max_h; + int scrn = 0; + int chroma_format = 0; + int mc_type = 0; + int surface_flags = 0; + unsigned short subpic_max_w = 0; + unsigned short subpic_max_h = 0; Status ret; struct vl_screen *vscreen; struct vl_context *vctx; diff --git a/src/gallium/state_trackers/xorg/xvmc/subpicture.c b/src/gallium/state_trackers/xorg/xvmc/subpicture.c index 7123e3b0634..3d0bb7ab67e 100644 --- a/src/gallium/state_trackers/xorg/xvmc/subpicture.c +++ b/src/gallium/state_trackers/xorg/xvmc/subpicture.c @@ -36,6 +36,7 @@ #include <util/u_memory.h> #include <util/u_math.h> #include <util/u_format.h> +#include <util/u_sampler.h> #include "xvmc_private.h" #define FOURCC_RGB 0x0000003 @@ -190,6 +191,27 @@ Status XvMCCreateSubpicture(Display *dpy, XvMCContext *context, XvMCSubpicture * tex = vpipe->screen->resource_create(vpipe->screen, &tex_templ); memset(&sampler_templ, 0, sizeof(sampler_templ)); + u_sampler_view_default_template(&sampler_templ, tex, tex->format); + +#if 0 + switch (image->id) { + case FOURCC_RGB: + assert(subpicture_priv->sfc->format == XvIDToPipe(image->id)); + for (y = 0; y < height; ++y) { + dst_line = dst; + for (x = 0; x < width; ++x, src += 3, dst_line += 4) { + dst_line[0] = src[2]; /* B */ + dst_line[1] = src[1]; /* G */ + dst_line[2] = src[0]; /* R */ + } + dst += xfer->stride; + } + break; + default: + XVMC_MSG(XVMC_ERR, "[XvMC] Unrecognized Xv image ID 0x%08X.\n", image->id); + } +#endif + subpicture_priv->sampler = vpipe->create_sampler_view(vpipe, tex, &sampler_templ); pipe_resource_reference(&tex, NULL); if (!subpicture_priv->sampler) { @@ -220,6 +242,7 @@ Status XvMCClearSubpicture(Display *dpy, XvMCSubpicture *subpicture, short x, sh { XvMCSubpicturePrivate *subpicture_priv; XvMCContextPrivate *context_priv; + struct pipe_box dst_box = {x, y, 0, width, height, 1}; float color_f[4]; assert(dpy); @@ -235,9 +258,9 @@ Status XvMCClearSubpicture(Display *dpy, XvMCSubpicture *subpicture, short x, sh subpicture_priv = subpicture->privData; context_priv = subpicture_priv->context->privData; /* TODO: Assert clear rect is within bounds? Or clip? */ - //context_priv->vctx->vpipe->clear_render_target(context_priv->vctx->vpipe, - // subpicture_priv->sampler, x, y, - // color_f, width, height); + context_priv->vctx->vpipe->clear_sampler(context_priv->vctx->vpipe, + subpicture_priv->sampler, &dst_box, + color_f); return Success; } @@ -250,9 +273,6 @@ Status XvMCCompositeSubpicture(Display *dpy, XvMCSubpicture *subpicture, XvImage XvMCSubpicturePrivate *subpicture_priv; XvMCContextPrivate *context_priv; struct pipe_video_context *vpipe; - - unsigned char *src, *dst, *dst_line; - unsigned x, y; struct pipe_box dst_box = {dstx, dsty, 0, width, height, 1}; XVMC_MSG(XVMC_TRACE, "[XvMC] Compositing subpicture %p.\n", subpicture); @@ -279,25 +299,6 @@ Status XvMCCompositeSubpicture(Display *dpy, XvMCSubpicture *subpicture, XvImage vpipe->upload_sampler(vpipe, subpicture_priv->sampler, &dst_box, image->data, width*3, srcx, srcy); -#if 0 - switch (image->id) { - case FOURCC_RGB: - assert(subpicture_priv->sfc->format == XvIDToPipe(image->id)); - for (y = 0; y < height; ++y) { - dst_line = dst; - for (x = 0; x < width; ++x, src += 3, dst_line += 4) { - dst_line[0] = src[2]; /* B */ - dst_line[1] = src[1]; /* G */ - dst_line[2] = src[0]; /* R */ - } - dst += xfer->stride; - } - break; - default: - XVMC_MSG(XVMC_ERR, "[XvMC] Unrecognized Xv image ID 0x%08X.\n", image->id); - } -#endif - XVMC_MSG(XVMC_TRACE, "[XvMC] Subpicture %p composited.\n", subpicture); return Success; |