[g3dvl] remove empty block handling for now
authorChristian König <deathsimple@vodafone.de>
Thu, 11 Nov 2010 11:49:47 +0000 (12:49 +0100)
committerChristian König <deathsimple@vodafone.de>
Thu, 11 Nov 2010 11:49:47 +0000 (12:49 +0100)
Maybe this isn't going into the right direction,
but it makes handling the code easier for now.

src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c
src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h
src/gallium/drivers/nv40/nv40_video_context.c
src/gallium/drivers/nvfx/nvfx_video_context.c
src/gallium/drivers/r300/r300_video_context.c
src/gallium/drivers/r600/r600_video_context.c
src/gallium/drivers/softpipe/sp_video_context.c
src/gallium/drivers/softpipe/sp_video_context.h

index a6fe0661200dfef4cedf022c8673ec41d913507c..4616e483f74a0dc40147454eac647fad36a110d7 100644 (file)
@@ -42,8 +42,6 @@
 #define MACROBLOCK_HEIGHT 16
 #define BLOCK_WIDTH 8
 #define BLOCK_HEIGHT 8
-#define ZERO_BLOCK_NIL -1.0f
-#define ZERO_BLOCK_IS_NIL(zb) ((zb).x < 0.0f)
 #define SCALE_FACTOR_16_TO_9 (32767.0f / 255.0f)
 
 struct vertex_shader_consts
@@ -512,8 +510,7 @@ init_pipe_state(struct vl_mpeg12_mc_renderer *r)
    /* Luma filter */
    filters[0] = PIPE_TEX_FILTER_NEAREST;
    /* Chroma filters */
-   if (r->chroma_format == PIPE_VIDEO_CHROMA_FORMAT_444 ||
-       r->eb_handling == VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE) {
+   if (r->chroma_format == PIPE_VIDEO_CHROMA_FORMAT_444 || true) { //TODO
       filters[1] = PIPE_TEX_FILTER_NEAREST;
       filters[2] = PIPE_TEX_FILTER_NEAREST;
    }
@@ -1199,10 +1196,6 @@ flush(struct vl_mpeg12_mc_renderer *r)
 
    r->pipe->flush(r->pipe, PIPE_FLUSH_RENDER_CACHE, r->fence);
 
-   if (r->eb_handling == VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE)
-      for (i = 0; i < 3; ++i)
-         r->zero_block[i].x = ZERO_BLOCK_NIL;
-
    r->num_macroblocks = 0;
 }
 
@@ -1230,17 +1223,6 @@ grab_field_coded_block(short *src, short *dst, unsigned dst_pitch)
       memcpy(dst + y * dst_pitch * 2, src + y * BLOCK_WIDTH, BLOCK_WIDTH * 2);
 }
 
-static void
-fill_frame_zero_block(short *dst, unsigned dst_pitch)
-{
-   //unsigned y;
-   //
-   //assert(dst);
-
-   //for (y = 0; y < BLOCK_HEIGHT; ++y)
-   //   memset(dst + y * dst_pitch, 0, BLOCK_WIDTH * 2);
-}
-
 static void
 fill_field_zero_block(short *dst, unsigned dst_pitch)
 {
@@ -1284,23 +1266,8 @@ grab_blocks(struct vl_mpeg12_mc_renderer *r, unsigned mbx, unsigned mby,
 
             ++sb;
          }
-         else if (r->eb_handling != VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_NONE) {
-            if(dct_type == PIPE_MPEG12_DCT_TYPE_FRAME) {
-
-               if (r->eb_handling == VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ALL ||
-                   ZERO_BLOCK_IS_NIL(r->zero_block[0])) {
-
-                  fill_frame_zero_block(texels + y * tex_pitch * BLOCK_WIDTH + x * BLOCK_WIDTH, tex_pitch);
-                  if (r->eb_handling == VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE) {
-                     r->zero_block[0].x = (mbx + x * 0.5f);
-                     r->zero_block[0].y = (mby + y * 0.5f);
-                  }
-               }
-            }
-            else {
-
-               fill_field_zero_block(texels + y * tex_pitch + x * BLOCK_WIDTH, tex_pitch);
-            }
+         else if(dct_type == PIPE_MPEG12_DCT_TYPE_FIELD) {
+            fill_field_zero_block(texels + y * tex_pitch + x * BLOCK_WIDTH, tex_pitch);
          }
       }
    }
@@ -1319,16 +1286,6 @@ grab_blocks(struct vl_mpeg12_mc_renderer *r, unsigned mbx, unsigned mby,
          grab_frame_coded_block(blocks + sb * BLOCK_WIDTH * BLOCK_HEIGHT, texels, tex_pitch);
          ++sb;
       }
