r600g: misc cleanup
authorJohn Doe <glisse@localhost.localdomain>
Wed, 15 Sep 2010 15:47:32 +0000 (11:47 -0400)
committerJohn Doe <glisse@localhost.localdomain>
Wed, 15 Sep 2010 15:48:34 +0000 (11:48 -0400)
Avoid using r600_screen structure to get ptr to radeon
winsys structure.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
src/gallium/drivers/r600/eg_asm.c
src/gallium/drivers/r600/r600_asm.c
src/gallium/drivers/r600/r600_asm.h
src/gallium/drivers/r600/r600_shader.c
src/gallium/drivers/r600/r600_shader.h
src/gallium/drivers/r600/r600_texture.c
src/gallium/drivers/r600/r700_asm.c

index bc5dda43ed082145c870c5de01d3fc614fc204f0..769f55087442178c3303716e56ea5fb8d0d12102 100644 (file)
@@ -20,6 +20,7 @@
  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  * USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
+#include "radeon.h"
 #include "r600_asm.h"
 #include "r600_context.h"
 #include "util/u_memory.h"
index 662b9b9115d015b76f7d9ce88491b7baa1d9260a..0d17f75da7e41ac6ad1d0c3db1dde1be5adff873 100644 (file)
  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  * USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
-#include "r600_asm.h"
+#include "radeon.h"
 #include "r600_context.h"
 #include "util/u_memory.h"
 #include "r600_sq.h"
 #include "r600_opcodes.h"
+#include "r600_asm.h"
 #include <stdio.h>
 #include <errno.h>
 
@@ -71,7 +72,6 @@ static inline unsigned int r600_bc_get_num_operands(struct r600_bc_alu *alu)
        case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN:
        case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS:
                return 1;
-        
        default: R600_ERR(
                "Need instruction operand number for 0x%x.\n", alu->inst); 
        };
index cc62535e5cd2e332316ca76f25f2a11ee5b1bde0..62a46cb0e1e8e29863a003d05f65aee6b2c08392 100644 (file)
@@ -23,7 +23,6 @@
 #ifndef R600_ASM_H
 #define R600_ASM_H
 
-#include "radeon.h"
 #include "util/u_double_list.h"
 
 #define NUM_OF_CYCLES 3
@@ -53,11 +52,11 @@ struct r600_bc_alu {
        unsigned                        inst;
        unsigned                        last;
        unsigned                        is_op3;
-       unsigned                        predicate;
+       unsigned                        predicate;
        unsigned                        nliteral;
        unsigned                        literal_added;
-       unsigned                        bank_swizzle;
-       unsigned                        bank_swizzle_force;
+       unsigned                        bank_swizzle;
+       unsigned                        bank_swizzle_force;
        u32                             value[4];
        int hw_gpr[NUM_OF_CYCLES][NUM_OF_COMPONENTS];
 };
@@ -124,15 +123,15 @@ struct r600_bc_cf {
        unsigned                        addr;
        unsigned                        ndw;
        unsigned                        id;
-       unsigned                        cond;
-       unsigned                        pop_count;
-       unsigned                        cf_addr; /* control flow addr */
-       unsigned                        kcache0_mode;
+       unsigned                        cond;
+       unsigned                        pop_count;
+       unsigned                        cf_addr; /* control flow addr */
+       unsigned                        kcache0_mode;
        struct list_head                alu;
        struct list_head                tex;
        struct list_head                vtx;
        struct r600_bc_output           output;
-       struct r600_bc_alu *curr_bs_head;
+       struct r600_bc_alu              *curr_bs_head;
 };
 
 #define FC_NONE 0
