r600g: misc cleanup

Avoid using r600_screen structure to get ptr to radeon
winsys structure.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
This commit is contained in:
John Doe
2010-09-15 11:47:32 -04:00
parent 26fe16a99b
commit e0b6df4fcc
7 changed files with 47 additions and 46 deletions

View File

@@ -20,6 +20,7 @@
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE. * USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "radeon.h"
#include "r600_asm.h" #include "r600_asm.h"
#include "r600_context.h" #include "r600_context.h"
#include "util/u_memory.h" #include "util/u_memory.h"

View File

@@ -20,11 +20,12 @@
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE. * USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "r600_asm.h" #include "radeon.h"
#include "r600_context.h" #include "r600_context.h"
#include "util/u_memory.h" #include "util/u_memory.h"
#include "r600_sq.h" #include "r600_sq.h"
#include "r600_opcodes.h" #include "r600_opcodes.h"
#include "r600_asm.h"
#include <stdio.h> #include <stdio.h>
#include <errno.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_SIN:
case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS: case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS:
return 1; return 1;
default: R600_ERR( default: R600_ERR(
"Need instruction operand number for 0x%x.\n", alu->inst); "Need instruction operand number for 0x%x.\n", alu->inst);
}; };

View File

@@ -23,7 +23,6 @@
#ifndef R600_ASM_H #ifndef R600_ASM_H
#define R600_ASM_H #define R600_ASM_H
#include "radeon.h"
#include "util/u_double_list.h" #include "util/u_double_list.h"
#define NUM_OF_CYCLES 3 #define NUM_OF_CYCLES 3
@@ -170,10 +169,8 @@ struct r600_bc {
unsigned nresource; unsigned nresource;
unsigned force_add_cf; unsigned force_add_cf;
u32 *bytecode; u32 *bytecode;
u32 fc_sp; u32 fc_sp;
struct r600_cf_stack_entry fc_stack[32]; struct r600_cf_stack_entry fc_stack[32];
unsigned call_sp; unsigned call_sp;
struct r600_cf_callstack callstack[SQ_MAX_CALL_DEPTH]; struct r600_cf_callstack callstack[SQ_MAX_CALL_DEPTH];
}; };
@@ -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_build(struct r600_bc *bc);
int r600_bc_add_cfinst(struct r600_bc *bc, int inst); 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); int r600_bc_add_alu_type(struct r600_bc *bc, const struct r600_bc_alu *alu, int type);
#endif #endif

View File

@@ -62,7 +62,6 @@ struct r600_shader_tgsi_instruction {
}; };
static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[], eg_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 tgsi_helper_tempx_replicate(struct r600_shader_ctx *ctx);
static int r600_shader_update(struct pipe_context *ctx, struct r600_shader *shader) static int r600_shader_update(struct pipe_context *ctx, struct r600_shader *shader)

View File

@@ -46,4 +46,6 @@ struct r600_shader {
boolean use_mem_constant; boolean use_mem_constant;
}; };
int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *shader);
#endif #endif

View 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; struct pipe_resource *ptex = &rtex->resource.base.b;
unsigned long w, h, pitch, size, layer_size, i, offset; 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_texture *rtex;
struct r600_resource *resource; struct r600_resource *resource;
struct r600_screen *rscreen = r600_screen(screen); struct radeon *radeon = (struct radeon *)screen->winsys;
rtex = CALLOC_STRUCT(r600_resource_texture); rtex = CALLOC_STRUCT(r600_resource_texture);
if (!rtex) { if (!rtex) {
@@ -116,11 +116,11 @@ struct pipe_resource *r600_texture_create(struct pipe_screen *screen,
resource->base.vtbl = &r600_texture_vtbl; resource->base.vtbl = &r600_texture_vtbl;
pipe_reference_init(&resource->base.b.reference, 1); pipe_reference_init(&resource->base.b.reference, 1);
resource->base.b.screen = screen; resource->base.b.screen = screen;
r600_setup_miptree(rscreen, rtex); r600_setup_miptree(rtex);
/* FIXME alignment 4096 enought ? too much ? */ /* FIXME alignment 4096 enought ? too much ? */
resource->domain = r600_domain_from_usage(resource->base.b.bind); 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) { if (resource->bo == NULL) {
FREE(rtex); FREE(rtex);
return NULL; 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_texture *rtex = (struct r600_resource_texture*)ptex;
struct r600_resource *resource = &rtex->resource; struct r600_resource *resource = &rtex->resource;
struct r600_screen *rscreen = r600_screen(screen); struct radeon *radeon = (struct radeon *)screen->winsys;
if (resource->bo) { if (resource->bo) {
radeon_bo_decref(rscreen->rw, resource->bo); radeon_bo_decref(radeon, resource->bo);
} }
if (rtex->uncompressed) { if (rtex->uncompressed) {
radeon_bo_decref(rscreen->rw, rtex->uncompressed); radeon_bo_decref(radeon, rtex->uncompressed);
} }
r600_texture_destroy_state(ptex); r600_texture_destroy_state(ptex);
FREE(rtex); FREE(rtex);
@@ -317,7 +317,7 @@ void* r600_texture_transfer_map(struct pipe_context *ctx,
struct r600_transfer *rtransfer = (struct r600_transfer*)transfer; struct r600_transfer *rtransfer = (struct r600_transfer*)transfer;
struct radeon_bo *bo; struct radeon_bo *bo;
enum pipe_format format = transfer->resource->format; 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; struct r600_resource_texture *rtex;
unsigned long offset = 0; unsigned long offset = 0;
char *map; 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.y / util_format_get_blockheight(format) * transfer->stride +
transfer->box.x / util_format_get_blockwidth(format) * util_format_get_blocksize(format); 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; return NULL;
} }
radeon_bo_wait(rscreen->rw, bo); radeon_bo_wait(radeon, bo);
map = bo->data; map = bo->data;
return map + offset; return map + offset;
@@ -355,7 +355,7 @@ void r600_texture_transfer_unmap(struct pipe_context *ctx,
struct pipe_transfer* transfer) struct pipe_transfer* transfer)
{ {
struct r600_transfer *rtransfer = (struct r600_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 r600_resource_texture *rtex;
struct radeon_bo *bo; struct radeon_bo *bo;
@@ -369,7 +369,7 @@ void r600_texture_transfer_unmap(struct pipe_context *ctx,
bo = ((struct r600_resource *)transfer->resource)->bo; 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 = struct u_resource_vtbl r600_texture_vtbl =

View File

@@ -20,8 +20,9 @@
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE. * USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "r600_asm.h" #include "radeon.h"
#include "r600_context.h" #include "r600_context.h"
#include "r600_asm.h"
#include "util/u_memory.h" #include "util/u_memory.h"
#include "r700_sq.h" #include "r700_sq.h"
#include <stdio.h> #include <stdio.h>