r300: prepare for texcopy code sharing
authorMaciej Cencora <m.cencora@gmail.com>
Sun, 10 Jan 2010 12:59:39 +0000 (13:59 +0100)
committerMaciej Cencora <m.cencora@gmail.com>
Tue, 19 Jan 2010 22:38:33 +0000 (23:38 +0100)
src/mesa/drivers/dri/r300/r300_blit.c
src/mesa/drivers/dri/r300/r300_blit.h
src/mesa/drivers/dri/r300/r300_context.c
src/mesa/drivers/dri/r300/r300_texcopy.c

index 2eec27e900f1b5ffe99359af27697492d36e344b..37e3f8aa005ffd5a93c22e69ccbcb8f8f29bc05f 100644 (file)
@@ -519,29 +519,31 @@ static void emit_cb_setup(struct r300_context *r300,
  * @param[in] height region height
  * @param[in] flip_y set if y coords of the source image need to be flipped
  */
-GLboolean r300_blit(struct r300_context *r300,
-                    struct radeon_bo *src_bo,
-                    intptr_t src_offset,
-                    gl_format src_mesaformat,
-                    unsigned src_pitch,
-                    unsigned src_width,
-                    unsigned src_height,
-                    unsigned src_x_offset,
-                    unsigned src_y_offset,
-                    struct radeon_bo *dst_bo,
-                    intptr_t dst_offset,
-                    gl_format dst_mesaformat,
-                    unsigned dst_pitch,
-                    unsigned dst_width,
-                    unsigned dst_height,
-                    unsigned dst_x_offset,
-                    unsigned dst_y_offset,
-                    unsigned reg_width,
-                    unsigned reg_height,
-                    unsigned flip_y)
+unsigned r300_blit(GLcontext *ctx,
+                   struct radeon_bo *src_bo,
+                   intptr_t src_offset,
+                   gl_format src_mesaformat,
+                   unsigned src_pitch,
+                   unsigned src_width,
+                   unsigned src_height,
+                   unsigned src_x_offset,
+                   unsigned src_y_offset,
+                   struct radeon_bo *dst_bo,
+                   intptr_t dst_offset,
+                   gl_format dst_mesaformat,
+                   unsigned dst_pitch,
+                   unsigned dst_width,
+                   unsigned dst_height,
+                   unsigned dst_x_offset,
+                   unsigned dst_y_offset,
+                   unsigned reg_width,
+                   unsigned reg_height,
+                   unsigned flip_y)
 {
+    r300ContextPtr r300 = R300_CONTEXT(ctx);
+
     if (_mesa_get_format_bits(src_mesaformat, GL_DEPTH_BITS) > 0)
-        return GL_FALSE;
+        return 0;
 
     /* Make sure that colorbuffer has even width - hw limitation */
     if (dst_pitch % 2 > 0)
@@ -551,7 +553,7 @@ GLboolean r300_blit(struct r300_context *r300,
      * Looks like a hw limitation.
      */
     if (dst_pitch < 32)
-        return GL_FALSE;
+        return 0;
 
     /* Need to clamp the region size to make sure
      * we don't read outside of the source buffer
@@ -567,7 +569,7 @@ GLboolean r300_blit(struct r300_context *r300,
         reg_height = dst_height - dst_y_offset;
 
     if (src_bo == dst_bo) {
-        return GL_FALSE;
+        return 0;
     }
 
     if (0) {
@@ -587,7 +589,7 @@ GLboolean r300_blit(struct r300_context *r300,
     radeonFlush(r300->radeon.glCtx);
 
     if (!validate_buffers(r300, src_bo, dst_bo))
-        return GL_FALSE;
+        return 0;
 
     rcommonEnsureCmdBufSpace(&r300->radeon, 200, __FUNCTION__);
 
@@ -618,5 +620,5 @@ GLboolean r300_blit(struct r300_context *r300,
 
     radeonFlush(r300->radeon.glCtx);
 
-    return GL_TRUE;
-}
\ No newline at end of file
+    return 1;
+}
index dc21e880982aa0b30b721d368058b1026de62ff6..735acaddd703f7f445d133e3457fc919781d110d 100644 (file)
 
 void r300_blit_init(struct r300_context *r300);
 
-GLboolean r300_blit(struct r300_context *r300,
-                    struct radeon_bo *src_bo,
-                    intptr_t src_offset,
-                    gl_format src_mesaformat,
-                    unsigned src_pitch,
-                    unsigned src_width,
-                    unsigned src_height,
-                    unsigned src_x_offset,
-                    unsigned src_y_offset,
-                    struct radeon_bo *dst_bo,
-                    intptr_t dst_offset,
-                    gl_format dst_mesaformat,
-                    unsigned dst_pitch,
-                    unsigned dst_width,
-                    unsigned dst_height,
-                    unsigned dst_x_offset,
-                    unsigned dst_y_offset,
-                    unsigned width,
-                    unsigned height,
-                    unsigned flip_y);
+unsigned r300_blit(GLcontext *ctx,
+                   struct radeon_bo *src_bo,
+                   intptr_t src_offset,
+                   gl_format src_mesaformat,
+                   unsigned src_pitch,
+                   unsigned src_width,
+                   unsigned src_height,
+                   unsigned src_x_offset,
+                   unsigned src_y_offset,
+                   struct radeon_bo *dst_bo,
+                   intptr_t dst_offset,
+                   gl_format dst_mesaformat,
+                   unsigned dst_pitch,
+                   unsigned dst_width,
+                   unsigned dst_height,
+                   unsigned dst_x_offset,
+                   unsigned dst_y_offset,
+                   unsigned reg_width,
+                   unsigned reg_height,
+                   unsigned flip_y);
 
 #endif // R300_BLIT_H
\ No newline at end of file
index 1f6ccf6ddca93e37dd678a55a3160f5745a9236e..e449590fbb832d923307ec8e91a17851d6daa5b4 100644 (file)
@@ -326,6 +326,8 @@ static void r300_init_vtbl(radeonContextPtr radeon)
                        radeon->vtbl.emit_query_finish = rv530_emit_query_finish_single_z;
        } else
                radeon->vtbl.emit_query_finish = r300_emit_query_finish;
+
+    radeon->vtbl.blit = r300_blit;
 }
 
 static void r300InitConstValues(GLcontext *ctx, radeonScreenPtr screen)
index ebc9c05b8a83c676ddb3af2dfa144bf5d481c633..716a38a0a4d952ccb6ad41b350c519a118fdedff 100644 (file)
@@ -34,7 +34,6 @@
 #include "drivers/common/meta.h"
 
 #include "radeon_mipmap_tree.h"
-#include "r300_blit.h"
 #include <main/debug.h>
 
 // TODO:
@@ -84,7 +83,7 @@ do_copy_texsubimage(GLcontext *ctx,
     }
 
     /* blit from src buffer to texture */
-    return r300_blit(r300, rrb->bo, src_offset, rrb->base.Format, rrb->pitch/rrb->cpp,
+    return r300->radeon.vtbl.blit(ctx, rrb->bo, src_offset, rrb->base.Format, rrb->pitch/rrb->cpp,
                      rrb->base.Width, rrb->base.Height, x, y,
                      timg->mt->bo, dst_offset, timg->base.TexFormat,
                      timg->base.Width, timg->base.Width, timg->base.Height,