summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r600
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2011-09-17 13:56:09 +0200
committerMarek Olšák <[email protected]>2011-09-30 23:19:52 +0200
commit518557d74abd4ce035dae079ff6eb1b08cc639d0 (patch)
treed080bff97deb7653a9f22dff8c8c9d711452ba23 /src/gallium/drivers/r600
parent6101b6d442b06a347c001fe85848d636ab7df260 (diff)
r600g: move family and chip_class from struct radeon to r600_screen
Reviewed-by: Alex Deucher <[email protected]>
Diffstat (limited to 'src/gallium/drivers/r600')
-rw-r--r--src/gallium/drivers/r600/r600.h3
-rw-r--r--src/gallium/drivers/r600/r600_pipe.c47
-rw-r--r--src/gallium/drivers/r600/r600_pipe.h2
-rw-r--r--src/gallium/drivers/r600/r600_texture.c5
4 files changed, 42 insertions, 15 deletions
diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h
index 7a16e758cda..d7b979b1b66 100644
--- a/src/gallium/drivers/r600/r600.h
+++ b/src/gallium/drivers/r600/r600.h
@@ -83,9 +83,6 @@ struct r600_tiling_info {
unsigned group_bytes;
};
-enum radeon_family r600_get_family(struct radeon *rw);
-enum chip_class r600_get_family_class(struct radeon *radeon);
-
struct r600_resource {
struct u_vbuf_resource b;
diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
index e27522da3f4..3838c0f9b9f 100644
--- a/src/gallium/drivers/r600/r600_pipe.c
+++ b/src/gallium/drivers/r600/r600_pipe.c
@@ -214,8 +214,8 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void
rctx->screen = rscreen;
rctx->ws = rscreen->ws;
rctx->radeon = rscreen->radeon;
- rctx->family = r600_get_family(rctx->radeon);
- rctx->chip_class = r600_get_family_class(rctx->radeon);
+ rctx->family = rscreen->family;
+ rctx->chip_class = rscreen->chip_class;
rctx->fences.bo = NULL;
rctx->fences.data = NULL;
@@ -327,15 +327,14 @@ static const char *r600_get_family_name(enum radeon_family family)
static const char* r600_get_name(struct pipe_screen* pscreen)
{
struct r600_screen *rscreen = (struct r600_screen *)pscreen;
- enum radeon_family family = r600_get_family(rscreen->radeon);
- return r600_get_family_name(family);
+ return r600_get_family_name(rscreen->family);
}
static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
{
struct r600_screen *rscreen = (struct r600_screen *)pscreen;
- enum radeon_family family = r600_get_family(rscreen->radeon);
+ enum radeon_family family = rscreen->family;
switch (param) {
/* Supported features (boolean caps). */
@@ -420,7 +419,7 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
static float r600_get_paramf(struct pipe_screen* pscreen, enum pipe_cap param)
{
struct r600_screen *rscreen = (struct r600_screen *)pscreen;
- enum radeon_family family = r600_get_family(rscreen->radeon);
+ enum radeon_family family = rscreen->family;
switch (param) {
case PIPE_CAP_MAX_LINE_WIDTH:
@@ -684,7 +683,7 @@ static int r600_init_tiling(struct r600_screen *rscreen)
uint32_t tiling_config = rscreen->info.r600_tiling_config;
/* set default group bytes, overridden by tiling info ioctl */
- if (r600_get_family_class(rscreen->radeon) <= R700) {
+ if (rscreen->chip_class <= R700) {
rscreen->tiling_info.group_bytes = 256;
} else {
rscreen->tiling_info.group_bytes = 512;
@@ -693,13 +692,24 @@ static int r600_init_tiling(struct r600_screen *rscreen)
if (!tiling_config)
return 0;
- if (r600_get_family_class(rscreen->radeon) <= R700) {
+ if (rscreen->chip_class <= R700) {
return r600_interpret_tiling(rscreen, tiling_config);
} else {
return evergreen_interpret_tiling(rscreen, tiling_config);
}
}
+static unsigned radeon_family_from_device(unsigned device)
+{
+ switch (device) {
+#define CHIPSET(pciid, name, family) case pciid: return CHIP_##family;
+#include "pci_ids/r600_pci_ids.h"
+#undef CHIPSET
+ default:
+ return CHIP_UNKNOWN;
+ }
+}
+
struct pipe_screen *r600_screen_create(struct radeon_winsys *ws)
{
struct r600_screen *rscreen;
@@ -718,6 +728,25 @@ struct pipe_screen *r600_screen_create(struct radeon_winsys *ws)
rscreen->radeon = radeon;
ws->query_info(ws, &rscreen->info);
+ rscreen->family = radeon_family_from_device(rscreen->info.pci_id);
+ if (rscreen->family == CHIP_UNKNOWN) {
+ fprintf(stderr, "r600: Unknown chipset 0x%04X\n", rscreen->info.pci_id);
+ radeon_destroy(radeon);
+ FREE(rscreen);
+ return NULL;
+ }
+
+ /* setup class */
+ if (rscreen->family == CHIP_CAYMAN) {
+ rscreen->chip_class = CAYMAN;
+ } else if (rscreen->family >= CHIP_CEDAR) {
+ rscreen->chip_class = EVERGREEN;
+ } else if (rscreen->family >= CHIP_RV770) {
+ rscreen->chip_class = R700;
+ } else {
+ rscreen->chip_class = R600;
+ }
+
if (r600_init_tiling(rscreen)) {
radeon_destroy(radeon);
FREE(rscreen);
@@ -732,7 +761,7 @@ struct pipe_screen *r600_screen_create(struct radeon_winsys *ws)
rscreen->screen.get_shader_param = r600_get_shader_param;
rscreen->screen.get_paramf = r600_get_paramf;
rscreen->screen.get_video_param = r600_get_video_param;
- if (r600_get_family_class(radeon) >= EVERGREEN) {
+ if (rscreen->chip_class >= EVERGREEN) {
rscreen->screen.is_format_supported = evergreen_is_format_supported;
} else {
rscreen->screen.is_format_supported = r600_is_format_supported;
diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h
index e94da48563d..c0cd3b32460 100644
--- a/src/gallium/drivers/r600/r600_pipe.h
+++ b/src/gallium/drivers/r600/r600_pipe.h
@@ -76,6 +76,8 @@ struct r600_screen {
struct pipe_screen screen;
struct radeon_winsys *ws;
struct radeon *radeon;
+ unsigned family;
+ enum chip_class chip_class;
struct radeon_info info;
struct r600_tiling_info tiling_info;
struct util_slab_mempool pool_buffers;
diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c
index 412efa5a243..99eb1aa4692 100644
--- a/src/gallium/drivers/r600/r600_texture.c
+++ b/src/gallium/drivers/r600/r600_texture.c
@@ -248,8 +248,7 @@ static void r600_setup_miptree(struct pipe_screen *screen,
unsigned array_mode)
{
struct pipe_resource *ptex = &rtex->resource.b.b.b;
- struct radeon *radeon = ((struct r600_screen*)screen)->radeon;
- enum chip_class chipc = r600_get_family_class(radeon);
+ enum chip_class chipc = ((struct r600_screen*)screen)->chip_class;
unsigned size, layer_size, i, offset;
unsigned nblocksx, nblocksy;
@@ -396,7 +395,7 @@ r600_texture_create_object(struct pipe_screen *screen,
/* We must split depth and stencil into two separate buffers on Evergreen. */
if (!(base->flags & R600_RESOURCE_FLAG_TRANSFER) &&
- r600_get_family_class(((struct r600_screen*)screen)->radeon) >= EVERGREEN &&
+ ((struct r600_screen*)screen)->chip_class >= EVERGREEN &&
util_format_is_depth_and_stencil(base->format)) {
struct pipe_resource stencil;
unsigned stencil_pitch_override = 0;