r300g, radeon-gallium: Fix API, cleanup.

Something called "validate" should return FALSE on failure, not TRUE.
This commit is contained in:
Corbin Simpson 2009-07-23 07:14:07 -07:00
parent 27b3c435ba
commit ca83d5a8db
6 changed files with 24 additions and 26 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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. */

View File

@ -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*