diff options
author | Corbin Simpson <[email protected]> | 2009-07-23 07:14:07 -0700 |
---|---|---|
committer | Corbin Simpson <[email protected]> | 2009-07-23 07:18:29 -0700 |
commit | ca83d5a8db510756eb95423a52b19ff52a2d6dc1 (patch) | |
tree | 7eead4cb2ee76c5da7d56693d4a9c8d7cabf1e14 | |
parent | 27b3c435ba0b9da6ab25cbffac9f975e0adaa66e (diff) |
r300g, radeon-gallium: Fix API, cleanup.
Something called "validate" should return FALSE on failure, not TRUE.
-rw-r--r-- | src/gallium/drivers/r300/r300_emit.c | 3 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_surface.c | 6 | ||||
-rw-r--r-- | src/gallium/winsys/drm/radeon/core/radeon_drm.c | 9 | ||||
-rw-r--r-- | src/gallium/winsys/drm/radeon/core/radeon_drm.h | 8 | ||||
-rw-r--r-- | src/gallium/winsys/drm/radeon/core/radeon_r300.c | 11 | ||||
-rw-r--r-- | src/gallium/winsys/drm/radeon/core/radeon_r300.h | 13 |
6 files changed, 24 insertions, 26 deletions
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 7ba56cdc1d2..ac510ffc2ed 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -531,10 +531,11 @@ validate: } else { debug_printf("No VBO while emitting dirty state!\n"); } - if (r300->winsys->validate(r300->winsys)) { + if (!r300->winsys->validate(r300->winsys)) { r300->context.flush(&r300->context, 0, NULL); if (invalid) { /* Well, hell. */ + debug_printf("r300: Stuck in validation loop, gonna quit now."); exit(1); } invalid = TRUE; diff --git a/src/gallium/drivers/r300/r300_surface.c b/src/gallium/drivers/r300/r300_surface.c index fdabe4d9cfe..25168ce5e95 100644 --- a/src/gallium/drivers/r300/r300_surface.c +++ b/src/gallium/drivers/r300/r300_surface.c @@ -125,9 +125,10 @@ validate: r300->context.flush(&r300->context, 0, NULL); goto validate; } - if (r300->winsys->validate(r300->winsys)) { + if (!r300->winsys->validate(r300->winsys)) { r300->context.flush(&r300->context, 0, NULL); if (invalid) { + debug_printf("r300: Stuck in validation loop, gonna fallback."); goto fallback; } invalid = TRUE; @@ -256,9 +257,10 @@ validate: r300->context.flush(&r300->context, 0, NULL); goto validate; } - if (r300->winsys->validate(r300->winsys)) { + if (!r300->winsys->validate(r300->winsys)) { r300->context.flush(&r300->context, 0, NULL); if (invalid) { + debug_printf("r300: Stuck in validation loop, gonna fallback."); goto fallback; } invalid = TRUE; diff --git a/src/gallium/winsys/drm/radeon/core/radeon_drm.c b/src/gallium/winsys/drm/radeon/core/radeon_drm.c index d6e4e4b5eb1..8d818cf8301 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_drm.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_drm.c @@ -29,12 +29,6 @@ */ #include "radeon_drm.h" -#include "trace/tr_drm.h" - -#include "r300_screen.h" -#include "xf86drm.h" - -#include <sys/ioctl.h> /* Create a pipe_screen. */ struct pipe_screen* radeon_create_screen(struct drm_api* api, @@ -59,7 +53,8 @@ struct pipe_context* radeon_create_context(struct drm_api* api, if (getenv("RADEON_SOFTPIPE")) { return radeon_create_softpipe(screen->winsys); } else { - return r300_create_context(screen, screen->winsys); + return r300_create_context(screen, + (struct r300_winsys*)screen->winsys); } } diff --git a/src/gallium/winsys/drm/radeon/core/radeon_drm.h b/src/gallium/winsys/drm/radeon/core/radeon_drm.h index 8560f71db65..88a5c82b284 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_drm.h +++ b/src/gallium/winsys/drm/radeon/core/radeon_drm.h @@ -30,8 +30,13 @@ #ifndef RADEON_DRM_H #define RADEON_DRM_H +#include <sys/ioctl.h> + +#include "xf86drm.h" + #include "pipe/p_screen.h" +#include "trace/tr_drm.h" #include "util/u_memory.h" #include "state_tracker/drm_api.h" @@ -40,6 +45,9 @@ #include "radeon_r300.h" #include "radeon_winsys_softpipe.h" +/* XXX */ +#include "r300_screen.h" + struct pipe_screen* radeon_create_screen(struct drm_api* api, int drmFB, struct drm_create_screen_arg *arg); diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c index ac33ea4c6e2..e927409e3ab 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c @@ -41,11 +41,11 @@ static boolean radeon_r300_validate(struct r300_winsys* winsys) (struct radeon_winsys_priv*)winsys->radeon_winsys; if (radeon_cs_space_check(priv->cs) < 0) { - return TRUE; + return FALSE; } /* Things are fine, we can proceed as normal. */ - return FALSE; + return TRUE; } static boolean radeon_r300_check_cs(struct r300_winsys* winsys, int size) @@ -118,10 +118,15 @@ static void radeon_r300_flush_cs(struct r300_winsys* winsys) debug_printf("radeon: Bad CS, dumping...\n"); radeon_cs_print(priv->cs, stderr); } - radeon_cs_erase(priv->cs); /* Clean out BOs. */ radeon_cs_space_reset_bos(priv->cs); + + /* Reset CS. + * Someday, when we care about performance, we should really find a way + * to rotate between two or three CS objects so that the GPU can be + * spinning through one CS while another one is being filled. */ + radeon_cs_erase(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 7f0246cc7ad..741c1371889 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_r300.h +++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.h @@ -34,19 +34,6 @@ #include "radeon_buffer.h" -/* protect us from bonghits */ -#ifndef RADEON_INFO_DEVICE_ID -#define RADEON_INFO_DEVICE_ID 0 -#endif -#ifndef DRM_RADEON_INFO -#define DRM_RADEON_INFO 0x1 -struct drm_radeon_info { - uint32_t request; - uint32_t pad; - uint64_t value; -}; -#endif - struct radeon_winsys; struct r300_winsys* |