Mesa (pipe-video): [g3dvl] correctly implement non power of two buffers

Christian König deathsimple at kemper.freedesktop.org
Sun Mar 20 19:11:22 UTC 2011


Module: Mesa
Branch: pipe-video
Commit: dd6cd206a6395be651bc965580e17c0d63513c7b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=dd6cd206a6395be651bc965580e17c0d63513c7b

Author: Christian König <deathsimple at vodafone.de>
Date:   Sun Mar 20 19:45:06 2011 +0100

[g3dvl] correctly implement non power of two buffers

---

 src/gallium/auxiliary/vl/vl_mpeg12_context.c  |    9 ++-------
 src/gallium/auxiliary/vl/vl_mpeg12_context.h  |    5 +++--
 src/gallium/drivers/r600/r600_video_context.c |    2 +-
 3 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_context.c b/src/gallium/auxiliary/vl/vl_mpeg12_context.c
index a79230d..781ff2a 100644
--- a/src/gallium/auxiliary/vl/vl_mpeg12_context.c
+++ b/src/gallium/auxiliary/vl/vl_mpeg12_context.c
@@ -228,11 +228,7 @@ vl_mpeg12_get_param(struct pipe_video_context *vpipe, int param)
 
    switch (param) {
       case PIPE_CAP_NPOT_TEXTURES:
-         /* XXX: Temporary; not all paths are NPOT-tested */
-#if 0
-         return ctx->pipe->screen->get_param(ctx->pipe->screen, param);
-#endif
-         return FALSE;
+         return !ctx->pot_buffers;
       case PIPE_CAP_DECODE_TARGET_PREFERRED_FORMAT:
          return ctx->decode_format;
       default:
@@ -691,6 +687,7 @@ vl_create_mpeg12_context(struct pipe_context *pipe,
 
    ctx->pipe = pipe;
    ctx->decode_format = decode_format;
+   ctx->pot_buffers = pot_buffers;
 
    ctx->quads = vl_vb_upload_quads(ctx->pipe, 2, 2);
    ctx->vertex_buffer_size = width / MACROBLOCK_WIDTH * height / MACROBLOCK_HEIGHT;
@@ -702,8 +699,6 @@ vl_create_mpeg12_context(struct pipe_context *pipe,
       return NULL;
    }
 
-   /* TODO: Non-pot buffers untested, probably doesn't work without changes to texcoord generation, vert shader, etc */
-   assert(pot_buffers);
    buffer_width = pot_buffers ? util_next_power_of_two(width) : width;
    buffer_height = pot_buffers ? util_next_power_of_two(height) : height;
 
diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_context.h b/src/gallium/auxiliary/vl/vl_mpeg12_context.h
index 6c964fb..c88c436 100644
--- a/src/gallium/auxiliary/vl/vl_mpeg12_context.h
+++ b/src/gallium/auxiliary/vl/vl_mpeg12_context.h
@@ -40,6 +40,9 @@ struct vl_mpeg12_context
 {
    struct pipe_video_context base;
    struct pipe_context *pipe;
+   enum pipe_format decode_format;
+   bool pot_buffers;
+
    struct pipe_surface *decode_target;
    const unsigned (*empty_block_mask)[3][2][2];
 
@@ -57,8 +60,6 @@ struct vl_mpeg12_context
    void *rast;
    void *dsa;
    void *blend;
-
-   enum pipe_format decode_format;
 };
 
 struct vl_mpeg12_buffer
diff --git a/src/gallium/drivers/r600/r600_video_context.c b/src/gallium/drivers/r600/r600_video_context.c
index 0b915d6..8190c9a 100644
--- a/src/gallium/drivers/r600/r600_video_context.c
+++ b/src/gallium/drivers/r600/r600_video_context.c
@@ -47,7 +47,7 @@ r600_video_create(struct pipe_screen *screen, enum pipe_video_profile profile,
          return vl_create_mpeg12_context(pipe, profile,
                                          chroma_format,
                                          width, height,
-                                         true,
+                                         false,
                                          PIPE_FORMAT_XYUV);
       default:
          return NULL;




More information about the mesa-commit mailing list