summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2010-02-22 17:26:30 +1000
committerDave Airlie <[email protected]>2010-02-22 17:26:35 +1000
commitb14548ea32000459f4f0c4b49f3fa11d1ee9c003 (patch)
treec6034ea6d6cdfb7669a11bed5b066c2345b7c48d /src/gallium/drivers
parentfff5be8e7b4557c221f2425dcafc2e7cbbba76ba (diff)
Revert "r300g: rebuild winsys/pipe buffer handling and add buffer map"
This reverts commit fff5be8e7b4557c221f2425dcafc2e7cbbba76ba. Probably went too soon with this, dileX reported OA not working for him it works here fine, but the optimisations I wanted aren't working properly yet so I'll fix that now. Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/r300/Makefile1
-rw-r--r--src/gallium/drivers/r300/r300_context.c38
-rw-r--r--src/gallium/drivers/r300/r300_context.h9
-rw-r--r--src/gallium/drivers/r300/r300_cs.h22
-rw-r--r--src/gallium/drivers/r300/r300_emit.c54
-rw-r--r--src/gallium/drivers/r300/r300_render.c33
-rw-r--r--src/gallium/drivers/r300/r300_screen.c38
-rw-r--r--src/gallium/drivers/r300/r300_screen.h2
-rw-r--r--src/gallium/drivers/r300/r300_screen_buffer.c222
-rw-r--r--src/gallium/drivers/r300/r300_screen_buffer.h85
-rw-r--r--src/gallium/drivers/r300/r300_state.c25
-rw-r--r--src/gallium/drivers/r300/r300_texture.c41
-rw-r--r--src/gallium/drivers/r300/r300_texture.h4
-rw-r--r--src/gallium/drivers/r300/r300_winsys.h127
14 files changed, 101 insertions, 600 deletions
diff --git a/src/gallium/drivers/r300/Makefile b/src/gallium/drivers/r300/Makefile
index 5707309bdf9..afddcb161fa 100644
--- a/src/gallium/drivers/r300/Makefile
+++ b/src/gallium/drivers/r300/Makefile
@@ -14,7 +14,6 @@ C_SOURCES = \
r300_query.c \
r300_render.c \
r300_screen.c \
- r300_screen_buffer.c \
r300_state.c \
r300_state_derived.c \
r300_state_invariant.c \
diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c
index a8a6a07a841..f631b4ed27f 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -24,7 +24,6 @@
#include "util/u_memory.h"
#include "util/u_simple_list.h"
-#include "util/u_upload_mgr.h"
#include "r300_blit.h"
#include "r300_context.h"
@@ -55,9 +54,6 @@ static void r300_destroy_context(struct pipe_context* context)
FREE(query);
}
- u_upload_destroy(r300->upload_vb);
- u_upload_destroy(r300->upload_ib);
-
FREE(r300->blend_color_state.state);
FREE(r300->clip_state.state);
FREE(r300->fb_state.state);
@@ -74,7 +70,11 @@ r300_is_texture_referenced(struct pipe_context *pipe,
struct pipe_texture *texture,
unsigned face, unsigned level)
{
- return 0;
+ struct pipe_buffer* buf = 0;
+
+ r300_get_texture_buffer(pipe->screen, texture, &buf, NULL);
+
+ return pipe->is_buffer_referenced(pipe, buf);
}
static unsigned int
@@ -136,14 +136,14 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
{
struct r300_context* r300 = CALLOC_STRUCT(r300_context);
struct r300_screen* r300screen = r300_screen(screen);
- struct r300_winsys_screen *rws = r300screen->rws;
+ struct radeon_winsys* radeon_winsys = r300screen->radeon_winsys;
if (!r300)
return NULL;
- r300->rws = rws;
+ r300->winsys = radeon_winsys;
- r300->context.winsys = (struct pipe_winsys*)rws;
+ r300->context.winsys = (struct pipe_winsys*)radeon_winsys;
r300->context.screen = screen;
r300->context.priv = priv;
@@ -201,31 +201,11 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
r300->invariant_state.dirty = TRUE;
- rws->set_flush_cb(r300->rws, r300_flush_cb, r300);
+ r300->winsys->set_flush_cb(r300->winsys, r300_flush_cb, r300);
r300->dirty_state = R300_NEW_KITCHEN_SINK;
r300->dirty_hw++;
r300->blitter = util_blitter_create(&r300->context);
- r300->upload_ib = u_upload_create(screen,
- 32 * 1024, 16,
- PIPE_BUFFER_USAGE_INDEX);
-
- if (r300->upload_ib == NULL)
- goto no_upload_ib;
-
- r300->upload_vb = u_upload_create(screen,
- 128 * 1024, 16,
- PIPE_BUFFER_USAGE_VERTEX);
- if (r300->upload_vb == NULL)
- goto no_upload_vb;
-
return &r300->context;
-
- // u_upload_destroy(r300->upload_vb);
- no_upload_ib:
- u_upload_destroy(r300->upload_ib);
- no_upload_vb:
- FREE(r300);
- return NULL;
}
diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
index 749bac04987..443af4ec2e3 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -32,7 +32,6 @@
#include "r300_screen.h"
-struct u_upload_mgr;
struct r300_context;
struct r300_fragment_shader;
@@ -239,7 +238,7 @@ struct r300_texture {
boolean is_npot;
/* Pipe buffer backing this texture. */
- struct r300_winsys_buffer *buffer;
+ struct pipe_buffer* buffer;
/* Registers carrying texture format data. */
struct r300_texture_state state;
@@ -266,7 +265,7 @@ struct r300_context {
struct pipe_context context;
/* The interface to the windowing system, etc. */
- struct r300_winsys_screen *rws;
+ struct radeon_winsys* winsys;
/* Draw module. Used mostly for SW TCL. */
struct draw_context* draw;
/* Accelerated blit support. */
@@ -331,7 +330,6 @@ struct r300_context {
/* Vertex elements for Gallium. */
struct pipe_vertex_element vertex_element[PIPE_MAX_ATTRIBS];
int vertex_element_count;
- bool any_user_vbs;
struct pipe_stencil_ref stencil_ref;
@@ -345,9 +343,6 @@ struct r300_context {
boolean polygon_offset_enabled;
/* Z buffer bit depth. */
uint32_t zbuffer_bpp;
-
- struct u_upload_mgr *upload_vb;
- struct u_upload_mgr *upload_ib;
};
/* Convenience cast wrapper. */
diff --git a/src/gallium/drivers/r300/r300_cs.h b/src/gallium/drivers/r300/r300_cs.h
index ad07efbffdb..151f72b0fe4 100644
--- a/src/gallium/drivers/r300/r300_cs.h
+++ b/src/gallium/drivers/r300/r300_cs.h
@@ -51,7 +51,7 @@
#define CS_LOCALS(context) \
struct r300_context* const cs_context_copy = (context); \
- struct r300_winsys_screen *cs_winsys = cs_context_copy->rws; \
+ struct radeon_winsys* cs_winsys = cs_context_copy->winsys; \
int cs_count = 0; (void) cs_count;
#define CHECK_CS(size) \
@@ -105,34 +105,22 @@
cs_count--; \
} while (0)
-#define OUT_CS_BUF_RELOC(bo, offset, rd, wd, flags) do { \
+#define OUT_CS_RELOC(bo, offset, rd, wd, flags) do { \
DBG(cs_context_copy, DBG_CS, "r300: writing relocation for buffer %p, offset %d, " \
"domains (%d, %d, %d)\n", \
bo, offset, rd, wd, flags); \
assert(bo); \
cs_winsys->write_cs_dword(cs_winsys, offset); \
- r300_buffer_write_reloc(cs_winsys, r300_buffer(bo), rd, wd, flags); \
- cs_count -= 3; \
-} while (0)
-
-
-#define OUT_CS_TEX_RELOC(tex, offset, rd, wd, flags) do { \
- DBG(cs_context_copy, DBG_CS, "r300: writing relocation for texture %p, offset %d, " \
- "domains (%d, %d, %d)\n", \
- tex, offset, rd, wd, flags); \
- assert(tex); \
- cs_winsys->write_cs_dword(cs_winsys, offset); \
- r300_texture_write_reloc(cs_winsys, tex, rd, wd, flags); \
+ cs_winsys->write_cs_reloc(cs_winsys, bo, rd, wd, flags); \
cs_count -= 3; \
} while (0)
-
-#define OUT_CS_BUF_RELOC_NO_OFFSET(bo, rd, wd, flags) do { \
+#define OUT_CS_RELOC_NO_OFFSET(bo, rd, wd, flags) do { \
DBG(cs_context_copy, DBG_CS, "r300: writing relocation for buffer %p, " \
"domains (%d, %d, %d)\n", \
bo, rd, wd, flags); \
assert(bo); \
- r300_buffer_write_reloc(cs_winsys, r300_buffer(bo), rd, wd, flags); \
+ cs_winsys->write_cs_reloc(cs_winsys, bo, rd, wd, flags); \
cs_count -= 2; \
} while (0)
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index 6fb1d7bd922..f7dcd8dc52f 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -32,8 +32,6 @@
#include "r300_emit.h"
#include "r300_fs.h"
#include "r300_screen.h"
-#include "r300_screen_buffer.h"
-#include "r300_state_inlines.h"
#include "r300_vs.h"
void r300_emit_blend_state(struct r300_context* r300, void* state)
@@ -420,10 +418,10 @@ void r300_emit_fb_state(struct r300_context* r300, void* state)
assert(tex && tex->buffer && "cbuf is marked, but NULL!");
OUT_CS_REG_SEQ(R300_RB3D_COLOROFFSET0 + (4 * i), 1);
- OUT_CS_TEX_RELOC(tex, surf->offset, 0, RADEON_GEM_DOMAIN_VRAM, 0);
+ OUT_CS_RELOC(tex->buffer, surf->offset, 0, RADEON_GEM_DOMAIN_VRAM, 0);
OUT_CS_REG_SEQ(R300_RB3D_COLORPITCH0 + (4 * i), 1);
- OUT_CS_TEX_RELOC(tex, tex->fb_state.colorpitch[surf->level],
+ OUT_CS_RELOC(tex->buffer, tex->fb_state.colorpitch[surf->level],
0, RADEON_GEM_DOMAIN_VRAM, 0);
OUT_CS_REG(R300_US_OUT_FMT_0 + (4 * i), tex->fb_state.us_out_fmt);
@@ -436,12 +434,12 @@ void r300_emit_fb_state(struct r300_context* r300, void* state)
assert(tex && tex->buffer && "zsbuf is marked, but NULL!");
OUT_CS_REG_SEQ(R300_ZB_DEPTHOFFSET, 1);
- OUT_CS_TEX_RELOC(tex, surf->offset, 0, RADEON_GEM_DOMAIN_VRAM, 0);
+ OUT_CS_RELOC(tex->buffer, surf->offset, 0, RADEON_GEM_DOMAIN_VRAM, 0);
OUT_CS_REG(R300_ZB_FORMAT, tex->fb_state.zb_format);
OUT_CS_REG_SEQ(R300_ZB_DEPTHPITCH, 1);
- OUT_CS_TEX_RELOC(tex, tex->fb_state.depthpitch[surf->level],
+ OUT_CS_RELOC(tex->buffer, tex->fb_state.depthpitch[surf->level],
0, RADEON_GEM_DOMAIN_VRAM, 0);
}
@@ -491,13 +489,13 @@ static void r300_emit_query_finish(struct r300_context *r300,
/* pipe 3 only */
OUT_CS_REG(R300_SU_REG_DEST, 1 << 3);
OUT_CS_REG_SEQ(R300_ZB_ZPASS_ADDR, 1);
- OUT_CS_BUF_RELOC(r300->oqbo, query->offset + (sizeof(uint32_t) * 3),
+ OUT_CS_RELOC(r300->oqbo, query->offset + (sizeof(uint32_t) * 3),
0, RADEON_GEM_DOMAIN_GTT, 0);
case 3:
/* pipe 2 only */
OUT_CS_REG(R300_SU_REG_DEST, 1 << 2);
OUT_CS_REG_SEQ(R300_ZB_ZPASS_ADDR, 1);
- OUT_CS_BUF_RELOC(r300->oqbo, query->offset + (sizeof(uint32_t) * 2),
+ OUT_CS_RELOC(r300->oqbo, query->offset + (sizeof(uint32_t) * 2),
0, RADEON_GEM_DOMAIN_GTT, 0);
case 2:
/* pipe 1 only */
@@ -505,13 +503,13 @@ static void r300_emit_query_finish(struct r300_context *r300,
OUT_CS_REG(R300_SU_REG_DEST,
1 << (caps->high_second_pipe ? 3 : 1));
OUT_CS_REG_SEQ(R300_ZB_ZPASS_ADDR, 1);
- OUT_CS_BUF_RELOC(r300->oqbo, query->offset + (sizeof(uint32_t) * 1),
+ OUT_CS_RELOC(r300->oqbo, query->offset + (sizeof(uint32_t) * 1),
0, RADEON_GEM_DOMAIN_GTT, 0);
case 1:
/* pipe 0 only */
OUT_CS_REG(R300_SU_REG_DEST, 1 << 0);
OUT_CS_REG_SEQ(R300_ZB_ZPASS_ADDR, 1);
- OUT_CS_BUF_RELOC(r300->oqbo, query->offset + (sizeof(uint32_t) * 0),
+ OUT_CS_RELOC(r300->oqbo, query->offset + (sizeof(uint32_t) * 0),
0, RADEON_GEM_DOMAIN_GTT, 0);
break;
default:
@@ -533,7 +531,7 @@ static void rv530_emit_query_single(struct r300_context *r300,
BEGIN_CS(8);
OUT_CS_REG(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_0);
OUT_CS_REG_SEQ(R300_ZB_ZPASS_ADDR, 1);
- OUT_CS_BUF_RELOC(r300->oqbo, query->offset, 0, RADEON_GEM_DOMAIN_GTT, 0);
+ OUT_CS_RELOC(r300->oqbo, query->offset, 0, RADEON_GEM_DOMAIN_GTT, 0);
OUT_CS_REG(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_ALL);
END_CS;
}
@@ -546,10 +544,10 @@ static void rv530_emit_query_double(struct r300_context *r300,
BEGIN_CS(14);
OUT_CS_REG(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_0);
OUT_CS_REG_SEQ(R300_ZB_ZPASS_ADDR, 1);
- OUT_CS_BUF_RELOC(r300->oqbo, query->offset, 0, RADEON_GEM_DOMAIN_GTT, 0);
+ OUT_CS_RELOC(r300->oqbo, query->offset, 0, RADEON_GEM_DOMAIN_GTT, 0);
OUT_CS_REG(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_1);
OUT_CS_REG_SEQ(R300_ZB_ZPASS_ADDR, 1);
- OUT_CS_BUF_RELOC(r300->oqbo, query->offset + sizeof(uint32_t), 0, RADEON_GEM_DOMAIN_GTT, 0);
+ OUT_CS_RELOC(r300->oqbo, query->offset + sizeof(uint32_t), 0, RADEON_GEM_DOMAIN_GTT, 0);
OUT_CS_REG(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_ALL);
END_CS;
}
@@ -761,7 +759,7 @@ void r300_emit_texture(struct r300_context* r300,
OUT_CS_REG(R300_TX_FORMAT1_0 + (offset * 4), tex->state.format1);
OUT_CS_REG(R300_TX_FORMAT2_0 + (offset * 4), tex->state.format2);
OUT_CS_REG_SEQ(R300_TX_OFFSET_0 + (offset * 4), 1);
- OUT_CS_TEX_RELOC(tex,
+ OUT_CS_RELOC(tex->buffer,
R300_TXO_MACRO_TILE(tex->macrotile) |
R300_TXO_MICRO_TILE(tex->microtile),
RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0, 0);
@@ -802,7 +800,7 @@ void r300_emit_aos(struct r300_context* r300, unsigned offset)
}
for (i = 0; i < aos_count; i++) {
- OUT_CS_BUF_RELOC_NO_OFFSET(vbuf[velem[i].vertex_buffer_index].buffer,
+ OUT_CS_RELOC_NO_OFFSET(vbuf[velem[i].vertex_buffer_index].buffer,
RADEON_GEM_DOMAIN_GTT, 0, 0);
}
END_CS;
@@ -1014,15 +1012,15 @@ void r300_emit_buffer_validate(struct r300_context *r300)
boolean invalid = FALSE;
/* Clean out BOs. */
- r300->rws->reset_bos(r300->rws);
+ r300->winsys->reset_bos(r300->winsys);
validate:
/* Color buffers... */
for (i = 0; i < fb->nr_cbufs; i++) {
tex = (struct r300_texture*)fb->cbufs[i]->texture;
assert(tex && tex->buffer && "cbuf is marked, but NULL!");
- if (!r300_add_texture(r300->rws, tex,
- 0, RADEON_GEM_DOMAIN_VRAM)) {
+ if (!r300->winsys->add_buffer(r300->winsys, tex->buffer,
+ 0, RADEON_GEM_DOMAIN_VRAM)) {
r300->context.flush(&r300->context, 0, NULL);
goto validate;
}
@@ -1031,8 +1029,8 @@ validate:
if (fb->zsbuf) {
tex = (struct r300_texture*)fb->zsbuf->texture;
assert(tex && tex->buffer && "zsbuf is marked, but NULL!");
- if (!r300_add_texture(r300->rws, tex,
- 0, RADEON_GEM_DOMAIN_VRAM)) {
+ if (!r300->winsys->add_buffer(r300->winsys, tex->buffer,
+ 0, RADEON_GEM_DOMAIN_VRAM)) {
r300->context.flush(&r300->context, 0, NULL);
goto validate;
}
@@ -1042,31 +1040,31 @@ validate:
tex = r300->textures[i];
if (!tex)
continue;
- if (!r300_add_texture(r300->rws, tex,
- RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0)) {
+ if (!r300->winsys->add_buffer(r300->winsys, tex->buffer,
+ RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0)) {
r300->context.flush(&r300->context, 0, NULL);
goto validate;
}
}
/* ...occlusion query buffer... */
if (r300->dirty_state & R300_NEW_QUERY) {
- if (!r300_add_buffer(r300->rws, r300->oqbo,
- 0, RADEON_GEM_DOMAIN_GTT)) {
+ if (!r300->winsys->add_buffer(r300->winsys, r300->oqbo,
+ 0, RADEON_GEM_DOMAIN_GTT)) {
r300->context.flush(&r300->context, 0, NULL);
goto validate;
}
}
/* ...and vertex buffer. */
if (r300->vbo) {
- if (!r300_add_buffer(r300->rws, r300->vbo,
- RADEON_GEM_DOMAIN_GTT, 0)) {
+ if (!r300->winsys->add_buffer(r300->winsys, r300->vbo,
+ RADEON_GEM_DOMAIN_GTT, 0)) {
r300->context.flush(&r300->context, 0, NULL);
goto validate;
}
} else {
/* debug_printf("No VBO while emitting dirty state!\n"); */
}
- if (!r300->rws->validate(r300->rws)) {
+ if (!r300->winsys->validate(r300->winsys)) {
r300->context.flush(&r300->context, 0, NULL);
if (invalid) {
/* Well, hell. */
@@ -1098,7 +1096,7 @@ void r300_emit_dirty_state(struct r300_context* r300)
/* Make sure we have at least 2*1024 spare dwords. */
/* XXX It would be nice to know the number of dwords we really need to
* XXX emit. */
- while (!r300->rws->check_cs(r300->rws, dwords)) {
+ while (!r300->winsys->check_cs(r300->winsys, dwords)) {
r300->context.flush(&r300->context, 0, NULL);
}
diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c
index 47f5d6f7f16..754eb4dc769 100644
--- a/src/gallium/drivers/r300/r300_render.c
+++ b/src/gallium/drivers/r300/r300_render.c
@@ -30,12 +30,10 @@
#include "util/u_format.h"
#include "util/u_memory.h"
-#include "util/u_upload_mgr.h"
#include "util/u_prim.h"
#include "r300_cs.h"
#include "r300_context.h"
-#include "r300_screen_buffer.h"
#include "r300_emit.h"
#include "r300_reg.h"
#include "r300_render.h"
@@ -299,7 +297,7 @@ static void r300_emit_draw_elements(struct r300_context *r300,
OUT_CS(R300_INDX_BUFFER_ONE_REG_WR | (R300_VAP_PORT_IDX0 >> 2) |
(0 << R300_INDX_BUFFER_SKIP_SHIFT));
OUT_CS(offset_dwords << 2);
- OUT_CS_BUF_RELOC(indexBuffer, count_dwords,
+ OUT_CS_RELOC(indexBuffer, count_dwords,
RADEON_GEM_DOMAIN_GTT, 0, 0);
END_CS;
@@ -310,28 +308,21 @@ static boolean r300_setup_vertex_buffers(struct r300_context *r300)
struct pipe_vertex_buffer *vbuf = r300->vertex_buffer;
struct pipe_vertex_element *velem = r300->vertex_element;
struct pipe_buffer *pbuf;
- int ret;
-
- /* upload buffers first */
- if (r300->any_user_vbs) {
- ret = r300_upload_user_buffers(r300);
- r300->any_user_vbs = false;
- }
validate:
for (int i = 0; i < r300->vertex_element_count; i++) {
pbuf = vbuf[velem[i].vertex_buffer_index].buffer;
- if (!r300_add_buffer(r300->rws, pbuf,
- RADEON_GEM_DOMAIN_GTT, 0)) {
+ if (!r300->winsys->add_buffer(r300->winsys, pbuf,
+ RADEON_GEM_DOMAIN_GTT, 0)) {
r300->context.flush(&r300->context, 0, NULL);
goto validate;
}
}
- if (!r300->rws->validate(r300->rws)) {
+ if (!r300->winsys->validate(r300->winsys)) {
r300->context.flush(&r300->context, 0, NULL);
- return r300->rws->validate(r300->rws);
+ return r300->winsys->validate(r300->winsys);
}
return TRUE;
@@ -405,20 +396,15 @@ void r300_draw_range_elements(struct pipe_context* pipe,
indexSize = 2;
}
- r300_upload_index_buffer(r300, &indexBuffer,
- indexSize, start, count);
-
- if (!r300_add_buffer(r300->rws, indexBuffer,
- RADEON_GEM_DOMAIN_GTT, 0)) {
+ if (!r300->winsys->add_buffer(r300->winsys, indexBuffer,
+ RADEON_GEM_DOMAIN_GTT, 0)) {
goto cleanup;
}
- if (!r300->rws->validate(r300->rws)) {
+ if (!r300->winsys->validate(r300->winsys)) {
goto cleanup;
}
- u_upload_flush(r300->upload_vb);
- u_upload_flush(r300->upload_ib);
r300_emit_dirty_state(r300);
r300_emit_aos(r300, 0);
@@ -439,7 +425,7 @@ void r300_draw_range_elements(struct pipe_context* pipe,
cleanup:
if (indexBuffer != orgIndexBuffer) {
- pipe_buffer_reference( &indexBuffer, NULL );
+ pipe->screen->buffer_destroy(indexBuffer);
}
}
@@ -480,7 +466,6 @@ void r300_draw_arrays(struct pipe_context* pipe, unsigned mode,
return;
}
- u_upload_flush(r300->upload_vb);
r300_emit_dirty_state(r300);
if (alt_num_verts || count <= 65535) {
diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
index 3b70312c829..6a55570571a 100644
--- a/src/gallium/drivers/r300/r300_screen.c
+++ b/src/gallium/drivers/r300/r300_screen.c
@@ -23,6 +23,7 @@
#include "util/u_inlines.h"
#include "util/u_format.h"
#include "util/u_memory.h"
+#include "util/u_simple_screen.h"
#include "r300_context.h"
#include "r300_screen.h"
@@ -31,8 +32,6 @@
#include "radeon_winsys.h"
#include "r300_winsys.h"
-#include "r300_screen_buffer.h"
-
/* Return the identifier behind whom the brave coders responsible for this
* amalgamation of code, sweat, and duct tape, routinely obscure their names.
*
@@ -293,11 +292,10 @@ static void* r300_transfer_map(struct pipe_screen* screen,
struct pipe_transfer* transfer)
{
struct r300_texture* tex = (struct r300_texture*)transfer->texture;
- struct r300_winsys_screen *rws = r300_winsys_screen(screen);
char* map;
enum pipe_format format = tex->tex.format;
- map = rws->buffer_map(rws, tex->buffer,
+ map = pipe_buffer_map(screen, tex->buffer,
pipe_transfer_buffer_flags(transfer));
if (!map) {
@@ -313,26 +311,21 @@ static void r300_transfer_unmap(struct pipe_screen* screen,
struct pipe_transfer* transfer)
{
struct r300_texture* tex = (struct r300_texture*)transfer->texture;
- struct r300_winsys_screen *rws = r300_winsys_screen(screen);
- rws->buffer_unmap(rws, tex->buffer);
+ pipe_buffer_unmap(screen, tex->buffer);
}
static void r300_destroy_screen(struct pipe_screen* pscreen)
{
struct r300_screen* r300screen = r300_screen(pscreen);
- struct r300_winsys_screen *rws = r300_winsys_screen(pscreen);
-
- if (rws)
- rws->destroy(rws);
FREE(r300screen->caps);
FREE(r300screen);
}
-struct pipe_screen* r300_create_screen(struct r300_winsys_screen *rws)
+struct pipe_screen* r300_create_screen(struct radeon_winsys* radeon_winsys)
{
- struct r300_screen *r300screen = CALLOC_STRUCT(r300_screen);
- struct r300_capabilities *caps = CALLOC_STRUCT(r300_capabilities);
+ struct r300_screen* r300screen = CALLOC_STRUCT(r300_screen);
+ struct r300_capabilities* caps = CALLOC_STRUCT(r300_capabilities);
if (!r300screen || !caps) {
FREE(r300screen);
@@ -340,16 +333,16 @@ struct pipe_screen* r300_create_screen(struct r300_winsys_screen *rws)
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);
+ caps->pci_id = radeon_winsys->pci_id;
+ caps->num_frag_pipes = radeon_winsys->gb_pipes;
+ caps->num_z_pipes = radeon_winsys->z_pipes;
r300_init_debug(r300screen);
r300_parse_chipset(caps);
r300screen->caps = caps;
- r300screen->rws = rws;
- r300screen->screen.winsys = (struct pipe_winsys*)rws;
+ r300screen->radeon_winsys = radeon_winsys;
+ r300screen->screen.winsys = (struct pipe_winsys*)radeon_winsys;
r300screen->screen.destroy = r300_destroy_screen;
r300screen->screen.get_name = r300_get_name;
r300screen->screen.get_vendor = r300_get_vendor;
@@ -363,12 +356,7 @@ struct pipe_screen* r300_create_screen(struct r300_winsys_screen *rws)
r300screen->screen.transfer_unmap = r300_transfer_unmap;
r300_init_screen_texture_functions(&r300screen->screen);
- r300_screen_init_buffer_functions(r300screen);
- return &r300screen->screen;
-}
+ u_simple_screen_init(&r300screen->screen);
-struct r300_winsys_screen *
-r300_winsys_screen(struct pipe_screen *screen)
-{
- return r300_screen(screen)->rws;
+ return &r300screen->screen;
}
diff --git a/src/gallium/drivers/r300/r300_screen.h b/src/gallium/drivers/r300/r300_screen.h
index 87fc6190ce6..502fbfa5a24 100644
--- a/src/gallium/drivers/r300/r300_screen.h
+++ b/src/gallium/drivers/r300/r300_screen.h
@@ -33,7 +33,7 @@ struct r300_screen {
/* Parent class */
struct pipe_screen screen;
- struct r300_winsys_screen *rws;
+ struct radeon_winsys* radeon_winsys;
/* Chipset capabilities */
struct r300_capabilities* caps;
diff --git a/src/gallium/drivers/r300/r300_screen_buffer.c b/src/gallium/drivers/r300/r300_screen_buffer.c
deleted file mode 100644
index 358582ea211..00000000000
--- a/src/gallium/drivers/r300/r300_screen_buffer.c
+++ /dev/null
@@ -1,222 +0,0 @@
-#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 "r300_screen_buffer.h"
-
-#include "r300_winsys.h"
-
-int r300_upload_index_buffer(struct r300_context *r300,
- struct pipe_buffer **index_buffer,
- unsigned index_size,
- unsigned start,
- unsigned count)
-{
- struct pipe_buffer *upload_buffer = NULL;
- unsigned index_offset = start * index_size;
- int ret = 0;
-
- if (r300_buffer_is_user_buffer(*index_buffer)) {
- ret = u_upload_buffer(r300->upload_ib,
- index_offset,
- count * index_size,
- *index_buffer,
- &index_offset,
- &upload_buffer);
- if (ret) {
- goto done;
- }
- *index_buffer = upload_buffer;
- }
- done:
- // if (upload_buffer)
- // pipe_buffer_reference(&upload_buffer, NULL);
- return ret;
-}
-
-int r300_upload_user_buffers(struct r300_context *r300)
-{
- enum pipe_error ret = PIPE_OK;
- int i, nr;
-
- nr = r300->vertex_buffer_count;
-
- for (i = 0; i < nr; i++) {
-
- if (r300_buffer_is_user_buffer(r300->vertex_buffer[i].buffer)) {
- struct pipe_buffer *upload_buffer = NULL;
- unsigned offset = 0;
- unsigned size = r300->vertex_buffer[i].buffer->size;
- unsigned upload_offset;
-
- ret = u_upload_buffer(r300->upload_vb,
- offset, size,
- r300->vertex_buffer[i].buffer,
- &upload_offset, &upload_buffer);
- if (ret)
- return ret;
-
- pipe_buffer_reference(&r300->vertex_buffer[i].buffer, NULL);
- r300->vertex_buffer[i].buffer = upload_buffer;
- r300->vertex_buffer[i].buffer_offset = upload_offset;
- }
- }
- return ret;
-}
-
-static struct r300_winsys_buffer *
-r300_winsys_buffer_create(struct r300_screen *r300screen,
- unsigned alignment,
- unsigned usage,
- unsigned size)
-{
- struct r300_winsys_screen *rws = r300screen->rws;
- struct r300_winsys_buffer *buf;
-
- buf = rws->buffer_create(rws, alignment, usage, size);
- return buf;
-}
-
-static void r300_winsys_buffer_destroy(struct r300_screen *r300screen,
- struct r300_buffer *rbuf)
-{
- struct r300_winsys_screen *rws = r300screen->rws;
-
- if (rbuf->buf) {
- rws->buffer_destroy(rbuf->buf);
- rbuf->buf = NULL;
- }
-}
-
-static struct pipe_buffer *r300_buffer_create(struct pipe_screen *screen,
- unsigned alignment,
- unsigned usage,
- unsigned size)
-{
- struct r300_screen *r300screen = r300_screen(screen);
- struct r300_buffer *rbuf;
-
- rbuf = CALLOC_STRUCT(r300_buffer);
- if (!rbuf)
- goto error1;
-
- rbuf->magic = R300_BUFFER_MAGIC;
-
- pipe_reference_init(&rbuf->base.reference, 1);
- rbuf->base.screen = screen;
- rbuf->base.alignment = alignment;
- rbuf->base.usage = usage;
- rbuf->base.size = size;
-
- rbuf->buf = r300_winsys_buffer_create(r300screen,
- alignment,
- usage,
- size);
-
- if (!rbuf->buf)
- goto error2;
-
- return &rbuf->base;
-error2:
- FREE(rbuf);
-error1:
- return NULL;
-}
-
-
-static struct pipe_buffer *r300_user_buffer_create(struct pipe_screen *screen,
- void *ptr,
- unsigned bytes)
-{
- struct r300_buffer *rbuf;
-
- rbuf = CALLOC_STRUCT(r300_buffer);
- if (!rbuf)
- goto no_rbuf;
-
- rbuf->magic = R300_BUFFER_MAGIC;
-
- pipe_reference_init(&rbuf->base.reference, 1);
- rbuf->base.screen = screen;
- rbuf->base.alignment = 1;
- rbuf->base.usage = 0;
- rbuf->base.size = bytes;
-
- rbuf->user_buffer = ptr;
- return &rbuf->base;
-
-no_rbuf:
- return NULL;
-}
-
-static void r300_buffer_destroy(struct pipe_buffer *buf)
-{
- struct r300_screen *r300screen = r300_screen(buf->screen);
- struct r300_buffer *rbuf = r300_buffer(buf);
-
- r300_winsys_buffer_destroy(r300screen, rbuf);
- FREE(rbuf);
-}
-
-static void *
-r300_buffer_map_range(struct pipe_screen *screen,
- struct pipe_buffer *buf,
- unsigned offset, unsigned length,
- unsigned usage )
-{
- struct r300_screen *r300screen = r300_screen(screen);
- struct r300_winsys_screen *rws = r300screen->rws;
- struct r300_buffer *rbuf = r300_buffer(buf);
- void *map;
-
- if (rbuf->user_buffer)
- return rbuf->user_buffer;
-
- map = rws->buffer_map(rws, rbuf->buf, usage);
-
- return map;
-}
-
-static void *
-r300_buffer_map(struct pipe_screen *screen,
- struct pipe_buffer *buf,
- unsigned usage)
-{
- struct r300_screen *r300screen = r300_screen(screen);
- struct r300_winsys_screen *rws = r300screen->rws;
- struct r300_buffer *rbuf = r300_buffer(buf);
- void *map;
-
- if (rbuf->user_buffer)
- return rbuf->user_buffer;
-
- map = rws->buffer_map(rws, rbuf->buf, usage);
-
- return map;
-}
-
-static void
-r300_buffer_unmap(struct pipe_screen *screen,
- struct pipe_buffer *buf)
-{
- struct r300_screen *r300screen = r300_screen(screen);
- struct r300_winsys_screen *rws = r300screen->rws;
- struct r300_buffer *rbuf = r300_buffer(buf);
-
- if (rbuf->buf)
- rws->buffer_unmap(rws, rbuf->buf);
-}
-
-void r300_screen_init_buffer_functions(struct r300_screen *r300screen)
-{
- r300screen->screen.buffer_create = r300_buffer_create;
- r300screen->screen.user_buffer_create = r300_user_buffer_create;
- r300screen->screen.buffer_map = r300_buffer_map;
- r300screen->screen.buffer_map_range = r300_buffer_map_range;
-// r300screen->screen.buffer_flush_mapped_range = r300_buffer_flush_mapped_range;
- r300screen->screen.buffer_unmap = r300_buffer_unmap;
- r300screen->screen.buffer_destroy = r300_buffer_destroy;
-}
diff --git a/src/gallium/drivers/r300/r300_screen_buffer.h b/src/gallium/drivers/r300/r300_screen_buffer.h
deleted file mode 100644
index 7c026508b59..00000000000
--- a/src/gallium/drivers/r300/r300_screen_buffer.h
+++ /dev/null
@@ -1,85 +0,0 @@
-#ifndef R300_SCREEN_BUFFER_H
-#define R300_SCREEN_BUFFER_H
-#include "pipe/p_compiler.h"
-#include "pipe/p_state.h"
-#include "r300_screen.h"
-
-#include "r300_winsys.h"
-#include "r300_context.h"
-
-#define R300_BUFFER_MAGIC 0xabcd1234
-
-struct r300_buffer
-{
- struct pipe_buffer base;
-
- uint32_t magic;
-
- struct r300_winsys_buffer *buf;
-
- void *user_buffer;
-};
-
-static INLINE struct r300_buffer *
-r300_buffer(struct pipe_buffer *buffer)
-{
- if (buffer) {
- assert(((struct r300_buffer *)buffer)->magic == R300_BUFFER_MAGIC);
- return (struct r300_buffer *)buffer;
- }
- return NULL;
-}
-
-static INLINE boolean
-r300_buffer_is_user_buffer(struct pipe_buffer *buffer)
-{
- return r300_buffer(buffer)->user_buffer ? true : false;
-}
-
-static INLINE boolean r300_add_buffer(struct r300_winsys_screen *rws,
- struct pipe_buffer *buffer,
- int rd, int wr)
-{
- struct r300_buffer *buf = r300_buffer(buffer);
-
- if (!buf->buf)
- return true;
-
- return rws->add_buffer(rws, buf->buf, rd, wr);
-}
-
-
-static INLINE boolean r300_add_texture(struct r300_winsys_screen *rws,
- struct r300_texture *tex,
- int rd, int wr)
-{
- return rws->add_buffer(rws, tex->buffer, rd, wr);
-}
-
-void r300_screen_init_buffer_functions(struct r300_screen *r300screen);
-
-static INLINE void r300_buffer_write_reloc(struct r300_winsys_screen *rws,
- struct r300_buffer *buf,
- uint32_t rd, uint32_t wd, uint32_t flags)
-{
- if (!buf->buf)
- return;
-
- rws->write_cs_reloc(rws, buf->buf, rd, wd, flags);
-}
-
-static INLINE void r300_texture_write_reloc(struct r300_winsys_screen *rws,
- struct r300_texture *texture,
- uint32_t rd, uint32_t wd, uint32_t flags)
-{
- rws->write_cs_reloc(rws, texture->buffer, rd, wd, flags);
-}
-
-int r300_upload_user_buffers(struct r300_context *r300);
-
-int r300_upload_index_buffer(struct r300_context *r300,
- struct pipe_buffer **index_buffer,
- unsigned index_size,
- unsigned start,
- unsigned count);
-#endif
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index d8a87dec151..34bf81c1930 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -34,7 +34,6 @@
#include "r300_context.h"
#include "r300_reg.h"
#include "r300_screen.h"
-#include "r300_screen_buffer.h"
#include "r300_state_inlines.h"
#include "r300_fs.h"
#include "r300_vs.h"
@@ -522,7 +521,7 @@ static void r300_fb_update_tiling_flags(struct r300_context *r300,
tex = (struct r300_texture*)old_state->cbufs[i]->texture;
if (tex) {
- r300->rws->buffer_set_tiling(r300->rws, tex->buffer,
+ r300->winsys->buffer_set_tiling(r300->winsys, tex->buffer,
tex->pitch[0],
tex->microtile != 0,
tex->macrotile != 0);
@@ -534,7 +533,7 @@ static void r300_fb_update_tiling_flags(struct r300_context *r300,
tex = (struct r300_texture*)old_state->zsbuf->texture;
if (tex) {
- r300->rws->buffer_set_tiling(r300->rws, tex->buffer,
+ r300->winsys->buffer_set_tiling(r300->winsys, tex->buffer,
tex->pitch[0],
tex->microtile != 0,
tex->macrotile != 0);
@@ -546,7 +545,7 @@ static void r300_fb_update_tiling_flags(struct r300_context *r300,
tex = (struct r300_texture*)new_state->cbufs[i]->texture;
level = new_state->cbufs[i]->level;
- r300->rws->buffer_set_tiling(r300->rws, tex->buffer,
+ r300->winsys->buffer_set_tiling(r300->winsys, tex->buffer,
tex->pitch[level],
tex->microtile != 0,
tex->mip_macrotile[level] != 0);
@@ -555,7 +554,7 @@ static void r300_fb_update_tiling_flags(struct r300_context *r300,
tex = (struct r300_texture*)new_state->zsbuf->texture;
level = new_state->zsbuf->level;
- r300->rws->buffer_set_tiling(r300->rws, tex->buffer,
+ r300->winsys->buffer_set_tiling(r300->winsys, tex->buffer,
tex->pitch[level],
tex->microtile != 0,
tex->mip_macrotile[level] != 0);
@@ -1029,26 +1028,10 @@ static void r300_set_vertex_buffers(struct pipe_context* pipe,
const struct pipe_vertex_buffer* buffers)
{
struct r300_context* r300 = r300_context(pipe);
- boolean any_user_buffer = false;
- int i;
-
- if (count == r300->vertex_buffer_count &&
- memcmp(r300->vertex_buffer, buffers, count * sizeof(buffers[0])) == 0)
- return;
-
- for (i = 0; i < count; i++) {
- pipe_buffer_reference(&r300->vertex_buffer[i].buffer, buffers[i].buffer);
- if (r300_buffer_is_user_buffer(buffers[i].buffer))
- any_user_buffer = true;
- }
-
- for ( ; i < r300->vertex_buffer_count; i++)
- pipe_buffer_reference(&r300->vertex_buffer[i].buffer, NULL);
memcpy(r300->vertex_buffer, buffers,
sizeof(struct pipe_vertex_buffer) * count);
r300->vertex_buffer_count = count;
- r300->any_user_vbs = any_user_buffer;
if (r300->draw) {
draw_flush(r300->draw);
diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c
index 9016e86ccd7..ed2be06254a 100644
--- a/src/gallium/drivers/r300/r300_texture.c
+++ b/src/gallium/drivers/r300/r300_texture.c
@@ -731,7 +731,7 @@ static struct pipe_texture*
{
struct r300_texture* tex = CALLOC_STRUCT(r300_texture);
struct r300_screen* rscreen = r300_screen(screen);
- struct r300_winsys_screen *rws = (struct r300_winsys_screen *)screen->winsys;
+ struct radeon_winsys* winsys = (struct radeon_winsys*)screen->winsys;
if (!tex) {
return NULL;
@@ -745,13 +745,13 @@ static struct pipe_texture*
r300_setup_miptree(rscreen, tex);
r300_setup_texture_state(rscreen, tex);
- tex->buffer = rws->buffer_create(rws, 2048,
- PIPE_BUFFER_USAGE_PIXEL,
- tex->size);
- rws->buffer_set_tiling(rws, tex->buffer,
- tex->pitch[0],
- tex->microtile != R300_BUFFER_LINEAR,
- tex->macrotile != R300_BUFFER_LINEAR);
+ tex->buffer = screen->buffer_create(screen, 2048,
+ PIPE_BUFFER_USAGE_PIXEL,
+ tex->size);
+ winsys->buffer_set_tiling(winsys, tex->buffer,
+ tex->pitch[0],
+ tex->microtile != R300_BUFFER_LINEAR,
+ tex->macrotile != R300_BUFFER_LINEAR);
if (!tex->buffer) {
FREE(tex);
@@ -764,9 +764,9 @@ static struct pipe_texture*
static void r300_texture_destroy(struct pipe_texture* texture)
{
struct r300_texture* tex = (struct r300_texture*)texture;
- struct r300_winsys_screen *rws = (struct r300_winsys_screen *)texture->screen->winsys;
- rws->buffer_reference(rws, &tex->buffer, NULL);
+ pipe_buffer_reference(&tex->buffer, NULL);
+
FREE(tex);
}
@@ -806,14 +806,14 @@ static void r300_tex_surface_destroy(struct pipe_surface* s)
FREE(s);
}
-struct pipe_texture *r300_texture_blanket_winsys_buffer(struct pipe_screen *screen,
- const struct pipe_texture *base,
- const unsigned *stride,
- struct r300_winsys_buffer *buffer)
+static struct pipe_texture*
+ r300_texture_blanket(struct pipe_screen* screen,
+ const struct pipe_texture* base,
+ const unsigned* stride,
+ struct pipe_buffer* buffer)
{
struct r300_texture* tex;
struct r300_screen* rscreen = r300_screen(screen);
- struct r300_winsys_screen *rws = (struct r300_winsys_screen *)screen->winsys;
/* Support only 2D textures without mipmaps */
if (base->target != PIPE_TEXTURE_2D ||
@@ -837,7 +837,7 @@ struct pipe_texture *r300_texture_blanket_winsys_buffer(struct pipe_screen *scre
r300_setup_flags(tex);
r300_setup_texture_state(rscreen, tex);
- rws->buffer_reference(rws, &tex->buffer, buffer);
+ pipe_buffer_reference(&tex->buffer, buffer);
return (struct pipe_texture*)tex;
}
@@ -896,6 +896,7 @@ void r300_init_screen_texture_functions(struct pipe_screen* screen)
screen->texture_destroy = r300_texture_destroy;
screen->get_tex_surface = r300_get_tex_surface;
screen->tex_surface_destroy = r300_tex_surface_destroy;
+ screen->texture_blanket = r300_texture_blanket;
screen->video_surface_create = r300_video_surface_create;
screen->video_surface_destroy= r300_video_surface_destroy;
@@ -903,23 +904,19 @@ void r300_init_screen_texture_functions(struct pipe_screen* screen)
boolean r300_get_texture_buffer(struct pipe_screen* screen,
struct pipe_texture* texture,
- struct r300_winsys_buffer** buffer,
+ struct pipe_buffer** buffer,
unsigned* stride)
{
struct r300_texture* tex = (struct r300_texture*)texture;
- struct r300_winsys_screen *rws = (struct r300_winsys_screen *)screen->winsys;
- struct r300_winsys_buffer *buf;
-
if (!tex) {
return FALSE;
}
- rws->buffer_reference(rws, &buf, tex->buffer);
+ pipe_buffer_reference(buffer, tex->buffer);
if (stride) {
*stride = r300_texture_get_stride(r300_screen(screen), tex, 0);
}
- *buffer = buf;
return TRUE;
}
diff --git a/src/gallium/drivers/r300/r300_texture.h b/src/gallium/drivers/r300/r300_texture.h
index 97724f790c8..46a5fb6188b 100644
--- a/src/gallium/drivers/r300/r300_texture.h
+++ b/src/gallium/drivers/r300/r300_texture.h
@@ -63,8 +63,8 @@ r300_video_surface(struct pipe_video_surface *pvs)
#ifndef R300_WINSYS_H
boolean r300_get_texture_buffer(struct pipe_screen* screen,
- struct pipe_texture *texture,
- struct r300_winsys_buffer** buffer,
+ struct pipe_texture* texture,
+ struct pipe_buffer** buffer,
unsigned* stride);
#endif /* R300_WINSYS_H */
diff --git a/src/gallium/drivers/r300/r300_winsys.h b/src/gallium/drivers/r300/r300_winsys.h
index c6f9174496b..40fb8a95ca5 100644
--- a/src/gallium/drivers/r300/r300_winsys.h
+++ b/src/gallium/drivers/r300/r300_winsys.h
@@ -23,6 +23,10 @@
#ifndef R300_WINSYS_H
#define R300_WINSYS_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* The public interface header for the r300 pipe driver.
* Any winsys hosting this pipe needs to implement r300_winsys and then
* call r300_create_screen to start things. */
@@ -30,128 +34,19 @@
#include "pipe/p_defines.h"
#include "pipe/p_state.h"
-struct r300_winsys_screen;
+struct radeon_winsys;
/* Creates a new r300 screen. */
-struct pipe_screen* r300_create_screen(struct r300_winsys_screen *rws);
-
-struct r300_winsys_buffer;
+struct pipe_screen* r300_create_screen(struct radeon_winsys* radeon_winsys);
boolean r300_get_texture_buffer(struct pipe_screen* screen,
struct pipe_texture* texture,
- struct r300_winsys_buffer** buffer,
- unsigned *stride);
-
-enum r300_value_id {
- R300_VID_PCI_ID,
- R300_VID_GB_PIPES,
- R300_VID_Z_PIPES,
-};
-
-struct r300_winsys_screen {
- void (*destroy)(struct r300_winsys_screen *ws);
-
- /**
- * Buffer management. Buffer attributes are mostly fixed over its lifetime.
- *
- * Remember that gallium gets to choose the interface it needs, and the
- * window systems must then implement that interface (rather than the
- * other way around...).
- *
- * usage is a bitmask of R300_WINSYS_BUFFER_USAGE_PIXEL/VERTEX/INDEX/CONSTANT. This
- * usage argument is only an optimization hint, not a guarantee, therefore
- * proper behavior must be observed in all circumstances.
- *
- * alignment indicates the client's alignment requirements, eg for
- * SSE instructions.
- */
- struct r300_winsys_buffer *(*buffer_create)(struct r300_winsys_screen *ws,
- unsigned alignment,
- unsigned usage,
- unsigned size);
-
- /**
- * Map the entire data store of a buffer object into the client's address.
- * flags is bitmask of R300_WINSYS_BUFFER_USAGE_CPU_READ/WRITE flags.
- */
- void *(*buffer_map)( struct r300_winsys_screen *ws,
- struct r300_winsys_buffer *buf,
- unsigned usage );
-
- void (*buffer_unmap)( struct r300_winsys_screen *ws,
- struct r300_winsys_buffer *buf );
-
- void (*buffer_destroy)( struct r300_winsys_buffer *buf );
-
-
- void (*buffer_reference)(struct r300_winsys_screen *rws,
- struct r300_winsys_buffer **pdst,
- struct r300_winsys_buffer *src);
-
- boolean (*buffer_references)(struct r300_winsys_buffer *a,
- struct r300_winsys_buffer *b);
-
- /* Add a pipe_buffer to the list of buffer objects to validate. */
- boolean (*add_buffer)(struct r300_winsys_screen *winsys,
- struct r300_winsys_buffer *buf,
- uint32_t rd,
- uint32_t wd);
-
- /* Revalidate all currently setup pipe_buffers.
- * Returns TRUE if a flush is required. */
- boolean (*validate)(struct r300_winsys_screen* winsys);
-
- /* Check to see if there's room for commands. */
- boolean (*check_cs)(struct r300_winsys_screen* winsys, int size);
-
- /* Start a command emit. */
- void (*begin_cs)(struct r300_winsys_screen* winsys,
- int size,
- const char* file,
- const char* function,
- int line);
-
- /* Write a dword to the command buffer. */
- void (*write_cs_dword)(struct r300_winsys_screen* winsys, uint32_t dword);
-
- /* Write a relocated dword to the command buffer. */
- void (*write_cs_reloc)(struct r300_winsys_screen *winsys,
- struct r300_winsys_buffer *buf,
- uint32_t rd,
- uint32_t wd,
- uint32_t flags);
-
- /* Finish a command emit. */
- void (*end_cs)(struct r300_winsys_screen* winsys,
- const char* file,
- const char* function,
- int line);
-
- /* Flush the CS. */
- void (*flush_cs)(struct r300_winsys_screen* winsys);
-
- /* winsys flush - callback from winsys when flush required */
- void (*set_flush_cb)(struct r300_winsys_screen *winsys,
- void (*flush_cb)(void *), void *data);
-
- void (*reset_bos)(struct r300_winsys_screen *winsys);
-
- void (*buffer_set_tiling)(struct r300_winsys_screen *winsys,
- struct r300_winsys_buffer *buffer,
- uint32_t pitch,
- boolean microtiled,
- boolean macrotiled);
-
- uint32_t (*get_value)(struct r300_winsys_screen *winsys,
- enum r300_value_id vid);
-};
+ struct pipe_buffer** buffer,
+ unsigned* stride);
-struct r300_winsys_screen *
-r300_winsys_screen(struct pipe_screen *screen);
+#ifdef __cplusplus
+}
+#endif
-struct pipe_texture *r300_texture_blanket_winsys_buffer(struct pipe_screen *screen,
- const struct pipe_texture *base,
- const unsigned *stride,
- struct r300_winsys_buffer *buffer);
#endif /* R300_WINSYS_H */