@@ -143,39 +142,37 @@ struct r600_bc_cf {
 #define FC_PUSH_WQM 5
 
 struct r600_cf_stack_entry {
-       int type;
-       struct r600_bc_cf *start;
-       struct r600_bc_cf **mid; /* used to store the else point */
-       int num_mid;
+       int                             type;
+       struct r600_bc_cf               *start;
+       struct r600_bc_cf               **mid; /* used to store the else point */
+       int                             num_mid;
 };
 
 #define SQ_MAX_CALL_DEPTH 0x00000020
 struct r600_cf_callstack {
-       unsigned fc_sp_before_entry;
-       int sub_desc_index;
-       int current;
-       int max;
+       unsigned                        fc_sp_before_entry;
+       int                             sub_desc_index;
+       int                             current;
+       int                             max;
 };
        
 struct r600_bc {
        enum radeon_family              family;
-       int chiprev; /* 0 - r600, 1 - r700, 2 - evergreen */
-       unsigned                        use_mem_constant; 
+       int                             chiprev; /* 0 - r600, 1 - r700, 2 - evergreen */
+       unsigned                        use_mem_constant; 
        struct list_head                cf;
        struct r600_bc_cf               *cf_last;
        unsigned                        ndw;
        unsigned                        ncf;
        unsigned                        ngpr;
-       unsigned                        nstack;
+       unsigned                        nstack;
        unsigned                        nresource;
        unsigned                        force_add_cf;
        u32                             *bytecode;
-
-       u32 fc_sp;
-       struct r600_cf_stack_entry fc_stack[32];
-
-       unsigned call_sp;
-       struct r600_cf_callstack callstack[SQ_MAX_CALL_DEPTH];
+       u32                             fc_sp;
+       struct r600_cf_stack_entry      fc_stack[32];
+       unsigned                        call_sp;
+       struct r600_cf_callstack        callstack[SQ_MAX_CALL_DEPTH];
 };
 
 int r600_bc_init(struct r600_bc *bc, enum radeon_family family);
@@ -187,4 +184,5 @@ int r600_bc_add_output(struct r600_bc *bc, const struct r600_bc_output *output);
 int r600_bc_build(struct r600_bc *bc);
 int r600_bc_add_cfinst(struct r600_bc *bc, int inst);
 int r600_bc_add_alu_type(struct r600_bc *bc, const struct r600_bc_alu *alu, int type);
+
 #endif
index f12dbd37d386d10fed311ea0194e49bf61d80f8d..0453138d2ba7d51333aabf5e45c5b6b9281411eb 100644 (file)
@@ -51,7 +51,7 @@ struct r600_shader_ctx {
        u32                                     value[4];
        u32                                     *literals;
        u32                                     nliterals;
-       u32                                     max_driver_temp_used;
+       u32                                     max_driver_temp_used;
 };
 
 struct r600_shader_tgsi_instruction {
@@ -62,7 +62,6 @@ struct r600_shader_tgsi_instruction {
 };
 
 static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[], eg_shader_tgsi_instruction[];
-static int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *shader);
 static int tgsi_helper_tempx_replicate(struct r600_shader_ctx *ctx);
 
 static int r600_shader_update(struct pipe_context *ctx, struct r600_shader *shader)
index fba4a2b3b8af918de5c3898d4468cbb46fc60e00..06dd65038d5e4f44a9e660776ac2e46651ce37f6 100644 (file)
@@ -42,8 +42,10 @@ struct r600_shader {
        struct r600_shader_io   input[32];
        struct r600_shader_io   output[32];
        enum radeon_family      family;
-       boolean                 uses_kill;
-       boolean                 use_mem_constant;
+       boolean                 uses_kill;
+       boolean                 use_mem_constant;
 };
 
+int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *shader);
+
 #endif
index 37907ef0e9a5af2416d52bc376c221547aa2100d..6c21abd95aed412bd9577077cec2b8efa84013d2 100644 (file)
@@ -73,7 +73,7 @@ static unsigned long r600_texture_get_offset(struct r600_resource_texture *rtex,
        }
 }
 
