summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2010-04-05 03:19:08 +0200
committerMarek Olšák <[email protected]>2010-04-05 07:09:46 +0200
commitb71bfc4400e1d7c15a2bebbbd3b26a8770fbf546 (patch)
tree9988c965cb23b78c5eeeb032b39dccc6da961551
parent32327196f7f7a97bebc462a1ba94270580ef3fe9 (diff)
r300g: simplify accessing screen from context
-rw-r--r--src/gallium/drivers/r300/r300_context.c7
-rw-r--r--src/gallium/drivers/r300/r300_context.h4
-rw-r--r--src/gallium/drivers/r300/r300_emit.c48
-rw-r--r--src/gallium/drivers/r300/r300_flush.c2
-rw-r--r--src/gallium/drivers/r300/r300_fs.c2
-rw-r--r--src/gallium/drivers/r300/r300_query.c16
-rw-r--r--src/gallium/drivers/r300/r300_render.c4
-rw-r--r--src/gallium/drivers/r300/r300_screen.c32
-rw-r--r--src/gallium/drivers/r300/r300_screen.h2
-rw-r--r--src/gallium/drivers/r300/r300_state.c46
-rw-r--r--src/gallium/drivers/r300/r300_state_derived.c2
-rw-r--r--src/gallium/drivers/r300/r300_state_invariant.c2
-rw-r--r--src/gallium/drivers/r300/r300_texture.c6
13 files changed, 79 insertions, 94 deletions
diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c
index 4b470b2c6af..1e1c7161eca 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -107,8 +107,8 @@ static void r300_flush_cb(void *data)
static void r300_setup_atoms(struct r300_context* r300)
{
- boolean is_r500 = r300_screen(r300->context.screen)->caps->is_r500;
- boolean has_tcl = r300_screen(r300->context.screen)->caps->has_tcl;
+ boolean is_r500 = r300->screen->caps.is_r500;
+ boolean has_tcl = r300->screen->caps.has_tcl;
/* Create the actual atom list.
*
@@ -159,6 +159,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
return NULL;
r300->rws = rws;
+ r300->screen = r300screen;
r300->context.winsys = (struct pipe_winsys*)rws;
r300->context.screen = screen;
@@ -170,7 +171,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
r300->context.surface_copy = r300_surface_copy;
r300->context.surface_fill = r300_surface_fill;
- if (r300screen->caps->has_tcl) {
+ if (r300screen->caps.has_tcl) {
r300->context.draw_arrays = r300_draw_arrays;
r300->context.draw_elements = r300_draw_elements;
r300->context.draw_range_elements = r300_draw_range_elements;
diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
index 108ab453a47..351bd2cdaee 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -292,6 +292,8 @@ struct r300_context {
/* The interface to the windowing system, etc. */
struct r300_winsys_screen *rws;
+ /* Screen. */
+ struct r300_screen *screen;
/* Draw module. Used mostly for SW TCL. */
struct draw_context* draw;
/* Accelerated blit support. */
@@ -403,7 +405,7 @@ void r300_init_tex_functions( struct pipe_context *pipe );
static INLINE boolean CTX_DBG_ON(struct r300_context * ctx, unsigned flags)
{
- return SCREEN_DBG_ON(r300_screen(ctx->context.screen), flags);
+ return SCREEN_DBG_ON(ctx->screen, flags);
}
static INLINE void CTX_DBG(struct r300_context * ctx, unsigned flags,
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index 15bcf8907f3..6ef140d8a36 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -64,10 +64,9 @@ void r300_emit_blend_color_state(struct r300_context* r300,
unsigned size, void* state)
{
struct r300_blend_color_state* bc = (struct r300_blend_color_state*)state;
- struct r300_screen* r300screen = r300_screen(r300->context.screen);
CS_LOCALS(r300);
- if (r300screen->caps->is_r500) {
+ if (r300->screen->caps.is_r500) {
BEGIN_CS(size);
OUT_CS_REG_SEQ(R500_RB3D_CONSTANT_COLOR_AR, 2);
OUT_CS(bc->blend_color_red_alpha);
@@ -85,13 +84,12 @@ void r300_emit_clip_state(struct r300_context* r300,
{
struct pipe_clip_state* clip = (struct pipe_clip_state*)state;
int i;
- struct r300_screen* r300screen = r300_screen(r300->context.screen);
CS_LOCALS(r300);
- if (r300screen->caps->has_tcl) {
+ if (r300->screen->caps.has_tcl) {
BEGIN_CS(size);
OUT_CS_REG(R300_VAP_PVS_VECTOR_INDX_REG,
- (r300screen->caps->is_r500 ?
+ (r300->screen->caps.is_r500 ?
R500_PVS_UCP_START : R300_PVS_UCP_START));
OUT_CS_ONE_REG(R300_VAP_PVS_UPLOAD_DATA, 6 * 4);
for (i = 0; i < 6; i++) {
@@ -114,7 +112,6 @@ void r300_emit_clip_state(struct r300_context* r300,
void r300_emit_dsa_state(struct r300_context* r300, unsigned size, void* state)
{
struct r300_dsa_state* dsa = (struct r300_dsa_state*)state;
- struct r300_screen* r300screen = r300_screen(r300->context.screen);
struct pipe_framebuffer_state* fb =
(struct pipe_framebuffer_state*)r300->fb_state.state;
struct pipe_stencil_ref stencil_ref = r300->stencil_ref;
@@ -134,7 +131,7 @@ void r300_emit_dsa_state(struct r300_context* r300, unsigned size, void* state)
OUT_CS(dsa->stencil_ref_mask | stencil_ref.ref_value[0]);
- if (r300screen->caps->is_r500) {
+ if (r300->screen->caps.is_r500) {
OUT_CS_REG(R500_ZB_STENCILREFMASK_BF, dsa->stencil_ref_bf | stencil_ref.ref_value[1]);
}
END_CS;
@@ -377,7 +374,6 @@ void r500_emit_fs_constant_buffer(struct r300_context* r300,
void r300_emit_fb_state(struct r300_context* r300, unsigned size, void* state)
{
struct pipe_framebuffer_state* fb = (struct pipe_framebuffer_state*)state;
- struct r300_screen* r300screen = r300_screen(r300->context.screen);
struct r300_texture* tex;
struct pipe_surface* surf;
int i;
@@ -395,7 +391,7 @@ void r300_emit_fb_state(struct r300_context* r300, unsigned size, void* state)
/* Set the number of colorbuffers. */
if (fb->nr_cbufs > 1) {
- if (r300screen->caps->is_r500) {
+ if (r300->screen->caps.is_r500) {
OUT_CS_REG(R300_RB3D_CCTL,
R300_RB3D_CCTL_NUM_MULTIWRITES(fb->nr_cbufs) |
R300_RB3D_CCTL_INDEPENDENT_COLORFORMAT_ENABLE_ENABLE);
@@ -449,7 +445,6 @@ void r300_emit_fb_state(struct r300_context* r300, unsigned size, void* state)
void r300_emit_query_start(struct r300_context *r300)
{
- struct r300_capabilities *caps = r300_screen(r300->context.screen)->caps;
struct r300_query *query = r300->query_current;
CS_LOCALS(r300);
@@ -457,7 +452,7 @@ void r300_emit_query_start(struct r300_context *r300)
return;
BEGIN_CS(4);
- if (caps->family == CHIP_FAMILY_RV530) {
+ if (r300->screen->caps.family == CHIP_FAMILY_RV530) {
OUT_CS_REG(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_ALL);
} else {
OUT_CS_REG(R300_SU_REG_DEST, R300_RASTER_PIPE_SELECT_ALL);
@@ -471,7 +466,7 @@ void r300_emit_query_start(struct r300_context *r300)
static void r300_emit_query_finish(struct r300_context *r300,
struct r300_query *query)
{
- struct r300_capabilities* caps = r300_screen(r300->context.screen)->caps;
+ struct r300_capabilities* caps = &r300->screen->caps;
CS_LOCALS(r300);
assert(caps->num_frag_pipes);
@@ -555,7 +550,7 @@ static void rv530_emit_query_double(struct r300_context *r300,
void r300_emit_query_end(struct r300_context* r300)
{
- struct r300_capabilities *caps = r300_screen(r300->context.screen)->caps;
+ struct r300_capabilities *caps = &r300->screen->caps;
struct r300_query *query = r300->query_current;
if (!query)
@@ -621,7 +616,6 @@ void r300_emit_rs_block_state(struct r300_context* r300,
{
struct r300_rs_block* rs = (struct r300_rs_block*)state;
unsigned i;
- struct r300_screen* r300screen = r300_screen(r300->context.screen);
/* It's the same for both INST and IP tables */
unsigned count = (rs->inst_count & R300_RS_INST_COUNT_MASK) + 1;
CS_LOCALS(r300);
@@ -629,7 +623,7 @@ void r300_emit_rs_block_state(struct r300_context* r300,
DBG(r300, DBG_DRAW, "r300: RS emit:\n");
BEGIN_CS(size);
- if (r300screen->caps->is_r500) {
+ if (r300->screen->caps.is_r500) {
OUT_CS_REG_SEQ(R500_RS_IP_0, count);
} else {
OUT_CS_REG_SEQ(R300_RS_IP_0, count);
@@ -643,7 +637,7 @@ void r300_emit_rs_block_state(struct r300_context* r300,
OUT_CS(rs->count);
OUT_CS(rs->inst_count);
- if (r300screen->caps->is_r500) {
+ if (r300->screen->caps.is_r500) {
OUT_CS_REG_SEQ(R500_RS_INST_0, count);
} else {
OUT_CS_REG_SEQ(R300_RS_INST_0, count);
@@ -664,7 +658,6 @@ void r300_emit_scissor_state(struct r300_context* r300,
{
unsigned minx, miny, maxx, maxy;
uint32_t top_left, bottom_right;
- struct r300_screen* r300screen = r300_screen(r300->context.screen);
struct pipe_scissor_state* scissor = (struct pipe_scissor_state*)state;
struct pipe_framebuffer_state* fb =
(struct pipe_framebuffer_state*)r300->fb_state.state;
@@ -697,7 +690,7 @@ void r300_emit_scissor_state(struct r300_context* r300,
maxy = 1;
}
- if (r300screen->caps->is_r500) {
+ if (r300->screen->caps.is_r500) {
top_left =
(minx << R300_SCISSORS_X_SHIFT) |
(miny << R300_SCISSORS_Y_SHIFT);
@@ -876,11 +869,11 @@ void r300_emit_vs_state(struct r300_context* r300, unsigned size, void* state)
{
struct r300_vertex_shader* vs = (struct r300_vertex_shader*)state;
struct r300_vertex_program_code* code = &vs->code;
- struct r300_screen* r300screen = r300_screen(r300->context.screen);
+ struct r300_screen* r300screen = r300->screen;
unsigned instruction_count = code->length / 4;
unsigned i;
- unsigned vtx_mem_size = r300screen->caps->is_r500 ? 128 : 72;
+ unsigned vtx_mem_size = r300screen->caps.is_r500 ? 128 : 72;
unsigned input_count = MAX2(util_bitcount(code->InputsRead), 1);
unsigned output_count = MAX2(util_bitcount(code->OutputsWritten), 1);
unsigned temp_count = MAX2(code->num_temporaries, 1);
@@ -911,22 +904,21 @@ void r300_emit_vs_state(struct r300_context* r300, unsigned size, void* state)
OUT_CS_REG(R300_VAP_CNTL, R300_PVS_NUM_SLOTS(pvs_num_slots) |
R300_PVS_NUM_CNTLRS(pvs_num_controllers) |
- R300_PVS_NUM_FPUS(r300screen->caps->num_vert_fpus) |
+ R300_PVS_NUM_FPUS(r300screen->caps.num_vert_fpus) |
R300_PVS_VF_MAX_VTX_NUM(12) |
- (r300screen->caps->is_r500 ? R500_TCL_STATE_OPTIMIZATION : 0));
+ (r300screen->caps.is_r500 ? R500_TCL_STATE_OPTIMIZATION : 0));
END_CS;
}
void r300_emit_vs_constant_buffer(struct r300_context* r300,
struct rc_constant_list* constants)
{
- struct r300_screen* r300screen = r300_screen(r300->context.screen);
unsigned i;
CS_LOCALS(r300);
BEGIN_CS(constants->Count * 4 + 3);
OUT_CS_REG(R300_VAP_PVS_VECTOR_INDX_REG,
- (r300screen->caps->is_r500 ?
+ (r300->screen->caps.is_r500 ?
R500_PVS_CONST_START : R300_PVS_CONST_START));
OUT_CS_ONE_REG(R300_VAP_PVS_UPLOAD_DATA, constants->Count * 4);
for (i = 0; i < constants->Count; i++) {
@@ -1105,7 +1097,7 @@ unsigned r300_get_num_dirty_dwords(struct r300_context *r300)
/* Emit all dirty state. */
void r300_emit_dirty_state(struct r300_context* r300)
{
- struct r300_screen* r300screen = r300_screen(r300->context.screen);
+ struct r300_screen* r300screen = r300->screen;
struct r300_atom* atom;
if (r300->dirty_state & R300_NEW_QUERY) {
@@ -1122,7 +1114,7 @@ void r300_emit_dirty_state(struct r300_context* r300)
if (r300->dirty_state & R300_NEW_FRAGMENT_SHADER) {
r300_emit_fragment_depth_config(r300, r300->fs);
- if (r300screen->caps->is_r500) {
+ if (r300screen->caps.is_r500) {
r500_emit_fragment_program_code(r300, &r300->fs->shader->code);
} else {
r300_emit_fragment_program_code(r300, &r300->fs->shader->code);
@@ -1131,7 +1123,7 @@ void r300_emit_dirty_state(struct r300_context* r300)
}
if (r300->dirty_state & R300_NEW_FRAGMENT_SHADER_CONSTANTS) {
- if (r300screen->caps->is_r500) {
+ if (r300screen->caps.is_r500) {
r500_emit_fs_constant_buffer(r300,
&r300->fs->shader->code.constants);
} else {
@@ -1154,7 +1146,7 @@ void r300_emit_dirty_state(struct r300_context* r300)
*/
/* Emit the VBO for SWTCL. */
- if (!r300screen->caps->has_tcl) {
+ if (!r300screen->caps.has_tcl) {
r300_emit_vertex_buffer(r300);
}
diff --git a/src/gallium/drivers/r300/r300_flush.c b/src/gallium/drivers/r300/r300_flush.c
index 70de152713d..0aa2e357353 100644
--- a/src/gallium/drivers/r300/r300_flush.c
+++ b/src/gallium/drivers/r300/r300_flush.c
@@ -63,7 +63,7 @@ static void r300_flush(struct pipe_context* pipe,
}
/* Unmark HWTCL state for SWTCL. */
- if (!r300_screen(pipe->screen)->caps->has_tcl) {
+ if (!r300->screen->caps.has_tcl) {
r300->vs_state.dirty = FALSE;
r300->dirty_state &= ~R300_NEW_VERTEX_SHADER_CONSTANTS;
}
diff --git a/src/gallium/drivers/r300/r300_fs.c b/src/gallium/drivers/r300/r300_fs.c
index 116bb80007d..b70bb51ba2d 100644
--- a/src/gallium/drivers/r300/r300_fs.c
+++ b/src/gallium/drivers/r300/r300_fs.c
@@ -168,7 +168,7 @@ static void r300_translate_fragment_shader(
compiler.code = &shader->code;
compiler.state = shader->compare_state;
- compiler.is_r500 = r300_screen(r300->context.screen)->caps->is_r500;
+ compiler.is_r500 = r300->screen->caps.is_r500;
compiler.max_temp_regs = compiler.is_r500 ? 128 : 32;
compiler.AllocateHwInputs = &allocate_hardware_inputs;
compiler.UserData = &fs->inputs;
diff --git a/src/gallium/drivers/r300/r300_query.c b/src/gallium/drivers/r300/r300_query.c
index 1778dc9ccaa..bc40fcfb5ba 100644
--- a/src/gallium/drivers/r300/r300_query.c
+++ b/src/gallium/drivers/r300/r300_query.c
@@ -36,7 +36,7 @@ static struct pipe_query *r300_create_query(struct pipe_context *pipe,
unsigned query_type)
{
struct r300_context *r300 = r300_context(pipe);
- struct r300_screen *r300screen = r300_screen(r300->context.screen);
+ struct r300_screen *r300screen = r300->screen;
unsigned query_size;
struct r300_query *q, *qptr;
@@ -47,10 +47,10 @@ static struct pipe_query *r300_create_query(struct pipe_context *pipe,
q->active = FALSE;
- if (r300screen->caps->family == CHIP_FAMILY_RV530)
- query_size = r300screen->caps->num_z_pipes * sizeof(uint32_t);
+ if (r300screen->caps.family == CHIP_FAMILY_RV530)
+ query_size = r300screen->caps.num_z_pipes * sizeof(uint32_t);
else
- query_size = r300screen->caps->num_frag_pipes * sizeof(uint32_t);
+ query_size = r300screen->caps.num_frag_pipes * sizeof(uint32_t);
if (!is_empty_list(&r300->query_list)) {
qptr = last_elem(&r300->query_list);
@@ -112,7 +112,7 @@ static boolean r300_get_query_result(struct pipe_context* pipe,
uint64_t* result)
{
struct r300_context* r300 = r300_context(pipe);
- struct r300_screen* r300screen = r300_screen(r300->context.screen);
+ struct r300_screen* r300screen = r300->screen;
struct r300_query *q = (struct r300_query*)query;
unsigned flags = PIPE_BUFFER_USAGE_CPU_READ;
uint32_t* map;
@@ -130,10 +130,10 @@ static boolean r300_get_query_result(struct pipe_context* pipe,
return FALSE;
map += q->offset / 4;
- if (r300screen->caps->family == CHIP_FAMILY_RV530)
- num_results = r300screen->caps->num_z_pipes;
+ if (r300screen->caps.family == CHIP_FAMILY_RV530)
+ num_results = r300screen->caps.num_z_pipes;
else
- num_results = r300screen->caps->num_frag_pipes;
+ num_results = r300screen->caps.num_frag_pipes;
for (i = 0; i < num_results; i++) {
if (*map == ~0U) {
diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c
index bba9ef251ee..c2b13235a16 100644
--- a/src/gallium/drivers/r300/r300_render.c
+++ b/src/gallium/drivers/r300/r300_render.c
@@ -420,7 +420,7 @@ void r300_draw_range_elements(struct pipe_context* pipe,
struct r300_context* r300 = r300_context(pipe);
struct pipe_buffer* orgIndexBuffer = indexBuffer;
#if defined(ENABLE_ALT_NUM_VERTS)
- boolean alt_num_verts = r300_screen(pipe->screen)->caps->is_r500 &&
+ boolean alt_num_verts = r300->screen->caps.is_r500 &&
count > 65536;
#else
boolean alt_num_verts = FALSE;
@@ -500,7 +500,7 @@ void r300_draw_arrays(struct pipe_context* pipe, unsigned mode,
{
struct r300_context* r300 = r300_context(pipe);
#if defined(ENABLE_ALT_NUM_VERTS)
- boolean alt_num_verts = r300_screen(pipe->screen)->caps->is_r500 &&
+ boolean alt_num_verts = r300->screen->caps.is_r500 &&
count > 65536;
#else
boolean alt_num_verts = FALSE;
diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
index 0a98458dc37..b52850674f6 100644
--- a/src/gallium/drivers/r300/r300_screen.c
+++ b/src/gallium/drivers/r300/r300_screen.c
@@ -72,7 +72,7 @@ static const char* r300_get_name(struct pipe_screen* pscreen)
{
struct r300_screen* r300screen = r300_screen(pscreen);
- return chip_families[r300screen->caps->family];
+ return chip_families[r300screen->caps.family];
}
static int r300_get_param(struct pipe_screen* pscreen, int param)
@@ -82,13 +82,13 @@ static int r300_get_param(struct pipe_screen* pscreen, int param)
switch (param) {
case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS:
case PIPE_CAP_MAX_COMBINED_SAMPLERS:
- return r300screen->caps->num_tex_units;
+ return r300screen->caps.num_tex_units;
case PIPE_CAP_NPOT_TEXTURES:
/* XXX enable now to get GL2.1 API,
* figure out later how to emulate this */
return 1;
case PIPE_CAP_TWO_SIDED_STENCIL:
- if (r300screen->caps->is_r500) {
+ if (r300screen->caps.is_r500) {
return 1;
} else {
return 0;
@@ -125,7 +125,7 @@ static int r300_get_param(struct pipe_screen* pscreen, int param)
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
- if (r300screen->caps->is_r500) {
+ if (r300screen->caps.is_r500) {
/* 13 == 4096 */
return 13;
} else {
@@ -143,7 +143,7 @@ static int r300_get_param(struct pipe_screen* pscreen, int param)
case PIPE_CAP_BLEND_EQUATION_SEPARATE:
return 1;
case PIPE_CAP_SM3:
- if (r300screen->caps->is_r500) {
+ if (r300screen->caps.is_r500) {
return 1;
} else {
return 0;
@@ -180,9 +180,9 @@ static float r300_get_paramf(struct pipe_screen* pscreen, int param)
case PIPE_CAP_MAX_POINT_WIDTH_AA:
/* The maximum dimensions of the colorbuffer are our practical
* rendering limits. 2048 pixels should be enough for anybody. */
- if (r300screen->caps->is_r500) {
+ if (r300screen->caps.is_r500) {
return 4096.0f;
- } else if (r300screen->caps->is_r400) {
+ } else if (r300screen->caps.is_r400) {
return 4021.0f;
} else {
return 2560.0f;
@@ -205,8 +205,8 @@ static boolean r300_is_format_supported(struct pipe_screen* screen,
unsigned geom_flags)
{
uint32_t retval = 0;
- boolean is_r500 = r300_screen(screen)->caps->is_r500;
- boolean is_r400 = r300_screen(screen)->caps->is_r400;
+ boolean is_r500 = r300_screen(screen)->caps.is_r500;
+ boolean is_r400 = r300_screen(screen)->caps.is_r400;
boolean is_z24 = format == PIPE_FORMAT_X8Z24_UNORM ||
format == PIPE_FORMAT_S8_USCALED_Z24_UNORM;
boolean is_color2101010 = format == PIPE_FORMAT_R10G10B10A2_UNORM;
@@ -265,29 +265,25 @@ static void r300_destroy_screen(struct pipe_screen* pscreen)
if (rws)
rws->destroy(rws);
- FREE(r300screen->caps);
FREE(r300screen);
}
struct pipe_screen* r300_create_screen(struct r300_winsys_screen *rws)
{
struct r300_screen *r300screen = CALLOC_STRUCT(r300_screen);
- struct r300_capabilities *caps = CALLOC_STRUCT(r300_capabilities);
- if (!r300screen || !caps) {
+ if (!r300screen) {
FREE(r300screen);
- FREE(caps);
return NULL;
}
- caps->pci_id = rws->get_value(rws, R300_VID_PCI_ID);
- caps->num_frag_pipes = rws->get_value(rws, R300_VID_GB_PIPES);
- caps->num_z_pipes = rws->get_value(rws, R300_VID_Z_PIPES);
+ r300screen->caps.pci_id = rws->get_value(rws, R300_VID_PCI_ID);
+ r300screen->caps.num_frag_pipes = rws->get_value(rws, R300_VID_GB_PIPES);
+ r300screen->caps.num_z_pipes = rws->get_value(rws, R300_VID_Z_PIPES);
r300_init_debug(r300screen);
- r300_parse_chipset(caps);
+ r300_parse_chipset(&r300screen->caps);
- r300screen->caps = caps;
r300screen->rws = rws;
r300screen->screen.winsys = (struct pipe_winsys*)rws;
r300screen->screen.destroy = r300_destroy_screen;
diff --git a/src/gallium/drivers/r300/r300_screen.h b/src/gallium/drivers/r300/r300_screen.h
index 1cf8b7452d7..159805840d9 100644
--- a/src/gallium/drivers/r300/r300_screen.h
+++ b/src/gallium/drivers/r300/r300_screen.h
@@ -37,7 +37,7 @@ struct r300_screen {
struct r300_winsys_screen *rws;
/* Chipset capabilities */
- struct r300_capabilities* caps;
+ struct r300_capabilities caps;
/** Combination of DBG_xxx flags */
unsigned debug;
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index d1486a20395..2adb3e7221b 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -219,7 +219,7 @@ static void* r300_create_blend_state(struct pipe_context* pipe,
/* Enable reading from the colorbuffer. */
blend->blend_control |= R300_READ_ENABLE;
- if (r300_screen(r300_context(pipe)->context.screen)->caps->is_r500) {
+ if (r300screen->caps.is_r500) {
/* Optimization: Depending on incoming pixels, we can
* conditionally disable the reading in hardware... */
if (eqRGB != PIPE_BLEND_MIN && eqA != PIPE_BLEND_MIN &&
@@ -308,7 +308,7 @@ static void* r300_create_blend_state(struct pipe_context* pipe,
/* Color channel masks for all MRTs. */
blend->color_channel_mask = bgra_cmask(state->rt[0].colormask);
- if (r300screen->caps->is_r500 && state->independent_blend_enable) {
+ if (r300screen->caps.is_r500 && state->independent_blend_enable) {
if (state->rt[1].blend_enable) {
blend->color_channel_mask |= bgra_cmask(state->rt[1].colormask) << 4;
}
@@ -363,7 +363,6 @@ static void r300_set_blend_color(struct pipe_context* pipe,
const struct pipe_blend_color* color)
{
struct r300_context* r300 = r300_context(pipe);
- struct r300_screen* r300screen = r300_screen(pipe->screen);
struct r300_blend_color_state* state =
(struct r300_blend_color_state*)r300->blend_color_state.state;
union util_color uc;
@@ -379,7 +378,7 @@ static void r300_set_blend_color(struct pipe_context* pipe,
float_to_fixed10(color->color[2]) |
(float_to_fixed10(color->color[1]) << 16);
- r300->blend_color_state.size = r300screen->caps->is_r500 ? 3 : 2;
+ r300->blend_color_state.size = r300->screen->caps.is_r500 ? 3 : 2;
r300->blend_color_state.dirty = TRUE;
}
@@ -390,7 +389,7 @@ static void r300_set_clip_state(struct pipe_context* pipe,
r300->clip = *state;
- if (r300_screen(pipe->screen)->caps->has_tcl) {
+ if (r300->screen->caps.has_tcl) {
memcpy(r300->clip_state.state, state, sizeof(struct pipe_clip_state));
r300->clip_state.size = 29;
} else {
@@ -411,8 +410,7 @@ static void*
r300_create_dsa_state(struct pipe_context* pipe,
const struct pipe_depth_stencil_alpha_state* state)
{
- struct r300_capabilities *caps =
- r300_screen(r300_context(pipe)->context.screen)->caps;
+ struct r300_capabilities *caps = &r300_screen(pipe->screen)->caps;
struct r300_dsa_state* dsa = CALLOC_STRUCT(r300_dsa_state);
/* Depth test setup. */
@@ -577,7 +575,6 @@ static void
const struct pipe_framebuffer_state* state)
{
struct r300_context* r300 = r300_context(pipe);
- struct r300_screen* r300screen = r300_screen(pipe->screen);
struct pipe_framebuffer_state *old_state = r300->fb_state.state;
unsigned max_width, max_height;
uint32_t zbuffer_bpp = 0;
@@ -588,9 +585,9 @@ static void
return;
}
- if (r300screen->caps->is_r500) {
+ if (r300->screen->caps.is_r500) {
max_width = max_height = 4096;
- } else if (r300screen->caps->is_r400) {
+ } else if (r300->screen->caps.is_r400) {
max_width = max_height = 4021;
} else {
max_width = max_height = 2560;
@@ -718,7 +715,6 @@ static void r300_set_polygon_stipple(struct pipe_context* pipe,
static void* r300_create_rs_state(struct pipe_context* pipe,
const struct pipe_rasterizer_state* state)
{
- struct r300_screen* r300screen = r300_screen(pipe->screen);
struct r300_rs_state* rs = CALLOC_STRUCT(r300_rs_state);
/* Copy rasterizer state for Draw. */
@@ -731,7 +727,7 @@ static void* r300_create_rs_state(struct pipe_context* pipe,
#endif
/* If no TCL engine is present, turn off the HW TCL. */
- if (!r300screen->caps->has_tcl) {
+ if (!r300_screen(pipe->screen)->caps.has_tcl) {
rs->vap_control_status |= R300_VAP_TCL_BYPASS;
}
@@ -855,7 +851,7 @@ static void*
{
struct r300_context* r300 = r300_context(pipe);
struct r300_sampler_state* sampler = CALLOC_STRUCT(r300_sampler_state);
- boolean is_r500 = r300_screen(pipe->screen)->caps->is_r500;
+ boolean is_r500 = r300->screen->caps.is_r500;
int lod_bias;
union util_color uc;
@@ -894,7 +890,7 @@ static void*
sampler->border_color = uc.ui;
/* R500-specific fixups and optimizations */
- if (r300_screen(r300->context.screen)->caps->is_r500) {
+ if (r300->screen->caps.is_r500) {
sampler->filter1 |= R500_BORDER_FIX;
}
@@ -908,7 +904,7 @@ static void r300_bind_sampler_states(struct pipe_context* pipe,
struct r300_context* r300 = r300_context(pipe);
struct r300_textures_state* state =
(struct r300_textures_state*)r300->textures_state.state;
- unsigned tex_units = r300_screen(r300->context.screen)->caps->num_tex_units;
+ unsigned tex_units = r300->screen->caps.num_tex_units;
if (count > tex_units) {
return;
@@ -948,8 +944,8 @@ static void r300_set_fragment_sampler_views(struct pipe_context* pipe,
(struct r300_textures_state*)r300->textures_state.state;
struct r300_texture *texture;
unsigned i;
- unsigned tex_units = r300_screen(r300->context.screen)->caps->num_tex_units;
- boolean is_r500 = r300_screen(r300->context.screen)->caps->is_r500;
+ unsigned tex_units = r300->screen->caps.num_tex_units;
+ boolean is_r500 = r300->screen->caps.is_r500;
boolean dirty_tex = FALSE;
if (count > tex_units) {
@@ -1191,7 +1187,6 @@ static void* r300_create_vertex_elements_state(struct pipe_context* pipe,
unsigned count,
const struct pipe_vertex_element* attribs)
{
- struct r300_screen* r300screen = r300_screen(pipe->screen);
struct r300_vertex_element_state *velems;
unsigned i, size;
@@ -1201,7 +1196,7 @@ static void* r300_create_vertex_elements_state(struct pipe_context* pipe,
velems->count = count;
memcpy(velems->velem, attribs, sizeof(struct pipe_vertex_element) * count);
- if (r300screen->caps->has_tcl) {
+ if (r300_screen(pipe->screen)->caps.has_tcl) {
/* Check if the format is aligned to the size of DWORD. */
for (i = 0; i < count; i++) {
size = util_format_get_blocksize(attribs[i].src_format);
@@ -1256,7 +1251,7 @@ static void* r300_create_vs_state(struct pipe_context* pipe,
struct r300_vertex_shader* vs = CALLOC_STRUCT(r300_vertex_shader);
r300_vertex_shader_common_init(vs, shader);
- if (r300_screen(pipe->screen)->caps->has_tcl) {
+ if (r300->screen->caps.has_tcl) {
r300_translate_vertex_shader(r300, vs);
} else {
vs->draw_vs = draw_create_vertex_shader(r300->draw, shader);
@@ -1290,7 +1285,7 @@ static void r300_bind_vs_state(struct pipe_context* pipe, void* shader)
/* The majority of the RS block bits is dependent on the vertex shader. */
r300->rs_block_state.dirty = TRUE; /* Will be updated before the emission. */
- if (r300_screen(pipe->screen)->caps->has_tcl) {
+ if (r300->screen->caps.has_tcl) {
r300->vs_state.dirty = TRUE;
r300->vs_state.size = vs->code.length + 9;
@@ -1309,7 +1304,7 @@ static void r300_delete_vs_state(struct pipe_context* pipe, void* shader)
struct r300_context* r300 = r300_context(pipe);
struct r300_vertex_shader* vs = (struct r300_vertex_shader*)shader;
- if (r300_screen(pipe->screen)->caps->has_tcl) {
+ if (r300->screen->caps.has_tcl) {
rc_constants_destroy(&vs->code.constants);
} else {
draw_delete_vertex_shader(r300->draw,
@@ -1325,7 +1320,6 @@ static void r300_set_constant_buffer(struct pipe_context *pipe,
struct pipe_buffer *buf)
{
struct r300_context* r300 = r300_context(pipe);
- struct r300_screen *r300screen = r300_screen(pipe->screen);
void *mapped;
int max_size = 0;
@@ -1344,10 +1338,10 @@ static void r300_set_constant_buffer(struct pipe_context *pipe,
max_size = 256;
break;
case PIPE_SHADER_FRAGMENT:
- if (r300screen->caps->is_r500) {
+ if (r300->screen->caps.is_r500) {
max_size = 256;
/* XXX Implement emission of r400's extended constant buffer. */
- /*} else if (r300screen->caps->is_r400) {
+ /*} else if (r300->screen->caps.is_r400) {
max_size = 64;*/
} else {
max_size = 32;
@@ -1369,7 +1363,7 @@ static void r300_set_constant_buffer(struct pipe_context *pipe,
pipe_buffer_unmap(pipe->screen, buf);
if (shader == PIPE_SHADER_VERTEX) {
- if (r300screen->caps->has_tcl) {
+ if (r300->screen->caps.has_tcl) {
r300->dirty_state |= R300_NEW_VERTEX_SHADER_CONSTANTS;
r300->pvs_flush.dirty = TRUE;
} else if (r300->draw) {
diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c
index a68dd80b6b9..292b20a7f47 100644
--- a/src/gallium/drivers/r300/r300_state_derived.c
+++ b/src/gallium/drivers/r300/r300_state_derived.c
@@ -265,7 +265,7 @@ static void r300_update_rs_block(struct r300_context* r300,
boolean any_bcolor_used = vs_outputs->bcolor[0] != ATTR_UNUSED ||
vs_outputs->bcolor[1] != ATTR_UNUSED;
- if (r300_screen(r300->context.screen)->caps->is_r500) {
+ if (r300->screen->caps.is_r500) {
rX00_rs_col = r500_rs_col;
rX00_rs_col_write = r500_rs_col_write;
rX00_rs_tex = r500_rs_tex;
diff --git a/src/gallium/drivers/r300/r300_state_invariant.c b/src/gallium/drivers/r300/r300_state_invariant.c
index 88ae75bb816..4685ec47614 100644
--- a/src/gallium/drivers/r300/r300_state_invariant.c
+++ b/src/gallium/drivers/r300/r300_state_invariant.c
@@ -41,7 +41,7 @@ struct pipe_viewport_state r300_viewport_identity = {
void r300_emit_invariant_state(struct r300_context* r300,
unsigned size, void* state)
{
- struct r300_capabilities* caps = r300_screen(r300->context.screen)->caps;
+ struct r300_capabilities* caps = &r300_screen(r300->context.screen)->caps;
CS_LOCALS(r300);
BEGIN_CS(14 + (caps->has_tcl ? 2: 0));
diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c
index d1db6722e0a..cc4cf560a0e 100644
--- a/src/gallium/drivers/r300/r300_texture.c
+++ b/src/gallium/drivers/r300/r300_texture.c
@@ -515,7 +515,7 @@ static void r300_setup_texture_state(struct r300_screen* screen, struct r300_tex
struct r300_texture_format_state* state = &tex->state;
struct pipe_texture *pt = &tex->tex;
unsigned i;
- boolean is_r500 = screen->caps->is_r500;
+ boolean is_r500 = screen->caps.is_r500;
/* Set sampler state. */
state->format0 = R300_TX_WIDTH((pt->width0 - 1) & 0x7ff) |
@@ -704,7 +704,7 @@ static void r300_setup_miptree(struct r300_screen* screen,
{
struct pipe_texture* base = &tex->tex;
unsigned stride, size, layer_size, nblocksy, i;
- boolean rv350_mode = screen->caps->family >= CHIP_FAMILY_RV350;
+ boolean rv350_mode = screen->caps.family >= CHIP_FAMILY_RV350;
SCREEN_DBG(screen, DBG_TEX, "r300: Making miptree for texture, format %s\n",
util_format_name(base->format));
@@ -751,7 +751,7 @@ static void r300_setup_tiling(struct pipe_screen *screen,
{
struct r300_winsys_screen *rws = (struct r300_winsys_screen *)screen->winsys;
enum pipe_format format = tex->tex.format;
- boolean rv350_mode = r300_screen(screen)->caps->family >= CHIP_FAMILY_RV350;
+ boolean rv350_mode = r300_screen(screen)->caps.family >= CHIP_FAMILY_RV350;
if (!r300_format_is_plain(format)) {
return;