Mesa (master): r300g, radeon-gallium: Fix API, cleanup.

Corbin Simpson csimpson at kemper.freedesktop.org
Thu Jul 23 14:20:02 UTC 2009


Module: Mesa
Branch: master
Commit: ca83d5a8db510756eb95423a52b19ff52a2d6dc1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ca83d5a8db510756eb95423a52b19ff52a2d6dc1

Author: Corbin Simpson <MostAwesomeDude at gmail.com>
Date:   Thu Jul 23 07:14:07 2009 -0700

r300g, radeon-gallium: Fix API, cleanup.

Something called "validate" should return FALSE on failure, not TRUE.

---

 src/gallium/drivers/r300/r300_emit.c             |    3 ++-
 src/gallium/drivers/r300/r300_surface.c          |    6 ++++--
 src/gallium/winsys/drm/radeon/core/radeon_drm.c  |    9 ++-------
 src/gallium/winsys/drm/radeon/core/radeon_drm.h  |    8 ++++++++
 src/gallium/winsys/drm/radeon/core/radeon_r300.c |   11 ++++++++---
 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 7ba56cd..ac510ff 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 fdabe4d..25168ce 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 d6e4e4b..8d818cf 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 8560f71..88a5c82 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 ac33ea4..e927409 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 7f0246c..741c137 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*




More information about the mesa-commit mailing list