-      else if (r->eb_handling != VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_NONE) {
-         if (r->eb_handling == VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ALL ||
-             ZERO_BLOCK_IS_NIL(r->zero_block[tb + 1])) {
-            fill_frame_zero_block(texels, tex_pitch);
-            if (r->eb_handling == VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE) {
-               r->zero_block[tb + 1].x = mbx;
-               r->zero_block[tb + 1].y = mby;
-            }
-         }
-      }
    }
 }
 
@@ -1371,18 +1328,12 @@ vl_mpeg12_mc_renderer_init(struct vl_mpeg12_mc_renderer *renderer,
                            unsigned picture_height,
                            enum pipe_video_chroma_format chroma_format,
                            enum VL_MPEG12_MC_RENDERER_BUFFER_MODE bufmode,
-                           enum VL_MPEG12_MC_RENDERER_EMPTY_BLOCK eb_handling,
                            bool pot_buffers)
 {
-   unsigned i;
-
    assert(renderer);
    assert(pipe);
    /* TODO: Implement other policies */
    assert(bufmode == VL_MPEG12_MC_RENDERER_BUFFER_PICTURE);
-   /* TODO: Implement this */
-   /* XXX: XFER_ALL sampling issue at block edges when using bilinear filtering */
-   assert(eb_handling != VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_NONE);
    /* TODO: Non-pot buffers untested, probably doesn't work without changes to texcoord generation, vert shader, etc */
    assert(pot_buffers);
 
@@ -1393,7 +1344,6 @@ vl_mpeg12_mc_renderer_init(struct vl_mpeg12_mc_renderer *renderer,
    renderer->picture_height = picture_height;
    renderer->chroma_format = chroma_format;
    renderer->bufmode = bufmode;
-   renderer->eb_handling = eb_handling;
    renderer->pot_buffers = pot_buffers;
 
    renderer->texview_map = util_new_keymap(sizeof(struct pipe_surface*), -1,
@@ -1420,8 +1370,6 @@ vl_mpeg12_mc_renderer_init(struct vl_mpeg12_mc_renderer *renderer,
    renderer->surface = NULL;
    renderer->past = NULL;
    renderer->future = NULL;
-   for (i = 0; i < 3; ++i)
-      renderer->zero_block[i].x = ZERO_BLOCK_NIL;
    renderer->num_macroblocks = 0;
 
    xfer_buffers_map(renderer);
index 55441591988a9898342183359125feb6d85202d4..50c38f9ff1019bf8b3989ed927124b9f58a0c4fb 100644 (file)
@@ -44,13 +44,6 @@ enum VL_MPEG12_MC_RENDERER_BUFFER_MODE
    VL_MPEG12_MC_RENDERER_BUFFER_PICTURE /* Larger batches, more memory */
 };
 
-enum VL_MPEG12_MC_RENDERER_EMPTY_BLOCK
-{
-   VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ALL, /* Waste of memory bandwidth */
-   VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE, /* Can only do point-filtering when interpolating subsampled chroma channels */
-   VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_NONE /* Needs conditional texel fetch! */
-};
-
 struct vl_mpeg12_mc_renderer
 {
    struct pipe_context *pipe;
@@ -58,7 +51,6 @@ struct vl_mpeg12_mc_renderer
    unsigned picture_height;
    enum pipe_video_chroma_format chroma_format;
    enum VL_MPEG12_MC_RENDERER_BUFFER_MODE bufmode;
-   enum VL_MPEG12_MC_RENDERER_EMPTY_BLOCK eb_handling;
    bool pot_buffers;
    unsigned macroblocks_per_batch;
 
@@ -104,7 +96,6 @@ struct vl_mpeg12_mc_renderer
    struct pipe_mpeg12_macroblock *macroblock_buf;
    struct pipe_transfer *tex_transfer[3];
    short *texels[3];
-   struct vertex2f zero_block[3];
 
    struct keymap *texview_map;
 };
@@ -115,7 +106,6 @@ bool vl_mpeg12_mc_renderer_init(struct vl_mpeg12_mc_renderer *renderer,
                                 unsigned picture_height,
                                 enum pipe_video_chroma_format chroma_format,
                                 enum VL_MPEG12_MC_RENDERER_BUFFER_MODE bufmode,
-                                enum VL_MPEG12_MC_RENDERER_EMPTY_BLOCK eb_handling,
                                 bool pot_buffers);
 
 void vl_mpeg12_mc_renderer_cleanup(struct vl_mpeg12_mc_renderer *renderer);
index 15a26ea3b3b10a01744fbb596bd4df6761f46439..e6e57ee787cefda7034a6d143422323f5aceb421 100644 (file)
@@ -43,6 +43,5 @@ nv40_video_create(struct pipe_screen *screen, enum pipe_video_profile profile,
 
    return sp_video_create_ex(pipe, profile, chroma_format, width, height,
                              VL_MPEG12_MC_RENDERER_BUFFER_PICTURE,
-                             VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE,
                              true);
 }
index 9212ae57fc06b4aebe2c17575e9a0ba42a36d0e0..58e1c0baa27d75c2b6855ec2f54ce1e7d4b8f2d3 100644 (file)
@@ -43,7 +43,6 @@ nvfx_video_create(struct pipe_screen *screen, enum pipe_video_profile profile,
 
    return sp_video_create_ex(pipe, profile, chroma_format, width, height,
                              VL_MPEG12_MC_RENDERER_BUFFER_PICTURE,
-                             VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE,
                              true,
                              PIPE_FORMAT_VUYX);
 }
index 622f1b8820b9ce785262d33e4e9326e9ef72d3ba..9fe6d6fcf25e2108fef8efab89d67ec34ca6e7f2 100644 (file)
@@ -267,7 +267,6 @@ r300_mpeg12_context_create(struct pipe_screen *screen,
     if (!vl_mpeg12_mc_renderer_init(&ctx->mc_renderer, ctx->pipe,
                                    width, height, chroma_format,
                                    VL_MPEG12_MC_RENDERER_BUFFER_PICTURE,
-                                   VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE,
                                    true))
     {
         ctx->pipe->destroy(ctx->pipe);
index 2bbf622052b7a9166291e7210989eaf287855506..b3885db0f552e51837a0b15afb10dd46457eefa0 100644 (file)
@@ -16,7 +16,6 @@ r600_video_create(struct pipe_screen *screen, enum pipe_video_profile profile,
 
    return sp_video_create_ex(pipe, profile, chroma_format, width, height,
                              VL_MPEG12_MC_RENDERER_BUFFER_PICTURE,
-                             VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE,
                              true,
                              PIPE_FORMAT_VUYX);
 }
index ff217d66c85e5e53288bfe85120443a8d378bb50..3edab82367715af1035352e91c45d835a7e1b773 100644 (file)
@@ -423,7 +423,6 @@ sp_mpeg12_create(struct pipe_context *pipe, enum pipe_video_profile profile,
                  enum pipe_video_chroma_format chroma_format,
                  unsigned width, unsigned height,
                  enum VL_MPEG12_MC_RENDERER_BUFFER_MODE bufmode,
-                 enum VL_MPEG12_MC_RENDERER_EMPTY_BLOCK eb_handling,
                  bool pot_buffers,
                  enum pipe_format decode_format)
 {
@@ -466,7 +465,7 @@ sp_mpeg12_create(struct pipe_context *pipe, enum pipe_video_profile profile,
 
    if (!vl_mpeg12_mc_renderer_init(&ctx->mc_renderer, ctx->pipe,
                                    width, height, chroma_format,
-                                   bufmode, eb_handling, pot_buffers)) {
+                                   bufmode, pot_buffers)) {
       ctx->pipe->destroy(ctx->pipe);
       FREE(ctx);
       return NULL;
@@ -505,12 +504,10 @@ sp_video_create(struct pipe_screen *screen, enum pipe_video_profile profile,
       return NULL;
 
    /* TODO: Use slice buffering for softpipe when implemented, no advantage to buffering an entire picture with softpipe */
-   /* TODO: Use XFER_NONE when implemented */
    return sp_video_create_ex(pipe, profile,
                              chroma_format,
                              width, height,
                              VL_MPEG12_MC_RENDERER_BUFFER_PICTURE,
-                             VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE,
                              true,
                              PIPE_FORMAT_XYUV);
 }
@@ -520,7 +517,6 @@ sp_video_create_ex(struct pipe_context *pipe, enum pipe_video_profile profile,
                    enum pipe_video_chroma_format chroma_format,
                    unsigned width, unsigned height,
                    enum VL_MPEG12_MC_RENDERER_BUFFER_MODE bufmode,
-                   enum VL_MPEG12_MC_RENDERER_EMPTY_BLOCK eb_handling,
                    bool pot_buffers,
                    enum pipe_format decode_format)
 {
@@ -532,7 +528,7 @@ sp_video_create_ex(struct pipe_context *pipe, enum pipe_video_profile profile,
          return sp_mpeg12_create(pipe, profile,
                                  chroma_format,
                                  width, height,
-                                 bufmode, eb_handling,
+                                 bufmode,
                                  pot_buffers,
                                  decode_format);
       default:
index 0fe48d7a872526301a4b8d4fba6600bef3f8acac..dbf1bc1d8ddcadd4c73407561a20b28b40a4f8d6 100644 (file)
@@ -62,7 +62,6 @@ sp_video_create_ex(struct pipe_context *pipe, enum pipe_video_profile profile,
                    enum pipe_video_chroma_format chroma_format,
                    unsigned width, unsigned height,
                    enum VL_MPEG12_MC_RENDERER_BUFFER_MODE bufmode,
-                   enum VL_MPEG12_MC_RENDERER_EMPTY_BLOCK eb_handling,
                    bool pot_buffers,
                    enum pipe_format decode_format);