summaryrefslogtreecommitdiffstats
path: root/src/gallium/winsys/radeon
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2011-07-22 19:25:07 +0200
committerMarek Olšák <[email protected]>2011-08-16 09:15:10 +0200
commitce12f826927cf2d3ac3fd70d893abfb07adc23db (patch)
tree021390666894835790a38127546ed1a4becd137a /src/gallium/winsys/radeon
parent8c409403217cf8c13e1d2dd306ad5e86b566c5c9 (diff)
r600g: first step into winsys/radeon
Reviewed-by: Alex Deucher <[email protected]>
Diffstat (limited to 'src/gallium/winsys/radeon')
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_drm_winsys.c35
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_drm_winsys.h6
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_winsys.h3
3 files changed, 36 insertions, 8 deletions
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
index 5983e86c570..faeb66c8908 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
@@ -47,6 +47,9 @@
#ifndef RADEON_INFO_WANT_CMASK
#define RADEON_INFO_WANT_CMASK 8
#endif
+#ifndef RADEON_INFO_NUM_BACKENDS
+#define RADEON_INFO_NUM_BACKENDS 10
+#endif
/* Enable/disable feature access for one command stream.
* If enable == TRUE, return TRUE on success.
@@ -175,6 +178,13 @@ static boolean do_winsys_init(struct radeon_drm_winsys *ws)
#define CHIPSET(pci_id, name, family) case pci_id:
#include "pci_ids/r300_pci_ids.h"
#undef CHIPSET
+ ws->gen = R300;
+ break;
+
+#define CHIPSET(pci_id, name, family) case pci_id:
+#include "pci_ids/r600_pci_ids.h"
+#undef CHIPSET
+ ws->gen = R600;
break;
default:
@@ -196,15 +206,23 @@ static boolean do_winsys_init(struct radeon_drm_winsys *ws)
ws->num_cpus = sysconf(_SC_NPROCESSORS_ONLN);
/* Generation-specific queries. */
- if (!radeon_get_drm_value(ws->fd, RADEON_INFO_NUM_GB_PIPES,
- "GB pipe count",
- &ws->info.r300_num_gb_pipes))
- return FALSE;
+ if (ws->gen == R300) {
+ if (!radeon_get_drm_value(ws->fd, RADEON_INFO_NUM_GB_PIPES,
+ "GB pipe count",
+ &ws->info.r300_num_gb_pipes))
+ return FALSE;
- if (!radeon_get_drm_value(ws->fd, RADEON_INFO_NUM_Z_PIPES,
- "Z pipe count",
- &ws->info.r300_num_z_pipes))
- return FALSE;
+ if (!radeon_get_drm_value(ws->fd, RADEON_INFO_NUM_Z_PIPES,
+ "Z pipe count",
+ &ws->info.r300_num_z_pipes))
+ return FALSE;
+ }
+ else if (ws->gen == R600) {
+ if (!radeon_get_drm_value(ws->fd, RADEON_INFO_NUM_BACKENDS,
+ "num backends",
+ &ws->info.r600_num_backends))
+ return FALSE;
+ }
return TRUE;
}
@@ -263,6 +281,7 @@ struct radeon_winsys *radeon_drm_winsys_create(int fd)
}
ws->fd = fd;
+ ws->info.fd = fd;
if (!do_winsys_init(ws))
goto fail;
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.h b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.h
index 347e1f1d11a..69216448496 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.h
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.h
@@ -33,12 +33,18 @@
#include "radeon_winsys.h"
#include "os/os_thread.h"
+enum radeon_generation {
+ R300,
+ R600
+};
+
struct radeon_drm_winsys {
struct radeon_winsys base;
int fd; /* DRM file descriptor */
int num_cs; /* The number of command streams created. */
+ enum radeon_generation gen;
struct radeon_info info;
struct pb_manager *kman;
diff --git a/src/gallium/winsys/radeon/drm/radeon_winsys.h b/src/gallium/winsys/radeon/drm/radeon_winsys.h
index 6d52dc25022..2a49e615981 100644
--- a/src/gallium/winsys/radeon/drm/radeon_winsys.h
+++ b/src/gallium/winsys/radeon/drm/radeon_winsys.h
@@ -73,6 +73,7 @@ struct radeon_info {
uint32_t pci_id;
uint32_t gart_size;
uint32_t vram_size;
+ uint32_t fd; /* XXX transitional */
uint32_t drm_major; /* version */
uint32_t drm_minor;
@@ -80,6 +81,8 @@ struct radeon_info {
uint32_t r300_num_gb_pipes;
uint32_t r300_num_z_pipes;
+
+ uint32_t r600_num_backends;
};
enum radeon_feature_id {