summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/r300
diff options
context:
space:
mode:
authorKeith Whitwell <keithw@vmware.com>2010-03-13 15:06:35 +0000
committerKeith Whitwell <keithw@vmware.com>2010-03-13 15:06:35 +0000
commit47bfbd452c93e6a8db013fb90d9f42210cf24889 (patch)
treee3cebba97261f567f461769d891aa77707b57bd7 /src/gallium/drivers/r300
parentfaa14818856e1e9a4ee624c2bc04d7aecabd07ab (diff)
parenta80e33f40731f07e8a39896bfdcd1b1504aedc1f (diff)
Merge commit 'origin/master' into gallium-sampler-view
Conflicts: src/gallium/auxiliary/util/u_tile.c src/gallium/auxiliary/util/u_tile.h src/gallium/drivers/identity/id_context.c src/gallium/drivers/llvmpipe/lp_setup.c src/gallium/drivers/llvmpipe/lp_setup.h src/gallium/drivers/softpipe/sp_tex_tile_cache.c src/gallium/include/pipe/p_context.h src/mesa/state_tracker/st_cb_bitmap.c src/mesa/state_tracker/st_cb_drawpixels.c
Diffstat (limited to 'src/gallium/drivers/r300')
-rw-r--r--src/gallium/drivers/r300/r300_context.c3
-rw-r--r--src/gallium/drivers/r300/r300_context.h1
-rw-r--r--src/gallium/drivers/r300/r300_reg.h4
-rw-r--r--src/gallium/drivers/r300/r300_render.c6
-rw-r--r--src/gallium/drivers/r300/r300_screen.c2
-rw-r--r--src/gallium/drivers/r300/r300_state.c2
-rw-r--r--src/gallium/drivers/r300/r300_transfer.c42
-rw-r--r--src/gallium/drivers/r300/r300_transfer.h4
8 files changed, 37 insertions, 27 deletions
diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c
index 923e1e541f..8606c0004e 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -34,6 +34,7 @@
#include "r300_screen.h"
#include "r300_state_invariant.h"
#include "r300_texture.h"
+#include "r300_transfer.h"
#include "radeon_winsys.h"
@@ -209,6 +210,8 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
r300_init_query_functions(r300);
+ r300_init_transfer_functions(r300);
+
/* r300_init_surface_functions(r300); */
r300_init_state_functions(r300);
diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
index 3b70bcda82..7b86669888 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -405,6 +405,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
struct draw_stage* r300_draw_stage(struct r300_context* r300);
void r300_init_state_functions(struct r300_context* r300);
void r300_init_surface_functions(struct r300_context* r300);
+void r300_init_tex_functions( struct pipe_context *pipe );
static INLINE boolean CTX_DBG_ON(struct r300_context * ctx, unsigned flags)
{
diff --git a/src/gallium/drivers/r300/r300_reg.h b/src/gallium/drivers/r300/r300_reg.h
index a249e8b36b..c67cc86871 100644
--- a/src/gallium/drivers/r300/r300_reg.h
+++ b/src/gallium/drivers/r300/r300_reg.h
@@ -540,7 +540,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
# define R300_PVS_FIRST_INST(x) ((x) << 0)
# define R300_PVS_XYZW_VALID_INST(x) ((x) << 10)
# define R300_PVS_LAST_INST(x) ((x) << 20)
-/* Addresses are relative the the vertex program parameters area. */
+/* Addresses are relative to the vertex program parameters area. */
#define R300_VAP_PVS_CONST_CNTL 0x22D4
# define R300_PVS_CONST_BASE_OFFSET_SHIFT 0
# define R300_PVS_MAX_CONST_ADDR_SHIFT 16
@@ -1857,7 +1857,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
* The destination register index is in FPI1 (color) and FPI3 (alpha)
* together with enable bits.
* There are separate enable bits for writing into temporary registers
- * (DSTC_REG_* /DSTA_REG) and and program output registers (DSTC_OUTPUT_*
+ * (DSTC_REG_* /DSTA_REG) and program output registers (DSTC_OUTPUT_*
* /DSTA_OUTPUT). You can write to both at once, or not write at all (the
* same index must be used for both).
*
diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c
index 9c001ae186..ccf39876a5 100644
--- a/src/gallium/drivers/r300/r300_render.c
+++ b/src/gallium/drivers/r300/r300_render.c
@@ -274,14 +274,14 @@ static void r300_emit_draw_elements(struct r300_context *r300,
#endif
CS_LOCALS(r300);
- assert((start * indexSize) % 4 == 0);
+ assert((start * indexSize) % 4 == 0);
assert(count < (1 << 24));
+ maxIndex = MIN3(maxIndex, r300->vertex_buffer_max_index, count - minIndex);
+
DBG(r300, DBG_DRAW, "r300: Indexbuf of %u indices, min %u max %u\n",
count, minIndex, maxIndex);
- maxIndex = MIN2(maxIndex, r300->vertex_buffer_max_index);
-
if (alt_num_verts) {
BEGIN_CS(15);
OUT_CS_REG(R500_VAP_ALT_NUM_VERTICES, count);
diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
index 5880eecd5f..64d1909a38 100644
--- a/src/gallium/drivers/r300/r300_screen.c
+++ b/src/gallium/drivers/r300/r300_screen.c
@@ -27,7 +27,6 @@
#include "r300_context.h"
#include "r300_texture.h"
-#include "r300_transfer.h"
#include "radeon_winsys.h"
#include "r300_winsys.h"
@@ -290,7 +289,6 @@ struct pipe_screen* r300_create_screen(struct radeon_winsys* radeon_winsys)
r300screen->screen.context_create = r300_create_context;
r300_init_screen_texture_functions(&r300screen->screen);
- r300_init_screen_transfer_functions(&r300screen->screen);
u_simple_screen_init(&r300screen->screen);
return &r300screen->screen;
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index d73ec78fda..d4b7376f12 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -1061,7 +1061,7 @@ static void r300_set_vertex_buffers(struct pipe_context* pipe,
const struct pipe_vertex_buffer* buffers)
{
struct r300_context* r300 = r300_context(pipe);
- unsigned i, max_index = ~0;
+ unsigned i, max_index = (1 << 24) - 1;
memcpy(r300->vertex_buffer, buffers,
sizeof(struct pipe_vertex_buffer) * count);
diff --git a/src/gallium/drivers/r300/r300_transfer.c b/src/gallium/drivers/r300/r300_transfer.c
index ec89681a3c..495e3dee76 100644
--- a/src/gallium/drivers/r300/r300_transfer.c
+++ b/src/gallium/drivers/r300/r300_transfer.c
@@ -118,15 +118,15 @@ static void r300_copy_into_tiled_texture(struct pipe_context *ctx,
}
static struct pipe_transfer*
-r300_get_tex_transfer(struct pipe_screen *screen,
+r300_get_tex_transfer(struct pipe_context *ctx,
struct pipe_texture *texture,
unsigned face, unsigned level, unsigned zslice,
enum pipe_transfer_usage usage, unsigned x, unsigned y,
unsigned w, unsigned h)
{
struct r300_texture *tex = (struct r300_texture *)texture;
+ struct r300_screen *r300screen = r300_screen(ctx->screen);
struct r300_transfer *trans;
- struct r300_screen *r300screen = r300_screen(screen);
struct pipe_texture template;
trans = CALLOC_STRUCT(r300_transfer);
@@ -136,7 +136,7 @@ r300_get_tex_transfer(struct pipe_screen *screen,
trans->transfer.usage = usage;
trans->transfer.width = w;
trans->transfer.height = h;
- trans->ctx = r300screen->ctx;
+ trans->ctx = ctx;
trans->x = x;
trans->y = y;
trans->level = level;
@@ -174,8 +174,10 @@ r300_get_tex_transfer(struct pipe_screen *screen,
}
/* Create the temporary texture. */
- trans->detiled_texture =
- (struct r300_texture*)screen->texture_create(screen, &template);
+ trans->detiled_texture = (struct r300_texture*)
+ ctx->screen->texture_create(ctx->screen,
+ &template);
+
assert(!trans->detiled_texture->microtile &&
!trans->detiled_texture->macrotile);
@@ -187,7 +189,7 @@ r300_get_tex_transfer(struct pipe_screen *screen,
if (usage & PIPE_TRANSFER_READ) {
/* We cannot map a tiled texture directly because the data is
* in a different order, therefore we do detiling using a blit. */
- r300_copy_from_tiled_texture(r300screen->ctx, trans);
+ r300_copy_from_tiled_texture(ctx, trans);
}
} else {
trans->transfer.x = x;
@@ -203,7 +205,8 @@ r300_get_tex_transfer(struct pipe_screen *screen,
return &trans->transfer;
}
-static void r300_tex_transfer_destroy(struct pipe_transfer *trans)
+static void r300_tex_transfer_destroy(struct pipe_context *ctx,
+ struct pipe_transfer *trans)
{
struct r300_transfer *r300transfer = r300_transfer(trans);
@@ -219,7 +222,7 @@ static void r300_tex_transfer_destroy(struct pipe_transfer *trans)
FREE(trans);
}
-static void* r300_transfer_map(struct pipe_screen *screen,
+static void* r300_transfer_map(struct pipe_context *ctx,
struct pipe_transfer *transfer)
{
struct r300_transfer *r300transfer = r300_transfer(transfer);
@@ -230,12 +233,12 @@ static void* r300_transfer_map(struct pipe_screen *screen,
if (r300transfer->detiled_texture) {
/* The detiled texture is of the same size as the region being mapped
* (no offset needed). */
- return pipe_buffer_map(screen,
+ return pipe_buffer_map(ctx->screen,
r300transfer->detiled_texture->buffer,
pipe_transfer_buffer_flags(transfer));
} else {
/* Tiling is disabled. */
- map = pipe_buffer_map(screen, tex->buffer,
+ map = pipe_buffer_map(ctx->screen, tex->buffer,
pipe_transfer_buffer_flags(transfer));
if (!map) {
@@ -248,23 +251,26 @@ static void* r300_transfer_map(struct pipe_screen *screen,
}
}
-static void r300_transfer_unmap(struct pipe_screen *screen,
+static void r300_transfer_unmap(struct pipe_context *ctx,
struct pipe_transfer *transfer)
{
struct r300_transfer *r300transfer = r300_transfer(transfer);
struct r300_texture *tex = (struct r300_texture*)transfer->texture;
if (r300transfer->detiled_texture) {
- pipe_buffer_unmap(screen, r300transfer->detiled_texture->buffer);
+ pipe_buffer_unmap(ctx->screen, r300transfer->detiled_texture->buffer);
} else {
- pipe_buffer_unmap(screen, tex->buffer);
+ pipe_buffer_unmap(ctx->screen, tex->buffer);
}
}
-void r300_init_screen_transfer_functions(struct pipe_screen *screen)
+
+void r300_init_transfer_functions( struct r300_context *r300ctx )
{
- screen->get_tex_transfer = r300_get_tex_transfer;
- screen->tex_transfer_destroy = r300_tex_transfer_destroy;
- screen->transfer_map = r300_transfer_map;
- screen->transfer_unmap = r300_transfer_unmap;
+ struct pipe_context *ctx = &r300ctx->context;
+
+ ctx->get_tex_transfer = r300_get_tex_transfer;
+ ctx->tex_transfer_destroy = r300_tex_transfer_destroy;
+ ctx->transfer_map = r300_transfer_map;
+ ctx->transfer_unmap = r300_transfer_unmap;
}
diff --git a/src/gallium/drivers/r300/r300_transfer.h b/src/gallium/drivers/r300/r300_transfer.h
index 60d1d3dc85..79baf6d048 100644
--- a/src/gallium/drivers/r300/r300_transfer.h
+++ b/src/gallium/drivers/r300/r300_transfer.h
@@ -26,6 +26,8 @@
#include "pipe/p_screen.h"
-void r300_init_screen_transfer_functions(struct pipe_screen *screen);
+struct r300_context;
+
+void r300_init_transfer_functions(struct r300_context *r300ctx);
#endif