Mesa (master): r600g: flush and resubmit if we reach limit

Jerome Glisse glisse at kemper.freedesktop.org
Tue Aug 3 21:05:00 UTC 2010


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

Author: Jerome Glisse <jglisse at redhat.com>
Date:   Tue Aug  3 17:02:48 2010 -0400

r600g: flush and resubmit if we reach limit

Signed-off-by: Jerome Glisse <jglisse at redhat.com>

---

 src/gallium/drivers/r600/r600_context.c |    2 +-
 src/gallium/drivers/r600/r600_context.h |   38 +-----------------------------
 src/gallium/drivers/r600/r600_draw.c    |    4 +++
 src/gallium/drivers/r600/r600_helper.c  |    6 +++++
 4 files changed, 13 insertions(+), 37 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_context.c b/src/gallium/drivers/r600/r600_context.c
index 8b19191..ae1780a 100644
--- a/src/gallium/drivers/r600/r600_context.c
+++ b/src/gallium/drivers/r600/r600_context.c
@@ -41,7 +41,7 @@ static void r600_destroy_context(struct pipe_context *context)
 	FREE(rctx);
 }
 
-static void r600_flush(struct pipe_context *ctx, unsigned flags,
+void r600_flush(struct pipe_context *ctx, unsigned flags,
 			struct pipe_fence_handle **fence)
 {
 	struct r600_context *rctx = r600_context(ctx);
diff --git a/src/gallium/drivers/r600/r600_context.h b/src/gallium/drivers/r600/r600_context.h
index f8fdce5..8d102b6 100644
--- a/src/gallium/drivers/r600/r600_context.h
+++ b/src/gallium/drivers/r600/r600_context.h
@@ -113,23 +113,6 @@ struct r600_context {
 	struct radeon_draw		*draw;
 	/* hw states */
 	struct r600_context_hw_states	hw_states;
-#if 0
-	struct r600_pipe_shader		*ps_shader;
-	struct r600_pipe_shader		*vs_shader;
-	unsigned			nps_sampler;
-	struct radeon_state		*ps_sampler[PIPE_MAX_ATTRIBS];
-	unsigned			nps_view;
-	unsigned			nvs_view;
-	struct r600_texture_resource	*ps_view[PIPE_MAX_ATTRIBS];
-	struct r600_texture_resource	*vs_view[PIPE_MAX_ATTRIBS];
-	unsigned			flat_shade;
-	unsigned			nvertex_buffer;
-	struct r600_vertex_elements_state *vertex_elements;
-	struct pipe_vertex_buffer	vertex_buffer[PIPE_MAX_ATTRIBS];
-	struct pipe_stencil_ref		stencil_ref;
-	struct pipe_framebuffer_state	fb_state;
-	struct pipe_viewport_state	viewport;
-#endif
 	/* pipe states */
 	unsigned			flat_shade;
 	unsigned			ps_nsampler;
@@ -161,25 +144,6 @@ struct r600_context {
 	struct pipe_blend_color         blend_color;
 };
 
-#if 0
-struct r600_vertex_elements_state
-{
-	unsigned count;
-	struct pipe_vertex_element	elements[32];
-};
-
-struct r600_pipe_shader {
-	struct r600_shader		shader;
-	struct radeon_bo		*bo;
-	struct radeon_state		*state;
-};
-
-struct r600_texture_resource {
-	struct pipe_sampler_view	view;
-	struct radeon_state		*state;
-};
-#endif
-
 /* Convenience cast wrapper. */
 static INLINE struct r600_context *r600_context(struct pipe_context *pipe)
 {
@@ -189,6 +153,8 @@ static INLINE struct r600_context *r600_context(struct pipe_context *pipe)
 struct r600_context_state *r600_context_state(struct r600_context *rctx, unsigned type, const void *state);
 struct r600_context_state *r600_context_state_incref(struct r600_context_state *rstate);
 struct r600_context_state *r600_context_state_decref(struct r600_context_state *rstate);
+void r600_flush(struct pipe_context *ctx, unsigned flags,
+			struct pipe_fence_handle **fence);
 
 int r600_context_hw_states(struct r600_context *rctx);
 
diff --git a/src/gallium/drivers/r600/r600_draw.c b/src/gallium/drivers/r600/r600_draw.c
index c52dfd3..43c805b 100644
--- a/src/gallium/drivers/r600/r600_draw.c
+++ b/src/gallium/drivers/r600/r600_draw.c
@@ -170,6 +170,10 @@ static int r600_draw_common(struct r600_draw *draw)
 		return r;
 	/* FIXME */
 	r = radeon_ctx_set_draw_new(rctx->ctx, rctx->draw);
+	if (r == -EBUSY) {
+		r600_flush(draw->ctx, 0, NULL);
+		r = radeon_ctx_set_draw_new(rctx->ctx, rctx->draw);
+	}
 	if (r)
 		return r;
 	rctx->draw = radeon_draw_duplicate(rctx->draw);
diff --git a/src/gallium/drivers/r600/r600_helper.c b/src/gallium/drivers/r600/r600_helper.c
index 132abf9..c672fe7 100644
--- a/src/gallium/drivers/r600/r600_helper.c
+++ b/src/gallium/drivers/r600/r600_helper.c
@@ -61,6 +61,12 @@ int r600_conv_pipe_format(unsigned pformat, unsigned *format)
 	case PIPE_FORMAT_I8_UNORM:
 		*format = V_0280A0_COLOR_8;
 		return 0;
+	case PIPE_FORMAT_B4G4R4A4_UNORM:
+		*format = V_0280A0_COLOR_4_4_4_4;
+		return 0;
+	case PIPE_FORMAT_B5G6R5_UNORM:
+		*format = V_0280A0_COLOR_5_6_5;
+		return 0;
 	case PIPE_FORMAT_L16_UNORM:
 	case PIPE_FORMAT_Z16_UNORM:
 	case PIPE_FORMAT_Z32_UNORM:




More information about the mesa-commit mailing list