[g3dvl] throw out all unused parts of the interface
authorChristian König <deathsimple@vodafone.de>
Fri, 25 Mar 2011 23:20:16 +0000 (00:20 +0100)
committerChristian König <deathsimple@vodafone.de>
Fri, 25 Mar 2011 23:20:16 +0000 (00:20 +0100)
src/gallium/auxiliary/vl/vl_compositor.c
src/gallium/auxiliary/vl/vl_compositor.h
src/gallium/auxiliary/vl/vl_mpeg12_context.c
src/gallium/include/pipe/p_video_context.h
src/gallium/state_trackers/xorg/xvmc/context.c
src/gallium/state_trackers/xorg/xvmc/subpicture.c

index cef8b6992ab30cf2f869fbe0b4ed28945a631718..278f86bc54ae75f5c50f9aa05f42f69626f9c813 100644 (file)
@@ -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);
 }
 
index c2de98de0efdc84407fac6508bbe4f3afaecd573..8bea7ab39cf3dc32a4795ed5c29a48414542ca1f 100644 (file)
@@ -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[],
index 185380ed216d615ca6b37cde1280686bd8d65ecc..af1079e480bac6586ce633df3cf0efbc5f2aacc8 100644 (file)
@@ -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;
 
index be40c36366a770a2dc3fd04b6405d0869fda0ac2..49b1038eea7576bd715f477fb63c040e63cf2d86 100644 (file)
@@ -84,6 +84,11 @@ struct pipe_video_context
                                           struct pipe_resource *resource,
                                           const struct pipe_surface *templ);
 
+   /**
+    * sampler view handling, used for subpictures for example
+    */
+   /*@{*/
+
    /**
     * create a sampler view of a texture, for subpictures for example
     */
@@ -91,6 +96,22 @@ struct pipe_video_context
                                                     struct pipe_resource *resource,
                                                     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
     */
@@ -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);
index 06a1633288b578e74a432940bb5600faa6020e98..b1d17cc914959c2b8bb1a74bba03a3e23ba82d9d 100644 (file)
@@ -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;
index 7123e3b063434f1de3130d3244025f3ea4fdc4d4..3d0bb7ab67e8b200bf2718168af1b3890d019383 100644 (file)
@@ -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;