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:
@@ -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"
|
||||||
|
@@ -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);
|
||||||
};
|
};
|
||||||
|
@@ -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
|
||||||
@@ -53,11 +52,11 @@ struct r600_bc_alu {
|
|||||||
unsigned inst;
|
unsigned inst;
|
||||||
unsigned last;
|
unsigned last;
|
||||||
unsigned is_op3;
|
unsigned is_op3;
|
||||||
unsigned predicate;
|
unsigned predicate;
|
||||||
unsigned nliteral;
|
unsigned nliteral;
|
||||||
unsigned literal_added;
|
unsigned literal_added;
|
||||||
unsigned bank_swizzle;
|
unsigned bank_swizzle;
|
||||||
unsigned bank_swizzle_force;
|
unsigned bank_swizzle_force;
|
||||||
u32 value[4];
|
u32 value[4];
|
||||||
int hw_gpr[NUM_OF_CYCLES][NUM_OF_COMPONENTS];
|
int hw_gpr[NUM_OF_CYCLES][NUM_OF_COMPONENTS];
|
||||||
};
|
};
|
||||||
@@ -124,15 +123,15 @@ struct r600_bc_cf {
|
|||||||
unsigned addr;
|
unsigned addr;
|
||||||
unsigned ndw;
|
unsigned ndw;
|
||||||
unsigned id;
|
unsigned id;
|
||||||
unsigned cond;
|
unsigned cond;
|
||||||
unsigned pop_count;
|
unsigned pop_count;
|
||||||
unsigned cf_addr; /* control flow addr */
|
unsigned cf_addr; /* control flow addr */
|
||||||
unsigned kcache0_mode;
|
unsigned kcache0_mode;
|
||||||
struct list_head alu;
|
struct list_head alu;
|
||||||
struct list_head tex;
|
struct list_head tex;
|
||||||
struct list_head vtx;
|
struct list_head vtx;
|
||||||
struct r600_bc_output output;
|
struct r600_bc_output output;
|
||||||
struct r600_bc_alu *curr_bs_head;
|
struct r600_bc_alu *curr_bs_head;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define FC_NONE 0
|
#define FC_NONE 0
|
||||||
@@ -143,39 +142,37 @@ struct r600_bc_cf {
|
|||||||
#define FC_PUSH_WQM 5
|
#define FC_PUSH_WQM 5
|
||||||
|
|
||||||
struct r600_cf_stack_entry {
|
struct r600_cf_stack_entry {
|
||||||
int type;
|
int type;
|
||||||
struct r600_bc_cf *start;
|
struct r600_bc_cf *start;
|
||||||
struct r600_bc_cf **mid; /* used to store the else point */
|
struct r600_bc_cf **mid; /* used to store the else point */
|
||||||
int num_mid;
|
int num_mid;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SQ_MAX_CALL_DEPTH 0x00000020
|
#define SQ_MAX_CALL_DEPTH 0x00000020
|
||||||
struct r600_cf_callstack {
|
struct r600_cf_callstack {
|
||||||
unsigned fc_sp_before_entry;
|
unsigned fc_sp_before_entry;
|
||||||
int sub_desc_index;
|
int sub_desc_index;
|
||||||
int current;
|
int current;
|
||||||
int max;
|
int max;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct r600_bc {
|
struct r600_bc {
|
||||||
enum radeon_family family;
|
enum radeon_family family;
|
||||||
int chiprev; /* 0 - r600, 1 - r700, 2 - evergreen */
|
int chiprev; /* 0 - r600, 1 - r700, 2 - evergreen */
|
||||||
unsigned use_mem_constant;
|
unsigned use_mem_constant;
|
||||||
struct list_head cf;
|
struct list_head cf;
|
||||||
struct r600_bc_cf *cf_last;
|
struct r600_bc_cf *cf_last;
|
||||||
unsigned ndw;
|
unsigned ndw;
|
||||||
unsigned ncf;
|
unsigned ncf;
|
||||||
unsigned ngpr;
|
unsigned ngpr;
|
||||||
unsigned nstack;
|
unsigned nstack;
|
||||||
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;
|
||||||
|
struct r600_cf_callstack callstack[SQ_MAX_CALL_DEPTH];
|
||||||
unsigned call_sp;
|
|
||||||
struct r600_cf_callstack callstack[SQ_MAX_CALL_DEPTH];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
int r600_bc_init(struct r600_bc *bc, enum radeon_family family);
|
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_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
|
||||||
|
@@ -51,7 +51,7 @@ struct r600_shader_ctx {
|
|||||||
u32 value[4];
|
u32 value[4];
|
||||||
u32 *literals;
|
u32 *literals;
|
||||||
u32 nliterals;
|
u32 nliterals;
|
||||||
u32 max_driver_temp_used;
|
u32 max_driver_temp_used;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct r600_shader_tgsi_instruction {
|
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 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)
|
||||||
|
@@ -42,8 +42,10 @@ struct r600_shader {
|
|||||||
struct r600_shader_io input[32];
|
struct r600_shader_io input[32];
|
||||||
struct r600_shader_io output[32];
|
struct r600_shader_io output[32];
|
||||||
enum radeon_family family;
|
enum radeon_family family;
|
||||||
boolean uses_kill;
|
boolean uses_kill;
|
||||||
boolean use_mem_constant;
|
boolean use_mem_constant;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *shader);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -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 =
|
||||||
|
@@ -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>
|
||||||
|
Reference in New Issue
Block a user