-static void r600_setup_miptree(struct r600_screen *rscreen, struct r600_resource_texture *rtex)
+static void r600_setup_miptree(struct r600_resource_texture *rtex)
 {
        struct pipe_resource *ptex = &rtex->resource.base.b;
        unsigned long w, h, pitch, size, layer_size, i, offset;
@@ -105,7 +105,7 @@ struct pipe_resource *r600_texture_create(struct pipe_screen *screen,
 {
        struct r600_resource_texture *rtex;
        struct r600_resource *resource;
-       struct r600_screen *rscreen = r600_screen(screen);
+       struct radeon *radeon = (struct radeon *)screen->winsys;
 
        rtex = CALLOC_STRUCT(r600_resource_texture);
        if (!rtex) {
@@ -116,11 +116,11 @@ struct pipe_resource *r600_texture_create(struct pipe_screen *screen,
        resource->base.vtbl = &r600_texture_vtbl;
        pipe_reference_init(&resource->base.b.reference, 1);
        resource->base.b.screen = screen;
-       r600_setup_miptree(rscreen, rtex);
+       r600_setup_miptree(rtex);
 
        /* FIXME alignment 4096 enought ? too much ? */
        resource->domain = r600_domain_from_usage(resource->base.b.bind);
-       resource->bo = radeon_bo(rscreen->rw, 0, rtex->size, 4096, NULL);
+       resource->bo = radeon_bo(radeon, 0, rtex->size, 4096, NULL);
        if (resource->bo == NULL) {
                FREE(rtex);
                return NULL;
@@ -146,13 +146,13 @@ static void r600_texture_destroy(struct pipe_screen *screen,
 {
        struct r600_resource_texture *rtex = (struct r600_resource_texture*)ptex;
        struct r600_resource *resource = &rtex->resource;
-       struct r600_screen *rscreen = r600_screen(screen);
+       struct radeon *radeon = (struct radeon *)screen->winsys;
 
        if (resource->bo) {
-               radeon_bo_decref(rscreen->rw, resource->bo);
+               radeon_bo_decref(radeon, resource->bo);
        }
        if (rtex->uncompressed) {
-               radeon_bo_decref(rscreen->rw, rtex->uncompressed);
+               radeon_bo_decref(radeon, rtex->uncompressed);
        }
        r600_texture_destroy_state(ptex);
        FREE(rtex);
@@ -317,7 +317,7 @@ void* r600_texture_transfer_map(struct pipe_context *ctx,
        struct r600_transfer *rtransfer = (struct r600_transfer*)transfer;
        struct radeon_bo *bo;
        enum pipe_format format = transfer->resource->format;
-       struct r600_screen *rscreen = r600_screen(ctx->screen);
+       struct radeon *radeon = (struct radeon *)ctx->screen->winsys;
        struct r600_resource_texture *rtex;
        unsigned long offset = 0;
        char *map;
@@ -342,10 +342,10 @@ void* r600_texture_transfer_map(struct pipe_context *ctx,
                        transfer->box.y / util_format_get_blockheight(format) * transfer->stride +
                        transfer->box.x / util_format_get_blockwidth(format) * util_format_get_blocksize(format);
        }
-       if (radeon_bo_map(rscreen->rw, bo)) {
+       if (radeon_bo_map(radeon, bo)) {
                return NULL;
        }
-       radeon_bo_wait(rscreen->rw, bo);
+       radeon_bo_wait(radeon, bo);
 
        map = bo->data;
        return map + offset;
@@ -355,7 +355,7 @@ void r600_texture_transfer_unmap(struct pipe_context *ctx,
                                 struct pipe_transfer* transfer)
 {
        struct r600_transfer *rtransfer = (struct r600_transfer*)transfer;
-       struct r600_screen *rscreen = r600_screen(ctx->screen);
+       struct radeon *radeon = (struct radeon *)ctx->screen->winsys;
        struct r600_resource_texture *rtex;
        struct radeon_bo *bo;
 
@@ -369,7 +369,7 @@ void r600_texture_transfer_unmap(struct pipe_context *ctx,
                        bo = ((struct r600_resource *)transfer->resource)->bo;
                }
        }
-       radeon_bo_unmap(rscreen->rw, bo);
+       radeon_bo_unmap(radeon, bo);
 }
 
 struct u_resource_vtbl r600_texture_vtbl =
@@ -495,7 +495,7 @@ uint32_t r600_translate_texformat(enum pipe_format format,
        default:
                break;
        }
-       
+
        /* S3TC formats. TODO */
        if (desc->layout == UTIL_FORMAT_LAYOUT_S3TC) {
                goto out_unknown;
index e754d733afc7283dd1da98a0d41c84e90a82fb0c..a78cf0ce950944ca144e02fe640f9cd23ad93a99 100644 (file)
@@ -20,8 +20,9 @@
  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  * USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
-#include "r600_asm.h"
+#include "radeon.h"
 #include "r600_context.h"
+#include "r600_asm.h"
 #include "util/u_memory.h"
 #include "r700_sq.h"
 #include <stdio.h>