From: Nicolai Hähnle Date: Thu, 23 Jul 2009 14:05:21 +0000 (-0700) Subject: radeon-gallium: Build fixes wrt changed libdrm_radeon space check API X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=27b3c435ba0b9da6ab25cbffac9f975e0adaa66e;p=mesa.git radeon-gallium: Build fixes wrt changed libdrm_radeon space check API Had to be hacked up a bit to apply to master. Sorry 'bout that. :3 --- diff --git a/src/gallium/winsys/drm/radeon/core/radeon_buffer.h b/src/gallium/winsys/drm/radeon/core/radeon_buffer.h index 8c8b61fa10b..f5153b06af5 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_buffer.h +++ b/src/gallium/winsys/drm/radeon/core/radeon_buffer.h @@ -61,11 +61,6 @@ struct radeon_winsys_priv { /* Radeon BO manager. */ struct radeon_bo_manager* bom; - /* Radeon BO space checker. */ - struct radeon_cs_space_check sc[RADEON_MAX_BOS]; - /* Current BO count. */ - unsigned bo_count; - /* Radeon CS manager. */ struct radeon_cs_manager* csm; diff --git a/src/gallium/winsys/drm/radeon/core/radeon_drm.c b/src/gallium/winsys/drm/radeon/core/radeon_drm.c index da2010184a2..d6e4e4b5eb1 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_drm.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_drm.c @@ -31,6 +31,11 @@ #include "radeon_drm.h" #include "trace/tr_drm.h" +#include "r300_screen.h" +#include "xf86drm.h" + +#include + /* Create a pipe_screen. */ struct pipe_screen* radeon_create_screen(struct drm_api* api, int drmFB, diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c index 8c5f756ddf8..ac33ea4c6e2 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c @@ -27,64 +27,23 @@ static boolean radeon_r300_add_buffer(struct r300_winsys* winsys, uint32_t rd, uint32_t wd) { - int i; struct radeon_winsys_priv* priv = (struct radeon_winsys_priv*)winsys->radeon_winsys; - struct radeon_cs_space_check* sc = priv->sc; struct radeon_bo* bo = ((struct radeon_pipe_buffer*)pbuffer)->bo; - /* Check to see if this BO is already in line for validation; - * find a slot for it otherwise. */ - for (i = 0; i < priv->bo_count; i++) { - if (sc[i].bo == bo) { - sc[i].read_domains |= rd; - sc[i].write_domain |= wd; - return TRUE; - } - } - - if (priv->bo_count >= RADEON_MAX_BOS) { - /* Dohoho. Not falling for that one again. Request a flush. */ - return FALSE; - } - - sc[priv->bo_count].bo = bo; - sc[priv->bo_count].read_domains = rd; - sc[priv->bo_count].write_domain = wd; - priv->bo_count++; - + radeon_cs_space_add_persistent_bo(priv->cs, bo, rd, wd); return TRUE; } static boolean radeon_r300_validate(struct r300_winsys* winsys) { - int retval, i; struct radeon_winsys_priv* priv = (struct radeon_winsys_priv*)winsys->radeon_winsys; - struct radeon_cs_space_check* sc = priv->sc; - retval = radeon_cs_space_check(priv->cs, sc, priv->bo_count); - - if (retval == RADEON_CS_SPACE_OP_TO_BIG) { - /* We might as well HCF, since this is not going to fit in the card, - * period. */ - /* XXX just drop it on the floor instead */ - exit(1); - } else if (retval == RADEON_CS_SPACE_FLUSH) { - /* We must flush before more rendering can commence. */ + if (radeon_cs_space_check(priv->cs) < 0) { return TRUE; } - /* XXX should probably be its own function */ - for (i = 0; i < priv->bo_count; i++) { - if (sc[i].read_domains && sc[i].write_domain) { - /* Cute, cute. We need to flush first. */ - debug_printf("radeon: BO %p can't be read and written; " - "requesting flush.\n", sc[i].bo); - return TRUE; - } - } - /* Things are fine, we can proceed as normal. */ return FALSE; } @@ -151,8 +110,7 @@ static void radeon_r300_flush_cs(struct r300_winsys* winsys) { struct radeon_winsys_priv* priv = (struct radeon_winsys_priv*)winsys->radeon_winsys; - struct radeon_cs_space_check* sc = priv->sc; - int retval = 1; + int retval; /* Emit the CS. */ retval = radeon_cs_emit(priv->cs); @@ -163,8 +121,7 @@ static void radeon_r300_flush_cs(struct r300_winsys* winsys) radeon_cs_erase(priv->cs); /* Clean out BOs. */ - memset(sc, 0, sizeof(struct radeon_cs_space_check) * RADEON_MAX_BOS); - priv->bo_count = 0; + radeon_cs_space_reset_bos(priv->cs); } /* Helper function to do the ioctls needed for setup and init. */ diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.h b/src/gallium/winsys/drm/radeon/core/radeon_r300.h index a2e0e582485..7f0246cc7ad 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_r300.h +++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.h @@ -20,6 +20,9 @@ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#ifndef RADEON_R300_H +#define RADEON_R300_H + /* XXX WTF is this! I shouldn't have to include those first three! FUCK! */ #include #include @@ -44,5 +47,9 @@ struct drm_radeon_info { }; #endif +struct radeon_winsys; + struct r300_winsys* radeon_create_r300_winsys(int fd, struct radeon_winsys* old_winsys); + +#endif /* RADEON_R300_H */