From c63bd15f81cecfb421ff798a3e2d0f82b90331db Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Tue, 18 Aug 2009 11:44:53 -0700 Subject: [PATCH] Revert "r300-gallium, radeon-gallium: Nuke gb_pipes from orbit." This reverts commit 6a40d1e9d96f8e8c57bc3bbd6f567cacd4471f59. Turns out that we *do* need these for OQ after all. Go figure. Conflicts: src/gallium/winsys/drm/radeon/core/radeon_r300.h --- src/gallium/drivers/r300/r300_chipset.c | 1 + src/gallium/drivers/r300/r300_chipset.h | 2 ++ src/gallium/drivers/r300/r300_screen.c | 1 + src/gallium/drivers/r300/r300_state_inlines.h | 19 ++++++++++++++++ src/gallium/drivers/r300/r300_winsys.h | 3 +++ .../winsys/drm/radeon/core/radeon_r300.c | 22 +++++++++++++++++-- 6 files changed, 46 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/r300/r300_chipset.c b/src/gallium/drivers/r300/r300_chipset.c index 00fae8d26f3..864bdedec03 100644 --- a/src/gallium/drivers/r300/r300_chipset.c +++ b/src/gallium/drivers/r300/r300_chipset.c @@ -34,6 +34,7 @@ void r300_parse_chipset(struct r300_capabilities* caps) caps->is_r500 = FALSE; caps->num_vert_fpus = 4; + /* Note: These are not ordered by PCI ID. I leave that task to GCC, * which will perform the ordering while collating jump tables. Instead, * I've tried to group them according to capabilities and age. */ diff --git a/src/gallium/drivers/r300/r300_chipset.h b/src/gallium/drivers/r300/r300_chipset.h index 5b2e1f05688..21eebeae600 100644 --- a/src/gallium/drivers/r300/r300_chipset.h +++ b/src/gallium/drivers/r300/r300_chipset.h @@ -34,6 +34,8 @@ struct r300_capabilities { int family; /* The number of vertex floating-point units */ int num_vert_fpus; + /* The number of fragment pipes */ + int num_frag_pipes; /* Whether or not TCL is physically present */ boolean has_tcl; /* Whether or not this is an RV515 or newer; R500s have many differences diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 96a73046217..15740f61252 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -392,6 +392,7 @@ struct pipe_screen* r300_create_screen(struct r300_winsys* r300_winsys) return NULL; caps->pci_id = r300_winsys->pci_id; + caps->num_frag_pipes = r300_winsys->gb_pipes; r300_parse_chipset(caps); diff --git a/src/gallium/drivers/r300/r300_state_inlines.h b/src/gallium/drivers/r300/r300_state_inlines.h index 22c8e199ae3..91b93fc367e 100644 --- a/src/gallium/drivers/r300/r300_state_inlines.h +++ b/src/gallium/drivers/r300/r300_state_inlines.h @@ -353,6 +353,25 @@ static INLINE uint32_t r300_translate_out_fmt(enum pipe_format format) /* Non-CSO state. (For now.) */ +static INLINE uint32_t r300_translate_gb_pipes(int pipe_count) +{ + switch (pipe_count) { + case 1: + return R300_GB_TILE_PIPE_COUNT_RV300; + break; + case 2: + return R300_GB_TILE_PIPE_COUNT_R300; + break; + case 3: + return R300_GB_TILE_PIPE_COUNT_R420_3P; + break; + case 4: + return R300_GB_TILE_PIPE_COUNT_R420; + break; + } + return 0; +} + static INLINE uint32_t translate_vertex_data_type(int type) { switch (type) { case EMIT_1F: diff --git a/src/gallium/drivers/r300/r300_winsys.h b/src/gallium/drivers/r300/r300_winsys.h index d2893c3b9d7..f18ad75a47d 100644 --- a/src/gallium/drivers/r300/r300_winsys.h +++ b/src/gallium/drivers/r300/r300_winsys.h @@ -45,6 +45,9 @@ struct r300_winsys { /* PCI ID */ uint32_t pci_id; + /* GB pipe count */ + uint32_t gb_pipes; + /* GART size. */ uint32_t gart_size; diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c index 4e9a2ddd161..d6bb77dc7e8 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c @@ -139,7 +139,25 @@ static void do_ioctls(struct r300_winsys* winsys, int fd) info.value = ⌖ - /* First, get PCI ID */ + /* First, get the number of pixel pipes */ + info.request = RADEON_INFO_NUM_GB_PIPES; + retval = drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info)); + if (retval) { + fprintf(stderr, "%s: New ioctl for GB pipe count failed " + "(error number %d), trying classic ioctl...\n", + __FUNCTION__, retval); + gp.param = RADEON_PARAM_NUM_GB_PIPES; + retval = drmCommandWriteRead(fd, DRM_RADEON_GETPARAM, &gp, + sizeof(gp)); + if (retval) { + fprintf(stderr, "%s: Failed to get GB pipe count, " + "error number %d\n", __FUNCTION__, retval); + exit(1); + } + } + winsys->gb_pipes = target; + + /* Then, get PCI ID */ info.request = RADEON_INFO_DEVICE_ID; retval = drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info)); if (retval) { @@ -149,7 +167,7 @@ static void do_ioctls(struct r300_winsys* winsys, int fd) } winsys->pci_id = target; - /* Then, retrieve MM info */ + /* Finally, retrieve MM info */ retval = drmCommandWriteRead(fd, DRM_RADEON_GEM_INFO, &gem_info, sizeof(gem_info)); if (retval) { -- 2.30.2