summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2014-08-01 19:36:37 +0200
committerMarek Olšák <[email protected]>2014-08-09 23:41:15 +0200
commit085a86154553d86f8e4296b4c732901f781bdfd8 (patch)
treede12283dfa312c6fd88b13ae32b82824517e82df
parent0b5d88a518da7e4c8a084b7881580846c5d6d11f (diff)
radeon,r200: fix buffer validation after CS flush
This validates all bound buffers (CB, ZB, textures, DMA) at the beginning of CS. This fixes "bo->space_accouned" assertion failures. Tested by: Jochen Rollwagen <[email protected]> Cc: [email protected] Reviewed-by: Alex Deucher <[email protected]>
-rw-r--r--src/mesa/drivers/dri/r200/r200_context.c1
-rw-r--r--src/mesa/drivers/dri/r200/r200_state.c2
-rw-r--r--src/mesa/drivers/dri/r200/r200_state.h1
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_common.c14
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_common_context.h1
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_context.c1
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_state.c2
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_state.h1
8 files changed, 8 insertions, 15 deletions
diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c
index 71dfcf337f0..d5749f3e10d 100644
--- a/src/mesa/drivers/dri/r200/r200_context.c
+++ b/src/mesa/drivers/dri/r200/r200_context.c
@@ -190,6 +190,7 @@ static void r200_init_vtbl(radeonContextPtr radeon)
radeon->vtbl.check_blit = r200_check_blit;
radeon->vtbl.blit = r200_blit;
radeon->vtbl.is_format_renderable = radeonIsFormatRenderable;
+ radeon->vtbl.revalidate_all_buffers = r200ValidateBuffers;
}
diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c
index 2c7b652952a..983430fe301 100644
--- a/src/mesa/drivers/dri/r200/r200_state.c
+++ b/src/mesa/drivers/dri/r200/r200_state.c
@@ -2210,7 +2210,7 @@ static void update_texturematrix( struct gl_context *ctx )
}
}
-static GLboolean r200ValidateBuffers(struct gl_context *ctx)
+GLboolean r200ValidateBuffers(struct gl_context *ctx)
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
struct radeon_renderbuffer *rrb;
diff --git a/src/mesa/drivers/dri/r200/r200_state.h b/src/mesa/drivers/dri/r200/r200_state.h
index db0f01f30e7..a396b06c8fb 100644
--- a/src/mesa/drivers/dri/r200/r200_state.h
+++ b/src/mesa/drivers/dri/r200/r200_state.h
@@ -47,6 +47,7 @@ extern void r200UpdateViewportOffset( struct gl_context *ctx );
extern void r200UpdateWindow( struct gl_context *ctx );
extern void r200UpdateDrawBuffer(struct gl_context *ctx);
+extern GLboolean r200ValidateBuffers(struct gl_context *ctx);
extern GLboolean r200ValidateState( struct gl_context *ctx );
extern void r200_vtbl_update_scissor( struct gl_context *ctx );
diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c
index 67c6dc7b2a7..515e55a5a6f 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common.c
+++ b/src/mesa/drivers/dri/radeon/radeon_common.c
@@ -532,17 +532,6 @@ static INLINE void radeonEmitAtoms(radeonContextPtr radeon, GLboolean emitAll)
COMMIT_BATCH();
}
-static GLboolean radeon_revalidate_bos(struct gl_context *ctx)
-{
- radeonContextPtr radeon = RADEON_CONTEXT(ctx);
- int ret;
-
- ret = radeon_cs_space_check(radeon->cmdbuf.cs);
- if (ret == RADEON_CS_SPACE_FLUSH)
- return GL_FALSE;
- return GL_TRUE;
-}
-
void radeonEmitState(radeonContextPtr radeon)
{
radeon_print(RADEON_STATE, RADEON_NORMAL, "%s\n", __FUNCTION__);
@@ -661,9 +650,8 @@ int rcommonFlushCmdBufLocked(radeonContextPtr rmesa, const char *caller)
radeon_cs_erase(rmesa->cmdbuf.cs);
rmesa->cmdbuf.flushing = 0;
- if (radeon_revalidate_bos(&rmesa->glCtx) == GL_FALSE) {
+ if (!rmesa->vtbl.revalidate_all_buffers(&rmesa->glCtx))
fprintf(stderr,"failed to revalidate buffers\n");
- }
return ret;
}
diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.h b/src/mesa/drivers/dri/radeon/radeon_common_context.h
index 6cd15356634..ac3e7b529b2 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common_context.h
+++ b/src/mesa/drivers/dri/radeon/radeon_common_context.h
@@ -496,6 +496,7 @@ struct radeon_context {
unsigned reg_height,
unsigned flip_y);
unsigned (*is_format_renderable)(mesa_format mesa_format);
+ GLboolean (*revalidate_all_buffers)(struct gl_context *ctx);
} vtbl;
};
diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c
index 1ceb4ab869e..edd94e2ae9f 100644
--- a/src/mesa/drivers/dri/radeon/radeon_context.c
+++ b/src/mesa/drivers/dri/radeon/radeon_context.c
@@ -157,6 +157,7 @@ static void r100_init_vtbl(radeonContextPtr radeon)
radeon->vtbl.check_blit = r100_check_blit;
radeon->vtbl.blit = r100_blit;
radeon->vtbl.is_format_renderable = radeonIsFormatRenderable;
+ radeon->vtbl.revalidate_all_buffers = r100ValidateBuffers;
}
/* Create the device specific context.
diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c
index f6bc5df0e47..843b041ab5b 100644
--- a/src/mesa/drivers/dri/radeon/radeon_state.c
+++ b/src/mesa/drivers/dri/radeon/radeon_state.c
@@ -1992,7 +1992,7 @@ static void update_texturematrix( struct gl_context *ctx )
}
}
-static GLboolean r100ValidateBuffers(struct gl_context *ctx)
+GLboolean r100ValidateBuffers(struct gl_context *ctx)
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
struct radeon_renderbuffer *rrb;
diff --git a/src/mesa/drivers/dri/radeon/radeon_state.h b/src/mesa/drivers/dri/radeon/radeon_state.h
index cb98969c492..41e5de65ee4 100644
--- a/src/mesa/drivers/dri/radeon/radeon_state.h
+++ b/src/mesa/drivers/dri/radeon/radeon_state.h
@@ -50,6 +50,7 @@ extern void radeonUpdateDrawBuffer( struct gl_context *ctx );
extern void radeonUploadTexMatrix( r100ContextPtr rmesa,
int unit, GLboolean swapcols );
+extern GLboolean r100ValidateBuffers(struct gl_context *ctx);
extern GLboolean radeonValidateState( struct gl_context *ctx );