diff options
Diffstat (limited to 'src/gallium/drivers/r300')
-rw-r--r-- | src/gallium/drivers/r300/r300_blit.c | 3 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_chipset.c | 3 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_chipset.h | 20 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_context.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_query.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_render.c | 6 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_screen_buffer.c | 19 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_screen_buffer.h | 6 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_state.c | 17 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_state_invariant.c | 13 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_texture.c | 6 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_tgsi_to_rc.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_winsys.h | 10 |
13 files changed, 67 insertions, 44 deletions
diff --git a/src/gallium/drivers/r300/r300_blit.c b/src/gallium/drivers/r300/r300_blit.c index e84b79ae902..e15c71eef65 100644 --- a/src/gallium/drivers/r300/r300_blit.c +++ b/src/gallium/drivers/r300/r300_blit.c @@ -37,6 +37,9 @@ static void r300_blitter_save_states(struct r300_context* r300) util_blitter_save_viewport(r300->blitter, &r300->viewport); util_blitter_save_clip(r300->blitter, &r300->clip); util_blitter_save_vertex_elements(r300->blitter, r300->velems); + /* XXX this crashes the driver + util_blitter_save_vertex_buffers(r300->blitter, r300->vertex_buffer_count, + r300->vertex_buffer); */ } /* Clear currently bound buffers. */ diff --git a/src/gallium/drivers/r300/r300_chipset.c b/src/gallium/drivers/r300/r300_chipset.c index 9b2163e44cc..928a310bd81 100644 --- a/src/gallium/drivers/r300/r300_chipset.c +++ b/src/gallium/drivers/r300/r300_chipset.c @@ -108,6 +108,7 @@ void r300_parse_chipset(struct r300_capabilities* caps) case 0x3150: case 0x3152: case 0x3154: + case 0x3155: case 0x3E50: case 0x3E54: caps->family = CHIP_FAMILY_RV380; @@ -370,4 +371,6 @@ void r300_parse_chipset(struct r300_capabilities* caps) fprintf(stderr, "r300: Warning: Unknown chipset 0x%x\n", caps->pci_id); } + + caps->is_rv350 = caps->family >= CHIP_FAMILY_RV350; } diff --git a/src/gallium/drivers/r300/r300_chipset.h b/src/gallium/drivers/r300/r300_chipset.h index ff957b7c29c..ab649c38573 100644 --- a/src/gallium/drivers/r300/r300_chipset.h +++ b/src/gallium/drivers/r300/r300_chipset.h @@ -42,18 +42,28 @@ struct r300_capabilities { unsigned num_tex_units; /* Whether or not TCL is physically present */ boolean has_tcl; - /* Whether or not this is R400. The differences compared to their R3xx + /* Whether or not this is RV350 or newer, including all r400 and r500 + * chipsets. The differences compared to the oldest r300 chips are: + * - Blend LTE/GTE thresholds + * - Better MACRO_SWITCH in texture tiling + * - Half float vertex + * - More HyperZ optimizations */ + boolean is_rv350; + /* Whether or not this is R400. The differences compared their rv350 * cousins are: * - Extended fragment shader registers - * - Blend LTE/GTE thresholds */ + * - 3DC texture compression (RGTC2) */ boolean is_r400; /* Whether or not this is an RV515 or newer; R500s have many differences - * that require extra consideration, compared to their R3xx cousins: + * that require extra consideration, compared to their rv350 cousins: * - Extra bit of width and height on texture sizes * - Blend color is split across two registers - * - Blend LTE/GTE thresholds * - Universal Shader (US) block used for fragment shaders - * - FP16 blending and multisampling */ + * - FP16 blending and multisampling + * - Full RGTC texture compression + * - 24-bit depth textures + * - Stencil back-face reference value + * - Ability to render up to 2^24 - 1 vertices with signed index offset */ boolean is_r500; /* Whether or not the second pixel pipe is accessed with the high bit */ boolean high_second_pipe; diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index 503af3e78a2..deaa03e1f61 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -186,7 +186,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, r300->context.draw_range_elements = r300_swtcl_draw_range_elements; /* Create a Draw. This is used for SW TCL. */ - r300->draw = draw_create(); + r300->draw = draw_create(&r300->context); /* Enable our renderer. */ draw_set_rasterize_stage(r300->draw, r300_draw_stage(r300)); /* Enable Draw's clipping. */ diff --git a/src/gallium/drivers/r300/r300_query.c b/src/gallium/drivers/r300/r300_query.c index 398edb9d101..5c27796e894 100644 --- a/src/gallium/drivers/r300/r300_query.c +++ b/src/gallium/drivers/r300/r300_query.c @@ -25,10 +25,8 @@ #include "r300_context.h" #include "r300_screen.h" -#include "r300_cs.h" #include "r300_emit.h" #include "r300_query.h" -#include "r300_reg.h" #include <stdio.h> diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index 007f01ace30..23b61df89cc 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -152,9 +152,9 @@ static boolean immd_is_good_idea(struct r300_context *r300, if (!checked[vbi]) { vbuf = &r300->vertex_buffer[vbi]; - if (r300->context.is_resource_referenced(&r300->context, - vbuf->buffer, - 0, 0)) { + if (r300_buffer_is_referenced(&r300->context, + vbuf->buffer, + R300_REF_CS | R300_REF_HW)) { /* It's a very bad idea to map it... */ return FALSE; } diff --git a/src/gallium/drivers/r300/r300_screen_buffer.c b/src/gallium/drivers/r300/r300_screen_buffer.c index 739f723f163..20a9ffb9f60 100644 --- a/src/gallium/drivers/r300/r300_screen_buffer.c +++ b/src/gallium/drivers/r300/r300_screen_buffer.c @@ -26,7 +26,6 @@ #include <stdio.h> #include "util/u_inlines.h" -#include "util/u_format.h" #include "util/u_memory.h" #include "util/u_upload_mgr.h" #include "util/u_math.h" @@ -34,9 +33,9 @@ #include "r300_screen_buffer.h" #include "r300_winsys.h" -static unsigned r300_buffer_is_referenced(struct pipe_context *context, - struct pipe_resource *buf, - unsigned face, unsigned level) +unsigned r300_buffer_is_referenced(struct pipe_context *context, + struct pipe_resource *buf, + enum r300_reference_domain domain) { struct r300_context *r300 = r300_context(context); struct r300_buffer *rbuf = r300_buffer(buf); @@ -44,12 +43,19 @@ static unsigned r300_buffer_is_referenced(struct pipe_context *context, if (r300_buffer_is_user_buffer(buf)) return PIPE_UNREFERENCED; - if (r300->rws->is_buffer_referenced(r300->rws, rbuf->buf)) + if (r300->rws->is_buffer_referenced(r300->rws, rbuf->buf, domain)) return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; return PIPE_UNREFERENCED; } +static unsigned r300_buffer_is_referenced_by_cs(struct pipe_context *context, + struct pipe_resource *buf, + unsigned face, unsigned level) +{ + return r300_buffer_is_referenced(context, buf, R300_REF_CS); +} + /* External helper, not required to implent u_resource_vtbl: */ int r300_upload_index_buffer(struct r300_context *r300, @@ -174,7 +180,6 @@ r300_buffer_transfer_map( struct pipe_context *pipe, rws->buffer_reference(rws, &rbuf->buf, NULL); rbuf->num_ranges = 0; - rbuf->map = NULL; rbuf->buf = r300_winsys_buffer_create(r300screen, 16, rbuf->b.b.bind, /* XXX */ @@ -243,7 +248,7 @@ struct u_resource_vtbl r300_buffer_vtbl = { u_default_resource_get_handle, /* get_handle */ r300_buffer_destroy, /* resource_destroy */ - r300_buffer_is_referenced, /* is_buffer_referenced */ + r300_buffer_is_referenced_by_cs, /* is_buffer_referenced */ u_default_get_transfer, /* get_transfer */ u_default_transfer_destroy, /* transfer_destroy */ r300_buffer_transfer_map, /* transfer_map */ diff --git a/src/gallium/drivers/r300/r300_screen_buffer.h b/src/gallium/drivers/r300/r300_screen_buffer.h index 82660d3e1a4..57f48229b2e 100644 --- a/src/gallium/drivers/r300/r300_screen_buffer.h +++ b/src/gallium/drivers/r300/r300_screen_buffer.h @@ -55,8 +55,6 @@ struct r300_buffer void *user_buffer; struct r300_buffer_range ranges[R300_BUFFER_MAX_RANGES]; unsigned num_ranges; - - void *map; }; /* Functions. */ @@ -77,6 +75,10 @@ struct pipe_resource *r300_user_buffer_create(struct pipe_screen *screen, unsigned bytes, unsigned usage); +unsigned r300_buffer_is_referenced(struct pipe_context *context, + struct pipe_resource *buf, + enum r300_reference_domain domain); + /* Inline functions. */ static INLINE struct r300_buffer *r300_buffer(struct pipe_resource *buffer) diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 371e52d2089..9eb8539a655 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -889,7 +889,7 @@ static void r300_bind_rs_state(struct pipe_context* pipe, void* state) if (r300->draw) { draw_flush(r300->draw); - draw_set_rasterizer_state(r300->draw, &rs->rs); + draw_set_rasterizer_state(r300->draw, &rs->rs, state); } if (rs) { @@ -1192,14 +1192,13 @@ static void r300_set_vertex_buffers(struct pipe_context* pipe, } if (vbo->max_index == ~0) { - /* Bogus value from broken state tracker; hax it. */ - /* TODO - more hax - fixes doom3 from almos on irc */ - if (!vbo->stride) { - fprintf(stderr, "r300: got a VBO with stride 0 fixing up to stide 4\n"); - vbo->stride = 4; - } - vbo->max_index = - (vbo->buffer->width0 - vbo->buffer_offset) / vbo->stride; + /* if no VBO stride then only one vertex value so max index is 1 */ + /* should think about converting to VS constants like svga does */ + if (!vbo->stride) + vbo->max_index = 1; + else + vbo->max_index = + (vbo->buffer->width0 - vbo->buffer_offset) / vbo->stride; } max_index = MIN2(vbo->max_index, max_index); diff --git a/src/gallium/drivers/r300/r300_state_invariant.c b/src/gallium/drivers/r300/r300_state_invariant.c index ffb175febf1..64d1d18b454 100644 --- a/src/gallium/drivers/r300/r300_state_invariant.c +++ b/src/gallium/drivers/r300/r300_state_invariant.c @@ -41,10 +41,9 @@ 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; CS_LOCALS(r300); - BEGIN_CS(12 + (caps->has_tcl ? 2: 0)); + BEGIN_CS(12 + (r300->screen->caps.has_tcl ? 2 : 0)); /*** Graphics Backend (GB) ***/ /* Subpixel multisampling for AA @@ -66,7 +65,7 @@ void r300_emit_invariant_state(struct r300_context* r300, /* Sign/normalize control */ OUT_CS_REG(R300_VAP_PSC_SGN_NORM_CNTL, R300_SGN_NORM_NO_ZERO); /* TCL-only stuff */ - if (caps->has_tcl) { + if (r300->screen->caps.has_tcl) { /* Amount of time to wait for vertex fetches in PVS */ OUT_CS_REG(VAP_PVS_VTX_TIMEOUT_REG, 0xffff); } @@ -74,10 +73,10 @@ void r300_emit_invariant_state(struct r300_context* r300, END_CS; /* XXX unsorted stuff from surface_fill */ - BEGIN_CS(38 + (caps->has_tcl ? 7 : 0) + - (caps->family >= CHIP_FAMILY_RV350 ? 4 : 0)); + BEGIN_CS(38 + (r300->screen->caps.has_tcl ? 7 : 0) + + (r300->screen->caps.is_rv350 ? 4 : 0)); - if (caps->has_tcl) { + if (r300->screen->caps.has_tcl) { /*Flushing PVS is required before the VAP_GB registers can be changed*/ OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0); OUT_CS_REG_SEQ(R300_VAP_GB_VERT_CLIP_ADJ, 4); @@ -107,7 +106,7 @@ void r300_emit_invariant_state(struct r300_context* r300, OUT_CS_REG(R300_SC_EDGERULE, 0x2DA49525); OUT_CS_REG(R300_RB3D_AARESOLVE_CTL, 0x00000000); - if (caps->family >= CHIP_FAMILY_RV350) { + if (r300->screen->caps.is_rv350) { OUT_CS_REG(R500_RB3D_DISCARD_SRC_PIXEL_LTE_THRESHOLD, 0x01010101); OUT_CS_REG(R500_RB3D_DISCARD_SRC_PIXEL_GTE_THRESHOLD, 0xFEFEFEFE); } diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index a4a3f2166f8..8bebeacf860 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -787,7 +787,7 @@ static void r300_setup_miptree(struct r300_screen* screen, { struct pipe_resource* base = &tex->b.b; unsigned stride, size, layer_size, nblocksy, i; - boolean rv350_mode = screen->caps.family >= CHIP_FAMILY_RV350; + boolean rv350_mode = screen->caps.is_rv350; SCREEN_DBG(screen, DBG_TEX, "r300: Making miptree for texture, format %s\n", util_format_name(base->format)); @@ -834,7 +834,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->b.b.format; - boolean rv350_mode = r300_screen(screen)->caps.family >= CHIP_FAMILY_RV350; + boolean rv350_mode = r300_screen(screen)->caps.is_rv350; boolean is_zb = util_format_is_depth_or_stencil(format); boolean dbg_no_tiling = SCREEN_DBG_ON(r300_screen(screen), DBG_NO_TILING); @@ -880,7 +880,7 @@ static unsigned r300_texture_is_referenced(struct pipe_context *context, struct r300_context *r300 = r300_context(context); struct r300_texture *rtex = (struct r300_texture *)texture; - if (r300->rws->is_buffer_referenced(r300->rws, rtex->buffer)) + if (r300->rws->is_buffer_referenced(r300->rws, rtex->buffer, R300_REF_CS)) return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; return PIPE_UNREFERENCED; diff --git a/src/gallium/drivers/r300/r300_tgsi_to_rc.c b/src/gallium/drivers/r300/r300_tgsi_to_rc.c index 21a1c45982d..f6428ed760f 100644 --- a/src/gallium/drivers/r300/r300_tgsi_to_rc.c +++ b/src/gallium/drivers/r300/r300_tgsi_to_rc.c @@ -115,10 +115,10 @@ static unsigned translate_opcode(unsigned opcode) /* case TGSI_OPCODE_ENDREP: return RC_OPCODE_ENDREP; */ /* case TGSI_OPCODE_PUSHA: return RC_OPCODE_PUSHA; */ /* case TGSI_OPCODE_POPA: return RC_OPCODE_POPA; */ - /* case TGSI_OPCODE_CEIL: return RC_OPCODE_CEIL; */ + case TGSI_OPCODE_CEIL: return RC_OPCODE_CEIL; /* case TGSI_OPCODE_I2F: return RC_OPCODE_I2F; */ /* case TGSI_OPCODE_NOT: return RC_OPCODE_NOT; */ - /* case TGSI_OPCODE_TRUNC: return RC_OPCODE_TRUNC; */ + case TGSI_OPCODE_TRUNC: return RC_OPCODE_FLR; /* case TGSI_OPCODE_SHL: return RC_OPCODE_SHL; */ /* case TGSI_OPCODE_ISHR: return RC_OPCODE_SHR; */ /* case TGSI_OPCODE_AND: return RC_OPCODE_AND; */ diff --git a/src/gallium/drivers/r300/r300_winsys.h b/src/gallium/drivers/r300/r300_winsys.h index 9c348d91158..2bd40176d10 100644 --- a/src/gallium/drivers/r300/r300_winsys.h +++ b/src/gallium/drivers/r300/r300_winsys.h @@ -42,6 +42,11 @@ enum r300_value_id { R300_VID_TEX3D_MIP_BUG, }; +enum r300_reference_domain { /* bitfield */ + R300_REF_CS = 1, + R300_REF_HW = 2 +}; + struct r300_winsys_screen { void (*destroy)(struct r300_winsys_screen *ws); @@ -160,9 +165,8 @@ struct r300_winsys_screen { struct winsys_handle *whandle); boolean (*is_buffer_referenced)(struct r300_winsys_screen *winsys, - struct r300_winsys_buffer *buffer); - - + struct r300_winsys_buffer *buffer, + enum r300_reference_domain domain); }; struct r300_winsys_screen * |