summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r300
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/r300')
-rw-r--r--src/gallium/drivers/r300/Makefile3
-rw-r--r--src/gallium/drivers/r300/r300_blit.c7
-rw-r--r--src/gallium/drivers/r300/r300_context.c31
-rw-r--r--src/gallium/drivers/r300/r300_context.h28
-rw-r--r--src/gallium/drivers/r300/r300_cs.h7
-rw-r--r--src/gallium/drivers/r300/r300_defines.h15
-rw-r--r--src/gallium/drivers/r300/r300_emit.c4
-rw-r--r--src/gallium/drivers/r300/r300_flush.c6
-rw-r--r--src/gallium/drivers/r300/r300_hyperz.c3
-rw-r--r--src/gallium/drivers/r300/r300_public.h4
-rw-r--r--src/gallium/drivers/r300/r300_query.c5
-rw-r--r--src/gallium/drivers/r300/r300_render.c8
-rw-r--r--src/gallium/drivers/r300/r300_screen.c29
-rw-r--r--src/gallium/drivers/r300/r300_screen.h8
-rw-r--r--src/gallium/drivers/r300/r300_screen_buffer.c13
-rw-r--r--src/gallium/drivers/r300/r300_screen_buffer.h1
-rw-r--r--src/gallium/drivers/r300/r300_state.c3
-rw-r--r--src/gallium/drivers/r300/r300_texture.c48
-rw-r--r--src/gallium/drivers/r300/r300_texture_desc.c28
-rw-r--r--src/gallium/drivers/r300/r300_texture_desc.h6
-rw-r--r--src/gallium/drivers/r300/r300_transfer.c4
-rw-r--r--src/gallium/drivers/r300/r300_winsys.h295
22 files changed, 117 insertions, 439 deletions
diff --git a/src/gallium/drivers/r300/Makefile b/src/gallium/drivers/r300/Makefile
index 66d900ebb5f..c9401b99f1c 100644
--- a/src/gallium/drivers/r300/Makefile
+++ b/src/gallium/drivers/r300/Makefile
@@ -29,8 +29,7 @@ C_SOURCES = \
r300_transfer.c
LIBRARY_INCLUDES = \
- -I$(TOP)/src/mesa/drivers/dri/r300/compiler \
- -I$(TOP)/src/gallium/winsys/drm/radeon/core
+ -I$(TOP)/src/mesa/drivers/dri/r300/compiler
COMPILER_ARCHIVE = $(TOP)/src/mesa/drivers/dri/r300/compiler/libr300compiler.a
diff --git a/src/gallium/drivers/r300/r300_blit.c b/src/gallium/drivers/r300/r300_blit.c
index ede0a2317d8..62d90afdcb0 100644
--- a/src/gallium/drivers/r300/r300_blit.c
+++ b/src/gallium/drivers/r300/r300_blit.c
@@ -23,7 +23,6 @@
#include "r300_context.h"
#include "r300_emit.h"
#include "r300_texture.h"
-#include "r300_winsys.h"
#include "util/u_format.h"
#include "util/u_pack_color.h"
@@ -206,7 +205,7 @@ static void r300_clear(struct pipe_context* pipe,
(struct r300_hyperz_state*)r300->hyperz_state.state;
uint32_t width = fb->width;
uint32_t height = fb->height;
- boolean can_hyperz = r300->rws->get_value(r300->rws, R300_CAN_HYPERZ);
+ boolean can_hyperz = r300->rws->get_value(r300->rws, RADEON_VID_CAN_HYPERZ);
uint32_t hyperz_dcv = hyperz->zb_depthclearvalue;
/* Enable fast Z clear.
@@ -260,8 +259,8 @@ static void r300_clear(struct pipe_context* pipe,
r300_get_num_cs_end_dwords(r300);
/* Reserve CS space. */
- if (dwords > (R300_MAX_CMDBUF_DWORDS - r300->cs->cdw)) {
- r300_flush(&r300->context, R300_FLUSH_ASYNC, NULL);
+ if (dwords > (RADEON_MAX_CMDBUF_DWORDS - r300->cs->cdw)) {
+ r300_flush(&r300->context, RADEON_FLUSH_ASYNC, NULL);
}
/* Emit clear packets. */
diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c
index 720d666d98c..15d1278c3bb 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -32,7 +32,6 @@
#include "r300_emit.h"
#include "r300_screen.h"
#include "r300_screen_buffer.h"
-#include "r300_winsys.h"
static void r300_update_num_contexts(struct r300_screen *r300screen,
int diff)
@@ -167,8 +166,8 @@ static boolean r300_setup_atoms(struct r300_context* r300)
boolean is_rv350 = r300->screen->caps.is_rv350;
boolean is_r500 = r300->screen->caps.is_r500;
boolean has_tcl = r300->screen->caps.has_tcl;
- boolean drm_2_6_0 = r300->rws->get_value(r300->rws, R300_VID_DRM_2_6_0);
- boolean can_hyperz = r300->rws->get_value(r300->rws, R300_CAN_HYPERZ);
+ boolean drm_2_6_0 = r300->rws->get_value(r300->rws, RADEON_VID_DRM_2_6_0);
+ boolean can_hyperz = r300->rws->get_value(r300->rws, RADEON_VID_CAN_HYPERZ);
boolean has_hiz_ram = r300->screen->caps.hiz_ram > 0;
/* Create the actual atom list.
@@ -379,7 +378,7 @@ static void r300_init_states(struct pipe_context *pipe)
if (r300->screen->caps.is_r500 ||
(r300->screen->caps.is_rv350 &&
- r300->rws->get_value(r300->rws, R300_VID_DRM_2_6_0))) {
+ r300->rws->get_value(r300->rws, RADEON_VID_DRM_2_6_0))) {
OUT_CB_REG(R300_GB_Z_PEQ_CONFIG, 0);
}
END_CB;
@@ -391,7 +390,7 @@ 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 *rws = r300screen->rws;
if (!r300)
return NULL;
@@ -514,19 +513,19 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
"r300: DRM version: %d.%d.%d, Name: %s, ID: 0x%04x, GB: %d, Z: %d\n"
"r300: GART size: %d MB, VRAM size: %d MB\n"
"r300: AA compression: %s, Z compression: %s, HiZ: %s\n",
- rws->get_value(rws, R300_VID_DRM_MAJOR),
- rws->get_value(rws, R300_VID_DRM_MINOR),
- rws->get_value(rws, R300_VID_DRM_PATCHLEVEL),
+ rws->get_value(rws, RADEON_VID_DRM_MAJOR),
+ rws->get_value(rws, RADEON_VID_DRM_MINOR),
+ rws->get_value(rws, RADEON_VID_DRM_PATCHLEVEL),
screen->get_name(screen),
- rws->get_value(rws, R300_VID_PCI_ID),
- rws->get_value(rws, R300_VID_GB_PIPES),
- rws->get_value(rws, R300_VID_Z_PIPES),
- rws->get_value(rws, R300_VID_GART_SIZE) >> 20,
- rws->get_value(rws, R300_VID_VRAM_SIZE) >> 20,
- rws->get_value(rws, R300_CAN_AACOMPRESS) ? "YES" : "NO",
- rws->get_value(rws, R300_CAN_HYPERZ) &&
+ rws->get_value(rws, RADEON_VID_PCI_ID),
+ rws->get_value(rws, RADEON_VID_R300_GB_PIPES),
+ rws->get_value(rws, RADEON_VID_R300_Z_PIPES),
+ rws->get_value(rws, RADEON_VID_GART_SIZE) >> 20,
+ rws->get_value(rws, RADEON_VID_VRAM_SIZE) >> 20,
+ rws->get_value(rws, RADEON_VID_CAN_AACOMPRESS) ? "YES" : "NO",
+ rws->get_value(rws, RADEON_VID_CAN_HYPERZ) &&
r300->screen->caps.zmask_ram ? "YES" : "NO",
- rws->get_value(rws, R300_CAN_HYPERZ) &&
+ rws->get_value(rws, RADEON_VID_CAN_HYPERZ) &&
r300->screen->caps.hiz_ram ? "YES" : "NO");
}
diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
index c1f766f6180..8a0a54cf1e9 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -34,7 +34,7 @@
#include "r300_defines.h"
#include "r300_screen.h"
-#include "r300_winsys.h"
+#include "../../winsys/radeon/drm/radeon_winsys.h"
struct u_upload_mgr;
struct r300_context;
@@ -291,12 +291,12 @@ struct r300_query {
boolean begin_emitted;
/* The buffer where query results are stored. */
- struct r300_winsys_bo *buf;
- struct r300_winsys_cs_handle *cs_buf;
+ struct pb_buffer *buf;
+ struct radeon_winsys_cs_handle *cs_buf;
/* The size of the buffer. */
unsigned buffer_size;
/* The domain of the buffer. */
- enum r300_buffer_domain domain;
+ enum radeon_bo_domain domain;
/* Linked list members. */
struct r300_query* prev;
@@ -307,10 +307,10 @@ struct r300_surface {
struct pipe_surface base;
/* Winsys buffer backing the texture. */
- struct r300_winsys_bo *buf;
- struct r300_winsys_cs_handle *cs_buf;
+ struct pb_buffer *buf;
+ struct radeon_winsys_cs_handle *cs_buf;
- enum r300_buffer_domain domain;
+ enum radeon_bo_domain domain;
uint32_t offset; /* COLOROFFSET or DEPTHOFFSET. */
uint32_t pitch; /* COLORPITCH or DEPTHPITCH. */
@@ -340,8 +340,8 @@ struct r300_texture_desc {
/* Buffer tiling.
* Macrotiling is specified per-level because small mipmaps cannot
* be macrotiled. */
- enum r300_buffer_tiling microtile;
- enum r300_buffer_tiling macrotile[R300_MAX_TEXTURE_LEVELS];
+ enum radeon_bo_layout microtile;
+ enum radeon_bo_layout macrotile[R300_MAX_TEXTURE_LEVELS];
/* Offsets into the buffer. */
unsigned offset_in_bytes[R300_MAX_TEXTURE_LEVELS];
@@ -397,9 +397,9 @@ struct r300_resource
struct u_vbuf_resource b;
/* Winsys buffer backing this resource. */
- struct r300_winsys_bo *buf;
- struct r300_winsys_cs_handle *cs_buf;
- enum r300_buffer_domain domain;
+ struct pb_buffer *buf;
+ struct radeon_winsys_cs_handle *cs_buf;
+ enum radeon_bo_domain domain;
unsigned buf_size;
/* Constant buffers are in user memory. */
@@ -460,9 +460,9 @@ struct r300_context {
struct pipe_context context;
/* The interface to the windowing system, etc. */
- struct r300_winsys_screen *rws;
+ struct radeon_winsys *rws;
/* The command stream. */
- struct r300_winsys_cs *cs;
+ struct radeon_winsys_cs *cs;
/* Screen. */
struct r300_screen *screen;
diff --git a/src/gallium/drivers/r300/r300_cs.h b/src/gallium/drivers/r300/r300_cs.h
index 2e52dfa43c6..c208e672f42 100644
--- a/src/gallium/drivers/r300/r300_cs.h
+++ b/src/gallium/drivers/r300/r300_cs.h
@@ -29,7 +29,6 @@
#include "r300_reg.h"
#include "r300_context.h"
-#include "r300_winsys.h"
/* Yes, I know macros are ugly. However, they are much prettier than the code
* that they neatly hide away, and don't have the cost of function setup,so
@@ -40,14 +39,14 @@
*/
#define CS_LOCALS(context) \
- struct r300_winsys_cs *cs_copy = (context)->cs; \
- struct r300_winsys_screen *cs_winsys = (context)->rws; \
+ struct radeon_winsys_cs *cs_copy = (context)->cs; \
+ struct radeon_winsys *cs_winsys = (context)->rws; \
int cs_count = 0; (void) cs_count; (void) cs_winsys;
#ifdef DEBUG
#define BEGIN_CS(size) do { \
- assert(size <= (R300_MAX_CMDBUF_DWORDS - cs_copy->cdw)); \
+ assert(size <= (RADEON_MAX_CMDBUF_DWORDS - cs_copy->cdw)); \
cs_count = size; \
} while (0)
diff --git a/src/gallium/drivers/r300/r300_defines.h b/src/gallium/drivers/r300/r300_defines.h
index 2d111f9158d..30e9befad21 100644
--- a/src/gallium/drivers/r300/r300_defines.h
+++ b/src/gallium/drivers/r300/r300_defines.h
@@ -32,19 +32,4 @@
#define R300_INVALID_FORMAT 0xffff
-/* Tiling flags. */
-enum r300_buffer_tiling {
- R300_BUFFER_LINEAR = 0,
- R300_BUFFER_TILED,
- R300_BUFFER_SQUARETILED,
-
- R300_BUFFER_UNKNOWN,
- R300_BUFFER_SELECT_LAYOUT = R300_BUFFER_UNKNOWN
-};
-
-enum r300_buffer_domain { /* bitfield */
- R300_DOMAIN_GTT = 2,
- R300_DOMAIN_VRAM = 4
-};
-
#endif
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index a21668a6fc5..62435c5e2e2 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -375,7 +375,7 @@ 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_surface* surf;
unsigned i;
- boolean can_hyperz = r300->rws->get_value(r300->rws, R300_CAN_HYPERZ);
+ boolean can_hyperz = r300->rws->get_value(r300->rws, RADEON_VID_CAN_HYPERZ);
uint32_t rb3d_cctl = 0;
CS_LOCALS(r300);
@@ -1231,7 +1231,7 @@ validate:
if (flushed)
return FALSE;
- r300_flush(&r300->context, R300_FLUSH_ASYNC, NULL);
+ r300_flush(&r300->context, RADEON_FLUSH_ASYNC, NULL);
flushed = TRUE;
goto validate;
}
diff --git a/src/gallium/drivers/r300/r300_flush.c b/src/gallium/drivers/r300/r300_flush.c
index b3d0d344ec4..de7d77d608b 100644
--- a/src/gallium/drivers/r300/r300_flush.c
+++ b/src/gallium/drivers/r300/r300_flush.c
@@ -38,7 +38,7 @@ void r300_flush(struct pipe_context *pipe,
{
struct r300_context *r300 = r300_context(pipe);
struct r300_atom *atom;
- struct r300_winsys_bo **rfence = (struct r300_winsys_bo**)fence;
+ struct pb_buffer **rfence = (struct pb_buffer**)fence;
if (r300->draw && !r300->draw_vbo_locked)
r300_draw_flush_vbuf(r300);
@@ -48,11 +48,11 @@ void r300_flush(struct pipe_context *pipe,
*rfence = r300->rws->buffer_create(r300->rws, 1, 1,
PIPE_BIND_VERTEX_BUFFER,
PIPE_USAGE_STATIC,
- R300_DOMAIN_GTT);
+ RADEON_DOMAIN_GTT);
/* Add the fence as a dummy relocation. */
r300->rws->cs_add_reloc(r300->cs,
r300->rws->buffer_get_cs_handle(*rfence),
- R300_DOMAIN_GTT, R300_DOMAIN_GTT);
+ RADEON_DOMAIN_GTT, RADEON_DOMAIN_GTT);
}
if (r300->dirty_hw) {
diff --git a/src/gallium/drivers/r300/r300_hyperz.c b/src/gallium/drivers/r300/r300_hyperz.c
index ecaadf4af8e..ef330f34c9e 100644
--- a/src/gallium/drivers/r300/r300_hyperz.c
+++ b/src/gallium/drivers/r300/r300_hyperz.c
@@ -24,7 +24,6 @@
#include "r300_context.h"
#include "r300_reg.h"
#include "r300_fs.h"
-#include "r300_winsys.h"
#include "util/u_format.h"
#include "util/u_mm.h"
@@ -153,7 +152,7 @@ static void r300_update_hyperz(struct r300_context* r300)
}
if (!zstex ||
- !r300->rws->get_value(r300->rws, R300_CAN_HYPERZ))
+ !r300->rws->get_value(r300->rws, RADEON_VID_CAN_HYPERZ))
return;
/* Zbuffer compression. */
diff --git a/src/gallium/drivers/r300/r300_public.h b/src/gallium/drivers/r300/r300_public.h
index 8e7a963c55d..b6059203ff1 100644
--- a/src/gallium/drivers/r300/r300_public.h
+++ b/src/gallium/drivers/r300/r300_public.h
@@ -2,8 +2,8 @@
#ifndef R300_PUBLIC_H
#define R300_PUBLIC_H
-struct r300_winsys_screen;
+struct radeon_winsys;
-struct pipe_screen* r300_screen_create(struct r300_winsys_screen *rws);
+struct pipe_screen* r300_screen_create(struct radeon_winsys *rws);
#endif
diff --git a/src/gallium/drivers/r300/r300_query.c b/src/gallium/drivers/r300/r300_query.c
index 717485f43cb..9752a519491 100644
--- a/src/gallium/drivers/r300/r300_query.c
+++ b/src/gallium/drivers/r300/r300_query.c
@@ -26,7 +26,6 @@
#include "r300_context.h"
#include "r300_screen.h"
#include "r300_emit.h"
-#include "r300_winsys.h"
#include <stdio.h>
@@ -46,7 +45,7 @@ static struct pipe_query *r300_create_query(struct pipe_context *pipe,
return NULL;
q->type = query_type;
- q->domain = R300_DOMAIN_GTT;
+ q->domain = RADEON_DOMAIN_GTT;
q->buffer_size = 4096;
if (r300screen->caps.family == CHIP_FAMILY_RV530)
@@ -70,7 +69,7 @@ static void r300_destroy_query(struct pipe_context* pipe,
{
struct r300_query* q = r300_query(query);
- r300_winsys_bo_reference(&q->buf, NULL);
+ pb_reference(&q->buf, NULL);
remove_from_list(q);
FREE(query);
}
diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c
index 26594dabe42..429b85545f7 100644
--- a/src/gallium/drivers/r300/r300_render.c
+++ b/src/gallium/drivers/r300/r300_render.c
@@ -218,8 +218,8 @@ static boolean r300_reserve_cs_dwords(struct r300_context *r300,
cs_dwords += r300_get_num_cs_end_dwords(r300);
/* Reserve requested CS space. */
- if (cs_dwords > (R300_MAX_CMDBUF_DWORDS - r300->cs->cdw)) {
- r300_flush(&r300->context, R300_FLUSH_ASYNC, NULL);
+ if (cs_dwords > (RADEON_MAX_CMDBUF_DWORDS - r300->cs->cdw)) {
+ r300_flush(&r300->context, RADEON_FLUSH_ASYNC, NULL);
flushed = TRUE;
}
@@ -343,7 +343,7 @@ static boolean immd_is_good_idea(struct r300_context *r300,
if (!checked[vbi]) {
buf = r300->vbuf_mgr->real_vertex_buffer[vbi];
- if ((r300_resource(buf)->domain != R300_DOMAIN_GTT)) {
+ if ((r300_resource(buf)->domain != RADEON_DOMAIN_GTT)) {
return FALSE;
}
@@ -1080,7 +1080,7 @@ static void r300_render_draw_elements(struct vbuf_render* render,
end_cs_dwords = r300_get_num_cs_end_dwords(r300);
while (count) {
- free_dwords = R300_MAX_CMDBUF_DWORDS - r300->cs->cdw;
+ free_dwords = RADEON_MAX_CMDBUF_DWORDS - r300->cs->cdw;
short_count = MIN2(count, (free_dwords - end_cs_dwords - 6) * 2);
diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
index 642523d4d9b..a5d737c4b3c 100644
--- a/src/gallium/drivers/r300/r300_screen.c
+++ b/src/gallium/drivers/r300/r300_screen.c
@@ -30,7 +30,6 @@
#include "r300_texture.h"
#include "r300_screen_buffer.h"
#include "r300_state_inlines.h"
-#include "r300_winsys.h"
#include "r300_public.h"
#include "draw/draw_context.h"
@@ -311,9 +310,9 @@ static boolean r300_is_format_supported(struct pipe_screen* screen,
unsigned sample_count,
unsigned usage)
{
- struct r300_winsys_screen *rws = r300_screen(screen)->rws;
+ struct radeon_winsys *rws = r300_screen(screen)->rws;
uint32_t retval = 0;
- boolean drm_2_8_0 = rws->get_value(rws, R300_VID_DRM_2_8_0);
+ boolean drm_2_8_0 = rws->get_value(rws, RADEON_VID_DRM_2_8_0);
boolean is_r500 = r300_screen(screen)->caps.is_r500;
boolean is_r400 = r300_screen(screen)->caps.is_r400;
boolean is_color2101010 = format == PIPE_FORMAT_R10G10B10A2_UNORM ||
@@ -412,7 +411,7 @@ static boolean r300_is_format_supported(struct pipe_screen* screen,
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);
+ struct radeon_winsys *rws = radeon_winsys(pscreen);
util_slab_destroy(&r300screen->pool_buffers);
pipe_mutex_destroy(r300screen->num_contexts_mutex);
@@ -427,15 +426,15 @@ static void r300_fence_reference(struct pipe_screen *screen,
struct pipe_fence_handle **ptr,
struct pipe_fence_handle *fence)
{
- r300_winsys_bo_reference((struct r300_winsys_bo**)ptr,
- (struct r300_winsys_bo*)fence);
+ pb_reference((struct pb_buffer**)ptr,
+ (struct pb_buffer*)fence);
}
static boolean r300_fence_signalled(struct pipe_screen *screen,
struct pipe_fence_handle *fence)
{
- struct r300_winsys_screen *rws = r300_screen(screen)->rws;
- struct r300_winsys_bo *rfence = (struct r300_winsys_bo*)fence;
+ struct radeon_winsys *rws = r300_screen(screen)->rws;
+ struct pb_buffer *rfence = (struct pb_buffer*)fence;
return !rws->buffer_is_busy(rfence);
}
@@ -444,8 +443,8 @@ static boolean r300_fence_finish(struct pipe_screen *screen,
struct pipe_fence_handle *fence,
uint64_t timeout)
{
- struct r300_winsys_screen *rws = r300_screen(screen)->rws;
- struct r300_winsys_bo *rfence = (struct r300_winsys_bo*)fence;
+ struct radeon_winsys *rws = r300_screen(screen)->rws;
+ struct pb_buffer *rfence = (struct pb_buffer*)fence;
if (timeout != PIPE_TIMEOUT_INFINITE) {
int64_t start_time = os_time_get();
@@ -467,7 +466,7 @@ static boolean r300_fence_finish(struct pipe_screen *screen,
return TRUE;
}
-struct pipe_screen* r300_screen_create(struct r300_winsys_screen *rws)
+struct pipe_screen* r300_screen_create(struct radeon_winsys *rws)
{
struct r300_screen *r300screen = CALLOC_STRUCT(r300_screen);
@@ -476,9 +475,9 @@ struct pipe_screen* r300_screen_create(struct r300_winsys_screen *rws)
return NULL;
}
- 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);
+ r300screen->caps.pci_id = rws->get_value(rws, RADEON_VID_PCI_ID);
+ r300screen->caps.num_frag_pipes = rws->get_value(rws, RADEON_VID_R300_GB_PIPES);
+ r300screen->caps.num_z_pipes = rws->get_value(rws, RADEON_VID_R300_Z_PIPES);
r300_init_debug(r300screen);
r300_parse_chipset(&r300screen->caps);
@@ -488,7 +487,7 @@ struct pipe_screen* r300_screen_create(struct r300_winsys_screen *rws)
if (SCREEN_DBG_ON(r300screen, DBG_NO_HIZ))
r300screen->caps.hiz_ram = 0;
- if (!rws->get_value(rws, R300_VID_DRM_2_8_0))
+ if (!rws->get_value(rws, RADEON_VID_DRM_2_8_0))
r300screen->caps.has_us_format = FALSE;
pipe_mutex_init(r300screen->num_contexts_mutex);
diff --git a/src/gallium/drivers/r300/r300_screen.h b/src/gallium/drivers/r300/r300_screen.h
index 576f9c1f4a9..bca86edb1d7 100644
--- a/src/gallium/drivers/r300/r300_screen.h
+++ b/src/gallium/drivers/r300/r300_screen.h
@@ -32,13 +32,13 @@
#include <stdio.h>
-struct r300_winsys_screen;
+struct radeon_winsys;
struct r300_screen {
/* Parent class */
struct pipe_screen screen;
- struct r300_winsys_screen *rws;
+ struct radeon_winsys *rws;
/* Chipset capabilities */
struct r300_capabilities caps;
@@ -61,8 +61,8 @@ static INLINE struct r300_screen* r300_screen(struct pipe_screen* screen) {
return (struct r300_screen*)screen;
}
-static INLINE struct r300_winsys_screen *
-r300_winsys_screen(struct pipe_screen *screen) {
+static INLINE struct radeon_winsys *
+radeon_winsys(struct pipe_screen *screen) {
return r300_screen(screen)->rws;
}
diff --git a/src/gallium/drivers/r300/r300_screen_buffer.c b/src/gallium/drivers/r300/r300_screen_buffer.c
index 986ae384fbf..4154c81512e 100644
--- a/src/gallium/drivers/r300/r300_screen_buffer.c
+++ b/src/gallium/drivers/r300/r300_screen_buffer.c
@@ -31,7 +31,6 @@
#include "util/u_math.h"
#include "r300_screen_buffer.h"
-#include "r300_winsys.h"
void r300_upload_index_buffer(struct r300_context *r300,
struct pipe_resource **index_buffer,
@@ -62,7 +61,7 @@ static void r300_buffer_destroy(struct pipe_screen *screen,
FREE(rbuf->constant_buffer);
if (rbuf->buf)
- r300_winsys_bo_reference(&rbuf->buf, NULL);
+ pb_reference(&rbuf->buf, NULL);
util_slab_free(&r300screen->pool_buffers, rbuf);
}
@@ -105,7 +104,7 @@ r300_buffer_transfer_map( struct pipe_context *pipe,
{
struct r300_context *r300 = r300_context(pipe);
struct r300_screen *r300screen = r300_screen(pipe->screen);
- struct r300_winsys_screen *rws = r300screen->rws;
+ struct radeon_winsys *rws = r300screen->rws;
struct r300_resource *rbuf = r300_resource(transfer->resource);
uint8_t *map;
@@ -126,7 +125,7 @@ static void r300_buffer_transfer_unmap( struct pipe_context *pipe,
struct pipe_transfer *transfer )
{
struct r300_screen *r300screen = r300_screen(pipe->screen);
- struct r300_winsys_screen *rws = r300screen->rws;
+ struct radeon_winsys *rws = r300screen->rws;
struct r300_resource *rbuf = r300_resource(transfer->resource);
if (rbuf->buf) {
@@ -144,7 +143,7 @@ static void r300_buffer_transfer_inline_write(struct pipe_context *pipe,
unsigned layer_stride)
{
struct r300_context *r300 = r300_context(pipe);
- struct r300_winsys_screen *rws = r300->screen->rws;
+ struct radeon_winsys *rws = r300->screen->rws;
struct r300_resource *rbuf = r300_resource(resource);
uint8_t *map = NULL;
@@ -188,7 +187,7 @@ struct pipe_resource *r300_buffer_create(struct pipe_screen *screen,
pipe_reference_init(&rbuf->b.b.b.reference, 1);
rbuf->b.b.b.screen = screen;
rbuf->b.user_ptr = NULL;
- rbuf->domain = R300_DOMAIN_GTT;
+ rbuf->domain = RADEON_DOMAIN_GTT;
rbuf->buf = NULL;
rbuf->buf_size = templ->width0;
rbuf->constant_buffer = NULL;
@@ -237,7 +236,7 @@ struct pipe_resource *r300_user_buffer_create(struct pipe_screen *screen,
rbuf->b.b.b.flags = 0;
rbuf->b.b.vtbl = &r300_buffer_vtbl;
rbuf->b.user_ptr = ptr;
- rbuf->domain = R300_DOMAIN_GTT;
+ rbuf->domain = RADEON_DOMAIN_GTT;
rbuf->buf = NULL;
rbuf->buf_size = size;
rbuf->constant_buffer = NULL;
diff --git a/src/gallium/drivers/r300/r300_screen_buffer.h b/src/gallium/drivers/r300/r300_screen_buffer.h
index cdbc4425fcb..360ec509cc5 100644
--- a/src/gallium/drivers/r300/r300_screen_buffer.h
+++ b/src/gallium/drivers/r300/r300_screen_buffer.h
@@ -32,7 +32,6 @@
#include "util/u_transfer.h"
#include "r300_screen.h"
-#include "r300_winsys.h"
#include "r300_context.h"
/* Functions. */
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index c92f871829a..24b41d5085d 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -45,7 +45,6 @@
#include "r300_fs.h"
#include "r300_texture.h"
#include "r300_vs.h"
-#include "r300_winsys.h"
/* r300_state: Functions used to intialize state context by translating
* Gallium state objects into semi-native r300 state objects. */
@@ -769,7 +768,7 @@ void r300_mark_fb_state_dirty(struct r300_context *r300,
enum r300_fb_state_change change)
{
struct pipe_framebuffer_state *state = r300->fb_state.state;
- boolean can_hyperz = r300->rws->get_value(r300->rws, R300_CAN_HYPERZ);
+ boolean can_hyperz = r300->rws->get_value(r300->rws, RADEON_VID_CAN_HYPERZ);
r300_mark_atom_dirty(r300, &r300->gpu_flush);
r300_mark_atom_dirty(r300, &r300->fb_state);
diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c
index 87e32a21fc1..38ca9a24e45 100644
--- a/src/gallium/drivers/r300/r300_texture.c
+++ b/src/gallium/drivers/r300/r300_texture.c
@@ -29,7 +29,6 @@
#include "r300_texture_desc.h"
#include "r300_transfer.h"
#include "r300_screen.h"
-#include "r300_winsys.h"
#include "util/u_format.h"
#include "util/u_format_s3tc.h"
@@ -874,7 +873,7 @@ static void r300_texture_destroy(struct pipe_screen *screen,
{
struct r300_resource* tex = (struct r300_resource*)texture;
- r300_winsys_bo_reference(&tex->buf, NULL);
+ pb_reference(&tex->buf, NULL);
FREE(tex);
}
@@ -882,7 +881,7 @@ boolean r300_resource_get_handle(struct pipe_screen* screen,
struct pipe_resource *texture,
struct winsys_handle *whandle)
{
- struct r300_winsys_screen *rws = (struct r300_winsys_screen *)screen->winsys;
+ struct radeon_winsys *rws = (struct radeon_winsys *)screen->winsys;
struct r300_resource* tex = (struct r300_resource*)texture;
if (!tex) {
@@ -909,17 +908,17 @@ static const struct u_resource_vtbl r300_texture_vtbl =
static struct r300_resource*
r300_texture_create_object(struct r300_screen *rscreen,
const struct pipe_resource *base,
- enum r300_buffer_tiling microtile,
- enum r300_buffer_tiling macrotile,
+ enum radeon_bo_layout microtile,
+ enum radeon_bo_layout macrotile,
unsigned stride_in_bytes_override,
unsigned max_buffer_size,
- struct r300_winsys_bo *buffer)
+ struct pb_buffer *buffer)
{
- struct r300_winsys_screen *rws = rscreen->rws;
+ struct radeon_winsys *rws = rscreen->rws;
struct r300_resource *tex = CALLOC_STRUCT(r300_resource);
if (!tex) {
if (buffer)
- r300_winsys_bo_reference(&buffer, NULL);
+ pb_reference(&buffer, NULL);
return NULL;
}
@@ -933,13 +932,13 @@ r300_texture_create_object(struct r300_screen *rscreen,
tex->tex.macrotile[0] = macrotile;
tex->tex.stride_in_bytes_override = stride_in_bytes_override;
tex->domain = base->flags & R300_RESOURCE_FLAG_TRANSFER ?
- R300_DOMAIN_GTT :
- R300_DOMAIN_VRAM | R300_DOMAIN_GTT;
+ RADEON_DOMAIN_GTT :
+ RADEON_DOMAIN_VRAM | RADEON_DOMAIN_GTT;
tex->buf_size = max_buffer_size;
if (!r300_resource_set_properties(&rscreen->screen, &tex->b.b.b, 0, base)) {
if (buffer)
- r300_winsys_bo_reference(&buffer, NULL);
+ pb_reference(&buffer, NULL);
FREE(tex);
return NULL;
}
@@ -972,15 +971,16 @@ struct pipe_resource *r300_texture_create(struct pipe_screen *screen,
const struct pipe_resource *base)
{
struct r300_screen *rscreen = r300_screen(screen);
- enum r300_buffer_tiling microtile, macrotile;
+ enum radeon_bo_layout microtile, macrotile;
if ((base->flags & R300_RESOURCE_FLAG_TRANSFER) ||
(base->bind & PIPE_BIND_SCANOUT)) {
- microtile = R300_BUFFER_LINEAR;
- macrotile = R300_BUFFER_LINEAR;
+ microtile = RADEON_LAYOUT_LINEAR;
+ macrotile = RADEON_LAYOUT_LINEAR;
} else {
- microtile = R300_BUFFER_SELECT_LAYOUT;
- macrotile = R300_BUFFER_SELECT_LAYOUT;
+ /* This will make the texture_create_function select the layout. */
+ microtile = RADEON_LAYOUT_UNKNOWN;
+ macrotile = RADEON_LAYOUT_UNKNOWN;
}
return (struct pipe_resource*)
@@ -992,10 +992,10 @@ struct pipe_resource *r300_texture_from_handle(struct pipe_screen *screen,
const struct pipe_resource *base,
struct winsys_handle *whandle)
{
- struct r300_winsys_screen *rws = (struct r300_winsys_screen*)screen->winsys;
+ struct radeon_winsys *rws = (struct radeon_winsys*)screen->winsys;
struct r300_screen *rscreen = r300_screen(screen);
- struct r300_winsys_bo *buffer;
- enum r300_buffer_tiling microtile, macrotile;
+ struct pb_buffer *buffer;
+ enum radeon_bo_layout microtile, macrotile;
unsigned stride, size;
/* Support only 2D textures without mipmaps */
@@ -1014,14 +1014,14 @@ struct pipe_resource *r300_texture_from_handle(struct pipe_screen *screen,
/* Enforce a microtiled zbuffer. */
if (util_format_is_depth_or_stencil(base->format) &&
- microtile == R300_BUFFER_LINEAR) {
+ microtile == RADEON_LAYOUT_LINEAR) {
switch (util_format_get_blocksize(base->format)) {
case 4:
- microtile = R300_BUFFER_TILED;
+ microtile = RADEON_LAYOUT_TILED;
break;
case 2:
- microtile = R300_BUFFER_SQUARETILED;
+ microtile = RADEON_LAYOUT_SQUARETILED;
break;
}
}
@@ -1062,8 +1062,8 @@ struct pipe_surface* r300_create_surface(struct pipe_context * ctx,
/* Prefer VRAM if there are multiple domains to choose from. */
surface->domain = tex->domain;
- if (surface->domain & R300_DOMAIN_VRAM)
- surface->domain &= ~R300_DOMAIN_GTT;
+ if (surface->domain & RADEON_DOMAIN_VRAM)
+ surface->domain &= ~RADEON_DOMAIN_GTT;
surface->offset = r300_texture_get_offset(tex, level,
surf_tmpl->u.tex.first_layer);
diff --git a/src/gallium/drivers/r300/r300_texture_desc.c b/src/gallium/drivers/r300/r300_texture_desc.c
index 2910666dd51..da5778be65e 100644
--- a/src/gallium/drivers/r300/r300_texture_desc.c
+++ b/src/gallium/drivers/r300/r300_texture_desc.c
@@ -22,9 +22,7 @@
* USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "r300_texture_desc.h"
-
#include "r300_context.h"
-#include "r300_winsys.h"
#include "util/u_format.h"
@@ -32,8 +30,8 @@
* in the given dimension. */
unsigned r300_get_pixel_alignment(enum pipe_format format,
unsigned num_samples,
- enum r300_buffer_tiling microtile,
- enum r300_buffer_tiling macrotile,
+ enum radeon_bo_layout microtile,
+ enum radeon_bo_layout macrotile,
enum r300_dim dim, boolean is_rs690)
{
static const unsigned table[2][5][3][2] =
@@ -62,8 +60,8 @@ unsigned r300_get_pixel_alignment(enum pipe_format format,
unsigned tile = 0;
unsigned pixsize = util_format_get_blocksize(format);
- assert(macrotile <= R300_BUFFER_TILED);
- assert(microtile <= R300_BUFFER_SQUARETILED);
+ assert(macrotile <= RADEON_LAYOUT_TILED);
+ assert(microtile <= RADEON_LAYOUT_SQUARETILED);
assert(pixsize <= 16);
assert(dim <= DIM_HEIGHT);
@@ -98,7 +96,7 @@ static boolean r300_texture_macro_switch(struct r300_resource *tex,
unsigned tile, texdim;
tile = r300_get_pixel_alignment(tex->b.b.b.format, tex->b.b.b.nr_samples,
- tex->tex.microtile, R300_BUFFER_TILED, dim, 0);
+ tex->tex.microtile, RADEON_LAYOUT_TILED, dim, 0);
if (dim == DIM_WIDTH) {
texdim = u_minify(tex->tex.width0, level);
} else {
@@ -233,10 +231,10 @@ static void r300_setup_miptree(struct r300_screen *screen,
for (i = 0; i <= base->last_level; i++) {
/* Let's see if this miplevel can be macrotiled. */
tex->tex.macrotile[i] =
- (tex->tex.macrotile[0] == R300_BUFFER_TILED &&
+ (tex->tex.macrotile[0] == RADEON_LAYOUT_TILED &&
r300_texture_macro_switch(tex, i, rv350_mode, DIM_WIDTH) &&
r300_texture_macro_switch(tex, i, rv350_mode, DIM_HEIGHT)) ?
- R300_BUFFER_TILED : R300_BUFFER_LINEAR;
+ RADEON_LAYOUT_TILED : RADEON_LAYOUT_LINEAR;
stride = r300_texture_get_stride(screen, tex, i);
@@ -424,8 +422,8 @@ static void r300_setup_tiling(struct r300_screen *screen,
boolean is_zb = util_format_is_depth_or_stencil(format);
boolean dbg_no_tiling = SCREEN_DBG_ON(screen, DBG_NO_TILING);
- tex->tex.microtile = R300_BUFFER_LINEAR;
- tex->tex.macrotile[0] = R300_BUFFER_LINEAR;
+ tex->tex.microtile = RADEON_LAYOUT_LINEAR;
+ tex->tex.macrotile[0] = RADEON_LAYOUT_LINEAR;
if (!util_format_is_plain(format)) {
return;
@@ -441,11 +439,11 @@ static void r300_setup_tiling(struct r300_screen *screen,
case 1:
case 4:
case 8:
- tex->tex.microtile = R300_BUFFER_TILED;
+ tex->tex.microtile = RADEON_LAYOUT_TILED;
break;
case 2:
- tex->tex.microtile = R300_BUFFER_SQUARETILED;
+ tex->tex.microtile = RADEON_LAYOUT_SQUARETILED;
break;
}
@@ -456,7 +454,7 @@ static void r300_setup_tiling(struct r300_screen *screen,
/* Set macrotiling. */
if (r300_texture_macro_switch(tex, 0, rv350_mode, DIM_WIDTH) &&
r300_texture_macro_switch(tex, 0, rv350_mode, DIM_HEIGHT)) {
- tex->tex.macrotile[0] = R300_BUFFER_TILED;
+ tex->tex.macrotile[0] = RADEON_LAYOUT_TILED;
}
}
@@ -501,7 +499,7 @@ boolean r300_texture_desc_init(struct r300_screen *rscreen,
}
/* Setup tiling. */
- if (tex->tex.microtile == R300_BUFFER_SELECT_LAYOUT) {
+ if (tex->tex.microtile == RADEON_LAYOUT_UNKNOWN) {
r300_setup_tiling(rscreen, tex);
}
diff --git a/src/gallium/drivers/r300/r300_texture_desc.h b/src/gallium/drivers/r300/r300_texture_desc.h
index ce6e9643ec6..a84d6fae0ea 100644
--- a/src/gallium/drivers/r300/r300_texture_desc.h
+++ b/src/gallium/drivers/r300/r300_texture_desc.h
@@ -25,7 +25,7 @@
#define R300_TEXTURE_DESC_H
#include "pipe/p_format.h"
-#include "r300_defines.h"
+#include "r300_context.h"
struct pipe_resource;
struct r300_screen;
@@ -39,8 +39,8 @@ enum r300_dim {
unsigned r300_get_pixel_alignment(enum pipe_format format,
unsigned num_samples,
- enum r300_buffer_tiling microtile,
- enum r300_buffer_tiling macrotile,
+ enum radeon_bo_layout microtile,
+ enum radeon_bo_layout macrotile,
enum r300_dim dim, boolean is_rs690);
boolean r300_texture_desc_init(struct r300_screen *rscreen,
diff --git a/src/gallium/drivers/r300/r300_transfer.c b/src/gallium/drivers/r300/r300_transfer.c
index 65c5095be6a..e2ea4cbf6c5 100644
--- a/src/gallium/drivers/r300/r300_transfer.c
+++ b/src/gallium/drivers/r300/r300_transfer.c
@@ -226,7 +226,7 @@ void* r300_texture_transfer_map(struct pipe_context *ctx,
struct pipe_transfer *transfer)
{
struct r300_context *r300 = r300_context(ctx);
- struct r300_winsys_screen *rws = (struct r300_winsys_screen *)ctx->winsys;
+ struct radeon_winsys *rws = (struct radeon_winsys *)ctx->winsys;
struct r300_transfer *r300transfer = r300_transfer(transfer);
struct r300_resource *tex = r300_resource(transfer->resource);
char *map;
@@ -256,7 +256,7 @@ void* r300_texture_transfer_map(struct pipe_context *ctx,
void r300_texture_transfer_unmap(struct pipe_context *ctx,
struct pipe_transfer *transfer)
{
- struct r300_winsys_screen *rws = (struct r300_winsys_screen *)ctx->winsys;
+ struct radeon_winsys *rws = (struct radeon_winsys *)ctx->winsys;
struct r300_transfer *r300transfer = r300_transfer(transfer);
struct r300_resource *tex = r300_resource(transfer->resource);
diff --git a/src/gallium/drivers/r300/r300_winsys.h b/src/gallium/drivers/r300/r300_winsys.h
deleted file mode 100644
index 3a6798a5423..00000000000
--- a/src/gallium/drivers/r300/r300_winsys.h
+++ /dev/null
@@ -1,295 +0,0 @@
-/*
- * Copyright 2008 Corbin Simpson <[email protected]>
- * Copyright 2010 Marek Olšák <[email protected]>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE. */
-
-#ifndef R300_WINSYS_H
-#define R300_WINSYS_H
-
-/* The public winsys interface header for the r300 pipe driver.
- * Any winsys hosting this pipe needs to implement r300_winsys_screen and then
- * call r300_screen_create to start things. */
-
-#include "r300_defines.h"
-
-#include "pipebuffer/pb_bufmgr.h"
-#include "pipe/p_defines.h"
-#include "pipe/p_state.h"
-
-#define R300_MAX_CMDBUF_DWORDS (16 * 1024)
-#define R300_FLUSH_ASYNC (1 << 0)
-
-struct winsys_handle;
-struct r300_winsys_screen;
-
-#define r300_winsys_bo pb_buffer
-#define r300_winsys_bo_reference(pdst, src) pb_reference(pdst, src)
-
-struct r300_winsys_cs_handle; /* for write_reloc etc. */
-
-struct r300_winsys_cs {
- unsigned cdw; /* Number of used dwords. */
- uint32_t *buf; /* The command buffer. */
-};
-
-enum r300_value_id {
- R300_VID_PCI_ID,
- R300_VID_GB_PIPES,
- R300_VID_Z_PIPES,
- R300_VID_GART_SIZE,
- R300_VID_VRAM_SIZE,
- R300_VID_DRM_MAJOR,
- R300_VID_DRM_MINOR,
- R300_VID_DRM_PATCHLEVEL,
-
- /* These should probably go away: */
- R300_VID_DRM_2_6_0, /* Hyper-Z, GB_Z_PEQ_CONFIG on rv350->r4xx, R500 FG_ALPHA_VALUE */
- R300_VID_DRM_2_8_0, /* R500 US_FORMAT regs, R500 ARGB2101010 colorbuffer, CMask, R16F/RG16F */
-
- R300_CAN_HYPERZ, /* ZMask + HiZ */
- R300_CAN_AACOMPRESS, /* CMask */
-};
-
-struct r300_winsys_screen {
- /**
- * Destroy this winsys.
- *
- * \param ws The winsys this function is called from.
- */
- void (*destroy)(struct r300_winsys_screen *ws);
-
- /**
- * Query a system value from a winsys.
- *
- * \param ws The winsys this function is called from.
- * \param vid One of the R300_VID_* enums.
- */
- uint32_t (*get_value)(struct r300_winsys_screen *ws,
- enum r300_value_id vid);
-
- /**************************************************************************
- * 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...).
- *************************************************************************/
-
- /**
- * Create a buffer object.
- *
- * \param ws The winsys this function is called from.
- * \param size The size to allocate.
- * \param alignment An alignment of the buffer in memory.
- * \param bind A bitmask of the PIPE_BIND_* flags.
- * \param usage A bitmask of the PIPE_USAGE_* flags.
- * \param domain A bitmask of the R300_DOMAIN_* flags.
- * \return The created buffer object.
- */
- struct r300_winsys_bo *(*buffer_create)(struct r300_winsys_screen *ws,
- unsigned size,
- unsigned alignment,
- unsigned bind,
- unsigned usage,
- enum r300_buffer_domain domain);
-
- struct r300_winsys_cs_handle *(*buffer_get_cs_handle)(
- struct r300_winsys_bo *buf);
-
- /**
- * Map the entire data store of a buffer object into the client's address
- * space.
- *
- * \param buf A winsys buffer object to map.
- * \param cs A command stream to flush if the buffer is referenced by it.
- * \param usage A bitmask of the PIPE_TRANSFER_* flags.
- * \return The pointer at the beginning of the buffer.
- */
- void *(*buffer_map)(struct r300_winsys_bo *buf,
- struct r300_winsys_cs *cs,
- enum pipe_transfer_usage usage);
-
- /**
- * Unmap a buffer object from the client's address space.
- *
- * \param buf A winsys buffer object to unmap.
- */
- void (*buffer_unmap)(struct r300_winsys_bo *buf);
-
- /**
- * Return TRUE if a buffer object is being used by the GPU.
- *
- * \param buf A winsys buffer object.
- */
- boolean (*buffer_is_busy)(struct r300_winsys_bo *buf);
-
- /**
- * Wait for a buffer object until it is not used by a GPU. This is
- * equivalent to a fence placed after the last command using the buffer,
- * and synchronizing to the fence.
- *
- * \param buf A winsys buffer object to wait for.
- */
- void (*buffer_wait)(struct r300_winsys_bo *buf);
-
- /**
- * Return tiling flags describing a memory layout of a buffer object.
- *
- * \param buf A winsys buffer object to get the flags from.
- * \param macrotile A pointer to the return value of the microtile flag.
- * \param microtile A pointer to the return value of the macrotile flag.
- *
- * \note microtile and macrotile are not bitmasks!
- */
- void (*buffer_get_tiling)(struct r300_winsys_bo *buf,
- enum r300_buffer_tiling *microtile,
- enum r300_buffer_tiling *macrotile);
-
- /**
- * Set tiling flags describing a memory layout of a buffer object.
- *
- * \param buf A winsys buffer object to set the flags for.
- * \param cs A command stream to flush if the buffer is referenced by it.
- * \param macrotile A macrotile flag.
- * \param microtile A microtile flag.
- * \param stride A stride of the buffer in bytes, for texturing.
- *
- * \note microtile and macrotile are not bitmasks!
- */
- void (*buffer_set_tiling)(struct r300_winsys_bo *buf,
- struct r300_winsys_cs *cs,
- enum r300_buffer_tiling microtile,
- enum r300_buffer_tiling macrotile,
- unsigned stride);
-
- /**
- * Get a winsys buffer from a winsys handle. The internal structure
- * of the handle is platform-specific and only a winsys should access it.
- *
- * \param ws The winsys this function is called from.
- * \param whandle A winsys handle pointer as was received from a state
- * tracker.
- * \param stride The returned buffer stride in bytes.
- * \param size The returned buffer size.
- */
- struct r300_winsys_bo *(*buffer_from_handle)(struct r300_winsys_screen *ws,
- struct winsys_handle *whandle,
- unsigned *stride,
- unsigned *size);
-
- /**
- * Get a winsys handle from a winsys buffer. The internal structure
- * of the handle is platform-specific and only a winsys should access it.
- *
- * \param buf A winsys buffer object to get the handle from.
- * \param whandle A winsys handle pointer.
- * \param stride A stride of the buffer in bytes, for texturing.
- * \return TRUE on success.
- */
- boolean (*buffer_get_handle)(struct r300_winsys_bo *buf,
- unsigned stride,
- struct winsys_handle *whandle);
-
- /**************************************************************************
- * Command submission.
- *
- * Each pipe context should create its own command stream and submit
- * commands independently of other contexts.
- *************************************************************************/
-
- /**
- * Create a command stream.
- *
- * \param ws The winsys this function is called from.
- */
- struct r300_winsys_cs *(*cs_create)(struct r300_winsys_screen *ws);
-
- /**
- * Destroy a command stream.
- *
- * \param cs A command stream to destroy.
- */
- void (*cs_destroy)(struct r300_winsys_cs *cs);
-
- /**
- * Add a new buffer relocation. Every relocation must first be added
- * before it can be written.
- *
- * \param cs A command stream to add buffer for validation against.
- * \param buf A winsys buffer to validate.
- * \param rd A read domain containing a bitmask of the R300_DOMAIN_* flags.
- * \param wd A write domain containing a bitmask of the R300_DOMAIN_* flags.
- */
- void (*cs_add_reloc)(struct r300_winsys_cs *cs,
- struct r300_winsys_cs_handle *buf,
- enum r300_buffer_domain rd,
- enum r300_buffer_domain wd);
-
- /**
- * Return TRUE if there is enough memory in VRAM and GTT for the relocs
- * added so far.
- *
- * \param cs A command stream to validate.
- */
- boolean (*cs_validate)(struct r300_winsys_cs *cs);
-
- /**
- * Write a relocated dword to a command buffer.
- *
- * \param cs A command stream the relocation is written to.
- * \param buf A winsys buffer to write the relocation for.
- * \param rd A read domain containing a bitmask of the R300_DOMAIN_* flags.
- * \param wd A write domain containing a bitmask of the R300_DOMAIN_* flags.
- */
- void (*cs_write_reloc)(struct r300_winsys_cs *cs,
- struct r300_winsys_cs_handle *buf);
-
- /**
- * Flush a command stream.
- *
- * \param cs A command stream to flush.
- * \param flags, R300_FLUSH_ASYNC or 0.
- */
- void (*cs_flush)(struct r300_winsys_cs *cs, unsigned flags);
-
- /**
- * Set a flush callback which is called from winsys when flush is
- * required.
- *
- * \param cs A command stream to set the callback for.
- * \param flush A flush callback function associated with the command stream.
- * \param user A user pointer that will be passed to the flush callback.
- */
- void (*cs_set_flush)(struct r300_winsys_cs *cs,
- void (*flush)(void *ctx, unsigned flags),
- void *user);
-
- /**
- * Return TRUE if a buffer is referenced by a command stream.
- *
- * \param cs A command stream.
- * \param buf A winsys buffer.
- */
- boolean (*cs_is_buffer_referenced)(struct r300_winsys_cs *cs,
- struct r300_winsys_cs_handle *buf);
-};
-
-#endif /* R300_WINSYS_H */