From 7843243deedd66b0c94c8874e732ed7e8c6617ff Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Wed, 22 Apr 2009 07:58:25 -0600
Subject: st: also check _NEW_PROGRAM flag for vertex shader constant buffers
This is a follow-on to commit c1a3b852807fb160f0cd246c1364b7336b4b947e.
Note that (at this time) wherever _NEW_PROGRAM_CONSTANTS is set we're still
setting _NEW_PROGRAM so this won't really make any difference (for now).
---
src/mesa/state_tracker/st_atom_constbuf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/mesa/state_tracker/st_atom_constbuf.c b/src/mesa/state_tracker/st_atom_constbuf.c
index 77ecd0719e..3ba7b26928 100644
--- a/src/mesa/state_tracker/st_atom_constbuf.c
+++ b/src/mesa/state_tracker/st_atom_constbuf.c
@@ -105,7 +105,7 @@ static void update_vs_constants(struct st_context *st )
const struct st_tracked_state st_update_vs_constants = {
"st_update_vs_constants", /* name */
{ /* dirty */
- _NEW_PROGRAM_CONSTANTS,
+ (_NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS), /* mesa */
ST_NEW_VERTEX_PROGRAM, /* st */
},
update_vs_constants /* update */
--
cgit v1.2.3
From f48473e42511f8d37a239a07f791bc0a87209e5b Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Wed, 22 Apr 2009 08:59:47 -0600
Subject: r200/r300/r500: add _NEW_PROGRAM_CONSTANTS flag
Make sure we detect constant buffer changes indicated by the new flag.
Should be able to remove _NEW_PROGRAM (and _NEW_MODELVIEW, _NEW_LIGHT, etc)
from several places (someday.
---
src/mesa/drivers/dri/r200/r200_state.c | 3 ++-
src/mesa/drivers/dri/r300/r300_fragprog.c | 3 ++-
src/mesa/drivers/dri/r300/r300_state.c | 7 ++++---
src/mesa/drivers/dri/r300/r500_fragprog.c | 3 ++-
4 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c
index 2fcc87c0f5..28ba5f49bc 100644
--- a/src/mesa/drivers/dri/r200/r200_state.c
+++ b/src/mesa/drivers/dri/r200/r200_state.c
@@ -2484,7 +2484,7 @@ void r200ValidateState( GLcontext *ctx )
r200UpdateDrawBuffer(ctx);
}
- if (new_state & (_NEW_TEXTURE | _NEW_PROGRAM)) {
+ if (new_state & (_NEW_TEXTURE | _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS)) {
r200UpdateTextureState( ctx );
new_state |= rmesa->NewGLState; /* may add TEXTURE_MATRIX */
r200UpdateLocalViewer( ctx );
@@ -2523,6 +2523,7 @@ void r200ValidateState( GLcontext *ctx )
}
if (new_state & (_NEW_PROGRAM|
+ _NEW_PROGRAM_CONSTANTS |
/* need to test for pretty much anything due to possible parameter bindings */
_NEW_MODELVIEW|_NEW_PROJECTION|_NEW_TRANSFORM|
_NEW_LIGHT|_NEW_TEXTURE|_NEW_TEXTURE_MATRIX|
diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.c b/src/mesa/drivers/dri/r300/r300_fragprog.c
index 873cde4414..2f45429cf2 100644
--- a/src/mesa/drivers/dri/r300/r300_fragprog.c
+++ b/src/mesa/drivers/dri/r300/r300_fragprog.c
@@ -470,7 +470,8 @@ void r300TranslateFragmentShader(r300ContextPtr r300,
fp->translated = GL_TRUE;
if (fp->error || (RADEON_DEBUG & DEBUG_PIXEL))
r300FragmentProgramDump(fp, &fp->code);
- r300UpdateStateParameters(r300->radeon.glCtx, _NEW_PROGRAM);
+ r300UpdateStateParameters(r300->radeon.glCtx, _NEW_PROGRAM |
+ _NEW_PROGRAM_CONSTANTS);
}
update_params(r300, fp);
diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c
index 8095538ff9..2589f09cc8 100644
--- a/src/mesa/drivers/dri/r300/r300_state.c
+++ b/src/mesa/drivers/dri/r300/r300_state.c
@@ -1107,7 +1107,7 @@ void r300UpdateStateParameters(GLcontext * ctx, GLuint new_state)
struct gl_program_parameter_list *paramList;
GLuint i;
- if (!(new_state & (_NEW_BUFFERS | _NEW_PROGRAM)))
+ if (!(new_state & (_NEW_BUFFERS | _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS)))
return;
fp = (struct r300_fragment_program *)ctx->FragmentProgram._Current;
@@ -2355,11 +2355,12 @@ void r300UpdateShaders(r300ContextPtr rmesa)
hw_tcl_on = future_hw_tcl_on = 0;
r300ResetHwState(rmesa);
- r300UpdateStateParameters(ctx, _NEW_PROGRAM);
+ r300UpdateStateParameters(ctx, _NEW_PROGRAM |
+ _NEW_PROGRAM_CONSTANTS);
return;
}
}
- r300UpdateStateParameters(ctx, _NEW_PROGRAM);
+ r300UpdateStateParameters(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS);
}
static const GLfloat *get_fragmentprogram_constant(GLcontext *ctx,
diff --git a/src/mesa/drivers/dri/r300/r500_fragprog.c b/src/mesa/drivers/dri/r300/r500_fragprog.c
index 292573de89..300559d0b4 100644
--- a/src/mesa/drivers/dri/r300/r500_fragprog.c
+++ b/src/mesa/drivers/dri/r300/r500_fragprog.c
@@ -501,7 +501,8 @@ void r500TranslateFragmentShader(r300ContextPtr r300,
_mesa_reference_program(r300->radeon.glCtx, &compiler.program, 0);
- r300UpdateStateParameters(r300->radeon.glCtx, _NEW_PROGRAM);
+ r300UpdateStateParameters(r300->radeon.glCtx, _NEW_PROGRAM |
+ _NEW_PROGRAM_CONSTANTS);
if (RADEON_DEBUG & DEBUG_PIXEL) {
if (fp->translated) {
--
cgit v1.2.3
From 817dcdd280cd749c3186bd3f00c06f41270aa884 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Wed, 22 Apr 2009 09:07:02 -0600
Subject: i965: use new _NEW_PROGRAM_CONSTANTS flag instead of dynamic flags
---
src/mesa/drivers/dri/i965/brw_curbe.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c
index 18b187ed1d..3c81899672 100644
--- a/src/mesa/drivers/dri/i965/brw_curbe.c
+++ b/src/mesa/drivers/dri/i965/brw_curbe.c
@@ -188,13 +188,6 @@ static void prepare_constant_buffer(struct brw_context *brw)
GLfloat *buf;
GLuint i;
- /* Update our own dependency flags. This works because this
- * function will also be called whenever fp or vp changes.
- */
- brw->curbe.tracked_state.dirty.mesa = (_NEW_TRANSFORM|_NEW_PROJECTION);
- brw->curbe.tracked_state.dirty.mesa |= vp->program.Base.Parameters->StateFlags;
- brw->curbe.tracked_state.dirty.mesa |= fp->program.Base.Parameters->StateFlags;
-
if (sz == 0) {
if (brw->curbe.last_buf) {
free(brw->curbe.last_buf);
@@ -422,7 +415,7 @@ static void emit_constant_buffer(struct brw_context *brw)
*/
const struct brw_tracked_state brw_constant_buffer = {
.dirty = {
- .mesa = (_NEW_TRANSFORM|_NEW_PROJECTION), /* plus fp and vp flags */
+ .mesa = _NEW_PROGRAM_CONSTANTS,
.brw = (BRW_NEW_FRAGMENT_PROGRAM |
BRW_NEW_VERTEX_PROGRAM |
BRW_NEW_URB_FENCE | /* Implicit - hardware requires this, not used above */
--
cgit v1.2.3
From 6b6a23c0f7e042d71764a2028f3d33b59076ac7c Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Wed, 22 Apr 2009 09:07:46 -0600
Subject: i965: updates to some debug code
---
src/mesa/drivers/dri/i965/brw_curbe.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c
index 3c81899672..da746e4aa0 100644
--- a/src/mesa/drivers/dri/i965/brw_curbe.c
+++ b/src/mesa/drivers/dri/i965/brw_curbe.c
@@ -352,11 +352,7 @@ update_constant_buffer(struct brw_context *brw,
dri_bo_unmap(const_buffer);
if (0) {
- int i;
- for (i = 0; i < params->NumParameters; i++) {
- float *p = params->ParameterValues[i];
- printf("%d: %f %f %f %f\n", i, p[0], p[1], p[2], p[3]);
- }
+ _mesa_print_parameter_list(params);
}
}
}
@@ -369,7 +365,7 @@ update_vertex_constant_buffer(struct brw_context *brw)
struct brw_vertex_program *vp =
(struct brw_vertex_program *) brw->vertex_program;
if (0) {
- printf("update VS constants in buffer %p\n", vp->const_buffer);
+ printf("update VS constants in buffer %p vp = %p\n", vp->const_buffer, vp);
printf("program %u\n", vp->program.Base.Id);
}
update_constant_buffer(brw, vp->program.Base.Parameters, vp->const_buffer);
@@ -382,6 +378,10 @@ update_fragment_constant_buffer(struct brw_context *brw)
{
struct brw_fragment_program *fp =
(struct brw_fragment_program *) brw->fragment_program;
+ if (0) {
+ printf("update WM constants in buffer %p\n", fp->const_buffer);
+ printf("program %u\n", fp->program.Base.Id);
+ }
update_constant_buffer(brw, fp->program.Base.Parameters, fp->const_buffer);
}
--
cgit v1.2.3
From 1dbab84e21cad81e971265db3dbc8dc6c344b340 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Wed, 22 Apr 2009 09:14:16 -0600
Subject: i965: use _NEW_PROGRAM_CONSTANTS and always create new const buffers
When program constants change we create a new VS constant buffer
instead of re-using the old one. This allows us to have several
const buffers in flight with vertex rendering.
---
src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 28 ++++++++++++------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index 71840d1e4e..89c456e62c 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -456,17 +456,14 @@ brw_update_vs_constant_surface( GLcontext *ctx,
assert(surf == 0);
- /* free old const buffer if too small */
- if (const_buffer && const_buffer->size < size) {
- dri_bo_unreference(const_buffer);
- const_buffer = NULL;
- }
+ /* We always create a new VS constant buffer so that several can be
+ * in flight at a time. Free the old one first...
+ */
+ dri_bo_unreference(const_buffer);
- /* alloc new buffer if needed */
- if (!const_buffer) {
- const_buffer =
- drm_intel_bo_alloc(intel->bufmgr, "vp_const_buffer", size, 64);
- }
+ /* alloc new buffer */
+ const_buffer =
+ drm_intel_bo_alloc(intel->bufmgr, "vp_const_buffer", size, 64);
memset(&key, 0, sizeof(key));
@@ -783,8 +780,7 @@ brw_vs_get_binding_table(struct brw_context *brw)
/**
- * Vertex shader surfaces. Just constant buffer for now. Could add vertex
- * shader textures in the future.
+ * Vertex shader surfaces (constant buffer).
*/
static void prepare_vs_surfaces(struct brw_context *brw )
{
@@ -820,8 +816,12 @@ prepare_surfaces(struct brw_context *brw)
const struct brw_tracked_state brw_wm_surfaces = {
.dirty = {
- .mesa = _NEW_COLOR | _NEW_TEXTURE | _NEW_BUFFERS | _NEW_PROGRAM,
- .brw = BRW_NEW_CONTEXT,
+ .mesa = (_NEW_COLOR |
+ _NEW_TEXTURE |
+ _NEW_BUFFERS |
+ _NEW_PROGRAM |
+ _NEW_PROGRAM_CONSTANTS),
+ .brw = (BRW_NEW_CONTEXT),
.cache = 0
},
.prepare = prepare_surfaces,
--
cgit v1.2.3
From a36dd5d54e3de5662c694e764d1c49795ddb6814 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Wed, 22 Apr 2009 09:14:53 -0600
Subject: i915: check the new _NEW_PROGRAM_CONSTANT flag
---
src/mesa/drivers/dri/i915/i915_context.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c
index fdd2cf6109..45ba2d14a5 100644
--- a/src/mesa/drivers/dri/i915/i915_context.c
+++ b/src/mesa/drivers/dri/i915/i915_context.c
@@ -73,7 +73,7 @@ i915InvalidateState(GLcontext * ctx, GLuint new_state)
p->params_uptodate = 0;
}
- if (new_state & (_NEW_FOG | _NEW_HINT | _NEW_PROGRAM))
+ if (new_state & (_NEW_FOG | _NEW_HINT | _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS))
i915_update_fog(ctx);
}
--
cgit v1.2.3
From e5681fc176bc43bc6c7804bd1e8d8557cdcab345 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Wed, 22 Apr 2009 09:16:21 -0600
Subject: i965: add _NEW_PROGRAM_CONSTANTS to mesa_bits[] list
---
src/mesa/drivers/dri/i965/brw_state_upload.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c
index 5de1450e61..197efeb1b7 100644
--- a/src/mesa/drivers/dri/i965/brw_state_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_state_upload.c
@@ -218,6 +218,7 @@ static struct dirty_bit_map mesa_bits[] = {
DEFINE_BIT(_NEW_MULTISAMPLE),
DEFINE_BIT(_NEW_TRACK_MATRIX),
DEFINE_BIT(_NEW_PROGRAM),
+ DEFINE_BIT(_NEW_PROGRAM_CONSTANTS),
{0, 0, 0}
};
--
cgit v1.2.3
From f428255bde93a452a7cdd48fba21839c99beb6cb Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Wed, 22 Apr 2009 09:23:15 -0600
Subject: i965: the brw_constant_buffer state atom is no longer dynamic
No more dynamic atoms so we can simplify the state validation code a little.
---
src/mesa/drivers/dri/i965/brw_context.h | 7 -------
src/mesa/drivers/dri/i965/brw_state_upload.c | 31 +++++-----------------------
2 files changed, 5 insertions(+), 33 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index a0b3b06309..af9fef5e22 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -448,8 +448,6 @@ struct brw_context
struct {
struct brw_state_flags dirty;
- struct brw_tracked_state **atoms;
- GLuint nr_atoms;
GLuint nr_color_regions;
struct intel_region *color_regions[MAX_DRAW_BUFFERS];
@@ -553,11 +551,6 @@ struct brw_context
GLuint vs_size;
GLuint total_size;
- /* Dynamic tracker which changes to reflect the state referenced
- * by active fp and vp program parameters:
- */
- struct brw_tracked_state tracked_state;
-
dri_bo *curbe_bo;
/** Offset within curbe_bo of space for current curbe entry */
GLuint curbe_offset;
diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c
index 197efeb1b7..491e2e2452 100644
--- a/src/mesa/drivers/dri/i965/brw_state_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_state_upload.c
@@ -102,39 +102,18 @@ const struct brw_tracked_state *atoms[] =
&brw_indices,
&brw_vertices,
- NULL, /* brw_constant_buffer */
+ &brw_constant_buffer
};
void brw_init_state( struct brw_context *brw )
{
- GLuint i;
-
brw_init_cache(brw);
-
- brw->state.atoms = _mesa_malloc(sizeof(atoms));
- brw->state.nr_atoms = sizeof(atoms)/sizeof(*atoms);
- _mesa_memcpy(brw->state.atoms, atoms, sizeof(atoms));
-
- /* Patch in a pointer to the dynamic state atom:
- */
- for (i = 0; i < brw->state.nr_atoms; i++)
- if (brw->state.atoms[i] == NULL)
- brw->state.atoms[i] = &brw->curbe.tracked_state;
-
- _mesa_memcpy(&brw->curbe.tracked_state,
- &brw_constant_buffer,
- sizeof(brw_constant_buffer));
}
void brw_destroy_state( struct brw_context *brw )
{
- if (brw->state.atoms) {
- _mesa_free(brw->state.atoms);
- brw->state.atoms = NULL;
- }
-
brw_destroy_cache(brw);
brw_destroy_batch_cache(brw);
}
@@ -337,7 +316,7 @@ void brw_validate_state( struct brw_context *brw )
/* do prepare stage for all atoms */
for (i = 0; i < Elements(atoms); i++) {
- const struct brw_tracked_state *atom = brw->state.atoms[i];
+ const struct brw_tracked_state *atom = atoms[i];
if (brw->intel.Fallback)
break;
@@ -368,8 +347,8 @@ void brw_upload_state(struct brw_context *brw)
_mesa_memset(&examined, 0, sizeof(examined));
prev = *state;
- for (i = 0; i < brw->state.nr_atoms; i++) {
- const struct brw_tracked_state *atom = brw->state.atoms[i];
+ for (i = 0; i < Elements(atoms); i++) {
+ const struct brw_tracked_state *atom = atoms[i];
struct brw_state_flags generated;
assert(atom->dirty.mesa ||
@@ -398,7 +377,7 @@ void brw_upload_state(struct brw_context *brw)
}
else {
for (i = 0; i < Elements(atoms); i++) {
- const struct brw_tracked_state *atom = brw->state.atoms[i];
+ const struct brw_tracked_state *atom = atoms[i];
if (brw->intel.Fallback)
break;
--
cgit v1.2.3
From 50853be894aa3edd1e9271f7d625f319209e340f Mon Sep 17 00:00:00 2001
From: Roland Scheidegger
Date: Wed, 22 Apr 2009 17:37:18 +0200
Subject: intel: fix max anisotropy supported
i915 actually supports up to 4 (according to header file - not tested),
i965 up to 16 (code already handled this but slightly broken), so don't use 2
for all chips, even though angular dependency is very high.
---
src/mesa/drivers/dri/i915/i830_context.c | 2 ++
src/mesa/drivers/dri/i915/i915_context.c | 2 ++
src/mesa/drivers/dri/i965/brw_context.c | 2 ++
src/mesa/drivers/dri/i965/brw_wm_sampler_state.c | 2 +-
src/mesa/drivers/dri/intel/intel_context.c | 2 --
5 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/mesa/drivers/dri/i915/i830_context.c b/src/mesa/drivers/dri/i915/i830_context.c
index 10b9bf371c..840946f908 100644
--- a/src/mesa/drivers/dri/i915/i830_context.c
+++ b/src/mesa/drivers/dri/i915/i830_context.c
@@ -98,6 +98,8 @@ i830CreateContext(const __GLcontextModes * mesaVis,
ctx->Const.MaxTextureRectSize = (1 << 11);
ctx->Const.MaxTextureUnits = I830_TEX_UNITS;
+ ctx->Const.MaxTextureMaxAnisotropy = 2.0;
+
ctx->Const.MaxDrawBuffers = 1;
_tnl_init_vertices(ctx, ctx->Const.MaxArrayLockSize + 12,
diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c
index fdd2cf6109..1f9f363df9 100644
--- a/src/mesa/drivers/dri/i915/i915_context.c
+++ b/src/mesa/drivers/dri/i915/i915_context.c
@@ -145,6 +145,8 @@ i915CreateContext(const __GLcontextModes * mesaVis,
ctx->Const.MaxTextureRectSize = (1 << 11);
ctx->Const.MaxTextureUnits = I915_TEX_UNITS;
+ ctx->Const.MaxTextureMaxAnisotropy = 4.0;
+
/* GL_ARB_fragment_program limits - don't think Mesa actually
* validates programs against these, and in any case one ARB
* instruction can translate to more than one HW instruction, so
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index d96ff29310..4dbe551d83 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -118,6 +118,8 @@ GLboolean brwCreateContext( const __GLcontextModes *mesaVis,
ctx->Const.MaxCubeTextureLevels = 12;
ctx->Const.MaxTextureRectSize = (1<<12);
+ ctx->Const.MaxTextureMaxAnisotropy = 16.0;
+
/* if conformance mode is set, swrast can handle any size AA point */
ctx->Const.MaxPointSizeAA = 255.0;
diff --git a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
index 1fc9f01372..c604ef0162 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
@@ -152,7 +152,7 @@ static void brw_update_sampler_state(struct wm_sampler_entry *key,
sampler->ss0.mag_filter = BRW_MAPFILTER_ANISOTROPIC;
if (key->max_aniso > 2.0) {
- sampler->ss3.max_aniso = MAX2((key->max_aniso - 2) / 2,
+ sampler->ss3.max_aniso = MIN2((key->max_aniso - 2) / 2,
BRW_ANISORATIO_16);
}
}
diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
index 3436b8ecd3..9b628dbc8e 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -528,8 +528,6 @@ intelInitContext(struct intel_context *intel,
}
}
- ctx->Const.MaxTextureMaxAnisotropy = 2.0;
-
/* This doesn't yet catch all non-conformant rendering, but it's a
* start.
*/
--
cgit v1.2.3
From a071a8d2e72e52e6a8906448b171756c8920ce96 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Wed, 22 Apr 2009 10:44:36 -0600
Subject: i965: remove unused state atom entries
---
src/mesa/drivers/dri/i965/brw_state_upload.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c
index 491e2e2452..20892cdf32 100644
--- a/src/mesa/drivers/dri/i965/brw_state_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_state_upload.c
@@ -59,7 +59,6 @@ const struct brw_tracked_state *atoms[] =
&brw_curbe_offsets,
&brw_recalculate_urb_fence,
-
&brw_cc_vp,
&brw_cc_unit,
@@ -88,15 +87,8 @@ const struct brw_tracked_state *atoms[] =
&brw_line_stipple,
&brw_aa_line_parameters,
- /* Ordering of the commands below is documented as fixed.
- */
-#if 0
- &brw_pipelined_state_pointers,
- &brw_urb_fence,
- &brw_constant_buffer_state,
-#else
+
&brw_psp_urb_cbs,
-#endif
&brw_drawing_rect,
&brw_indices,
--
cgit v1.2.3
From f9af97c7a5d81226a87d79baf8fb00231c96398d Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Wed, 22 Apr 2009 11:08:46 -0600
Subject: i965: checkpoint commit: use two state caches instead of one
The new, second cache will only be used for surface-related items.
Since we can create many surfaces the original, single cache could get
filled quickly. When we cleared it, we had to regenerate shaders, etc.
With two caches, we can avoid doing that.
---
src/mesa/drivers/dri/i965/brw_context.h | 3 +-
src/mesa/drivers/dri/i965/brw_state.h | 4 +-
src/mesa/drivers/dri/i965/brw_state_cache.c | 122 ++++++++++++++++++---------
src/mesa/drivers/dri/i965/brw_state_upload.c | 4 +-
4 files changed, 88 insertions(+), 45 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index af9fef5e22..cad711d18a 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -467,7 +467,8 @@ struct brw_context
int validated_bo_count;
} state;
- struct brw_cache cache;
+ struct brw_cache cache; /** non-surface items */
+ struct brw_cache surface_cache; /* surface items */
struct brw_cached_batch_item *cached_batch_items;
struct {
diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h
index 81b0a45998..7ea2fc113c 100644
--- a/src/mesa/drivers/dri/i965/brw_state.h
+++ b/src/mesa/drivers/dri/i965/brw_state.h
@@ -135,8 +135,8 @@ dri_bo *brw_search_cache( struct brw_cache *cache,
void *aux_return);
void brw_state_cache_check_size( struct brw_context *brw );
-void brw_init_cache( struct brw_context *brw );
-void brw_destroy_cache( struct brw_context *brw );
+void brw_init_caches( struct brw_context *brw );
+void brw_destroy_caches( struct brw_context *brw );
/***********************************************************************
* brw_state_batch.c
diff --git a/src/mesa/drivers/dri/i965/brw_state_cache.c b/src/mesa/drivers/dri/i965/brw_state_cache.c
index d5b5166406..3b23a8b755 100644
--- a/src/mesa/drivers/dri/i965/brw_state_cache.c
+++ b/src/mesa/drivers/dri/i965/brw_state_cache.c
@@ -320,20 +320,20 @@ enum pool_type {
};
static void
-brw_init_cache_id( struct brw_context *brw,
- const char *name,
- enum brw_cache_id id,
- GLuint key_size,
- GLuint aux_size)
+brw_init_cache_id(struct brw_cache *cache,
+ const char *name,
+ enum brw_cache_id id,
+ GLuint key_size,
+ GLuint aux_size)
{
- struct brw_cache *cache = &brw->cache;
-
cache->name[id] = strdup(name);
cache->key_size[id] = key_size;
cache->aux_size[id] = aux_size;
}
-void brw_init_cache( struct brw_context *brw )
+
+static void
+brw_init_non_surface_cache( struct brw_context *brw )
{
struct brw_cache *cache = &brw->cache;
@@ -342,114 +342,145 @@ void brw_init_cache( struct brw_context *brw )
cache->size = 7;
cache->n_items = 0;
cache->items = (struct brw_cache_item **)
- _mesa_calloc(cache->size *
- sizeof(struct brw_cache_item));
+ _mesa_calloc(cache->size * sizeof(struct brw_cache_item));
- brw_init_cache_id(brw,
+ brw_init_cache_id(cache,
"CC_VP",
BRW_CC_VP,
sizeof(struct brw_cc_viewport),
0);
- brw_init_cache_id(brw,
+ brw_init_cache_id(cache,
"CC_UNIT",
BRW_CC_UNIT,
sizeof(struct brw_cc_unit_state),
0);
- brw_init_cache_id(brw,
+ brw_init_cache_id(cache,
"WM_PROG",
BRW_WM_PROG,
sizeof(struct brw_wm_prog_key),
sizeof(struct brw_wm_prog_data));
- brw_init_cache_id(brw,
+ brw_init_cache_id(cache,
"SAMPLER_DEFAULT_COLOR",
BRW_SAMPLER_DEFAULT_COLOR,
sizeof(struct brw_sampler_default_color),
0);
- brw_init_cache_id(brw,
+ brw_init_cache_id(cache,
"SAMPLER",
BRW_SAMPLER,
0, /* variable key/data size */
0);
- brw_init_cache_id(brw,
+ brw_init_cache_id(cache,
"WM_UNIT",
BRW_WM_UNIT,
sizeof(struct brw_wm_unit_state),
0);
- brw_init_cache_id(brw,
+ brw_init_cache_id(cache,
"SF_PROG",
BRW_SF_PROG,
sizeof(struct brw_sf_prog_key),
sizeof(struct brw_sf_prog_data));
- brw_init_cache_id(brw,
+ brw_init_cache_id(cache,
"SF_VP",
BRW_SF_VP,
sizeof(struct brw_sf_viewport),
0);
- brw_init_cache_id(brw,
+ brw_init_cache_id(cache,
"SF_UNIT",
BRW_SF_UNIT,
sizeof(struct brw_sf_unit_state),
0);
- brw_init_cache_id(brw,
+ brw_init_cache_id(cache,
"VS_UNIT",
BRW_VS_UNIT,
sizeof(struct brw_vs_unit_state),
0);
- brw_init_cache_id(brw,
+ brw_init_cache_id(cache,
"VS_PROG",
BRW_VS_PROG,
sizeof(struct brw_vs_prog_key),
sizeof(struct brw_vs_prog_data));
- brw_init_cache_id(brw,
+ brw_init_cache_id(cache,
"CLIP_UNIT",
BRW_CLIP_UNIT,
sizeof(struct brw_clip_unit_state),
0);
- brw_init_cache_id(brw,
+ brw_init_cache_id(cache,
"CLIP_PROG",
BRW_CLIP_PROG,
sizeof(struct brw_clip_prog_key),
sizeof(struct brw_clip_prog_data));
- brw_init_cache_id(brw,
+ brw_init_cache_id(cache,
"GS_UNIT",
BRW_GS_UNIT,
sizeof(struct brw_gs_unit_state),
0);
- brw_init_cache_id(brw,
+ brw_init_cache_id(cache,
"GS_PROG",
BRW_GS_PROG,
sizeof(struct brw_gs_prog_key),
sizeof(struct brw_gs_prog_data));
+#if 1
+ brw_init_cache_id(cache,
+ "SS_SURFACE",
+ BRW_SS_SURFACE,
+ sizeof(struct brw_surface_state),
+ 0);
+
+ brw_init_cache_id(cache,
+ "SS_SURF_BIND",
+ BRW_SS_SURF_BIND,
+ 0,
+ 0);
+#endif
+}
+
+static void
+brw_init_surface_cache( struct brw_context *brw )
+{
+ struct brw_cache *cache = &brw->surface_cache;
- brw_init_cache_id(brw,
+ cache->brw = brw;
+
+ cache->size = 7;
+ cache->n_items = 0;
+ cache->items = (struct brw_cache_item **)
+ _mesa_calloc(cache->size * sizeof(struct brw_cache_item));
+
+ brw_init_cache_id(cache,
"SS_SURFACE",
BRW_SS_SURFACE,
sizeof(struct brw_surface_state),
0);
- brw_init_cache_id(brw,
+ brw_init_cache_id(cache,
"SS_SURF_BIND",
BRW_SS_SURF_BIND,
0,
0);
}
+void brw_init_caches( struct brw_context *brw )
+{
+ brw_init_non_surface_cache(brw);
+ brw_init_surface_cache(brw);
+}
+
static void
-brw_clear_cache( struct brw_context *brw )
+brw_clear_cache( struct brw_context *brw, struct brw_cache *cache )
{
struct brw_cache_item *c, *next;
GLuint i;
@@ -457,8 +488,8 @@ brw_clear_cache( struct brw_context *brw )
if (INTEL_DEBUG & DEBUG_STATE)
_mesa_printf("%s\n", __FUNCTION__);
- for (i = 0; i < brw->cache.size; i++) {
- for (c = brw->cache.items[i]; c; c = next) {
+ for (i = 0; i < cache->size; i++) {
+ for (c = cache->items[i]; c; c = next) {
int j;
next = c->next;
@@ -468,10 +499,10 @@ brw_clear_cache( struct brw_context *brw )
free((void *)c->key);
free(c);
}
- brw->cache.items[i] = NULL;
+ cache->items[i] = NULL;
}
- brw->cache.n_items = 0;
+ cache->n_items = 0;
if (brw->curbe.last_buf) {
_mesa_free(brw->curbe.last_buf);
@@ -489,19 +520,30 @@ void brw_state_cache_check_size( struct brw_context *brw )
* 32k, so 1000 of them is around 1.5MB.
*/
if (brw->cache.n_items > 1000)
- brw_clear_cache(brw);
+ brw_clear_cache(brw, &brw->cache);
+
+ if (brw->surface_cache.n_items > 1000)
+ brw_clear_cache(brw, &brw->surface_cache);
}
-void brw_destroy_cache( struct brw_context *brw )
+
+static void
+brw_destroy_cache(struct brw_context *brw, struct brw_cache *cache)
{
GLuint i;
- brw_clear_cache(brw);
+ brw_clear_cache(brw, cache);
for (i = 0; i < BRW_MAX_CACHE; i++) {
- dri_bo_unreference(brw->cache.last_bo[i]);
- free(brw->cache.name[i]);
+ dri_bo_unreference(cache->last_bo[i]);
+ free(cache->name[i]);
}
- free(brw->cache.items);
- brw->cache.items = NULL;
- brw->cache.size = 0;
+ free(cache->items);
+ cache->items = NULL;
+ cache->size = 0;
+}
+
+void brw_destroy_caches( struct brw_context *brw )
+{
+ brw_destroy_cache(brw, &brw->cache);
+ brw_destroy_cache(brw, &brw->surface_cache);
}
diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c
index 20892cdf32..2641bcb2aa 100644
--- a/src/mesa/drivers/dri/i965/brw_state_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_state_upload.c
@@ -100,13 +100,13 @@ const struct brw_tracked_state *atoms[] =
void brw_init_state( struct brw_context *brw )
{
- brw_init_cache(brw);
+ brw_init_caches(brw);
}
void brw_destroy_state( struct brw_context *brw )
{
- brw_destroy_cache(brw);
+ brw_destroy_caches(brw);
brw_destroy_batch_cache(brw);
}
--
cgit v1.2.3
From 4843e54fc69daf379dea9899673b3df92b44049c Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Wed, 22 Apr 2009 11:12:07 -0600
Subject: i965: actually use the new, second surface state cache
---
src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 39 +++++++++++++-----------
1 file changed, 22 insertions(+), 17 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index 89c456e62c..74f3f1791e 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -268,7 +268,7 @@ brw_create_texture_surface( struct brw_context *brw,
surf.ss0.cube_neg_z = 1;
}
- bo = brw_upload_cache(&brw->cache, BRW_SS_SURFACE,
+ bo = brw_upload_cache(&brw->surface_cache, BRW_SS_SURFACE,
key, sizeof(*key),
&key->bo, key->bo ? 1 : 0,
&surf, sizeof(surf),
@@ -321,10 +321,11 @@ brw_update_texture_surface( GLcontext *ctx, GLuint unit )
key.tiling = intelObj->mt->region->tiling;
dri_bo_unreference(brw->wm.surf_bo[surf]);
- brw->wm.surf_bo[surf] = brw_search_cache(&brw->cache, BRW_SS_SURFACE,
- &key, sizeof(key),
- &key.bo, key.bo ? 1 : 0,
- NULL);
+ brw->wm.surf_bo[surf] = brw_search_cache(&brw->surface_cache,
+ BRW_SS_SURFACE,
+ &key, sizeof(key),
+ &key.bo, key.bo ? 1 : 0,
+ NULL);
if (brw->wm.surf_bo[surf] == NULL) {
brw->wm.surf_bo[surf] = brw_create_texture_surface(brw, &key);
}
@@ -362,7 +363,7 @@ brw_create_constant_surface( struct brw_context *brw,
surf.ss3.pitch = (key->pitch * key->cpp) - 1; /* ignored?? */
brw_set_surface_tiling(&surf, key->tiling); /* tiling now allowed */
- bo = brw_upload_cache(&brw->cache, BRW_SS_SURFACE,
+ bo = brw_upload_cache(&brw->surface_cache, BRW_SS_SURFACE,
key, sizeof(*key),
&key->bo, key->bo ? 1 : 0,
&surf, sizeof(surf),
@@ -427,7 +428,8 @@ brw_update_wm_constant_surface( GLcontext *ctx,
*/
dri_bo_unreference(brw->wm.surf_bo[surf]);
- brw->wm.surf_bo[surf] = brw_search_cache(&brw->cache, BRW_SS_SURFACE,
+ brw->wm.surf_bo[surf] = brw_search_cache(&brw->surface_cache,
+ BRW_SS_SURFACE,
&key, sizeof(key),
&key.bo, key.bo ? 1 : 0,
NULL);
@@ -484,7 +486,8 @@ brw_update_vs_constant_surface( GLcontext *ctx,
*/
dri_bo_unreference(brw->vs.surf_bo[surf]);
- brw->vs.surf_bo[surf] = brw_search_cache(&brw->cache, BRW_SS_SURFACE,
+ brw->vs.surf_bo[surf] = brw_search_cache(&brw->surface_cache,
+ BRW_SS_SURFACE,
&key, sizeof(key),
&key.bo, key.bo ? 1 : 0,
NULL);
@@ -563,10 +566,11 @@ brw_update_renderbuffer_surface(struct brw_context *brw,
dri_bo_unreference(brw->wm.surf_bo[unit]);
brw->wm.surf_bo[unit] = NULL;
if (cached)
- brw->wm.surf_bo[unit] = brw_search_cache(&brw->cache, BRW_SS_SURFACE,
- &key, sizeof(key),
- ®ion_bo, 1,
- NULL);
+ brw->wm.surf_bo[unit] = brw_search_cache(&brw->surface_cache,
+ BRW_SS_SURFACE,
+ &key, sizeof(key),
+ ®ion_bo, 1,
+ NULL);
if (brw->wm.surf_bo[unit] == NULL) {
struct brw_surface_state surf;
@@ -591,7 +595,8 @@ brw_update_renderbuffer_surface(struct brw_context *brw,
surf.ss0.writedisable_alpha = !key.color_mask[3];
/* Key size will never match key size for textures, so we're safe. */
- brw->wm.surf_bo[unit] = brw_upload_cache(&brw->cache, BRW_SS_SURFACE,
+ brw->wm.surf_bo[unit] = brw_upload_cache(&brw->surface_cache,
+ BRW_SS_SURFACE,
&key, sizeof(key),
®ion_bo, 1,
&surf, sizeof(surf),
@@ -623,7 +628,7 @@ brw_wm_get_binding_table(struct brw_context *brw)
assert(brw->wm.nr_surfaces <= BRW_WM_MAX_SURF);
- bind_bo = brw_search_cache(&brw->cache, BRW_SS_SURF_BIND,
+ bind_bo = brw_search_cache(&brw->surface_cache, BRW_SS_SURF_BIND,
NULL, 0,
brw->wm.surf_bo, brw->wm.nr_surfaces,
NULL);
@@ -639,7 +644,7 @@ brw_wm_get_binding_table(struct brw_context *brw)
else
data[i] = 0;
- bind_bo = brw_upload_cache( &brw->cache, BRW_SS_SURF_BIND,
+ bind_bo = brw_upload_cache( &brw->surface_cache, BRW_SS_SURF_BIND,
NULL, 0,
brw->wm.surf_bo, brw->wm.nr_surfaces,
data, data_size,
@@ -739,7 +744,7 @@ brw_vs_get_binding_table(struct brw_context *brw)
assert(brw->vs.nr_surfaces <= BRW_VS_MAX_SURF);
- bind_bo = brw_search_cache(&brw->cache, BRW_SS_SURF_BIND,
+ bind_bo = brw_search_cache(&brw->surface_cache, BRW_SS_SURF_BIND,
NULL, 0,
brw->vs.surf_bo, brw->vs.nr_surfaces,
NULL);
@@ -755,7 +760,7 @@ brw_vs_get_binding_table(struct brw_context *brw)
else
data[i] = 0;
- bind_bo = brw_upload_cache( &brw->cache, BRW_SS_SURF_BIND,
+ bind_bo = brw_upload_cache( &brw->surface_cache, BRW_SS_SURF_BIND,
NULL, 0,
brw->vs.surf_bo, brw->vs.nr_surfaces,
data, data_size,
--
cgit v1.2.3
From fa92756400ccfbb3f0201df634feb45ab4f98352 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Wed, 22 Apr 2009 18:16:03 +0100
Subject: mesa: Fix buffer overflow when parsing generic vertex attributes.
---
src/mesa/shader/arbprogparse.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c
index b47bf360cf..c7a031067e 100644
--- a/src/mesa/shader/arbprogparse.c
+++ b/src/mesa/shader/arbprogparse.c
@@ -1513,10 +1513,16 @@ generic_attrib_check(struct var_cache *vc_head)
curr = vc_head;
while (curr) {
if (curr->type == vt_attrib) {
- if (curr->attrib_is_generic)
- genericAttrib[ curr->attrib_binding ] = GL_TRUE;
- else
+ if (curr->attrib_is_generic) {
+ GLuint attr = (curr->attrib_binding == 0)
+ ? 0 : (curr->attrib_binding - VERT_ATTRIB_GENERIC0);
+ assert(attr < MAX_VERTEX_PROGRAM_ATTRIBS);
+ genericAttrib[attr] = GL_TRUE;
+ }
+ else {
+ assert(curr->attrib_binding < MAX_VERTEX_PROGRAM_ATTRIBS);
explicitAttrib[ curr->attrib_binding ] = GL_TRUE;
+ }
}
curr = curr->next;
--
cgit v1.2.3
From c0c58cf5cfc11b9256287871660cc16966e662ef Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Wed, 22 Apr 2009 11:28:24 -0600
Subject: i965: comments, reformatting
---
src/mesa/drivers/dri/i965/brw_state_cache.c | 55 ++++++++++++++++++++---------
1 file changed, 38 insertions(+), 17 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_state_cache.c b/src/mesa/drivers/dri/i965/brw_state_cache.c
index 3b23a8b755..cbae68798c 100644
--- a/src/mesa/drivers/dri/i965/brw_state_cache.c
+++ b/src/mesa/drivers/dri/i965/brw_state_cache.c
@@ -56,9 +56,9 @@
* incorrect program is run for the other instance.
*/
+#include "main/imports.h"
#include "brw_state.h"
#include "intel_batchbuffer.h"
-#include "main/imports.h"
/* XXX: Fixme - have to include these to get the sizes of the prog_key
* structs:
@@ -69,8 +69,10 @@
#include "brw_sf.h"
#include "brw_gs.h"
-static GLuint hash_key( const void *key, GLuint key_size,
- dri_bo **reloc_bufs, GLuint nr_reloc_bufs)
+
+static GLuint
+hash_key(const void *key, GLuint key_size,
+ dri_bo **reloc_bufs, GLuint nr_reloc_bufs)
{
GLuint *ikey = (GLuint *)key;
GLuint hash = 0, i;
@@ -95,6 +97,7 @@ static GLuint hash_key( const void *key, GLuint key_size,
return hash;
}
+
/**
* Marks a new buffer as being chosen for the given cache id.
*/
@@ -111,6 +114,7 @@ update_cache_last(struct brw_cache *cache, enum brw_cache_id cache_id,
cache->brw->state.dirty.cache |= 1 << cache_id;
}
+
static struct brw_cache_item *
search_cache(struct brw_cache *cache, enum brw_cache_id cache_id,
GLuint hash, const void *key, GLuint key_size,
@@ -143,7 +147,8 @@ search_cache(struct brw_cache *cache, enum brw_cache_id cache_id,
}
-static void rehash( struct brw_cache *cache )
+static void
+rehash(struct brw_cache *cache)
{
struct brw_cache_item **items;
struct brw_cache_item *c, *next;
@@ -164,15 +169,17 @@ static void rehash( struct brw_cache *cache )
cache->size = size;
}
+
/**
* Returns the buffer object matching cache_id and key, or NULL.
*/
-dri_bo *brw_search_cache( struct brw_cache *cache,
- enum brw_cache_id cache_id,
- const void *key,
- GLuint key_size,
- dri_bo **reloc_bufs, GLuint nr_reloc_bufs,
- void *aux_return )
+dri_bo *
+brw_search_cache(struct brw_cache *cache,
+ enum brw_cache_id cache_id,
+ const void *key,
+ GLuint key_size,
+ dri_bo **reloc_bufs, GLuint nr_reloc_bufs,
+ void *aux_return)
{
struct brw_cache_item *item;
GLuint hash = hash_key(key, key_size, reloc_bufs, nr_reloc_bufs);
@@ -192,6 +199,7 @@ dri_bo *brw_search_cache( struct brw_cache *cache,
return item->bo;
}
+
dri_bo *
brw_upload_cache( struct brw_cache *cache,
enum brw_cache_id cache_id,
@@ -265,7 +273,9 @@ brw_upload_cache( struct brw_cache *cache,
return bo;
}
-/* This doesn't really work with aux data. Use search/upload instead
+
+/**
+ * This doesn't really work with aux data. Use search/upload instead
*/
dri_bo *
brw_cache_data_sz(struct brw_cache *cache,
@@ -296,6 +306,7 @@ brw_cache_data_sz(struct brw_cache *cache,
return bo;
}
+
/**
* Wrapper around brw_cache_data_sz using the cache_id's canonical key size.
*
@@ -319,6 +330,7 @@ enum pool_type {
DW_GENERAL_STATE
};
+
static void
brw_init_cache_id(struct brw_cache *cache,
const char *name,
@@ -333,7 +345,7 @@ brw_init_cache_id(struct brw_cache *cache,
static void
-brw_init_non_surface_cache( struct brw_context *brw )
+brw_init_non_surface_cache(struct brw_context *brw)
{
struct brw_cache *cache = &brw->cache;
@@ -433,6 +445,7 @@ brw_init_non_surface_cache( struct brw_context *brw )
BRW_GS_PROG,
sizeof(struct brw_gs_prog_key),
sizeof(struct brw_gs_prog_data));
+
#if 1
brw_init_cache_id(cache,
"SS_SURFACE",
@@ -448,8 +461,9 @@ brw_init_non_surface_cache( struct brw_context *brw )
#endif
}
+
static void
-brw_init_surface_cache( struct brw_context *brw )
+brw_init_surface_cache(struct brw_context *brw)
{
struct brw_cache *cache = &brw->surface_cache;
@@ -473,14 +487,17 @@ brw_init_surface_cache( struct brw_context *brw )
0);
}
-void brw_init_caches( struct brw_context *brw )
+
+void
+brw_init_caches(struct brw_context *brw)
{
brw_init_non_surface_cache(brw);
brw_init_surface_cache(brw);
}
+
static void
-brw_clear_cache( struct brw_context *brw, struct brw_cache *cache )
+brw_clear_cache(struct brw_context *brw, struct brw_cache *cache)
{
struct brw_cache_item *c, *next;
GLuint i;
@@ -514,7 +531,9 @@ brw_clear_cache( struct brw_context *brw, struct brw_cache *cache )
brw->state.dirty.cache |= ~0;
}
-void brw_state_cache_check_size( struct brw_context *brw )
+
+void
+brw_state_cache_check_size(struct brw_context *brw)
{
/* un-tuned guess. We've got around 20 state objects for a total of around
* 32k, so 1000 of them is around 1.5MB.
@@ -542,7 +561,9 @@ brw_destroy_cache(struct brw_context *brw, struct brw_cache *cache)
cache->size = 0;
}
-void brw_destroy_caches( struct brw_context *brw )
+
+void
+brw_destroy_caches(struct brw_context *brw)
{
brw_destroy_cache(brw, &brw->cache);
brw_destroy_cache(brw, &brw->surface_cache);
--
cgit v1.2.3
From 21a422d97e501f4ca68ab24ad3fe5f5eb1393349 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Wed, 22 Apr 2009 11:29:49 -0600
Subject: i965: remove old code to init surface-related cache IDs
These types are only found in the new surface state cache now.
---
src/mesa/drivers/dri/i965/brw_state_cache.c | 14 --------------
1 file changed, 14 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_state_cache.c b/src/mesa/drivers/dri/i965/brw_state_cache.c
index cbae68798c..320d886c99 100644
--- a/src/mesa/drivers/dri/i965/brw_state_cache.c
+++ b/src/mesa/drivers/dri/i965/brw_state_cache.c
@@ -445,20 +445,6 @@ brw_init_non_surface_cache(struct brw_context *brw)
BRW_GS_PROG,
sizeof(struct brw_gs_prog_key),
sizeof(struct brw_gs_prog_data));
-
-#if 1
- brw_init_cache_id(cache,
- "SS_SURFACE",
- BRW_SS_SURFACE,
- sizeof(struct brw_surface_state),
- 0);
-
- brw_init_cache_id(cache,
- "SS_SURF_BIND",
- BRW_SS_SURF_BIND,
- 0,
- 0);
-#endif
}
--
cgit v1.2.3
From 5c8fb6acc10662c9e71078c9f273db6c7808e9ff Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Wed, 22 Apr 2009 11:47:59 -0600
Subject: i965: define BRW_MAX_GRF
---
src/mesa/drivers/dri/i965/brw_context.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index cad711d18a..f0d4993e11 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -243,6 +243,9 @@ struct brw_vs_ouput_sizes {
};
+/** Number of general purpose registers (VS, WM, etc) */
+#define BRW_MAX_GRF 128
+
/** Number of texture sampler units */
#define BRW_MAX_TEX_UNIT 16
--
cgit v1.2.3
From ac22178eb049126003db40b0a77a111498a12ab7 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Wed, 22 Apr 2009 11:52:16 -0600
Subject: i965: enable VS constant buffers
In the VS constants can now be handled in two different ways:
1. If there's room in the GRF, put constants there. They're preloaded from
the CURBE prior to VS execution. This is the historical approach. The
problem is the GRF may not have room for all the shader's constants and
temps and misc registers. Hence...
2. Use a separate constant buffer which is read from using a READ message.
This allows a very large number of constants and frees up GRF regs for
shader temporaries. This is the new approach. May be a little slower
than 1.
1 vs. 2 is chosen according to how many constants and temps the shader needs.
---
src/mesa/drivers/dri/i965/brw_vs_emit.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c
index 524f1211ce..1da5a3f502 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c
@@ -69,13 +69,17 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c )
{
GLuint i, reg = 0, mrf;
-#if 0
- if (c->vp->program.Base.Parameters->NumParameters >= 6)
- c->use_const_buffer = 1;
+ /* Determine whether to use a real constant buffer or use a block
+ * of GRF registers for constants. The later is faster but only
+ * works if everything fits in the GRF.
+ * XXX this heuristic/check may need some fine tuning...
+ */
+ if (c->vp->program.Base.Parameters->NumParameters +
+ c->vp->program.Base.NumTemporaries + 20 > BRW_MAX_GRF)
+ c->use_const_buffer = GL_TRUE;
else
-#endif
c->use_const_buffer = GL_FALSE;
- /*printf("use_const_buffer = %d\n", c->use_const_buffer);*/
+ printf("use_const_buffer = %d\n", c->use_const_buffer);
/* r0 -- reserved as usual
*/
--
cgit v1.2.3
From ebfbd8c4fef78e3cd9604660e5bb96e3c6df07e5 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Wed, 22 Apr 2009 13:46:58 -0600
Subject: i965: disable debug printf
---
src/mesa/drivers/dri/i965/brw_vs_emit.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c
index 1da5a3f502..c2b3702798 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c
@@ -79,7 +79,7 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c )
c->use_const_buffer = GL_TRUE;
else
c->use_const_buffer = GL_FALSE;
- printf("use_const_buffer = %d\n", c->use_const_buffer);
+ /*printf("use_const_buffer = %d\n", c->use_const_buffer);*/
/* r0 -- reserved as usual
*/
--
cgit v1.2.3
From 8ee6ab6acb8f89fbc87865751573fcbffb4695ef Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Wed, 22 Apr 2009 15:02:01 -0600
Subject: mesa: fix _mesa_dump_textures(), add null ptr check
Calling _mesa_dump_textures() deleted the textures... oops!!!
---
src/mesa/main/debug.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c
index fdd10dd307..2eabcdaf49 100644
--- a/src/mesa/main/debug.c
+++ b/src/mesa/main/debug.c
@@ -3,6 +3,7 @@
* Version: 6.5
*
* Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
+ * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -262,7 +263,7 @@ static void
write_texture_image(struct gl_texture_object *texObj)
{
const struct gl_texture_image *img = texObj->Image[0][0];
- if (img) {
+ if (img && img->Data) {
char s[100];
/* make filename */
@@ -338,5 +339,5 @@ _mesa_dump_textures(GLboolean dumpImages)
{
GET_CURRENT_CONTEXT(ctx);
DumpImages = dumpImages;
- _mesa_HashDeleteAll(ctx->Shared->TexObjects, dump_texture_cb, ctx);
+ _mesa_HashWalk(ctx->Shared->TexObjects, dump_texture_cb, ctx);
}
--
cgit v1.2.3
From 984f2bb629bb742c6d11d4c8434a2cb32a5b8b75 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Wed, 22 Apr 2009 15:10:36 -0600
Subject: st: comments, license, copyright
---
src/mesa/state_tracker/st_inlines.h | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/src/mesa/state_tracker/st_inlines.h b/src/mesa/state_tracker/st_inlines.h
index 0322d5dfa6..a41cfeb96f 100644
--- a/src/mesa/state_tracker/st_inlines.h
+++ b/src/mesa/state_tracker/st_inlines.h
@@ -1,3 +1,35 @@
+/**************************************************************************
+ *
+ * Copyright 2009 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+/**
+ * Functions for checking if buffers/textures are referenced when we need
+ * to read/write from/to them. Flush when needed.
+ */
+
#ifndef ST_INLINES_H
#define ST_INLINES_H
--
cgit v1.2.3
From c5a97eda32d37de7d1154288bf4298dff3542551 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Wed, 22 Apr 2009 15:12:22 -0600
Subject: gallium: license, copyright
---
src/gallium/auxiliary/util/u_linear.c | 31 +++++++++++++++++++++++++++++++
src/gallium/auxiliary/util/u_linear.h | 31 +++++++++++++++++++++++++++++++
2 files changed, 62 insertions(+)
diff --git a/src/gallium/auxiliary/util/u_linear.c b/src/gallium/auxiliary/util/u_linear.c
index 6be365e53b..a1dce3f5cf 100644
--- a/src/gallium/auxiliary/util/u_linear.c
+++ b/src/gallium/auxiliary/util/u_linear.c
@@ -1,3 +1,34 @@
+/**************************************************************************
+ *
+ * Copyright 2009 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+/**
+ * Functions for converting tiled data to linear and vice versa.
+ */
+
#include "util/u_debug.h"
#include "u_linear.h"
diff --git a/src/gallium/auxiliary/util/u_linear.h b/src/gallium/auxiliary/util/u_linear.h
index 1589f029bc..b74308ffa3 100644
--- a/src/gallium/auxiliary/util/u_linear.h
+++ b/src/gallium/auxiliary/util/u_linear.h
@@ -1,3 +1,34 @@
+/**************************************************************************
+ *
+ * Copyright 2009 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+/**
+ * Functions for converting tiled data to linear and vice versa.
+ */
+
#ifndef U_LINEAR_H
#define U_LINEAR_H
--
cgit v1.2.3
From 725d50601c2c010ce427a23a6e023f79df8a3a22 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Wed, 22 Apr 2009 16:38:04 -0600
Subject: mesa: fix comment typo
---
src/mesa/main/pixel.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c
index 52781e048e..57ae9c721a 100644
--- a/src/mesa/main/pixel.c
+++ b/src/mesa/main/pixel.c
@@ -819,7 +819,7 @@ update_image_transfer_state(GLcontext *ctx)
/**
- * Update meas pixel transfer derived state.
+ * Update mesa pixel transfer derived state.
*/
void _mesa_update_pixel( GLcontext *ctx, GLuint new_state )
{
--
cgit v1.2.3
From 6b0c9366a3f13d74c00666cb7c26b65732f6b1aa Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Wed, 22 Apr 2009 16:41:05 -0600
Subject: mesa: minor state-update changes in histogram code
Call FLUSH_VERTICES() in _mesa_Histogram().
No need to signal _NEW_PIXEL in ResetHistogram(), ResetMinmax().
---
src/mesa/main/histogram.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/src/mesa/main/histogram.c b/src/mesa/main/histogram.c
index 905c1ad830..5fee4fd0e3 100644
--- a/src/mesa/main/histogram.c
+++ b/src/mesa/main/histogram.c
@@ -975,6 +975,8 @@ _mesa_Histogram(GLenum target, GLsizei width, GLenum internalFormat, GLboolean s
}
}
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+
/* reset histograms */
for (i = 0; i < HISTOGRAM_TABLE_SIZE; i++) {
ctx->Histogram.Count[i][0] = 0;
@@ -1002,8 +1004,6 @@ _mesa_Histogram(GLenum target, GLsizei width, GLenum internalFormat, GLboolean s
ctx->Histogram.AlphaSize = 8 * sizeof(GLuint);
ctx->Histogram.LuminanceSize = 8 * sizeof(GLuint);
}
-
- ctx->NewState |= _NEW_PIXEL;
}
@@ -1058,8 +1058,6 @@ _mesa_ResetHistogram(GLenum target)
ctx->Histogram.Count[i][2] = 0;
ctx->Histogram.Count[i][3] = 0;
}
-
- ctx->NewState |= _NEW_PIXEL;
}
@@ -1083,7 +1081,6 @@ _mesa_ResetMinmax(GLenum target)
ctx->MinMax.Min[GCOMP] = 1000; ctx->MinMax.Max[GCOMP] = -1000;
ctx->MinMax.Min[BCOMP] = 1000; ctx->MinMax.Max[BCOMP] = -1000;
ctx->MinMax.Min[ACOMP] = 1000; ctx->MinMax.Max[ACOMP] = -1000;
- ctx->NewState |= _NEW_PIXEL;
}
--
cgit v1.2.3
From 17ee25ba6f846d08521f22c5ec2a6e59a5383cf4 Mon Sep 17 00:00:00 2001
From: Michel Dänzer
Date: Thu, 23 Apr 2009 12:17:28 +0100
Subject: gallium: Fix up xorg state tracker build.
---
src/gallium/state_trackers/xorg/xorg_dri2.c | 2 --
src/gallium/state_trackers/xorg/xorg_exa.c | 1 -
2 files changed, 3 deletions(-)
diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c
index d04204e1bf..0d29b1e572 100644
--- a/src/gallium/state_trackers/xorg/xorg_dri2.c
+++ b/src/gallium/state_trackers/xorg/xorg_dri2.c
@@ -85,7 +85,6 @@ driCreateBuffers(DrawablePtr pDraw, unsigned int *attachments, int count)
memset(&template, 0, sizeof(template));
template.target = PIPE_TEXTURE_2D;
- template.compressed = 0;
template.format = PIPE_FORMAT_S8Z24_UNORM;
pf_get_block(template.format, &template.block);
template.width[0] = pDraw->width;
@@ -98,7 +97,6 @@ driCreateBuffers(DrawablePtr pDraw, unsigned int *attachments, int count)
struct pipe_texture template;
memset(&template, 0, sizeof(template));
template.target = PIPE_TEXTURE_2D;
- template.compressed = 0;
template.format = PIPE_FORMAT_A8R8G8B8_UNORM;
pf_get_block(template.format, &template.block);
template.width[0] = pDraw->width;
diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c
index 56c8fdccb2..ee61de1ea7 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa.c
+++ b/src/gallium/state_trackers/xorg/xorg_exa.c
@@ -425,7 +425,6 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height,
memset(&template, 0, sizeof(template));
template.target = PIPE_TEXTURE_2D;
- template.compressed = 0;
exa_get_pipe_format(depth, &template.format, &bitsPerPixel);
pf_get_block(template.format, &template.block);
template.width[0] = width;
--
cgit v1.2.3
From 49ba80dff335226a54dae60477b256384005b393 Mon Sep 17 00:00:00 2001
From: Michel Dänzer
Date: Thu, 23 Apr 2009 12:20:22 +0100
Subject: gallium: Always include xorg-server.h before other X server headers.
Various breakage otherwise, e.g. _XSERVER64 not being defined on 64 bit leading
to inconsistent definitions of X server internal structs.
---
src/gallium/state_trackers/xorg/xorg_dri2.c | 1 +
src/gallium/state_trackers/xorg/xorg_exa.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c
index 0d29b1e572..401bd39dac 100644
--- a/src/gallium/state_trackers/xorg/xorg_dri2.c
+++ b/src/gallium/state_trackers/xorg/xorg_dri2.c
@@ -28,6 +28,7 @@
*
*/
+#include "xorg-server.h"
#include "xf86.h"
#include "xf86_OSproc.h"
diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c
index ee61de1ea7..d743e1e300 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa.c
+++ b/src/gallium/state_trackers/xorg/xorg_exa.c
@@ -28,6 +28,7 @@
*
*/
+#include "xorg-server.h"
#include "xf86.h"
#include "xorg_tracker.h"
--
cgit v1.2.3
From 13cb8264d81f09ce046c73fd751596572d13512e Mon Sep 17 00:00:00 2001
From: Michel Dänzer
Date: Thu, 23 Apr 2009 12:57:46 +0100
Subject: gallium/intel/gem: Use softpipe rather than i915simple if
INTEL_SOFTPIPE is set.
---
src/gallium/drivers/softpipe/sp_texture.c | 19 +++++++++++++++++++
src/gallium/drivers/softpipe/sp_winsys.h | 6 ++++++
src/gallium/winsys/drm/intel/gem/intel_be_context.c | 14 ++++++++------
src/gallium/winsys/drm/intel/gem/intel_be_device.c | 7 ++++++-
src/gallium/winsys/drm/intel/xorg/Makefile | 3 ++-
5 files changed, 41 insertions(+), 8 deletions(-)
diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c
index c0113c47ad..9e19745889 100644
--- a/src/gallium/drivers/softpipe/sp_texture.c
+++ b/src/gallium/drivers/softpipe/sp_texture.c
@@ -399,3 +399,22 @@ softpipe_init_screen_texture_funcs(struct pipe_screen *screen)
screen->transfer_map = softpipe_transfer_map;
screen->transfer_unmap = softpipe_transfer_unmap;
}
+
+
+boolean
+softpipe_get_texture_buffer( struct pipe_texture *texture,
+ struct pipe_buffer **buf,
+ unsigned *stride )
+{
+ struct softpipe_texture *tex = (struct softpipe_texture *)texture;
+
+ if (!tex)
+ return FALSE;
+
+ pipe_buffer_reference(buf, tex->buffer);
+
+ if (stride)
+ *stride = tex->stride[0];
+
+ return TRUE;
+}
diff --git a/src/gallium/drivers/softpipe/sp_winsys.h b/src/gallium/drivers/softpipe/sp_winsys.h
index cf91e7782b..9e571862b7 100644
--- a/src/gallium/drivers/softpipe/sp_winsys.h
+++ b/src/gallium/drivers/softpipe/sp_winsys.h
@@ -52,6 +52,12 @@ struct pipe_screen *
softpipe_create_screen(struct pipe_winsys *);
+boolean
+softpipe_get_texture_buffer( struct pipe_texture *texture,
+ struct pipe_buffer **buf,
+ unsigned *stride );
+
+
#ifdef __cplusplus
}
#endif
diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_context.c b/src/gallium/winsys/drm/intel/gem/intel_be_context.c
index bb6f1b916c..cfe8c88466 100644
--- a/src/gallium/winsys/drm/intel/gem/intel_be_context.c
+++ b/src/gallium/winsys/drm/intel/gem/intel_be_context.c
@@ -1,6 +1,8 @@
#include "pipe/p_screen.h"
+#include "softpipe/sp_winsys.h"
+
#include "intel_be_device.h"
#include "intel_be_context.h"
#include "intel_be_batchbuffer.h"
@@ -106,13 +108,13 @@ intel_be_create_context(struct pipe_screen *screen)
intel_be_init_context(intel, device);
-#if 0
- pipe = intel_create_softpipe(intel, screen->winsys);
-#else
- pipe = i915_create_context(screen, &device->base, &intel->base);
-#endif
+ if (getenv("INTEL_SOFTPIPE"))
+ pipe = softpipe_create(screen);
+ else
+ pipe = i915_create_context(screen, &device->base, &intel->base);
- pipe->priv = intel;
+ if (pipe)
+ pipe->priv = intel;
return pipe;
}
diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_device.c b/src/gallium/winsys/drm/intel/gem/intel_be_device.c
index 0f6300323b..8979f0ae15 100644
--- a/src/gallium/winsys/drm/intel/gem/intel_be_device.c
+++ b/src/gallium/winsys/drm/intel/gem/intel_be_device.c
@@ -10,6 +10,7 @@
#include "intel_be_fence.h"
#include "i915simple/i915_winsys.h"
+#include "softpipe/sp_winsys.h"
#include "intel_be_api.h"
@@ -302,7 +303,11 @@ intel_be_create_screen(int drmFD, int deviceID)
intel_be_init_device(dev, drmFD, deviceID);
- screen = i915_create_screen(&dev->base, deviceID);
+ if (getenv("INTEL_SOFTPIPE")) {
+ screen = softpipe_create_screen(&dev->base);
+ drm_api_hooks.buffer_from_texture = softpipe_get_texture_buffer;
+ } else
+ screen = i915_create_screen(&dev->base, deviceID);
return screen;
}
diff --git a/src/gallium/winsys/drm/intel/xorg/Makefile b/src/gallium/winsys/drm/intel/xorg/Makefile
index a45ca570db..b1b6b9362b 100644
--- a/src/gallium/winsys/drm/intel/xorg/Makefile
+++ b/src/gallium/winsys/drm/intel/xorg/Makefile
@@ -21,6 +21,7 @@ LIBS = \
$(GALLIUMDIR)/state_trackers/xorg/libxorgtracker.a \
$(GALLIUMDIR)/winsys/drm/intel/gem/libinteldrm.a \
$(TOP)/src/gallium/drivers/i915simple/libi915simple.a \
+ $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
$(GALLIUM_AUXILIARIES)
#############################################
@@ -29,7 +30,7 @@ LIBS = \
all default: $(TARGET)
-$(TARGET): $(OBJECTS) Makefile $(GALLIUMDIR)/state_trackers/xorg/libxorgtracker.a
+$(TARGET): $(OBJECTS) Makefile $(GALLIUMDIR)/state_trackers/xorg/libxorgtracker.a $(LIBS)
$(TOP)/bin/mklib -noprefix -o $@ \
$(OBJECTS) $(LIBS) $(shell pkg-config --libs libdrm) -ldrm_intel
--
cgit v1.2.3
From e0da812c5bdb7ffdd3450f614a4b73e44cd7feca Mon Sep 17 00:00:00 2001
From: Michel Dänzer
Date: Thu, 23 Apr 2009 13:19:56 +0100
Subject: gallium: Make the intel xorg winsys start up with any Intel chipset.
For unsupported devices the screen/context creation should fail cleanly later
on.
---
src/gallium/winsys/drm/intel/xorg/intel_xorg.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/src/gallium/winsys/drm/intel/xorg/intel_xorg.c b/src/gallium/winsys/drm/intel/xorg/intel_xorg.c
index aea39247e5..46a7971f60 100644
--- a/src/gallium/winsys/drm/intel/xorg/intel_xorg.c
+++ b/src/gallium/winsys/drm/intel/xorg/intel_xorg.c
@@ -37,20 +37,17 @@ static Bool intel_xorg_pci_probe(DriverPtr driver,
intptr_t match_data);
static const struct pci_id_match intel_xorg_device_match[] = {
- {0x8086, 0x2592, 0xffff, 0xffff, 0, 0, 0},
- {0x8086, 0x27A2, 0xffff, 0xffff, 0, 0, 0},
+ {0x8086, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, 0, 0, 0},
{0, 0, 0},
};
static SymTabRec intel_xorg_chipsets[] = {
- {0x2592, "Intel Graphics Device"},
- {0x27A2, "Intel Graphics Device"},
+ {PCI_MATCH_ANY, "Intel Graphics Device"},
{-1, NULL}
};
static PciChipsets intel_xorg_pci_devices[] = {
- {0x2592, 0x2592, RES_SHARED_VGA},
- {0x27A2, 0x27A2, RES_SHARED_VGA},
+ {PCI_MATCH_ANY, PCI_MATCH_ANY, RES_SHARED_VGA},
{-1, -1, RES_UNDEFINED}
};
--
cgit v1.2.3
From f3c7d6ff866cdd96cdd55baee94f58698a9656a3 Mon Sep 17 00:00:00 2001
From: Michel Dänzer
Date: Thu, 23 Apr 2009 14:47:31 +0100
Subject: gallium: Handle non-NULL data pointer in EXA ModifyPixmapHeader hook.
Need to use the data pointed to for pixmap contents in that case.
Fixes RENDER based text rendering.
---
src/gallium/state_trackers/xorg/xorg_exa.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c
index d743e1e300..7913174354 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa.c
+++ b/src/gallium/state_trackers/xorg/xorg_exa.c
@@ -37,6 +37,8 @@
#include "pipe/p_state.h"
#include "pipe/p_inlines.h"
+#include "util/u_rect.h"
+
struct exa_entity
{
ExaDriverPtr pExa;
@@ -436,6 +438,18 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height,
priv->tex = exa->scrn->texture_create(exa->scrn, &template);
}
+ if (pPixData) {
+ struct pipe_transfer *transfer =
+ exa->scrn->get_tex_transfer(exa->scrn, priv->tex, 0, 0, 0,
+ PIPE_TRANSFER_WRITE,
+ 0, 0, width, height);
+ pipe_copy_rect(exa->scrn->transfer_map(exa->scrn, transfer),
+ &priv->tex->block, transfer->stride, 0, 0,
+ width, height, pPixData, pPixmap->devKind, 0, 0);
+ exa->scrn->transfer_unmap(exa->scrn, transfer);
+ exa->scrn->tex_transfer_destroy(transfer);
+ }
+
return TRUE;
}
--
cgit v1.2.3
From 4f4907d69f9020ce17aef21b6431d2dd65e01982 Mon Sep 17 00:00:00 2001
From: Eric Anholt
Date: Wed, 22 Apr 2009 16:24:42 -0700
Subject: intel: Take advantage of GL_READ_ONLY_ARB to map to GEM bo_map write
flag.
This is a CPU win in general, but in particular reduces the pain of
Mesa's calculation of min/max indices in DrawElements (wtf?).
---
src/mesa/drivers/dri/i965/brw_curbe.c | 4 ++--
src/mesa/drivers/dri/intel/intel_buffer_objects.c | 5 ++---
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c
index 18b187ed1d..03371564e1 100644
--- a/src/mesa/drivers/dri/i965/brw_curbe.c
+++ b/src/mesa/drivers/dri/i965/brw_curbe.c
@@ -353,10 +353,10 @@ update_constant_buffer(struct brw_context *brw,
assert(const_buffer);
assert(const_buffer->size >= size);
- dri_bo_map(const_buffer, GL_TRUE);
+ drm_intel_gem_bo_map_gtt(const_buffer);
map = const_buffer->virtual;
memcpy(map, params->ParameterValues, size);
- dri_bo_unmap(const_buffer);
+ drm_intel_gem_bo_unmap_gtt(const_buffer);
if (0) {
int i;
diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
index b7c7eeb368..c849e4869e 100644
--- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c
+++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
@@ -204,9 +204,8 @@ intel_bufferobj_map(GLcontext * ctx,
{
struct intel_context *intel = intel_context(ctx);
struct intel_buffer_object *intel_obj = intel_buffer_object(obj);
+ GLboolean read_only = (access == GL_READ_ONLY_ARB);
- /* XXX: Translate access to flags arg below:
- */
assert(intel_obj);
if (intel_obj->region)
@@ -217,7 +216,7 @@ intel_bufferobj_map(GLcontext * ctx,
return NULL;
}
- dri_bo_map(intel_obj->buffer, GL_TRUE);
+ dri_bo_map(intel_obj->buffer, !read_only);
obj->Pointer = intel_obj->buffer->virtual;
return obj->Pointer;
}
--
cgit v1.2.3
From 8374379572d1c541a804990bc926108360f67c02 Mon Sep 17 00:00:00 2001
From: Eric Anholt
Date: Thu, 23 Apr 2009 09:37:55 -0700
Subject: i965: Support drawing to FBO cube faces other than positive X.
Also fixes drawing to 3D texture depth levels.
---
src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index 71840d1e4e..805df8a4af 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -520,6 +520,7 @@ brw_update_renderbuffer_surface(struct brw_context *brw,
GLubyte color_mask[4];
GLboolean color_blend;
uint32_t tiling;
+ uint32_t draw_offset;
} key;
memset(&key, 0, sizeof(key));
@@ -550,6 +551,7 @@ brw_update_renderbuffer_surface(struct brw_context *brw,
key.height = region->height;
key.pitch = region->pitch;
key.cpp = region->cpp;
+ key.draw_offset = region->draw_offset; /* cur 3d or cube face offset */
} else {
key.surface_type = BRW_SURFACE_NULL;
key.surface_format = BRW_SURFACEFORMAT_B8G8R8A8_UNORM;
@@ -557,6 +559,7 @@ brw_update_renderbuffer_surface(struct brw_context *brw,
key.width = 1;
key.height = 1;
key.cpp = 4;
+ key.draw_offset = 0;
}
memcpy(key.color_mask, ctx->Color.ColorMask,
sizeof(key.color_mask));
@@ -578,8 +581,9 @@ brw_update_renderbuffer_surface(struct brw_context *brw,
surf.ss0.surface_format = key.surface_format;
surf.ss0.surface_type = key.surface_type;
+ surf.ss1.base_addr = key.draw_offset;
if (region_bo != NULL)
- surf.ss1.base_addr = region_bo->offset; /* reloc */
+ surf.ss1.base_addr += region_bo->offset; /* reloc */
surf.ss2.width = key.width - 1;
surf.ss2.height = key.height - 1;
@@ -604,12 +608,12 @@ brw_update_renderbuffer_surface(struct brw_context *brw,
* them both. We might be able to figure out from other state
* a more restrictive relocation to emit.
*/
- dri_bo_emit_reloc(brw->wm.surf_bo[unit],
- I915_GEM_DOMAIN_RENDER,
- I915_GEM_DOMAIN_RENDER,
- 0,
- offsetof(struct brw_surface_state, ss1),
- region_bo);
+ drm_intel_bo_emit_reloc(brw->wm.surf_bo[unit],
+ offsetof(struct brw_surface_state, ss1),
+ region_bo,
+ key.draw_offset,
+ I915_GEM_DOMAIN_RENDER,
+ I915_GEM_DOMAIN_RENDER);
}
}
}
--
cgit v1.2.3
From ae69a046505d8c94cd3a59a9376310a904c35b3c Mon Sep 17 00:00:00 2001
From: Roland Scheidegger
Date: Thu, 23 Apr 2009 21:55:25 +0200
Subject: i915: fix fix for anisotropic filtering
forgot to commit the changes to actually support 4x aniso filtering...
---
src/mesa/drivers/dri/i915/i915_texstate.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c
index 43f65392b5..a37dd7f4fb 100644
--- a/src/mesa/drivers/dri/i915/i915_texstate.c
+++ b/src/mesa/drivers/dri/i915/i915_texstate.c
@@ -132,7 +132,7 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
struct intel_texture_object *intelObj = intel_texture_object(tObj);
struct gl_texture_image *firstImage;
GLuint *state = i915->state.Tex[unit], format, pitch;
- GLint lodbias;
+ GLint lodbias, aniso = 0;
GLubyte border[4];
memset(state, 0, sizeof(state));
@@ -230,6 +230,10 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
if (tObj->MaxAnisotropy > 1.0) {
minFilt = FILTER_ANISOTROPIC;
magFilt = FILTER_ANISOTROPIC;
+ if (tObj->MaxAnisotropy > 2.0)
+ aniso = SS2_MAX_ANISO_4;
+ else
+ aniso = SS2_MAX_ANISO_2;
}
else {
switch (tObj->MagFilter) {
@@ -275,7 +279,8 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
state[I915_TEXREG_SS2] |= ((minFilt << SS2_MIN_FILTER_SHIFT) |
(mipFilt << SS2_MIP_FILTER_SHIFT) |
- (magFilt << SS2_MAG_FILTER_SHIFT));
+ (magFilt << SS2_MAG_FILTER_SHIFT) |
+ aniso);
}
{
--
cgit v1.2.3
From a9a363f8298e9d534e60e3d2869f8677138a1e7e Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Thu, 23 Apr 2009 17:41:23 -0600
Subject: i965: revert part of commit 4f4907d69f9020ce17aef21b6431d2dd65e01982
The drm_intel_gem_bo_map_gtt() call that replaced dri_bo_map() is
producing errors like:
intel_bufmgr_gem.c:689: Error preparing buffer map 39 (vp_const_buffer): Invalid argument .
and returning NULL, causing a segfault in the memcpy().
Just reverting until we can get to the root issue...
---
src/mesa/drivers/dri/i965/brw_curbe.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c
index 03371564e1..18b187ed1d 100644
--- a/src/mesa/drivers/dri/i965/brw_curbe.c
+++ b/src/mesa/drivers/dri/i965/brw_curbe.c
@@ -353,10 +353,10 @@ update_constant_buffer(struct brw_context *brw,
assert(const_buffer);
assert(const_buffer->size >= size);
- drm_intel_gem_bo_map_gtt(const_buffer);
+ dri_bo_map(const_buffer, GL_TRUE);
map = const_buffer->virtual;
memcpy(map, params->ParameterValues, size);
- drm_intel_gem_bo_unmap_gtt(const_buffer);
+ dri_bo_unmap(const_buffer);
if (0) {
int i;
--
cgit v1.2.3
From 1d0039959302fddd560dc7f9642f312e588cce0e Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Thu, 23 Apr 2009 17:54:34 -0600
Subject: mesa: more informative error messages
---
src/mesa/main/texparam.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index 515a35cdfc..e60ab6aa12 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -69,7 +69,7 @@ validate_texture_wrap_mode(GLcontext * ctx, GLenum target, GLenum wrap)
return GL_TRUE;
}
- _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
+ _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param=0x%x)", wrap );
return GL_FALSE;
}
@@ -209,7 +209,8 @@ set_tex_parameteri(GLcontext *ctx,
}
/* fall-through */
default:
- _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
+ _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param=0x%x)",
+ params[0] );
}
return GL_FALSE;
@@ -223,7 +224,8 @@ set_tex_parameteri(GLcontext *ctx,
texObj->MagFilter = params[0];
return GL_TRUE;
default:
- _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
+ _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param=0x%x)",
+ params[0]);
}
return GL_FALSE;
@@ -262,7 +264,8 @@ set_tex_parameteri(GLcontext *ctx,
return GL_FALSE;
if (params[0] < 0 ||
(texObj->Target == GL_TEXTURE_RECTANGLE_ARB && params[0] != 0)) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)");
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glTexParameter(param=%d)", params[0]);
return GL_FALSE;
}
flush(ctx, texObj);
@@ -273,7 +276,8 @@ set_tex_parameteri(GLcontext *ctx,
if (texObj->MaxLevel == params[0])
return GL_FALSE;
if (params[0] < 0 || texObj->Target == GL_TEXTURE_RECTANGLE_ARB) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glTexParameter(param)");
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glTexParameter(param=%d)", params[0]);
return GL_FALSE;
}
flush(ctx, texObj);
@@ -340,7 +344,7 @@ set_tex_parameteri(GLcontext *ctx,
}
}
else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(param)");
+ _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=0x%x)", pname);
}
return GL_FALSE;
--
cgit v1.2.3
From ff71587b27beaf288d535e14c75e58425d7efc7a Mon Sep 17 00:00:00 2001
From: Roland Scheidegger
Date: Thu, 23 Apr 2009 23:41:41 +0200
Subject: i965: fix point size issue
need to clamp point size to user set min/max values, even for constant
point size. Fixes glean pointAtten test.
---
src/mesa/drivers/dri/i965/brw_sf_state.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/mesa/drivers/dri/i965/brw_sf_state.c b/src/mesa/drivers/dri/i965/brw_sf_state.c
index fc4eddda0a..68fa9820b6 100644
--- a/src/mesa/drivers/dri/i965/brw_sf_state.c
+++ b/src/mesa/drivers/dri/i965/brw_sf_state.c
@@ -147,7 +147,7 @@ sf_unit_populate_key(struct brw_context *brw, struct brw_sf_unit_key *key)
key->line_smooth = ctx->Line.SmoothFlag;
key->point_sprite = ctx->Point.PointSprite;
- key->point_size = ctx->Point.Size;
+ key->point_size = CLAMP(ctx->Point.Size, ctx->Point.MinSize, ctx->Point.MaxSize);
key->point_attenuated = ctx->Point._Attenuated;
key->render_to_fbo = brw->intel.ctx.DrawBuffer->Name != 0;
--
cgit v1.2.3
From 510a44eea799f2370b79e5da532b3004e94bb005 Mon Sep 17 00:00:00 2001
From: Keith Whitwell
Date: Tue, 21 Apr 2009 19:49:29 +0100
Subject: tests/mipmap_view: add a bunch of keystrokes for testing
render-to-texture
Move between mipmaps, render a triangle, reload textures with either
the original arch (and GenMipmaps) or via straightforward glTexImage.
---
progs/tests/mipmap_view.c | 267 +++++++++++++++++++++++++++++++++++++---------
1 file changed, 219 insertions(+), 48 deletions(-)
diff --git a/progs/tests/mipmap_view.c b/progs/tests/mipmap_view.c
index 85fc67ac79..808d348699 100644
--- a/progs/tests/mipmap_view.c
+++ b/progs/tests/mipmap_view.c
@@ -18,12 +18,27 @@
#define TEXTURE_FILE "../images/arch.rgb"
-static int TexWidth = 256, TexHeight = 256;
+#define LEVELS 8
+#define SIZE (1<
Date: Wed, 22 Apr 2009 15:19:44 +0100
Subject: demos/readpix: add option to draw triangle instead of drawpix
---
progs/demos/readpix.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 62 insertions(+), 5 deletions(-)
diff --git a/progs/demos/readpix.c b/progs/demos/readpix.c
index c0aac2272f..bbb3a68eff 100644
--- a/progs/demos/readpix.c
+++ b/progs/demos/readpix.c
@@ -17,6 +17,7 @@
#define IMAGE_FILE "../images/girl.rgb"
static int ImgWidth, ImgHeight;
+static int WinWidth, WinHeight;
static GLenum ImgFormat;
static GLubyte *Image = NULL;
@@ -27,6 +28,7 @@ static int CPosX, CPosY; /* copypixels */
static GLboolean DrawFront = GL_FALSE;
static GLboolean ScaleAndBias = GL_FALSE;
static GLboolean Benchmark = GL_FALSE;
+static GLboolean Triangle = GL_FALSE;
static GLubyte *TempImage = NULL;
#define COMBO 1
@@ -150,11 +152,60 @@ Display( void )
/* draw original image */
glRasterPos2i(APosX, 5);
PrintString("Original");
- glRasterPos2i(APosX, APosY);
- glEnable(GL_DITHER);
- SetupPixelTransfer(GL_FALSE);
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- glDrawPixels(ImgWidth, ImgHeight, ImgFormat, GL_UNSIGNED_BYTE, Image);
+ if (!Triangle) {
+ glRasterPos2i(APosX, APosY);
+ glEnable(GL_DITHER);
+ SetupPixelTransfer(GL_FALSE);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ glDrawPixels(ImgWidth, ImgHeight, ImgFormat, GL_UNSIGNED_BYTE, Image);
+ }
+ else {
+ float z = 0;
+
+ glViewport(APosX, APosY, ImgWidth, ImgHeight);
+ glMatrixMode( GL_PROJECTION );
+ glLoadIdentity();
+ glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
+ glDisable(GL_CULL_FACE);
+
+ /* Red should never be seen
+ */
+ glBegin(GL_POLYGON);
+ glColor3f(1,0,0);
+ glVertex3f(-2, -2, z);
+ glVertex3f(-2, 2, z);
+ glVertex3f(2, 2, z);
+ glVertex3f(2, -2, z);
+ glEnd();
+
+ /* Blue background
+ */
+ glBegin(GL_POLYGON);
+ glColor3f(.5,.5,1);
+ glVertex3f(-1, -1, z);
+ glVertex3f(-1, 1, z);
+ glVertex3f(1, 1, z);
+ glVertex3f(1, -1, z);
+ glEnd();
+
+ /* Triangle
+ */
+ glBegin(GL_TRIANGLES);
+ glColor3f(.8,0,0);
+ glVertex3f(-0.9, -0.9, z);
+ glColor3f(0,.9,0);
+ glVertex3f( 0.9, -0.9, z);
+ glColor3f(0,0,.7);
+ glVertex3f( 0.0, 0.9, z);
+ glEnd();
+
+ glColor3f(1,1,1);
+
+ glViewport( 0, 0, WinWidth, WinHeight );
+ glMatrixMode( GL_PROJECTION );
+ glLoadIdentity();
+ glOrtho( 0.0, WinWidth, 0.0, WinHeight, -1.0, 1.0 );
+ }
/* might try alignment=4 here for testing */
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
@@ -218,6 +269,9 @@ Display( void )
static void
Reshape( int width, int height )
{
+ WinWidth = width;
+ WinHeight = height;
+
glViewport( 0, 0, width, height );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
@@ -236,6 +290,9 @@ Key( unsigned char key, int x, int y )
case 'b':
Benchmark = GL_TRUE;
break;
+ case 't':
+ Triangle = !Triangle;
+ break;
case 's':
ScaleAndBias = !ScaleAndBias;
break;
--
cgit v1.2.3
From f4a286e5f5ac11b2e5266ef39db5d1d1cb5f77ce Mon Sep 17 00:00:00 2001
From: Jakob Bornecrantz
Date: Thu, 23 Apr 2009 05:42:26 +0200
Subject: util: Add more entry points for dumping to bmp
---
src/gallium/auxiliary/util/u_debug.c | 56 ++++++++++++++++++++++++------------
src/gallium/auxiliary/util/u_debug.h | 5 ++++
2 files changed, 43 insertions(+), 18 deletions(-)
diff --git a/src/gallium/auxiliary/util/u_debug.c b/src/gallium/auxiliary/util/u_debug.c
index ae47a274a6..18597ef839 100644
--- a/src/gallium/auxiliary/util/u_debug.c
+++ b/src/gallium/auxiliary/util/u_debug.c
@@ -721,6 +721,7 @@ void
debug_dump_surface_bmp(const char *filename,
struct pipe_surface *surface)
{
+#ifndef PIPE_SUBSYSTEM_WINDOWS_MINIPORT
struct pipe_transfer *transfer;
struct pipe_texture *texture = surface->texture;
struct pipe_screen *screen = texture->screen;
@@ -733,6 +734,7 @@ debug_dump_surface_bmp(const char *filename,
debug_dump_transfer_bmp(filename, transfer);
screen->tex_transfer_destroy(transfer);
+#endif
}
void
@@ -740,32 +742,56 @@ debug_dump_transfer_bmp(const char *filename,
struct pipe_transfer *transfer)
{
#ifndef PIPE_SUBSYSTEM_WINDOWS_MINIPORT
- struct util_stream *stream;
- struct bmp_file_header bmfh;
- struct bmp_info_header bmih;
float *rgba;
- unsigned x, y;
if (!transfer)
goto error1;
rgba = MALLOC(transfer->width*transfer->height*4*sizeof(float));
+ if(!rgba)
+ goto error1;
+
+ pipe_get_tile_rgba(transfer, 0, 0,
+ transfer->width, transfer->height,
+ rgba);
+
+ debug_dump_float_rgba_bmp(filename,
+ transfer->width, transfer->height,
+ rgba, transfer->width);
+
+ FREE(rgba);
+error1:
+ ;
+#endif
+}
+
+void
+debug_dump_float_rgba_bmp(const char *filename,
+ unsigned width, unsigned height,
+ float *rgba, unsigned stride)
+{
+#ifndef PIPE_SUBSYSTEM_WINDOWS_MINIPORT
+ struct util_stream *stream;
+ struct bmp_file_header bmfh;
+ struct bmp_info_header bmih;
+ unsigned x, y;
+
if(!rgba)
goto error1;
bmfh.bfType = 0x4d42;
- bmfh.bfSize = 14 + 40 + transfer->height*transfer->width*4;
+ bmfh.bfSize = 14 + 40 + height*width*4;
bmfh.bfReserved1 = 0;
bmfh.bfReserved2 = 0;
bmfh.bfOffBits = 14 + 40;
bmih.biSize = 40;
- bmih.biWidth = transfer->width;
- bmih.biHeight = transfer->height;
+ bmih.biWidth = width;
+ bmih.biHeight = height;
bmih.biPlanes = 1;
bmih.biBitCount = 32;
bmih.biCompression = 0;
- bmih.biSizeImage = transfer->height*transfer->width*4;
+ bmih.biSizeImage = height*width*4;
bmih.biXPelsPerMeter = 0;
bmih.biYPelsPerMeter = 0;
bmih.biClrUsed = 0;
@@ -773,19 +799,15 @@ debug_dump_transfer_bmp(const char *filename,
stream = util_stream_create(filename, bmfh.bfSize);
if(!stream)
- goto error2;
+ goto error1;
util_stream_write(stream, &bmfh, 14);
util_stream_write(stream, &bmih, 40);
- pipe_get_tile_rgba(transfer, 0, 0,
- transfer->width, transfer->height,
- rgba);
-
- y = transfer->height;
+ y = height;
while(y--) {
- float *ptr = rgba + (transfer->width * y * 4);
- for(x = 0; x < transfer->width; ++x)
+ float *ptr = rgba + (stride * y * 4);
+ for(x = 0; x < width; ++x)
{
struct bmp_rgb_quad pixel;
pixel.rgbRed = float_to_ubyte(ptr[x*4 + 0]);
@@ -797,8 +819,6 @@ debug_dump_transfer_bmp(const char *filename,
}
util_stream_close(stream);
-error2:
- FREE(rgba);
error1:
;
#endif
diff --git a/src/gallium/auxiliary/util/u_debug.h b/src/gallium/auxiliary/util/u_debug.h
index 8d703e47fc..bcd8f0f3cf 100644
--- a/src/gallium/auxiliary/util/u_debug.h
+++ b/src/gallium/auxiliary/util/u_debug.h
@@ -347,10 +347,15 @@ void debug_dump_surface_bmp(const char *filename,
struct pipe_surface *surface);
void debug_dump_transfer_bmp(const char *filename,
struct pipe_transfer *transfer);
+void debug_dump_float_rgba_bmp(const char *filename,
+ unsigned width, unsigned height,
+ float *rgba, unsigned stride);
#else
#define debug_dump_image(prefix, format, cpp, width, height, stride, data) ((void)0)
#define debug_dump_surface(prefix, surface) ((void)0)
#define debug_dump_surface_bmp(filename, surface) ((void)0)
+#define debug_dump_transfer_bmp(filename, transfer) ((void)0)
+#define debug_dump_rgba_float_bmp(filename, width, height, rgba, stride) ((void)0)
#endif
--
cgit v1.2.3
From a86ef37655c25e0e5a7cb0e41ba7b1c2dcdc1a90 Mon Sep 17 00:00:00 2001
From: Keith Whitwell
Date: Fri, 24 Apr 2009 12:16:29 +0100
Subject: shadowtex: fflush stdout for cygwin
---
progs/demos/shadowtex.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/progs/demos/shadowtex.c b/progs/demos/shadowtex.c
index f10a01ec26..dc5a4bbc48 100644
--- a/progs/demos/shadowtex.c
+++ b/progs/demos/shadowtex.c
@@ -788,6 +788,7 @@ Key(unsigned char key, int x, int y)
exit(0);
break;
}
+ fflush(stdout);
glutPostRedisplay();
}
@@ -1014,6 +1015,7 @@ PrintHelp(void)
printf(" + cursor keys = rotate light source\n");
if (HaveEXTshadowFuncs)
printf(" o = cycle through comparison modes\n");
+ fflush(stdout);
}
--
cgit v1.2.3
From 29d9abf72d73c4ccd3ad605f68ab1adf5e13c67a Mon Sep 17 00:00:00 2001
From: Keith Whitwell
Date: Fri, 24 Apr 2009 12:43:04 +0100
Subject: pipebuffer: don't fail when validating mapped buffers
This can be almost impossible to avoid - hopefully we won't encounter
a situation where this is a true requirement. Would probably require
drivers to flush between hardware and software vertex processing.
---
src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
index 2cd0b8a8cd..044e8e1dd3 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
@@ -365,21 +365,22 @@ fenced_buffer_validate(struct pb_buffer *buf,
if(fenced_buf->vl && fenced_buf->vl != vl)
return PIPE_ERROR_RETRY;
+#if 0
/* Do not validate if buffer is still mapped */
if(fenced_buf->flags & PIPE_BUFFER_USAGE_CPU_READ_WRITE) {
/* TODO: wait for the thread that mapped the buffer to unmap it */
return PIPE_ERROR_RETRY;
}
+ /* Final sanity checking */
+ assert(!(fenced_buf->flags & PIPE_BUFFER_USAGE_CPU_READ_WRITE));
+ assert(!fenced_buf->mapcount);
+#endif
if(fenced_buf->vl == vl &&
(fenced_buf->validation_flags & flags) == flags) {
/* Nothing to do -- buffer already validated */
return PIPE_OK;
}
-
- /* Final sanity checking */
- assert(!(fenced_buf->flags & PIPE_BUFFER_USAGE_CPU_READ_WRITE));
- assert(!fenced_buf->mapcount);
ret = pb_validate(fenced_buf->buffer, vl, flags);
if (ret != PIPE_OK)
--
cgit v1.2.3
From 027ed1b505a1bf6e3f5ad4412734d7edf337c08b Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Fri, 24 Apr 2009 09:43:44 -0600
Subject: mesa: signal _NEW_PROGRAM_CONSTANTS instead of _NEW_PROGRAM
Use _NEW_PROGRAM_CONSTANTS when changing constant/uniform buffer values.
Binding a new program/shader sets both _NEW_PROGRAM and _NEW_PROGRAM_CONSTANTS.
---
src/mesa/shader/arbprogram.c | 13 +++++++------
src/mesa/shader/nvprogram.c | 2 +-
src/mesa/shader/shader_api.c | 6 +++---
3 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/src/mesa/shader/arbprogram.c b/src/mesa/shader/arbprogram.c
index 981565ab8f..317d623a22 100644
--- a/src/mesa/shader/arbprogram.c
+++ b/src/mesa/shader/arbprogram.c
@@ -74,8 +74,6 @@ _mesa_BindProgram(GLenum target, GLuint id)
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
- FLUSH_VERTICES(ctx, _NEW_PROGRAM);
-
/* Error-check target and get curProg */
if ((target == GL_VERTEX_PROGRAM_ARB) && /* == GL_VERTEX_PROGRAM_NV */
(ctx->Extensions.NV_vertex_program ||
@@ -132,6 +130,9 @@ _mesa_BindProgram(GLenum target, GLuint id)
return;
}
+ /* signal new program (and its new constants) */
+ FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS);
+
/* bind newProg */
if (target == GL_VERTEX_PROGRAM_ARB) { /* == GL_VERTEX_PROGRAM_NV */
_mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current,
@@ -489,7 +490,7 @@ _mesa_ProgramEnvParameter4fARB(GLenum target, GLuint index,
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
- FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS);
+ FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS);
if (target == GL_FRAGMENT_PROGRAM_ARB
&& ctx->Extensions.ARB_fragment_program) {
@@ -537,7 +538,7 @@ _mesa_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
GLfloat * dest;
ASSERT_OUTSIDE_BEGIN_END(ctx);
- FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS);
+ FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS);
if (count <= 0) {
_mesa_error(ctx, GL_INVALID_VALUE, "glProgramEnvParameters4fv(count)");
@@ -631,7 +632,7 @@ _mesa_ProgramLocalParameter4fARB(GLenum target, GLuint index,
struct gl_program *prog;
ASSERT_OUTSIDE_BEGIN_END(ctx);
- FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS);
+ FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS);
if ((target == GL_FRAGMENT_PROGRAM_NV
&& ctx->Extensions.NV_fragment_program) ||
@@ -685,7 +686,7 @@ _mesa_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
GLint i;
ASSERT_OUTSIDE_BEGIN_END(ctx);
- FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS);
+ FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS);
if (count <= 0) {
_mesa_error(ctx, GL_INVALID_VALUE, "glProgramLocalParameters4fv(count)");
diff --git a/src/mesa/shader/nvprogram.c b/src/mesa/shader/nvprogram.c
index 5142c2a4a5..8ba521182b 100644
--- a/src/mesa/shader/nvprogram.c
+++ b/src/mesa/shader/nvprogram.c
@@ -706,7 +706,7 @@ _mesa_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte *name,
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
- FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS);
+ FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS);
prog = _mesa_lookup_program(ctx, id);
if (!prog || prog->Target != GL_FRAGMENT_PROGRAM_NV) {
diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c
index 644cd39185..8f414a0889 100644
--- a/src/mesa/shader/shader_api.c
+++ b/src/mesa/shader/shader_api.c
@@ -1487,7 +1487,7 @@ _mesa_use_program(GLcontext *ctx, GLuint program)
return;
}
- FLUSH_VERTICES(ctx, _NEW_PROGRAM);
+ FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS);
if (program) {
shProg = _mesa_lookup_shader_program_err(ctx, program, "glUseProgram");
@@ -1789,7 +1789,7 @@ _mesa_uniform(GLcontext *ctx, GLint location, GLsizei count,
return;
}
- FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS);
+ FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS);
uniform = &shProg->Uniforms->Uniforms[location];
@@ -1929,7 +1929,7 @@ _mesa_uniform_matrix(GLcontext *ctx, GLint cols, GLint rows,
return;
}
- FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS);
+ FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS);
uniform = &shProg->Uniforms->Uniforms[location];
--
cgit v1.2.3
From b2a69ae879a3ddb1f0ca1ea184ba24587cf25786 Mon Sep 17 00:00:00 2001
From: Alan Hourihane
Date: Fri, 24 Apr 2009 16:44:58 +0100
Subject: demos: ensure display lists are destroyed for next generation
---
progs/xdemos/glxcontexts.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/progs/xdemos/glxcontexts.c b/progs/xdemos/glxcontexts.c
index a9ff326ed5..a97b62a908 100644
--- a/progs/xdemos/glxcontexts.c
+++ b/progs/xdemos/glxcontexts.c
@@ -385,6 +385,10 @@ draw( Display *dpy, Window win )
} else
do_draw();
+ glDeleteLists(gear1, 1);
+ glDeleteLists(gear2, 1);
+ glDeleteLists(gear3, 1);
+
glXSwapBuffers(dpy, win);
glXDestroyContext(dpy, ctx);
}
--
cgit v1.2.3
From 3321b6984ecd96ba466d8d010e390fff71a799d7 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Fri, 24 Apr 2009 09:50:11 -0600
Subject: i965: use drm_intel_gem_bo_map/unmap_gtt() when possible, otherwise
dri_bo_subdata()
This wraps up the unfinished business from commit a9a363f8298e9d534e60e3d2869f8677138a1e7e
---
src/mesa/drivers/dri/i965/brw_curbe.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c
index 18b187ed1d..2d15793078 100644
--- a/src/mesa/drivers/dri/i965/brw_curbe.c
+++ b/src/mesa/drivers/dri/i965/brw_curbe.c
@@ -344,19 +344,23 @@ update_constant_buffer(struct brw_context *brw,
const struct gl_program_parameter_list *params,
dri_bo *const_buffer)
{
+ struct intel_context *intel = &brw->intel;
const int size = params->NumParameters * 4 * sizeof(GLfloat);
/* copy Mesa program constants into the buffer */
if (const_buffer && size > 0) {
- GLubyte *map;
assert(const_buffer);
assert(const_buffer->size >= size);
- dri_bo_map(const_buffer, GL_TRUE);
- map = const_buffer->virtual;
- memcpy(map, params->ParameterValues, size);
- dri_bo_unmap(const_buffer);
+ if (intel->intelScreen->kernel_exec_fencing) {
+ drm_intel_gem_bo_map_gtt(const_buffer);
+ memcpy(const_buffer->virtual, params->ParameterValues, size);
+ drm_intel_gem_bo_unmap_gtt(const_buffer);
+ }
+ else {
+ dri_bo_subdata(const_buffer, 0, size, params->ParameterValues);
+ }
if (0) {
int i;
--
cgit v1.2.3
From 1c9786894cc3ce66665ca507a6daf6a829e5af89 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Fri, 24 Apr 2009 10:46:40 -0600
Subject: mesa: fix up error/warning/debug output newlines
As of commit 23ad86cfb91c294ce85a3116d4b825aaa3988a6e all messages go
through output_if_debug().
Add new parameter to output_if_debug() to indicate whether to emit a newline.
_mesa_warning() and _mesa_error() calls should not end their strings with \n.
_mesa_debug() calls should end their text with \n.
---
src/mesa/main/context.c | 2 +-
src/mesa/main/imports.c | 35 ++++++++++++++++++++++++++---------
2 files changed, 27 insertions(+), 10 deletions(-)
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 5726dbd983..4469c8e1fa 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -434,7 +434,7 @@ one_time_init( GLcontext *ctx )
}
#if defined(DEBUG) && defined(__DATE__) && defined(__TIME__)
- _mesa_debug(ctx, "Mesa %s DEBUG build %s %s",
+ _mesa_debug(ctx, "Mesa %s DEBUG build %s %s\n",
MESA_VERSION_STRING, __DATE__, __TIME__);
#endif
diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
index 2ac93a5237..8797f36695 100644
--- a/src/mesa/main/imports.c
+++ b/src/mesa/main/imports.c
@@ -980,7 +980,8 @@ _mesa_vsprintf( char *str, const char *fmt, va_list args )
/*@{*/
static void
-output_if_debug(const char *prefixString, const char *outputString)
+output_if_debug(const char *prefixString, const char *outputString,
+ GLboolean newline)
{
static int debug = -1;
@@ -1004,16 +1005,19 @@ output_if_debug(const char *prefixString, const char *outputString)
/* Now only print the string if we're required to do so. */
if (debug) {
- fprintf(stderr, "%s: %s\n", prefixString, outputString);
+ fprintf(stderr, "%s: %s", prefixString, outputString);
+ if (newline)
+ fprintf(stderr, "\n");
}
}
+
/**
* Report a warning (a recoverable error condition) to stderr if
* either DEBUG is defined or the MESA_DEBUG env var is set.
*
* \param ctx GL context.
- * \param fmtString printf() alike format string.
+ * \param fmtString printf()-like format string.
*/
void
_mesa_warning( GLcontext *ctx, const char *fmtString, ... )
@@ -1025,11 +1029,12 @@ _mesa_warning( GLcontext *ctx, const char *fmtString, ... )
(void) vsnprintf( str, MAXSTRING, fmtString, args );
va_end( args );
- output_if_debug("Mesa warning", str);
+ output_if_debug("Mesa warning", str, GL_TRUE);
}
+
/**
- * Report an internla implementation problem.
+ * Report an internal implementation problem.
* Prints the message to stderr via fprintf().
*
* \param ctx GL context.
@@ -1050,8 +1055,9 @@ _mesa_problem( const GLcontext *ctx, const char *fmtString, ... )
fprintf(stderr, "Please report at bugzilla.freedesktop.org\n");
}
+
/**
- * Record an OpenGL state error. These usually occur when the users
+ * Record an OpenGL state error. These usually occur when the user
* passes invalid parameters to a GL function.
*
* If debugging is enabled (either at compile-time via the DEBUG macro, or
@@ -1123,11 +1129,22 @@ _mesa_error( GLcontext *ctx, GLenum error, const char *fmtString, ... )
errstr = "unknown";
break;
}
- _mesa_debug(ctx, "User error: %s in %s\n", errstr, where);
+
+ {
+ char s[MAXSTRING], s2[MAXSTRING];
+ va_list args;
+ va_start(args, fmtString);
+ vsnprintf(s, MAXSTRING, fmtString, args);
+ va_end(args);
+
+ snprintf(s2, MAXSTRING, "%s in %s", errstr, s);
+ output_if_debug("Mesa: User error", s2, GL_TRUE);
+ }
}
_mesa_record_error(ctx, error);
-}
+}
+
/**
* Report debug information. Print error message to stderr via fprintf().
@@ -1145,7 +1162,7 @@ _mesa_debug( const GLcontext *ctx, const char *fmtString, ... )
va_start(args, fmtString);
vsnprintf(s, MAXSTRING, fmtString, args);
va_end(args);
- output_if_debug("Mesa", s);
+ output_if_debug("Mesa", s, GL_FALSE);
#endif /* DEBUG */
(void) ctx;
(void) fmtString;
--
cgit v1.2.3
From d8d7b2c3955fa2204bb031fea17afae994de79f7 Mon Sep 17 00:00:00 2001
From: Ian Romanick
Date: Mon, 20 Apr 2009 20:52:56 -0700
Subject: DRI2: Implement protocol for DRI2GetBuffersWithFormat
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Ian Romanick
Reviewed-by: Kristian Høgsberg
---
src/glx/x11/dri2.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/glx/x11/dri2.h | 10 ++++++++
2 files changed, 80 insertions(+)
diff --git a/src/glx/x11/dri2.c b/src/glx/x11/dri2.c
index f967432b99..ebb2985924 100644
--- a/src/glx/x11/dri2.c
+++ b/src/glx/x11/dri2.c
@@ -39,6 +39,16 @@
#include "xf86drm.h"
#include "dri2.h"
+/* Allow the build to work with an older versions of dri2proto.h and
+ * dri2tokens.h.
+ */
+#if DRI2_MINOR < 1
+#undef DRI2_MINOR
+#define DRI2_MINOR 1
+#define X_DRI2GetBuffersWithFormat 7
+#endif
+
+
static char dri2ExtensionName[] = DRI2_NAME;
static XExtensionInfo *dri2Info;
static XEXT_GENERATE_CLOSE_DISPLAY (DRI2CloseDisplay, dri2Info)
@@ -276,6 +286,66 @@ DRI2Buffer *DRI2GetBuffers(Display *dpy, XID drawable,
return buffers;
}
+
+DRI2Buffer *DRI2GetBuffersWithFormat(Display *dpy, XID drawable,
+ int *width, int *height,
+ unsigned int *attachments, int count,
+ int *outCount)
+{
+ XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+ xDRI2GetBuffersReply rep;
+ xDRI2GetBuffersReq *req;
+ DRI2Buffer *buffers;
+ xDRI2Buffer repBuffer;
+ CARD32 *p;
+ int i;
+
+ XextCheckExtension (dpy, info, dri2ExtensionName, False);
+
+ LockDisplay(dpy);
+ GetReqExtra(DRI2GetBuffers, count * (4 * 2), req);
+ req->reqType = info->codes->major_opcode;
+ req->dri2ReqType = X_DRI2GetBuffersWithFormat;
+ req->drawable = drawable;
+ req->count = count;
+ p = (CARD32 *) &req[1];
+ for (i = 0; i < (count * 2); i++)
+ p[i] = attachments[i];
+
+ if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NULL;
+ }
+
+ *width = rep.width;
+ *height = rep.height;
+ *outCount = rep.count;
+
+ buffers = Xmalloc(rep.count * sizeof buffers[0]);
+ if (buffers == NULL) {
+ _XEatData(dpy, rep.count * sizeof repBuffer);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NULL;
+ }
+
+ for (i = 0; i < rep.count; i++) {
+ _XReadPad(dpy, (char *) &repBuffer, sizeof repBuffer);
+ buffers[i].attachment = repBuffer.attachment;
+ buffers[i].name = repBuffer.name;
+ buffers[i].pitch = repBuffer.pitch;
+ buffers[i].cpp = repBuffer.cpp;
+ buffers[i].flags = repBuffer.flags;
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ return buffers;
+}
+
+
void DRI2CopyRegion(Display *dpy, XID drawable, XserverRegion region,
CARD32 dest, CARD32 src)
{
diff --git a/src/glx/x11/dri2.h b/src/glx/x11/dri2.h
index 356c6bcb55..b0e61f80d7 100644
--- a/src/glx/x11/dri2.h
+++ b/src/glx/x11/dri2.h
@@ -63,6 +63,16 @@ DRI2GetBuffers(Display *dpy, XID drawable,
unsigned int *attachments, int count,
int *outCount);
+/**
+ * \note
+ * This function is only supported with DRI2 version 1.1 or later.
+ */
+extern DRI2Buffer *
+DRI2GetBuffersWithFormat(Display *dpy, XID drawable,
+ int *width, int *height,
+ unsigned int *attachments, int count,
+ int *outCount);
+
extern void
DRI2CopyRegion(Display *dpy, XID drawable, XserverRegion region,
CARD32 dest, CARD32 src);
--
cgit v1.2.3
From dbf87f23126cc869637575e9ea2cb58774efe888 Mon Sep 17 00:00:00 2001
From: Ian Romanick
Date: Mon, 20 Apr 2009 20:55:56 -0700
Subject: DRI2: Implement interface for drivers to access
DRI2GetBuffersWithFormat
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Ian Romanick
Reviewed-by: Kristian Høgsberg
---
include/GL/internal/dri_interface.h | 28 +++++++++-
src/glx/x11/dri2_glx.c | 104 +++++++++++++++++++++++++++++-------
2 files changed, 112 insertions(+), 20 deletions(-)
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index 335bf62a80..bfa8a33b3c 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -649,6 +649,7 @@ struct __DRIswrastExtensionRec {
#define __DRI_BUFFER_ACCUM 6
#define __DRI_BUFFER_FAKE_FRONT_LEFT 7
#define __DRI_BUFFER_FAKE_FRONT_RIGHT 8
+#define __DRI_BUFFER_DEPTH_STENCIL 9 /**< Only available with DRI2 1.1 */
struct __DRIbufferRec {
unsigned int attachment;
@@ -659,7 +660,7 @@ struct __DRIbufferRec {
};
#define __DRI_DRI2_LOADER "DRI_DRI2Loader"
-#define __DRI_DRI2_LOADER_VERSION 2
+#define __DRI_DRI2_LOADER_VERSION 3
struct __DRIdri2LoaderExtensionRec {
__DRIextension base;
@@ -680,6 +681,31 @@ struct __DRIdri2LoaderExtensionRec {
* into __DRIdri2ExtensionRec::createNewDrawable
*/
void (*flushFrontBuffer)(__DRIdrawable *driDrawable, void *loaderPrivate);
+
+
+ /**
+ * Get list of buffers from the server
+ *
+ * Gets a list of buffer for the specified set of attachments. Unlike
+ * \c ::getBuffers, this function takes a list of attachments paired with
+ * opaque \c unsigned \c int value describing the format of the buffer.
+ * It is the responsibility of the caller to know what the service that
+ * allocates the buffers will expect to receive for the format.
+ *
+ * \param driDrawable Drawable whose buffers are being queried.
+ * \param width Output where the width of the buffers is stored.
+ * \param height Output where the height of the buffers is stored.
+ * \param attachments List of pairs of attachment ID and opaque format
+ * requested for the drawable.
+ * \param count Number of attachment / format pairs stored in
+ * \c attachments.
+ * \param loaderPrivate Loader's private data that was previously passed
+ * into __DRIdri2ExtensionRec::createNewDrawable.
+ */
+ __DRIbuffer *(*getBuffersWithFormat)(__DRIdrawable *driDrawable,
+ int *width, int *height,
+ unsigned int *attachments, int count,
+ int *out_count, void *loaderPrivate);
};
/**
diff --git a/src/glx/x11/dri2_glx.c b/src/glx/x11/dri2_glx.c
index b6eeb913b6..fb31898db2 100644
--- a/src/glx/x11/dri2_glx.c
+++ b/src/glx/x11/dri2_glx.c
@@ -47,6 +47,9 @@
#include "dri2.h"
#include "dri_common.h"
+#undef DRI2_MINOR
+#define DRI2_MINOR 1
+
typedef struct __GLXDRIdisplayPrivateRec __GLXDRIdisplayPrivate;
typedef struct __GLXDRIcontextPrivateRec __GLXDRIcontextPrivate;
typedef struct __GLXDRIdrawablePrivateRec __GLXDRIdrawablePrivate;
@@ -289,30 +292,25 @@ static void dri2DestroyScreen(__GLXscreenConfigs *psc)
psc->__driScreen = NULL;
}
-static __DRIbuffer *
-dri2GetBuffers(__DRIdrawable *driDrawable,
- int *width, int *height,
- unsigned int *attachments, int count,
- int *out_count, void *loaderPrivate)
+/**
+ * Process list of buffer received from the server
+ *
+ * Processes the list of buffers received in a reply from the server to either
+ * \c DRI2GetBuffers or \c DRI2GetBuffersWithFormat.
+ */
+static void
+process_buffers(__GLXDRIdrawablePrivate *pdraw, DRI2Buffer *buffers,
+ unsigned count)
{
- __GLXDRIdrawablePrivate *pdraw = loaderPrivate;
- DRI2Buffer *buffers;
int i;
- buffers = DRI2GetBuffers(pdraw->base.psc->dpy, pdraw->base.xDrawable,
- width, height, attachments, count, out_count);
- if (buffers == NULL)
- return NULL;
-
- pdraw->width = *width;
- pdraw->height = *height;
- pdraw->bufferCount = *out_count;
+ pdraw->bufferCount = count;
pdraw->have_fake_front = 0;
pdraw->have_back = 0;
/* This assumes the DRI2 buffer attachment tokens matches the
* __DRIbuffer tokens. */
- for (i = 0; i < *out_count; i++) {
+ for (i = 0; i < count; i++) {
pdraw->buffers[i].attachment = buffers[i].attachment;
pdraw->buffers[i].name = buffers[i].name;
pdraw->buffers[i].pitch = buffers[i].pitch;
@@ -324,6 +322,51 @@ dri2GetBuffers(__DRIdrawable *driDrawable,
pdraw->have_back = 1;
}
+}
+
+static __DRIbuffer *
+dri2GetBuffers(__DRIdrawable *driDrawable,
+ int *width, int *height,
+ unsigned int *attachments, int count,
+ int *out_count, void *loaderPrivate)
+{
+ __GLXDRIdrawablePrivate *pdraw = loaderPrivate;
+ DRI2Buffer *buffers;
+
+ buffers = DRI2GetBuffers(pdraw->base.psc->dpy, pdraw->base.xDrawable,
+ width, height, attachments, count, out_count);
+ if (buffers == NULL)
+ return NULL;
+
+ pdraw->width = *width;
+ pdraw->height = *height;
+ process_buffers(pdraw, buffers, *out_count);
+
+ Xfree(buffers);
+
+ return pdraw->buffers;
+}
+
+static __DRIbuffer *
+dri2GetBuffersWithFormat(__DRIdrawable *driDrawable,
+ int *width, int *height,
+ unsigned int *attachments, int count,
+ int *out_count, void *loaderPrivate)
+{
+ __GLXDRIdrawablePrivate *pdraw = loaderPrivate;
+ DRI2Buffer *buffers;
+
+ buffers = DRI2GetBuffersWithFormat(pdraw->base.psc->dpy,
+ pdraw->base.xDrawable,
+ width, height, attachments,
+ count, out_count);
+ if (buffers == NULL)
+ return NULL;
+
+ pdraw->width = *width;
+ pdraw->height = *height;
+ process_buffers(pdraw, buffers, *out_count);
+
Xfree(buffers);
return pdraw->buffers;
@@ -332,7 +375,15 @@ dri2GetBuffers(__DRIdrawable *driDrawable,
static const __DRIdri2LoaderExtension dri2LoaderExtension = {
{ __DRI_DRI2_LOADER, __DRI_DRI2_LOADER_VERSION },
dri2GetBuffers,
- dri2FlushFrontBuffer
+ dri2FlushFrontBuffer,
+ dri2GetBuffersWithFormat,
+};
+
+static const __DRIdri2LoaderExtension dri2LoaderExtension_old = {
+ { __DRI_DRI2_LOADER, __DRI_DRI2_LOADER_VERSION },
+ dri2GetBuffers,
+ dri2FlushFrontBuffer,
+ NULL,
};
static const __DRIextension *loader_extensions[] = {
@@ -341,11 +392,19 @@ static const __DRIextension *loader_extensions[] = {
NULL
};
+static const __DRIextension *loader_extensions_old[] = {
+ &dri2LoaderExtension_old.base,
+ &systemTimeExtension.base,
+ NULL
+};
+
static __GLXDRIscreen *dri2CreateScreen(__GLXscreenConfigs *psc, int screen,
__GLXdisplayPrivate *priv)
{
const __DRIconfig **driver_configs;
const __DRIextension **extensions;
+ const __GLXDRIdisplayPrivate *const pdp = (__GLXDRIdisplayPrivate *)
+ priv->dri2Display;
__GLXDRIscreen *psp;
char *driverName, *deviceName;
drm_magic_t magic;
@@ -402,9 +461,16 @@ static __GLXDRIscreen *dri2CreateScreen(__GLXscreenConfigs *psc, int screen,
return NULL;
}
+ /* If the server does not support the protocol for
+ * DRI2GetBuffersWithFormat, don't supply that interface to the driver.
+ */
psc->__driScreen =
- psc->dri2->createNewScreen(screen, psc->fd,
- loader_extensions, &driver_configs, psc);
+ psc->dri2->createNewScreen(screen, psc->fd,
+ ((pdp->driMinor < 1)
+ ? loader_extensions_old
+ : loader_extensions),
+ &driver_configs, psc);
+
if (psc->__driScreen == NULL) {
ErrorMessageF("failed to create dri screen\n");
return NULL;
--
cgit v1.2.3
From f2272b5b2fd9195fe8f9eccfdd2e3c13d18a35e7 Mon Sep 17 00:00:00 2001
From: Ian Romanick
Date: Mon, 20 Apr 2009 20:56:45 -0700
Subject: intel / DRI2: When available, use DRI2GetBuffersWithFormat
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This interface gives the driver two important features. First, it can
allocate the (fake) front-buffer only when needed. Second, it can
tell the buffer allocator the format of buffers being allocated. This
enables support for back-buffer and depth-buffer with different bits
per pixel.
Signed-off-by: Ian Romanick
Reviewed-by: Kristian Høgsberg
---
src/mesa/drivers/dri/intel/intel_buffers.c | 10 +++
src/mesa/drivers/dri/intel/intel_context.c | 105 ++++++++++++++++++++++++-----
2 files changed, 99 insertions(+), 16 deletions(-)
diff --git a/src/mesa/drivers/dri/intel/intel_buffers.c b/src/mesa/drivers/dri/intel/intel_buffers.c
index 90964df355..ecac5bf020 100644
--- a/src/mesa/drivers/dri/intel/intel_buffers.c
+++ b/src/mesa/drivers/dri/intel/intel_buffers.c
@@ -323,8 +323,18 @@ intelDrawBuffer(GLcontext * ctx, GLenum mode)
{
if ((ctx->DrawBuffer != NULL) && (ctx->DrawBuffer->Name == 0)) {
struct intel_context *const intel = intel_context(ctx);
+ const GLboolean was_front_buffer_rendering =
+ intel->is_front_buffer_rendering;
intel->is_front_buffer_rendering = (mode == GL_FRONT_LEFT);
+
+ /* If we weren't front-buffer rendering before but we are now, make sure
+ * that the front-buffer has actually been allocated.
+ */
+ if (!was_front_buffer_rendering && intel->is_front_buffer_rendering) {
+ intel_update_renderbuffers(intel->driContext,
+ intel->driContext->driDrawablePriv);
+ }
}
intel_draw_buffer(ctx, ctx->DrawBuffer);
diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
index 9b628dbc8e..7fda793373 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -173,6 +173,24 @@ intelGetString(GLcontext * ctx, GLenum name)
}
}
+static unsigned
+intel_bits_per_pixel(const struct intel_renderbuffer *rb)
+{
+ switch (rb->Base._ActualFormat) {
+ case GL_RGB5:
+ case GL_DEPTH_COMPONENT16:
+ return 16;
+ case GL_RGB8:
+ case GL_RGBA8:
+ case GL_DEPTH_COMPONENT24:
+ case GL_DEPTH24_STENCIL8_EXT:
+ case GL_STENCIL_INDEX8_EXT:
+ return 32;
+ default:
+ return 0;
+ }
+}
+
void
intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable)
{
@@ -192,22 +210,62 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable)
screen = intel->intelScreen->driScrnPriv;
- i = 0;
- if (intel_fb->color_rb[0])
- attachments[i++] = __DRI_BUFFER_FRONT_LEFT;
- if (intel_fb->color_rb[1])
- attachments[i++] = __DRI_BUFFER_BACK_LEFT;
- if (intel_get_renderbuffer(&intel_fb->Base, BUFFER_DEPTH))
- attachments[i++] = __DRI_BUFFER_DEPTH;
- if (intel_get_renderbuffer(&intel_fb->Base, BUFFER_STENCIL))
- attachments[i++] = __DRI_BUFFER_STENCIL;
-
- buffers = (*screen->dri2.loader->getBuffers)(drawable,
- &drawable->w,
- &drawable->h,
- attachments, i,
- &count,
- drawable->loaderPrivate);
+ if ((screen->dri2.loader->base.version > 2)
+ && (screen->dri2.loader->getBuffersWithFormat != NULL)) {
+ struct intel_renderbuffer *depth_rb;
+ struct intel_renderbuffer *stencil_rb;
+
+ i = 0;
+ if ((intel->is_front_buffer_rendering || !intel_fb->color_rb[1])
+ && intel_fb->color_rb[0]) {
+ attachments[i++] = __DRI_BUFFER_FRONT_LEFT;
+ attachments[i++] = intel_bits_per_pixel(intel_fb->color_rb[0]);
+ }
+
+ if (intel_fb->color_rb[1]) {
+ attachments[i++] = __DRI_BUFFER_BACK_LEFT;
+ attachments[i++] = intel_bits_per_pixel(intel_fb->color_rb[1]);
+ }
+
+ depth_rb = intel_get_renderbuffer(&intel_fb->Base, BUFFER_DEPTH);
+ stencil_rb = intel_get_renderbuffer(&intel_fb->Base, BUFFER_STENCIL);
+
+ if ((depth_rb != NULL) && (stencil_rb != NULL)) {
+ attachments[i++] = __DRI_BUFFER_DEPTH_STENCIL;
+ attachments[i++] = intel_bits_per_pixel(depth_rb);
+ } else if (depth_rb != NULL) {
+ attachments[i++] = __DRI_BUFFER_DEPTH;
+ attachments[i++] = intel_bits_per_pixel(depth_rb);
+ } else if (stencil_rb != NULL) {
+ attachments[i++] = __DRI_BUFFER_STENCIL;
+ attachments[i++] = intel_bits_per_pixel(stencil_rb);
+ }
+
+ buffers =
+ (*screen->dri2.loader->getBuffersWithFormat)(drawable,
+ &drawable->w,
+ &drawable->h,
+ attachments, i / 2,
+ &count,
+ drawable->loaderPrivate);
+ } else {
+ i = 0;
+ if (intel_fb->color_rb[0])
+ attachments[i++] = __DRI_BUFFER_FRONT_LEFT;
+ if (intel_fb->color_rb[1])
+ attachments[i++] = __DRI_BUFFER_BACK_LEFT;
+ if (intel_get_renderbuffer(&intel_fb->Base, BUFFER_DEPTH))
+ attachments[i++] = __DRI_BUFFER_DEPTH;
+ if (intel_get_renderbuffer(&intel_fb->Base, BUFFER_STENCIL))
+ attachments[i++] = __DRI_BUFFER_STENCIL;
+
+ buffers = (*screen->dri2.loader->getBuffers)(drawable,
+ &drawable->w,
+ &drawable->h,
+ attachments, i,
+ &count,
+ drawable->loaderPrivate);
+ }
if (buffers == NULL)
return;
@@ -250,6 +308,11 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable)
region_name = "dri2 depth buffer";
break;
+ case __DRI_BUFFER_DEPTH_STENCIL:
+ rb = intel_get_renderbuffer(&intel_fb->Base, BUFFER_DEPTH);
+ region_name = "dri2 depth / stencil buffer";
+ break;
+
case __DRI_BUFFER_STENCIL:
rb = intel_get_renderbuffer(&intel_fb->Base, BUFFER_STENCIL);
region_name = "dri2 stencil buffer";
@@ -296,6 +359,16 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable)
intel_renderbuffer_set_region(rb, region);
intel_region_release(®ion);
+
+ if (buffers[i].attachment == __DRI_BUFFER_DEPTH_STENCIL) {
+ struct intel_region *stencil_region;
+
+ intel_region_reference(&stencil_region, region);
+
+ rb = intel_get_renderbuffer(&intel_fb->Base, BUFFER_STENCIL);
+ intel_renderbuffer_set_region(rb, stencil_region);
+ intel_region_release(&stencil_region);
+ }
}
driUpdateFramebufferSize(&intel->ctx, drawable);
--
cgit v1.2.3
From 91eb8baaca21d24bfd3640c9f6b316610a7c5910 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Fri, 24 Apr 2009 17:08:59 -0600
Subject: tgis: SSE code generator doesn't yet support indirect addressing of
temp regs
Fall back to interpreter in this case.
---
src/gallium/auxiliary/tgsi/tgsi_sse2.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/src/gallium/auxiliary/tgsi/tgsi_sse2.c b/src/gallium/auxiliary/tgsi/tgsi_sse2.c
index 4b4e34b29e..ba2bfdef06 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_sse2.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_sse2.c
@@ -1466,6 +1466,31 @@ emit_cmp(
}
}
+
+/**
+ * Check if inst src/dest regs use indirect addressing into temporary
+ * register file.
+ */
+static boolean
+indirect_temp_reference(const struct tgsi_full_instruction *inst)
+{
+ uint i;
+ for (i = 0; i < inst->Instruction.NumSrcRegs; i++) {
+ const struct tgsi_full_src_register *reg = &inst->FullSrcRegisters[i];
+ if (reg->SrcRegister.File == TGSI_FILE_TEMPORARY &&
+ reg->SrcRegister.Indirect)
+ return TRUE;
+ }
+ for (i = 0; i < inst->Instruction.NumDstRegs; i++) {
+ const struct tgsi_full_dst_register *reg = &inst->FullDstRegisters[i];
+ if (reg->DstRegister.File == TGSI_FILE_TEMPORARY &&
+ reg->DstRegister.Indirect)
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
static int
emit_instruction(
struct x86_function *func,
@@ -1473,6 +1498,10 @@ emit_instruction(
{
unsigned chan_index;
+ /* we can't handle indirect addressing into temp register file yet */
+ if (indirect_temp_reference(inst))
+ return FALSE;
+
switch (inst->Instruction.Opcode) {
case TGSI_OPCODE_ARL:
FOR_EACH_DST0_ENABLED_CHANNEL( *inst, chan_index ) {
--
cgit v1.2.3
From 302ba83116a24dbcd09a5f8d10edaaf862127873 Mon Sep 17 00:00:00 2001
From: Ian Romanick
Date: Fri, 24 Apr 2009 16:14:51 -0700
Subject: intel: Initialize region ptr to prevent assertion in
intel_region_reference
---
src/mesa/drivers/dri/intel/intel_context.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
index 7fda793373..8446032742 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -361,7 +361,7 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable)
intel_region_release(®ion);
if (buffers[i].attachment == __DRI_BUFFER_DEPTH_STENCIL) {
- struct intel_region *stencil_region;
+ struct intel_region *stencil_region = NULL;
intel_region_reference(&stencil_region, region);
--
cgit v1.2.3
From 022319b92ccd2f3bfc4aca54ebc7e39aeddd8b21 Mon Sep 17 00:00:00 2001
From: Ian Romanick
Date: Fri, 24 Apr 2009 16:39:00 -0700
Subject: intel: Fix more issues with the combined depth-stencil attachment
---
src/mesa/drivers/dri/intel/intel_context.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
index 8446032742..eb224a8a41 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -361,13 +361,20 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable)
intel_region_release(®ion);
if (buffers[i].attachment == __DRI_BUFFER_DEPTH_STENCIL) {
- struct intel_region *stencil_region = NULL;
-
- intel_region_reference(&stencil_region, region);
-
rb = intel_get_renderbuffer(&intel_fb->Base, BUFFER_STENCIL);
- intel_renderbuffer_set_region(rb, stencil_region);
- intel_region_release(&stencil_region);
+ if (rb != NULL) {
+ struct intel_region *stencil_region = NULL;
+
+ if (rb->region) {
+ dri_bo_flink(rb->region->buffer, &name);
+ if (name == buffers[i].name)
+ continue;
+ }
+
+ intel_region_reference(&stencil_region, region);
+ intel_renderbuffer_set_region(rb, stencil_region);
+ intel_region_release(&stencil_region);
+ }
}
}
--
cgit v1.2.3
From d18dd6ad11268c7a6c2835f4f5fa999c735da300 Mon Sep 17 00:00:00 2001
From: Samuel Thibault
Date: Thu, 23 Apr 2009 05:43:22 -0700
Subject: GNU/Hurd fixes
Here is a couple of fixes for GNU/Hurd:
- dri_interface.h: no libdrm support either.
- configure.ac:
- GNU/Hurd is a GNU OS with _GNU_SOURCE and PTHREADS.
- GNU needs a couple of flags like other OSes
Signed-off-by: Dan Nicholson
---
configure.ac | 6 +++++-
include/GL/internal/dri_interface.h | 2 +-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index 8412cdce7f..7b07f0fa7c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -87,7 +87,7 @@ dnl Compiler macros
DEFINES=""
AC_SUBST([DEFINES])
case "$host_os" in
-linux*|*-gnu*)
+linux*|*-gnu*|gnu*)
DEFINES="$DEFINES -D_GNU_SOURCE -DPTHREADS"
;;
solaris*)
@@ -742,6 +742,10 @@ if test "$mesa_driver" = dri; then
unichrome savage sis swrast"
fi
;;
+ gnu*)
+ DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
+ DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
+ ;;
solaris*)
DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index bfa8a33b3c..910c9166b5 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -41,7 +41,7 @@
#define DRI_INTERFACE_H
/* For archs with no drm.h */
-#if !defined(__APPLE__) && !defined(__CYGWIN__)
+#if !defined(__APPLE__) && !defined(__CYGWIN__) && !defined(__GNU__)
#include
#else
typedef unsigned int drm_context_t;
--
cgit v1.2.3
From f44f1155a9d1539bc5173928af20f5a2541ec6be Mon Sep 17 00:00:00 2001
From: Jakob Bornecrantz
Date: Sat, 25 Apr 2009 12:52:04 +0100
Subject: gallium-intel: Link dri2 driver with softpipe
---
src/gallium/winsys/drm/intel/dri2/Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/gallium/winsys/drm/intel/dri2/Makefile b/src/gallium/winsys/drm/intel/dri2/Makefile
index 1a02109274..e7c57afc34 100644
--- a/src/gallium/winsys/drm/intel/dri2/Makefile
+++ b/src/gallium/winsys/drm/intel/dri2/Makefile
@@ -6,6 +6,7 @@ LIBNAME = i915_dri.so
PIPE_DRIVERS = \
$(TOP)/src/gallium/state_trackers/dri2/libdri2drm.a \
$(TOP)/src/gallium/winsys/drm/intel/gem/libinteldrm.a \
+ $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
$(TOP)/src/gallium/drivers/i915simple/libi915simple.a
--
cgit v1.2.3
From 5f701f22f00ea17e0aba91c9995c9f559963d591 Mon Sep 17 00:00:00 2001
From: Jakob Bornecrantz
Date: Sat, 25 Apr 2009 12:55:21 +0100
Subject: gallium-intel: Cache software switch
---
src/gallium/winsys/drm/intel/gem/intel_be_context.c | 2 +-
src/gallium/winsys/drm/intel/gem/intel_be_device.c | 5 ++++-
src/gallium/winsys/drm/intel/gem/intel_be_device.h | 2 ++
3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_context.c b/src/gallium/winsys/drm/intel/gem/intel_be_context.c
index cfe8c88466..fe0b138fbe 100644
--- a/src/gallium/winsys/drm/intel/gem/intel_be_context.c
+++ b/src/gallium/winsys/drm/intel/gem/intel_be_context.c
@@ -108,7 +108,7 @@ intel_be_create_context(struct pipe_screen *screen)
intel_be_init_context(intel, device);
- if (getenv("INTEL_SOFTPIPE"))
+ if (device->softpipe)
pipe = softpipe_create(screen);
else
pipe = i915_create_context(screen, &device->base, &intel->base);
diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_device.c b/src/gallium/winsys/drm/intel/gem/intel_be_device.c
index 8979f0ae15..4fa7a5e1a2 100644
--- a/src/gallium/winsys/drm/intel/gem/intel_be_device.c
+++ b/src/gallium/winsys/drm/intel/gem/intel_be_device.c
@@ -6,6 +6,7 @@
#include "pipe/p_state.h"
#include "pipe/p_inlines.h"
#include "util/u_memory.h"
+#include "util/u_debug.h"
#include "intel_be_fence.h"
@@ -286,6 +287,8 @@ intel_be_init_device(struct intel_be_device *dev, int fd, unsigned id)
dev->pools.gem = drm_intel_bufmgr_gem_init(dev->fd, dev->max_batch_size);
+ dev->softpipe = debug_get_bool_option("INTEL_SOFTPIPE", FALSE);
+
return true;
}
@@ -303,7 +306,7 @@ intel_be_create_screen(int drmFD, int deviceID)
intel_be_init_device(dev, drmFD, deviceID);
- if (getenv("INTEL_SOFTPIPE")) {
+ if (dev->softpipe) {
screen = softpipe_create_screen(&dev->base);
drm_api_hooks.buffer_from_texture = softpipe_get_texture_buffer;
} else
diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_device.h b/src/gallium/winsys/drm/intel/gem/intel_be_device.h
index 47d2176cb4..b32637ece2 100644
--- a/src/gallium/winsys/drm/intel/gem/intel_be_device.h
+++ b/src/gallium/winsys/drm/intel/gem/intel_be_device.h
@@ -16,6 +16,8 @@ struct intel_be_device
{
struct pipe_winsys base;
+ boolean softpipe;
+
int fd; /**< Drm file discriptor */
unsigned id;
--
cgit v1.2.3
From a098e6090319e618f71e2ff5ee9b6a993571fddf Mon Sep 17 00:00:00 2001
From: Jakob Bornecrantz
Date: Sat, 25 Apr 2009 12:56:07 +0100
Subject: gallium-intel: Fix warning
---
src/gallium/winsys/drm/intel/gem/intel_be_device.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_device.c b/src/gallium/winsys/drm/intel/gem/intel_be_device.c
index 4fa7a5e1a2..c866c2a2f1 100644
--- a/src/gallium/winsys/drm/intel/gem/intel_be_device.c
+++ b/src/gallium/winsys/drm/intel/gem/intel_be_device.c
@@ -177,8 +177,6 @@ intel_be_handle_from_buffer(struct pipe_screen *screen,
struct pipe_buffer *buffer,
unsigned *handle)
{
- drm_intel_bo *bo;
-
if (!buffer)
return FALSE;
--
cgit v1.2.3
From d9f2d0752b087b0d39748b005bc4f795a3d05404 Mon Sep 17 00:00:00 2001
From: Mathias Gottschlag
Date: Sat, 25 Apr 2009 01:27:23 +0200
Subject: r300-gallium: Set framebuffer pitch on every framebuffer change.
Signed-off-by: Corbin Simpson
---
src/gallium/drivers/r300/r300_emit.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index 417d5f6307..cce5c591f1 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -160,7 +160,7 @@ void r300_emit_fb_state(struct r300_context* r300,
struct r300_texture* tex;
CS_LOCALS(r300);
- BEGIN_CS((6 * fb->nr_cbufs) + (fb->zsbuf ? 6 : 0) + 4);
+ BEGIN_CS((7 * fb->nr_cbufs) + (fb->zsbuf ? 7 : 0) + 4);
for (i = 0; i < fb->nr_cbufs; i++) {
tex = (struct r300_texture*)fb->cbufs[i]->texture;
OUT_CS_REG_SEQ(R300_RB3D_COLOROFFSET0 + (4 * i), 1);
@@ -168,6 +168,9 @@ void r300_emit_fb_state(struct r300_context* r300,
OUT_CS_REG(R300_US_OUT_FMT_0 + (4 * i),
r300_translate_out_fmt(fb->cbufs[i]->format));
+ unsigned pixpitch = tex->stride / tex->tex.block.size;
+ OUT_CS_REG(R300_RB3D_COLORPITCH0 + (4 * i), pixpitch |
+ r300_translate_colorformat(tex->tex.format));
}
if (fb->zsbuf) {
@@ -180,6 +183,8 @@ void r300_emit_fb_state(struct r300_context* r300,
} else {
OUT_CS_REG(R300_ZB_FORMAT, 0x0);
}
+ unsigned pixpitch = tex->stride / tex->tex.block.size;
+ OUT_CS_REG(R300_ZB_DEPTHPITCH, pixpitch);
}
OUT_CS_REG(R300_RB3D_DSTCACHE_CTLSTAT,
--
cgit v1.2.3
From f45a7a1d1f8a576daf02e94ecabfd42f556dd9b4 Mon Sep 17 00:00:00 2001
From: Corbin Simpson
Date: Fri, 24 Apr 2009 16:53:38 -0700
Subject: r300-gallium: Clean up FB state emit.
---
src/gallium/drivers/r300/r300_emit.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index cce5c591f1..74d63ffe41 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -152,38 +152,38 @@ void r500_emit_fragment_shader(struct r300_context* r300,
END_CS;
}
-/* XXX add pitch, stride, clean up */
void r300_emit_fb_state(struct r300_context* r300,
struct pipe_framebuffer_state* fb)
{
- int i;
struct r300_texture* tex;
+ unsigned pixpitch;
+ int i;
CS_LOCALS(r300);
- BEGIN_CS((7 * fb->nr_cbufs) + (fb->zsbuf ? 7 : 0) + 4);
+ BEGIN_CS((8 * fb->nr_cbufs) + (fb->zsbuf ? 8 : 0) + 4);
for (i = 0; i < fb->nr_cbufs; i++) {
tex = (struct r300_texture*)fb->cbufs[i]->texture;
+ pixpitch = tex->stride / tex->tex.block.size;
+
OUT_CS_REG_SEQ(R300_RB3D_COLOROFFSET0 + (4 * i), 1);
OUT_CS_RELOC(tex->buffer, 0, 0, RADEON_GEM_DOMAIN_VRAM, 0);
- OUT_CS_REG(R300_US_OUT_FMT_0 + (4 * i),
- r300_translate_out_fmt(fb->cbufs[i]->format));
- unsigned pixpitch = tex->stride / tex->tex.block.size;
OUT_CS_REG(R300_RB3D_COLORPITCH0 + (4 * i), pixpitch |
r300_translate_colorformat(tex->tex.format));
+
+ OUT_CS_REG(R300_US_OUT_FMT_0 + (4 * i),
+ r300_translate_out_fmt(fb->cbufs[i]->format));
}
if (fb->zsbuf) {
tex = (struct r300_texture*)fb->zsbuf->texture;
+ pixpitch = (tex->stride / tex->tex.block.size);
+
OUT_CS_REG_SEQ(R300_ZB_DEPTHOFFSET, 1);
OUT_CS_RELOC(tex->buffer, 0, 0, RADEON_GEM_DOMAIN_VRAM, 0);
- if (fb->zsbuf->format == PIPE_FORMAT_Z24S8_UNORM) {
- OUT_CS_REG(R300_ZB_FORMAT,
- R300_DEPTHFORMAT_24BIT_INT_Z_8BIT_STENCIL);
- } else {
- OUT_CS_REG(R300_ZB_FORMAT, 0x0);
- }
- unsigned pixpitch = tex->stride / tex->tex.block.size;
+
+ OUT_CS_REG(R300_ZB_FORMAT, r300_translate_zsformat(tex->tex.format));
+
OUT_CS_REG(R300_ZB_DEPTHPITCH, pixpitch);
}
--
cgit v1.2.3
From 233c6fb694ebd946ae76cb48701adf4d2086b1c1 Mon Sep 17 00:00:00 2001
From: Corbin Simpson
Date: Sat, 25 Apr 2009 16:53:38 -0700
Subject: r300-gallium: Fix vertex shader OVM counting.
Attribs must be packed: position, point size, colors, texcoords.
Thanks to osiris for pointing it out.
---
src/gallium/drivers/r300/r300_state_tcl.c | 38 ++++++++++++++++++++++++++++---
src/gallium/drivers/r300/r300_state_tcl.h | 12 +++++++---
2 files changed, 44 insertions(+), 6 deletions(-)
diff --git a/src/gallium/drivers/r300/r300_state_tcl.c b/src/gallium/drivers/r300/r300_state_tcl.c
index bb96e2ad67..d84912de48 100644
--- a/src/gallium/drivers/r300/r300_state_tcl.c
+++ b/src/gallium/drivers/r300/r300_state_tcl.c
@@ -34,14 +34,20 @@ static void r300_vs_declare(struct r300_vs_asm* assembler,
assembler->tab[decl->DeclarationRange.First] = 0;
break;
case TGSI_SEMANTIC_COLOR:
- assembler->tab[decl->DeclarationRange.First] = 2;
+ assembler->tab[decl->DeclarationRange.First] =
+ (assembler->point_size ? 1 : 0) +
+ assembler->out_colors;
break;
+ case TGSI_SEMANTIC_FOG:
case TGSI_SEMANTIC_GENERIC:
/* XXX multiple? */
- assembler->tab[decl->DeclarationRange.First] = 6;
+ assembler->tab[decl->DeclarationRange.First] =
+ (assembler->point_size ? 1 : 0) +
+ assembler->out_colors +
+ assembler->out_texcoords;
break;
case TGSI_SEMANTIC_PSIZE:
- assembler->tab[decl->DeclarationRange.First] = 15;
+ assembler->tab[decl->DeclarationRange.First] = 1;
break;
default:
debug_printf("r300: vs: Bad semantic declaration %d\n",
@@ -252,6 +258,28 @@ static void r300_vs_instruction(struct r300_vertex_shader* vs,
}
}
+static void r300_vs_init(struct r300_vertex_shader* vs,
+ struct r300_vs_asm* assembler)
+{
+ struct tgsi_shader_info* info = &vs->info;
+ int i;
+
+ for (i = 0; i < info->num_outputs; i++) {
+ switch (info->output_semantic_name[i]) {
+ case TGSI_SEMANTIC_PSIZE:
+ assembler->point_size = TRUE;
+ break;
+ case TGSI_SEMANTIC_COLOR:
+ assembler->out_colors++;
+ break;
+ case TGSI_SEMANTIC_FOG:
+ case TGSI_SEMANTIC_GENERIC:
+ assembler->out_texcoords++;
+ break;
+ }
+ }
+}
+
void r300_translate_vertex_shader(struct r300_context* r300,
struct r300_vertex_shader* vs)
{
@@ -264,6 +292,10 @@ void r300_translate_vertex_shader(struct r300_context* r300,
if (assembler == NULL) {
return;
}
+
+ /* Init assembler. */
+ r300_vs_init(vs, assembler);
+
/* Setup starting offset for immediates. */
assembler->imm_offset = consts->user_count;
diff --git a/src/gallium/drivers/r300/r300_state_tcl.h b/src/gallium/drivers/r300/r300_state_tcl.h
index de944028ba..e2e1357d43 100644
--- a/src/gallium/drivers/r300/r300_state_tcl.h
+++ b/src/gallium/drivers/r300/r300_state_tcl.h
@@ -99,7 +99,13 @@ struct r300_vs_asm {
unsigned imm_offset;
/* Number of immediate constants. */
unsigned imm_count;
- /* Offsets into vertex output memory. */
+ /* Number of colors to write. */
+ unsigned out_colors;
+ /* Number of texcoords to write. */
+ unsigned out_texcoords;
+ /* Whether to emit point size. */
+ boolean point_size;
+ /* Tab of declared outputs to OVM outputs. */
unsigned tab[16];
};
@@ -115,7 +121,7 @@ static struct r300_vertex_shader r300_passthrough_vertex_shader = {
.instructions[0].inst3 = 0x0,
.instructions[1].inst0 = R300_PVS_DST_OPCODE(R300_VE_ADD) |
R300_PVS_DST_REG_TYPE(R300_PVS_DST_REG_OUT) |
- R300_PVS_DST_OFFSET(2) | R300_PVS_DST_WE_XYZW,
+ R300_PVS_DST_OFFSET(1) | R300_PVS_DST_WE_XYZW,
.instructions[1].inst1 = R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) |
R300_PVS_SRC_OFFSET(1) | R300_PVS_SRC_SWIZZLE_XYZW,
.instructions[1].inst2 = R300_PVS_SRC_SWIZZLE_ZERO,
@@ -134,7 +140,7 @@ static struct r300_vertex_shader r300_texture_vertex_shader = {
.instructions[0].inst3 = 0x0,
.instructions[1].inst0 = R300_PVS_DST_OPCODE(R300_VE_ADD) |
R300_PVS_DST_REG_TYPE(R300_PVS_DST_REG_OUT) |
- R300_PVS_DST_OFFSET(6) | R300_PVS_DST_WE_XYZW,
+ R300_PVS_DST_OFFSET(1) | R300_PVS_DST_WE_XYZW,
.instructions[1].inst1 = R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) |
R300_PVS_SRC_OFFSET(1) | R300_PVS_SRC_SWIZZLE_XYZW,
.instructions[1].inst2 = R300_PVS_SRC_SWIZZLE_ZERO,
--
cgit v1.2.3
From 86d2144412915b0052a468806c4fba81d72a682d Mon Sep 17 00:00:00 2001
From: Mathias Gottschlag
Date: Sun, 26 Apr 2009 12:04:35 +0200
Subject: r300-gallium: Add a draw_flush() to r300_flush().
This fixes some missing primitives which had been drawn right before the next glClear().
---
src/gallium/drivers/r300/r300_flush.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/gallium/drivers/r300/r300_flush.c b/src/gallium/drivers/r300/r300_flush.c
index 20ca6905ad..89a5f2b20c 100644
--- a/src/gallium/drivers/r300/r300_flush.c
+++ b/src/gallium/drivers/r300/r300_flush.c
@@ -29,6 +29,8 @@ static void r300_flush(struct pipe_context* pipe,
struct r300_context* r300 = r300_context(pipe);
CS_LOCALS(r300);
+ draw_flush(r300->draw);
+
if (r300->dirty_hw) {
FLUSH_CS;
r300_emit_invariant_state(r300);
--
cgit v1.2.3
From 904b563fd027c05a9755bc07719c55099ab5a9fd Mon Sep 17 00:00:00 2001
From: Corbin Simpson
Date: Sun, 26 Apr 2009 10:06:02 -0700
Subject: r300-gallium: Correctly flush Draw.
Should help with a few non-TCL bugs.
---
src/gallium/drivers/r300/r300_state.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index c9507ae193..184a23c9e6 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -421,6 +421,7 @@ static void r300_bind_rs_state(struct pipe_context* pipe, void* state)
struct r300_context* r300 = r300_context(pipe);
struct r300_rs_state* rs = (struct r300_rs_state*)state;
+ draw_flush(r300->draw);
draw_set_rasterizer_state(r300->draw, &rs->rs);
r300->rs_state = rs;
@@ -528,7 +529,6 @@ static void r300_set_scissor_state(struct pipe_context* pipe,
const struct pipe_scissor_state* state)
{
struct r300_context* r300 = r300_context(pipe);
- draw_flush(r300->draw);
if (r300_screen(r300->context.screen)->caps->is_r500) {
r300->scissor_state->scissor_top_left =
@@ -555,6 +555,8 @@ static void r300_set_viewport_state(struct pipe_context* pipe,
{
struct r300_context* r300 = r300_context(pipe);
+ draw_flush(r300->draw);
+
if (r300_screen(r300->context.screen)->caps->has_tcl) {
/* Do the transform in HW. */
r300->viewport_state->vte_control = R300_VTX_W0_FMT;
@@ -642,6 +644,8 @@ static void r300_bind_vs_state(struct pipe_context* pipe, void* shader)
{
struct r300_context* r300 = r300_context(pipe);
+ draw_flush(r300->draw);
+
if (r300_screen(pipe->screen)->caps->has_tcl) {
struct r300_vertex_shader* vs = (struct r300_vertex_shader*)shader;
--
cgit v1.2.3
From 4486e40143d16b7a6d28b4c652e671a198603131 Mon Sep 17 00:00:00 2001
From: Maciej Cencora
Date: Tue, 21 Apr 2009 02:38:08 +0200
Subject: r300: always emit output insts after all KIL insts
---
src/mesa/drivers/dri/r300/r300_state.c | 4 ++-
src/mesa/drivers/dri/r300/radeon_program_pair.c | 45 +++++++++++++++++++++++--
2 files changed, 46 insertions(+), 3 deletions(-)
diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c
index 8095538ff9..6b79aa4313 100644
--- a/src/mesa/drivers/dri/r300/r300_state.c
+++ b/src/mesa/drivers/dri/r300/r300_state.c
@@ -472,7 +472,9 @@ static void r300SetEarlyZState(GLcontext * ctx)
if (ctx->Color.AlphaEnabled && ctx->Color.AlphaFunc != GL_ALWAYS)
topZ = R300_ZTOP_DISABLE;
- if (current_fragment_program_writes_depth(ctx))
+ else if (current_fragment_program_writes_depth(ctx))
+ topZ = R300_ZTOP_DISABLE;
+ else if (ctx->FragmentProgram._Current && ctx->FragmentProgram._Current->UsesKill)
topZ = R300_ZTOP_DISABLE;
if (topZ != r300->hw.zstencil_format.cmd[2]) {
diff --git a/src/mesa/drivers/dri/r300/radeon_program_pair.c b/src/mesa/drivers/dri/r300/radeon_program_pair.c
index 4aa2319a45..2e21f7bf66 100644
--- a/src/mesa/drivers/dri/r300/radeon_program_pair.c
+++ b/src/mesa/drivers/dri/r300/radeon_program_pair.c
@@ -47,6 +47,7 @@
struct pair_state_instruction {
GLuint IsTex:1; /**< Is a texture instruction */
+ GLuint IsOutput:1; /**< Is output instruction */
GLuint NeedRGB:1; /**< Needs the RGB ALU */
GLuint NeedAlpha:1; /**< Needs the Alpha ALU */
GLuint IsTranscendent:1; /**< Is a special transcendent instruction */
@@ -123,6 +124,7 @@ struct pair_state {
GLboolean Debug;
GLboolean Verbose;
void *UserData;
+ GLubyte NumKillInsts;
/**
* Translate Mesa registers to hardware registers
@@ -148,6 +150,11 @@ struct pair_state {
struct pair_state_instruction *ReadyAlpha;
struct pair_state_instruction *ReadyTEX;
+ /**
+ * Linked list of deferred instructions
+ */
+ struct pair_state_instruction *DeferredInsts;
+
/**
* Pool of @ref reg_value structures for fast allocation.
*/
@@ -231,7 +238,9 @@ static void instruction_ready(struct pair_state *s, int ip)
if (s->Verbose)
_mesa_printf("instruction_ready(%i)\n", ip);
- if (pairinst->IsTex)
+ if (s->NumKillInsts > 0 && pairinst->IsOutput)
+ add_pairinst_to_list(&s->DeferredInsts, pairinst);
+ else if (pairinst->IsTex)
add_pairinst_to_list(&s->ReadyTEX, pairinst);
else if (!pairinst->NeedAlpha)
add_pairinst_to_list(&s->ReadyRGB, pairinst);
@@ -339,6 +348,8 @@ static void classify_instruction(struct pair_state *s,
error("Unknown opcode %d\n", inst->Opcode);
break;
}
+
+ pairinst->IsOutput = (inst->DstReg.File == PROGRAM_OUTPUT);
}
@@ -602,8 +613,11 @@ static void emit_all_tex(struct pair_state *s)
struct prog_instruction *inst = s->Program->Instructions + ip;
commit_instruction(s, ip);
- if (inst->Opcode != OPCODE_KIL)
+ if (inst->Opcode == OPCODE_KIL)
+ --s->NumKillInsts;
+ else
inst->DstReg.Index = get_hw_reg(s, inst->DstReg.File, inst->DstReg.Index);
+
inst->SrcReg[0].Index = get_hw_reg(s, inst->SrcReg[0].File, inst->SrcReg[0].Index);
if (s->Debug) {
@@ -861,6 +875,17 @@ static void emit_alu(struct pair_state *s)
s->Error = s->Error || !s->Handler->EmitPaired(s->UserData, &pair);
}
+static GLubyte countKillInsts(struct gl_program *prog)
+{
+ GLubyte i, count = 0;
+
+ for (i = 0; i < prog->NumInstructions; ++i) {
+ if (prog->Instructions[i].Opcode == OPCODE_KIL)
+ ++count;
+ }
+
+ return count;
+}
GLboolean radeonPairProgram(GLcontext *ctx, struct gl_program *program,
const struct radeon_pair_handler* handler, void *userdata)
@@ -874,6 +899,7 @@ GLboolean radeonPairProgram(GLcontext *ctx, struct gl_program *program,
s.UserData = userdata;
s.Debug = (RADEON_DEBUG & DEBUG_PIXEL) ? GL_TRUE : GL_FALSE;
s.Verbose = GL_FALSE && s.Debug;
+ s.NumKillInsts = countKillInsts(program);
s.Instructions = (struct pair_state_instruction*)_mesa_calloc(
sizeof(struct pair_state_instruction)*s.Program->NumInstructions);
@@ -892,6 +918,21 @@ GLboolean radeonPairProgram(GLcontext *ctx, struct gl_program *program,
if (s.ReadyTEX)
emit_all_tex(&s);
+ if (!s.NumKillInsts) {
+ struct pair_state_instruction *pairinst = s.DeferredInsts;
+ while (pairinst) {
+ if (!pairinst->NeedAlpha)
+ add_pairinst_to_list(&s.ReadyRGB, pairinst);
+ else if (!pairinst->NeedRGB)
+ add_pairinst_to_list(&s.ReadyAlpha, pairinst);
+ else
+ add_pairinst_to_list(&s.ReadyFullALU, pairinst);
+
+ pairinst = pairinst->NextReady;
+ }
+ s.DeferredInsts = NULL;
+ }
+
while(s.ReadyFullALU || s.ReadyRGB || s.ReadyAlpha)
emit_alu(&s);
}
--
cgit v1.2.3
From b504721cc7fdfd9420e80c0f7ab78a3f92abeb58 Mon Sep 17 00:00:00 2001
From: José Fonseca
Date: Thu, 23 Apr 2009 13:20:06 +0100
Subject: stw: Use a statically initiallized gl proc table.
It doesn't change anyway.
---
src/gallium/state_trackers/wgl/icd/stw_icd.c | 703 +++++++++++++--------------
1 file changed, 347 insertions(+), 356 deletions(-)
diff --git a/src/gallium/state_trackers/wgl/icd/stw_icd.c b/src/gallium/state_trackers/wgl/icd/stw_icd.c
index faf7f2f410..3711982fd2 100644
--- a/src/gallium/state_trackers/wgl/icd/stw_icd.c
+++ b/src/gallium/state_trackers/wgl/icd/stw_icd.c
@@ -38,9 +38,6 @@
#define DBG 0
-static GLCLTPROCTABLE cpt;
-static boolean cpt_initialized = FALSE;
-
BOOL APIENTRY
DrvCopyContext(
@@ -165,351 +162,352 @@ DrvSetCallbackProcs(
}
-static void init_proc_table( GLCLTPROCTABLE *cpt )
-{
- GLDISPATCHTABLE *disp = &cpt->glDispatchTable;
-
- memset( cpt, 0, sizeof *cpt );
- cpt->cEntries = OPENGL_VERSION_110_ENTRIES;
-
-#define GPA_GL( NAME ) disp->NAME = gl##NAME
- GPA_GL( NewList );
- GPA_GL( EndList );
- GPA_GL( CallList );
- GPA_GL( CallLists );
- GPA_GL( DeleteLists );
- GPA_GL( GenLists );
- GPA_GL( ListBase );
- GPA_GL( Begin );
- GPA_GL( Bitmap );
- GPA_GL( Color3b );
- GPA_GL( Color3bv );
- GPA_GL( Color3d );
- GPA_GL( Color3dv );
- GPA_GL( Color3f );
- GPA_GL( Color3fv );
- GPA_GL( Color3i );
- GPA_GL( Color3iv );
- GPA_GL( Color3s );
- GPA_GL( Color3sv );
- GPA_GL( Color3ub );
- GPA_GL( Color3ubv );
- GPA_GL( Color3ui );
- GPA_GL( Color3uiv );
- GPA_GL( Color3us );
- GPA_GL( Color3usv );
- GPA_GL( Color4b );
- GPA_GL( Color4bv );
- GPA_GL( Color4d );
- GPA_GL( Color4dv );
- GPA_GL( Color4f );
- GPA_GL( Color4fv );
- GPA_GL( Color4i );
- GPA_GL( Color4iv );
- GPA_GL( Color4s );
- GPA_GL( Color4sv );
- GPA_GL( Color4ub );
- GPA_GL( Color4ubv );
- GPA_GL( Color4ui );
- GPA_GL( Color4uiv );
- GPA_GL( Color4us );
- GPA_GL( Color4usv );
- GPA_GL( EdgeFlag );
- GPA_GL( EdgeFlagv );
- GPA_GL( End );
- GPA_GL( Indexd );
- GPA_GL( Indexdv );
- GPA_GL( Indexf );
- GPA_GL( Indexfv );
- GPA_GL( Indexi );
- GPA_GL( Indexiv );
- GPA_GL( Indexs );
- GPA_GL( Indexsv );
- GPA_GL( Normal3b );
- GPA_GL( Normal3bv );
- GPA_GL( Normal3d );
- GPA_GL( Normal3dv );
- GPA_GL( Normal3f );
- GPA_GL( Normal3fv );
- GPA_GL( Normal3i );
- GPA_GL( Normal3iv );
- GPA_GL( Normal3s );
- GPA_GL( Normal3sv );
- GPA_GL( RasterPos2d );
- GPA_GL( RasterPos2dv );
- GPA_GL( RasterPos2f );
- GPA_GL( RasterPos2fv );
- GPA_GL( RasterPos2i );
- GPA_GL( RasterPos2iv );
- GPA_GL( RasterPos2s );
- GPA_GL( RasterPos2sv );
- GPA_GL( RasterPos3d );
- GPA_GL( RasterPos3dv );
- GPA_GL( RasterPos3f );
- GPA_GL( RasterPos3fv );
- GPA_GL( RasterPos3i );
- GPA_GL( RasterPos3iv );
- GPA_GL( RasterPos3s );
- GPA_GL( RasterPos3sv );
- GPA_GL( RasterPos4d );
- GPA_GL( RasterPos4dv );
- GPA_GL( RasterPos4f );
- GPA_GL( RasterPos4fv );
- GPA_GL( RasterPos4i );
- GPA_GL( RasterPos4iv );
- GPA_GL( RasterPos4s );
- GPA_GL( RasterPos4sv );
- GPA_GL( Rectd );
- GPA_GL( Rectdv );
- GPA_GL( Rectf );
- GPA_GL( Rectfv );
- GPA_GL( Recti );
- GPA_GL( Rectiv );
- GPA_GL( Rects );
- GPA_GL( Rectsv );
- GPA_GL( TexCoord1d );
- GPA_GL( TexCoord1dv );
- GPA_GL( TexCoord1f );
- GPA_GL( TexCoord1fv );
- GPA_GL( TexCoord1i );
- GPA_GL( TexCoord1iv );
- GPA_GL( TexCoord1s );
- GPA_GL( TexCoord1sv );
- GPA_GL( TexCoord2d );
- GPA_GL( TexCoord2dv );
- GPA_GL( TexCoord2f );
- GPA_GL( TexCoord2fv );
- GPA_GL( TexCoord2i );
- GPA_GL( TexCoord2iv );
- GPA_GL( TexCoord2s );
- GPA_GL( TexCoord2sv );
- GPA_GL( TexCoord3d );
- GPA_GL( TexCoord3dv );
- GPA_GL( TexCoord3f );
- GPA_GL( TexCoord3fv );
- GPA_GL( TexCoord3i );
- GPA_GL( TexCoord3iv );
- GPA_GL( TexCoord3s );
- GPA_GL( TexCoord3sv );
- GPA_GL( TexCoord4d );
- GPA_GL( TexCoord4dv );
- GPA_GL( TexCoord4f );
- GPA_GL( TexCoord4fv );
- GPA_GL( TexCoord4i );
- GPA_GL( TexCoord4iv );
- GPA_GL( TexCoord4s );
- GPA_GL( TexCoord4sv );
- GPA_GL( Vertex2d );
- GPA_GL( Vertex2dv );
- GPA_GL( Vertex2f );
- GPA_GL( Vertex2fv );
- GPA_GL( Vertex2i );
- GPA_GL( Vertex2iv );
- GPA_GL( Vertex2s );
- GPA_GL( Vertex2sv );
- GPA_GL( Vertex3d );
- GPA_GL( Vertex3dv );
- GPA_GL( Vertex3f );
- GPA_GL( Vertex3fv );
- GPA_GL( Vertex3i );
- GPA_GL( Vertex3iv );
- GPA_GL( Vertex3s );
- GPA_GL( Vertex3sv );
- GPA_GL( Vertex4d );
- GPA_GL( Vertex4dv );
- GPA_GL( Vertex4f );
- GPA_GL( Vertex4fv );
- GPA_GL( Vertex4i );
- GPA_GL( Vertex4iv );
- GPA_GL( Vertex4s );
- GPA_GL( Vertex4sv );
- GPA_GL( ClipPlane );
- GPA_GL( ColorMaterial );
- GPA_GL( CullFace );
- GPA_GL( Fogf );
- GPA_GL( Fogfv );
- GPA_GL( Fogi );
- GPA_GL( Fogiv );
- GPA_GL( FrontFace );
- GPA_GL( Hint );
- GPA_GL( Lightf );
- GPA_GL( Lightfv );
- GPA_GL( Lighti );
- GPA_GL( Lightiv );
- GPA_GL( LightModelf );
- GPA_GL( LightModelfv );
- GPA_GL( LightModeli );
- GPA_GL( LightModeliv );
- GPA_GL( LineStipple );
- GPA_GL( LineWidth );
- GPA_GL( Materialf );
- GPA_GL( Materialfv );
- GPA_GL( Materiali );
- GPA_GL( Materialiv );
- GPA_GL( PointSize );
- GPA_GL( PolygonMode );
- GPA_GL( PolygonStipple );
- GPA_GL( Scissor );
- GPA_GL( ShadeModel );
- GPA_GL( TexParameterf );
- GPA_GL( TexParameterfv );
- GPA_GL( TexParameteri );
- GPA_GL( TexParameteriv );
- GPA_GL( TexImage1D );
- GPA_GL( TexImage2D );
- GPA_GL( TexEnvf );
- GPA_GL( TexEnvfv );
- GPA_GL( TexEnvi );
- GPA_GL( TexEnviv );
- GPA_GL( TexGend );
- GPA_GL( TexGendv );
- GPA_GL( TexGenf );
- GPA_GL( TexGenfv );
- GPA_GL( TexGeni );
- GPA_GL( TexGeniv );
- GPA_GL( FeedbackBuffer );
- GPA_GL( SelectBuffer );
- GPA_GL( RenderMode );
- GPA_GL( InitNames );
- GPA_GL( LoadName );
- GPA_GL( PassThrough );
- GPA_GL( PopName );
- GPA_GL( PushName );
- GPA_GL( DrawBuffer );
- GPA_GL( Clear );
- GPA_GL( ClearAccum );
- GPA_GL( ClearIndex );
- GPA_GL( ClearColor );
- GPA_GL( ClearStencil );
- GPA_GL( ClearDepth );
- GPA_GL( StencilMask );
- GPA_GL( ColorMask );
- GPA_GL( DepthMask );
- GPA_GL( IndexMask );
- GPA_GL( Accum );
- GPA_GL( Disable );
- GPA_GL( Enable );
- GPA_GL( Finish );
- GPA_GL( Flush );
- GPA_GL( PopAttrib );
- GPA_GL( PushAttrib );
- GPA_GL( Map1d );
- GPA_GL( Map1f );
- GPA_GL( Map2d );
- GPA_GL( Map2f );
- GPA_GL( MapGrid1d );
- GPA_GL( MapGrid1f );
- GPA_GL( MapGrid2d );
- GPA_GL( MapGrid2f );
- GPA_GL( EvalCoord1d );
- GPA_GL( EvalCoord1dv );
- GPA_GL( EvalCoord1f );
- GPA_GL( EvalCoord1fv );
- GPA_GL( EvalCoord2d );
- GPA_GL( EvalCoord2dv );
- GPA_GL( EvalCoord2f );
- GPA_GL( EvalCoord2fv );
- GPA_GL( EvalMesh1 );
- GPA_GL( EvalPoint1 );
- GPA_GL( EvalMesh2 );
- GPA_GL( EvalPoint2 );
- GPA_GL( AlphaFunc );
- GPA_GL( BlendFunc );
- GPA_GL( LogicOp );
- GPA_GL( StencilFunc );
- GPA_GL( StencilOp );
- GPA_GL( DepthFunc );
- GPA_GL( PixelZoom );
- GPA_GL( PixelTransferf );
- GPA_GL( PixelTransferi );
- GPA_GL( PixelStoref );
- GPA_GL( PixelStorei );
- GPA_GL( PixelMapfv );
- GPA_GL( PixelMapuiv );
- GPA_GL( PixelMapusv );
- GPA_GL( ReadBuffer );
- GPA_GL( CopyPixels );
- GPA_GL( ReadPixels );
- GPA_GL( DrawPixels );
- GPA_GL( GetBooleanv );
- GPA_GL( GetClipPlane );
- GPA_GL( GetDoublev );
- GPA_GL( GetError );
- GPA_GL( GetFloatv );
- GPA_GL( GetIntegerv );
- GPA_GL( GetLightfv );
- GPA_GL( GetLightiv );
- GPA_GL( GetMapdv );
- GPA_GL( GetMapfv );
- GPA_GL( GetMapiv );
- GPA_GL( GetMaterialfv );
- GPA_GL( GetMaterialiv );
- GPA_GL( GetPixelMapfv );
- GPA_GL( GetPixelMapuiv );
- GPA_GL( GetPixelMapusv );
- GPA_GL( GetPolygonStipple );
- GPA_GL( GetString );
- GPA_GL( GetTexEnvfv );
- GPA_GL( GetTexEnviv );
- GPA_GL( GetTexGendv );
- GPA_GL( GetTexGenfv );
- GPA_GL( GetTexGeniv );
- GPA_GL( GetTexImage );
- GPA_GL( GetTexParameterfv );
- GPA_GL( GetTexParameteriv );
- GPA_GL( GetTexLevelParameterfv );
- GPA_GL( GetTexLevelParameteriv );
- GPA_GL( IsEnabled );
- GPA_GL( IsList );
- GPA_GL( DepthRange );
- GPA_GL( Frustum );
- GPA_GL( LoadIdentity );
- GPA_GL( LoadMatrixf );
- GPA_GL( LoadMatrixd );
- GPA_GL( MatrixMode );
- GPA_GL( MultMatrixf );
- GPA_GL( MultMatrixd );
- GPA_GL( Ortho );
- GPA_GL( PopMatrix );
- GPA_GL( PushMatrix );
- GPA_GL( Rotated );
- GPA_GL( Rotatef );
- GPA_GL( Scaled );
- GPA_GL( Scalef );
- GPA_GL( Translated );
- GPA_GL( Translatef );
- GPA_GL( Viewport );
- GPA_GL( ArrayElement );
- GPA_GL( BindTexture );
- GPA_GL( ColorPointer );
- GPA_GL( DisableClientState );
- GPA_GL( DrawArrays );
- GPA_GL( DrawElements );
- GPA_GL( EdgeFlagPointer );
- GPA_GL( EnableClientState );
- GPA_GL( IndexPointer );
- GPA_GL( Indexub );
- GPA_GL( Indexubv );
- GPA_GL( InterleavedArrays );
- GPA_GL( NormalPointer );
- GPA_GL( PolygonOffset );
- GPA_GL( TexCoordPointer );
- GPA_GL( VertexPointer );
- GPA_GL( AreTexturesResident );
- GPA_GL( CopyTexImage1D );
- GPA_GL( CopyTexImage2D );
- GPA_GL( CopyTexSubImage1D );
- GPA_GL( CopyTexSubImage2D );
- GPA_GL( DeleteTextures );
- GPA_GL( GenTextures );
- GPA_GL( GetPointerv );
- GPA_GL( IsTexture );
- GPA_GL( PrioritizeTextures );
- GPA_GL( TexSubImage1D );
- GPA_GL( TexSubImage2D );
- GPA_GL( PopClientAttrib );
- GPA_GL( PushClientAttrib );
-}
+/**
+ * Although WGL allows different dispatch entrypoints per context
+ */
+static const GLCLTPROCTABLE cpt =
+{
+ OPENGL_VERSION_110_ENTRIES,
+ {
+ &glNewList,
+ &glEndList,
+ &glCallList,
+ &glCallLists,
+ &glDeleteLists,
+ &glGenLists,
+ &glListBase,
+ &glBegin,
+ &glBitmap,
+ &glColor3b,
+ &glColor3bv,
+ &glColor3d,
+ &glColor3dv,
+ &glColor3f,
+ &glColor3fv,
+ &glColor3i,
+ &glColor3iv,
+ &glColor3s,
+ &glColor3sv,
+ &glColor3ub,
+ &glColor3ubv,
+ &glColor3ui,
+ &glColor3uiv,
+ &glColor3us,
+ &glColor3usv,
+ &glColor4b,
+ &glColor4bv,
+ &glColor4d,
+ &glColor4dv,
+ &glColor4f,
+ &glColor4fv,
+ &glColor4i,
+ &glColor4iv,
+ &glColor4s,
+ &glColor4sv,
+ &glColor4ub,
+ &glColor4ubv,
+ &glColor4ui,
+ &glColor4uiv,
+ &glColor4us,
+ &glColor4usv,
+ &glEdgeFlag,
+ &glEdgeFlagv,
+ &glEnd,
+ &glIndexd,
+ &glIndexdv,
+ &glIndexf,
+ &glIndexfv,
+ &glIndexi,
+ &glIndexiv,
+ &glIndexs,
+ &glIndexsv,
+ &glNormal3b,
+ &glNormal3bv,
+ &glNormal3d,
+ &glNormal3dv,
+ &glNormal3f,
+ &glNormal3fv,
+ &glNormal3i,
+ &glNormal3iv,
+ &glNormal3s,
+ &glNormal3sv,
+ &glRasterPos2d,
+ &glRasterPos2dv,
+ &glRasterPos2f,
+ &glRasterPos2fv,
+ &glRasterPos2i,
+ &glRasterPos2iv,
+ &glRasterPos2s,
+ &glRasterPos2sv,
+ &glRasterPos3d,
+ &glRasterPos3dv,
+ &glRasterPos3f,
+ &glRasterPos3fv,
+ &glRasterPos3i,
+ &glRasterPos3iv,
+ &glRasterPos3s,
+ &glRasterPos3sv,
+ &glRasterPos4d,
+ &glRasterPos4dv,
+ &glRasterPos4f,
+ &glRasterPos4fv,
+ &glRasterPos4i,
+ &glRasterPos4iv,
+ &glRasterPos4s,
+ &glRasterPos4sv,
+ &glRectd,
+ &glRectdv,
+ &glRectf,
+ &glRectfv,
+ &glRecti,
+ &glRectiv,
+ &glRects,
+ &glRectsv,
+ &glTexCoord1d,
+ &glTexCoord1dv,
+ &glTexCoord1f,
+ &glTexCoord1fv,
+ &glTexCoord1i,
+ &glTexCoord1iv,
+ &glTexCoord1s,
+ &glTexCoord1sv,
+ &glTexCoord2d,
+ &glTexCoord2dv,
+ &glTexCoord2f,
+ &glTexCoord2fv,
+ &glTexCoord2i,
+ &glTexCoord2iv,
+ &glTexCoord2s,
+ &glTexCoord2sv,
+ &glTexCoord3d,
+ &glTexCoord3dv,
+ &glTexCoord3f,
+ &glTexCoord3fv,
+ &glTexCoord3i,
+ &glTexCoord3iv,
+ &glTexCoord3s,
+ &glTexCoord3sv,
+ &glTexCoord4d,
+ &glTexCoord4dv,
+ &glTexCoord4f,
+ &glTexCoord4fv,
+ &glTexCoord4i,
+ &glTexCoord4iv,
+ &glTexCoord4s,
+ &glTexCoord4sv,
+ &glVertex2d,
+ &glVertex2dv,
+ &glVertex2f,
+ &glVertex2fv,
+ &glVertex2i,
+ &glVertex2iv,
+ &glVertex2s,
+ &glVertex2sv,
+ &glVertex3d,
+ &glVertex3dv,
+ &glVertex3f,
+ &glVertex3fv,
+ &glVertex3i,
+ &glVertex3iv,
+ &glVertex3s,
+ &glVertex3sv,
+ &glVertex4d,
+ &glVertex4dv,
+ &glVertex4f,
+ &glVertex4fv,
+ &glVertex4i,
+ &glVertex4iv,
+ &glVertex4s,
+ &glVertex4sv,
+ &glClipPlane,
+ &glColorMaterial,
+ &glCullFace,
+ &glFogf,
+ &glFogfv,
+ &glFogi,
+ &glFogiv,
+ &glFrontFace,
+ &glHint,
+ &glLightf,
+ &glLightfv,
+ &glLighti,
+ &glLightiv,
+ &glLightModelf,
+ &glLightModelfv,
+ &glLightModeli,
+ &glLightModeliv,
+ &glLineStipple,
+ &glLineWidth,
+ &glMaterialf,
+ &glMaterialfv,
+ &glMateriali,
+ &glMaterialiv,
+ &glPointSize,
+ &glPolygonMode,
+ &glPolygonStipple,
+ &glScissor,
+ &glShadeModel,
+ &glTexParameterf,
+ &glTexParameterfv,
+ &glTexParameteri,
+ &glTexParameteriv,
+ &glTexImage1D,
+ &glTexImage2D,
+ &glTexEnvf,
+ &glTexEnvfv,
+ &glTexEnvi,
+ &glTexEnviv,
+ &glTexGend,
+ &glTexGendv,
+ &glTexGenf,
+ &glTexGenfv,
+ &glTexGeni,
+ &glTexGeniv,
+ &glFeedbackBuffer,
+ &glSelectBuffer,
+ &glRenderMode,
+ &glInitNames,
+ &glLoadName,
+ &glPassThrough,
+ &glPopName,
+ &glPushName,
+ &glDrawBuffer,
+ &glClear,
+ &glClearAccum,
+ &glClearIndex,
+ &glClearColor,
+ &glClearStencil,
+ &glClearDepth,
+ &glStencilMask,
+ &glColorMask,
+ &glDepthMask,
+ &glIndexMask,
+ &glAccum,
+ &glDisable,
+ &glEnable,
+ &glFinish,
+ &glFlush,
+ &glPopAttrib,
+ &glPushAttrib,
+ &glMap1d,
+ &glMap1f,
+ &glMap2d,
+ &glMap2f,
+ &glMapGrid1d,
+ &glMapGrid1f,
+ &glMapGrid2d,
+ &glMapGrid2f,
+ &glEvalCoord1d,
+ &glEvalCoord1dv,
+ &glEvalCoord1f,
+ &glEvalCoord1fv,
+ &glEvalCoord2d,
+ &glEvalCoord2dv,
+ &glEvalCoord2f,
+ &glEvalCoord2fv,
+ &glEvalMesh1,
+ &glEvalPoint1,
+ &glEvalMesh2,
+ &glEvalPoint2,
+ &glAlphaFunc,
+ &glBlendFunc,
+ &glLogicOp,
+ &glStencilFunc,
+ &glStencilOp,
+ &glDepthFunc,
+ &glPixelZoom,
+ &glPixelTransferf,
+ &glPixelTransferi,
+ &glPixelStoref,
+ &glPixelStorei,
+ &glPixelMapfv,
+ &glPixelMapuiv,
+ &glPixelMapusv,
+ &glReadBuffer,
+ &glCopyPixels,
+ &glReadPixels,
+ &glDrawPixels,
+ &glGetBooleanv,
+ &glGetClipPlane,
+ &glGetDoublev,
+ &glGetError,
+ &glGetFloatv,
+ &glGetIntegerv,
+ &glGetLightfv,
+ &glGetLightiv,
+ &glGetMapdv,
+ &glGetMapfv,
+ &glGetMapiv,
+ &glGetMaterialfv,
+ &glGetMaterialiv,
+ &glGetPixelMapfv,
+ &glGetPixelMapuiv,
+ &glGetPixelMapusv,
+ &glGetPolygonStipple,
+ &glGetString,
+ &glGetTexEnvfv,
+ &glGetTexEnviv,
+ &glGetTexGendv,
+ &glGetTexGenfv,
+ &glGetTexGeniv,
+ &glGetTexImage,
+ &glGetTexParameterfv,
+ &glGetTexParameteriv,
+ &glGetTexLevelParameterfv,
+ &glGetTexLevelParameteriv,
+ &glIsEnabled,
+ &glIsList,
+ &glDepthRange,
+ &glFrustum,
+ &glLoadIdentity,
+ &glLoadMatrixf,
+ &glLoadMatrixd,
+ &glMatrixMode,
+ &glMultMatrixf,
+ &glMultMatrixd,
+ &glOrtho,
+ &glPopMatrix,
+ &glPushMatrix,
+ &glRotated,
+ &glRotatef,
+ &glScaled,
+ &glScalef,
+ &glTranslated,
+ &glTranslatef,
+ &glViewport,
+ &glArrayElement,
+ &glBindTexture,
+ &glColorPointer,
+ &glDisableClientState,
+ &glDrawArrays,
+ &glDrawElements,
+ &glEdgeFlagPointer,
+ &glEnableClientState,
+ &glIndexPointer,
+ &glIndexub,
+ &glIndexubv,
+ &glInterleavedArrays,
+ &glNormalPointer,
+ &glPolygonOffset,
+ &glTexCoordPointer,
+ &glVertexPointer,
+ &glAreTexturesResident,
+ &glCopyTexImage1D,
+ &glCopyTexImage2D,
+ &glCopyTexSubImage1D,
+ &glCopyTexSubImage2D,
+ &glDeleteTextures,
+ &glGenTextures,
+ &glGetPointerv,
+ &glIsTexture,
+ &glPrioritizeTextures,
+ &glTexSubImage1D,
+ &glTexSubImage2D,
+ &glPopClientAttrib,
+ &glPushClientAttrib
+ }
+};
+
PGLCLTPROCTABLE APIENTRY
DrvSetContext(
@@ -521,17 +519,10 @@ DrvSetContext(
debug_printf( "%s( 0x%p, %u, 0x%p )\n",
__FUNCTION__, hdc, dhglrc, pfnSetProcTable );
- /* Although WGL allows different dispatch entrypoints per
- */
- if (!cpt_initialized) {
- init_proc_table( &cpt );
- cpt_initialized = TRUE;
- }
-
if (!stw_make_current( hdc, dhglrc ))
return NULL;
- return &cpt;
+ return (GLCLTPROCTABLE *)&cpt;
}
int APIENTRY
--
cgit v1.2.3
From 99b77d05d2e8c4af5f7d752d6827c21fd6c4d5ee Mon Sep 17 00:00:00 2001
From: José Fonseca
Date: Mon, 27 Apr 2009 13:09:58 +0100
Subject: mesa: Call _mesa_snprintf instead of snprintf.
snprintf not directly available on Windows.
---
src/mesa/main/imports.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
index 8797f36695..615f7c9a6d 100644
--- a/src/mesa/main/imports.c
+++ b/src/mesa/main/imports.c
@@ -1137,7 +1137,7 @@ _mesa_error( GLcontext *ctx, GLenum error, const char *fmtString, ... )
vsnprintf(s, MAXSTRING, fmtString, args);
va_end(args);
- snprintf(s2, MAXSTRING, "%s in %s", errstr, s);
+ _mesa_snprintf(s2, MAXSTRING, "%s in %s", errstr, s);
output_if_debug("Mesa: User error", s2, GL_TRUE);
}
}
--
cgit v1.2.3
From b618827fac84ca12a354da5808f30e96bedbc92a Mon Sep 17 00:00:00 2001
From: Micah Dowty
Date: Fri, 24 Apr 2009 23:45:16 +0200
Subject: util: Add debug_printf_once
---
src/gallium/auxiliary/util/u_debug.h | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/src/gallium/auxiliary/util/u_debug.h b/src/gallium/auxiliary/util/u_debug.h
index bcd8f0f3cf..d42b65ce28 100644
--- a/src/gallium/auxiliary/util/u_debug.h
+++ b/src/gallium/auxiliary/util/u_debug.h
@@ -102,6 +102,22 @@ debug_printf(const char *format, ...)
}
+/*
+ * ... isn't portable so we need to pass arguments in parentheses.
+ *
+ * usage:
+ * debug_printf_once(("awnser: %i\n", 42));
+ */
+#define debug_printf_once(args) \
+ do { \
+ static boolean once = TRUE; \
+ if (once) { \
+ once = FALSE; \
+ debug_printf args; \
+ } \
+ } while (0)
+
+
#ifdef DEBUG
#define debug_vprintf(_format, _ap) _debug_vprintf(_format, _ap)
#else
--
cgit v1.2.3
From 7da3f9403b235394a5c7e9456e34a0c9dad7dd15 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Fri, 24 Apr 2009 16:28:36 -0600
Subject: mesa: refactor code and make _mesa_find_temp_intervals() public
---
src/mesa/shader/prog_optimize.c | 154 ++++++++++++++++++++++++++++++++++------
src/mesa/shader/prog_optimize.h | 12 ++++
2 files changed, 144 insertions(+), 22 deletions(-)
diff --git a/src/mesa/shader/prog_optimize.c b/src/mesa/shader/prog_optimize.c
index 6ba2e76ff9..a02f5efa41 100644
--- a/src/mesa/shader/prog_optimize.c
+++ b/src/mesa/shader/prog_optimize.c
@@ -547,15 +547,13 @@ update_interval(GLint intBegin[], GLint intEnd[], GLuint index, GLuint ic)
/**
- * Find the live intervals for each temporary register in the program.
- * For register R, the interval [A,B] indicates that R is referenced
- * from instruction A through instruction B.
- * Special consideration is needed for loops and subroutines.
- * \return GL_TRUE if success, GL_FALSE if we cannot proceed for some reason
+ * Find first/last instruction that references each temporary register.
*/
-static GLboolean
-find_live_intervals(struct gl_program *prog,
- struct interval_list *liveIntervals)
+GLboolean
+_mesa_find_temp_intervals(const struct prog_instruction *instructions,
+ GLuint numInstructions,
+ GLint intBegin[MAX_PROGRAM_TEMPS],
+ GLint intEnd[MAX_PROGRAM_TEMPS])
{
struct loop_info
{
@@ -563,26 +561,15 @@ find_live_intervals(struct gl_program *prog,
};
struct loop_info loopStack[MAX_LOOP_NESTING];
GLuint loopStackDepth = 0;
- GLint intBegin[MAX_PROGRAM_TEMPS], intEnd[MAX_PROGRAM_TEMPS];
GLuint i;
- /*
- * Note: we'll return GL_FALSE below if we find relative indexing
- * into the TEMP register file. We can't handle that yet.
- * We also give up on subroutines for now.
- */
-
- if (dbg) {
- _mesa_printf("Optimize: Begin find intervals\n");
- }
-
for (i = 0; i < MAX_PROGRAM_TEMPS; i++){
intBegin[i] = intEnd[i] = -1;
}
/* Scan instructions looking for temporary registers */
- for (i = 0; i < prog->NumInstructions; i++) {
- const struct prog_instruction *inst = prog->Instructions + i;
+ for (i = 0; i < numInstructions; i++) {
+ const struct prog_instruction *inst = instructions + i;
if (inst->Opcode == OPCODE_BGNLOOP) {
loopStack[loopStackDepth].Start = i;
loopStack[loopStackDepth].End = inst->BranchTarget;
@@ -595,7 +582,7 @@ find_live_intervals(struct gl_program *prog,
return GL_FALSE;
}
else {
- const GLuint numSrc = _mesa_num_inst_src_regs(inst->Opcode);
+ const GLuint numSrc = 3;/*_mesa_num_inst_src_regs(inst->Opcode);*/
GLuint j;
for (j = 0; j < numSrc; j++) {
if (inst->SrcReg[j].File == PROGRAM_TEMPORARY) {
@@ -624,6 +611,39 @@ find_live_intervals(struct gl_program *prog,
}
}
+ return GL_TRUE;
+}
+
+
+/**
+ * Find the live intervals for each temporary register in the program.
+ * For register R, the interval [A,B] indicates that R is referenced
+ * from instruction A through instruction B.
+ * Special consideration is needed for loops and subroutines.
+ * \return GL_TRUE if success, GL_FALSE if we cannot proceed for some reason
+ */
+static GLboolean
+find_live_intervals(struct gl_program *prog,
+ struct interval_list *liveIntervals)
+{
+ GLint intBegin[MAX_PROGRAM_TEMPS], intEnd[MAX_PROGRAM_TEMPS];
+ GLuint i;
+
+ /*
+ * Note: we'll return GL_FALSE below if we find relative indexing
+ * into the TEMP register file. We can't handle that yet.
+ * We also give up on subroutines for now.
+ */
+
+ if (dbg) {
+ _mesa_printf("Optimize: Begin find intervals\n");
+ }
+
+ /* build intermediate arrays */
+ if (!_mesa_find_temp_intervals(prog->Instructions, prog->NumInstructions,
+ intBegin, intEnd))
+ return GL_FALSE;
+
/* Build live intervals list from intermediate arrays */
liveIntervals->Num = 0;
for (i = 0; i < MAX_PROGRAM_TEMPS; i++) {
@@ -794,6 +814,96 @@ _mesa_reallocate_registers(struct gl_program *prog)
+
+
+
+
+#if 0
+static void
+_mesa_find_temporary_live_intervals(struct gl_program *prog,
+ GLint firstInst[MAX_PROGRAM_TEMPS],
+ GLint lastInst[MAX_PROGRAM_TEMPS])
+{
+ GLuint i;
+
+ for (i = 0; i < MAX_PROGRAM_TEMPS; i++) {
+ firstInst[i] = lastInst[i] = -1;
+ }
+
+ struct loop_info loopStack[MAX_LOOP_NESTING];
+ GLuint loopStackDepth = 0;
+ GLint intBegin[MAX_PROGRAM_TEMPS], intEnd[MAX_PROGRAM_TEMPS];
+ GLuint i;
+
+ /*
+ * Note: we'll return GL_FALSE below if we find relative indexing
+ * into the TEMP register file. We can't handle that yet.
+ * We also give up on subroutines for now.
+ */
+
+ if (dbg) {
+ _mesa_printf("Optimize: Begin find intervals\n");
+ }
+
+ for (i = 0; i < MAX_PROGRAM_TEMPS; i++){
+ intBegin[i] = intEnd[i] = -1;
+ }
+
+ /* Scan instructions looking for temporary registers */
+ for (i = 0; i < prog->NumInstructions; i++) {
+ const struct prog_instruction *inst = prog->Instructions + i;
+ if (inst->Opcode == OPCODE_BGNLOOP) {
+ loopStack[loopStackDepth].Start = i;
+ loopStack[loopStackDepth].End = inst->BranchTarget;
+ loopStackDepth++;
+ }
+ else if (inst->Opcode == OPCODE_ENDLOOP) {
+ loopStackDepth--;
+ }
+ else if (inst->Opcode == OPCODE_CAL) {
+ return GL_FALSE;
+ }
+ else {
+ const GLuint numSrc = _mesa_num_inst_src_regs(inst->Opcode);
+ GLuint j;
+ for (j = 0; j < numSrc; j++) {
+ if (inst->SrcReg[j].File == PROGRAM_TEMPORARY) {
+ const GLuint index = inst->SrcReg[j].Index;
+ if (inst->SrcReg[j].RelAddr)
+ return GL_FALSE;
+ update_interval(intBegin, intEnd, index, i);
+ if (loopStackDepth > 0) {
+ /* extend temp register's interval to end of loop */
+ GLuint loopEnd = loopStack[loopStackDepth - 1].End;
+ update_interval(intBegin, intEnd, index, loopEnd);
+ }
+ }
+ }
+ if (inst->DstReg.File == PROGRAM_TEMPORARY) {
+ const GLuint index = inst->DstReg.Index;
+ if (inst->DstReg.RelAddr)
+ return GL_FALSE;
+ update_interval(intBegin, intEnd, index, i);
+ if (loopStackDepth > 0) {
+ /* extend temp register's interval to end of loop */
+ GLuint loopEnd = loopStack[loopStackDepth - 1].End;
+ update_interval(intBegin, intEnd, index, loopEnd);
+ }
+ }
+ }
+ }
+
+
+
+
+#endif
+
+
+
+
+
+
+
/**
* Apply optimizations to the given program to eliminate unnecessary
* instructions, temp regs, etc.
diff --git a/src/mesa/shader/prog_optimize.h b/src/mesa/shader/prog_optimize.h
index d102cfd9fc..43894a2723 100644
--- a/src/mesa/shader/prog_optimize.h
+++ b/src/mesa/shader/prog_optimize.h
@@ -25,7 +25,19 @@
#ifndef PROG_OPT_H
#define PROG_OPT_H
+
+#include "main/config.h"
+
+
struct gl_program;
+struct prog_instruction;
+
+
+extern GLboolean
+_mesa_find_temp_intervals(const struct prog_instruction *instructions,
+ GLuint numInstructions,
+ GLint intBegin[MAX_PROGRAM_TEMPS],
+ GLint intEnd[MAX_PROGRAM_TEMPS]);
extern void
_mesa_optimize_program(GLcontext *ctx, struct gl_program *program);
--
cgit v1.2.3
From b58b3a786aa38dcc9d72144c2cc691151e46e3d5 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Fri, 24 Apr 2009 16:33:46 -0600
Subject: i965: rework GLSL/WM register allocation
Use a bitvector of used/free flags.
If we run out of temps, examine the live intervals of the temp regs in
the program and free those which are no longer alive.
Also, enable the new WM const buffer code.
---
src/mesa/drivers/dri/i965/brw_wm.h | 5 +-
src/mesa/drivers/dri/i965/brw_wm_glsl.c | 211 +++++++++++++++++++++++++-------
2 files changed, 168 insertions(+), 48 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h
index d0ab3bdc65..75205fddb7 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.h
+++ b/src/mesa/drivers/dri/i965/brw_wm.h
@@ -240,15 +240,18 @@ struct brw_wm_compile {
GLuint max_wm_grf;
GLuint last_scratch;
+ GLuint cur_inst; /**< index of current instruction */
+
/** Mapping from Mesa registers to hardware registers */
struct {
GLboolean inited;
struct brw_reg reg;
} wm_regs[PROGRAM_PAYLOAD+1][256][4];
+ GLboolean used_grf[BRW_WM_MAX_GRF];
+ GLuint first_free_grf;
struct brw_reg stack;
struct brw_reg emit_mask_reg;
- GLuint reg_index; /**< Index of next free GRF register */
GLuint tmp_regs[BRW_WM_MAX_GRF];
GLuint tmp_index;
GLuint tmp_max;
diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c
index 22e17622c6..3471c1946e 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c
@@ -1,5 +1,7 @@
#include "main/macros.h"
#include "shader/prog_parameter.h"
+#include "shader/prog_print.h"
+#include "shader/prog_optimize.h"
#include "brw_context.h"
#include "brw_eu.h"
#include "brw_wm.h"
@@ -42,6 +44,76 @@ GLboolean brw_wm_is_glsl(const struct gl_fragment_program *fp)
}
+
+static void
+reclaim_temps(struct brw_wm_compile *c);
+
+
+/** Mark GRF register as used. */
+static void
+prealloc_grf(struct brw_wm_compile *c, int r)
+{
+ c->used_grf[r] = GL_TRUE;
+}
+
+
+/** Mark given GRF register as not in use. */
+static void
+release_grf(struct brw_wm_compile *c, int r)
+{
+ /*assert(c->used_grf[r]);*/
+ c->used_grf[r] = GL_FALSE;
+ c->first_free_grf = MIN2(c->first_free_grf, r);
+}
+
+
+/** Return index of a free GRF, mark it as used. */
+static int
+alloc_grf(struct brw_wm_compile *c)
+{
+ GLuint r;
+ for (r = c->first_free_grf; r < BRW_WM_MAX_GRF; r++) {
+ if (!c->used_grf[r]) {
+ c->used_grf[r] = GL_TRUE;
+ c->first_free_grf = r + 1; /* a guess */
+ return r;
+ }
+ }
+
+ /* no free temps, try to reclaim some */
+ reclaim_temps(c);
+ c->first_free_grf = 0;
+
+ /* try alloc again */
+ for (r = c->first_free_grf; r < BRW_WM_MAX_GRF; r++) {
+ if (!c->used_grf[r]) {
+ c->used_grf[r] = GL_TRUE;
+ c->first_free_grf = r + 1; /* a guess */
+ return r;
+ }
+ }
+
+ for (r = 0; r < BRW_WM_MAX_GRF; r++) {
+ assert(c->used_grf[r]);
+ }
+ /*printf("Really out of temp regs!\n");*/
+ return 60;
+}
+
+
+/** Return number of GRF registers used */
+static int
+num_grf_used(const struct brw_wm_compile *c)
+{
+ int r;
+ for (r = BRW_WM_MAX_GRF - 1; r >= 0; r--)
+ if (c->used_grf[r])
+ return r + 1;
+ return 0;
+}
+
+
+
/**
* Record the mapping of a Mesa register to a hardware register.
*/
@@ -68,11 +140,18 @@ static int get_scalar_dst_index(const struct prog_instruction *inst)
static struct brw_reg alloc_tmp(struct brw_wm_compile *c)
{
struct brw_reg reg;
- if(c->tmp_index == c->tmp_max)
- c->tmp_regs[ c->tmp_max++ ] = c->reg_index++;
-
+
+ /* if we need to allocate another temp, grow the tmp_regs[] array */
+ if (c->tmp_index == c->tmp_max) {
+ c->tmp_regs[ c->tmp_max++ ] = alloc_grf(c);
+ }
+
+ /* form the GRF register */
reg = brw_vec8_grf(c->tmp_regs[ c->tmp_index++ ], 0);
+ /*printf("alloc_temp %d\n", reg.nr);*/
+ assert(reg.nr < BRW_WM_MAX_GRF);
return reg;
+
}
/**
@@ -130,35 +209,26 @@ get_reg(struct brw_wm_compile *c, int file, int index, int component,
return brw_null_reg();
}
+ assert(index < 256);
/* see if we've already allocated a HW register for this Mesa register */
if (c->wm_regs[file][index][component].inited) {
- /* yes, re-use */
- reg = c->wm_regs[file][index][component].reg;
+ /* yes, re-use */
+ reg = c->wm_regs[file][index][component].reg;
}
else {
/* no, allocate new register */
- reg = brw_vec8_grf(c->reg_index, 0);
- }
+ int grf = alloc_grf(c);
+ if (grf < 0) {
+ /* totally out of temps */
+ grf = 70; /* XXX !!!! */
+ }
- /* if this is a new register allocation, record it in the table */
- if (!c->wm_regs[file][index][component].inited) {
- set_reg(c, file, index, component, reg);
- c->reg_index++;
- }
+ reg = brw_vec8_grf(grf, 0);
+ /*printf("Alloc new grf %d for %d.%d\n", reg.nr, index, component);*/
- if (c->reg_index >= BRW_WM_MAX_GRF - 12) {
- /* ran out of temporary registers! */
-#if 1
- /* This is a big hack for now.
- * Return bad register index, just don't hang the GPU.
- */
- _mesa_fprintf(stderr, "out of regs %d\n", c->reg_index);
- c->reg_index = BRW_WM_MAX_GRF - 13;
-#else
- return brw_null_reg();
-#endif
+ set_reg(c, file, index, component, reg);
}
-
+
if (neg & (1 << component)) {
reg = negate(reg);
}
@@ -168,6 +238,46 @@ get_reg(struct brw_wm_compile *c, int file, int index, int component,
}
+
+/**
+ * This is called if we run out of GRF registers. Examine the live intervals
+ * of temp regs in the program and free those which won't be used again.
+ */
+static void
+reclaim_temps(struct brw_wm_compile *c)
+{
+ GLint intBegin[MAX_PROGRAM_TEMPS];
+ GLint intEnd[MAX_PROGRAM_TEMPS];
+ int index;
+
+ /*printf("Reclaim temps:\n");*/
+
+ _mesa_find_temp_intervals(c->prog_instructions, c->nr_fp_insns,
+ intBegin, intEnd);
+
+ for (index = 0; index < MAX_PROGRAM_TEMPS; index++) {
+ if (intEnd[index] != -1 && intEnd[index] < c->cur_inst) {
+ /* program temp[i] can be freed */
+ int component;
+ /*printf(" temp[%d] is dead\n", index);*/
+ for (component = 0; component < 4; component++) {
+ if (c->wm_regs[PROGRAM_TEMPORARY][index][component].inited) {
+ int r = c->wm_regs[PROGRAM_TEMPORARY][index][component].reg.nr;
+ release_grf(c, r);
+ /*
+ printf(" Reclaim temp %d, reg %d at inst %d\n",
+ index, r, c->cur_inst);
+ */
+ c->wm_regs[PROGRAM_TEMPORARY][index][component].inited = GL_FALSE;
+ }
+ }
+ }
+ }
+}
+
+
+
+
/**
* Preallocate registers. This sets up the Mesa to hardware register
* mapping for certain registers, such as constants (uniforms/state vars)
@@ -179,6 +289,10 @@ static void prealloc_reg(struct brw_wm_compile *c)
struct brw_reg reg;
int nr_interp_regs = 0;
GLuint inputs = FRAG_BIT_WPOS | c->fp_interp_emitted | c->fp_deriv_emitted;
+ GLuint reg_index = 0;
+
+ memset(c->used_grf, GL_FALSE, sizeof(c->used_grf));
+ c->first_free_grf = 0;
for (i = 0; i < 4; i++) {
if (i < c->key.nr_depth_regs)
@@ -187,14 +301,20 @@ static void prealloc_reg(struct brw_wm_compile *c)
reg = brw_vec8_grf(0, 0);
set_reg(c, PROGRAM_PAYLOAD, PAYLOAD_DEPTH, i, reg);
}
- c->reg_index += 2 * c->key.nr_depth_regs;
+ reg_index += 2 * c->key.nr_depth_regs;
/* constants */
{
- const int nr_params = c->fp->program.Base.Parameters->NumParameters;
+ const GLuint nr_params = c->fp->program.Base.Parameters->NumParameters;
+ const GLuint nr_temps = c->fp->program.Base.NumTemporaries;
/* use a real constant buffer, or just use a section of the GRF? */
- c->use_const_buffer = GL_FALSE; /* (nr_params > 8);*/
+ /* XXX this heuristic may need adjustment... */
+ if ((nr_params + nr_temps) * 4 + reg_index > 80)
+ c->use_const_buffer = GL_TRUE;
+ else
+ c->use_const_buffer = GL_FALSE;
+ /*printf("WM use_const_buffer = %d\n", c->use_const_buffer);*/
if (c->use_const_buffer) {
/* We'll use a real constant buffer and fetch constants from
@@ -216,7 +336,7 @@ static void prealloc_reg(struct brw_wm_compile *c)
for (i = 0; i < nr_params; i++) {
/* loop over XYZW channels */
for (j = 0; j < 4; j++, index++) {
- reg = brw_vec1_grf(c->reg_index + index / 8, index % 8);
+ reg = brw_vec1_grf(reg_index + index / 8, index % 8);
/* Save pointer to parameter/constant value.
* Constants will be copied in prepare_constant_buffer()
*/
@@ -226,7 +346,7 @@ static void prealloc_reg(struct brw_wm_compile *c)
}
/* number of constant regs used (each reg is float[8]) */
c->nr_creg = 2 * ((4 * nr_params + 15) / 16);
- c->reg_index += c->nr_creg;
+ reg_index += c->nr_creg;
}
}
@@ -234,20 +354,24 @@ static void prealloc_reg(struct brw_wm_compile *c)
for (i = 0; i < FRAG_ATTRIB_MAX; i++) {
if (inputs & (1<reg_index, 0);
+ reg = brw_vec8_grf(reg_index, 0);
for (j = 0; j < 4; j++)
set_reg(c, PROGRAM_PAYLOAD, i, j, reg);
- c->reg_index += 2;
+ reg_index += 2;
}
}
c->prog_data.first_curbe_grf = c->key.nr_depth_regs * 2;
c->prog_data.urb_read_length = nr_interp_regs * 2;
c->prog_data.curb_read_length = c->nr_creg;
- c->emit_mask_reg = brw_uw1_reg(BRW_GENERAL_REGISTER_FILE, c->reg_index, 0);
- c->reg_index++;
- c->stack = brw_uw16_reg(BRW_GENERAL_REGISTER_FILE, c->reg_index, 0);
- c->reg_index += 2;
+ c->emit_mask_reg = brw_uw1_reg(BRW_GENERAL_REGISTER_FILE, reg_index, 0);
+ reg_index++;
+ c->stack = brw_uw16_reg(BRW_GENERAL_REGISTER_FILE, reg_index, 0);
+ reg_index += 2;
+
+ /* mark GRF regs [0..reg_index-1] as in-use */
+ for (i = 0; i < reg_index; i++)
+ prealloc_grf(c, i);
/* An instruction may reference up to three constants.
* They'll be found in these registers.
@@ -256,13 +380,9 @@ static void prealloc_reg(struct brw_wm_compile *c)
if (c->use_const_buffer) {
for (i = 0; i < 3; i++) {
c->current_const[i].index = -1;
- c->current_const[i].reg = alloc_tmp(c);
+ c->current_const[i].reg = brw_vec8_grf(alloc_grf(c), 0);
}
}
-#if 0
- printf("USE CONST BUFFER? %d\n", c->use_const_buffer);
- printf("AFTER PRE_ALLOC, reg_index = %d\n", c->reg_index);
-#endif
}
@@ -2595,7 +2715,6 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c)
struct brw_compile *p = &c->func;
struct brw_indirect stack_index = brw_indirect(0, 0);
- c->reg_index = 0;
prealloc_reg(c);
brw_set_compression_control(p, BRW_COMPRESSION_NONE);
brw_MOV(p, get_addr_reg(stack_index), brw_address(c->stack));
@@ -2603,6 +2722,8 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c)
for (i = 0; i < c->nr_fp_insns; i++) {
const struct prog_instruction *inst = &c->prog_instructions[i];
+ c->cur_inst = i;
+
#if 0
_mesa_printf("Inst %d: ", i);
_mesa_print_instruction(inst);
@@ -2833,17 +2954,13 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c)
_mesa_printf("unsupported IR in fragment shader %d\n",
inst->Opcode);
}
+
if (inst->CondUpdate)
brw_set_predicate_control(p, BRW_PREDICATE_NORMAL);
else
brw_set_predicate_control(p, BRW_PREDICATE_NONE);
}
post_wm_emit(c);
-
- if (c->reg_index >= BRW_WM_MAX_GRF) {
- _mesa_problem(NULL, "Ran out of registers in brw_wm_emit_glsl()");
- /* XXX we need to do some proper error recovery here */
- }
}
@@ -2867,6 +2984,6 @@ void brw_wm_glsl_emit(struct brw_context *brw, struct brw_wm_compile *c)
brw_wm_print_program(c, "brw_wm_glsl_emit done");
}
- c->prog_data.total_grf = c->reg_index;
+ c->prog_data.total_grf = num_grf_used(c);
c->prog_data.total_scratch = 0;
}
--
cgit v1.2.3
From e32660060954c0d1a1f7636c6365970348f3be24 Mon Sep 17 00:00:00 2001
From: Shuang He
Date: Mon, 27 Apr 2009 07:13:33 -0600
Subject: demos: Clean up allocated Textures and Display Lists when demo quit
---
progs/demos/ipers.c | 18 ++++++++++++++++++
progs/demos/teapot.c | 11 +++++++++++
progs/demos/tunnel.c | 9 +++++++++
progs/demos/tunnel2.c | 9 +++++++++
4 files changed, 47 insertions(+)
diff --git a/progs/demos/ipers.c b/progs/demos/ipers.c
index 6e153c04e1..5d82b0dc92 100644
--- a/progs/demos/ipers.c
+++ b/progs/demos/ipers.c
@@ -236,11 +236,28 @@ special(int k, int x, int y)
}
}
+static void
+cleanup(void)
+{
+ int i;
+
+ glDeleteTextures(1, &t1id);
+ glDeleteTextures(1, &t2id);
+
+ glDeleteLists(skydlist, 1);
+ for (i = 0; i < MAX_LOD; i++) {
+ glDeleteLists(LODdlist[i], 1);
+ glDeleteLists(LODnumpoly[i], 1);
+ }
+}
+
+
static void
key(unsigned char k, int x, int y)
{
switch (k) {
case 27:
+ cleanup();
exit(0);
break;
@@ -707,6 +724,7 @@ main(int ac, char **av)
glutIdleFunc(draw);
glutMainLoop();
+ cleanup();
return 0;
}
diff --git a/progs/demos/teapot.c b/progs/demos/teapot.c
index 38ede7ac3e..6bf6e06409 100644
--- a/progs/demos/teapot.c
+++ b/progs/demos/teapot.c
@@ -173,10 +173,20 @@ static void special(int k, int x, int y)
}
}
+static void cleanup(void)
+{
+ glDeleteTextures(1, &t1id);
+ glDeleteTextures(1, &t2id);
+ glDeleteLists(teapotdlist, 1);
+ glDeleteLists(basedlist, 1);
+ glDeleteLists(lightdlist, 1);
+}
+
static void key(unsigned char k, int x, int y)
{
switch(k) {
case 27:
+ cleanup();
exit(0);
break;
@@ -670,6 +680,7 @@ int main(int ac, char **av)
glutIdleFunc(draw);
glutMainLoop();
+ cleanup();
return 0;
}
diff --git a/progs/demos/tunnel.c b/progs/demos/tunnel.c
index 6a240580e8..6981da3298 100644
--- a/progs/demos/tunnel.c
+++ b/progs/demos/tunnel.c
@@ -202,11 +202,19 @@ special(int k, int x, int y)
}
}
+static void
+cleanup(void)
+{
+ glDeleteTextures(1, &t1id);
+ glDeleteTextures(1, &t2id);
+}
+
static void
key(unsigned char k, int x, int y)
{
switch (k) {
case 27:
+ cleanup();
exit(0);
break;
@@ -531,5 +539,6 @@ main(int ac, char **av)
glutMainLoop();
+ cleanup();
return 0;
}
diff --git a/progs/demos/tunnel2.c b/progs/demos/tunnel2.c
index f4171a8346..0288ea0f8c 100644
--- a/progs/demos/tunnel2.c
+++ b/progs/demos/tunnel2.c
@@ -200,6 +200,13 @@ special(int k, int x, int y)
}
}
+static void
+cleanup(void)
+{
+ glDeleteTextures(1, &t1id);
+ glDeleteTextures(1, &t2id);
+}
+
static void
key(unsigned char k, int x, int y)
{
@@ -207,6 +214,7 @@ key(unsigned char k, int x, int y)
case 27:
glutDestroyWindow(channel[0]);
glutDestroyWindow(channel[1]);
+ cleanup();
exit(0);
break;
@@ -602,6 +610,7 @@ main(int ac, char **av)
calcposobs();
glutMainLoop();
+ cleanup();
return 0;
}
--
cgit v1.2.3
From 5ed7764fd6354da8e2be15d6fb724c2d6be9be4a Mon Sep 17 00:00:00 2001
From: Keith Whitwell
Date: Mon, 27 Apr 2009 14:42:23 +0100
Subject: mesa/st: fix incorrect face, level in compress_with_blit
We were incorrectly applying the destination texture face and level
when requesting a transfer to the temporary texture, which has only
one face and level. This would obviously cause problems uploading to
compressed cube and mipmap textures.
---
src/mesa/state_tracker/st_cb_texture.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index c3e990e077..aeb75117ec 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -418,7 +418,6 @@ compress_with_blit(GLcontext * ctx,
const GLuint dstImageOffsets[1] = {0};
struct st_texture_image *stImage = st_texture_image(texImage);
struct pipe_screen *screen = ctx->st->pipe->screen;
- const GLuint face = _mesa_tex_target_to_face(target);
const struct gl_texture_format *mesa_format;
struct pipe_texture templ;
struct pipe_texture *src_tex;
@@ -467,7 +466,7 @@ compress_with_blit(GLcontext * ctx,
/* Put user's tex data into the temporary texture
*/
tex_xfer = st_cond_flush_get_tex_transfer(st_context(ctx), src_tex,
- face, level, 0,
+ 0, 0, 0, /* face, level are zero */
PIPE_TRANSFER_WRITE,
0, 0, width, height); /* x, y, w, h */
map = screen->transfer_map(screen, tex_xfer);
--
cgit v1.2.3
From 5250eec652af46d20261624fd043992355a0b4ba Mon Sep 17 00:00:00 2001
From: Keith Whitwell
Date: Mon, 27 Apr 2009 14:43:31 +0100
Subject: util/time: add util_time_sleep() for windows userspace
Somebody with a clue could probably do a better implemenation...
---
src/gallium/auxiliary/util/u_time.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/gallium/auxiliary/util/u_time.c b/src/gallium/auxiliary/util/u_time.c
index 8afe4fccf7..8e167d3c42 100644
--- a/src/gallium/auxiliary/util/u_time.c
+++ b/src/gallium/auxiliary/util/u_time.c
@@ -217,4 +217,13 @@ void util_time_sleep(unsigned usecs)
} while(start <= curr && curr < end ||
end < start && (curr < end || start <= curr));
}
+#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
+#include
+#include
+
+
+void util_time_sleep(unsigned usecs)
+{
+ Sleep((usecs + 999)/ 1000);
+}
#endif
--
cgit v1.2.3
From dc9705d12d162ba6d087eb762e315de9f97bc456 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Mon, 27 Apr 2009 09:51:46 -0600
Subject: i965: only upload constant buffer data when we actually need the
const buffer
Make the use_const_buffer field per-program and only call the code which
updates the constant buffer's data if the flag is set.
This should undo the perf regression from 20f3497e4b6756e330f7b3f54e8acaa1d6c92052
---
src/mesa/drivers/dri/i965/brw_context.h | 2 ++
src/mesa/drivers/dri/i965/brw_curbe.c | 6 ++++--
src/mesa/drivers/dri/i965/brw_vs.h | 2 --
src/mesa/drivers/dri/i965/brw_vs_emit.c | 10 +++++-----
src/mesa/drivers/dri/i965/brw_wm.h | 2 --
src/mesa/drivers/dri/i965/brw_wm_glsl.c | 12 ++++++------
6 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index a0b3b06309..aef2ff5f86 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -161,6 +161,7 @@ struct brw_vertex_program {
struct gl_vertex_program program;
GLuint id;
dri_bo *const_buffer; /** Program constant buffer/surface */
+ GLboolean use_const_buffer;
};
@@ -171,6 +172,7 @@ struct brw_fragment_program {
GLboolean isGLSL; /**< really, any IF/LOOP/CONT/BREAK instructions */
dri_bo *const_buffer; /** Program constant buffer/surface */
+ GLboolean use_const_buffer;
};
diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c
index 2d15793078..9197fede2d 100644
--- a/src/mesa/drivers/dri/i965/brw_curbe.c
+++ b/src/mesa/drivers/dri/i965/brw_curbe.c
@@ -383,7 +383,8 @@ update_vertex_constant_buffer(struct brw_context *brw)
printf("update VS constants in buffer %p\n", vp->const_buffer);
printf("program %u\n", vp->program.Base.Id);
}
- update_constant_buffer(brw, vp->program.Base.Parameters, vp->const_buffer);
+ if (vp->use_const_buffer)
+ update_constant_buffer(brw, vp->program.Base.Parameters, vp->const_buffer);
}
@@ -393,7 +394,8 @@ update_fragment_constant_buffer(struct brw_context *brw)
{
struct brw_fragment_program *fp =
(struct brw_fragment_program *) brw->fragment_program;
- update_constant_buffer(brw, fp->program.Base.Parameters, fp->const_buffer);
+ if (fp->use_const_buffer)
+ update_constant_buffer(brw, fp->program.Base.Parameters, fp->const_buffer);
}
diff --git a/src/mesa/drivers/dri/i965/brw_vs.h b/src/mesa/drivers/dri/i965/brw_vs.h
index d20cf78b8a..1e4f66091e 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.h
+++ b/src/mesa/drivers/dri/i965/brw_vs.h
@@ -75,8 +75,6 @@ struct brw_vs_compile {
struct brw_reg userplane[6];
- /** using a real constant buffer? */
- GLboolean use_const_buffer;
/** we may need up to 3 constants per instruction (if use_const_buffer) */
struct {
GLint index;
diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c
index 524f1211ce..b69616d6e5 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c
@@ -71,10 +71,10 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c )
#if 0
if (c->vp->program.Base.Parameters->NumParameters >= 6)
- c->use_const_buffer = 1;
+ c->vp->use_const_buffer = 1;
else
#endif
- c->use_const_buffer = GL_FALSE;
+ c->vp->use_const_buffer = GL_FALSE;
/*printf("use_const_buffer = %d\n", c->use_const_buffer);*/
/* r0 -- reserved as usual
@@ -96,7 +96,7 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c )
/* Vertex program parameters from curbe:
*/
- if (c->use_const_buffer) {
+ if (c->vp->use_const_buffer) {
/* get constants from a real constant buffer */
c->prog_data.curb_read_length = 0;
c->prog_data.nr_params = 4; /* XXX 0 causes a bug elsewhere... */
@@ -172,7 +172,7 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c )
reg++;
}
- if (c->use_const_buffer) {
+ if (c->vp->use_const_buffer) {
for (i = 0; i < 3; i++) {
c->current_const[i].index = -1;
c->current_const[i].reg = brw_vec8_grf(reg, 0);
@@ -869,7 +869,7 @@ get_src_reg( struct brw_vs_compile *c,
case PROGRAM_STATE_VAR:
case PROGRAM_CONSTANT:
case PROGRAM_UNIFORM:
- if (c->use_const_buffer) {
+ if (c->vp->use_const_buffer) {
return get_constant(c, inst, argIndex);
}
else if (relAddr) {
diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h
index d0ab3bdc65..f0d31fc1dd 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.h
+++ b/src/mesa/drivers/dri/i965/brw_wm.h
@@ -254,8 +254,6 @@ struct brw_wm_compile {
GLuint tmp_max;
GLuint subroutines[BRW_WM_MAX_SUBROUTINE];
- /** using a real constant buffer? */
- GLboolean use_const_buffer;
/** we may need up to 3 constants per instruction (if use_const_buffer) */
struct {
GLint index;
diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c
index 22e17622c6..117460842a 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c
@@ -194,9 +194,9 @@ static void prealloc_reg(struct brw_wm_compile *c)
const int nr_params = c->fp->program.Base.Parameters->NumParameters;
/* use a real constant buffer, or just use a section of the GRF? */
- c->use_const_buffer = GL_FALSE; /* (nr_params > 8);*/
+ c->fp->use_const_buffer = GL_FALSE; /* (nr_params > 8);*/
- if (c->use_const_buffer) {
+ if (c->fp->use_const_buffer) {
/* We'll use a real constant buffer and fetch constants from
* it with a dataport read message.
*/
@@ -253,14 +253,14 @@ static void prealloc_reg(struct brw_wm_compile *c)
* They'll be found in these registers.
* XXX alloc these on demand!
*/
- if (c->use_const_buffer) {
+ if (c->fp->use_const_buffer) {
for (i = 0; i < 3; i++) {
c->current_const[i].index = -1;
c->current_const[i].reg = alloc_tmp(c);
}
}
#if 0
- printf("USE CONST BUFFER? %d\n", c->use_const_buffer);
+ printf("USE CONST BUFFER? %d\n", c->fp->use_const_buffer);
printf("AFTER PRE_ALLOC, reg_index = %d\n", c->reg_index);
#endif
}
@@ -368,7 +368,7 @@ static struct brw_reg get_src_reg(struct brw_wm_compile *c,
const GLuint nr = 1;
const GLuint component = GET_SWZ(src->Swizzle, channel);
- if (c->use_const_buffer &&
+ if (c->fp->use_const_buffer &&
(src->File == PROGRAM_STATE_VAR ||
src->File == PROGRAM_CONSTANT ||
src->File == PROGRAM_UNIFORM)) {
@@ -2609,7 +2609,7 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c)
#endif
/* fetch any constants that this instruction needs */
- if (c->use_const_buffer)
+ if (c->fp->use_const_buffer)
fetch_constants(c, inst);
if (inst->CondUpdate)
--
cgit v1.2.3
From 3ebcf2dd7489ecaf19a7167892069c4d58c285d8 Mon Sep 17 00:00:00 2001
From: José Fonseca
Date: Mon, 27 Apr 2009 17:13:40 +0100
Subject: util: Remove unix includes.
---
src/gallium/auxiliary/util/u_time.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/src/gallium/auxiliary/util/u_time.c b/src/gallium/auxiliary/util/u_time.c
index 8e167d3c42..5268cbf79c 100644
--- a/src/gallium/auxiliary/util/u_time.c
+++ b/src/gallium/auxiliary/util/u_time.c
@@ -218,10 +218,6 @@ void util_time_sleep(unsigned usecs)
end < start && (curr < end || start <= curr));
}
#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
-#include
-#include
-
-
void util_time_sleep(unsigned usecs)
{
Sleep((usecs + 999)/ 1000);
--
cgit v1.2.3
From c384ccb0c4f50f72bafdfb693d0aa36b4304a064 Mon Sep 17 00:00:00 2001
From: José Fonseca
Date: Mon, 27 Apr 2009 17:30:05 +0100
Subject: wgl: Implement WGL_EXT_extensions_string extension.
---
src/gallium/state_trackers/wgl/SConscript | 2 +-
.../wgl/shared/stw_arbextensionsstring.c | 46 -----------------
.../wgl/shared/stw_extensionsstring.c | 58 ++++++++++++++++++++++
.../state_trackers/wgl/shared/stw_getprocaddress.c | 3 ++
4 files changed, 62 insertions(+), 47 deletions(-)
delete mode 100644 src/gallium/state_trackers/wgl/shared/stw_arbextensionsstring.c
create mode 100644 src/gallium/state_trackers/wgl/shared/stw_extensionsstring.c
diff --git a/src/gallium/state_trackers/wgl/SConscript b/src/gallium/state_trackers/wgl/SConscript
index 61fd8bfc0c..5bbcc7175f 100644
--- a/src/gallium/state_trackers/wgl/SConscript
+++ b/src/gallium/state_trackers/wgl/SConscript
@@ -26,7 +26,7 @@ if env['platform'] in ['windows']:
'shared/stw_device.c',
'shared/stw_framebuffer.c',
'shared/stw_pixelformat.c',
- 'shared/stw_arbextensionsstring.c',
+ 'shared/stw_extensionsstring.c',
'shared/stw_getprocaddress.c',
'shared/stw_arbpixelformat.c',
'shared/stw_tls.c',
diff --git a/src/gallium/state_trackers/wgl/shared/stw_arbextensionsstring.c b/src/gallium/state_trackers/wgl/shared/stw_arbextensionsstring.c
deleted file mode 100644
index cd9fe93eee..0000000000
--- a/src/gallium/state_trackers/wgl/shared/stw_arbextensionsstring.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#include
-
-#define WGL_WGLEXT_PROTOTYPES
-
-#include
-#include
-
-
-WINGDIAPI const char * APIENTRY
-wglGetExtensionsStringARB(
- HDC hdc )
-{
- (void) hdc;
-
- return
- "WGL_ARB_extensions_string "
- "WGL_ARB_multisample "
- "WGL_ARB_pixel_format";
-}
diff --git a/src/gallium/state_trackers/wgl/shared/stw_extensionsstring.c b/src/gallium/state_trackers/wgl/shared/stw_extensionsstring.c
new file mode 100644
index 0000000000..2660c591f9
--- /dev/null
+++ b/src/gallium/state_trackers/wgl/shared/stw_extensionsstring.c
@@ -0,0 +1,58 @@
+/**************************************************************************
+ *
+ * Copyright 2009 VMware, Inc.
+ * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#include
+
+#define WGL_WGLEXT_PROTOTYPES
+
+#include
+#include
+
+
+static const char *stw_extension_string =
+ "WGL_ARB_extensions_string "
+ "WGL_ARB_multisample "
+ "WGL_ARB_pixel_format "
+ "WGL_EXT_extensions_string";
+
+
+WINGDIAPI const char * APIENTRY
+wglGetExtensionsStringARB(
+ HDC hdc )
+{
+ (void) hdc;
+
+ return stw_extension_string;
+}
+
+
+WINGDIAPI const char * APIENTRY
+wglGetExtensionsStringEXT( void )
+{
+ return stw_extension_string;
+}
diff --git a/src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c b/src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c
index aa43120955..4070cbd5c0 100644
--- a/src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c
+++ b/src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c
@@ -53,6 +53,9 @@ static const struct stw_extension_entry stw_extension_entries[] = {
STW_EXTENSION_ENTRY( wglGetPixelFormatAttribfvARB ),
STW_EXTENSION_ENTRY( wglGetPixelFormatAttribivARB ),
+ /* WGL_EXT_extensions_string */
+ STW_EXTENSION_ENTRY( wglGetExtensionsStringEXT ),
+
{ NULL, NULL }
};
--
cgit v1.2.3
From 777b9ff43e88e456d686208c83712f26aba2dd95 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Mon, 27 Apr 2009 10:45:41 -0600
Subject: i965: only upload constant buffer data when we actually need the
const buffer
Make the use_const_buffer field per-program and only call the code which
updates the constant buffer's data if the flag is set.
This should undo the perf regression from 20f3497e4b6756e330f7b3f54e8acaa1d6c92052
(cherry picked from master, commit dc9705d12d162ba6d087eb762e315de9f97bc456)
---
src/mesa/drivers/dri/i965/brw_context.h | 2 ++
src/mesa/drivers/dri/i965/brw_curbe.c | 6 ++++--
src/mesa/drivers/dri/i965/brw_vs.h | 2 --
src/mesa/drivers/dri/i965/brw_vs_emit.c | 11 ++++++-----
src/mesa/drivers/dri/i965/brw_wm.h | 2 --
src/mesa/drivers/dri/i965/brw_wm_glsl.c | 16 ++++++++++------
6 files changed, 22 insertions(+), 17 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index f0d4993e11..838e718d0d 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -161,6 +161,7 @@ struct brw_vertex_program {
struct gl_vertex_program program;
GLuint id;
dri_bo *const_buffer; /** Program constant buffer/surface */
+ GLboolean use_const_buffer;
};
@@ -171,6 +172,7 @@ struct brw_fragment_program {
GLboolean isGLSL; /**< really, any IF/LOOP/CONT/BREAK instructions */
dri_bo *const_buffer; /** Program constant buffer/surface */
+ GLboolean use_const_buffer;
};
diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c
index da746e4aa0..e6e26cdc40 100644
--- a/src/mesa/drivers/dri/i965/brw_curbe.c
+++ b/src/mesa/drivers/dri/i965/brw_curbe.c
@@ -368,7 +368,8 @@ update_vertex_constant_buffer(struct brw_context *brw)
printf("update VS constants in buffer %p vp = %p\n", vp->const_buffer, vp);
printf("program %u\n", vp->program.Base.Id);
}
- update_constant_buffer(brw, vp->program.Base.Parameters, vp->const_buffer);
+ if (vp->use_const_buffer)
+ update_constant_buffer(brw, vp->program.Base.Parameters, vp->const_buffer);
}
@@ -382,7 +383,8 @@ update_fragment_constant_buffer(struct brw_context *brw)
printf("update WM constants in buffer %p\n", fp->const_buffer);
printf("program %u\n", fp->program.Base.Id);
}
- update_constant_buffer(brw, fp->program.Base.Parameters, fp->const_buffer);
+ if (fp->use_const_buffer)
+ update_constant_buffer(brw, fp->program.Base.Parameters, fp->const_buffer);
}
diff --git a/src/mesa/drivers/dri/i965/brw_vs.h b/src/mesa/drivers/dri/i965/brw_vs.h
index d20cf78b8a..1e4f66091e 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.h
+++ b/src/mesa/drivers/dri/i965/brw_vs.h
@@ -75,8 +75,6 @@ struct brw_vs_compile {
struct brw_reg userplane[6];
- /** using a real constant buffer? */
- GLboolean use_const_buffer;
/** we may need up to 3 constants per instruction (if use_const_buffer) */
struct {
GLint index;
diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c
index c2b3702798..b9a338b1cd 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c
@@ -76,9 +76,10 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c )
*/
if (c->vp->program.Base.Parameters->NumParameters +
c->vp->program.Base.NumTemporaries + 20 > BRW_MAX_GRF)
- c->use_const_buffer = GL_TRUE;
+ c->vp->use_const_buffer = GL_TRUE;
else
- c->use_const_buffer = GL_FALSE;
+ c->vp->use_const_buffer = GL_FALSE;
+
/*printf("use_const_buffer = %d\n", c->use_const_buffer);*/
/* r0 -- reserved as usual
@@ -100,7 +101,7 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c )
/* Vertex program parameters from curbe:
*/
- if (c->use_const_buffer) {
+ if (c->vp->use_const_buffer) {
/* get constants from a real constant buffer */
c->prog_data.curb_read_length = 0;
c->prog_data.nr_params = 4; /* XXX 0 causes a bug elsewhere... */
@@ -176,7 +177,7 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c )
reg++;
}
- if (c->use_const_buffer) {
+ if (c->vp->use_const_buffer) {
for (i = 0; i < 3; i++) {
c->current_const[i].index = -1;
c->current_const[i].reg = brw_vec8_grf(reg, 0);
@@ -873,7 +874,7 @@ get_src_reg( struct brw_vs_compile *c,
case PROGRAM_STATE_VAR:
case PROGRAM_CONSTANT:
case PROGRAM_UNIFORM:
- if (c->use_const_buffer) {
+ if (c->vp->use_const_buffer) {
return get_constant(c, inst, argIndex);
}
else if (relAddr) {
diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h
index 75205fddb7..2f80a60c12 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.h
+++ b/src/mesa/drivers/dri/i965/brw_wm.h
@@ -257,8 +257,6 @@ struct brw_wm_compile {
GLuint tmp_max;
GLuint subroutines[BRW_WM_MAX_SUBROUTINE];
- /** using a real constant buffer? */
- GLboolean use_const_buffer;
/** we may need up to 3 constants per instruction (if use_const_buffer) */
struct {
GLint index;
diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c
index 3471c1946e..eca4ca2c82 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c
@@ -311,12 +311,12 @@ static void prealloc_reg(struct brw_wm_compile *c)
/* use a real constant buffer, or just use a section of the GRF? */
/* XXX this heuristic may need adjustment... */
if ((nr_params + nr_temps) * 4 + reg_index > 80)
- c->use_const_buffer = GL_TRUE;
+ c->fp->use_const_buffer = GL_TRUE;
else
- c->use_const_buffer = GL_FALSE;
+ c->fp->use_const_buffer = GL_FALSE;
/*printf("WM use_const_buffer = %d\n", c->use_const_buffer);*/
- if (c->use_const_buffer) {
+ if (c->fp->use_const_buffer) {
/* We'll use a real constant buffer and fetch constants from
* it with a dataport read message.
*/
@@ -377,12 +377,16 @@ static void prealloc_reg(struct brw_wm_compile *c)
* They'll be found in these registers.
* XXX alloc these on demand!
*/
- if (c->use_const_buffer) {
+ if (c->fp->use_const_buffer) {
for (i = 0; i < 3; i++) {
c->current_const[i].index = -1;
c->current_const[i].reg = brw_vec8_grf(alloc_grf(c), 0);
}
}
+#if 0
+ printf("USE CONST BUFFER? %d\n", c->fp->use_const_buffer);
+ printf("AFTER PRE_ALLOC, reg_index = %d\n", c->reg_index);
+#endif
}
@@ -488,7 +492,7 @@ static struct brw_reg get_src_reg(struct brw_wm_compile *c,
const GLuint nr = 1;
const GLuint component = GET_SWZ(src->Swizzle, channel);
- if (c->use_const_buffer &&
+ if (c->fp->use_const_buffer &&
(src->File == PROGRAM_STATE_VAR ||
src->File == PROGRAM_CONSTANT ||
src->File == PROGRAM_UNIFORM)) {
@@ -2730,7 +2734,7 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c)
#endif
/* fetch any constants that this instruction needs */
- if (c->use_const_buffer)
+ if (c->fp->use_const_buffer)
fetch_constants(c, inst);
if (inst->CondUpdate)
--
cgit v1.2.3
From dd4802176f7751e8c38c000687ff9cb9633649aa Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Mon, 27 Apr 2009 10:46:30 -0600
Subject: i965: #include prog_print.h to silence warning
---
src/mesa/drivers/dri/i965/brw_curbe.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c
index e6e26cdc40..f6d2014fb1 100644
--- a/src/mesa/drivers/dri/i965/brw_curbe.c
+++ b/src/mesa/drivers/dri/i965/brw_curbe.c
@@ -36,6 +36,7 @@
#include "main/macros.h"
#include "main/enums.h"
#include "shader/prog_parameter.h"
+#include "shader/prog_print.h"
#include "shader/prog_statevars.h"
#include "intel_batchbuffer.h"
#include "intel_regions.h"
--
cgit v1.2.3
From 76b9da9e98bad4bf22fe6610394236203b620bd9 Mon Sep 17 00:00:00 2001
From: José Fonseca
Date: Mon, 27 Apr 2009 18:48:11 +0100
Subject: wgl: Cope with pre-existing threads.
DllMain is called with DLL_THREAD_ATTACH only by threads created after
the DLL is loaded by the process.
---
src/gallium/state_trackers/wgl/shared/stw_tls.c | 39 ++++++++++++++++++++-----
1 file changed, 31 insertions(+), 8 deletions(-)
diff --git a/src/gallium/state_trackers/wgl/shared/stw_tls.c b/src/gallium/state_trackers/wgl/shared/stw_tls.c
index e72bafb880..95863ca9cf 100644
--- a/src/gallium/state_trackers/wgl/shared/stw_tls.c
+++ b/src/gallium/state_trackers/wgl/shared/stw_tls.c
@@ -44,6 +44,20 @@ stw_tls_init(void)
return TRUE;
}
+static INLINE struct stw_tls_data *
+stw_tls_data_create()
+{
+ struct stw_tls_data *data;
+
+ data = CALLOC_STRUCT(stw_tls_data);
+ if (!data)
+ return NULL;
+
+ data->currentPixelFormat = 0;
+
+ return data;
+}
+
boolean
stw_tls_init_thread(void)
{
@@ -53,14 +67,9 @@ stw_tls_init_thread(void)
return FALSE;
}
- data = MALLOC(sizeof(*data));
- if (!data) {
+ data = stw_tls_data_create();
+ if(!data)
return FALSE;
- }
-
- data->currentPixelFormat = 0;
- data->currentDC = NULL;
- data->currentGLRC = 0;
TlsSetValue(tlsIndex, data);
@@ -93,9 +102,23 @@ stw_tls_cleanup(void)
struct stw_tls_data *
stw_tls_get_data(void)
{
+ struct stw_tls_data *data;
+
if (tlsIndex == TLS_OUT_OF_INDEXES) {
return NULL;
}
+
+ data = (struct stw_tls_data *) TlsGetValue(tlsIndex);
+ if(!data) {
+ /* DllMain is called with DLL_THREAD_ATTACH only by threads created after
+ * the DLL is loaded by the process */
+
+ data = stw_tls_data_create();
+ if(!data)
+ return NULL;
+
+ TlsSetValue(tlsIndex, data);
+ }
- return (struct stw_tls_data *) TlsGetValue(tlsIndex);
+ return data;
}
--
cgit v1.2.3
From 359a58230e0644a39c1904a74bc25803dc6cab6f Mon Sep 17 00:00:00 2001
From: Robert Ellison
Date: Mon, 27 Apr 2009 12:08:34 -0600
Subject: Avoid a segfault in shader compilation
If a shader reaches an out-of-memory condition while adding
a new function (reallocating the function list), a segfault
will occur during cleanup (because the num_functions field
is non-zero, but the functions pointer is NULL).
This fixes that segfault by zeroing out the num_functions
field if reallocation fails.
---
src/mesa/shader/slang/slang_compile.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c
index ba2fc4f85c..d7ad879e97 100644
--- a/src/mesa/shader/slang/slang_compile.c
+++ b/src/mesa/shader/slang/slang_compile.c
@@ -2161,6 +2161,12 @@ parse_function(slang_parse_ctx * C, slang_output_ctx * O, int definition,
(O->funs->num_functions + 1)
* sizeof(slang_function));
if (O->funs->functions == NULL) {
+ /* Make sure that there are no functions marked, as the
+ * allocation is currently NULL, in order to avoid
+ * a potental segfault as we clean up later.
+ */
+ O->funs->num_functions = 0;
+
slang_info_log_memory(C->L);
slang_function_destruct(&parsed_func);
return GL_FALSE;
--
cgit v1.2.3
From 638261b3530106b70819c2fe0c3cd613c0d85777 Mon Sep 17 00:00:00 2001
From: Thomas Hellstrom
Date: Tue, 28 Apr 2009 11:23:11 +0200
Subject: gallium: Update the drm_api.
Make it possible to pass state-tracker-specific data to the
init_screen function, and even open the door for device-specific
state-tracker screen initialization.
Signed-off-by: Thomas Hellstrom
---
src/gallium/include/state_tracker/drm_api.h | 19 +++++++++++-
src/gallium/state_trackers/dri2/dri_screen.c | 35 +---------------------
src/gallium/state_trackers/dri2/dri_screen.h | 2 --
src/gallium/state_trackers/egl/egl_tracker.c | 2 +-
src/gallium/state_trackers/xorg/xorg_driver.c | 2 +-
src/gallium/winsys/drm/intel/gem/intel_be_api.h | 3 +-
src/gallium/winsys/drm/intel/gem/intel_be_device.c | 35 +++++++++++++++++++++-
.../winsys/drm/nouveau/dri/nouveau_screen.c | 2 +-
.../winsys/drm/nouveau/drm/nouveau_drm_api.c | 2 +-
src/gallium/winsys/drm/radeon/core/radeon_drm.c | 3 +-
src/gallium/winsys/drm/radeon/core/radeon_drm.h | 3 +-
11 files changed, 63 insertions(+), 45 deletions(-)
diff --git a/src/gallium/include/state_tracker/drm_api.h b/src/gallium/include/state_tracker/drm_api.h
index 435435da29..5790b2f6c7 100644
--- a/src/gallium/include/state_tracker/drm_api.h
+++ b/src/gallium/include/state_tracker/drm_api.h
@@ -10,13 +10,30 @@ struct pipe_buffer;
struct pipe_context;
struct pipe_texture;
+enum drm_create_screen_mode {
+ DRM_CREATE_NORMAL = 0,
+ DRM_CREATE_DRI1,
+ DRM_CREATE_DRIVER = 1024,
+ DRM_CREATE_MAX
+};
+
+/**
+ * Modes other than DRM_CREATE_NORMAL derive from this struct.
+ */
+/*@{*/
+struct drm_create_screen_arg {
+ enum drm_create_screen_mode mode;
+};
+/*@}*/
+
struct drm_api
{
/**
* Special buffer functions
*/
/*@{*/
- struct pipe_screen* (*create_screen)(int drmFB, int pciID);
+ struct pipe_screen* (*create_screen)(int drm_fd,
+ struct drm_create_screen_arg *arg);
struct pipe_context* (*create_context)(struct pipe_screen *screen);
/*@}*/
diff --git a/src/gallium/state_trackers/dri2/dri_screen.c b/src/gallium/state_trackers/dri2/dri_screen.c
index ab5878a4bc..ab33003f51 100644
--- a/src/gallium/state_trackers/dri2/dri_screen.c
+++ b/src/gallium/state_trackers/dri2/dri_screen.c
@@ -67,37 +67,6 @@ static const __DRIextension *dri_screen_extensions[] = {
NULL
};
-
-static void
-dri_get_drm_minor(struct dri_screen *screen)
-{
- /* TODO get the real minor */
- screen->minor = 0;
-}
-
-
-static void
-dri_get_device_id(struct dri_screen *screen)
-{
- char path[512];
- FILE *file;
-
- /*
- * There must be a better way to get the deviceID.
- * XXX this only works on Linux.
- */
- snprintf(path, sizeof(path), "/sys/class/drm/card%d/device/device", screen->minor);
- file = fopen(path, "r");
- if (!file) {
- return;
- }
-
- fgets(path, sizeof(path), file);
- sscanf(path, "%x", &screen->deviceID);
- fclose(file);
-}
-
-
static const __DRIconfig **
dri_fill_in_modes(__DRIscreenPrivate *psp,
unsigned pixel_bits, unsigned depth_bits,
@@ -212,13 +181,11 @@ dri_init_screen2(__DRIscreenPrivate *sPriv)
screen->sPriv = sPriv;
screen->fd = sPriv->fd;
- dri_get_drm_minor(screen);
- dri_get_device_id(screen);
sPriv->private = (void *) screen;
sPriv->extensions = dri_screen_extensions;
- screen->pipe_screen = drm_api_hooks.create_screen(screen->fd, screen->deviceID);
+ screen->pipe_screen = drm_api_hooks.create_screen(screen->fd, NULL);
if (!screen->pipe_screen) {
debug_printf("%s: failed to create pipe_screen\n", __FUNCTION__);
goto fail;
diff --git a/src/gallium/state_trackers/dri2/dri_screen.h b/src/gallium/state_trackers/dri2/dri_screen.h
index fe2676d0be..3751ec6121 100644
--- a/src/gallium/state_trackers/dri2/dri_screen.h
+++ b/src/gallium/state_trackers/dri2/dri_screen.h
@@ -54,9 +54,7 @@ struct dri_screen
struct dri_context *dummyContext;
/* drm */
- int deviceID;
int fd;
- int minor;
/* gallium */
struct pipe_winsys *pipe_winsys;
diff --git a/src/gallium/state_trackers/egl/egl_tracker.c b/src/gallium/state_trackers/egl/egl_tracker.c
index abdf84544f..8e62008461 100644
--- a/src/gallium/state_trackers/egl/egl_tracker.c
+++ b/src/gallium/state_trackers/egl/egl_tracker.c
@@ -146,7 +146,7 @@ drm_initialize(_EGLDriver *drv, EGLDisplay dpy, EGLint *major, EGLint *minor)
dev->drmFD = fd;
drm_get_device_id(dev);
- dev->screen = drm_api_hooks.create_screen(dev->drmFD, dev->deviceID);
+ dev->screen = drm_api_hooks.create_screen(dev->drmFD, NULL);
if (!dev->screen)
goto err_screen;
dev->winsys = dev->screen->winsys;
diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c
index 8a2711e70c..45e831f0c2 100644
--- a/src/gallium/state_trackers/xorg/xorg_driver.c
+++ b/src/gallium/state_trackers/xorg/xorg_driver.c
@@ -476,7 +476,7 @@ ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
}
if (!ms->screen) {
- ms->screen = drm_api_hooks.create_screen(ms->fd, ms->PciInfo->device_id);
+ ms->screen = drm_api_hooks.create_screen(ms->fd, NULL);
if (!ms->screen) {
FatalError("Could not init pipe_screen\n");
diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_api.h b/src/gallium/winsys/drm/intel/gem/intel_be_api.h
index 73e458d4ba..1c622f3b97 100644
--- a/src/gallium/winsys/drm/intel/gem/intel_be_api.h
+++ b/src/gallium/winsys/drm/intel/gem/intel_be_api.h
@@ -8,7 +8,8 @@
#include "intel_be_device.h"
-struct pipe_screen *intel_be_create_screen(int drmFD, int pciID);
+struct pipe_screen *intel_be_create_screen(int drmFD,
+ struct drm_create_screen_arg *arg);
struct pipe_context *intel_be_create_context(struct pipe_screen *screen);
#endif
diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_device.c b/src/gallium/winsys/drm/intel/gem/intel_be_device.c
index c866c2a2f1..907ac86637 100644
--- a/src/gallium/winsys/drm/intel/gem/intel_be_device.c
+++ b/src/gallium/winsys/drm/intel/gem/intel_be_device.c
@@ -14,6 +14,7 @@
#include "softpipe/sp_winsys.h"
#include "intel_be_api.h"
+#include
/*
* Buffer
@@ -290,11 +291,42 @@ intel_be_init_device(struct intel_be_device *dev, int fd, unsigned id)
return true;
}
+static void
+intel_be_get_device_id(unsigned int *device_id)
+{
+ char path[512];
+ FILE *file;
+
+ /*
+ * FIXME: Fix this up to use a drm ioctl or whatever.
+ */
+
+ snprintf(path, sizeof(path), "/sys/class/drm/card0/device/device");
+ file = fopen(path, "r");
+ if (!file) {
+ return;
+ }
+
+ fgets(path, sizeof(path), file);
+ sscanf(path, "%x", device_id);
+ fclose(file);
+}
+
struct pipe_screen *
-intel_be_create_screen(int drmFD, int deviceID)
+intel_be_create_screen(int drmFD, struct drm_create_screen_arg *arg)
{
struct intel_be_device *dev;
struct pipe_screen *screen;
+ unsigned int deviceID;
+
+ if (arg != NULL) {
+ switch(arg->mode) {
+ case DRM_CREATE_NORMAL:
+ break;
+ default:
+ return NULL;
+ }
+ }
/* Allocate the private area */
dev = malloc(sizeof(*dev));
@@ -302,6 +334,7 @@ intel_be_create_screen(int drmFD, int deviceID)
return NULL;
memset(dev, 0, sizeof(*dev));
+ intel_be_get_device_id(&deviceID);
intel_be_init_device(dev, drmFD, deviceID);
if (dev->softpipe) {
diff --git a/src/gallium/winsys/drm/nouveau/dri/nouveau_screen.c b/src/gallium/winsys/drm/nouveau/dri/nouveau_screen.c
index 0b45b1ff1f..4e9b76a909 100644
--- a/src/gallium/winsys/drm/nouveau/dri/nouveau_screen.c
+++ b/src/gallium/winsys/drm/nouveau/dri/nouveau_screen.c
@@ -267,7 +267,7 @@ nouveau_screen_create(__DRIscreenPrivate *psp)
nouveau_device_open_existing(&nv_screen->device, 0, psp->fd, 0);
- nv_screen->pscreen = drm_api_hooks.create_screen(psp->fd, 0);
+ nv_screen->pscreen = drm_api_hooks.create_screen(psp->fd, NULL);
if (!nv_screen->pscreen) {
FREE(nv_screen);
return NULL;
diff --git a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c
index c0127e803f..a558fda140 100644
--- a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c
+++ b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c
@@ -8,7 +8,7 @@
#include "nouveau_bo.h"
static struct pipe_screen *
-nouveau_drm_create_screen(int fd, int pciid)
+nouveau_drm_create_screen(int fd, struct drm_create_screen_arg *arg)
{
struct pipe_winsys *ws;
struct nouveau_winsys *nvws;
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_drm.c b/src/gallium/winsys/drm/radeon/core/radeon_drm.c
index 3446654e28..1f89d1b1d1 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_drm.c
+++ b/src/gallium/winsys/drm/radeon/core/radeon_drm.c
@@ -31,7 +31,8 @@
#include "radeon_drm.h"
/* Create a pipe_screen. */
-struct pipe_screen* radeon_create_screen(int drmFB, int pciID)
+struct pipe_screen* radeon_create_screen(int drmFB,
+ struct drm_create_screen_arg *arg )
{
struct radeon_winsys* winsys = radeon_pipe_winsys(drmFB);
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_drm.h b/src/gallium/winsys/drm/radeon/core/radeon_drm.h
index ca2d98ed1a..049f9984db 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_drm.h
+++ b/src/gallium/winsys/drm/radeon/core/radeon_drm.h
@@ -40,7 +40,8 @@
#include "radeon_r300.h"
#include "radeon_winsys_softpipe.h"
-struct pipe_screen* radeon_create_screen(int drmFB, int pciID);
+struct pipe_screen* radeon_create_screen(int drmFB,
+ struct drm_create_screen_arg *arg);
struct pipe_context* radeon_create_context(struct pipe_screen* screen);
--
cgit v1.2.3
From 2e5acd24b0421f3824fbe441f4a7062c1f081109 Mon Sep 17 00:00:00 2001
From: Thomas Hellstrom
Date: Tue, 28 Apr 2009 11:32:59 +0200
Subject: gallium: Move the dri2 state tracker since we're about to extend it
to dri1.
Signed-off-by: Thomas Hellstrom
---
src/gallium/state_trackers/dri/Makefile | 28 ++
src/gallium/state_trackers/dri/dri_context.c | 170 ++++++++++++
src/gallium/state_trackers/dri/dri_context.h | 96 +++++++
src/gallium/state_trackers/dri/dri_drawable.c | 325 +++++++++++++++++++++++
src/gallium/state_trackers/dri/dri_drawable.h | 89 +++++++
src/gallium/state_trackers/dri/dri_extensions.c | 119 +++++++++
src/gallium/state_trackers/dri/dri_screen.c | 239 +++++++++++++++++
src/gallium/state_trackers/dri/dri_screen.h | 88 ++++++
src/gallium/state_trackers/dri2/Makefile | 28 --
src/gallium/state_trackers/dri2/dri_context.c | 170 ------------
src/gallium/state_trackers/dri2/dri_context.h | 96 -------
src/gallium/state_trackers/dri2/dri_drawable.c | 325 -----------------------
src/gallium/state_trackers/dri2/dri_drawable.h | 89 -------
src/gallium/state_trackers/dri2/dri_extensions.c | 119 ---------
src/gallium/state_trackers/dri2/dri_screen.c | 239 -----------------
src/gallium/state_trackers/dri2/dri_screen.h | 88 ------
src/gallium/winsys/drm/intel/dri2/Makefile | 2 +-
src/gallium/winsys/drm/nouveau/dri2/Makefile | 2 +-
src/gallium/winsys/drm/radeon/dri2/Makefile | 2 +-
19 files changed, 1157 insertions(+), 1157 deletions(-)
create mode 100644 src/gallium/state_trackers/dri/Makefile
create mode 100644 src/gallium/state_trackers/dri/dri_context.c
create mode 100644 src/gallium/state_trackers/dri/dri_context.h
create mode 100644 src/gallium/state_trackers/dri/dri_drawable.c
create mode 100644 src/gallium/state_trackers/dri/dri_drawable.h
create mode 100644 src/gallium/state_trackers/dri/dri_extensions.c
create mode 100644 src/gallium/state_trackers/dri/dri_screen.c
create mode 100644 src/gallium/state_trackers/dri/dri_screen.h
delete mode 100644 src/gallium/state_trackers/dri2/Makefile
delete mode 100644 src/gallium/state_trackers/dri2/dri_context.c
delete mode 100644 src/gallium/state_trackers/dri2/dri_context.h
delete mode 100644 src/gallium/state_trackers/dri2/dri_drawable.c
delete mode 100644 src/gallium/state_trackers/dri2/dri_drawable.h
delete mode 100644 src/gallium/state_trackers/dri2/dri_extensions.c
delete mode 100644 src/gallium/state_trackers/dri2/dri_screen.c
delete mode 100644 src/gallium/state_trackers/dri2/dri_screen.h
diff --git a/src/gallium/state_trackers/dri/Makefile b/src/gallium/state_trackers/dri/Makefile
new file mode 100644
index 0000000000..47750e997e
--- /dev/null
+++ b/src/gallium/state_trackers/dri/Makefile
@@ -0,0 +1,28 @@
+TOP = ../../../..
+include $(TOP)/configs/current
+
+LIBNAME = dri2drm
+
+LIBRARY_INCLUDES = \
+ -I$(TOP)/include \
+ -I$(TOP)/src/mesa \
+ -I$(TOP)/src/mesa/drivers/dri/common \
+ -I$(TOP)/src/mesa/main \
+ $(shell pkg-config --cflags-only-I libdrm)
+
+
+C_SOURCES = \
+ dri_context.c \
+ dri_screen.c \
+ dri_drawable.c \
+ dri_extensions.c
+
+# $(TOP)/src/mesa/drivers/dri/common/utils.c \
+ $(TOP)/src/mesa/drivers/dri/common/vblank.c \
+ $(TOP)/src/mesa/drivers/dri/common/dri_util.c \
+ $(TOP)/src/mesa/drivers/dri/common/xmlconfig.c \
+ $(TOP)/src/mesa/drivers/common/driverfuncs.c \
+ $(TOP)/src/mesa/drivers/dri/common/texmem.c \
+ $(TOP)/src/mesa/drivers/dri/common/drirenderbuffer.c
+
+include ../../Makefile.template
diff --git a/src/gallium/state_trackers/dri/dri_context.c b/src/gallium/state_trackers/dri/dri_context.c
new file mode 100644
index 0000000000..92c26ac70f
--- /dev/null
+++ b/src/gallium/state_trackers/dri/dri_context.c
@@ -0,0 +1,170 @@
+/**************************************************************************
+ *
+ * Copyright 2009, VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+/*
+ * Author: Keith Whitwell
+ * Author: Jakob Bornecrantz
+ */
+
+#include "dri_screen.h"
+
+#include "dri_drawable.h"
+
+
+#include "state_tracker/drm_api.h"
+#include "state_tracker/st_public.h"
+#include "state_tracker/st_context.h"
+#include "pipe/p_context.h"
+
+#include "dri_context.h"
+
+#include "util/u_memory.h"
+
+
+GLboolean
+dri_create_context(const __GLcontextModes *visual,
+ __DRIcontextPrivate *cPriv,
+ void *sharedContextPrivate)
+{
+ __DRIscreenPrivate *sPriv = cPriv->driScreenPriv;
+ struct dri_screen *screen = dri_screen(sPriv);
+ struct dri_context *ctx = NULL;
+ struct st_context *st_share = NULL;
+
+ if (sharedContextPrivate) {
+ st_share = ((struct dri_context *) sharedContextPrivate)->st;
+ }
+
+ ctx = CALLOC_STRUCT(dri_context);
+ if (ctx == NULL)
+ goto fail;
+
+ cPriv->driverPrivate = ctx;
+ ctx->cPriv = cPriv;
+ ctx->sPriv = sPriv;
+
+ driParseConfigFiles(&ctx->optionCache,
+ &screen->optionCache,
+ sPriv->myNum,
+ "dri");
+
+ ctx->pipe = drm_api_hooks.create_context(screen->pipe_screen);
+
+ if (ctx->pipe == NULL)
+ goto fail;
+
+ /* used in dri_flush_frontbuffer */
+ ctx->pipe->priv = ctx;
+
+ ctx->st = st_create_context(ctx->pipe, visual, st_share);
+ if (ctx->st == NULL)
+ goto fail;
+
+ dri_init_extensions(ctx);
+
+ return GL_TRUE;
+
+fail:
+ if (ctx && ctx->st)
+ st_destroy_context(ctx->st);
+
+ if (ctx && ctx->pipe)
+ ctx->pipe->destroy(ctx->pipe);
+
+ FREE(ctx);
+ return FALSE;
+}
+
+
+void
+dri_destroy_context(__DRIcontextPrivate *cPriv)
+{
+ struct dri_context *ctx = dri_context(cPriv);
+ struct dri_screen *screen = dri_screen(cPriv->driScreenPriv);
+
+ /* No particular reason to wait for command completion before
+ * destroying a context, but it is probably worthwhile flushing it
+ * to avoid having to add code elsewhere to cope with flushing a
+ * partially destroyed context.
+ */
+ st_flush(ctx->st, 0, NULL);
+
+ if (screen->dummyContext == ctx)
+ screen->dummyContext = NULL;
+
+ /* Also frees ctx->pipe?
+ */
+ st_destroy_context(ctx->st);
+
+ FREE(ctx);
+}
+
+
+GLboolean
+dri_unbind_context(__DRIcontextPrivate *cPriv)
+{
+ struct dri_context *ctx = dri_context(cPriv);
+ st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
+ /* XXX make_current(NULL)? */
+ return GL_TRUE;
+}
+
+
+GLboolean
+dri_make_current(__DRIcontextPrivate *cPriv,
+ __DRIdrawablePrivate *driDrawPriv,
+ __DRIdrawablePrivate *driReadPriv)
+{
+ if (cPriv) {
+ struct dri_context *ctx = dri_context(cPriv);
+ struct dri_screen *screen = dri_screen(cPriv->driScreenPriv);
+ struct dri_drawable *draw = dri_drawable(driDrawPriv);
+ struct dri_drawable *read = dri_drawable(driReadPriv);
+
+ /* This is for situations in which we need a rendering context but
+ * there may not be any currently bound.
+ */
+ screen->dummyContext = ctx;
+
+ st_make_current(ctx->st,
+ draw->stfb,
+ read->stfb);
+
+ /* used in dri_flush_frontbuffer */
+ ctx->dPriv = driDrawPriv;
+
+ if (driDrawPriv)
+ dri_get_buffers(driDrawPriv);
+ if (driDrawPriv != driReadPriv && driReadPriv)
+ dri_get_buffers(driReadPriv);
+ } else {
+ st_make_current(NULL, NULL, NULL);
+ }
+
+ return GL_TRUE;
+}
+
+/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/state_trackers/dri/dri_context.h b/src/gallium/state_trackers/dri/dri_context.h
new file mode 100644
index 0000000000..e910472700
--- /dev/null
+++ b/src/gallium/state_trackers/dri/dri_context.h
@@ -0,0 +1,96 @@
+/**************************************************************************
+ *
+ * Copyright (C) 2009 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+/*
+ * Author: Keith Whitwell
+ * Author: Jakob Bornecrantz
+ */
+
+#ifndef DRI_CONTEXT_H
+#define DRI_CONTEXT_H
+
+#include "pipe/p_compiler.h"
+#include "drm.h"
+#include "dri_util.h"
+
+
+struct pipe_context;
+struct pipe_fence;
+struct st_context;
+struct dri_drawable;
+
+
+struct dri_context
+{
+ /* dri */
+ __DRIscreenPrivate *sPriv;
+ __DRIcontextPrivate *cPriv;
+ __DRIdrawablePrivate *dPriv;
+
+ driOptionCache optionCache;
+
+ /* gallium */
+ struct st_context *st;
+ struct pipe_context *pipe;
+};
+
+
+static INLINE struct dri_context *
+dri_context(__DRIcontextPrivate *driContextPriv)
+{
+ return (struct dri_context *) driContextPriv->driverPrivate;
+}
+
+
+/***********************************************************************
+ * dri_context.c
+ */
+void
+dri_destroy_context(__DRIcontextPrivate * driContextPriv);
+
+boolean
+dri_unbind_context(__DRIcontextPrivate * driContextPriv);
+
+boolean
+dri_make_current(__DRIcontextPrivate * driContextPriv,
+ __DRIdrawablePrivate * driDrawPriv,
+ __DRIdrawablePrivate * driReadPriv);
+
+boolean
+dri_create_context(const __GLcontextModes * visual,
+ __DRIcontextPrivate * driContextPriv,
+ void *sharedContextPrivate);
+
+
+/***********************************************************************
+ * dri_extensions.c
+ */
+void
+dri_init_extensions(struct dri_context *ctx);
+
+#endif
+
+/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c
new file mode 100644
index 0000000000..2e3f4099e2
--- /dev/null
+++ b/src/gallium/state_trackers/dri/dri_drawable.c
@@ -0,0 +1,325 @@
+/**************************************************************************
+ *
+ * Copyright 2009, VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+/*
+ * Author: Keith Whitwell
+ * Author: Jakob Bornecrantz
+ */
+
+#include "dri_screen.h"
+#include "dri_context.h"
+#include "dri_drawable.h"
+
+#include "pipe/p_context.h"
+#include "pipe/p_screen.h"
+#include "pipe/p_inlines.h"
+#include "state_tracker/drm_api.h"
+#include "state_tracker/st_public.h"
+#include "state_tracker/st_context.h"
+#include "state_tracker/st_cb_fbo.h"
+
+#include "util/u_memory.h"
+
+
+static void
+dri_copy_to_front(__DRIdrawablePrivate *dPriv,
+ struct pipe_surface *from,
+ int x, int y, unsigned w, unsigned h)
+{
+ /* TODO send a message to the Xserver to copy to the real front buffer */
+}
+
+
+static struct pipe_surface *
+dri_surface_from_handle(struct pipe_screen *screen,
+ unsigned handle,
+ enum pipe_format format,
+ unsigned width,
+ unsigned height,
+ unsigned pitch)
+{
+ struct pipe_surface *surface = NULL;
+ struct pipe_texture *texture = NULL;
+ struct pipe_texture templat;
+ struct pipe_buffer *buf = NULL;
+
+ buf = drm_api_hooks.buffer_from_handle(screen, "dri2 buffer", handle);
+ if (!buf)
+ return NULL;
+
+ memset(&templat, 0, sizeof(templat));
+ templat.tex_usage |= PIPE_TEXTURE_USAGE_RENDER_TARGET;
+ templat.target = PIPE_TEXTURE_2D;
+ templat.last_level = 0;
+ templat.depth[0] = 1;
+ templat.format = format;
+ templat.width[0] = width;
+ templat.height[0] = height;
+ pf_get_block(templat.format, &templat.block);
+
+ texture = screen->texture_blanket(screen,
+ &templat,
+ &pitch,
+ buf);
+
+ /* we don't need the buffer from this point on */
+ pipe_buffer_reference(&buf, NULL);
+
+ if (!texture)
+ return NULL;
+
+ surface = screen->get_tex_surface(screen, texture, 0, 0, 0,
+ PIPE_BUFFER_USAGE_GPU_READ |
+ PIPE_BUFFER_USAGE_GPU_WRITE);
+
+ /* we don't need the texture from this point on */
+ pipe_texture_reference(&texture, NULL);
+ return surface;
+}
+
+
+/**
+ * This will be called a drawable is known to have been resized.
+ */
+void
+dri_get_buffers(__DRIdrawablePrivate *dPriv)
+{
+ struct dri_drawable *drawable = dri_drawable(dPriv);
+ struct pipe_surface *surface = NULL;
+ struct pipe_screen *screen = dri_screen(drawable->sPriv)->pipe_screen;
+ __DRIbuffer *buffers = NULL;
+ __DRIscreen *dri_screen = drawable->sPriv;
+ __DRIdrawable *dri_drawable = drawable->dPriv;
+ boolean have_depth = FALSE;
+ int i, count;
+
+ buffers = (*dri_screen->dri2.loader->getBuffers)(dri_drawable,
+ &dri_drawable->w,
+ &dri_drawable->h,
+ drawable->attachments,
+ drawable->num_attachments,
+ &count,
+ dri_drawable->loaderPrivate);
+
+ if (buffers == NULL) {
+ return;
+ }
+
+ /* set one cliprect to cover the whole dri_drawable */
+ dri_drawable->x = 0;
+ dri_drawable->y = 0;
+ dri_drawable->backX = 0;
+ dri_drawable->backY = 0;
+ dri_drawable->numClipRects = 1;
+ dri_drawable->pClipRects[0].x1 = 0;
+ dri_drawable->pClipRects[0].y1 = 0;
+ dri_drawable->pClipRects[0].x2 = dri_drawable->w;
+ dri_drawable->pClipRects[0].y2 = dri_drawable->h;
+ dri_drawable->numBackClipRects = 1;
+ dri_drawable->pBackClipRects[0].x1 = 0;
+ dri_drawable->pBackClipRects[0].y1 = 0;
+ dri_drawable->pBackClipRects[0].x2 = dri_drawable->w;
+ dri_drawable->pBackClipRects[0].y2 = dri_drawable->h;
+
+ for (i = 0; i < count; i++) {
+ enum pipe_format format = 0;
+ int index = 0;
+
+ switch (buffers[i].attachment) {
+ case __DRI_BUFFER_FRONT_LEFT:
+ index = ST_SURFACE_FRONT_LEFT;
+ format = PIPE_FORMAT_A8R8G8B8_UNORM;
+ break;
+ case __DRI_BUFFER_FAKE_FRONT_LEFT:
+ index = ST_SURFACE_FRONT_LEFT;
+ format = PIPE_FORMAT_A8R8G8B8_UNORM;
+ break;
+ case __DRI_BUFFER_BACK_LEFT:
+ index = ST_SURFACE_BACK_LEFT;
+ format = PIPE_FORMAT_A8R8G8B8_UNORM;
+ break;
+ case __DRI_BUFFER_DEPTH:
+ index = ST_SURFACE_DEPTH;
+ format = PIPE_FORMAT_Z24S8_UNORM;
+ break;
+ case __DRI_BUFFER_STENCIL:
+ index = ST_SURFACE_DEPTH;
+ format = PIPE_FORMAT_Z24S8_UNORM;
+ break;
+ case __DRI_BUFFER_ACCUM:
+ default:
+ assert(0);
+ }
+ assert(buffers[i].cpp == 4);
+
+ if (index == ST_SURFACE_DEPTH) {
+ if (have_depth)
+ continue;
+ else
+ have_depth = TRUE;
+ }
+
+ surface = dri_surface_from_handle(screen,
+ buffers[i].name,
+ format,
+ dri_drawable->w,
+ dri_drawable->h,
+ buffers[i].pitch);
+
+ st_set_framebuffer_surface(drawable->stfb, index, surface);
+ pipe_surface_reference(&surface, NULL);
+ }
+ /* this needed, or else the state tracker fails to pick the new buffers */
+ st_resize_framebuffer(drawable->stfb, dri_drawable->w, dri_drawable->h);
+}
+
+
+void
+dri_flush_frontbuffer(struct pipe_screen *screen,
+ struct pipe_surface *surf,
+ void *context_private)
+{
+ struct dri_context *ctx = (struct dri_context *)context_private;
+ dri_copy_to_front(ctx->dPriv, surf, 0, 0, surf->width, surf->height);
+}
+
+
+void
+dri_swap_buffers(__DRIdrawablePrivate * dPriv)
+{
+ /* not needed for dri2 */
+ assert(0);
+}
+
+
+void
+dri_copy_sub_buffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h)
+{
+ /* not needed for dri2 */
+ assert(0);
+}
+
+
+/**
+ * This is called when we need to set up GL rendering to a new X window.
+ */
+boolean
+dri_create_buffer(__DRIscreenPrivate *sPriv,
+ __DRIdrawablePrivate *dPriv,
+ const __GLcontextModes *visual,
+ boolean isPixmap)
+{
+ enum pipe_format colorFormat, depthFormat, stencilFormat;
+ struct dri_screen *screen = sPriv->private;
+ struct dri_drawable *drawable = NULL;
+ struct pipe_screen *pscreen = screen->pipe_screen;
+ int i;
+
+ if (isPixmap)
+ goto fail; /* not implemented */
+
+ drawable = CALLOC_STRUCT(dri_drawable);
+ if (drawable == NULL)
+ goto fail;
+
+ /* XXX: todo: use the pipe_screen queries to figure out which
+ * render targets are supportable.
+ */
+ assert(visual->redBits == 8);
+ assert(visual->depthBits == 24 || visual->depthBits == 0);
+ assert(visual->stencilBits == 8 || visual->stencilBits == 0);
+
+ colorFormat = PIPE_FORMAT_A8R8G8B8_UNORM;
+
+ if (visual->depthBits) {
+ if (pscreen->is_format_supported(pscreen, PIPE_FORMAT_Z24S8_UNORM,
+ PIPE_TEXTURE_2D,
+ PIPE_TEXTURE_USAGE_RENDER_TARGET |
+ PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0))
+ depthFormat = PIPE_FORMAT_Z24S8_UNORM;
+ else
+ depthFormat = PIPE_FORMAT_S8Z24_UNORM;
+ } else
+ depthFormat = PIPE_FORMAT_NONE;
+
+ if (visual->stencilBits) {
+ if (pscreen->is_format_supported(pscreen, PIPE_FORMAT_Z24S8_UNORM,
+ PIPE_TEXTURE_2D,
+ PIPE_TEXTURE_USAGE_RENDER_TARGET |
+ PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0))
+ stencilFormat = PIPE_FORMAT_Z24S8_UNORM;
+ else
+ stencilFormat = PIPE_FORMAT_S8Z24_UNORM;
+ } else
+ stencilFormat = PIPE_FORMAT_NONE;
+
+ drawable->stfb = st_create_framebuffer(visual,
+ colorFormat,
+ depthFormat,
+ stencilFormat,
+ dPriv->w,
+ dPriv->h,
+ (void*) drawable);
+ if (drawable->stfb == NULL)
+ goto fail;
+
+ drawable->sPriv = sPriv;
+ drawable->dPriv = dPriv;
+ dPriv->driverPrivate = (void *) drawable;
+
+ /* setup dri2 buffers information */
+ i = 0;
+ drawable->attachments[i++] = __DRI_BUFFER_FRONT_LEFT;
+#if 0
+ /* TODO incase of double buffer visual, delay fake creation */
+ drawable->attachments[i++] = __DRI_BUFFER_FAKE_FRONT_LEFT;
+#endif
+ if (visual->doubleBufferMode)
+ drawable->attachments[i++] = __DRI_BUFFER_BACK_LEFT;
+ if (visual->depthBits)
+ drawable->attachments[i++] = __DRI_BUFFER_DEPTH;
+ if (visual->stencilBits)
+ drawable->attachments[i++] = __DRI_BUFFER_STENCIL;
+ drawable->num_attachments = i;
+
+ return GL_TRUE;
+fail:
+ FREE(drawable);
+ return GL_FALSE;
+}
+
+
+void
+dri_destroy_buffer(__DRIdrawablePrivate *dPriv)
+{
+ struct dri_drawable *drawable = dri_drawable(dPriv);
+
+ st_unreference_framebuffer(drawable->stfb);
+
+ FREE(drawable);
+}
+
+/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/state_trackers/dri/dri_drawable.h b/src/gallium/state_trackers/dri/dri_drawable.h
new file mode 100644
index 0000000000..185c657b35
--- /dev/null
+++ b/src/gallium/state_trackers/dri/dri_drawable.h
@@ -0,0 +1,89 @@
+/**************************************************************************
+ *
+ * Copyright 2009, VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#ifndef DRI_DRAWABLE_H
+#define DRI_DRAWABLE_H
+
+#include "pipe/p_compiler.h"
+
+struct pipe_surface;
+struct pipe_fence;
+struct st_framebuffer;
+
+
+struct dri_drawable
+{
+ /* dri */
+ __DRIdrawablePrivate *dPriv;
+ __DRIscreenPrivate *sPriv;
+
+ unsigned attachments[8];
+ unsigned num_attachments;
+
+ /* gallium */
+ struct st_framebuffer *stfb;
+};
+
+
+static INLINE struct dri_drawable *
+dri_drawable(__DRIdrawablePrivate * driDrawPriv)
+{
+ return (struct dri_drawable *) driDrawPriv->driverPrivate;
+}
+
+
+/***********************************************************************
+ * dri_drawable.c
+ */
+boolean
+dri_create_buffer(__DRIscreenPrivate *sPriv,
+ __DRIdrawablePrivate *dPriv,
+ const __GLcontextModes *visual,
+ boolean isPixmap);
+
+void
+dri_flush_frontbuffer(struct pipe_screen *screen,
+ struct pipe_surface *surf,
+ void *context_private);
+
+void
+dri_swap_buffers(__DRIdrawablePrivate * dPriv);
+
+void
+dri_copy_sub_buffer(__DRIdrawablePrivate * dPriv,
+ int x, int y,
+ int w, int h);
+
+void
+dri_get_buffers(__DRIdrawablePrivate * dPriv);
+
+void
+dri_destroy_buffer(__DRIdrawablePrivate *dPriv);
+
+#endif
+
+/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/state_trackers/dri/dri_extensions.c b/src/gallium/state_trackers/dri/dri_extensions.c
new file mode 100644
index 0000000000..732d1e89b0
--- /dev/null
+++ b/src/gallium/state_trackers/dri/dri_extensions.c
@@ -0,0 +1,119 @@
+/**************************************************************************
+ *
+ * Copyright 2009, VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+/*
+ * Author: Keith Whitwell
+ * Author: Jakob Bornecrantz
+ */
+
+#include "dri_screen.h"
+#include "dri_context.h"
+#include "state_tracker/st_context.h"
+
+#define need_GL_ARB_multisample
+#define need_GL_ARB_occlusion_query
+#define need_GL_ARB_point_parameters
+#define need_GL_ARB_texture_compression
+#define need_GL_ARB_vertex_buffer_object
+#define need_GL_ARB_vertex_program
+#define need_GL_ARB_window_pos
+#define need_GL_EXT_blend_color
+#define need_GL_EXT_blend_equation_separate
+#define need_GL_EXT_blend_func_separate
+#define need_GL_EXT_blend_minmax
+#define need_GL_EXT_cull_vertex
+#define need_GL_EXT_fog_coord
+#define need_GL_EXT_framebuffer_object
+#define need_GL_EXT_multi_draw_arrays
+#define need_GL_EXT_secondary_color
+#define need_GL_NV_vertex_program
+#include "extension_helper.h"
+
+
+/**
+ * Extension strings exported by the driver.
+ */
+const struct dri_extension card_extensions[] = {
+ {"GL_ARB_multisample", GL_ARB_multisample_functions},
+ {"GL_ARB_multitexture", NULL},
+ {"GL_ARB_occlusion_query", GL_ARB_occlusion_query_functions},
+ {"GL_ARB_point_parameters", GL_ARB_point_parameters_functions},
+ {"GL_ARB_texture_border_clamp", NULL},
+ {"GL_ARB_texture_compression", GL_ARB_texture_compression_functions},
+ {"GL_ARB_texture_cube_map", NULL},
+ {"GL_ARB_texture_env_add", NULL},
+ {"GL_ARB_texture_env_combine", NULL},
+ {"GL_ARB_texture_env_dot3", NULL},
+ {"GL_ARB_texture_mirrored_repeat", NULL},
+ {"GL_ARB_texture_rectangle", NULL},
+ {"GL_ARB_vertex_buffer_object", GL_ARB_vertex_buffer_object_functions},
+ {"GL_ARB_pixel_buffer_object", NULL},
+ {"GL_ARB_vertex_program", GL_ARB_vertex_program_functions},
+ {"GL_ARB_window_pos", GL_ARB_window_pos_functions},
+ {"GL_EXT_blend_color", GL_EXT_blend_color_functions},
+ {"GL_EXT_blend_equation_separate", GL_EXT_blend_equation_separate_functions},
+ {"GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions},
+ {"GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions},
+ {"GL_EXT_blend_subtract", NULL},
+ {"GL_EXT_cull_vertex", GL_EXT_cull_vertex_functions},
+ {"GL_EXT_fog_coord", GL_EXT_fog_coord_functions},
+ {"GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions},
+ {"GL_EXT_multi_draw_arrays", GL_EXT_multi_draw_arrays_functions},
+ {"GL_EXT_packed_depth_stencil", NULL},
+ {"GL_EXT_pixel_buffer_object", NULL},
+ {"GL_EXT_secondary_color", GL_EXT_secondary_color_functions},
+ {"GL_EXT_stencil_wrap", NULL},
+ {"GL_EXT_texture_edge_clamp", NULL},
+ {"GL_EXT_texture_env_combine", NULL},
+ {"GL_EXT_texture_env_dot3", NULL},
+ {"GL_EXT_texture_filter_anisotropic", NULL},
+ {"GL_EXT_texture_lod_bias", NULL},
+ {"GL_3DFX_texture_compression_FXT1", NULL},
+ {"GL_APPLE_client_storage", NULL},
+ {"GL_MESA_pack_invert", NULL},
+ {"GL_MESA_ycbcr_texture", NULL},
+ {"GL_NV_blend_square", NULL},
+ {"GL_NV_vertex_program", GL_NV_vertex_program_functions},
+ {"GL_NV_vertex_program1_1", NULL},
+ {"GL_SGIS_generate_mipmap", NULL },
+ {NULL, NULL}
+};
+
+
+void
+dri_init_extensions(struct dri_context *ctx)
+{
+ /* The card_extensions list should be pruned according to the
+ * capabilities of the pipe_screen. This is actually something
+ * that can/should be done inside st_create_context().
+ */
+ if (ctx)
+ driInitExtensions(ctx->st->ctx, card_extensions, GL_TRUE);
+ else
+ driInitExtensions(NULL, card_extensions, GL_FALSE);
+}
+
+/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c
new file mode 100644
index 0000000000..ab33003f51
--- /dev/null
+++ b/src/gallium/state_trackers/dri/dri_screen.c
@@ -0,0 +1,239 @@
+/**************************************************************************
+ *
+ * Copyright 2009, VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+/*
+ * Author: Keith Whitwell
+ * Author: Jakob Bornecrantz
+ */
+
+#include "utils.h"
+#include "vblank.h"
+#include "xmlpool.h"
+
+#include "dri_screen.h"
+#include "dri_context.h"
+#include "dri_drawable.h"
+
+#include "pipe/p_context.h"
+#include "pipe/p_screen.h"
+#include "pipe/p_inlines.h"
+#include "state_tracker/drm_api.h"
+#include "state_tracker/st_public.h"
+#include "state_tracker/st_cb_fbo.h"
+
+
+PUBLIC const char __driConfigOptions[] =
+ DRI_CONF_BEGIN DRI_CONF_SECTION_PERFORMANCE
+ DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS)
+ DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
+ DRI_CONF_SECTION_END DRI_CONF_SECTION_QUALITY
+ /*DRI_CONF_FORCE_S3TC_ENABLE(false)*/
+ DRI_CONF_ALLOW_LARGE_TEXTURES(1)
+ DRI_CONF_SECTION_END DRI_CONF_END;
+
+
+const uint __driNConfigOptions = 3;
+
+
+static const __DRIextension *dri_screen_extensions[] = {
+ &driReadDrawableExtension,
+ &driCopySubBufferExtension.base,
+ &driSwapControlExtension.base,
+ &driFrameTrackingExtension.base,
+ &driMediaStreamCounterExtension.base,
+ NULL
+};
+
+static const __DRIconfig **
+dri_fill_in_modes(__DRIscreenPrivate *psp,
+ unsigned pixel_bits, unsigned depth_bits,
+ unsigned stencil_bits, GLboolean have_back_buffer)
+{
+ __DRIconfig **configs;
+ __GLcontextModes *m;
+ unsigned num_modes;
+ uint8_t depth_bits_array[3];
+ uint8_t stencil_bits_array[3];
+ uint8_t msaa_samples_array[1];
+ unsigned depth_buffer_factor;
+ unsigned back_buffer_factor;
+ unsigned msaa_samples_factor;
+ GLenum fb_format;
+ GLenum fb_type;
+ int i;
+
+ static const GLenum back_buffer_modes[] = {
+ GLX_NONE, GLX_SWAP_UNDEFINED_OML, GLX_SWAP_COPY_OML
+ };
+
+ /* TODO probe the hardware of what is supports */
+ depth_bits_array[0] = 0;
+ depth_bits_array[1] = 24;
+ depth_bits_array[2] = 24;
+
+ stencil_bits_array[0] = 0; /* no depth or stencil */
+ stencil_bits_array[1] = 0; /* z24x8 */
+ stencil_bits_array[2] = 8; /* z24s8 */
+
+ msaa_samples_array[0] = 0;
+
+ depth_buffer_factor = 3;
+ back_buffer_factor = 3;
+ msaa_samples_factor = 1;
+
+ num_modes = depth_buffer_factor * back_buffer_factor * msaa_samples_factor * 4;
+
+ if (pixel_bits == 16) {
+ fb_format = GL_RGB;
+ fb_type = GL_UNSIGNED_SHORT_5_6_5;
+ }
+ else {
+ fb_format = GL_BGRA;
+ fb_type = GL_UNSIGNED_INT_8_8_8_8_REV;
+ }
+
+ configs = driCreateConfigs(fb_format, fb_type,
+ depth_bits_array,
+ stencil_bits_array, depth_buffer_factor,
+ back_buffer_modes, back_buffer_factor,
+ msaa_samples_array, msaa_samples_factor);
+ if (configs == NULL) {
+ debug_printf("%s: driCreateConfigs failed\n", __FUNCTION__);
+ return NULL;
+ }
+
+ for (i = 0; configs[i]; i++) {
+ m = &configs[i]->modes;
+ if ((m->stencilBits != 0) && (m->stencilBits != stencil_bits)) {
+ m->visualRating = GLX_SLOW_CONFIG;
+ }
+ }
+
+ return (const const __DRIconfig **) configs;
+}
+
+
+/**
+ * Get information about previous buffer swaps.
+ */
+int
+dri_get_swap_info(__DRIdrawablePrivate * dPriv,
+ __DRIswapInfo * sInfo)
+{
+ if (dPriv == NULL ||
+ dPriv->driverPrivate == NULL ||
+ sInfo == NULL)
+ return -1;
+ else
+ return 0;
+}
+
+
+/**
+ * NULL stub for old dri loaders
+ */
+const __DRIconfig **
+dri_init_screen(__DRIscreenPrivate *sPriv)
+{
+ return NULL;
+}
+
+
+/**
+ * This is the driver specific part of the createNewScreen entry point.
+ *
+ * Returns the __GLcontextModes supported by this driver.
+ */
+const __DRIconfig **
+dri_init_screen2(__DRIscreenPrivate *sPriv)
+{
+ struct dri_screen *screen;
+
+ /* Set up dispatch table to cope with all known extensions */
+ dri_init_extensions(NULL);
+
+ screen = CALLOC_STRUCT(dri_screen);
+ if (!screen)
+ goto fail;
+
+ screen->sPriv = sPriv;
+ screen->fd = sPriv->fd;
+ sPriv->private = (void *) screen;
+ sPriv->extensions = dri_screen_extensions;
+
+
+ screen->pipe_screen = drm_api_hooks.create_screen(screen->fd, NULL);
+ if (!screen->pipe_screen) {
+ debug_printf("%s: failed to create pipe_screen\n", __FUNCTION__);
+ goto fail;
+ }
+
+ /* We need to hook in here */
+ screen->pipe_screen->flush_frontbuffer = dri_flush_frontbuffer;
+
+ driParseOptionInfo(&screen->optionCache,
+ __driConfigOptions,
+ __driNConfigOptions);
+
+ return dri_fill_in_modes(sPriv,
+ 4 * 8,
+ 24,
+ 8,
+ 1);
+fail:
+ return NULL;
+}
+
+
+void
+dri_destroy_screen(__DRIscreenPrivate * sPriv)
+{
+ struct dri_screen *screen = dri_screen(sPriv);
+
+ screen->pipe_screen->destroy(screen->pipe_screen);
+ FREE(screen);
+ sPriv->private = NULL;
+}
+
+
+PUBLIC const struct __DriverAPIRec driDriverAPI = {
+ .InitScreen = dri_init_screen, /* not supported but exported */
+ .DestroyScreen = dri_destroy_screen,
+ .CreateContext = dri_create_context,
+ .DestroyContext = dri_destroy_context,
+ .CreateBuffer = dri_create_buffer,
+ .DestroyBuffer = dri_destroy_buffer,
+ .SwapBuffers = dri_swap_buffers, /* not supported but exported */
+ .MakeCurrent = dri_make_current,
+ .UnbindContext = dri_unbind_context,
+ .GetSwapInfo = dri_get_swap_info,
+ .GetDrawableMSC = driDrawableGetMSC32,
+ .WaitForMSC = driWaitForMSC32,
+ .CopySubBuffer = dri_copy_sub_buffer, /* not supported but exported */
+ .InitScreen2 = dri_init_screen2,
+};
+
+/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/state_trackers/dri/dri_screen.h b/src/gallium/state_trackers/dri/dri_screen.h
new file mode 100644
index 0000000000..3751ec6121
--- /dev/null
+++ b/src/gallium/state_trackers/dri/dri_screen.h
@@ -0,0 +1,88 @@
+/**************************************************************************
+ *
+ * Copyright 2009, VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+/*
+ * Author: Keith Whitwell
+ * Author: Jakob Bornecrantz
+ */
+
+#ifndef DRI_SCREEN_H
+#define DRI_SCREEN_H
+
+#include "dri_util.h"
+#include "xmlconfig.h"
+
+#include "pipe/p_compiler.h"
+
+struct dri_screen
+{
+ /* dri */
+ __DRIscreenPrivate *sPriv;
+
+ /**
+ * Configuration cache with default values for all contexts
+ */
+ driOptionCache optionCache;
+
+ /**
+ * Temporary(?) context to use for SwapBuffers or other situations in
+ * which we need a rendering context, but none is currently bound.
+ */
+ struct dri_context *dummyContext;
+
+ /* drm */
+ int fd;
+
+ /* gallium */
+ struct pipe_winsys *pipe_winsys;
+ struct pipe_screen *pipe_screen;
+};
+
+
+/** cast wrapper */
+static INLINE struct dri_screen *
+dri_screen(__DRIscreenPrivate *sPriv)
+{
+ return (struct dri_screen *) sPriv->private;
+}
+
+
+/***********************************************************************
+ * dri_screen.c
+ */
+const __DRIconfig **
+dri_init_screen2(__DRIscreenPrivate *sPriv);
+
+void
+dri_destroy_screen(__DRIscreenPrivate * sPriv);
+
+int
+dri_get_swap_info(__DRIdrawablePrivate * dPriv,
+ __DRIswapInfo * sInfo);
+
+#endif
+
+/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/state_trackers/dri2/Makefile b/src/gallium/state_trackers/dri2/Makefile
deleted file mode 100644
index 47750e997e..0000000000
--- a/src/gallium/state_trackers/dri2/Makefile
+++ /dev/null
@@ -1,28 +0,0 @@
-TOP = ../../../..
-include $(TOP)/configs/current
-
-LIBNAME = dri2drm
-
-LIBRARY_INCLUDES = \
- -I$(TOP)/include \
- -I$(TOP)/src/mesa \
- -I$(TOP)/src/mesa/drivers/dri/common \
- -I$(TOP)/src/mesa/main \
- $(shell pkg-config --cflags-only-I libdrm)
-
-
-C_SOURCES = \
- dri_context.c \
- dri_screen.c \
- dri_drawable.c \
- dri_extensions.c
-
-# $(TOP)/src/mesa/drivers/dri/common/utils.c \
- $(TOP)/src/mesa/drivers/dri/common/vblank.c \
- $(TOP)/src/mesa/drivers/dri/common/dri_util.c \
- $(TOP)/src/mesa/drivers/dri/common/xmlconfig.c \
- $(TOP)/src/mesa/drivers/common/driverfuncs.c \
- $(TOP)/src/mesa/drivers/dri/common/texmem.c \
- $(TOP)/src/mesa/drivers/dri/common/drirenderbuffer.c
-
-include ../../Makefile.template
diff --git a/src/gallium/state_trackers/dri2/dri_context.c b/src/gallium/state_trackers/dri2/dri_context.c
deleted file mode 100644
index 92c26ac70f..0000000000
--- a/src/gallium/state_trackers/dri2/dri_context.c
+++ /dev/null
@@ -1,170 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2009, VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-/*
- * Author: Keith Whitwell
- * Author: Jakob Bornecrantz
- */
-
-#include "dri_screen.h"
-
-#include "dri_drawable.h"
-
-
-#include "state_tracker/drm_api.h"
-#include "state_tracker/st_public.h"
-#include "state_tracker/st_context.h"
-#include "pipe/p_context.h"
-
-#include "dri_context.h"
-
-#include "util/u_memory.h"
-
-
-GLboolean
-dri_create_context(const __GLcontextModes *visual,
- __DRIcontextPrivate *cPriv,
- void *sharedContextPrivate)
-{
- __DRIscreenPrivate *sPriv = cPriv->driScreenPriv;
- struct dri_screen *screen = dri_screen(sPriv);
- struct dri_context *ctx = NULL;
- struct st_context *st_share = NULL;
-
- if (sharedContextPrivate) {
- st_share = ((struct dri_context *) sharedContextPrivate)->st;
- }
-
- ctx = CALLOC_STRUCT(dri_context);
- if (ctx == NULL)
- goto fail;
-
- cPriv->driverPrivate = ctx;
- ctx->cPriv = cPriv;
- ctx->sPriv = sPriv;
-
- driParseConfigFiles(&ctx->optionCache,
- &screen->optionCache,
- sPriv->myNum,
- "dri");
-
- ctx->pipe = drm_api_hooks.create_context(screen->pipe_screen);
-
- if (ctx->pipe == NULL)
- goto fail;
-
- /* used in dri_flush_frontbuffer */
- ctx->pipe->priv = ctx;
-
- ctx->st = st_create_context(ctx->pipe, visual, st_share);
- if (ctx->st == NULL)
- goto fail;
-
- dri_init_extensions(ctx);
-
- return GL_TRUE;
-
-fail:
- if (ctx && ctx->st)
- st_destroy_context(ctx->st);
-
- if (ctx && ctx->pipe)
- ctx->pipe->destroy(ctx->pipe);
-
- FREE(ctx);
- return FALSE;
-}
-
-
-void
-dri_destroy_context(__DRIcontextPrivate *cPriv)
-{
- struct dri_context *ctx = dri_context(cPriv);
- struct dri_screen *screen = dri_screen(cPriv->driScreenPriv);
-
- /* No particular reason to wait for command completion before
- * destroying a context, but it is probably worthwhile flushing it
- * to avoid having to add code elsewhere to cope with flushing a
- * partially destroyed context.
- */
- st_flush(ctx->st, 0, NULL);
-
- if (screen->dummyContext == ctx)
- screen->dummyContext = NULL;
-
- /* Also frees ctx->pipe?
- */
- st_destroy_context(ctx->st);
-
- FREE(ctx);
-}
-
-
-GLboolean
-dri_unbind_context(__DRIcontextPrivate *cPriv)
-{
- struct dri_context *ctx = dri_context(cPriv);
- st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
- /* XXX make_current(NULL)? */
- return GL_TRUE;
-}
-
-
-GLboolean
-dri_make_current(__DRIcontextPrivate *cPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv)
-{
- if (cPriv) {
- struct dri_context *ctx = dri_context(cPriv);
- struct dri_screen *screen = dri_screen(cPriv->driScreenPriv);
- struct dri_drawable *draw = dri_drawable(driDrawPriv);
- struct dri_drawable *read = dri_drawable(driReadPriv);
-
- /* This is for situations in which we need a rendering context but
- * there may not be any currently bound.
- */
- screen->dummyContext = ctx;
-
- st_make_current(ctx->st,
- draw->stfb,
- read->stfb);
-
- /* used in dri_flush_frontbuffer */
- ctx->dPriv = driDrawPriv;
-
- if (driDrawPriv)
- dri_get_buffers(driDrawPriv);
- if (driDrawPriv != driReadPriv && driReadPriv)
- dri_get_buffers(driReadPriv);
- } else {
- st_make_current(NULL, NULL, NULL);
- }
-
- return GL_TRUE;
-}
-
-/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/state_trackers/dri2/dri_context.h b/src/gallium/state_trackers/dri2/dri_context.h
deleted file mode 100644
index e910472700..0000000000
--- a/src/gallium/state_trackers/dri2/dri_context.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/**************************************************************************
- *
- * Copyright (C) 2009 VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-/*
- * Author: Keith Whitwell
- * Author: Jakob Bornecrantz
- */
-
-#ifndef DRI_CONTEXT_H
-#define DRI_CONTEXT_H
-
-#include "pipe/p_compiler.h"
-#include "drm.h"
-#include "dri_util.h"
-
-
-struct pipe_context;
-struct pipe_fence;
-struct st_context;
-struct dri_drawable;
-
-
-struct dri_context
-{
- /* dri */
- __DRIscreenPrivate *sPriv;
- __DRIcontextPrivate *cPriv;
- __DRIdrawablePrivate *dPriv;
-
- driOptionCache optionCache;
-
- /* gallium */
- struct st_context *st;
- struct pipe_context *pipe;
-};
-
-
-static INLINE struct dri_context *
-dri_context(__DRIcontextPrivate *driContextPriv)
-{
- return (struct dri_context *) driContextPriv->driverPrivate;
-}
-
-
-/***********************************************************************
- * dri_context.c
- */
-void
-dri_destroy_context(__DRIcontextPrivate * driContextPriv);
-
-boolean
-dri_unbind_context(__DRIcontextPrivate * driContextPriv);
-
-boolean
-dri_make_current(__DRIcontextPrivate * driContextPriv,
- __DRIdrawablePrivate * driDrawPriv,
- __DRIdrawablePrivate * driReadPriv);
-
-boolean
-dri_create_context(const __GLcontextModes * visual,
- __DRIcontextPrivate * driContextPriv,
- void *sharedContextPrivate);
-
-
-/***********************************************************************
- * dri_extensions.c
- */
-void
-dri_init_extensions(struct dri_context *ctx);
-
-#endif
-
-/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/state_trackers/dri2/dri_drawable.c b/src/gallium/state_trackers/dri2/dri_drawable.c
deleted file mode 100644
index 2e3f4099e2..0000000000
--- a/src/gallium/state_trackers/dri2/dri_drawable.c
+++ /dev/null
@@ -1,325 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2009, VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-/*
- * Author: Keith Whitwell
- * Author: Jakob Bornecrantz
- */
-
-#include "dri_screen.h"
-#include "dri_context.h"
-#include "dri_drawable.h"
-
-#include "pipe/p_context.h"
-#include "pipe/p_screen.h"
-#include "pipe/p_inlines.h"
-#include "state_tracker/drm_api.h"
-#include "state_tracker/st_public.h"
-#include "state_tracker/st_context.h"
-#include "state_tracker/st_cb_fbo.h"
-
-#include "util/u_memory.h"
-
-
-static void
-dri_copy_to_front(__DRIdrawablePrivate *dPriv,
- struct pipe_surface *from,
- int x, int y, unsigned w, unsigned h)
-{
- /* TODO send a message to the Xserver to copy to the real front buffer */
-}
-
-
-static struct pipe_surface *
-dri_surface_from_handle(struct pipe_screen *screen,
- unsigned handle,
- enum pipe_format format,
- unsigned width,
- unsigned height,
- unsigned pitch)
-{
- struct pipe_surface *surface = NULL;
- struct pipe_texture *texture = NULL;
- struct pipe_texture templat;
- struct pipe_buffer *buf = NULL;
-
- buf = drm_api_hooks.buffer_from_handle(screen, "dri2 buffer", handle);
- if (!buf)
- return NULL;
-
- memset(&templat, 0, sizeof(templat));
- templat.tex_usage |= PIPE_TEXTURE_USAGE_RENDER_TARGET;
- templat.target = PIPE_TEXTURE_2D;
- templat.last_level = 0;
- templat.depth[0] = 1;
- templat.format = format;
- templat.width[0] = width;
- templat.height[0] = height;
- pf_get_block(templat.format, &templat.block);
-
- texture = screen->texture_blanket(screen,
- &templat,
- &pitch,
- buf);
-
- /* we don't need the buffer from this point on */
- pipe_buffer_reference(&buf, NULL);
-
- if (!texture)
- return NULL;
-
- surface = screen->get_tex_surface(screen, texture, 0, 0, 0,
- PIPE_BUFFER_USAGE_GPU_READ |
- PIPE_BUFFER_USAGE_GPU_WRITE);
-
- /* we don't need the texture from this point on */
- pipe_texture_reference(&texture, NULL);
- return surface;
-}
-
-
-/**
- * This will be called a drawable is known to have been resized.
- */
-void
-dri_get_buffers(__DRIdrawablePrivate *dPriv)
-{
- struct dri_drawable *drawable = dri_drawable(dPriv);
- struct pipe_surface *surface = NULL;
- struct pipe_screen *screen = dri_screen(drawable->sPriv)->pipe_screen;
- __DRIbuffer *buffers = NULL;
- __DRIscreen *dri_screen = drawable->sPriv;
- __DRIdrawable *dri_drawable = drawable->dPriv;
- boolean have_depth = FALSE;
- int i, count;
-
- buffers = (*dri_screen->dri2.loader->getBuffers)(dri_drawable,
- &dri_drawable->w,
- &dri_drawable->h,
- drawable->attachments,
- drawable->num_attachments,
- &count,
- dri_drawable->loaderPrivate);
-
- if (buffers == NULL) {
- return;
- }
-
- /* set one cliprect to cover the whole dri_drawable */
- dri_drawable->x = 0;
- dri_drawable->y = 0;
- dri_drawable->backX = 0;
- dri_drawable->backY = 0;
- dri_drawable->numClipRects = 1;
- dri_drawable->pClipRects[0].x1 = 0;
- dri_drawable->pClipRects[0].y1 = 0;
- dri_drawable->pClipRects[0].x2 = dri_drawable->w;
- dri_drawable->pClipRects[0].y2 = dri_drawable->h;
- dri_drawable->numBackClipRects = 1;
- dri_drawable->pBackClipRects[0].x1 = 0;
- dri_drawable->pBackClipRects[0].y1 = 0;
- dri_drawable->pBackClipRects[0].x2 = dri_drawable->w;
- dri_drawable->pBackClipRects[0].y2 = dri_drawable->h;
-
- for (i = 0; i < count; i++) {
- enum pipe_format format = 0;
- int index = 0;
-
- switch (buffers[i].attachment) {
- case __DRI_BUFFER_FRONT_LEFT:
- index = ST_SURFACE_FRONT_LEFT;
- format = PIPE_FORMAT_A8R8G8B8_UNORM;
- break;
- case __DRI_BUFFER_FAKE_FRONT_LEFT:
- index = ST_SURFACE_FRONT_LEFT;
- format = PIPE_FORMAT_A8R8G8B8_UNORM;
- break;
- case __DRI_BUFFER_BACK_LEFT:
- index = ST_SURFACE_BACK_LEFT;
- format = PIPE_FORMAT_A8R8G8B8_UNORM;
- break;
- case __DRI_BUFFER_DEPTH:
- index = ST_SURFACE_DEPTH;
- format = PIPE_FORMAT_Z24S8_UNORM;
- break;
- case __DRI_BUFFER_STENCIL:
- index = ST_SURFACE_DEPTH;
- format = PIPE_FORMAT_Z24S8_UNORM;
- break;
- case __DRI_BUFFER_ACCUM:
- default:
- assert(0);
- }
- assert(buffers[i].cpp == 4);
-
- if (index == ST_SURFACE_DEPTH) {
- if (have_depth)
- continue;
- else
- have_depth = TRUE;
- }
-
- surface = dri_surface_from_handle(screen,
- buffers[i].name,
- format,
- dri_drawable->w,
- dri_drawable->h,
- buffers[i].pitch);
-
- st_set_framebuffer_surface(drawable->stfb, index, surface);
- pipe_surface_reference(&surface, NULL);
- }
- /* this needed, or else the state tracker fails to pick the new buffers */
- st_resize_framebuffer(drawable->stfb, dri_drawable->w, dri_drawable->h);
-}
-
-
-void
-dri_flush_frontbuffer(struct pipe_screen *screen,
- struct pipe_surface *surf,
- void *context_private)
-{
- struct dri_context *ctx = (struct dri_context *)context_private;
- dri_copy_to_front(ctx->dPriv, surf, 0, 0, surf->width, surf->height);
-}
-
-
-void
-dri_swap_buffers(__DRIdrawablePrivate * dPriv)
-{
- /* not needed for dri2 */
- assert(0);
-}
-
-
-void
-dri_copy_sub_buffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h)
-{
- /* not needed for dri2 */
- assert(0);
-}
-
-
-/**
- * This is called when we need to set up GL rendering to a new X window.
- */
-boolean
-dri_create_buffer(__DRIscreenPrivate *sPriv,
- __DRIdrawablePrivate *dPriv,
- const __GLcontextModes *visual,
- boolean isPixmap)
-{
- enum pipe_format colorFormat, depthFormat, stencilFormat;
- struct dri_screen *screen = sPriv->private;
- struct dri_drawable *drawable = NULL;
- struct pipe_screen *pscreen = screen->pipe_screen;
- int i;
-
- if (isPixmap)
- goto fail; /* not implemented */
-
- drawable = CALLOC_STRUCT(dri_drawable);
- if (drawable == NULL)
- goto fail;
-
- /* XXX: todo: use the pipe_screen queries to figure out which
- * render targets are supportable.
- */
- assert(visual->redBits == 8);
- assert(visual->depthBits == 24 || visual->depthBits == 0);
- assert(visual->stencilBits == 8 || visual->stencilBits == 0);
-
- colorFormat = PIPE_FORMAT_A8R8G8B8_UNORM;
-
- if (visual->depthBits) {
- if (pscreen->is_format_supported(pscreen, PIPE_FORMAT_Z24S8_UNORM,
- PIPE_TEXTURE_2D,
- PIPE_TEXTURE_USAGE_RENDER_TARGET |
- PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0))
- depthFormat = PIPE_FORMAT_Z24S8_UNORM;
- else
- depthFormat = PIPE_FORMAT_S8Z24_UNORM;
- } else
- depthFormat = PIPE_FORMAT_NONE;
-
- if (visual->stencilBits) {
- if (pscreen->is_format_supported(pscreen, PIPE_FORMAT_Z24S8_UNORM,
- PIPE_TEXTURE_2D,
- PIPE_TEXTURE_USAGE_RENDER_TARGET |
- PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0))
- stencilFormat = PIPE_FORMAT_Z24S8_UNORM;
- else
- stencilFormat = PIPE_FORMAT_S8Z24_UNORM;
- } else
- stencilFormat = PIPE_FORMAT_NONE;
-
- drawable->stfb = st_create_framebuffer(visual,
- colorFormat,
- depthFormat,
- stencilFormat,
- dPriv->w,
- dPriv->h,
- (void*) drawable);
- if (drawable->stfb == NULL)
- goto fail;
-
- drawable->sPriv = sPriv;
- drawable->dPriv = dPriv;
- dPriv->driverPrivate = (void *) drawable;
-
- /* setup dri2 buffers information */
- i = 0;
- drawable->attachments[i++] = __DRI_BUFFER_FRONT_LEFT;
-#if 0
- /* TODO incase of double buffer visual, delay fake creation */
- drawable->attachments[i++] = __DRI_BUFFER_FAKE_FRONT_LEFT;
-#endif
- if (visual->doubleBufferMode)
- drawable->attachments[i++] = __DRI_BUFFER_BACK_LEFT;
- if (visual->depthBits)
- drawable->attachments[i++] = __DRI_BUFFER_DEPTH;
- if (visual->stencilBits)
- drawable->attachments[i++] = __DRI_BUFFER_STENCIL;
- drawable->num_attachments = i;
-
- return GL_TRUE;
-fail:
- FREE(drawable);
- return GL_FALSE;
-}
-
-
-void
-dri_destroy_buffer(__DRIdrawablePrivate *dPriv)
-{
- struct dri_drawable *drawable = dri_drawable(dPriv);
-
- st_unreference_framebuffer(drawable->stfb);
-
- FREE(drawable);
-}
-
-/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/state_trackers/dri2/dri_drawable.h b/src/gallium/state_trackers/dri2/dri_drawable.h
deleted file mode 100644
index 185c657b35..0000000000
--- a/src/gallium/state_trackers/dri2/dri_drawable.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2009, VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#ifndef DRI_DRAWABLE_H
-#define DRI_DRAWABLE_H
-
-#include "pipe/p_compiler.h"
-
-struct pipe_surface;
-struct pipe_fence;
-struct st_framebuffer;
-
-
-struct dri_drawable
-{
- /* dri */
- __DRIdrawablePrivate *dPriv;
- __DRIscreenPrivate *sPriv;
-
- unsigned attachments[8];
- unsigned num_attachments;
-
- /* gallium */
- struct st_framebuffer *stfb;
-};
-
-
-static INLINE struct dri_drawable *
-dri_drawable(__DRIdrawablePrivate * driDrawPriv)
-{
- return (struct dri_drawable *) driDrawPriv->driverPrivate;
-}
-
-
-/***********************************************************************
- * dri_drawable.c
- */
-boolean
-dri_create_buffer(__DRIscreenPrivate *sPriv,
- __DRIdrawablePrivate *dPriv,
- const __GLcontextModes *visual,
- boolean isPixmap);
-
-void
-dri_flush_frontbuffer(struct pipe_screen *screen,
- struct pipe_surface *surf,
- void *context_private);
-
-void
-dri_swap_buffers(__DRIdrawablePrivate * dPriv);
-
-void
-dri_copy_sub_buffer(__DRIdrawablePrivate * dPriv,
- int x, int y,
- int w, int h);
-
-void
-dri_get_buffers(__DRIdrawablePrivate * dPriv);
-
-void
-dri_destroy_buffer(__DRIdrawablePrivate *dPriv);
-
-#endif
-
-/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/state_trackers/dri2/dri_extensions.c b/src/gallium/state_trackers/dri2/dri_extensions.c
deleted file mode 100644
index 732d1e89b0..0000000000
--- a/src/gallium/state_trackers/dri2/dri_extensions.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2009, VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-/*
- * Author: Keith Whitwell
- * Author: Jakob Bornecrantz
- */
-
-#include "dri_screen.h"
-#include "dri_context.h"
-#include "state_tracker/st_context.h"
-
-#define need_GL_ARB_multisample
-#define need_GL_ARB_occlusion_query
-#define need_GL_ARB_point_parameters
-#define need_GL_ARB_texture_compression
-#define need_GL_ARB_vertex_buffer_object
-#define need_GL_ARB_vertex_program
-#define need_GL_ARB_window_pos
-#define need_GL_EXT_blend_color
-#define need_GL_EXT_blend_equation_separate
-#define need_GL_EXT_blend_func_separate
-#define need_GL_EXT_blend_minmax
-#define need_GL_EXT_cull_vertex
-#define need_GL_EXT_fog_coord
-#define need_GL_EXT_framebuffer_object
-#define need_GL_EXT_multi_draw_arrays
-#define need_GL_EXT_secondary_color
-#define need_GL_NV_vertex_program
-#include "extension_helper.h"
-
-
-/**
- * Extension strings exported by the driver.
- */
-const struct dri_extension card_extensions[] = {
- {"GL_ARB_multisample", GL_ARB_multisample_functions},
- {"GL_ARB_multitexture", NULL},
- {"GL_ARB_occlusion_query", GL_ARB_occlusion_query_functions},
- {"GL_ARB_point_parameters", GL_ARB_point_parameters_functions},
- {"GL_ARB_texture_border_clamp", NULL},
- {"GL_ARB_texture_compression", GL_ARB_texture_compression_functions},
- {"GL_ARB_texture_cube_map", NULL},
- {"GL_ARB_texture_env_add", NULL},
- {"GL_ARB_texture_env_combine", NULL},
- {"GL_ARB_texture_env_dot3", NULL},
- {"GL_ARB_texture_mirrored_repeat", NULL},
- {"GL_ARB_texture_rectangle", NULL},
- {"GL_ARB_vertex_buffer_object", GL_ARB_vertex_buffer_object_functions},
- {"GL_ARB_pixel_buffer_object", NULL},
- {"GL_ARB_vertex_program", GL_ARB_vertex_program_functions},
- {"GL_ARB_window_pos", GL_ARB_window_pos_functions},
- {"GL_EXT_blend_color", GL_EXT_blend_color_functions},
- {"GL_EXT_blend_equation_separate", GL_EXT_blend_equation_separate_functions},
- {"GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions},
- {"GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions},
- {"GL_EXT_blend_subtract", NULL},
- {"GL_EXT_cull_vertex", GL_EXT_cull_vertex_functions},
- {"GL_EXT_fog_coord", GL_EXT_fog_coord_functions},
- {"GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions},
- {"GL_EXT_multi_draw_arrays", GL_EXT_multi_draw_arrays_functions},
- {"GL_EXT_packed_depth_stencil", NULL},
- {"GL_EXT_pixel_buffer_object", NULL},
- {"GL_EXT_secondary_color", GL_EXT_secondary_color_functions},
- {"GL_EXT_stencil_wrap", NULL},
- {"GL_EXT_texture_edge_clamp", NULL},
- {"GL_EXT_texture_env_combine", NULL},
- {"GL_EXT_texture_env_dot3", NULL},
- {"GL_EXT_texture_filter_anisotropic", NULL},
- {"GL_EXT_texture_lod_bias", NULL},
- {"GL_3DFX_texture_compression_FXT1", NULL},
- {"GL_APPLE_client_storage", NULL},
- {"GL_MESA_pack_invert", NULL},
- {"GL_MESA_ycbcr_texture", NULL},
- {"GL_NV_blend_square", NULL},
- {"GL_NV_vertex_program", GL_NV_vertex_program_functions},
- {"GL_NV_vertex_program1_1", NULL},
- {"GL_SGIS_generate_mipmap", NULL },
- {NULL, NULL}
-};
-
-
-void
-dri_init_extensions(struct dri_context *ctx)
-{
- /* The card_extensions list should be pruned according to the
- * capabilities of the pipe_screen. This is actually something
- * that can/should be done inside st_create_context().
- */
- if (ctx)
- driInitExtensions(ctx->st->ctx, card_extensions, GL_TRUE);
- else
- driInitExtensions(NULL, card_extensions, GL_FALSE);
-}
-
-/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/state_trackers/dri2/dri_screen.c b/src/gallium/state_trackers/dri2/dri_screen.c
deleted file mode 100644
index ab33003f51..0000000000
--- a/src/gallium/state_trackers/dri2/dri_screen.c
+++ /dev/null
@@ -1,239 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2009, VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-/*
- * Author: Keith Whitwell
- * Author: Jakob Bornecrantz
- */
-
-#include "utils.h"
-#include "vblank.h"
-#include "xmlpool.h"
-
-#include "dri_screen.h"
-#include "dri_context.h"
-#include "dri_drawable.h"
-
-#include "pipe/p_context.h"
-#include "pipe/p_screen.h"
-#include "pipe/p_inlines.h"
-#include "state_tracker/drm_api.h"
-#include "state_tracker/st_public.h"
-#include "state_tracker/st_cb_fbo.h"
-
-
-PUBLIC const char __driConfigOptions[] =
- DRI_CONF_BEGIN DRI_CONF_SECTION_PERFORMANCE
- DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS)
- DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
- DRI_CONF_SECTION_END DRI_CONF_SECTION_QUALITY
- /*DRI_CONF_FORCE_S3TC_ENABLE(false)*/
- DRI_CONF_ALLOW_LARGE_TEXTURES(1)
- DRI_CONF_SECTION_END DRI_CONF_END;
-
-
-const uint __driNConfigOptions = 3;
-
-
-static const __DRIextension *dri_screen_extensions[] = {
- &driReadDrawableExtension,
- &driCopySubBufferExtension.base,
- &driSwapControlExtension.base,
- &driFrameTrackingExtension.base,
- &driMediaStreamCounterExtension.base,
- NULL
-};
-
-static const __DRIconfig **
-dri_fill_in_modes(__DRIscreenPrivate *psp,
- unsigned pixel_bits, unsigned depth_bits,
- unsigned stencil_bits, GLboolean have_back_buffer)
-{
- __DRIconfig **configs;
- __GLcontextModes *m;
- unsigned num_modes;
- uint8_t depth_bits_array[3];
- uint8_t stencil_bits_array[3];
- uint8_t msaa_samples_array[1];
- unsigned depth_buffer_factor;
- unsigned back_buffer_factor;
- unsigned msaa_samples_factor;
- GLenum fb_format;
- GLenum fb_type;
- int i;
-
- static const GLenum back_buffer_modes[] = {
- GLX_NONE, GLX_SWAP_UNDEFINED_OML, GLX_SWAP_COPY_OML
- };
-
- /* TODO probe the hardware of what is supports */
- depth_bits_array[0] = 0;
- depth_bits_array[1] = 24;
- depth_bits_array[2] = 24;
-
- stencil_bits_array[0] = 0; /* no depth or stencil */
- stencil_bits_array[1] = 0; /* z24x8 */
- stencil_bits_array[2] = 8; /* z24s8 */
-
- msaa_samples_array[0] = 0;
-
- depth_buffer_factor = 3;
- back_buffer_factor = 3;
- msaa_samples_factor = 1;
-
- num_modes = depth_buffer_factor * back_buffer_factor * msaa_samples_factor * 4;
-
- if (pixel_bits == 16) {
- fb_format = GL_RGB;
- fb_type = GL_UNSIGNED_SHORT_5_6_5;
- }
- else {
- fb_format = GL_BGRA;
- fb_type = GL_UNSIGNED_INT_8_8_8_8_REV;
- }
-
- configs = driCreateConfigs(fb_format, fb_type,
- depth_bits_array,
- stencil_bits_array, depth_buffer_factor,
- back_buffer_modes, back_buffer_factor,
- msaa_samples_array, msaa_samples_factor);
- if (configs == NULL) {
- debug_printf("%s: driCreateConfigs failed\n", __FUNCTION__);
- return NULL;
- }
-
- for (i = 0; configs[i]; i++) {
- m = &configs[i]->modes;
- if ((m->stencilBits != 0) && (m->stencilBits != stencil_bits)) {
- m->visualRating = GLX_SLOW_CONFIG;
- }
- }
-
- return (const const __DRIconfig **) configs;
-}
-
-
-/**
- * Get information about previous buffer swaps.
- */
-int
-dri_get_swap_info(__DRIdrawablePrivate * dPriv,
- __DRIswapInfo * sInfo)
-{
- if (dPriv == NULL ||
- dPriv->driverPrivate == NULL ||
- sInfo == NULL)
- return -1;
- else
- return 0;
-}
-
-
-/**
- * NULL stub for old dri loaders
- */
-const __DRIconfig **
-dri_init_screen(__DRIscreenPrivate *sPriv)
-{
- return NULL;
-}
-
-
-/**
- * This is the driver specific part of the createNewScreen entry point.
- *
- * Returns the __GLcontextModes supported by this driver.
- */
-const __DRIconfig **
-dri_init_screen2(__DRIscreenPrivate *sPriv)
-{
- struct dri_screen *screen;
-
- /* Set up dispatch table to cope with all known extensions */
- dri_init_extensions(NULL);
-
- screen = CALLOC_STRUCT(dri_screen);
- if (!screen)
- goto fail;
-
- screen->sPriv = sPriv;
- screen->fd = sPriv->fd;
- sPriv->private = (void *) screen;
- sPriv->extensions = dri_screen_extensions;
-
-
- screen->pipe_screen = drm_api_hooks.create_screen(screen->fd, NULL);
- if (!screen->pipe_screen) {
- debug_printf("%s: failed to create pipe_screen\n", __FUNCTION__);
- goto fail;
- }
-
- /* We need to hook in here */
- screen->pipe_screen->flush_frontbuffer = dri_flush_frontbuffer;
-
- driParseOptionInfo(&screen->optionCache,
- __driConfigOptions,
- __driNConfigOptions);
-
- return dri_fill_in_modes(sPriv,
- 4 * 8,
- 24,
- 8,
- 1);
-fail:
- return NULL;
-}
-
-
-void
-dri_destroy_screen(__DRIscreenPrivate * sPriv)
-{
- struct dri_screen *screen = dri_screen(sPriv);
-
- screen->pipe_screen->destroy(screen->pipe_screen);
- FREE(screen);
- sPriv->private = NULL;
-}
-
-
-PUBLIC const struct __DriverAPIRec driDriverAPI = {
- .InitScreen = dri_init_screen, /* not supported but exported */
- .DestroyScreen = dri_destroy_screen,
- .CreateContext = dri_create_context,
- .DestroyContext = dri_destroy_context,
- .CreateBuffer = dri_create_buffer,
- .DestroyBuffer = dri_destroy_buffer,
- .SwapBuffers = dri_swap_buffers, /* not supported but exported */
- .MakeCurrent = dri_make_current,
- .UnbindContext = dri_unbind_context,
- .GetSwapInfo = dri_get_swap_info,
- .GetDrawableMSC = driDrawableGetMSC32,
- .WaitForMSC = driWaitForMSC32,
- .CopySubBuffer = dri_copy_sub_buffer, /* not supported but exported */
- .InitScreen2 = dri_init_screen2,
-};
-
-/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/state_trackers/dri2/dri_screen.h b/src/gallium/state_trackers/dri2/dri_screen.h
deleted file mode 100644
index 3751ec6121..0000000000
--- a/src/gallium/state_trackers/dri2/dri_screen.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2009, VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-/*
- * Author: Keith Whitwell
- * Author: Jakob Bornecrantz
- */
-
-#ifndef DRI_SCREEN_H
-#define DRI_SCREEN_H
-
-#include "dri_util.h"
-#include "xmlconfig.h"
-
-#include "pipe/p_compiler.h"
-
-struct dri_screen
-{
- /* dri */
- __DRIscreenPrivate *sPriv;
-
- /**
- * Configuration cache with default values for all contexts
- */
- driOptionCache optionCache;
-
- /**
- * Temporary(?) context to use for SwapBuffers or other situations in
- * which we need a rendering context, but none is currently bound.
- */
- struct dri_context *dummyContext;
-
- /* drm */
- int fd;
-
- /* gallium */
- struct pipe_winsys *pipe_winsys;
- struct pipe_screen *pipe_screen;
-};
-
-
-/** cast wrapper */
-static INLINE struct dri_screen *
-dri_screen(__DRIscreenPrivate *sPriv)
-{
- return (struct dri_screen *) sPriv->private;
-}
-
-
-/***********************************************************************
- * dri_screen.c
- */
-const __DRIconfig **
-dri_init_screen2(__DRIscreenPrivate *sPriv);
-
-void
-dri_destroy_screen(__DRIscreenPrivate * sPriv);
-
-int
-dri_get_swap_info(__DRIdrawablePrivate * dPriv,
- __DRIswapInfo * sInfo);
-
-#endif
-
-/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/winsys/drm/intel/dri2/Makefile b/src/gallium/winsys/drm/intel/dri2/Makefile
index e7c57afc34..286ef08d5b 100644
--- a/src/gallium/winsys/drm/intel/dri2/Makefile
+++ b/src/gallium/winsys/drm/intel/dri2/Makefile
@@ -4,7 +4,7 @@ include $(TOP)/configs/current
LIBNAME = i915_dri.so
PIPE_DRIVERS = \
- $(TOP)/src/gallium/state_trackers/dri2/libdri2drm.a \
+ $(TOP)/src/gallium/state_trackers/dri/libdri2drm.a \
$(TOP)/src/gallium/winsys/drm/intel/gem/libinteldrm.a \
$(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
$(TOP)/src/gallium/drivers/i915simple/libi915simple.a
diff --git a/src/gallium/winsys/drm/nouveau/dri2/Makefile b/src/gallium/winsys/drm/nouveau/dri2/Makefile
index 728870d2e1..5e5efbcb11 100644
--- a/src/gallium/winsys/drm/nouveau/dri2/Makefile
+++ b/src/gallium/winsys/drm/nouveau/dri2/Makefile
@@ -4,7 +4,7 @@ include $(TOP)/configs/current
LIBNAME = nouveau_dri2.so
PIPE_DRIVERS = \
- $(TOP)/src/gallium/state_trackers/dri2/libdri2drm.a \
+ $(TOP)/src/gallium/state_trackers/dri/libdri2drm.a \
$(TOP)/src/gallium/winsys/drm/nouveau/drm/libnouveaudrm.a \
$(TOP)/src/gallium/drivers/nv04/libnv04.a \
$(TOP)/src/gallium/drivers/nv10/libnv10.a \
diff --git a/src/gallium/winsys/drm/radeon/dri2/Makefile b/src/gallium/winsys/drm/radeon/dri2/Makefile
index f471c44349..58a87dae18 100644
--- a/src/gallium/winsys/drm/radeon/dri2/Makefile
+++ b/src/gallium/winsys/drm/radeon/dri2/Makefile
@@ -7,7 +7,7 @@ LIBNAME = radeon_dri.so
MINIGLX_SOURCES =
PIPE_DRIVERS = \
- $(TOP)/src/gallium/state_trackers/dri2/libdri2drm.a \
+ $(TOP)/src/gallium/state_trackers/dri/libdri2drm.a \
$(TOP)/src/gallium/winsys/drm/radeon/core/libradeonwinsys.a \
$(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
$(TOP)/src/gallium/drivers/r300/libr300.a
--
cgit v1.2.3
From a70c4f352e8e7aea0b130fd1285352bbf89503b5 Mon Sep 17 00:00:00 2001
From: Thomas Hellstrom
Date: Tue, 28 Apr 2009 11:43:06 +0200
Subject: gallium: Add a dri1 api
that a driver needs to implement on top of the drm api to support dri1.
Signed-off-by: Thomas Hellstrom
---
src/gallium/include/state_tracker/dri1_api.h | 82 ++++++++++++++++++++++++++++
1 file changed, 82 insertions(+)
create mode 100644 src/gallium/include/state_tracker/dri1_api.h
diff --git a/src/gallium/include/state_tracker/dri1_api.h b/src/gallium/include/state_tracker/dri1_api.h
new file mode 100644
index 0000000000..b173ba3683
--- /dev/null
+++ b/src/gallium/include/state_tracker/dri1_api.h
@@ -0,0 +1,82 @@
+#ifndef _DRI1_API_H_
+#define _DRI1_API_H_
+
+#include "pipe/p_compiler.h"
+#include "pipe/p_screen.h"
+#include "pipe/p_format.h"
+
+#include "state_tracker/drm_api.h"
+
+#include
+
+struct pipe_screen;
+struct pipe_winsys;
+struct pipe_buffer;
+struct pipe_context;
+struct pipe_texture;
+
+struct dri1_api_version
+{
+ int major;
+ int minor;
+ int patch_level;
+};
+
+/**
+ * This callback struct is intended for drivers that need to take
+ * the hardware lock on command submission.
+ */
+
+struct dri1_api_lock_funcs
+{
+ void (*lock) (struct pipe_context * pipe);
+ void (*unlock) (struct pipe_context * locked_pipe);
+ boolean(*is_locked) (struct pipe_context * locked_pipe);
+ boolean(*is_lock_lost) (struct pipe_context * locked_pipe);
+ void (*clear_lost_lock) (struct pipe_context * locked_pipe);
+};
+
+struct dri1_api
+{
+ /**
+ * For flushing to the front buffer. A driver should implement one and only
+ * one of the functions below. The present_locked functions allows a dri1
+ * driver to pageflip.
+ */
+
+ /*@{ */
+
+ struct pipe_surface *(*front_srf_locked) (struct pipe_context *
+ locked_pipe);
+
+ void (*present_locked) (struct pipe_context * locked_pipe,
+ struct pipe_surface * surf,
+ const struct drm_clip_rect * rect,
+ unsigned int num_clip,
+ int x_draw, int y_draw,
+ const struct drm_clip_rect * src_bbox,
+ struct pipe_fence_handle ** fence);
+ /*@} */
+};
+
+struct dri1_create_screen_arg
+{
+ struct drm_create_screen_arg base;
+
+ struct dri1_api_lock_funcs *lf;
+ void *ddx_info;
+ int ddx_info_size;
+ void *sarea;
+
+ struct dri1_api_version ddx_version;
+ struct dri1_api_version dri_version;
+ struct dri1_api_version drm_version;
+
+ /*
+ * out parameters;
+ */
+
+ struct dri1_api *api;
+};
+
+#endif
--
cgit v1.2.3
From ca1f5f7e6c05e34cfe8ef10f29aa19f5547311e6 Mon Sep 17 00:00:00 2001
From: Thomas Hellstrom
Date: Tue, 28 Apr 2009 11:49:39 +0200
Subject: gallium: Update the dri2 state tracker to support dri1.
Signed-off-by: Thomas Hellstrom
---
src/gallium/state_trackers/dri/dri_context.c | 91 ++++++--
src/gallium/state_trackers/dri/dri_context.h | 36 ++-
src/gallium/state_trackers/dri/dri_drawable.c | 318 ++++++++++++++++++++++++--
src/gallium/state_trackers/dri/dri_drawable.h | 18 +-
src/gallium/state_trackers/dri/dri_screen.c | 87 +++++--
src/gallium/state_trackers/dri/dri_screen.h | 12 +-
6 files changed, 507 insertions(+), 55 deletions(-)
diff --git a/src/gallium/state_trackers/dri/dri_context.c b/src/gallium/state_trackers/dri/dri_context.c
index 92c26ac70f..a45fb541fd 100644
--- a/src/gallium/state_trackers/dri/dri_context.c
+++ b/src/gallium/state_trackers/dri/dri_context.c
@@ -32,9 +32,8 @@
#include "dri_screen.h"
#include "dri_drawable.h"
-
-
#include "state_tracker/drm_api.h"
+#include "state_tracker/dri1_api.h"
#include "state_tracker/st_public.h"
#include "state_tracker/st_context.h"
#include "pipe/p_context.h"
@@ -44,6 +43,7 @@
#include "util/u_memory.h"
+
GLboolean
dri_create_context(const __GLcontextModes *visual,
__DRIcontextPrivate *cPriv,
@@ -65,6 +65,9 @@ dri_create_context(const __GLcontextModes *visual,
cPriv->driverPrivate = ctx;
ctx->cPriv = cPriv;
ctx->sPriv = sPriv;
+ ctx->lock = screen->drmLock;
+ ctx->d_stamp = -1;
+ ctx->r_stamp = -1;
driParseConfigFiles(&ctx->optionCache,
&screen->optionCache,
@@ -126,13 +129,22 @@ dri_destroy_context(__DRIcontextPrivate *cPriv)
GLboolean
dri_unbind_context(__DRIcontextPrivate *cPriv)
{
- struct dri_context *ctx = dri_context(cPriv);
- st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
- /* XXX make_current(NULL)? */
+ if (cPriv) {
+ struct dri_context *ctx = dri_context(cPriv);
+
+ if (--ctx->bind_count == 0) {
+ GET_CURRENT_CONTEXT(curGLCtx);
+
+ if (ctx->st == curGLCtx->st) {
+ st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
+ st_make_current(NULL, NULL, NULL);
+ }
+ }
+ }
+
return GL_TRUE;
}
-
GLboolean
dri_make_current(__DRIcontextPrivate *cPriv,
__DRIdrawablePrivate *driDrawPriv,
@@ -143,23 +155,32 @@ dri_make_current(__DRIcontextPrivate *cPriv,
struct dri_screen *screen = dri_screen(cPriv->driScreenPriv);
struct dri_drawable *draw = dri_drawable(driDrawPriv);
struct dri_drawable *read = dri_drawable(driReadPriv);
+ GET_CURRENT_CONTEXT(oldGLCtx);
+
+ if (oldGLCtx && oldGLCtx->st != ctx->st)
+ st_flush(oldGLCtx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
+
+ ++ctx->bind_count;
/* This is for situations in which we need a rendering context but
* there may not be any currently bound.
*/
screen->dummyContext = ctx;
- st_make_current(ctx->st,
- draw->stfb,
- read->stfb);
-
/* used in dri_flush_frontbuffer */
ctx->dPriv = driDrawPriv;
-
- if (driDrawPriv)
- dri_get_buffers(driDrawPriv);
- if (driDrawPriv != driReadPriv && driReadPriv)
- dri_get_buffers(driReadPriv);
+ ctx->rPriv = driReadPriv;
+
+ st_make_current(ctx->st, draw->stfb, read->stfb);
+
+ if (__dri1_api_hooks) {
+ dri1_update_drawables(ctx, draw, read);
+ } else {
+ if (driDrawPriv)
+ dri_get_buffers(driDrawPriv);
+ if (driDrawPriv != driReadPriv && driReadPriv)
+ dri_get_buffers(driReadPriv);
+ }
} else {
st_make_current(NULL, NULL, NULL);
}
@@ -167,4 +188,44 @@ dri_make_current(__DRIcontextPrivate *cPriv,
return GL_TRUE;
}
+static void
+st_dri_lock(struct pipe_context *pipe)
+{
+ dri_lock((struct dri_context *) pipe->priv);
+}
+
+static void
+st_dri_unlock(struct pipe_context *pipe)
+{
+ dri_unlock((struct dri_context *) pipe->priv);
+}
+
+static boolean
+st_dri_is_locked(struct pipe_context *pipe)
+{
+ return ((struct dri_context *) pipe->priv)->isLocked;
+}
+
+static boolean
+st_dri_lost_lock(struct pipe_context *pipe)
+{
+ return ((struct dri_context *) pipe->priv)->wsLostLock;
+}
+
+static void
+st_dri_clear_lost_lock(struct pipe_context *pipe)
+{
+ ((struct dri_context *) pipe->priv)->wsLostLock = FALSE;
+}
+
+struct dri1_api_lock_funcs dri1_lf =
+{
+ .lock = st_dri_lock,
+ .unlock = st_dri_unlock,
+ .is_locked = st_dri_is_locked,
+ .is_lock_lost = st_dri_lost_lock,
+ .clear_lost_lock = st_dri_clear_lost_lock
+};
+
+
/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/state_trackers/dri/dri_context.h b/src/gallium/state_trackers/dri/dri_context.h
index e910472700..82a5916827 100644
--- a/src/gallium/state_trackers/dri/dri_context.h
+++ b/src/gallium/state_trackers/dri/dri_context.h
@@ -42,32 +42,64 @@ struct pipe_fence;
struct st_context;
struct dri_drawable;
-
struct dri_context
{
/* dri */
__DRIscreenPrivate *sPriv;
__DRIcontextPrivate *cPriv;
__DRIdrawablePrivate *dPriv;
+ __DRIdrawablePrivate *rPriv;
driOptionCache optionCache;
+ unsigned int d_stamp;
+ unsigned int r_stamp;
+
+ drmLock *lock;
+ boolean isLocked;
+ boolean stLostLock;
+ boolean wsLostLock;
+
+ unsigned int bind_count;
+
/* gallium */
struct st_context *st;
struct pipe_context *pipe;
};
-
static INLINE struct dri_context *
dri_context(__DRIcontextPrivate *driContextPriv)
{
return (struct dri_context *) driContextPriv->driverPrivate;
}
+static INLINE void
+dri_lock(struct dri_context *ctx)
+{
+ drm_context_t hw_context = ctx->cPriv->hHWContext;
+ char ret = 0;
+
+ DRM_CAS(ctx->lock, hw_context, DRM_LOCK_HELD | hw_context, ret);
+ if (ret) {
+ drmGetLock(ctx->sPriv->fd, hw_context, 0);
+ ctx->stLostLock = TRUE;
+ ctx->wsLostLock = TRUE;
+ }
+ ctx->isLocked = TRUE;
+}
+
+static INLINE void
+dri_unlock(struct dri_context *ctx)
+{
+ ctx->isLocked = FALSE;
+ DRM_UNLOCK(ctx->sPriv->fd, ctx->lock, ctx->cPriv->hHWContext);
+}
/***********************************************************************
* dri_context.c
*/
+extern struct dri1_api_lock_funcs dri1_lf;
+
void
dri_destroy_context(__DRIcontextPrivate * driContextPriv);
diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c
index 2e3f4099e2..287617e9a9 100644
--- a/src/gallium/state_trackers/dri/dri_drawable.c
+++ b/src/gallium/state_trackers/dri/dri_drawable.c
@@ -37,6 +37,7 @@
#include "pipe/p_screen.h"
#include "pipe/p_inlines.h"
#include "state_tracker/drm_api.h"
+#include "state_tracker/dri1_api.h"
#include "state_tracker/st_public.h"
#include "state_tracker/st_context.h"
#include "state_tracker/st_cb_fbo.h"
@@ -207,22 +208,6 @@ dri_flush_frontbuffer(struct pipe_screen *screen,
}
-void
-dri_swap_buffers(__DRIdrawablePrivate * dPriv)
-{
- /* not needed for dri2 */
- assert(0);
-}
-
-
-void
-dri_copy_sub_buffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h)
-{
- /* not needed for dri2 */
- assert(0);
-}
-
-
/**
* This is called when we need to set up GL rendering to a new X window.
*/
@@ -305,21 +290,322 @@ dri_create_buffer(__DRIscreenPrivate *sPriv,
drawable->attachments[i++] = __DRI_BUFFER_STENCIL;
drawable->num_attachments = i;
+ drawable->desired_fences = 2;
+
return GL_TRUE;
fail:
FREE(drawable);
return GL_FALSE;
}
+static struct pipe_fence_handle *
+dri_swap_fences_pop_front(struct dri_drawable *draw)
+{
+ struct pipe_screen *screen = dri_screen(draw->sPriv)->pipe_screen;
+ struct pipe_fence_handle *fence = NULL;
+
+ if (draw->cur_fences >= draw->desired_fences) {
+ screen->fence_reference(screen, &fence, draw->swap_fences[draw->tail]);
+ screen->fence_reference(screen, &draw->swap_fences[draw->tail++], NULL);
+ --draw->cur_fences;
+ draw->tail &= DRI_SWAP_FENCES_MASK;
+ }
+ return fence;
+}
+
+static void
+dri_swap_fences_push_back(struct dri_drawable *draw,
+ struct pipe_fence_handle *fence)
+{
+ struct pipe_screen *screen = dri_screen(draw->sPriv)->pipe_screen;
+
+ if (!fence)
+ return;
+
+ if (draw->cur_fences < DRI_SWAP_FENCES_MAX) {
+ draw->cur_fences++;
+ screen->fence_reference(screen, &draw->swap_fences[draw->head++], fence);
+ draw->head &= DRI_SWAP_FENCES_MASK;
+ }
+}
void
dri_destroy_buffer(__DRIdrawablePrivate *dPriv)
{
struct dri_drawable *drawable = dri_drawable(dPriv);
+ struct pipe_fence_handle *fence;
+ struct pipe_screen *screen = dri_screen(drawable->sPriv)->pipe_screen;
st_unreference_framebuffer(drawable->stfb);
+ drawable->desired_fences = 0;
+ while(drawable->cur_fences) {
+ fence = dri_swap_fences_pop_front(drawable);
+ screen->fence_reference(screen, &fence, NULL);
+ }
FREE(drawable);
}
+static void
+dri1_update_drawables_locked(struct dri_context *ctx,
+ __DRIdrawablePrivate *driDrawPriv,
+ __DRIdrawablePrivate *driReadPriv)
+{
+ if (ctx->stLostLock) {
+ ctx->stLostLock = FALSE;
+ if (driDrawPriv == driReadPriv)
+ DRI_VALIDATE_DRAWABLE_INFO(ctx->sPriv, driDrawPriv);
+ else
+ DRI_VALIDATE_TWO_DRAWABLES_INFO(ctx->sPriv, driDrawPriv, driReadPriv);
+ }
+}
+
+/**
+ * This ensures all contexts which binds to a drawable picks up the
+ * drawable change and signals new buffer state.
+ * Calling st_resize_framebuffer for each context may seem like overkill,
+ * but no new buffers will actually be allocated if the dimensions doesn't
+ * change.
+ */
+
+static void
+dri1_propagate_drawable_change(struct dri_context *ctx)
+{
+ __DRIdrawablePrivate *dPriv = ctx->dPriv;
+ __DRIdrawablePrivate *rPriv = ctx->rPriv;
+ boolean flushed = FALSE;
+
+ if (dPriv && ctx->d_stamp != dPriv->lastStamp) {
+
+ st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
+ flushed = TRUE;
+ ctx->d_stamp = dPriv->lastStamp;
+ st_resize_framebuffer(dri_drawable(dPriv)->stfb, dPriv->w, dPriv->h);
+
+ }
+
+ if (rPriv && dPriv != rPriv && ctx->r_stamp != rPriv->lastStamp) {
+
+ if (!flushed)
+ st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
+ ctx->r_stamp = rPriv->lastStamp;
+ st_resize_framebuffer(dri_drawable(rPriv)->stfb, rPriv->w, rPriv->h);
+
+ } else if (rPriv && dPriv == rPriv) {
+
+ ctx->r_stamp = ctx->d_stamp;
+
+ }
+}
+
+void
+dri1_update_drawables(struct dri_context *ctx,
+ struct dri_drawable *draw,
+ struct dri_drawable *read)
+{
+ dri_lock(ctx);
+ dri1_update_drawables_locked(ctx, draw->dPriv, read->dPriv);
+ dri_unlock(ctx);
+
+ dri1_propagate_drawable_change(ctx);
+}
+
+static INLINE boolean
+dri1_intersect_src_bbox(struct drm_clip_rect *dst,
+ int dst_x,
+ int dst_y,
+ const struct drm_clip_rect *src,
+ const struct drm_clip_rect *bbox)
+{
+ int xy1;
+ int xy2;
+
+ xy1 = ((int) src->x1 > (int) bbox->x1 + dst_x) ? src->x1 :
+ (int) bbox->x1 + dst_x;
+ xy2 = ((int) src->x2 < (int) bbox->x2 + dst_x) ? src->x2 :
+ (int) bbox->x2 + dst_x;
+ if (xy1 >= xy2 || xy1 < 0)
+ return FALSE;
+
+ dst->x1 = xy1;
+ dst->x2 = xy2;
+
+ xy1 = ((int) src->y1 > (int) bbox->y1 + dst_x) ? src->y1 :
+ (int) bbox->y1 + dst_x;
+ xy2 = ((int) src->y2 < (int) bbox->y2 + dst_x) ? src->y2 :
+ (int) bbox->y2 + dst_x;
+ if (xy1 >= xy2 || xy1 < 0)
+ return FALSE;
+
+ dst->y1 = xy1;
+ dst->y2 = xy2;
+ return TRUE;
+}
+
+
+static void
+dri1_swap_copy(struct dri_context *ctx,
+ struct pipe_surface *dst,
+ struct pipe_surface *src,
+ __DRIdrawablePrivate *dPriv,
+ const struct drm_clip_rect *bbox)
+{
+ struct pipe_context *pipe = ctx->pipe;
+ struct drm_clip_rect clip;
+ struct drm_clip_rect *cur;
+ int i;
+
+ cur = dPriv->pClipRects;
+
+ for (i=0; inumClipRects; ++i) {
+ if (dri1_intersect_src_bbox(&clip, dPriv->x, dPriv->y, cur++, bbox))
+ pipe->surface_copy(pipe, dst, clip.x1, clip.y1,
+ src,
+ (int) clip.x1 - dPriv->x,
+ (int) clip.y1 - dPriv->y,
+ clip.x2 - clip.x1,
+ clip.y2 - clip.y1);
+ }
+}
+
+static void
+dri1_copy_to_front(struct dri_context *ctx,
+ struct pipe_surface *surf,
+ __DRIdrawablePrivate *dPriv,
+ const struct drm_clip_rect *sub_box,
+ struct pipe_fence_handle **fence)
+{
+ struct pipe_context *pipe = ctx->pipe;
+ boolean save_lost_lock;
+ uint cur_w;
+ uint cur_h;
+ struct drm_clip_rect bbox;
+ boolean visible = TRUE;
+
+ *fence = NULL;
+
+ dri_lock(ctx);
+ save_lost_lock = ctx->stLostLock;
+ dri1_update_drawables_locked(ctx, dPriv, dPriv);
+ st_get_framebuffer_dimensions(dri_drawable(dPriv)->stfb, &cur_w, &cur_h);
+
+ bbox.x1 = 0;
+ bbox.x2 = cur_w;
+ bbox.y1 = 0;
+ bbox.y2 = cur_h;
+
+ if (sub_box)
+ visible = dri1_intersect_src_bbox(&bbox, 0, 0, &bbox, sub_box);
+
+ if (visible && __dri1_api_hooks->present_locked) {
+
+ __dri1_api_hooks->present_locked(pipe,
+ surf,
+ dPriv->pClipRects,
+ dPriv->numClipRects,
+ dPriv->x,
+ dPriv->y,
+ &bbox,
+ fence);
+
+ } else if (visible && __dri1_api_hooks->front_srf_locked) {
+
+ struct pipe_surface *front =
+ __dri1_api_hooks->front_srf_locked(pipe);
+
+ if (front)
+ dri1_swap_copy(ctx, front, surf, dPriv, &bbox);
+
+ st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, fence);
+ }
+
+ ctx->stLostLock = save_lost_lock;
+
+ /**
+ * FIXME: Revisit this: Update drawables on copy_sub_buffer ?
+ */
+
+ if (!sub_box)
+ dri1_update_drawables_locked(ctx, ctx->dPriv, ctx->rPriv);
+
+ dri_unlock(ctx);
+ dri1_propagate_drawable_change(ctx);
+}
+
+void
+dri1_flush_frontbuffer(struct pipe_screen *screen,
+ struct pipe_surface *surf,
+ void *context_private)
+{
+ struct dri_context *ctx = (struct dri_context *)context_private;
+ struct pipe_fence_handle *dummy_fence;
+
+ dri1_copy_to_front(ctx, surf, ctx->dPriv, NULL, &dummy_fence);
+
+ /**
+ * FIXME: Do we need swap throttling here?
+ */
+}
+
+void
+dri_swap_buffers(__DRIdrawablePrivate * dPriv)
+{
+ struct dri_context *ctx;
+ struct pipe_surface *back_surf;
+ struct dri_drawable *draw = dri_drawable(dPriv);
+ struct pipe_screen *screen = dri_screen(draw->sPriv)->pipe_screen;
+ struct pipe_fence_handle *fence;
+ GET_CURRENT_CONTEXT(glCtx);
+
+ assert(__dri1_api_hooks != NULL);
+
+ if (!glCtx)
+ return; /* For now */
+
+ ctx = (struct dri_context *) glCtx->st->pipe->priv;
+
+ st_get_framebuffer_surface(draw->stfb, ST_SURFACE_BACK_LEFT, &back_surf);
+ if (back_surf) {
+ st_notify_swapbuffers(draw->stfb);
+ st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
+ fence = dri_swap_fences_pop_front(draw);
+ if (fence) {
+ (void) screen->fence_finish(screen, fence, 0);
+ screen->fence_reference(screen, &fence, NULL);
+ }
+ dri1_copy_to_front(ctx, back_surf, dPriv, NULL, &fence);
+ dri_swap_fences_push_back(draw, fence);
+ screen->fence_reference(screen, &fence, NULL);
+ }
+}
+
+void
+dri_copy_sub_buffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h)
+{
+ struct drm_clip_rect sub_bbox;
+ struct dri_context *ctx;
+ struct pipe_surface *back_surf;
+ struct dri_drawable *draw = dri_drawable(dPriv);
+ struct pipe_fence_handle *dummy_fence;
+ GET_CURRENT_CONTEXT(glCtx);
+
+ assert(__dri1_api_hooks != NULL);
+
+ if (!glCtx)
+ return;
+
+ ctx = (struct dri_context *) glCtx->st->pipe->priv;
+
+ sub_bbox.x1 = x;
+ sub_bbox.x2 = x + w;
+ sub_bbox.y1 = y;
+ sub_bbox.y2 = y + h;
+
+ st_get_framebuffer_surface(draw->stfb, ST_SURFACE_BACK_LEFT, &back_surf);
+ if (back_surf) {
+ st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
+ dri1_copy_to_front(ctx, back_surf, dPriv, &sub_bbox, &dummy_fence);
+ }
+}
+
/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/state_trackers/dri/dri_drawable.h b/src/gallium/state_trackers/dri/dri_drawable.h
index 185c657b35..c1341deb52 100644
--- a/src/gallium/state_trackers/dri/dri_drawable.h
+++ b/src/gallium/state_trackers/dri/dri_drawable.h
@@ -31,9 +31,11 @@
#include "pipe/p_compiler.h"
struct pipe_surface;
-struct pipe_fence;
+struct pipe_fence_handle;
struct st_framebuffer;
+#define DRI_SWAP_FENCES_MAX 8
+#define DRI_SWAP_FENCES_MASK 7
struct dri_drawable
{
@@ -46,6 +48,11 @@ struct dri_drawable
/* gallium */
struct st_framebuffer *stfb;
+ struct pipe_fence_handle *swap_fences[DRI_SWAP_FENCES_MAX];
+ unsigned int head;
+ unsigned int tail;
+ unsigned int desired_fences;
+ unsigned int cur_fences;
};
@@ -84,6 +91,15 @@ dri_get_buffers(__DRIdrawablePrivate * dPriv);
void
dri_destroy_buffer(__DRIdrawablePrivate *dPriv);
+void
+dri1_update_drawables(struct dri_context *ctx,
+ struct dri_drawable *draw,
+ struct dri_drawable *read);
+
+void
+dri1_flush_frontbuffer(struct pipe_screen *screen,
+ struct pipe_surface *surf,
+ void *context_private);
#endif
/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c
index ab33003f51..418bb90115 100644
--- a/src/gallium/state_trackers/dri/dri_screen.c
+++ b/src/gallium/state_trackers/dri/dri_screen.c
@@ -40,7 +40,9 @@
#include "pipe/p_context.h"
#include "pipe/p_screen.h"
#include "pipe/p_inlines.h"
+#include "pipe/p_format.h"
#include "state_tracker/drm_api.h"
+#include "state_tracker/dri1_api.h"
#include "state_tracker/st_public.h"
#include "state_tracker/st_cb_fbo.h"
@@ -57,7 +59,6 @@ PUBLIC const char __driConfigOptions[] =
const uint __driNConfigOptions = 3;
-
static const __DRIextension *dri_screen_extensions[] = {
&driReadDrawableExtension,
&driCopySubBufferExtension.base,
@@ -67,6 +68,8 @@ static const __DRIextension *dri_screen_extensions[] = {
NULL
};
+struct dri1_api *__dri1_api_hooks = NULL;
+
static const __DRIconfig **
dri_fill_in_modes(__DRIscreenPrivate *psp,
unsigned pixel_bits, unsigned depth_bits,
@@ -139,7 +142,7 @@ dri_fill_in_modes(__DRIscreenPrivate *psp,
/**
* Get information about previous buffer swaps.
*/
-int
+static int
dri_get_swap_info(__DRIdrawablePrivate * dPriv,
__DRIswapInfo * sInfo)
{
@@ -151,13 +154,69 @@ dri_get_swap_info(__DRIdrawablePrivate * dPriv,
return 0;
}
+static INLINE void
+dri_copy_version(struct dri1_api_version *dst,
+ const struct __DRIversionRec *src)
+{
+ dst->major = src->major;
+ dst->minor = src->minor;
+ dst->patch_level = src->patch;
+}
-/**
- * NULL stub for old dri loaders
- */
-const __DRIconfig **
+static const __DRIconfig **
dri_init_screen(__DRIscreenPrivate *sPriv)
{
+ struct dri_screen *screen;
+ const __DRIconfig **configs;
+ struct dri1_create_screen_arg arg;
+
+ dri_init_extensions(NULL);
+
+ screen = CALLOC_STRUCT(dri_screen);
+ if (!screen)
+ return NULL;
+
+ screen->sPriv = sPriv;
+ screen->fd = sPriv->fd;
+ screen->drmLock = (drmLock *) &sPriv->pSAREA->lock;
+
+ sPriv->private = (void *) screen;
+ sPriv->extensions = dri_screen_extensions;
+
+ arg.base.mode = DRM_CREATE_DRI1;
+ arg.lf = &dri1_lf;
+ arg.ddx_info = sPriv->pDevPriv;
+ arg.ddx_info_size = sPriv->devPrivSize;
+ arg.sarea = sPriv->pSAREA;
+ dri_copy_version(&arg.ddx_version, &sPriv->ddx_version);
+ dri_copy_version(&arg.dri_version, &sPriv->dri_version);
+ dri_copy_version(&arg.drm_version, &sPriv->drm_version);
+ arg.api = NULL;
+
+ screen->pipe_screen = drm_api_hooks.create_screen
+ (screen->fd, &arg.base);
+
+ if (!screen->pipe_screen || !arg.api) {
+ debug_printf("%s: failed to create dri1 screen\n", __FUNCTION__);
+ goto out_no_screen;
+ }
+
+ __dri1_api_hooks = arg.api;
+
+ screen->pipe_screen->flush_frontbuffer = dri1_flush_frontbuffer;
+ driParseOptionInfo(&screen->optionCache,
+ __driConfigOptions,
+ __driNConfigOptions);
+
+ configs = dri_fill_in_modes(sPriv, sPriv->fbBPP, 24, 8, 1);
+ if (!configs)
+ goto out_no_configs;
+
+ return configs;
+ out_no_configs:
+ screen->pipe_screen->destroy(screen->pipe_screen);
+ out_no_screen:
+ FREE(screen);
return NULL;
}
@@ -167,10 +226,11 @@ dri_init_screen(__DRIscreenPrivate *sPriv)
*
* Returns the __GLcontextModes supported by this driver.
*/
-const __DRIconfig **
+static const __DRIconfig **
dri_init_screen2(__DRIscreenPrivate *sPriv)
{
struct dri_screen *screen;
+ struct drm_create_screen_arg arg;
/* Set up dispatch table to cope with all known extensions */
dri_init_extensions(NULL);
@@ -183,9 +243,9 @@ dri_init_screen2(__DRIscreenPrivate *sPriv)
screen->fd = sPriv->fd;
sPriv->private = (void *) screen;
sPriv->extensions = dri_screen_extensions;
+ arg.mode = DRM_CREATE_NORMAL;
-
- screen->pipe_screen = drm_api_hooks.create_screen(screen->fd, NULL);
+ screen->pipe_screen = drm_api_hooks.create_screen(screen->fd, &arg);
if (!screen->pipe_screen) {
debug_printf("%s: failed to create pipe_screen\n", __FUNCTION__);
goto fail;
@@ -208,7 +268,7 @@ fail:
}
-void
+static void
dri_destroy_screen(__DRIscreenPrivate * sPriv)
{
struct dri_screen *screen = dri_screen(sPriv);
@@ -220,19 +280,20 @@ dri_destroy_screen(__DRIscreenPrivate * sPriv)
PUBLIC const struct __DriverAPIRec driDriverAPI = {
- .InitScreen = dri_init_screen, /* not supported but exported */
+ .InitScreen = dri_init_screen,
.DestroyScreen = dri_destroy_screen,
.CreateContext = dri_create_context,
.DestroyContext = dri_destroy_context,
.CreateBuffer = dri_create_buffer,
.DestroyBuffer = dri_destroy_buffer,
- .SwapBuffers = dri_swap_buffers, /* not supported but exported */
+ .SwapBuffers = dri_swap_buffers,
.MakeCurrent = dri_make_current,
.UnbindContext = dri_unbind_context,
.GetSwapInfo = dri_get_swap_info,
.GetDrawableMSC = driDrawableGetMSC32,
.WaitForMSC = driWaitForMSC32,
- .CopySubBuffer = dri_copy_sub_buffer, /* not supported but exported */
+ .CopySubBuffer = dri_copy_sub_buffer,
+ .InitScreen = dri_init_screen,
.InitScreen2 = dri_init_screen2,
};
diff --git a/src/gallium/state_trackers/dri/dri_screen.h b/src/gallium/state_trackers/dri/dri_screen.h
index 3751ec6121..c358c35168 100644
--- a/src/gallium/state_trackers/dri/dri_screen.h
+++ b/src/gallium/state_trackers/dri/dri_screen.h
@@ -37,6 +37,8 @@
#include "pipe/p_compiler.h"
+#include "state_tracker/dri1_api.h"
+
struct dri_screen
{
/* dri */
@@ -55,6 +57,7 @@ struct dri_screen
/* drm */
int fd;
+ drmLock *drmLock;
/* gallium */
struct pipe_winsys *pipe_winsys;
@@ -73,15 +76,8 @@ dri_screen(__DRIscreenPrivate *sPriv)
/***********************************************************************
* dri_screen.c
*/
-const __DRIconfig **
-dri_init_screen2(__DRIscreenPrivate *sPriv);
-
-void
-dri_destroy_screen(__DRIscreenPrivate * sPriv);
-int
-dri_get_swap_info(__DRIdrawablePrivate * dPriv,
- __DRIswapInfo * sInfo);
+extern struct dri1_api *__dri1_api_hooks;
#endif
--
cgit v1.2.3
From 0929b2bf3cdb54d94da8dee5797878e2ee582b41 Mon Sep 17 00:00:00 2001
From: Thomas Hellstrom
Date: Tue, 28 Apr 2009 11:54:25 +0200
Subject: gallium: indent and cleanfile the dri state-tracker.
---
src/gallium/state_trackers/dri/dri_context.c | 42 ++---
src/gallium/state_trackers/dri/dri_context.h | 23 +--
src/gallium/state_trackers/dri/dri_drawable.c | 227 +++++++++++-------------
src/gallium/state_trackers/dri/dri_drawable.h | 33 ++--
src/gallium/state_trackers/dri/dri_extensions.c | 7 +-
src/gallium/state_trackers/dri/dri_screen.c | 164 ++++++++---------
src/gallium/state_trackers/dri/dri_screen.h | 6 +-
7 files changed, 221 insertions(+), 281 deletions(-)
diff --git a/src/gallium/state_trackers/dri/dri_context.c b/src/gallium/state_trackers/dri/dri_context.c
index a45fb541fd..7f38671126 100644
--- a/src/gallium/state_trackers/dri/dri_context.c
+++ b/src/gallium/state_trackers/dri/dri_context.c
@@ -42,12 +42,9 @@
#include "util/u_memory.h"
-
-
GLboolean
-dri_create_context(const __GLcontextModes *visual,
- __DRIcontextPrivate *cPriv,
- void *sharedContextPrivate)
+dri_create_context(const __GLcontextModes * visual,
+ __DRIcontextPrivate * cPriv, void *sharedContextPrivate)
{
__DRIscreenPrivate *sPriv = cPriv->driScreenPriv;
struct dri_screen *screen = dri_screen(sPriv);
@@ -55,7 +52,7 @@ dri_create_context(const __GLcontextModes *visual,
struct st_context *st_share = NULL;
if (sharedContextPrivate) {
- st_share = ((struct dri_context *) sharedContextPrivate)->st;
+ st_share = ((struct dri_context *)sharedContextPrivate)->st;
}
ctx = CALLOC_STRUCT(dri_context);
@@ -70,9 +67,7 @@ dri_create_context(const __GLcontextModes *visual,
ctx->r_stamp = -1;
driParseConfigFiles(&ctx->optionCache,
- &screen->optionCache,
- sPriv->myNum,
- "dri");
+ &screen->optionCache, sPriv->myNum, "dri");
ctx->pipe = drm_api_hooks.create_context(screen->pipe_screen);
@@ -90,7 +85,7 @@ dri_create_context(const __GLcontextModes *visual,
return GL_TRUE;
-fail:
+ fail:
if (ctx && ctx->st)
st_destroy_context(ctx->st);
@@ -101,9 +96,8 @@ fail:
return FALSE;
}
-
void
-dri_destroy_context(__DRIcontextPrivate *cPriv)
+dri_destroy_context(__DRIcontextPrivate * cPriv)
{
struct dri_context *ctx = dri_context(cPriv);
struct dri_screen *screen = dri_screen(cPriv->driScreenPriv);
@@ -125,9 +119,8 @@ dri_destroy_context(__DRIcontextPrivate *cPriv)
FREE(ctx);
}
-
GLboolean
-dri_unbind_context(__DRIcontextPrivate *cPriv)
+dri_unbind_context(__DRIcontextPrivate * cPriv)
{
if (cPriv) {
struct dri_context *ctx = dri_context(cPriv);
@@ -146,15 +139,16 @@ dri_unbind_context(__DRIcontextPrivate *cPriv)
}
GLboolean
-dri_make_current(__DRIcontextPrivate *cPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv)
+dri_make_current(__DRIcontextPrivate * cPriv,
+ __DRIdrawablePrivate * driDrawPriv,
+ __DRIdrawablePrivate * driReadPriv)
{
if (cPriv) {
struct dri_context *ctx = dri_context(cPriv);
struct dri_screen *screen = dri_screen(cPriv->driScreenPriv);
struct dri_drawable *draw = dri_drawable(driDrawPriv);
struct dri_drawable *read = dri_drawable(driReadPriv);
+
GET_CURRENT_CONTEXT(oldGLCtx);
if (oldGLCtx && oldGLCtx->st != ctx->st)
@@ -191,35 +185,34 @@ dri_make_current(__DRIcontextPrivate *cPriv,
static void
st_dri_lock(struct pipe_context *pipe)
{
- dri_lock((struct dri_context *) pipe->priv);
+ dri_lock((struct dri_context *)pipe->priv);
}
static void
st_dri_unlock(struct pipe_context *pipe)
{
- dri_unlock((struct dri_context *) pipe->priv);
+ dri_unlock((struct dri_context *)pipe->priv);
}
static boolean
st_dri_is_locked(struct pipe_context *pipe)
{
- return ((struct dri_context *) pipe->priv)->isLocked;
+ return ((struct dri_context *)pipe->priv)->isLocked;
}
static boolean
st_dri_lost_lock(struct pipe_context *pipe)
{
- return ((struct dri_context *) pipe->priv)->wsLostLock;
+ return ((struct dri_context *)pipe->priv)->wsLostLock;
}
static void
st_dri_clear_lost_lock(struct pipe_context *pipe)
{
- ((struct dri_context *) pipe->priv)->wsLostLock = FALSE;
+ ((struct dri_context *)pipe->priv)->wsLostLock = FALSE;
}
-struct dri1_api_lock_funcs dri1_lf =
-{
+struct dri1_api_lock_funcs dri1_lf = {
.lock = st_dri_lock,
.unlock = st_dri_unlock,
.is_locked = st_dri_is_locked,
@@ -227,5 +220,4 @@ struct dri1_api_lock_funcs dri1_lf =
.clear_lost_lock = st_dri_clear_lost_lock
};
-
/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/state_trackers/dri/dri_context.h b/src/gallium/state_trackers/dri/dri_context.h
index 82a5916827..4650178734 100644
--- a/src/gallium/state_trackers/dri/dri_context.h
+++ b/src/gallium/state_trackers/dri/dri_context.h
@@ -36,7 +36,6 @@
#include "drm.h"
#include "dri_util.h"
-
struct pipe_context;
struct pipe_fence;
struct st_context;
@@ -68,9 +67,9 @@ struct dri_context
};
static INLINE struct dri_context *
-dri_context(__DRIcontextPrivate *driContextPriv)
+dri_context(__DRIcontextPrivate * driContextPriv)
{
- return (struct dri_context *) driContextPriv->driverPrivate;
+ return (struct dri_context *)driContextPriv->driverPrivate;
}
static INLINE void
@@ -100,28 +99,24 @@ dri_unlock(struct dri_context *ctx)
*/
extern struct dri1_api_lock_funcs dri1_lf;
-void
-dri_destroy_context(__DRIcontextPrivate * driContextPriv);
+void dri_destroy_context(__DRIcontextPrivate * driContextPriv);
-boolean
-dri_unbind_context(__DRIcontextPrivate * driContextPriv);
+boolean dri_unbind_context(__DRIcontextPrivate * driContextPriv);
boolean
dri_make_current(__DRIcontextPrivate * driContextPriv,
- __DRIdrawablePrivate * driDrawPriv,
- __DRIdrawablePrivate * driReadPriv);
+ __DRIdrawablePrivate * driDrawPriv,
+ __DRIdrawablePrivate * driReadPriv);
boolean
dri_create_context(const __GLcontextModes * visual,
- __DRIcontextPrivate * driContextPriv,
- void *sharedContextPrivate);
-
+ __DRIcontextPrivate * driContextPriv,
+ void *sharedContextPrivate);
/***********************************************************************
* dri_extensions.c
*/
-void
-dri_init_extensions(struct dri_context *ctx);
+void dri_init_extensions(struct dri_context *ctx);
#endif
diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c
index 287617e9a9..abda4ff17e 100644
--- a/src/gallium/state_trackers/dri/dri_drawable.c
+++ b/src/gallium/state_trackers/dri/dri_drawable.c
@@ -44,23 +44,19 @@
#include "util/u_memory.h"
-
static void
-dri_copy_to_front(__DRIdrawablePrivate *dPriv,
- struct pipe_surface *from,
- int x, int y, unsigned w, unsigned h)
+dri_copy_to_front(__DRIdrawablePrivate * dPriv,
+ struct pipe_surface *from,
+ int x, int y, unsigned w, unsigned h)
{
/* TODO send a message to the Xserver to copy to the real front buffer */
}
-
static struct pipe_surface *
dri_surface_from_handle(struct pipe_screen *screen,
- unsigned handle,
- enum pipe_format format,
- unsigned width,
- unsigned height,
- unsigned pitch)
+ unsigned handle,
+ enum pipe_format format,
+ unsigned width, unsigned height, unsigned pitch)
{
struct pipe_surface *surface = NULL;
struct pipe_texture *texture = NULL;
@@ -81,10 +77,7 @@ dri_surface_from_handle(struct pipe_screen *screen,
templat.height[0] = height;
pf_get_block(templat.format, &templat.block);
- texture = screen->texture_blanket(screen,
- &templat,
- &pitch,
- buf);
+ texture = screen->texture_blanket(screen, &templat, &pitch, buf);
/* we don't need the buffer from this point on */
pipe_buffer_reference(&buf, NULL);
@@ -93,20 +86,19 @@ dri_surface_from_handle(struct pipe_screen *screen,
return NULL;
surface = screen->get_tex_surface(screen, texture, 0, 0, 0,
- PIPE_BUFFER_USAGE_GPU_READ |
- PIPE_BUFFER_USAGE_GPU_WRITE);
+ PIPE_BUFFER_USAGE_GPU_READ |
+ PIPE_BUFFER_USAGE_GPU_WRITE);
/* we don't need the texture from this point on */
pipe_texture_reference(&texture, NULL);
return surface;
}
-
/**
* This will be called a drawable is known to have been resized.
*/
void
-dri_get_buffers(__DRIdrawablePrivate *dPriv)
+dri_get_buffers(__DRIdrawablePrivate * dPriv)
{
struct dri_drawable *drawable = dri_drawable(dPriv);
struct pipe_surface *surface = NULL;
@@ -117,13 +109,14 @@ dri_get_buffers(__DRIdrawablePrivate *dPriv)
boolean have_depth = FALSE;
int i, count;
- buffers = (*dri_screen->dri2.loader->getBuffers)(dri_drawable,
- &dri_drawable->w,
- &dri_drawable->h,
- drawable->attachments,
- drawable->num_attachments,
- &count,
- dri_drawable->loaderPrivate);
+ buffers = (*dri_screen->dri2.loader->getBuffers) (dri_drawable,
+ &dri_drawable->w,
+ &dri_drawable->h,
+ drawable->attachments,
+ drawable->
+ num_attachments, &count,
+ dri_drawable->
+ loaderPrivate);
if (buffers == NULL) {
return;
@@ -150,45 +143,44 @@ dri_get_buffers(__DRIdrawablePrivate *dPriv)
int index = 0;
switch (buffers[i].attachment) {
- case __DRI_BUFFER_FRONT_LEFT:
- index = ST_SURFACE_FRONT_LEFT;
- format = PIPE_FORMAT_A8R8G8B8_UNORM;
- break;
- case __DRI_BUFFER_FAKE_FRONT_LEFT:
- index = ST_SURFACE_FRONT_LEFT;
- format = PIPE_FORMAT_A8R8G8B8_UNORM;
- break;
- case __DRI_BUFFER_BACK_LEFT:
- index = ST_SURFACE_BACK_LEFT;
- format = PIPE_FORMAT_A8R8G8B8_UNORM;
- break;
- case __DRI_BUFFER_DEPTH:
- index = ST_SURFACE_DEPTH;
- format = PIPE_FORMAT_Z24S8_UNORM;
- break;
- case __DRI_BUFFER_STENCIL:
- index = ST_SURFACE_DEPTH;
- format = PIPE_FORMAT_Z24S8_UNORM;
- break;
- case __DRI_BUFFER_ACCUM:
- default:
- assert(0);
+ case __DRI_BUFFER_FRONT_LEFT:
+ index = ST_SURFACE_FRONT_LEFT;
+ format = PIPE_FORMAT_A8R8G8B8_UNORM;
+ break;
+ case __DRI_BUFFER_FAKE_FRONT_LEFT:
+ index = ST_SURFACE_FRONT_LEFT;
+ format = PIPE_FORMAT_A8R8G8B8_UNORM;
+ break;
+ case __DRI_BUFFER_BACK_LEFT:
+ index = ST_SURFACE_BACK_LEFT;
+ format = PIPE_FORMAT_A8R8G8B8_UNORM;
+ break;
+ case __DRI_BUFFER_DEPTH:
+ index = ST_SURFACE_DEPTH;
+ format = PIPE_FORMAT_Z24S8_UNORM;
+ break;
+ case __DRI_BUFFER_STENCIL:
+ index = ST_SURFACE_DEPTH;
+ format = PIPE_FORMAT_Z24S8_UNORM;
+ break;
+ case __DRI_BUFFER_ACCUM:
+ default:
+ assert(0);
}
assert(buffers[i].cpp == 4);
if (index == ST_SURFACE_DEPTH) {
- if (have_depth)
- continue;
- else
- have_depth = TRUE;
+ if (have_depth)
+ continue;
+ else
+ have_depth = TRUE;
}
surface = dri_surface_from_handle(screen,
- buffers[i].name,
- format,
- dri_drawable->w,
- dri_drawable->h,
- buffers[i].pitch);
+ buffers[i].name,
+ format,
+ dri_drawable->w,
+ dri_drawable->h, buffers[i].pitch);
st_set_framebuffer_surface(drawable->stfb, index, surface);
pipe_surface_reference(&surface, NULL);
@@ -197,25 +189,22 @@ dri_get_buffers(__DRIdrawablePrivate *dPriv)
st_resize_framebuffer(drawable->stfb, dri_drawable->w, dri_drawable->h);
}
-
void
dri_flush_frontbuffer(struct pipe_screen *screen,
- struct pipe_surface *surf,
- void *context_private)
+ struct pipe_surface *surf, void *context_private)
{
struct dri_context *ctx = (struct dri_context *)context_private;
+
dri_copy_to_front(ctx->dPriv, surf, 0, 0, surf->width, surf->height);
}
-
/**
* This is called when we need to set up GL rendering to a new X window.
*/
boolean
-dri_create_buffer(__DRIscreenPrivate *sPriv,
- __DRIdrawablePrivate *dPriv,
- const __GLcontextModes *visual,
- boolean isPixmap)
+dri_create_buffer(__DRIscreenPrivate * sPriv,
+ __DRIdrawablePrivate * dPriv,
+ const __GLcontextModes * visual, boolean isPixmap)
{
enum pipe_format colorFormat, depthFormat, stencilFormat;
struct dri_screen *screen = sPriv->private;
@@ -224,7 +213,7 @@ dri_create_buffer(__DRIscreenPrivate *sPriv,
int i;
if (isPixmap)
- goto fail; /* not implemented */
+ goto fail; /* not implemented */
drawable = CALLOC_STRUCT(dri_drawable);
if (drawable == NULL)
@@ -241,39 +230,38 @@ dri_create_buffer(__DRIscreenPrivate *sPriv,
if (visual->depthBits) {
if (pscreen->is_format_supported(pscreen, PIPE_FORMAT_Z24S8_UNORM,
- PIPE_TEXTURE_2D,
- PIPE_TEXTURE_USAGE_RENDER_TARGET |
- PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0))
- depthFormat = PIPE_FORMAT_Z24S8_UNORM;
+ PIPE_TEXTURE_2D,
+ PIPE_TEXTURE_USAGE_RENDER_TARGET |
+ PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0))
+ depthFormat = PIPE_FORMAT_Z24S8_UNORM;
else
- depthFormat = PIPE_FORMAT_S8Z24_UNORM;
+ depthFormat = PIPE_FORMAT_S8Z24_UNORM;
} else
depthFormat = PIPE_FORMAT_NONE;
if (visual->stencilBits) {
if (pscreen->is_format_supported(pscreen, PIPE_FORMAT_Z24S8_UNORM,
- PIPE_TEXTURE_2D,
- PIPE_TEXTURE_USAGE_RENDER_TARGET |
- PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0))
- stencilFormat = PIPE_FORMAT_Z24S8_UNORM;
+ PIPE_TEXTURE_2D,
+ PIPE_TEXTURE_USAGE_RENDER_TARGET |
+ PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0))
+ stencilFormat = PIPE_FORMAT_Z24S8_UNORM;
else
- stencilFormat = PIPE_FORMAT_S8Z24_UNORM;
+ stencilFormat = PIPE_FORMAT_S8Z24_UNORM;
} else
stencilFormat = PIPE_FORMAT_NONE;
drawable->stfb = st_create_framebuffer(visual,
- colorFormat,
- depthFormat,
- stencilFormat,
- dPriv->w,
- dPriv->h,
- (void*) drawable);
+ colorFormat,
+ depthFormat,
+ stencilFormat,
+ dPriv->w,
+ dPriv->h, (void *)drawable);
if (drawable->stfb == NULL)
goto fail;
drawable->sPriv = sPriv;
drawable->dPriv = dPriv;
- dPriv->driverPrivate = (void *) drawable;
+ dPriv->driverPrivate = (void *)drawable;
/* setup dri2 buffers information */
i = 0;
@@ -293,7 +281,7 @@ dri_create_buffer(__DRIscreenPrivate *sPriv,
drawable->desired_fences = 2;
return GL_TRUE;
-fail:
+ fail:
FREE(drawable);
return GL_FALSE;
}
@@ -324,13 +312,14 @@ dri_swap_fences_push_back(struct dri_drawable *draw,
if (draw->cur_fences < DRI_SWAP_FENCES_MAX) {
draw->cur_fences++;
- screen->fence_reference(screen, &draw->swap_fences[draw->head++], fence);
+ screen->fence_reference(screen, &draw->swap_fences[draw->head++],
+ fence);
draw->head &= DRI_SWAP_FENCES_MASK;
}
}
void
-dri_destroy_buffer(__DRIdrawablePrivate *dPriv)
+dri_destroy_buffer(__DRIdrawablePrivate * dPriv)
{
struct dri_drawable *drawable = dri_drawable(dPriv);
struct pipe_fence_handle *fence;
@@ -338,7 +327,7 @@ dri_destroy_buffer(__DRIdrawablePrivate *dPriv)
st_unreference_framebuffer(drawable->stfb);
drawable->desired_fences = 0;
- while(drawable->cur_fences) {
+ while (drawable->cur_fences) {
fence = dri_swap_fences_pop_front(drawable);
screen->fence_reference(screen, &fence, NULL);
}
@@ -348,15 +337,16 @@ dri_destroy_buffer(__DRIdrawablePrivate *dPriv)
static void
dri1_update_drawables_locked(struct dri_context *ctx,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv)
+ __DRIdrawablePrivate * driDrawPriv,
+ __DRIdrawablePrivate * driReadPriv)
{
if (ctx->stLostLock) {
ctx->stLostLock = FALSE;
if (driDrawPriv == driReadPriv)
DRI_VALIDATE_DRAWABLE_INFO(ctx->sPriv, driDrawPriv);
else
- DRI_VALIDATE_TWO_DRAWABLES_INFO(ctx->sPriv, driDrawPriv, driReadPriv);
+ DRI_VALIDATE_TWO_DRAWABLES_INFO(ctx->sPriv, driDrawPriv,
+ driReadPriv);
}
}
@@ -387,7 +377,7 @@ dri1_propagate_drawable_change(struct dri_context *ctx)
if (rPriv && dPriv != rPriv && ctx->r_stamp != rPriv->lastStamp) {
if (!flushed)
- st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
+ st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
ctx->r_stamp = rPriv->lastStamp;
st_resize_framebuffer(dri_drawable(rPriv)->stfb, rPriv->w, rPriv->h);
@@ -400,8 +390,7 @@ dri1_propagate_drawable_change(struct dri_context *ctx)
void
dri1_update_drawables(struct dri_context *ctx,
- struct dri_drawable *draw,
- struct dri_drawable *read)
+ struct dri_drawable *draw, struct dri_drawable *read)
{
dri_lock(ctx);
dri1_update_drawables_locked(ctx, draw->dPriv, read->dPriv);
@@ -420,20 +409,20 @@ dri1_intersect_src_bbox(struct drm_clip_rect *dst,
int xy1;
int xy2;
- xy1 = ((int) src->x1 > (int) bbox->x1 + dst_x) ? src->x1 :
- (int) bbox->x1 + dst_x;
- xy2 = ((int) src->x2 < (int) bbox->x2 + dst_x) ? src->x2 :
- (int) bbox->x2 + dst_x;
+ xy1 = ((int)src->x1 > (int)bbox->x1 + dst_x) ? src->x1 :
+ (int)bbox->x1 + dst_x;
+ xy2 = ((int)src->x2 < (int)bbox->x2 + dst_x) ? src->x2 :
+ (int)bbox->x2 + dst_x;
if (xy1 >= xy2 || xy1 < 0)
return FALSE;
dst->x1 = xy1;
dst->x2 = xy2;
- xy1 = ((int) src->y1 > (int) bbox->y1 + dst_x) ? src->y1 :
- (int) bbox->y1 + dst_x;
- xy2 = ((int) src->y2 < (int) bbox->y2 + dst_x) ? src->y2 :
- (int) bbox->y2 + dst_x;
+ xy1 = ((int)src->y1 > (int)bbox->y1 + dst_x) ? src->y1 :
+ (int)bbox->y1 + dst_x;
+ xy2 = ((int)src->y2 < (int)bbox->y2 + dst_x) ? src->y2 :
+ (int)bbox->y2 + dst_x;
if (xy1 >= xy2 || xy1 < 0)
return FALSE;
@@ -442,13 +431,11 @@ dri1_intersect_src_bbox(struct drm_clip_rect *dst,
return TRUE;
}
-
static void
dri1_swap_copy(struct dri_context *ctx,
struct pipe_surface *dst,
struct pipe_surface *src,
- __DRIdrawablePrivate *dPriv,
- const struct drm_clip_rect *bbox)
+ __DRIdrawablePrivate * dPriv, const struct drm_clip_rect *bbox)
{
struct pipe_context *pipe = ctx->pipe;
struct drm_clip_rect clip;
@@ -457,21 +444,20 @@ dri1_swap_copy(struct dri_context *ctx,
cur = dPriv->pClipRects;
- for (i=0; inumClipRects; ++i) {
+ for (i = 0; i < dPriv->numClipRects; ++i) {
if (dri1_intersect_src_bbox(&clip, dPriv->x, dPriv->y, cur++, bbox))
pipe->surface_copy(pipe, dst, clip.x1, clip.y1,
src,
- (int) clip.x1 - dPriv->x,
- (int) clip.y1 - dPriv->y,
- clip.x2 - clip.x1,
- clip.y2 - clip.y1);
+ (int)clip.x1 - dPriv->x,
+ (int)clip.y1 - dPriv->y,
+ clip.x2 - clip.x1, clip.y2 - clip.y1);
}
}
static void
dri1_copy_to_front(struct dri_context *ctx,
struct pipe_surface *surf,
- __DRIdrawablePrivate *dPriv,
+ __DRIdrawablePrivate * dPriv,
const struct drm_clip_rect *sub_box,
struct pipe_fence_handle **fence)
{
@@ -503,15 +489,11 @@ dri1_copy_to_front(struct dri_context *ctx,
surf,
dPriv->pClipRects,
dPriv->numClipRects,
- dPriv->x,
- dPriv->y,
- &bbox,
- fence);
+ dPriv->x, dPriv->y, &bbox, fence);
} else if (visible && __dri1_api_hooks->front_srf_locked) {
- struct pipe_surface *front =
- __dri1_api_hooks->front_srf_locked(pipe);
+ struct pipe_surface *front = __dri1_api_hooks->front_srf_locked(pipe);
if (front)
dri1_swap_copy(ctx, front, surf, dPriv, &bbox);
@@ -534,8 +516,7 @@ dri1_copy_to_front(struct dri_context *ctx,
void
dri1_flush_frontbuffer(struct pipe_screen *screen,
- struct pipe_surface *surf,
- void *context_private)
+ struct pipe_surface *surf, void *context_private)
{
struct dri_context *ctx = (struct dri_context *)context_private;
struct pipe_fence_handle *dummy_fence;
@@ -555,14 +536,15 @@ dri_swap_buffers(__DRIdrawablePrivate * dPriv)
struct dri_drawable *draw = dri_drawable(dPriv);
struct pipe_screen *screen = dri_screen(draw->sPriv)->pipe_screen;
struct pipe_fence_handle *fence;
+
GET_CURRENT_CONTEXT(glCtx);
assert(__dri1_api_hooks != NULL);
if (!glCtx)
- return; /* For now */
+ return; /* For now */
- ctx = (struct dri_context *) glCtx->st->pipe->priv;
+ ctx = (struct dri_context *)glCtx->st->pipe->priv;
st_get_framebuffer_surface(draw->stfb, ST_SURFACE_BACK_LEFT, &back_surf);
if (back_surf) {
@@ -570,7 +552,7 @@ dri_swap_buffers(__DRIdrawablePrivate * dPriv)
st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
fence = dri_swap_fences_pop_front(draw);
if (fence) {
- (void) screen->fence_finish(screen, fence, 0);
+ (void)screen->fence_finish(screen, fence, 0);
screen->fence_reference(screen, &fence, NULL);
}
dri1_copy_to_front(ctx, back_surf, dPriv, NULL, &fence);
@@ -587,6 +569,7 @@ dri_copy_sub_buffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h)
struct pipe_surface *back_surf;
struct dri_drawable *draw = dri_drawable(dPriv);
struct pipe_fence_handle *dummy_fence;
+
GET_CURRENT_CONTEXT(glCtx);
assert(__dri1_api_hooks != NULL);
@@ -594,7 +577,7 @@ dri_copy_sub_buffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h)
if (!glCtx)
return;
- ctx = (struct dri_context *) glCtx->st->pipe->priv;
+ ctx = (struct dri_context *)glCtx->st->pipe->priv;
sub_bbox.x1 = x;
sub_bbox.x2 = x + w;
diff --git a/src/gallium/state_trackers/dri/dri_drawable.h b/src/gallium/state_trackers/dri/dri_drawable.h
index c1341deb52..78a66624aa 100644
--- a/src/gallium/state_trackers/dri/dri_drawable.h
+++ b/src/gallium/state_trackers/dri/dri_drawable.h
@@ -55,51 +55,40 @@ struct dri_drawable
unsigned int cur_fences;
};
-
static INLINE struct dri_drawable *
dri_drawable(__DRIdrawablePrivate * driDrawPriv)
{
- return (struct dri_drawable *) driDrawPriv->driverPrivate;
+ return (struct dri_drawable *)driDrawPriv->driverPrivate;
}
-
/***********************************************************************
* dri_drawable.c
*/
boolean
-dri_create_buffer(__DRIscreenPrivate *sPriv,
- __DRIdrawablePrivate *dPriv,
- const __GLcontextModes *visual,
- boolean isPixmap);
+dri_create_buffer(__DRIscreenPrivate * sPriv,
+ __DRIdrawablePrivate * dPriv,
+ const __GLcontextModes * visual, boolean isPixmap);
void
dri_flush_frontbuffer(struct pipe_screen *screen,
- struct pipe_surface *surf,
- void *context_private);
+ struct pipe_surface *surf, void *context_private);
-void
-dri_swap_buffers(__DRIdrawablePrivate * dPriv);
+void dri_swap_buffers(__DRIdrawablePrivate * dPriv);
void
-dri_copy_sub_buffer(__DRIdrawablePrivate * dPriv,
- int x, int y,
- int w, int h);
+dri_copy_sub_buffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h);
-void
-dri_get_buffers(__DRIdrawablePrivate * dPriv);
+void dri_get_buffers(__DRIdrawablePrivate * dPriv);
-void
-dri_destroy_buffer(__DRIdrawablePrivate *dPriv);
+void dri_destroy_buffer(__DRIdrawablePrivate * dPriv);
void
dri1_update_drawables(struct dri_context *ctx,
- struct dri_drawable *draw,
- struct dri_drawable *read);
+ struct dri_drawable *draw, struct dri_drawable *read);
void
dri1_flush_frontbuffer(struct pipe_screen *screen,
- struct pipe_surface *surf,
- void *context_private);
+ struct pipe_surface *surf, void *context_private);
#endif
/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/state_trackers/dri/dri_extensions.c b/src/gallium/state_trackers/dri/dri_extensions.c
index 732d1e89b0..0c59d42d5c 100644
--- a/src/gallium/state_trackers/dri/dri_extensions.c
+++ b/src/gallium/state_trackers/dri/dri_extensions.c
@@ -52,7 +52,6 @@
#define need_GL_NV_vertex_program
#include "extension_helper.h"
-
/**
* Extension strings exported by the driver.
*/
@@ -74,7 +73,8 @@ const struct dri_extension card_extensions[] = {
{"GL_ARB_vertex_program", GL_ARB_vertex_program_functions},
{"GL_ARB_window_pos", GL_ARB_window_pos_functions},
{"GL_EXT_blend_color", GL_EXT_blend_color_functions},
- {"GL_EXT_blend_equation_separate", GL_EXT_blend_equation_separate_functions},
+ {"GL_EXT_blend_equation_separate",
+ GL_EXT_blend_equation_separate_functions},
{"GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions},
{"GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions},
{"GL_EXT_blend_subtract", NULL},
@@ -98,11 +98,10 @@ const struct dri_extension card_extensions[] = {
{"GL_NV_blend_square", NULL},
{"GL_NV_vertex_program", GL_NV_vertex_program_functions},
{"GL_NV_vertex_program1_1", NULL},
- {"GL_SGIS_generate_mipmap", NULL },
+ {"GL_SGIS_generate_mipmap", NULL},
{NULL, NULL}
};
-
void
dri_init_extensions(struct dri_context *ctx)
{
diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c
index 418bb90115..d3392ee690 100644
--- a/src/gallium/state_trackers/dri/dri_screen.c
+++ b/src/gallium/state_trackers/dri/dri_screen.c
@@ -46,34 +46,32 @@
#include "state_tracker/st_public.h"
#include "state_tracker/st_cb_fbo.h"
-
PUBLIC const char __driConfigOptions[] =
DRI_CONF_BEGIN DRI_CONF_SECTION_PERFORMANCE
- DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS)
- DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
+ DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS)
+ DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
DRI_CONF_SECTION_END DRI_CONF_SECTION_QUALITY
- /*DRI_CONF_FORCE_S3TC_ENABLE(false)*/
- DRI_CONF_ALLOW_LARGE_TEXTURES(1)
+ /*DRI_CONF_FORCE_S3TC_ENABLE(false) */
+ DRI_CONF_ALLOW_LARGE_TEXTURES(1)
DRI_CONF_SECTION_END DRI_CONF_END;
+ const uint __driNConfigOptions = 3;
-const uint __driNConfigOptions = 3;
-
-static const __DRIextension *dri_screen_extensions[] = {
- &driReadDrawableExtension,
- &driCopySubBufferExtension.base,
- &driSwapControlExtension.base,
- &driFrameTrackingExtension.base,
- &driMediaStreamCounterExtension.base,
- NULL
-};
+ static const __DRIextension *dri_screen_extensions[] = {
+ &driReadDrawableExtension,
+ &driCopySubBufferExtension.base,
+ &driSwapControlExtension.base,
+ &driFrameTrackingExtension.base,
+ &driMediaStreamCounterExtension.base,
+ NULL
+ };
struct dri1_api *__dri1_api_hooks = NULL;
static const __DRIconfig **
-dri_fill_in_modes(__DRIscreenPrivate *psp,
- unsigned pixel_bits, unsigned depth_bits,
- unsigned stencil_bits, GLboolean have_back_buffer)
+dri_fill_in_modes(__DRIscreenPrivate * psp,
+ unsigned pixel_bits, unsigned depth_bits,
+ unsigned stencil_bits, GLboolean have_back_buffer)
{
__DRIconfig **configs;
__GLcontextModes *m;
@@ -97,9 +95,9 @@ dri_fill_in_modes(__DRIscreenPrivate *psp,
depth_bits_array[1] = 24;
depth_bits_array[2] = 24;
- stencil_bits_array[0] = 0; /* no depth or stencil */
- stencil_bits_array[1] = 0; /* z24x8 */
- stencil_bits_array[2] = 8; /* z24s8 */
+ stencil_bits_array[0] = 0; /* no depth or stencil */
+ stencil_bits_array[1] = 0; /* z24x8 */
+ stencil_bits_array[2] = 8; /* z24s8 */
msaa_samples_array[0] = 0;
@@ -107,22 +105,22 @@ dri_fill_in_modes(__DRIscreenPrivate *psp,
back_buffer_factor = 3;
msaa_samples_factor = 1;
- num_modes = depth_buffer_factor * back_buffer_factor * msaa_samples_factor * 4;
+ num_modes =
+ depth_buffer_factor * back_buffer_factor * msaa_samples_factor * 4;
if (pixel_bits == 16) {
fb_format = GL_RGB;
fb_type = GL_UNSIGNED_SHORT_5_6_5;
- }
- else {
+ } else {
fb_format = GL_BGRA;
fb_type = GL_UNSIGNED_INT_8_8_8_8_REV;
}
configs = driCreateConfigs(fb_format, fb_type,
depth_bits_array,
- stencil_bits_array, depth_buffer_factor,
- back_buffer_modes, back_buffer_factor,
- msaa_samples_array, msaa_samples_factor);
+ stencil_bits_array, depth_buffer_factor,
+ back_buffer_modes, back_buffer_factor,
+ msaa_samples_array, msaa_samples_factor);
if (configs == NULL) {
debug_printf("%s: driCreateConfigs failed\n", __FUNCTION__);
return NULL;
@@ -131,24 +129,20 @@ dri_fill_in_modes(__DRIscreenPrivate *psp,
for (i = 0; configs[i]; i++) {
m = &configs[i]->modes;
if ((m->stencilBits != 0) && (m->stencilBits != stencil_bits)) {
- m->visualRating = GLX_SLOW_CONFIG;
+ m->visualRating = GLX_SLOW_CONFIG;
}
}
- return (const const __DRIconfig **) configs;
+ return (const const __DRIconfig **)configs;
}
-
/**
* Get information about previous buffer swaps.
*/
static int
-dri_get_swap_info(__DRIdrawablePrivate * dPriv,
- __DRIswapInfo * sInfo)
+dri_get_swap_info(__DRIdrawablePrivate * dPriv, __DRIswapInfo * sInfo)
{
- if (dPriv == NULL ||
- dPriv->driverPrivate == NULL ||
- sInfo == NULL)
+ if (dPriv == NULL || dPriv->driverPrivate == NULL || sInfo == NULL)
return -1;
else
return 0;
@@ -164,37 +158,36 @@ dri_copy_version(struct dri1_api_version *dst,
}
static const __DRIconfig **
-dri_init_screen(__DRIscreenPrivate *sPriv)
+dri_init_screen(__DRIscreenPrivate * sPriv)
{
- struct dri_screen *screen;
- const __DRIconfig **configs;
- struct dri1_create_screen_arg arg;
+ struct dri_screen *screen;
+ const __DRIconfig **configs;
+ struct dri1_create_screen_arg arg;
- dri_init_extensions(NULL);
+ dri_init_extensions(NULL);
- screen = CALLOC_STRUCT(dri_screen);
- if (!screen)
- return NULL;
+ screen = CALLOC_STRUCT(dri_screen);
+ if (!screen)
+ return NULL;
- screen->sPriv = sPriv;
- screen->fd = sPriv->fd;
- screen->drmLock = (drmLock *) &sPriv->pSAREA->lock;
+ screen->sPriv = sPriv;
+ screen->fd = sPriv->fd;
+ screen->drmLock = (drmLock *) & sPriv->pSAREA->lock;
- sPriv->private = (void *) screen;
- sPriv->extensions = dri_screen_extensions;
+ sPriv->private = (void *)screen;
+ sPriv->extensions = dri_screen_extensions;
- arg.base.mode = DRM_CREATE_DRI1;
- arg.lf = &dri1_lf;
- arg.ddx_info = sPriv->pDevPriv;
- arg.ddx_info_size = sPriv->devPrivSize;
- arg.sarea = sPriv->pSAREA;
- dri_copy_version(&arg.ddx_version, &sPriv->ddx_version);
- dri_copy_version(&arg.dri_version, &sPriv->dri_version);
- dri_copy_version(&arg.drm_version, &sPriv->drm_version);
- arg.api = NULL;
+ arg.base.mode = DRM_CREATE_DRI1;
+ arg.lf = &dri1_lf;
+ arg.ddx_info = sPriv->pDevPriv;
+ arg.ddx_info_size = sPriv->devPrivSize;
+ arg.sarea = sPriv->pSAREA;
+ dri_copy_version(&arg.ddx_version, &sPriv->ddx_version);
+ dri_copy_version(&arg.dri_version, &sPriv->dri_version);
+ dri_copy_version(&arg.drm_version, &sPriv->drm_version);
+ arg.api = NULL;
- screen->pipe_screen = drm_api_hooks.create_screen
- (screen->fd, &arg.base);
+ screen->pipe_screen = drm_api_hooks.create_screen(screen->fd, &arg.base);
if (!screen->pipe_screen || !arg.api) {
debug_printf("%s: failed to create dri1 screen\n", __FUNCTION__);
@@ -205,8 +198,7 @@ dri_init_screen(__DRIscreenPrivate *sPriv)
screen->pipe_screen->flush_frontbuffer = dri1_flush_frontbuffer;
driParseOptionInfo(&screen->optionCache,
- __driConfigOptions,
- __driNConfigOptions);
+ __driConfigOptions, __driNConfigOptions);
configs = dri_fill_in_modes(sPriv, sPriv->fbBPP, 24, 8, 1);
if (!configs)
@@ -220,14 +212,13 @@ dri_init_screen(__DRIscreenPrivate *sPriv)
return NULL;
}
-
/**
* This is the driver specific part of the createNewScreen entry point.
*
* Returns the __GLcontextModes supported by this driver.
*/
static const __DRIconfig **
-dri_init_screen2(__DRIscreenPrivate *sPriv)
+dri_init_screen2(__DRIscreenPrivate * sPriv)
{
struct dri_screen *screen;
struct drm_create_screen_arg arg;
@@ -241,7 +232,7 @@ dri_init_screen2(__DRIscreenPrivate *sPriv)
screen->sPriv = sPriv;
screen->fd = sPriv->fd;
- sPriv->private = (void *) screen;
+ sPriv->private = (void *)screen;
sPriv->extensions = dri_screen_extensions;
arg.mode = DRM_CREATE_NORMAL;
@@ -255,19 +246,13 @@ dri_init_screen2(__DRIscreenPrivate *sPriv)
screen->pipe_screen->flush_frontbuffer = dri_flush_frontbuffer;
driParseOptionInfo(&screen->optionCache,
- __driConfigOptions,
- __driNConfigOptions);
-
- return dri_fill_in_modes(sPriv,
- 4 * 8,
- 24,
- 8,
- 1);
-fail:
+ __driConfigOptions, __driNConfigOptions);
+
+ return dri_fill_in_modes(sPriv, 4 * 8, 24, 8, 1);
+ fail:
return NULL;
}
-
static void
dri_destroy_screen(__DRIscreenPrivate * sPriv)
{
@@ -278,23 +263,22 @@ dri_destroy_screen(__DRIscreenPrivate * sPriv)
sPriv->private = NULL;
}
-
PUBLIC const struct __DriverAPIRec driDriverAPI = {
- .InitScreen = dri_init_screen,
- .DestroyScreen = dri_destroy_screen,
- .CreateContext = dri_create_context,
- .DestroyContext = dri_destroy_context,
- .CreateBuffer = dri_create_buffer,
- .DestroyBuffer = dri_destroy_buffer,
- .SwapBuffers = dri_swap_buffers,
- .MakeCurrent = dri_make_current,
- .UnbindContext = dri_unbind_context,
- .GetSwapInfo = dri_get_swap_info,
- .GetDrawableMSC = driDrawableGetMSC32,
- .WaitForMSC = driWaitForMSC32,
- .CopySubBuffer = dri_copy_sub_buffer,
- .InitScreen = dri_init_screen,
- .InitScreen2 = dri_init_screen2,
+ .InitScreen = dri_init_screen,
+ .DestroyScreen = dri_destroy_screen,
+ .CreateContext = dri_create_context,
+ .DestroyContext = dri_destroy_context,
+ .CreateBuffer = dri_create_buffer,
+ .DestroyBuffer = dri_destroy_buffer,
+ .SwapBuffers = dri_swap_buffers,
+ .MakeCurrent = dri_make_current,
+ .UnbindContext = dri_unbind_context,
+ .GetSwapInfo = dri_get_swap_info,
+ .GetDrawableMSC = driDrawableGetMSC32,
+ .WaitForMSC = driWaitForMSC32,
+ .CopySubBuffer = dri_copy_sub_buffer,
+ .InitScreen = dri_init_screen,
+ .InitScreen2 = dri_init_screen2,
};
/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/state_trackers/dri/dri_screen.h b/src/gallium/state_trackers/dri/dri_screen.h
index c358c35168..100d9e50e0 100644
--- a/src/gallium/state_trackers/dri/dri_screen.h
+++ b/src/gallium/state_trackers/dri/dri_screen.h
@@ -64,15 +64,13 @@ struct dri_screen
struct pipe_screen *pipe_screen;
};
-
/** cast wrapper */
static INLINE struct dri_screen *
-dri_screen(__DRIscreenPrivate *sPriv)
+dri_screen(__DRIscreenPrivate * sPriv)
{
- return (struct dri_screen *) sPriv->private;
+ return (struct dri_screen *)sPriv->private;
}
-
/***********************************************************************
* dri_screen.c
*/
--
cgit v1.2.3
From 05af5a7f593ac6451cff9e6923d4a969d5358bcb Mon Sep 17 00:00:00 2001
From: Thomas Hellstrom
Date: Tue, 28 Apr 2009 11:58:27 +0200
Subject: gallium: Rename the dri state tracker lib to libdridrm.a
---
src/gallium/state_trackers/dri/Makefile | 2 +-
src/gallium/winsys/drm/intel/dri2/Makefile | 2 +-
src/gallium/winsys/drm/nouveau/dri2/Makefile | 2 +-
src/gallium/winsys/drm/radeon/dri2/Makefile | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/gallium/state_trackers/dri/Makefile b/src/gallium/state_trackers/dri/Makefile
index 47750e997e..ef8f19709a 100644
--- a/src/gallium/state_trackers/dri/Makefile
+++ b/src/gallium/state_trackers/dri/Makefile
@@ -1,7 +1,7 @@
TOP = ../../../..
include $(TOP)/configs/current
-LIBNAME = dri2drm
+LIBNAME = dridrm
LIBRARY_INCLUDES = \
-I$(TOP)/include \
diff --git a/src/gallium/winsys/drm/intel/dri2/Makefile b/src/gallium/winsys/drm/intel/dri2/Makefile
index 286ef08d5b..125e79e0ed 100644
--- a/src/gallium/winsys/drm/intel/dri2/Makefile
+++ b/src/gallium/winsys/drm/intel/dri2/Makefile
@@ -4,7 +4,7 @@ include $(TOP)/configs/current
LIBNAME = i915_dri.so
PIPE_DRIVERS = \
- $(TOP)/src/gallium/state_trackers/dri/libdri2drm.a \
+ $(TOP)/src/gallium/state_trackers/dri/libdridrm.a \
$(TOP)/src/gallium/winsys/drm/intel/gem/libinteldrm.a \
$(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
$(TOP)/src/gallium/drivers/i915simple/libi915simple.a
diff --git a/src/gallium/winsys/drm/nouveau/dri2/Makefile b/src/gallium/winsys/drm/nouveau/dri2/Makefile
index 5e5efbcb11..377a80d518 100644
--- a/src/gallium/winsys/drm/nouveau/dri2/Makefile
+++ b/src/gallium/winsys/drm/nouveau/dri2/Makefile
@@ -4,7 +4,7 @@ include $(TOP)/configs/current
LIBNAME = nouveau_dri2.so
PIPE_DRIVERS = \
- $(TOP)/src/gallium/state_trackers/dri/libdri2drm.a \
+ $(TOP)/src/gallium/state_trackers/dri/libdridrm.a \
$(TOP)/src/gallium/winsys/drm/nouveau/drm/libnouveaudrm.a \
$(TOP)/src/gallium/drivers/nv04/libnv04.a \
$(TOP)/src/gallium/drivers/nv10/libnv10.a \
diff --git a/src/gallium/winsys/drm/radeon/dri2/Makefile b/src/gallium/winsys/drm/radeon/dri2/Makefile
index 58a87dae18..c218ee9d01 100644
--- a/src/gallium/winsys/drm/radeon/dri2/Makefile
+++ b/src/gallium/winsys/drm/radeon/dri2/Makefile
@@ -7,7 +7,7 @@ LIBNAME = radeon_dri.so
MINIGLX_SOURCES =
PIPE_DRIVERS = \
- $(TOP)/src/gallium/state_trackers/dri/libdri2drm.a \
+ $(TOP)/src/gallium/state_trackers/dri/libdridrm.a \
$(TOP)/src/gallium/winsys/drm/radeon/core/libradeonwinsys.a \
$(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
$(TOP)/src/gallium/drivers/r300/libr300.a
--
cgit v1.2.3
From 1ae877d95adbc19cb0a8d4fe07f46ac4d46c8147 Mon Sep 17 00:00:00 2001
From: Corbin Simpson
Date: Tue, 28 Apr 2009 03:28:37 -0700
Subject: radeon: Use PCI_MATCH_ANY for xorg driver.
Might as well.
---
src/gallium/winsys/drm/radeon/xorg/radeon_xorg.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/src/gallium/winsys/drm/radeon/xorg/radeon_xorg.c b/src/gallium/winsys/drm/radeon/xorg/radeon_xorg.c
index 6f77fbe5de..36824251f0 100644
--- a/src/gallium/winsys/drm/radeon/xorg/radeon_xorg.c
+++ b/src/gallium/winsys/drm/radeon/xorg/radeon_xorg.c
@@ -38,20 +38,17 @@ static Bool radeon_xorg_pci_probe(DriverPtr driver,
intptr_t match_data);
static const struct pci_id_match radeon_xorg_device_match[] = {
- {0x1002, 0x5E4D, 0xffff, 0xffff, 0, 0, 0},
- {0x1002, 0x7249, 0xffff, 0xffff, 0, 0, 0},
+ {0x1002, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, 0, 0, 0},
{0, 0, 0},
};
static SymTabRec radeon_xorg_chipsets[] = {
- {0x5E4D, "Radeon RV410 PCIE (X700)"},
- {0x7249, "Radeon R580 PCIE (X1900 XT)"},
+ {PCI_MATCH_ANY, "ATI/AMD Radeon Graphics Chipset"},
{-1, NULL}
};
static PciChipsets radeon_xorg_pci_devices[] = {
- {0x5E4D, 0x5E4D, RES_SHARED_VGA},
- {0x7249, 0x7249, RES_SHARED_VGA},
+ {PCI_MATCH_ANY, PCI_MATCH_ANY, RES_SHARED_VGA},
{-1, -1, RES_UNDEFINED}
};
--
cgit v1.2.3
From 81ded8092a4068ec289e6c7207078f076bfee5fd Mon Sep 17 00:00:00 2001
From: Corbin Simpson
Date: Tue, 28 Apr 2009 03:28:57 -0700
Subject: radeon-r300: Fix a bit of breakage.
Not really sure why reordering the ioctls makes them work again.
---
src/gallium/winsys/drm/radeon/core/radeon_r300.c | 19 +++++++++---------
src/gallium/winsys/drm/radeon/dri/Makefile | 25 ++++++++++++++++++++++++
src/gallium/winsys/drm/radeon/dri/SConscript | 14 +++++++++++++
src/gallium/winsys/drm/radeon/dri2/Makefile | 25 ------------------------
src/gallium/winsys/drm/radeon/dri2/SConscript | 14 -------------
5 files changed, 48 insertions(+), 49 deletions(-)
create mode 100644 src/gallium/winsys/drm/radeon/dri/Makefile
create mode 100644 src/gallium/winsys/drm/radeon/dri/SConscript
delete mode 100644 src/gallium/winsys/drm/radeon/dri2/Makefile
delete mode 100644 src/gallium/winsys/drm/radeon/dri2/SConscript
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c
index 293b6c2d38..3302d623bf 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c
+++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c
@@ -53,32 +53,31 @@ static void radeon_r300_flush_cs(struct radeon_cs* cs)
static void do_ioctls(struct r300_winsys* winsys, int fd)
{
drm_radeon_getparam_t gp;
- uint32_t target;
+ int target;
int retval;
/* XXX is this cast safe? */
gp.value = (int*)⌖
- /* First, get PCI ID */
- gp.param = RADEON_PARAM_DEVICE_ID;
+ /* First, get the number of pixel pipes */
+ gp.param = RADEON_PARAM_NUM_GB_PIPES;
retval = drmCommandWriteRead(fd, DRM_RADEON_GETPARAM, &gp, sizeof(gp));
if (retval) {
- fprintf(stderr, "%s: Failed to get PCI ID, error number %d",
+ fprintf(stderr, "%s: Failed to get GB pipe count, error number %d\n",
__FUNCTION__, retval);
exit(1);
}
- winsys->pci_id = target;
+ winsys->gb_pipes = target;
- /* Then, get the number of pixel pipes */
- gp.param = RADEON_PARAM_NUM_GB_PIPES;
+ /* Then, get PCI ID */
+ gp.param = RADEON_PARAM_DEVICE_ID;
retval = drmCommandWriteRead(fd, DRM_RADEON_GETPARAM, &gp, sizeof(gp));
if (retval) {
- fprintf(stderr, "%s: Failed to get GB pipe count, error number %d",
+ fprintf(stderr, "%s: Failed to get PCI ID, error number %d\n",
__FUNCTION__, retval);
exit(1);
}
- winsys->gb_pipes = target;
-
+ winsys->pci_id = target;
}
struct r300_winsys*
diff --git a/src/gallium/winsys/drm/radeon/dri/Makefile b/src/gallium/winsys/drm/radeon/dri/Makefile
new file mode 100644
index 0000000000..c218ee9d01
--- /dev/null
+++ b/src/gallium/winsys/drm/radeon/dri/Makefile
@@ -0,0 +1,25 @@
+
+TOP = ../../../../../..
+include $(TOP)/configs/current
+
+LIBNAME = radeon_dri.so
+
+MINIGLX_SOURCES =
+
+PIPE_DRIVERS = \
+ $(TOP)/src/gallium/state_trackers/dri/libdridrm.a \
+ $(TOP)/src/gallium/winsys/drm/radeon/core/libradeonwinsys.a \
+ $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
+ $(TOP)/src/gallium/drivers/r300/libr300.a
+
+C_SOURCES = \
+ $(COMMON_GALLIUM_SOURCES) \
+ $(DRIVER_SOURCES)
+
+ASM_SOURCES =
+
+include ../../Makefile.template
+
+DRI_LIB_DEPS += -ldrm_radeon
+
+symlinks:
diff --git a/src/gallium/winsys/drm/radeon/dri/SConscript b/src/gallium/winsys/drm/radeon/dri/SConscript
new file mode 100644
index 0000000000..f2cdee97d9
--- /dev/null
+++ b/src/gallium/winsys/drm/radeon/dri/SConscript
@@ -0,0 +1,14 @@
+Import('*')
+
+env = drienv.Clone()
+
+drivers = [
+ softpipe,
+ r300
+]
+
+env.SharedLibrary(
+ target ='radeon_dri.so',
+ source = COMMON_GALLIUM_SOURCES,
+ LIBS = drivers + mesa + auxiliaries + env['LIBS'],
+)
diff --git a/src/gallium/winsys/drm/radeon/dri2/Makefile b/src/gallium/winsys/drm/radeon/dri2/Makefile
deleted file mode 100644
index c218ee9d01..0000000000
--- a/src/gallium/winsys/drm/radeon/dri2/Makefile
+++ /dev/null
@@ -1,25 +0,0 @@
-
-TOP = ../../../../../..
-include $(TOP)/configs/current
-
-LIBNAME = radeon_dri.so
-
-MINIGLX_SOURCES =
-
-PIPE_DRIVERS = \
- $(TOP)/src/gallium/state_trackers/dri/libdridrm.a \
- $(TOP)/src/gallium/winsys/drm/radeon/core/libradeonwinsys.a \
- $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
- $(TOP)/src/gallium/drivers/r300/libr300.a
-
-C_SOURCES = \
- $(COMMON_GALLIUM_SOURCES) \
- $(DRIVER_SOURCES)
-
-ASM_SOURCES =
-
-include ../../Makefile.template
-
-DRI_LIB_DEPS += -ldrm_radeon
-
-symlinks:
diff --git a/src/gallium/winsys/drm/radeon/dri2/SConscript b/src/gallium/winsys/drm/radeon/dri2/SConscript
deleted file mode 100644
index f2cdee97d9..0000000000
--- a/src/gallium/winsys/drm/radeon/dri2/SConscript
+++ /dev/null
@@ -1,14 +0,0 @@
-Import('*')
-
-env = drienv.Clone()
-
-drivers = [
- softpipe,
- r300
-]
-
-env.SharedLibrary(
- target ='radeon_dri.so',
- source = COMMON_GALLIUM_SOURCES,
- LIBS = drivers + mesa + auxiliaries + env['LIBS'],
-)
--
cgit v1.2.3
From 171c7f91cd3dcb41bf7abb333d725b3b3a3e9b1a Mon Sep 17 00:00:00 2001
From: Thomas Hellstrom
Date: Tue, 28 Apr 2009 13:03:22 +0200
Subject: gallium dri st: Fix up some comments and minor bugs.
Signed-off-by: Thomas Hellstrom
---
src/gallium/state_trackers/dri/dri_context.c | 2 +-
src/gallium/state_trackers/dri/dri_drawable.c | 17 ++++++++++-------
2 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/src/gallium/state_trackers/dri/dri_context.c b/src/gallium/state_trackers/dri/dri_context.c
index 7f38671126..8e6299c540 100644
--- a/src/gallium/state_trackers/dri/dri_context.c
+++ b/src/gallium/state_trackers/dri/dri_context.c
@@ -128,7 +128,7 @@ dri_unbind_context(__DRIcontextPrivate * cPriv)
if (--ctx->bind_count == 0) {
GET_CURRENT_CONTEXT(curGLCtx);
- if (ctx->st == curGLCtx->st) {
+ if (curGLCtx && ctx->st == curGLCtx->st) {
st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
st_make_current(NULL, NULL, NULL);
}
diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c
index abda4ff17e..fd4bae5aea 100644
--- a/src/gallium/state_trackers/dri/dri_drawable.c
+++ b/src/gallium/state_trackers/dri/dri_drawable.c
@@ -351,10 +351,10 @@ dri1_update_drawables_locked(struct dri_context *ctx,
}
/**
- * This ensures all contexts which binds to a drawable picks up the
- * drawable change and signals new buffer state.
+ * This ensures all contexts which bind to a drawable pick up the
+ * drawable change and signal new buffer state.
* Calling st_resize_framebuffer for each context may seem like overkill,
- * but no new buffers will actually be allocated if the dimensions doesn't
+ * but no new buffers will actually be allocated if the dimensions don't
* change.
*/
@@ -419,10 +419,10 @@ dri1_intersect_src_bbox(struct drm_clip_rect *dst,
dst->x1 = xy1;
dst->x2 = xy2;
- xy1 = ((int)src->y1 > (int)bbox->y1 + dst_x) ? src->y1 :
- (int)bbox->y1 + dst_x;
- xy2 = ((int)src->y2 < (int)bbox->y2 + dst_x) ? src->y2 :
- (int)bbox->y2 + dst_x;
+ xy1 = ((int)src->y1 > (int)bbox->y1 + dst_y) ? src->y1 :
+ (int)bbox->y1 + dst_y;
+ xy2 = ((int)src->y2 < (int)bbox->y2 + dst_y) ? src->y2 :
+ (int)bbox->y2 + dst_y;
if (xy1 >= xy2 || xy1 < 0)
return FALSE;
@@ -522,6 +522,7 @@ dri1_flush_frontbuffer(struct pipe_screen *screen,
struct pipe_fence_handle *dummy_fence;
dri1_copy_to_front(ctx, surf, ctx->dPriv, NULL, &dummy_fence);
+ screen->fence_reference(screen, &dummy_fence, NULL);
/**
* FIXME: Do we need swap throttling here?
@@ -564,6 +565,7 @@ dri_swap_buffers(__DRIdrawablePrivate * dPriv)
void
dri_copy_sub_buffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h)
{
+ struct pipe_screen *screen = dri_screen(dPriv->driScreenPriv)->pipe_screen;
struct drm_clip_rect sub_bbox;
struct dri_context *ctx;
struct pipe_surface *back_surf;
@@ -588,6 +590,7 @@ dri_copy_sub_buffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h)
if (back_surf) {
st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
dri1_copy_to_front(ctx, back_surf, dPriv, &sub_bbox, &dummy_fence);
+ screen->fence_reference(screen, &dummy_fence, NULL);
}
}
--
cgit v1.2.3
From c9b336bc936a733b1273170fc5e2ecc4980116b2 Mon Sep 17 00:00:00 2001
From: Jakob Bornecrantz
Date: Tue, 28 Apr 2009 01:00:51 +0200
Subject: gallium-intel: Fix build of dri driver
---
src/gallium/winsys/drm/intel/dri/Makefile | 23 +++++++++++++++++++++++
src/gallium/winsys/drm/intel/dri2/Makefile | 23 -----------------------
2 files changed, 23 insertions(+), 23 deletions(-)
create mode 100644 src/gallium/winsys/drm/intel/dri/Makefile
delete mode 100644 src/gallium/winsys/drm/intel/dri2/Makefile
diff --git a/src/gallium/winsys/drm/intel/dri/Makefile b/src/gallium/winsys/drm/intel/dri/Makefile
new file mode 100644
index 0000000000..125e79e0ed
--- /dev/null
+++ b/src/gallium/winsys/drm/intel/dri/Makefile
@@ -0,0 +1,23 @@
+TOP = ../../../../../..
+include $(TOP)/configs/current
+
+LIBNAME = i915_dri.so
+
+PIPE_DRIVERS = \
+ $(TOP)/src/gallium/state_trackers/dri/libdridrm.a \
+ $(TOP)/src/gallium/winsys/drm/intel/gem/libinteldrm.a \
+ $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
+ $(TOP)/src/gallium/drivers/i915simple/libi915simple.a
+
+
+DRIVER_SOURCES =
+
+C_SOURCES = \
+ $(COMMON_GALLIUM_SOURCES) \
+ $(DRIVER_SOURCES)
+
+include ../../Makefile.template
+
+DRI_LIB_DEPS += -ldrm_intel
+
+symlinks:
diff --git a/src/gallium/winsys/drm/intel/dri2/Makefile b/src/gallium/winsys/drm/intel/dri2/Makefile
deleted file mode 100644
index 125e79e0ed..0000000000
--- a/src/gallium/winsys/drm/intel/dri2/Makefile
+++ /dev/null
@@ -1,23 +0,0 @@
-TOP = ../../../../../..
-include $(TOP)/configs/current
-
-LIBNAME = i915_dri.so
-
-PIPE_DRIVERS = \
- $(TOP)/src/gallium/state_trackers/dri/libdridrm.a \
- $(TOP)/src/gallium/winsys/drm/intel/gem/libinteldrm.a \
- $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
- $(TOP)/src/gallium/drivers/i915simple/libi915simple.a
-
-
-DRIVER_SOURCES =
-
-C_SOURCES = \
- $(COMMON_GALLIUM_SOURCES) \
- $(DRIVER_SOURCES)
-
-include ../../Makefile.template
-
-DRI_LIB_DEPS += -ldrm_intel
-
-symlinks:
--
cgit v1.2.3
From aef3bccbdaf20f7e0e1fdab0084f60556a12d55d Mon Sep 17 00:00:00 2001
From: Jakob Bornecrantz
Date: Tue, 28 Apr 2009 12:56:21 +0100
Subject: gallium-intel: Create a i965_dri.so symlink
This is only used for debuging the gem backend on i965
chipset using the softpipe pipe driver.
Usage: "export INTEL_SOFTPIPE=y" and point LIBGL_DRIVERS_PATH
to "$MESA/lib/gallium" where $MESA is the mesa root.
---
src/gallium/winsys/drm/intel/dri/Makefile | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/gallium/winsys/drm/intel/dri/Makefile b/src/gallium/winsys/drm/intel/dri/Makefile
index 125e79e0ed..a4704bc050 100644
--- a/src/gallium/winsys/drm/intel/dri/Makefile
+++ b/src/gallium/winsys/drm/intel/dri/Makefile
@@ -20,4 +20,6 @@ include ../../Makefile.template
DRI_LIB_DEPS += -ldrm_intel
-symlinks:
+symlinks: $(TOP)/$(LIB_DIR)/gallium
+ @rm -f $(TOP)/lib/gallium/i965_dri.so
+ ln -s i915_dri.so $(TOP)/lib/gallium/i965_dri.so
--
cgit v1.2.3
From 3d2bba0d10d59a9c2d6d09c5dc3fabe148d5e0d7 Mon Sep 17 00:00:00 2001
From: Thomas Hellstrom
Date: Tue, 28 Apr 2009 14:12:39 +0200
Subject: st: Add an st_get_current() function.
Signed-off-by: Thomas Hellstrom
---
src/mesa/state_tracker/st_context.c | 6 ++++++
src/mesa/state_tracker/st_public.h | 2 ++
2 files changed, 8 insertions(+)
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index b27274725f..92a630eff9 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -279,6 +279,12 @@ void st_make_current(struct st_context *st,
}
}
+struct st_context *st_get_current(void)
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ return (ctx == NULL) ? NULL : ctx->st;
+}
void st_copy_context_state(struct st_context *dst,
struct st_context *src,
diff --git a/src/mesa/state_tracker/st_public.h b/src/mesa/state_tracker/st_public.h
index 030314372f..290b8a974e 100644
--- a/src/mesa/state_tracker/st_public.h
+++ b/src/mesa/state_tracker/st_public.h
@@ -95,6 +95,8 @@ void st_make_current(struct st_context *st,
struct st_framebuffer *draw,
struct st_framebuffer *read);
+struct st_context *st_get_current(void);
+
void st_flush( struct st_context *st, uint pipeFlushFlags,
struct pipe_fence_handle **fence );
void st_finish( struct st_context *st );
--
cgit v1.2.3
From 8cfa6546c9aa25edad3e7bc3cf6f1a9399052b79 Mon Sep 17 00:00:00 2001
From: Thomas Hellstrom
Date: Tue, 28 Apr 2009 14:20:45 +0200
Subject: gallium dri st: Use st_get_current() instead of GET_CURRENT_CONTEXT()
Signed-off-by: Thomas Hellstrom
---
src/gallium/state_trackers/dri/dri_context.c | 11 ++++-------
src/gallium/state_trackers/dri/dri_drawable.c | 14 ++++++--------
2 files changed, 10 insertions(+), 15 deletions(-)
diff --git a/src/gallium/state_trackers/dri/dri_context.c b/src/gallium/state_trackers/dri/dri_context.c
index 8e6299c540..54d2a56356 100644
--- a/src/gallium/state_trackers/dri/dri_context.c
+++ b/src/gallium/state_trackers/dri/dri_context.c
@@ -126,9 +126,7 @@ dri_unbind_context(__DRIcontextPrivate * cPriv)
struct dri_context *ctx = dri_context(cPriv);
if (--ctx->bind_count == 0) {
- GET_CURRENT_CONTEXT(curGLCtx);
-
- if (curGLCtx && ctx->st == curGLCtx->st) {
+ if (ctx->st && ctx->st == st_get_current()) {
st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
st_make_current(NULL, NULL, NULL);
}
@@ -148,11 +146,10 @@ dri_make_current(__DRIcontextPrivate * cPriv,
struct dri_screen *screen = dri_screen(cPriv->driScreenPriv);
struct dri_drawable *draw = dri_drawable(driDrawPriv);
struct dri_drawable *read = dri_drawable(driReadPriv);
+ struct st_context *old_st = st_get_current();
- GET_CURRENT_CONTEXT(oldGLCtx);
-
- if (oldGLCtx && oldGLCtx->st != ctx->st)
- st_flush(oldGLCtx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
+ if (old_st && old_st != ctx->st)
+ st_flush(old_st, PIPE_FLUSH_RENDER_CACHE, NULL);
++ctx->bind_count;
diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c
index fd4bae5aea..15a2088df5 100644
--- a/src/gallium/state_trackers/dri/dri_drawable.c
+++ b/src/gallium/state_trackers/dri/dri_drawable.c
@@ -537,15 +537,14 @@ dri_swap_buffers(__DRIdrawablePrivate * dPriv)
struct dri_drawable *draw = dri_drawable(dPriv);
struct pipe_screen *screen = dri_screen(draw->sPriv)->pipe_screen;
struct pipe_fence_handle *fence;
-
- GET_CURRENT_CONTEXT(glCtx);
+ struct st_context *st = st_get_current();
assert(__dri1_api_hooks != NULL);
- if (!glCtx)
+ if (!st)
return; /* For now */
- ctx = (struct dri_context *)glCtx->st->pipe->priv;
+ ctx = (struct dri_context *)st->pipe->priv;
st_get_framebuffer_surface(draw->stfb, ST_SURFACE_BACK_LEFT, &back_surf);
if (back_surf) {
@@ -571,15 +570,14 @@ dri_copy_sub_buffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h)
struct pipe_surface *back_surf;
struct dri_drawable *draw = dri_drawable(dPriv);
struct pipe_fence_handle *dummy_fence;
-
- GET_CURRENT_CONTEXT(glCtx);
+ struct st_context *st = st_get_current();
assert(__dri1_api_hooks != NULL);
- if (!glCtx)
+ if (!st)
return;
- ctx = (struct dri_context *)glCtx->st->pipe->priv;
+ ctx = (struct dri_context *)st->pipe->priv;
sub_bbox.x1 = x;
sub_bbox.x2 = x + w;
--
cgit v1.2.3
From 2c994ad3cb91288966bdc028b0afa9935a51a971 Mon Sep 17 00:00:00 2001
From: Thomas Hellstrom
Date: Tue, 28 Apr 2009 14:43:41 +0200
Subject: gallium dri st: Propagate the drawable info when we bind to new
drawables.
Signed-off-by: Thomas Hellstrom
---
src/gallium/state_trackers/dri/dri_context.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/gallium/state_trackers/dri/dri_context.c b/src/gallium/state_trackers/dri/dri_context.c
index 54d2a56356..45eaec4ed3 100644
--- a/src/gallium/state_trackers/dri/dri_context.c
+++ b/src/gallium/state_trackers/dri/dri_context.c
@@ -158,9 +158,14 @@ dri_make_current(__DRIcontextPrivate * cPriv,
*/
screen->dummyContext = ctx;
- /* used in dri_flush_frontbuffer */
- ctx->dPriv = driDrawPriv;
- ctx->rPriv = driReadPriv;
+ if (ctx->dPriv != driDrawPriv) {
+ ctx->dPriv = driDrawPriv;
+ ctx->d_stamp = driDrawPriv->lastStamp - 1;
+ }
+ if (ctx->rPriv != driReadPriv) {
+ ctx->rPriv = driReadPriv;
+ ctx->r_stamp = driReadPriv->lastStamp - 1;
+ }
st_make_current(ctx->st, draw->stfb, read->stfb);
--
cgit v1.2.3
From e0d5ff1a8a2237808d88f087f029224beee015af Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Mon, 27 Apr 2009 17:01:59 -0600
Subject: demos: asst. updates, clean-ups
---
progs/tests/floattex.c | 43 ++++++++++++++++++++-----------------------
1 file changed, 20 insertions(+), 23 deletions(-)
diff --git a/progs/tests/floattex.c b/progs/tests/floattex.c
index dd99d836c6..ad14cacdcb 100644
--- a/progs/tests/floattex.c
+++ b/progs/tests/floattex.c
@@ -1,6 +1,5 @@
/*
* Test floating point textures.
- * No actual rendering, yet.
*/
@@ -103,7 +102,6 @@ Key(unsigned char key, int x, int y)
}
-
static void
InitTexture(void)
{
@@ -141,6 +139,8 @@ InitTexture(void)
GL_RGB, GL_FLOAT, ftex);
+ CheckError(__LINE__);
+
/* sanity checks */
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_RED_TYPE_ARB, &t);
assert(t == GL_FLOAT);
@@ -152,32 +152,26 @@ InitTexture(void)
assert(t == GL_FLOAT);
free(image);
- free(ftex);
-
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter);
-#if 0
- /* read back the texture and make sure values are correct */
- glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_FLOAT, tex2);
- CheckError(__LINE__);
- for (i = 0; i < 16; i++) {
- for (j = 0; j < 16; j++) {
- if (tex[i][j][0] != tex2[i][j][0] ||
- tex[i][j][1] != tex2[i][j][1] ||
- tex[i][j][2] != tex2[i][j][2] ||
- tex[i][j][3] != tex2[i][j][3]) {
- printf("tex[%d][%d] %g %g %g %g != tex2[%d][%d] %g %g %g %g\n",
- i, j,
- tex[i][j][0], tex[i][j][1], tex[i][j][2], tex[i][j][3],
- i, j,
- tex2[i][j][0], tex2[i][j][1], tex2[i][j][2], tex2[i][j][3]);
+ if (1) {
+ /* read back the texture and make sure values are correct */
+ GLfloat *tex2 = (GLfloat *)
+ malloc(imgWidth * imgHeight * 4 * sizeof(GLfloat));
+ glGetTexImage(GL_TEXTURE_2D, 0, imgFormat, GL_FLOAT, tex2);
+ CheckError(__LINE__);
+ for (i = 0; i < imgWidth * imgHeight * 4; i++) {
+ if (ftex[i] != tex2[i]) {
+ printf("tex[%d] %g != tex2[%d] %g\n",
+ i, ftex[i], i, tex2[i]);
}
}
}
-#endif
+
+ free(ftex);
}
@@ -193,7 +187,9 @@ CreateProgram(void)
assert(program);
- // InitUniforms(program, Uniforms);
+ glUseProgram_func(program);
+
+ InitUniforms(program, Uniforms);
return program;
}
@@ -211,8 +207,9 @@ Init(void)
exit(1);
}
- if (!glutExtensionSupported("GL_MESAX_texture_float")) {
- printf("Sorry, this test requires GL_MESAX_texture_float\n");
+ if (!glutExtensionSupported("GL_MESAX_texture_float") &&
+ !glutExtensionSupported("GL_ARB_texture_float")) {
+ printf("Sorry, this test requires GL_MESAX/ARB_texture_float\n");
exit(1);
}
--
cgit v1.2.3
From dcf571aff9de1a4298c4d2c4148d84cdc4daf02e Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Tue, 28 Apr 2009 09:05:19 -0600
Subject: swrast: add missing break in clamp_rect_coord_linear()
See bug 21461.
---
src/mesa/swrast/s_texfilter.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c
index a483023a50..31bfb5c952 100644
--- a/src/mesa/swrast/s_texfilter.c
+++ b/src/mesa/swrast/s_texfilter.c
@@ -462,6 +462,7 @@ clamp_rect_coord_linear(GLenum wrapMode, GLfloat coord, GLint max,
fcol -= 0.5F;
i0 = IFLOOR(fcol);
i1 = i0 + 1;
+ break;
default:
_mesa_problem(NULL, "bad wrapMode in clamp_rect_coord_linear");
i0 = i1 = 0;
--
cgit v1.2.3
From 43d9020ff1e975e7f4f9480d9ef24f0b9fb2141f Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Tue, 28 Apr 2009 09:58:44 -0600
Subject: i965: avoid segfault in intel_update_renderbuffers() if using DRI1
---
src/mesa/drivers/dri/intel/intel_context.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
index eb224a8a41..a6d8729d8f 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -198,7 +198,7 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable)
struct intel_renderbuffer *rb;
struct intel_region *region, *depth_region;
struct intel_context *intel = context->driverPrivate;
- __DRIbuffer *buffers;
+ __DRIbuffer *buffers = NULL;
__DRIscreen *screen;
int i, count;
unsigned int attachments[10];
@@ -210,7 +210,8 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable)
screen = intel->intelScreen->driScrnPriv;
- if ((screen->dri2.loader->base.version > 2)
+ if (screen->dri2.loader
+ && (screen->dri2.loader->base.version > 2)
&& (screen->dri2.loader->getBuffersWithFormat != NULL)) {
struct intel_renderbuffer *depth_rb;
struct intel_renderbuffer *stencil_rb;
@@ -248,7 +249,7 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable)
attachments, i / 2,
&count,
drawable->loaderPrivate);
- } else {
+ } else if (screen->dri2.loader) {
i = 0;
if (intel_fb->color_rb[0])
attachments[i++] = __DRI_BUFFER_FRONT_LEFT;
--
cgit v1.2.3
From 09c91a1565fc99f20379a0f552651303ae8067c2 Mon Sep 17 00:00:00 2001
From: Alex Deucher
Date: Tue, 28 Apr 2009 12:37:29 -0400
Subject: R300: add quadpipe overrides
RV410 SE chips only have 1 quadpipe.
Also, handle other R300 chip with quadpipe override
---
src/mesa/drivers/dri/radeon/radeon_screen.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c
index 882853344b..791f59826b 100644
--- a/src/mesa/drivers/dri/radeon/radeon_screen.c
+++ b/src/mesa/drivers/dri/radeon/radeon_screen.c
@@ -561,11 +561,8 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv )
screen->chip_family = CHIP_FAMILY_RS300;
break;
- /* 9500 with 1 pipe verified by: Reid Linnemann */
+
case PCI_CHIP_R300_AD:
- screen->chip_family = CHIP_FAMILY_RV350;
- screen->chip_flags = RADEON_CHIPSET_TCL;
- break;
case PCI_CHIP_R300_AE:
case PCI_CHIP_R300_AF:
case PCI_CHIP_R300_AG:
@@ -893,6 +890,18 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv )
} else {
screen->num_gb_pipes = temp;
}
+
+ /* pipe overrides */
+ switch (dri_priv->deviceID) {
+ case PCI_CHIP_R300_AD: /* 9500 with 1 quadpipe verified by: Reid Linnemann */
+ case PCI_CHIP_RV410_5E4C: /* RV410 SE only have 1 quadpipe */
+ case PCI_CHIP_RV410_5E4F: /* RV410 SE only have 1 quadpipe */
+ screen->num_gb_pipes = 1;
+ break;
+ default:
+ break;
+ }
+
}
if ( sPriv->drm_version.minor >= 10 ) {
--
cgit v1.2.3
From 43e24a5928aaf6a00f7d9e55e92abfb1b3e20166 Mon Sep 17 00:00:00 2001
From: José Fonseca
Date: Mon, 27 Apr 2009 20:24:55 +0100
Subject: wgl: Store current HDC/HGLRC in stw_context.
Less TLS lookups.
---
.../state_trackers/wgl/shared/stw_context.c | 66 ++++++++++++++--------
.../state_trackers/wgl/shared/stw_context.h | 1 +
src/gallium/state_trackers/wgl/shared/stw_tls.h | 2 -
3 files changed, 44 insertions(+), 25 deletions(-)
diff --git a/src/gallium/state_trackers/wgl/shared/stw_context.c b/src/gallium/state_trackers/wgl/shared/stw_context.c
index f3c7af93f5..0b5dd78ec6 100644
--- a/src/gallium/state_trackers/wgl/shared/stw_context.c
+++ b/src/gallium/state_trackers/wgl/shared/stw_context.c
@@ -101,7 +101,7 @@ stw_create_layer_context(
ctx = CALLOC_STRUCT( stw_context );
if (ctx == NULL)
- return 0;
+ goto no_ctx;
ctx->hdc = hdc;
ctx->color_bits = GetDeviceCaps( ctx->hdc, BITSPIXEL );
@@ -125,7 +125,7 @@ stw_create_layer_context(
pf->pfd.cAccumAlphaBits,
pf->numSamples );
if (visual == NULL)
- goto fail;
+ goto no_visual;
screen = stw_dev->screen;
@@ -137,7 +137,7 @@ stw_create_layer_context(
pipe = stw_dev->stw_winsys->create_context( screen );
if (pipe == NULL)
- goto fail;
+ goto no_pipe;
#ifdef DEBUG
/* Wrap context */
@@ -150,28 +150,29 @@ stw_create_layer_context(
ctx->st = st_create_context( pipe, visual, NULL );
if (ctx->st == NULL)
- goto fail;
+ goto no_st_ctx;
ctx->st->ctx->DriverCtx = ctx;
ctx->pfi = pf;
pipe_mutex_lock( stw_dev->mutex );
- hglrc = handle_table_add(stw_dev->ctx_table, ctx);
+ ctx->hglrc = handle_table_add(stw_dev->ctx_table, ctx);
pipe_mutex_unlock( stw_dev->mutex );
-
- /* Success?
- */
- if (hglrc != 0)
- return hglrc;
-
-fail:
- if (visual)
- _mesa_destroy_visual( visual );
-
- if (pipe)
- pipe->destroy( pipe );
-
+ if (!ctx->hglrc)
+ goto no_hglrc;
+
+ return ctx->hglrc;
+
+no_hglrc:
+ st_destroy_context(ctx->st);
+ goto no_pipe; /* st_context_destroy already destroys pipe */
+no_st_ctx:
+ pipe->destroy( pipe );
+no_pipe:
+ _mesa_destroy_visual( visual );
+no_visual:
FREE( ctx );
+no_ctx:
return 0;
}
@@ -271,13 +272,35 @@ stw_get_window_size( HDC hdc, GLuint *width, GLuint *height )
UINT_PTR
stw_get_current_context( void )
{
- return stw_tls_get_data()->currentGLRC;
+ GET_CURRENT_CONTEXT( glcurctx );
+ struct stw_context *ctx;
+
+ if(!glcurctx)
+ return NULL;
+
+ ctx = (struct stw_context *)glcurctx->DriverCtx;
+ assert(ctx);
+ if(!ctx)
+ return NULL;
+
+ return ctx->hglrc;
}
HDC
stw_get_current_dc( void )
{
- return stw_tls_get_data()->currentDC;
+ GET_CURRENT_CONTEXT( glcurctx );
+ struct stw_context *ctx;
+
+ if(!glcurctx)
+ return NULL;
+
+ ctx = (struct stw_context *)glcurctx->DriverCtx;
+ assert(ctx);
+ if(!ctx)
+ return NULL;
+
+ return ctx->hdc;
}
BOOL
@@ -299,9 +322,6 @@ stw_make_current(
ctx = stw_lookup_context_locked( hglrc );
pipe_mutex_unlock( stw_dev->mutex );
- stw_tls_get_data()->currentDC = hdc;
- stw_tls_get_data()->currentGLRC = hglrc;
-
if (glcurctx != NULL) {
curctx = (struct stw_context *) glcurctx->DriverCtx;
diff --git a/src/gallium/state_trackers/wgl/shared/stw_context.h b/src/gallium/state_trackers/wgl/shared/stw_context.h
index bc3b1dc880..e276737e85 100644
--- a/src/gallium/state_trackers/wgl/shared/stw_context.h
+++ b/src/gallium/state_trackers/wgl/shared/stw_context.h
@@ -36,6 +36,7 @@ struct stw_pixelformat_info;
struct stw_context
{
struct st_context *st;
+ UINT_PTR hglrc;
HDC hdc;
DWORD color_bits;
const struct stw_pixelformat_info *pfi;
diff --git a/src/gallium/state_trackers/wgl/shared/stw_tls.h b/src/gallium/state_trackers/wgl/shared/stw_tls.h
index f5a6bdf4b1..6cfb0899f2 100644
--- a/src/gallium/state_trackers/wgl/shared/stw_tls.h
+++ b/src/gallium/state_trackers/wgl/shared/stw_tls.h
@@ -33,8 +33,6 @@
struct stw_tls_data
{
uint currentPixelFormat;
- HDC currentDC;
- UINT_PTR currentGLRC;
HHOOK hCallWndProcHook;
};
--
cgit v1.2.3
From afd16512bc354cf1a7220cb9bf3ce445503c7af4 Mon Sep 17 00:00:00 2001
From: Keith Whitwell
Date: Mon, 27 Apr 2009 18:56:26 +0100
Subject: mesa/st: workaround for crashes in st_copy_texsubimage
Proper fix for this hasn't been identified, but avoid crashing.
---
src/mesa/state_tracker/st_cb_texture.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index aeb75117ec..b7b791d9a4 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -51,6 +51,7 @@
#include "state_tracker/st_texture.h"
#include "state_tracker/st_gen_mipmap.h"
#include "state_tracker/st_inlines.h"
+#include "state_tracker/st_atom.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
@@ -1317,6 +1318,10 @@ st_copy_texsubimage(GLcontext *ctx,
/* any rendering in progress must complete before we grab the fb image */
st_finish(ctx->st);
+ /* make sure finalize_textures has been called?
+ */
+ if (0) st_validate_state(ctx->st);
+
/* determine if copying depth or color data */
if (texBaseFormat == GL_DEPTH_COMPONENT ||
texBaseFormat == GL_DEPTH24_STENCIL8) {
@@ -1330,6 +1335,11 @@ st_copy_texsubimage(GLcontext *ctx,
strb = st_renderbuffer(fb->_ColorReadBuffer);
}
+ if (!strb || !strb->surface || !stImage->pt) {
+ debug_printf("%s: null strb or stImage\n", __FUNCTION__);
+ return;
+ }
+
assert(strb);
assert(strb->surface);
assert(stImage->pt);
--
cgit v1.2.3
From b91e5f8e197793feac016242140bf489bd16071c Mon Sep 17 00:00:00 2001
From: Keith Whitwell
Date: Mon, 27 Apr 2009 19:36:42 +0100
Subject: util/indices: remove debug prints
---
src/gallium/auxiliary/indices/u_unfilled_gen.c | 160 ------------------------
src/gallium/auxiliary/indices/u_unfilled_gen.py | 1 -
2 files changed, 161 deletions(-)
diff --git a/src/gallium/auxiliary/indices/u_unfilled_gen.c b/src/gallium/auxiliary/indices/u_unfilled_gen.c
index fd082ebbb3..93897c98de 100644
--- a/src/gallium/auxiliary/indices/u_unfilled_gen.c
+++ b/src/gallium/auxiliary/indices/u_unfilled_gen.c
@@ -71,13 +71,10 @@ static void generate_tris_ushort(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=6, i+=3) {
- debug_printf(" line %d %d\n", (int)i, (int)i+1);
(out+j)[0] = (ushort)(i);
(out+j)[1] = (ushort)(i+1);
- debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
(out+j+2)[0] = (ushort)(i+1);
(out+j+2)[1] = (ushort)(i+2);
- debug_printf(" line %d %d\n", (int)i+2, (int)i);
(out+j+4)[0] = (ushort)(i+2);
(out+j+4)[1] = (ushort)(i);
}
@@ -90,13 +87,10 @@ static void generate_tristrip_ushort(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=6, i++) {
- debug_printf(" line %d %d\n", (int)i, (int)i+1/*+(i&1)*/);
(out+j)[0] = (ushort)(i);
(out+j)[1] = (ushort)(i+1/*+(i&1)*/);
- debug_printf(" line %d %d\n", (int)i+1/*+(i&1)*/, (int)i+2/*-(i&1)*/);
(out+j+2)[0] = (ushort)(i+1/*+(i&1)*/);
(out+j+2)[1] = (ushort)(i+2/*-(i&1)*/);
- debug_printf(" line %d %d\n", (int)i+2/*-(i&1)*/, (int)i);
(out+j+4)[0] = (ushort)(i+2/*-(i&1)*/);
(out+j+4)[1] = (ushort)(i);
}
@@ -109,13 +103,10 @@ static void generate_trifan_ushort(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=6, i++) {
- debug_printf(" line %d %d\n", (int)0, (int)i+1);
(out+j)[0] = (ushort)(0);
(out+j)[1] = (ushort)(i+1);
- debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
(out+j+2)[0] = (ushort)(i+1);
(out+j+2)[1] = (ushort)(i+2);
- debug_printf(" line %d %d\n", (int)i+2, (int)0);
(out+j+4)[0] = (ushort)(i+2);
(out+j+4)[1] = (ushort)(0);
}
@@ -128,16 +119,12 @@ static void generate_quads_ushort(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=8, i+=4) {
- debug_printf(" line %d %d\n", (int)i+0, (int)i+1);
(out+j)[0] = (ushort)(i+0);
(out+j)[1] = (ushort)(i+1);
- debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
(out+j+2)[0] = (ushort)(i+1);
(out+j+2)[1] = (ushort)(i+2);
- debug_printf(" line %d %d\n", (int)i+2, (int)i+3);
(out+j+4)[0] = (ushort)(i+2);
(out+j+4)[1] = (ushort)(i+3);
- debug_printf(" line %d %d\n", (int)i+3, (int)i+0);
(out+j+6)[0] = (ushort)(i+3);
(out+j+6)[1] = (ushort)(i+0);
}
@@ -150,16 +137,12 @@ static void generate_quadstrip_ushort(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=8, i+=2) {
- debug_printf(" line %d %d\n", (int)i+2, (int)i+0);
(out+j)[0] = (ushort)(i+2);
(out+j)[1] = (ushort)(i+0);
- debug_printf(" line %d %d\n", (int)i+0, (int)i+1);
(out+j+2)[0] = (ushort)(i+0);
(out+j+2)[1] = (ushort)(i+1);
- debug_printf(" line %d %d\n", (int)i+1, (int)i+3);
(out+j+4)[0] = (ushort)(i+1);
(out+j+4)[1] = (ushort)(i+3);
- debug_printf(" line %d %d\n", (int)i+3, (int)i+2);
(out+j+6)[0] = (ushort)(i+3);
(out+j+6)[1] = (ushort)(i+2);
}
@@ -172,13 +155,10 @@ static void generate_polygon_ushort(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=6, i++) {
- debug_printf(" line %d %d\n", (int)0, (int)i+1);
(out+j)[0] = (ushort)(0);
(out+j)[1] = (ushort)(i+1);
- debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
(out+j+2)[0] = (ushort)(i+1);
(out+j+2)[1] = (ushort)(i+2);
- debug_printf(" line %d %d\n", (int)i+2, (int)0);
(out+j+4)[0] = (ushort)(i+2);
(out+j+4)[1] = (ushort)(0);
}
@@ -191,13 +171,10 @@ static void generate_tris_uint(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=6, i+=3) {
- debug_printf(" line %d %d\n", (int)i, (int)i+1);
(out+j)[0] = (uint)(i);
(out+j)[1] = (uint)(i+1);
- debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
(out+j+2)[0] = (uint)(i+1);
(out+j+2)[1] = (uint)(i+2);
- debug_printf(" line %d %d\n", (int)i+2, (int)i);
(out+j+4)[0] = (uint)(i+2);
(out+j+4)[1] = (uint)(i);
}
@@ -210,13 +187,10 @@ static void generate_tristrip_uint(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=6, i++) {
- debug_printf(" line %d %d\n", (int)i, (int)i+1/*+(i&1)*/);
(out+j)[0] = (uint)(i);
(out+j)[1] = (uint)(i+1/*+(i&1)*/);
- debug_printf(" line %d %d\n", (int)i+1/*+(i&1)*/, (int)i+2/*-(i&1)*/);
(out+j+2)[0] = (uint)(i+1/*+(i&1)*/);
(out+j+2)[1] = (uint)(i+2/*-(i&1)*/);
- debug_printf(" line %d %d\n", (int)i+2/*-(i&1)*/, (int)i);
(out+j+4)[0] = (uint)(i+2/*-(i&1)*/);
(out+j+4)[1] = (uint)(i);
}
@@ -229,13 +203,10 @@ static void generate_trifan_uint(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=6, i++) {
- debug_printf(" line %d %d\n", (int)0, (int)i+1);
(out+j)[0] = (uint)(0);
(out+j)[1] = (uint)(i+1);
- debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
(out+j+2)[0] = (uint)(i+1);
(out+j+2)[1] = (uint)(i+2);
- debug_printf(" line %d %d\n", (int)i+2, (int)0);
(out+j+4)[0] = (uint)(i+2);
(out+j+4)[1] = (uint)(0);
}
@@ -248,16 +219,12 @@ static void generate_quads_uint(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=8, i+=4) {
- debug_printf(" line %d %d\n", (int)i+0, (int)i+1);
(out+j)[0] = (uint)(i+0);
(out+j)[1] = (uint)(i+1);
- debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
(out+j+2)[0] = (uint)(i+1);
(out+j+2)[1] = (uint)(i+2);
- debug_printf(" line %d %d\n", (int)i+2, (int)i+3);
(out+j+4)[0] = (uint)(i+2);
(out+j+4)[1] = (uint)(i+3);
- debug_printf(" line %d %d\n", (int)i+3, (int)i+0);
(out+j+6)[0] = (uint)(i+3);
(out+j+6)[1] = (uint)(i+0);
}
@@ -270,16 +237,12 @@ static void generate_quadstrip_uint(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=8, i+=2) {
- debug_printf(" line %d %d\n", (int)i+2, (int)i+0);
(out+j)[0] = (uint)(i+2);
(out+j)[1] = (uint)(i+0);
- debug_printf(" line %d %d\n", (int)i+0, (int)i+1);
(out+j+2)[0] = (uint)(i+0);
(out+j+2)[1] = (uint)(i+1);
- debug_printf(" line %d %d\n", (int)i+1, (int)i+3);
(out+j+4)[0] = (uint)(i+1);
(out+j+4)[1] = (uint)(i+3);
- debug_printf(" line %d %d\n", (int)i+3, (int)i+2);
(out+j+6)[0] = (uint)(i+3);
(out+j+6)[1] = (uint)(i+2);
}
@@ -292,13 +255,10 @@ static void generate_polygon_uint(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=6, i++) {
- debug_printf(" line %d %d\n", (int)0, (int)i+1);
(out+j)[0] = (uint)(0);
(out+j)[1] = (uint)(i+1);
- debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
(out+j+2)[0] = (uint)(i+1);
(out+j+2)[1] = (uint)(i+2);
- debug_printf(" line %d %d\n", (int)i+2, (int)0);
(out+j+4)[0] = (uint)(i+2);
(out+j+4)[1] = (uint)(0);
}
@@ -313,13 +273,10 @@ static void translate_tris_ubyte2ushort(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=6, i+=3) {
- debug_printf(" line %d %d\n", (int)i, (int)i+1);
(out+j)[0] = (ushort)in[i];
(out+j)[1] = (ushort)in[i+1];
- debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
(out+j+2)[0] = (ushort)in[i+1];
(out+j+2)[1] = (ushort)in[i+2];
- debug_printf(" line %d %d\n", (int)i+2, (int)i);
(out+j+4)[0] = (ushort)in[i+2];
(out+j+4)[1] = (ushort)in[i];
}
@@ -334,13 +291,10 @@ static void translate_tristrip_ubyte2ushort(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=6, i++) {
- debug_printf(" line %d %d\n", (int)i, (int)i+1/*+(i&1)*/);
(out+j)[0] = (ushort)in[i];
(out+j)[1] = (ushort)in[i+1/*+(i&1)*/];
- debug_printf(" line %d %d\n", (int)i+1/*+(i&1)*/, (int)i+2/*-(i&1)*/);
(out+j+2)[0] = (ushort)in[i+1/*+(i&1)*/];
(out+j+2)[1] = (ushort)in[i+2/*-(i&1)*/];
- debug_printf(" line %d %d\n", (int)i+2/*-(i&1)*/, (int)i);
(out+j+4)[0] = (ushort)in[i+2/*-(i&1)*/];
(out+j+4)[1] = (ushort)in[i];
}
@@ -355,13 +309,10 @@ static void translate_trifan_ubyte2ushort(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=6, i++) {
- debug_printf(" line %d %d\n", (int)0, (int)i+1);
(out+j)[0] = (ushort)in[0];
(out+j)[1] = (ushort)in[i+1];
- debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
(out+j+2)[0] = (ushort)in[i+1];
(out+j+2)[1] = (ushort)in[i+2];
- debug_printf(" line %d %d\n", (int)i+2, (int)0);
(out+j+4)[0] = (ushort)in[i+2];
(out+j+4)[1] = (ushort)in[0];
}
@@ -376,16 +327,12 @@ static void translate_quads_ubyte2ushort(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=8, i+=4) {
- debug_printf(" line %d %d\n", (int)i+0, (int)i+1);
(out+j)[0] = (ushort)in[i+0];
(out+j)[1] = (ushort)in[i+1];
- debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
(out+j+2)[0] = (ushort)in[i+1];
(out+j+2)[1] = (ushort)in[i+2];
- debug_printf(" line %d %d\n", (int)i+2, (int)i+3);
(out+j+4)[0] = (ushort)in[i+2];
(out+j+4)[1] = (ushort)in[i+3];
- debug_printf(" line %d %d\n", (int)i+3, (int)i+0);
(out+j+6)[0] = (ushort)in[i+3];
(out+j+6)[1] = (ushort)in[i+0];
}
@@ -400,16 +347,12 @@ static void translate_quadstrip_ubyte2ushort(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=8, i+=2) {
- debug_printf(" line %d %d\n", (int)i+2, (int)i+0);
(out+j)[0] = (ushort)in[i+2];
(out+j)[1] = (ushort)in[i+0];
- debug_printf(" line %d %d\n", (int)i+0, (int)i+1);
(out+j+2)[0] = (ushort)in[i+0];
(out+j+2)[1] = (ushort)in[i+1];
- debug_printf(" line %d %d\n", (int)i+1, (int)i+3);
(out+j+4)[0] = (ushort)in[i+1];
(out+j+4)[1] = (ushort)in[i+3];
- debug_printf(" line %d %d\n", (int)i+3, (int)i+2);
(out+j+6)[0] = (ushort)in[i+3];
(out+j+6)[1] = (ushort)in[i+2];
}
@@ -424,13 +367,10 @@ static void translate_polygon_ubyte2ushort(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=6, i++) {
- debug_printf(" line %d %d\n", (int)0, (int)i+1);
(out+j)[0] = (ushort)in[0];
(out+j)[1] = (ushort)in[i+1];
- debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
(out+j+2)[0] = (ushort)in[i+1];
(out+j+2)[1] = (ushort)in[i+2];
- debug_printf(" line %d %d\n", (int)i+2, (int)0);
(out+j+4)[0] = (ushort)in[i+2];
(out+j+4)[1] = (ushort)in[0];
}
@@ -445,13 +385,10 @@ static void translate_tris_ubyte2uint(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=6, i+=3) {
- debug_printf(" line %d %d\n", (int)i, (int)i+1);
(out+j)[0] = (uint)in[i];
(out+j)[1] = (uint)in[i+1];
- debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
(out+j+2)[0] = (uint)in[i+1];
(out+j+2)[1] = (uint)in[i+2];
- debug_printf(" line %d %d\n", (int)i+2, (int)i);
(out+j+4)[0] = (uint)in[i+2];
(out+j+4)[1] = (uint)in[i];
}
@@ -466,13 +403,10 @@ static void translate_tristrip_ubyte2uint(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=6, i++) {
- debug_printf(" line %d %d\n", (int)i, (int)i+1/*+(i&1)*/);
(out+j)[0] = (uint)in[i];
(out+j)[1] = (uint)in[i+1/*+(i&1)*/];
- debug_printf(" line %d %d\n", (int)i+1/*+(i&1)*/, (int)i+2/*-(i&1)*/);
(out+j+2)[0] = (uint)in[i+1/*+(i&1)*/];
(out+j+2)[1] = (uint)in[i+2/*-(i&1)*/];
- debug_printf(" line %d %d\n", (int)i+2/*-(i&1)*/, (int)i);
(out+j+4)[0] = (uint)in[i+2/*-(i&1)*/];
(out+j+4)[1] = (uint)in[i];
}
@@ -487,13 +421,10 @@ static void translate_trifan_ubyte2uint(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=6, i++) {
- debug_printf(" line %d %d\n", (int)0, (int)i+1);
(out+j)[0] = (uint)in[0];
(out+j)[1] = (uint)in[i+1];
- debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
(out+j+2)[0] = (uint)in[i+1];
(out+j+2)[1] = (uint)in[i+2];
- debug_printf(" line %d %d\n", (int)i+2, (int)0);
(out+j+4)[0] = (uint)in[i+2];
(out+j+4)[1] = (uint)in[0];
}
@@ -508,16 +439,12 @@ static void translate_quads_ubyte2uint(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=8, i+=4) {
- debug_printf(" line %d %d\n", (int)i+0, (int)i+1);
(out+j)[0] = (uint)in[i+0];
(out+j)[1] = (uint)in[i+1];
- debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
(out+j+2)[0] = (uint)in[i+1];
(out+j+2)[1] = (uint)in[i+2];
- debug_printf(" line %d %d\n", (int)i+2, (int)i+3);
(out+j+4)[0] = (uint)in[i+2];
(out+j+4)[1] = (uint)in[i+3];
- debug_printf(" line %d %d\n", (int)i+3, (int)i+0);
(out+j+6)[0] = (uint)in[i+3];
(out+j+6)[1] = (uint)in[i+0];
}
@@ -532,16 +459,12 @@ static void translate_quadstrip_ubyte2uint(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=8, i+=2) {
- debug_printf(" line %d %d\n", (int)i+2, (int)i+0);
(out+j)[0] = (uint)in[i+2];
(out+j)[1] = (uint)in[i+0];
- debug_printf(" line %d %d\n", (int)i+0, (int)i+1);
(out+j+2)[0] = (uint)in[i+0];
(out+j+2)[1] = (uint)in[i+1];
- debug_printf(" line %d %d\n", (int)i+1, (int)i+3);
(out+j+4)[0] = (uint)in[i+1];
(out+j+4)[1] = (uint)in[i+3];
- debug_printf(" line %d %d\n", (int)i+3, (int)i+2);
(out+j+6)[0] = (uint)in[i+3];
(out+j+6)[1] = (uint)in[i+2];
}
@@ -556,13 +479,10 @@ static void translate_polygon_ubyte2uint(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=6, i++) {
- debug_printf(" line %d %d\n", (int)0, (int)i+1);
(out+j)[0] = (uint)in[0];
(out+j)[1] = (uint)in[i+1];
- debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
(out+j+2)[0] = (uint)in[i+1];
(out+j+2)[1] = (uint)in[i+2];
- debug_printf(" line %d %d\n", (int)i+2, (int)0);
(out+j+4)[0] = (uint)in[i+2];
(out+j+4)[1] = (uint)in[0];
}
@@ -577,13 +497,10 @@ static void translate_tris_ushort2ushort(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=6, i+=3) {
- debug_printf(" line %d %d\n", (int)i, (int)i+1);
(out+j)[0] = (ushort)in[i];
(out+j)[1] = (ushort)in[i+1];
- debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
(out+j+2)[0] = (ushort)in[i+1];
(out+j+2)[1] = (ushort)in[i+2];
- debug_printf(" line %d %d\n", (int)i+2, (int)i);
(out+j+4)[0] = (ushort)in[i+2];
(out+j+4)[1] = (ushort)in[i];
}
@@ -598,13 +515,10 @@ static void translate_tristrip_ushort2ushort(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=6, i++) {
- debug_printf(" line %d %d\n", (int)i, (int)i+1/*+(i&1)*/);
(out+j)[0] = (ushort)in[i];
(out+j)[1] = (ushort)in[i+1/*+(i&1)*/];
- debug_printf(" line %d %d\n", (int)i+1/*+(i&1)*/, (int)i+2/*-(i&1)*/);
(out+j+2)[0] = (ushort)in[i+1/*+(i&1)*/];
(out+j+2)[1] = (ushort)in[i+2/*-(i&1)*/];
- debug_printf(" line %d %d\n", (int)i+2/*-(i&1)*/, (int)i);
(out+j+4)[0] = (ushort)in[i+2/*-(i&1)*/];
(out+j+4)[1] = (ushort)in[i];
}
@@ -619,13 +533,10 @@ static void translate_trifan_ushort2ushort(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=6, i++) {
- debug_printf(" line %d %d\n", (int)0, (int)i+1);
(out+j)[0] = (ushort)in[0];
(out+j)[1] = (ushort)in[i+1];
- debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
(out+j+2)[0] = (ushort)in[i+1];
(out+j+2)[1] = (ushort)in[i+2];
- debug_printf(" line %d %d\n", (int)i+2, (int)0);
(out+j+4)[0] = (ushort)in[i+2];
(out+j+4)[1] = (ushort)in[0];
}
@@ -640,16 +551,12 @@ static void translate_quads_ushort2ushort(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=8, i+=4) {
- debug_printf(" line %d %d\n", (int)i+0, (int)i+1);
(out+j)[0] = (ushort)in[i+0];
(out+j)[1] = (ushort)in[i+1];
- debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
(out+j+2)[0] = (ushort)in[i+1];
(out+j+2)[1] = (ushort)in[i+2];
- debug_printf(" line %d %d\n", (int)i+2, (int)i+3);
(out+j+4)[0] = (ushort)in[i+2];
(out+j+4)[1] = (ushort)in[i+3];
- debug_printf(" line %d %d\n", (int)i+3, (int)i+0);
(out+j+6)[0] = (ushort)in[i+3];
(out+j+6)[1] = (ushort)in[i+0];
}
@@ -664,16 +571,12 @@ static void translate_quadstrip_ushort2ushort(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=8, i+=2) {
- debug_printf(" line %d %d\n", (int)i+2, (int)i+0);
(out+j)[0] = (ushort)in[i+2];
(out+j)[1] = (ushort)in[i+0];
- debug_printf(" line %d %d\n", (int)i+0, (int)i+1);
(out+j+2)[0] = (ushort)in[i+0];
(out+j+2)[1] = (ushort)in[i+1];
- debug_printf(" line %d %d\n", (int)i+1, (int)i+3);
(out+j+4)[0] = (ushort)in[i+1];
(out+j+4)[1] = (ushort)in[i+3];
- debug_printf(" line %d %d\n", (int)i+3, (int)i+2);
(out+j+6)[0] = (ushort)in[i+3];
(out+j+6)[1] = (ushort)in[i+2];
}
@@ -688,13 +591,10 @@ static void translate_polygon_ushort2ushort(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=6, i++) {
- debug_printf(" line %d %d\n", (int)0, (int)i+1);
(out+j)[0] = (ushort)in[0];
(out+j)[1] = (ushort)in[i+1];
- debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
(out+j+2)[0] = (ushort)in[i+1];
(out+j+2)[1] = (ushort)in[i+2];
- debug_printf(" line %d %d\n", (int)i+2, (int)0);
(out+j+4)[0] = (ushort)in[i+2];
(out+j+4)[1] = (ushort)in[0];
}
@@ -709,13 +609,10 @@ static void translate_tris_ushort2uint(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=6, i+=3) {
- debug_printf(" line %d %d\n", (int)i, (int)i+1);
(out+j)[0] = (uint)in[i];
(out+j)[1] = (uint)in[i+1];
- debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
(out+j+2)[0] = (uint)in[i+1];
(out+j+2)[1] = (uint)in[i+2];
- debug_printf(" line %d %d\n", (int)i+2, (int)i);
(out+j+4)[0] = (uint)in[i+2];
(out+j+4)[1] = (uint)in[i];
}
@@ -730,13 +627,10 @@ static void translate_tristrip_ushort2uint(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=6, i++) {
- debug_printf(" line %d %d\n", (int)i, (int)i+1/*+(i&1)*/);
(out+j)[0] = (uint)in[i];
(out+j)[1] = (uint)in[i+1/*+(i&1)*/];
- debug_printf(" line %d %d\n", (int)i+1/*+(i&1)*/, (int)i+2/*-(i&1)*/);
(out+j+2)[0] = (uint)in[i+1/*+(i&1)*/];
(out+j+2)[1] = (uint)in[i+2/*-(i&1)*/];
- debug_printf(" line %d %d\n", (int)i+2/*-(i&1)*/, (int)i);
(out+j+4)[0] = (uint)in[i+2/*-(i&1)*/];
(out+j+4)[1] = (uint)in[i];
}
@@ -751,13 +645,10 @@ static void translate_trifan_ushort2uint(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=6, i++) {
- debug_printf(" line %d %d\n", (int)0, (int)i+1);
(out+j)[0] = (uint)in[0];
(out+j)[1] = (uint)in[i+1];
- debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
(out+j+2)[0] = (uint)in[i+1];
(out+j+2)[1] = (uint)in[i+2];
- debug_printf(" line %d %d\n", (int)i+2, (int)0);
(out+j+4)[0] = (uint)in[i+2];
(out+j+4)[1] = (uint)in[0];
}
@@ -772,16 +663,12 @@ static void translate_quads_ushort2uint(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=8, i+=4) {
- debug_printf(" line %d %d\n", (int)i+0, (int)i+1);
(out+j)[0] = (uint)in[i+0];
(out+j)[1] = (uint)in[i+1];
- debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
(out+j+2)[0] = (uint)in[i+1];
(out+j+2)[1] = (uint)in[i+2];
- debug_printf(" line %d %d\n", (int)i+2, (int)i+3);
(out+j+4)[0] = (uint)in[i+2];
(out+j+4)[1] = (uint)in[i+3];
- debug_printf(" line %d %d\n", (int)i+3, (int)i+0);
(out+j+6)[0] = (uint)in[i+3];
(out+j+6)[1] = (uint)in[i+0];
}
@@ -796,16 +683,12 @@ static void translate_quadstrip_ushort2uint(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=8, i+=2) {
- debug_printf(" line %d %d\n", (int)i+2, (int)i+0);
(out+j)[0] = (uint)in[i+2];
(out+j)[1] = (uint)in[i+0];
- debug_printf(" line %d %d\n", (int)i+0, (int)i+1);
(out+j+2)[0] = (uint)in[i+0];
(out+j+2)[1] = (uint)in[i+1];
- debug_printf(" line %d %d\n", (int)i+1, (int)i+3);
(out+j+4)[0] = (uint)in[i+1];
(out+j+4)[1] = (uint)in[i+3];
- debug_printf(" line %d %d\n", (int)i+3, (int)i+2);
(out+j+6)[0] = (uint)in[i+3];
(out+j+6)[1] = (uint)in[i+2];
}
@@ -820,13 +703,10 @@ static void translate_polygon_ushort2uint(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=6, i++) {
- debug_printf(" line %d %d\n", (int)0, (int)i+1);
(out+j)[0] = (uint)in[0];
(out+j)[1] = (uint)in[i+1];
- debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
(out+j+2)[0] = (uint)in[i+1];
(out+j+2)[1] = (uint)in[i+2];
- debug_printf(" line %d %d\n", (int)i+2, (int)0);
(out+j+4)[0] = (uint)in[i+2];
(out+j+4)[1] = (uint)in[0];
}
@@ -841,13 +721,10 @@ static void translate_tris_uint2ushort(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=6, i+=3) {
- debug_printf(" line %d %d\n", (int)i, (int)i+1);
(out+j)[0] = (ushort)in[i];
(out+j)[1] = (ushort)in[i+1];
- debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
(out+j+2)[0] = (ushort)in[i+1];
(out+j+2)[1] = (ushort)in[i+2];
- debug_printf(" line %d %d\n", (int)i+2, (int)i);
(out+j+4)[0] = (ushort)in[i+2];
(out+j+4)[1] = (ushort)in[i];
}
@@ -862,13 +739,10 @@ static void translate_tristrip_uint2ushort(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=6, i++) {
- debug_printf(" line %d %d\n", (int)i, (int)i+1/*+(i&1)*/);
(out+j)[0] = (ushort)in[i];
(out+j)[1] = (ushort)in[i+1/*+(i&1)*/];
- debug_printf(" line %d %d\n", (int)i+1/*+(i&1)*/, (int)i+2/*-(i&1)*/);
(out+j+2)[0] = (ushort)in[i+1/*+(i&1)*/];
(out+j+2)[1] = (ushort)in[i+2/*-(i&1)*/];
- debug_printf(" line %d %d\n", (int)i+2/*-(i&1)*/, (int)i);
(out+j+4)[0] = (ushort)in[i+2/*-(i&1)*/];
(out+j+4)[1] = (ushort)in[i];
}
@@ -883,13 +757,10 @@ static void translate_trifan_uint2ushort(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=6, i++) {
- debug_printf(" line %d %d\n", (int)0, (int)i+1);
(out+j)[0] = (ushort)in[0];
(out+j)[1] = (ushort)in[i+1];
- debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
(out+j+2)[0] = (ushort)in[i+1];
(out+j+2)[1] = (ushort)in[i+2];
- debug_printf(" line %d %d\n", (int)i+2, (int)0);
(out+j+4)[0] = (ushort)in[i+2];
(out+j+4)[1] = (ushort)in[0];
}
@@ -904,16 +775,12 @@ static void translate_quads_uint2ushort(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=8, i+=4) {
- debug_printf(" line %d %d\n", (int)i+0, (int)i+1);
(out+j)[0] = (ushort)in[i+0];
(out+j)[1] = (ushort)in[i+1];
- debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
(out+j+2)[0] = (ushort)in[i+1];
(out+j+2)[1] = (ushort)in[i+2];
- debug_printf(" line %d %d\n", (int)i+2, (int)i+3);
(out+j+4)[0] = (ushort)in[i+2];
(out+j+4)[1] = (ushort)in[i+3];
- debug_printf(" line %d %d\n", (int)i+3, (int)i+0);
(out+j+6)[0] = (ushort)in[i+3];
(out+j+6)[1] = (ushort)in[i+0];
}
@@ -928,16 +795,12 @@ static void translate_quadstrip_uint2ushort(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=8, i+=2) {
- debug_printf(" line %d %d\n", (int)i+2, (int)i+0);
(out+j)[0] = (ushort)in[i+2];
(out+j)[1] = (ushort)in[i+0];
- debug_printf(" line %d %d\n", (int)i+0, (int)i+1);
(out+j+2)[0] = (ushort)in[i+0];
(out+j+2)[1] = (ushort)in[i+1];
- debug_printf(" line %d %d\n", (int)i+1, (int)i+3);
(out+j+4)[0] = (ushort)in[i+1];
(out+j+4)[1] = (ushort)in[i+3];
- debug_printf(" line %d %d\n", (int)i+3, (int)i+2);
(out+j+6)[0] = (ushort)in[i+3];
(out+j+6)[1] = (ushort)in[i+2];
}
@@ -952,13 +815,10 @@ static void translate_polygon_uint2ushort(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=6, i++) {
- debug_printf(" line %d %d\n", (int)0, (int)i+1);
(out+j)[0] = (ushort)in[0];
(out+j)[1] = (ushort)in[i+1];
- debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
(out+j+2)[0] = (ushort)in[i+1];
(out+j+2)[1] = (ushort)in[i+2];
- debug_printf(" line %d %d\n", (int)i+2, (int)0);
(out+j+4)[0] = (ushort)in[i+2];
(out+j+4)[1] = (ushort)in[0];
}
@@ -973,13 +833,10 @@ static void translate_tris_uint2uint(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=6, i+=3) {
- debug_printf(" line %d %d\n", (int)i, (int)i+1);
(out+j)[0] = (uint)in[i];
(out+j)[1] = (uint)in[i+1];
- debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
(out+j+2)[0] = (uint)in[i+1];
(out+j+2)[1] = (uint)in[i+2];
- debug_printf(" line %d %d\n", (int)i+2, (int)i);
(out+j+4)[0] = (uint)in[i+2];
(out+j+4)[1] = (uint)in[i];
}
@@ -994,13 +851,10 @@ static void translate_tristrip_uint2uint(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=6, i++) {
- debug_printf(" line %d %d\n", (int)i, (int)i+1/*+(i&1)*/);
(out+j)[0] = (uint)in[i];
(out+j)[1] = (uint)in[i+1/*+(i&1)*/];
- debug_printf(" line %d %d\n", (int)i+1/*+(i&1)*/, (int)i+2/*-(i&1)*/);
(out+j+2)[0] = (uint)in[i+1/*+(i&1)*/];
(out+j+2)[1] = (uint)in[i+2/*-(i&1)*/];
- debug_printf(" line %d %d\n", (int)i+2/*-(i&1)*/, (int)i);
(out+j+4)[0] = (uint)in[i+2/*-(i&1)*/];
(out+j+4)[1] = (uint)in[i];
}
@@ -1015,13 +869,10 @@ static void translate_trifan_uint2uint(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=6, i++) {
- debug_printf(" line %d %d\n", (int)0, (int)i+1);
(out+j)[0] = (uint)in[0];
(out+j)[1] = (uint)in[i+1];
- debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
(out+j+2)[0] = (uint)in[i+1];
(out+j+2)[1] = (uint)in[i+2];
- debug_printf(" line %d %d\n", (int)i+2, (int)0);
(out+j+4)[0] = (uint)in[i+2];
(out+j+4)[1] = (uint)in[0];
}
@@ -1036,16 +887,12 @@ static void translate_quads_uint2uint(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=8, i+=4) {
- debug_printf(" line %d %d\n", (int)i+0, (int)i+1);
(out+j)[0] = (uint)in[i+0];
(out+j)[1] = (uint)in[i+1];
- debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
(out+j+2)[0] = (uint)in[i+1];
(out+j+2)[1] = (uint)in[i+2];
- debug_printf(" line %d %d\n", (int)i+2, (int)i+3);
(out+j+4)[0] = (uint)in[i+2];
(out+j+4)[1] = (uint)in[i+3];
- debug_printf(" line %d %d\n", (int)i+3, (int)i+0);
(out+j+6)[0] = (uint)in[i+3];
(out+j+6)[1] = (uint)in[i+0];
}
@@ -1060,16 +907,12 @@ static void translate_quadstrip_uint2uint(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=8, i+=2) {
- debug_printf(" line %d %d\n", (int)i+2, (int)i+0);
(out+j)[0] = (uint)in[i+2];
(out+j)[1] = (uint)in[i+0];
- debug_printf(" line %d %d\n", (int)i+0, (int)i+1);
(out+j+2)[0] = (uint)in[i+0];
(out+j+2)[1] = (uint)in[i+1];
- debug_printf(" line %d %d\n", (int)i+1, (int)i+3);
(out+j+4)[0] = (uint)in[i+1];
(out+j+4)[1] = (uint)in[i+3];
- debug_printf(" line %d %d\n", (int)i+3, (int)i+2);
(out+j+6)[0] = (uint)in[i+3];
(out+j+6)[1] = (uint)in[i+2];
}
@@ -1084,13 +927,10 @@ static void translate_polygon_uint2uint(
unsigned i, j;
(void)j;
for (j = i = 0; j < nr; j+=6, i++) {
- debug_printf(" line %d %d\n", (int)0, (int)i+1);
(out+j)[0] = (uint)in[0];
(out+j)[1] = (uint)in[i+1];
- debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
(out+j+2)[0] = (uint)in[i+1];
(out+j+2)[1] = (uint)in[i+2];
- debug_printf(" line %d %d\n", (int)i+2, (int)0);
(out+j+4)[0] = (uint)in[i+2];
(out+j+4)[1] = (uint)in[0];
}
diff --git a/src/gallium/auxiliary/indices/u_unfilled_gen.py b/src/gallium/auxiliary/indices/u_unfilled_gen.py
index d0344fe313..36896ce605 100644
--- a/src/gallium/auxiliary/indices/u_unfilled_gen.py
+++ b/src/gallium/auxiliary/indices/u_unfilled_gen.py
@@ -99,7 +99,6 @@ def vert( intype, outtype, v0 ):
return '(' + outtype + ')in[' + v0 + ']'
def line( intype, outtype, ptr, v0, v1 ):
- print ' debug_printf(" line %d %d\\n", (int)' + v0 + ', (int)' + v1 + ');'
print ' (' + ptr + ')[0] = ' + vert( intype, outtype, v0 ) + ';'
print ' (' + ptr + ')[1] = ' + vert( intype, outtype, v1 ) + ';'
--
cgit v1.2.3
From fd402791f909371d8f1c1381f0e16a0f08bd78e6 Mon Sep 17 00:00:00 2001
From: Keith Whitwell
Date: Tue, 28 Apr 2009 11:49:55 +0100
Subject: progs: add fflushes for cygwin
---
progs/demos/dinoshade.c | 2 ++
progs/redbook/polyoff.c | 3 +++
2 files changed, 5 insertions(+)
diff --git a/progs/demos/dinoshade.c b/progs/demos/dinoshade.c
index 451da2ec89..41b19d5a92 100644
--- a/progs/demos/dinoshade.c
+++ b/progs/demos/dinoshade.c
@@ -624,6 +624,7 @@ redraw(void)
glFinish();
end = glutGet(GLUT_ELAPSED_TIME);
printf("Speed %.3g frames/sec (%d ms)\n", 1000.0/(end-start), end-start);
+ fflush(stdout);
}
glutSwapBuffers();
@@ -878,6 +879,7 @@ main(int argc, char **argv)
polygonOffsetVersion = MISSING;
printf("\ndinoshine: Missing polygon offset.\n");
printf(" Expect shadow depth aliasing artifacts.\n\n");
+ fflush(stdout);
}
}
diff --git a/progs/redbook/polyoff.c b/progs/redbook/polyoff.c
index 2017b4d8ee..de34b2e767 100644
--- a/progs/redbook/polyoff.c
+++ b/progs/redbook/polyoff.c
@@ -153,6 +153,7 @@ static void Benchmark( float xdiff, float ydiff )
double seconds, fps;
printf("Benchmarking...\n");
+ fflush(stdout);
draws = 0;
startTime = glutGet(GLUT_ELAPSED_TIME);
@@ -169,6 +170,7 @@ static void Benchmark( float xdiff, float ydiff )
seconds = (double) (endTime - startTime) / 1000.0;
fps = draws / seconds;
printf("Result: fps: %g\n", fps);
+ fflush(stdout);
}
@@ -263,6 +265,7 @@ void keyboard (unsigned char key, int x, int y)
default:
break;
}
+ fflush(stdout);
}
static void
--
cgit v1.2.3
From afc0c59dbd7f89d914763fd78701461f22c00450 Mon Sep 17 00:00:00 2001
From: Keith Whitwell
Date: Mon, 27 Apr 2009 15:33:44 +0100
Subject: mesa/st: translate VERT_ATTRIB_GENERIC8..15 in
st_translate_vertex_program
It seems quake4 can hit these attributes sometimes.
---
src/mesa/state_tracker/st_program.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index 2795570cf1..6ec633c0b4 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -169,6 +169,14 @@ st_translate_vertex_program(struct st_context *st,
case VERT_ATTRIB_GENERIC5:
case VERT_ATTRIB_GENERIC6:
case VERT_ATTRIB_GENERIC7:
+ case VERT_ATTRIB_GENERIC8:
+ case VERT_ATTRIB_GENERIC9:
+ case VERT_ATTRIB_GENERIC10:
+ case VERT_ATTRIB_GENERIC11:
+ case VERT_ATTRIB_GENERIC12:
+ case VERT_ATTRIB_GENERIC13:
+ case VERT_ATTRIB_GENERIC14:
+ case VERT_ATTRIB_GENERIC15:
assert(attr < VERT_ATTRIB_MAX);
vs_input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
vs_input_semantic_index[slot] = num_generic++;
--
cgit v1.2.3
From eb979cef8535914f428d2462e78f713da558fc18 Mon Sep 17 00:00:00 2001
From: Keith Whitwell
Date: Tue, 28 Apr 2009 14:50:05 +0100
Subject: gallium/draw: add ability to print out active pipeline stages
---
src/gallium/auxiliary/draw/draw_pipe.h | 1 +
src/gallium/auxiliary/draw/draw_pipe_aaline.c | 1 +
src/gallium/auxiliary/draw/draw_pipe_aapoint.c | 1 +
src/gallium/auxiliary/draw/draw_pipe_clip.c | 1 +
src/gallium/auxiliary/draw/draw_pipe_cull.c | 1 +
src/gallium/auxiliary/draw/draw_pipe_flatshade.c | 1 +
src/gallium/auxiliary/draw/draw_pipe_offset.c | 1 +
src/gallium/auxiliary/draw/draw_pipe_pstipple.c | 1 +
src/gallium/auxiliary/draw/draw_pipe_stipple.c | 1 +
src/gallium/auxiliary/draw/draw_pipe_twoside.c | 1 +
src/gallium/auxiliary/draw/draw_pipe_unfilled.c | 1 +
src/gallium/auxiliary/draw/draw_pipe_validate.c | 11 ++++++++++-
src/gallium/auxiliary/draw/draw_pipe_vbuf.c | 1 +
src/gallium/auxiliary/draw/draw_pipe_wide_line.c | 1 +
src/gallium/auxiliary/draw/draw_pipe_wide_point.c | 1 +
15 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/src/gallium/auxiliary/draw/draw_pipe.h b/src/gallium/auxiliary/draw/draw_pipe.h
index dbad8f98ac..479250729f 100644
--- a/src/gallium/auxiliary/draw/draw_pipe.h
+++ b/src/gallium/auxiliary/draw/draw_pipe.h
@@ -57,6 +57,7 @@ struct draw_stage
struct draw_context *draw; /**< parent context */
struct draw_stage *next; /**< next stage in pipeline */
+ const char *name; /**< for debugging */
struct vertex_header **tmp; /**< temp vert storage, such as for clipping */
unsigned nr_tmps;
diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c b/src/gallium/auxiliary/draw/draw_pipe_aaline.c
index ca69f0b95e..9fedeef2d3 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_aaline.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_aaline.c
@@ -746,6 +746,7 @@ draw_aaline_stage(struct draw_context *draw)
goto fail;
aaline->stage.draw = draw;
+ aaline->stage.name = "aaline";
aaline->stage.next = NULL;
aaline->stage.point = draw_pipe_passthrough_point;
aaline->stage.line = aaline_first_line;
diff --git a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c
index 3133abe5dc..66839f7873 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c
@@ -757,6 +757,7 @@ draw_aapoint_stage(struct draw_context *draw)
goto fail;
aapoint->stage.draw = draw;
+ aapoint->stage.name = "aapoint";
aapoint->stage.next = NULL;
aapoint->stage.point = aapoint_first_point;
aapoint->stage.line = draw_pipe_passthrough_line;
diff --git a/src/gallium/auxiliary/draw/draw_pipe_clip.c b/src/gallium/auxiliary/draw/draw_pipe_clip.c
index 3265dcd154..0670268a19 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_clip.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_clip.c
@@ -496,6 +496,7 @@ struct draw_stage *draw_clip_stage( struct draw_context *draw )
goto fail;
clipper->stage.draw = draw;
+ clipper->stage.name = "clipper";
clipper->stage.point = clip_point;
clipper->stage.line = clip_first_line;
clipper->stage.tri = clip_first_tri;
diff --git a/src/gallium/auxiliary/draw/draw_pipe_cull.c b/src/gallium/auxiliary/draw/draw_pipe_cull.c
index 053be5f050..0a70483858 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_cull.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_cull.c
@@ -129,6 +129,7 @@ struct draw_stage *draw_cull_stage( struct draw_context *draw )
goto fail;
cull->stage.draw = draw;
+ cull->stage.name = "cull";
cull->stage.next = NULL;
cull->stage.point = draw_pipe_passthrough_point;
cull->stage.line = draw_pipe_passthrough_line;
diff --git a/src/gallium/auxiliary/draw/draw_pipe_flatshade.c b/src/gallium/auxiliary/draw/draw_pipe_flatshade.c
index 43d1fecc4d..34afb1a0b6 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_flatshade.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_flatshade.c
@@ -261,6 +261,7 @@ struct draw_stage *draw_flatshade_stage( struct draw_context *draw )
goto fail;
flatshade->stage.draw = draw;
+ flatshade->stage.name = "flatshade";
flatshade->stage.next = NULL;
flatshade->stage.point = draw_pipe_passthrough_point;
flatshade->stage.line = flatshade_first_line;
diff --git a/src/gallium/auxiliary/draw/draw_pipe_offset.c b/src/gallium/auxiliary/draw/draw_pipe_offset.c
index 62c31532d0..40798a5d6e 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_offset.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_offset.c
@@ -166,6 +166,7 @@ struct draw_stage *draw_offset_stage( struct draw_context *draw )
draw_alloc_temp_verts( &offset->stage, 3 );
offset->stage.draw = draw;
+ offset->stage.name = "offset";
offset->stage.next = NULL;
offset->stage.point = draw_pipe_passthrough_point;
offset->stage.line = draw_pipe_passthrough_line;
diff --git a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
index 04e59152c5..9287fc130e 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
@@ -586,6 +586,7 @@ draw_pstip_stage(struct draw_context *draw)
draw_alloc_temp_verts( &pstip->stage, 8 );
pstip->stage.draw = draw;
+ pstip->stage.name = "pstip";
pstip->stage.next = NULL;
pstip->stage.point = draw_pipe_passthrough_point;
pstip->stage.line = draw_pipe_passthrough_line;
diff --git a/src/gallium/auxiliary/draw/draw_pipe_stipple.c b/src/gallium/auxiliary/draw/draw_pipe_stipple.c
index b65e2aa102..6e921bac27 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_stipple.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_stipple.c
@@ -238,6 +238,7 @@ struct draw_stage *draw_stipple_stage( struct draw_context *draw )
draw_alloc_temp_verts( &stipple->stage, 2 );
stipple->stage.draw = draw;
+ stipple->stage.name = "stipple";
stipple->stage.next = NULL;
stipple->stage.point = stipple_reset_point;
stipple->stage.line = stipple_first_line;
diff --git a/src/gallium/auxiliary/draw/draw_pipe_twoside.c b/src/gallium/auxiliary/draw/draw_pipe_twoside.c
index c329d92339..eef0238b15 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_twoside.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_twoside.c
@@ -181,6 +181,7 @@ struct draw_stage *draw_twoside_stage( struct draw_context *draw )
goto fail;
twoside->stage.draw = draw;
+ twoside->stage.name = "twoside";
twoside->stage.next = NULL;
twoside->stage.point = draw_pipe_passthrough_point;
twoside->stage.line = draw_pipe_passthrough_line;
diff --git a/src/gallium/auxiliary/draw/draw_pipe_unfilled.c b/src/gallium/auxiliary/draw/draw_pipe_unfilled.c
index 68835fd1a5..03bb842e20 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_unfilled.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_unfilled.c
@@ -184,6 +184,7 @@ struct draw_stage *draw_unfilled_stage( struct draw_context *draw )
goto fail;
unfilled->stage.draw = draw;
+ unfilled->stage.name = "unfilled";
unfilled->stage.next = NULL;
unfilled->stage.tmp = NULL;
unfilled->stage.point = draw_pipe_passthrough_point;
diff --git a/src/gallium/auxiliary/draw/draw_pipe_validate.c b/src/gallium/auxiliary/draw/draw_pipe_validate.c
index 03e842ce08..bea90e50d3 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_validate.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_validate.c
@@ -262,7 +262,15 @@ static struct draw_stage *validate_pipeline( struct draw_stage *stage )
draw->pipeline.first = next;
- return next;
+
+ if (0) {
+ debug_printf("draw pipeline:\n");
+ for (next = draw->pipeline.first; next ; next = next->next )
+ debug_printf(" %s\n", next->name);
+ debug_printf("\n");
+ }
+
+ return draw->pipeline.first;
}
static void validate_tri( struct draw_stage *stage,
@@ -318,6 +326,7 @@ struct draw_stage *draw_validate_stage( struct draw_context *draw )
return NULL;
stage->draw = draw;
+ stage->name = "validate";
stage->next = NULL;
stage->point = validate_point;
stage->line = validate_line;
diff --git a/src/gallium/auxiliary/draw/draw_pipe_vbuf.c b/src/gallium/auxiliary/draw/draw_pipe_vbuf.c
index 12325d30d6..a5d840b96e 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_vbuf.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_vbuf.c
@@ -446,6 +446,7 @@ struct draw_stage *draw_vbuf_stage( struct draw_context *draw,
goto fail;
vbuf->stage.draw = draw;
+ vbuf->stage.name = "vbuf";
vbuf->stage.point = vbuf_first_point;
vbuf->stage.line = vbuf_first_line;
vbuf->stage.tri = vbuf_first_tri;
diff --git a/src/gallium/auxiliary/draw/draw_pipe_wide_line.c b/src/gallium/auxiliary/draw/draw_pipe_wide_line.c
index 184e363594..f32cbef983 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_wide_line.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_wide_line.c
@@ -168,6 +168,7 @@ struct draw_stage *draw_wide_line_stage( struct draw_context *draw )
draw_alloc_temp_verts( &wide->stage, 4 );
wide->stage.draw = draw;
+ wide->stage.name = "wide-line";
wide->stage.next = NULL;
wide->stage.point = draw_pipe_passthrough_point;
wide->stage.line = wideline_line;
diff --git a/src/gallium/auxiliary/draw/draw_pipe_wide_point.c b/src/gallium/auxiliary/draw/draw_pipe_wide_point.c
index e1af9e56a2..49034ae86a 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_wide_point.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_wide_point.c
@@ -279,6 +279,7 @@ struct draw_stage *draw_wide_point_stage( struct draw_context *draw )
goto fail;
wide->stage.draw = draw;
+ wide->stage.name = "wide-point";
wide->stage.next = NULL;
wide->stage.point = widepoint_first_point;
wide->stage.line = draw_pipe_passthrough_line;
--
cgit v1.2.3
From 106f2b031cbb83a54fa2949cb07357ecea68b92a Mon Sep 17 00:00:00 2001
From: Keith Whitwell
Date: Tue, 28 Apr 2009 14:51:11 +0100
Subject: mesa/st: remove duplicate offset calculation
---
src/mesa/state_tracker/st_atom_rasterizer.c | 17 +----------------
src/mesa/state_tracker/st_context.h | 2 --
2 files changed, 1 insertion(+), 18 deletions(-)
diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c b/src/mesa/state_tracker/st_atom_rasterizer.c
index 61687fbc3e..4e70510c0c 100644
--- a/src/mesa/state_tracker/st_atom_rasterizer.c
+++ b/src/mesa/state_tracker/st_atom_rasterizer.c
@@ -180,22 +180,7 @@ static void update_raster_state( struct st_context *st )
if (ctx->Polygon.StippleFlag)
raster->poly_stipple_enable = 1;
-
-
- /* _NEW_BUFFERS, _NEW_POLYGON
- */
- if (raster->fill_cw != PIPE_POLYGON_MODE_FILL ||
- raster->fill_ccw != PIPE_POLYGON_MODE_FILL)
- {
- GLfloat mrd = (ctx->DrawBuffer ?
- ctx->DrawBuffer->_MRD :
- 1.0f);
-
- raster->offset_units = ctx->Polygon.OffsetFactor * mrd;
- raster->offset_scale = (ctx->Polygon.OffsetUnits * mrd *
- st->polygon_offset_scale);
- }
-
+
/* _NEW_POINT
*/
raster->point_size = ctx->Point.Size;
diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h
index f840579a40..6ffed56d9a 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -120,8 +120,6 @@ struct st_context
GLboolean missing_textures;
- GLfloat polygon_offset_scale; /* ?? */
-
/** Mapping from VERT_RESULT_x to post-transformed vertex slot */
const GLuint *vertex_result_to_slot;
--
cgit v1.2.3
From c0bff53334194f9d1aada23510123f1591d5512e Mon Sep 17 00:00:00 2001
From: Keith Whitwell
Date: Tue, 28 Apr 2009 17:49:50 +0100
Subject: mesa/main: protect driver.finish with FLUSH_CURRENT
Already doing this for driver.flush()
---
src/mesa/main/context.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 4469c8e1fa..016284de9a 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1497,6 +1497,7 @@ _mesa_Finish(void)
{
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ FLUSH_CURRENT( ctx, 0 );
if (ctx->Driver.Finish) {
ctx->Driver.Finish(ctx);
}
--
cgit v1.2.3
From 801a33ae44355b89cebed47e9e48e39545522f6e Mon Sep 17 00:00:00 2001
From: Keith Whitwell
Date: Tue, 28 Apr 2009 17:50:19 +0100
Subject: mesa/st: protect internal flushes with FLUSH_CURRENT
Already doing this for driver.flush()
---
src/mesa/state_tracker/st_cb_flush.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/mesa/state_tracker/st_cb_flush.c b/src/mesa/state_tracker/st_cb_flush.c
index 7d7d3823c9..fbaffd154f 100644
--- a/src/mesa/state_tracker/st_cb_flush.c
+++ b/src/mesa/state_tracker/st_cb_flush.c
@@ -82,7 +82,7 @@ display_front_buffer(struct st_context *st)
void st_flush( struct st_context *st, uint pipeFlushFlags,
struct pipe_fence_handle **fence )
{
- FLUSH_VERTICES(st->ctx, 0);
+ FLUSH_CURRENT(st->ctx, 0);
/* Release any vertex buffers that might potentially be accessed in
* successive frames:
--
cgit v1.2.3
From 46ddcbc1a9e70d5dba257e6421eb69ed942dd1da Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Tue, 28 Apr 2009 14:29:27 -0600
Subject: softpipe: return PIPE_UNREFERENCED in
softpipe_is_buffer/texture_referenced()
This allows the engine demo to run again (avoid crash in VBO code).
This stuff still needs to be revisited someday though...
---
src/gallium/drivers/softpipe/sp_context.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c
index 11aff81479..62e8d99cfd 100644
--- a/src/gallium/drivers/softpipe/sp_context.c
+++ b/src/gallium/drivers/softpipe/sp_context.c
@@ -126,14 +126,14 @@ softpipe_is_texture_referenced( struct pipe_context *pipe,
struct pipe_texture *texture,
unsigned face, unsigned level)
{
- return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
+ return PIPE_UNREFERENCED;
}
static unsigned int
softpipe_is_buffer_referenced( struct pipe_context *pipe,
struct pipe_buffer *buf)
{
- return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
+ return PIPE_UNREFERENCED;
}
struct pipe_context *
--
cgit v1.2.3
From 0e85dcb66b990a63d60032816798ff693f9248e7 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Wed, 29 Apr 2009 11:52:06 -0600
Subject: mesa: added _mesa_check_soa_dependencies() function
This function will check an instruction to see if there's data dependencies
between the dst and src registers if executed in an SOA manner.
---
src/mesa/shader/prog_instruction.c | 50 ++++++++++++++++++++++++++++++++++++++
src/mesa/shader/prog_instruction.h | 3 +++
2 files changed, 53 insertions(+)
diff --git a/src/mesa/shader/prog_instruction.c b/src/mesa/shader/prog_instruction.c
index ca7565c091..ae3a003fee 100644
--- a/src/mesa/shader/prog_instruction.c
+++ b/src/mesa/shader/prog_instruction.c
@@ -285,6 +285,56 @@ _mesa_is_tex_instruction(gl_inst_opcode opcode)
}
+/**
+ * Check if there's a potential src/dst register data dependency when
+ * using SOA execution.
+ * Example:
+ * MOV T, T.yxwz;
+ * This would expand into:
+ * MOV t0, t1;
+ * MOV t1, t0;
+ * MOV t2, t3;
+ * MOV t3, t2;
+ * The second instruction will have the wrong value for t0 if executed as-is.
+ */
+GLboolean
+_mesa_check_soa_dependencies(const struct prog_instruction *inst)
+{
+ GLuint i, chan;
+
+ if (inst->DstReg.WriteMask == WRITEMASK_X ||
+ inst->DstReg.WriteMask == WRITEMASK_Y ||
+ inst->DstReg.WriteMask == WRITEMASK_Z ||
+ inst->DstReg.WriteMask == WRITEMASK_W ||
+ inst->DstReg.WriteMask == 0x0) {
+ /* no chance of data dependency */
+ return GL_FALSE;
+ }
+
+ /* loop over src regs */
+ for (i = 0; i < 3; i++) {
+ if (inst->SrcReg[i].File == inst->DstReg.File &&
+ inst->SrcReg[i].Index == inst->DstReg.Index) {
+ /* loop over dest channels */
+ GLuint channelsWritten = 0x0;
+ for (chan = 0; chan < 4; chan++) {
+ if (inst->DstReg.WriteMask & (1 << chan)) {
+ /* check if we're reading a channel that's been written */
+ GLuint swizzle = GET_SWZ(inst->SrcReg[i].Swizzle, chan);
+ if (swizzle <= SWIZZLE_W &&
+ (channelsWritten & (1 << swizzle))) {
+ return GL_TRUE;
+ }
+
+ channelsWritten |= (1 << chan);
+ }
+ }
+ }
+ }
+ return GL_FALSE;
+}
+
+
/**
* Return string name for given program opcode.
*/
diff --git a/src/mesa/shader/prog_instruction.h b/src/mesa/shader/prog_instruction.h
index 3109f6cbae..40ad998f79 100644
--- a/src/mesa/shader/prog_instruction.h
+++ b/src/mesa/shader/prog_instruction.h
@@ -428,6 +428,9 @@ _mesa_num_inst_dst_regs(gl_inst_opcode opcode);
extern GLboolean
_mesa_is_tex_instruction(gl_inst_opcode opcode);
+extern GLboolean
+_mesa_check_soa_dependencies(const struct prog_instruction *inst);
+
extern const char *
_mesa_opcode_string(gl_inst_opcode opcode);
--
cgit v1.2.3
From 8fa6c1ac9299402c1faf75b264cf70b1b83d1eff Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Wed, 29 Apr 2009 11:56:57 -0600
Subject: tgsi: added tgsi_check_soa_dependencies() and related debug code
(disabled)
The TGSI interpeter operates in SOA style. We need to check for data
dependencies in instructions which read from and write to the same register.
For now just adding some debug code to detect that condition. Actual fixes
to follow.
---
src/gallium/auxiliary/tgsi/tgsi_exec.c | 62 ++++++++++++++++++++++++++++++++++
1 file changed, 62 insertions(+)
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index e8bd7cda3b..aba7a3f937 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -53,6 +53,7 @@
#include "pipe/p_compiler.h"
#include "pipe/p_state.h"
#include "pipe/p_shader_tokens.h"
+#include "tgsi/tgsi_dump.h"
#include "tgsi/tgsi_parse.h"
#include "tgsi/tgsi_util.h"
#include "tgsi_exec.h"
@@ -169,6 +170,56 @@ print_temp(const struct tgsi_exec_machine *mach, uint index)
#endif
+/**
+ * Check if there's a potential src/dst register data dependency when
+ * using SOA execution.
+ * Example:
+ * MOV T, T.yxwz;
+ * This would expand into:
+ * MOV t0, t1;
+ * MOV t1, t0;
+ * MOV t2, t3;
+ * MOV t3, t2;
+ * The second instruction will have the wrong value for t0 if executed as-is.
+ */
+static boolean
+tgsi_check_soa_dependencies(const struct tgsi_full_instruction *inst)
+{
+ uint i, chan;
+
+ uint writemask = inst->FullDstRegisters[0].DstRegister.WriteMask;
+ if (writemask == TGSI_WRITEMASK_X ||
+ writemask == TGSI_WRITEMASK_Y ||
+ writemask == TGSI_WRITEMASK_Z ||
+ writemask == TGSI_WRITEMASK_W ||
+ writemask == TGSI_WRITEMASK_NONE) {
+ /* no chance of data dependency */
+ return FALSE;
+ }
+
+ /* loop over src regs */
+ for (i = 0; i < inst->Instruction.NumSrcRegs; i++) {
+ if ((inst->FullSrcRegisters[i].SrcRegister.File ==
+ inst->FullDstRegisters[0].DstRegister.File) &&
+ (inst->FullSrcRegisters[i].SrcRegister.Index ==
+ inst->FullDstRegisters[0].DstRegister.Index)) {
+ /* loop over dest channels */
+ uint channelsWritten = 0x0;
+ FOR_EACH_ENABLED_CHANNEL(*inst, chan) {
+ /* check if we're reading a channel that's been written */
+ uint swizzle = tgsi_util_get_full_src_register_extswizzle(&inst->FullSrcRegisters[i], chan);
+ if (swizzle <= TGSI_SWIZZLE_W &&
+ (channelsWritten & (1 << swizzle))) {
+ return TRUE;
+ }
+
+ channelsWritten |= (1 << chan);
+ }
+ }
+ }
+ return FALSE;
+}
+
/**
* Initialize machine state by expanding tokens to full instructions,
@@ -280,6 +331,17 @@ tgsi_exec_machine_bind_shader(
memcpy(instructions + numInstructions,
&parse.FullToken.FullInstruction,
sizeof(instructions[0]));
+
+#if 0
+ if (tgsi_check_soa_dependencies(&parse.FullToken.FullInstruction)) {
+ debug_printf("SOA dependency in instruction:\n");
+ tgsi_dump_instruction(&parse.FullToken.FullInstruction,
+ numInstructions);
+ }
+#else
+ (void) tgsi_check_soa_dependencies;
+#endif
+
numInstructions++;
break;
--
cgit v1.2.3
From dca190e9432d4ed122bdd534922d0c3d85791c6a Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Wed, 29 Apr 2009 11:52:06 -0600
Subject: mesa: added _mesa_check_soa_dependencies() function
This function will check an instruction to see if there's data dependencies
between the dst and src registers if executed in an SOA manner.
---
src/mesa/shader/prog_instruction.c | 50 ++++++++++++++++++++++++++++++++++++++
src/mesa/shader/prog_instruction.h | 3 +++
2 files changed, 53 insertions(+)
diff --git a/src/mesa/shader/prog_instruction.c b/src/mesa/shader/prog_instruction.c
index ca7565c091..ae3a003fee 100644
--- a/src/mesa/shader/prog_instruction.c
+++ b/src/mesa/shader/prog_instruction.c
@@ -285,6 +285,56 @@ _mesa_is_tex_instruction(gl_inst_opcode opcode)
}
+/**
+ * Check if there's a potential src/dst register data dependency when
+ * using SOA execution.
+ * Example:
+ * MOV T, T.yxwz;
+ * This would expand into:
+ * MOV t0, t1;
+ * MOV t1, t0;
+ * MOV t2, t3;
+ * MOV t3, t2;
+ * The second instruction will have the wrong value for t0 if executed as-is.
+ */
+GLboolean
+_mesa_check_soa_dependencies(const struct prog_instruction *inst)
+{
+ GLuint i, chan;
+
+ if (inst->DstReg.WriteMask == WRITEMASK_X ||
+ inst->DstReg.WriteMask == WRITEMASK_Y ||
+ inst->DstReg.WriteMask == WRITEMASK_Z ||
+ inst->DstReg.WriteMask == WRITEMASK_W ||
+ inst->DstReg.WriteMask == 0x0) {
+ /* no chance of data dependency */
+ return GL_FALSE;
+ }
+
+ /* loop over src regs */
+ for (i = 0; i < 3; i++) {
+ if (inst->SrcReg[i].File == inst->DstReg.File &&
+ inst->SrcReg[i].Index == inst->DstReg.Index) {
+ /* loop over dest channels */
+ GLuint channelsWritten = 0x0;
+ for (chan = 0; chan < 4; chan++) {
+ if (inst->DstReg.WriteMask & (1 << chan)) {
+ /* check if we're reading a channel that's been written */
+ GLuint swizzle = GET_SWZ(inst->SrcReg[i].Swizzle, chan);
+ if (swizzle <= SWIZZLE_W &&
+ (channelsWritten & (1 << swizzle))) {
+ return GL_TRUE;
+ }
+
+ channelsWritten |= (1 << chan);
+ }
+ }
+ }
+ }
+ return GL_FALSE;
+}
+
+
/**
* Return string name for given program opcode.
*/
diff --git a/src/mesa/shader/prog_instruction.h b/src/mesa/shader/prog_instruction.h
index 3109f6cbae..40ad998f79 100644
--- a/src/mesa/shader/prog_instruction.h
+++ b/src/mesa/shader/prog_instruction.h
@@ -428,6 +428,9 @@ _mesa_num_inst_dst_regs(gl_inst_opcode opcode);
extern GLboolean
_mesa_is_tex_instruction(gl_inst_opcode opcode);
+extern GLboolean
+_mesa_check_soa_dependencies(const struct prog_instruction *inst);
+
extern const char *
_mesa_opcode_string(gl_inst_opcode opcode);
--
cgit v1.2.3
From 356f311c4a3ee91a4afe33d210dd4c5fdc897ea3 Mon Sep 17 00:00:00 2001
From: Dan Nicholson
Date: Wed, 29 Apr 2009 06:49:27 -0700
Subject: autoconf: Clean up some m4 usage
m4_fatal is equivalent to m4_errprint + m4_exit.
---
configure.ac | 22 +++++++---------------
1 file changed, 7 insertions(+), 15 deletions(-)
diff --git a/configure.ac b/configure.ac
index 7b07f0fa7c..154f6e6352 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5,12 +5,8 @@ AC_PREREQ([2.59])
dnl Versioning - scrape the version from configs/default
m4_define([mesa_version],
[m4_esyscmd([${MAKE-make} -s -f bin/version.mk version | tr -d '\n'])])
-m4_ifval(mesa_version,[],[
- m4_errprint([Error: Failed to get the Mesa version from the output of
- running `make -f bin/version.mk version'
-])
- m4_exit([1])
-])
+m4_ifval(mesa_version,,
+ [m4_fatal([Failed to get the Mesa version from `make -f bin/version.mk version`])])
dnl Tell the user about autoconf.html in the --help output
m4_divert_once([HELP_END], [
@@ -58,15 +54,11 @@ fi
AC_SUBST([MKDEP_OPTIONS])
dnl Make sure the pkg-config macros are defined
-m4_ifdef([PKG_PROG_PKG_CONFIG],[],[
- m4_errprint([Error: Could not locate the pkg-config autoconf macros.
- These are usually located in /usr/share/aclocal/pkg.m4. If your
- macros are in a different location, try setting the environment
- variable ACLOCAL="aclocal -I/other/macro/dir" before running
- autoreconf.
-])
- m4_exit([1])
-])
+m4_ifndef([PKG_PROG_PKG_CONFIG],
+ [m4_fatal([Could not locate the pkg-config autoconf macros.
+ These are usually located in /usr/share/aclocal/pkg.m4. If your macros
+ are in a different location, try setting the environment variable
+ ACLOCAL="aclocal -I/other/macro/dir" before running autoreconf.])])
PKG_PROG_PKG_CONFIG()
dnl LIB_DIR - library basename
--
cgit v1.2.3
From 66f978625685d83b04c32b19b62c3cb8c0d25f74 Mon Sep 17 00:00:00 2001
From: Dan Nicholson
Date: Wed, 29 Apr 2009 12:11:43 -0700
Subject: autoconf: Add switch for optional EGL
EGL doesn't build on all platforms, so allow people to opt out.
---
configure.ac | 32 +++++++++++++++++++++++---------
1 file changed, 23 insertions(+), 9 deletions(-)
diff --git a/configure.ac b/configure.ac
index 154f6e6352..8110e0f869 100644
--- a/configure.ac
+++ b/configure.ac
@@ -403,7 +403,7 @@ esac
dnl
dnl Driver specific build directories
dnl
-SRC_DIRS="mesa egl glew"
+SRC_DIRS="mesa glew"
GLU_DIRS="sgi"
WINDOW_SYSTEM=""
GALLIUM_DIRS="auxiliary drivers state_trackers"
@@ -857,14 +857,23 @@ AC_SUBST([OSMESA_PC_LIB_PRIV])
dnl
dnl EGL configuration
dnl
-if test "$x11_pkgconfig" = yes; then
- PKG_CHECK_MODULES([EGL],[x11])
- EGL_LIB_DEPS="$EGL_LIBS"
-else
- # should check these...
- EGL_LIB_DEPS="$X_LIBS -lX11"
+AC_ARG_ENABLE([egl],
+ [AS_HELP_STRING([--disable-egl],
+ [disable EGL library @<:@default=enabled@:>@])],
+ [enable_egl="$enableval"],
+ [enable_egl=yes])
+if test "x$enable_egl" = xyes; then
+ SRC_DIRS="$SRC_DIRS egl"
+
+ if test "$x11_pkgconfig" = yes; then
+ PKG_CHECK_MODULES([EGL], [x11])
+ EGL_LIB_DEPS="$EGL_LIBS"
+ else
+ # should check these...
+ EGL_LIB_DEPS="$X_LIBS -lX11"
+ fi
+ EGL_LIB_DEPS="$EGL_LIB_DEPS $DLOPEN_LIBS"
fi
-EGL_LIB_DEPS="$EGL_LIB_DEPS $DLOPEN_LIBS"
AC_SUBST([EGL_LIB_DEPS])
dnl
@@ -1108,7 +1117,7 @@ yes)
GALLIUM_STATE_TRACKERS_DIRS=glx
;;
dri)
- GALLIUM_STATE_TRACKERS_DIRS=egl
+ test "x$enable_egl" = xyes && GALLIUM_STATE_TRACKERS_DIRS=egl
;;
esac
;;
@@ -1118,6 +1127,10 @@ yes)
for tracker in $state_trackers; do
test -d "$srcdir/src/gallium/state_trackers/$tracker" || \
AC_MSG_ERROR([state tracker '$tracker' doesn't exist])
+
+ if test "$tracker" = egl && test "x$enable_egl" != xyes; then
+ AC_MSG_ERROR([cannot build egl state tracker without EGL library])
+ fi
done
GALLIUM_STATE_TRACKERS_DIRS="$state_trackers"
;;
@@ -1233,6 +1246,7 @@ dnl Libraries
echo ""
echo " Shared libs: $enable_shared"
echo " Static libs: $enable_static"
+echo " EGL: $enable_egl"
echo " GLU: $enable_glu"
echo " GLw: $enable_glw (Motif: $enable_motif)"
echo " glut: $enable_glut"
--
cgit v1.2.3
From a9c97c5f2a9b880d01336a23134600e4b34429d0 Mon Sep 17 00:00:00 2001
From: Tom Fogal
Date: Wed, 29 Apr 2009 10:32:46 -0600
Subject: Use variable library name in pkg-config output.
Previously the pkg-config output files would contain e.g. `-lGL'
and `-lGLU', even if the user modified their configuration to
build libraries with different names. This modifies the
pkg-config inputs, and corresponding makery, so that modifying the
output library name will cause the appropriate updated name to
appear in the pkg-config `-l' option.
Signed-off-by: Dan Nicholson
---
src/glu/Makefile | 3 ++-
src/glu/glu.pc.in | 2 +-
src/glut/glx/Makefile | 3 ++-
src/glut/glx/glut.pc.in | 2 +-
src/glut/mini/Makefile | 3 ++-
src/glut/mini/glut.pc.in | 2 +-
src/glw/Makefile | 3 ++-
src/glw/glw.pc.in | 2 +-
src/mesa/Makefile | 3 ++-
src/mesa/gl.pc.in | 2 +-
10 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/src/glu/Makefile b/src/glu/Makefile
index e519dfeec4..5c26ead1bb 100644
--- a/src/glu/Makefile
+++ b/src/glu/Makefile
@@ -22,7 +22,8 @@ pcedit = sed \
-e 's,@GLU_PC_REQ@,$(GLU_PC_REQ),' \
-e 's,@GLU_PC_REQ_PRIV@,$(GLU_PC_REQ_PRIV),' \
-e 's,@GLU_PC_LIB_PRIV@,$(GLU_PC_LIB_PRIV),' \
- -e 's,@GLU_PC_CFLAGS@,$(GLU_PC_CFLAGS),'
+ -e 's,@GLU_PC_CFLAGS@,$(GLU_PC_CFLAGS),' \
+ -e 's,@GLU_LIB@,$(GLU_LIB),'
glu.pc: glu.pc.in
$(pcedit) $< > $@
diff --git a/src/glu/glu.pc.in b/src/glu/glu.pc.in
index bc2517e90e..f7d9109823 100644
--- a/src/glu/glu.pc.in
+++ b/src/glu/glu.pc.in
@@ -8,6 +8,6 @@ Description: Mesa OpenGL Utility library
Requires: @GLU_PC_REQ@
Requires.private: @GLU_PC_REQ_PRIV@
Version: @VERSION@
-Libs: -L${libdir} -lGLU
+Libs: -L${libdir} -l@GLU_LIB@
Libs.private: @GLU_PC_LIB_PRIV@
Cflags: -I${includedir} @GLU_PC_CFLAGS@
diff --git a/src/glut/glx/Makefile b/src/glut/glx/Makefile
index 9a975bbc60..1b072906c7 100644
--- a/src/glut/glx/Makefile
+++ b/src/glut/glx/Makefile
@@ -107,7 +107,8 @@ pcedit = sed \
-e 's,@VERSION@,$(GLUT_MAJOR).$(GLUT_MINOR).$(GLUT_TINY),' \
-e 's,@GLUT_PC_REQ_PRIV@,$(GLUT_PC_REQ_PRIV),' \
-e 's,@GLUT_PC_LIB_PRIV@,$(GLUT_PC_LIB_PRIV),' \
- -e 's,@GLUT_PC_CFLAGS@,$(GLUT_PC_CFLAGS),'
+ -e 's,@GLUT_PC_CFLAGS@,$(GLUT_PC_CFLAGS),' \
+ -e 's,@GLUT_LIB@,$(GLUT_LIB),'
glut.pc: glut.pc.in
$(pcedit) $< > $@
diff --git a/src/glut/glx/glut.pc.in b/src/glut/glx/glut.pc.in
index ae0689d7e8..151dd0b802 100644
--- a/src/glut/glx/glut.pc.in
+++ b/src/glut/glx/glut.pc.in
@@ -8,6 +8,6 @@ Description: Mesa OpenGL Utility Toolkit library
Requires: gl glu
Requires.private: @GLUT_PC_REQ_PRIV@
Version: @VERSION@
-Libs: -L${libdir} -lglut
+Libs: -L${libdir} -l@GLUT_LIB@
Libs.private: @GLUT_PC_LIB_PRIV@
Cflags: -I${includedir} @GLUT_PC_CFLAGS@
diff --git a/src/glut/mini/Makefile b/src/glut/mini/Makefile
index 841a473f89..0e42436133 100644
--- a/src/glut/mini/Makefile
+++ b/src/glut/mini/Makefile
@@ -81,7 +81,8 @@ pcedit = sed \
-e 's,@VERSION@,$(GLUT_MAJOR).$(GLUT_MINOR).$(GLUT_TINY),' \
-e 's,@GLUT_PC_REQ_PRIV@,$(GLUT_PC_REQ_PRIV),' \
-e 's,@GLUT_PC_LIB_PRIV@,$(GLUT_PC_LIB_PRIV),' \
- -e 's,@GLUT_PC_CFLAGS@,$(GLUT_PC_CFLAGS),'
+ -e 's,@GLUT_PC_CFLAGS@,$(GLUT_PC_CFLAGS),' \
+ -e 's,@GLUT_LIB@,$(GLUT_LIB),'
glut.pc: glut.pc.in
$(pcedit) $< > $@
diff --git a/src/glut/mini/glut.pc.in b/src/glut/mini/glut.pc.in
index ae0689d7e8..151dd0b802 100644
--- a/src/glut/mini/glut.pc.in
+++ b/src/glut/mini/glut.pc.in
@@ -8,6 +8,6 @@ Description: Mesa OpenGL Utility Toolkit library
Requires: gl glu
Requires.private: @GLUT_PC_REQ_PRIV@
Version: @VERSION@
-Libs: -L${libdir} -lglut
+Libs: -L${libdir} -l@GLUT_LIB@
Libs.private: @GLUT_PC_LIB_PRIV@
Cflags: -I${includedir} @GLUT_PC_CFLAGS@
diff --git a/src/glw/Makefile b/src/glw/Makefile
index b153a6df75..d88d773313 100644
--- a/src/glw/Makefile
+++ b/src/glw/Makefile
@@ -33,7 +33,8 @@ pcedit = sed \
-e 's,@VERSION@,$(MAJOR).$(MINOR).$(TINY),' \
-e 's,@GLW_PC_REQ_PRIV@,$(GLW_PC_REQ_PRIV),' \
-e 's,@GLW_PC_LIB_PRIV@,$(GLW_PC_LIB_PRIV),' \
- -e 's,@GLW_PC_CFLAGS@,$(GLW_PC_CFLAGS),'
+ -e 's,@GLW_PC_CFLAGS@,$(GLW_PC_CFLAGS),' \
+ -e 's,@GLW_LIB@,$(GLW_LIB),'
glw.pc: glw.pc.in
$(pcedit) $< > $@
diff --git a/src/glw/glw.pc.in b/src/glw/glw.pc.in
index 5493093be1..19a7c307c0 100644
--- a/src/glw/glw.pc.in
+++ b/src/glw/glw.pc.in
@@ -8,6 +8,6 @@ Description: Mesa OpenGL widget library
Requires: gl
Requires.private: @GLW_PC_REQ_PRIV@
Version: @VERSION@
-Libs: -L${libdir} -lGLw
+Libs: -L${libdir} -l@GLW_LIB@
Libs.private: @GLW_PC_LIB_PRIV@
Cflags: -I${includedir} @GLW_PC_CFLAGS@
diff --git a/src/mesa/Makefile b/src/mesa/Makefile
index 4ff28dae9b..bb18bee8ea 100644
--- a/src/mesa/Makefile
+++ b/src/mesa/Makefile
@@ -103,7 +103,8 @@ gl_pcedit = sed \
-e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \
-e 's,@GL_PC_REQ_PRIV@,$(GL_PC_REQ_PRIV),' \
-e 's,@GL_PC_LIB_PRIV@,$(GL_PC_LIB_PRIV),' \
- -e 's,@GL_PC_CFLAGS@,$(GL_PC_CFLAGS),'
+ -e 's,@GL_PC_CFLAGS@,$(GL_PC_CFLAGS),' \
+ -e 's,@GL_LIB@,$(GL_LIB),'
gl.pc: gl.pc.in
$(gl_pcedit) $< > $@
diff --git a/src/mesa/gl.pc.in b/src/mesa/gl.pc.in
index 0462b9fca2..97b86596fc 100644
--- a/src/mesa/gl.pc.in
+++ b/src/mesa/gl.pc.in
@@ -7,6 +7,6 @@ Name: gl
Description: Mesa OpenGL library
Requires.private: @GL_PC_REQ_PRIV@
Version: @VERSION@
-Libs: -L${libdir} -lGL
+Libs: -L${libdir} -l@GL_LIB@
Libs.private: @GL_PC_LIB_PRIV@
Cflags: -I${includedir} @GL_PC_CFLAGS@
--
cgit v1.2.3
From 1793d5adac121a2142b662d87e24990ebf209ca3 Mon Sep 17 00:00:00 2001
From: Jakob Bornecrantz
Date: Wed, 29 Apr 2009 20:17:21 +0100
Subject: progs/tests: Add mipmap_comp for mipmap testing with compressed
textures
---
progs/tests/.gitignore | 1 +
progs/tests/Makefile | 1 +
progs/tests/SConscript | 1 +
progs/tests/mipmap_comp.c | 295 ++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 298 insertions(+)
create mode 100644 progs/tests/mipmap_comp.c
diff --git a/progs/tests/.gitignore b/progs/tests/.gitignore
index e6369de3ab..8d05668c07 100644
--- a/progs/tests/.gitignore
+++ b/progs/tests/.gitignore
@@ -49,6 +49,7 @@ mapbufrange
mapvbo
minmag
mipgen
+mipmap_comp
mipmap_limits
mipmap_view
multipal
diff --git a/progs/tests/Makefile b/progs/tests/Makefile
index f5fbf374f7..628ca41535 100644
--- a/progs/tests/Makefile
+++ b/progs/tests/Makefile
@@ -58,6 +58,7 @@ SOURCES = \
mapvbo.c \
minmag.c \
mipgen.c \
+ mipmap_comp.c \
mipmap_limits.c \
mipmap_view.c \
multipal.c \
diff --git a/progs/tests/SConscript b/progs/tests/SConscript
index 4f22ca735c..453fcecd9c 100644
--- a/progs/tests/SConscript
+++ b/progs/tests/SConscript
@@ -81,6 +81,7 @@ progs = [
'mapvbo',
'minmag',
'mipgen',
+ 'mipmap_comp',
'mipmap_limits',
'mipmap_view',
'multipal',
diff --git a/progs/tests/mipmap_comp.c b/progs/tests/mipmap_comp.c
new file mode 100644
index 0000000000..5842e2b880
--- /dev/null
+++ b/progs/tests/mipmap_comp.c
@@ -0,0 +1,295 @@
+/* Copyright (c) Mark J. Kilgard, 1994. */
+/*
+ * (c) Copyright 1993, Silicon Graphics, Inc.
+ * ALL RIGHTS RESERVED
+ * Permission to use, copy, modify, and distribute this software for
+ * any purpose and without fee is hereby granted, provided that the above
+ * copyright notice appear in all copies and that both the copyright notice
+ * and this permission notice appear in supporting documentation, and that
+ * the name of Silicon Graphics, Inc. not be used in advertising
+ * or publicity pertaining to distribution of the software without specific,
+ * written prior permission.
+ *
+ * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
+ * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
+ * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+ * GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
+ * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
+ * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
+ * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
+ * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN
+ * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
+ * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * US Government Users Restricted Rights
+ * Use, duplication, or disclosure by the Government is subject to
+ * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
+ * (c)(1)(ii) of the Rights in Technical Data and Computer Software
+ * clause at DFARS 252.227-7013 and/or in similar or successor
+ * clauses in the FAR or the DOD or NASA FAR Supplement.
+ * Unpublished-- rights reserved under the copyright laws of the
+ * United States. Contractor/manufacturer is Silicon Graphics,
+ * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311.
+ *
+ * OpenGL(TM) is a trademark of Silicon Graphics, Inc.
+ */
+
+/* mipmap_comp
+ * Test compressed texture mipmaps
+ *
+ * Based on mipmap_limits
+ */
+
+#include
+#include
+#include
+#include
+#include
+
+#include "readtex.h"
+
+#define SIZE 16 /* not larger then 16 */
+
+static GLint BaseLevel = 0, MaxLevel = 9;
+static GLfloat MinLod = -1, MaxLod = 9;
+static GLfloat LodBias = 0.0;
+static GLboolean NearestFilter = GL_TRUE;
+static GLuint texImage;
+
+
+static void
+initValues(void)
+{
+ BaseLevel = 0;
+ MaxLevel = 9;
+ MinLod = -1;
+ MaxLod = 2;
+ LodBias = 5.0;
+ NearestFilter = GL_TRUE;
+}
+
+
+static void
+makeImage(int level, int width, int height)
+{
+#if 0
+ GLubyte img[SIZE*SIZE*3];
+ int i, j;
+
+ (void)size;
+ for (i = 0; i < height; i++) {
+ for (j = 0; j < width; j++) {
+ int k = (i * width + j) * 3;
+ img[k + 0] = 255 * ((level + 1) % 2);
+ img[k + 1] = 255 * ((level + 1) % 2);
+ img[k + 2] = 255 * ((level + 1) % 2);
+ }
+ }
+
+ glTexImage2D(GL_TEXTURE_2D, level, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, width, height, 0,
+ GL_RGB, GL_UNSIGNED_BYTE, img);
+#else
+ GLubyte img[128];
+ GLint size[] = {
+ 128, /* 16x16 */
+ 32, /* 8x8 */
+ 8, /* 4x4 */
+ 8, /* 2x2 */
+ 8, /* 1x1 */
+ };
+ int i;
+ int value = ((level + 1) % 2) * 0xffffffff;
+ memset(img, 0, 128);
+
+ /* generate black and white mipmap levels */
+ if (value)
+ for (i = 0; i < size[level] / 4; i += 2)
+ ((int*)img)[i] = value;
+
+ glCompressedTexImage2D(GL_TEXTURE_2D, level,
+ GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
+ width, height, 0,
+ size[level], img);
+#endif
+}
+
+
+static void
+makeImages(void)
+{
+ int i, sz;
+
+ for (i = 0, sz = SIZE; sz >= 1; i++, sz /= 2) {
+ makeImage(i, sz, sz);
+ printf("Level %d size: %d x %d\n", i, sz, sz);
+ }
+}
+
+
+static void
+myInit(void)
+{
+
+ initValues();
+
+ glEnable(GL_DEPTH_TEST);
+ glDepthFunc(GL_LESS);
+ glShadeModel(GL_FLAT);
+
+ glTranslatef(0.0, 0.0, -3.6);
+
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ glGenTextures(1, &texImage);
+ glBindTexture(GL_TEXTURE_2D, texImage);
+ makeImages();
+
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
+ glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
+ glEnable(GL_TEXTURE_2D);
+}
+
+
+static void
+display(void)
+{
+ GLfloat tcm = 1.0;
+ glBindTexture(GL_TEXTURE_2D, texImage);
+
+ printf("BASE_LEVEL=%d MAX_LEVEL=%d MIN_LOD=%.2g MAX_LOD=%.2g Bias=%.2g Filter=%s\n",
+ BaseLevel, MaxLevel, MinLod, MaxLod, LodBias,
+ NearestFilter ? "NEAREST" : "LINEAR");
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, BaseLevel);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, MaxLevel);
+
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, MinLod);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, MaxLod);
+
+ if (NearestFilter) {
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
+ GL_NEAREST_MIPMAP_NEAREST);
+ }
+ else {
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
+ GL_LINEAR_MIPMAP_LINEAR);
+ }
+
+ glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, LodBias);
+
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ glBegin(GL_QUADS);
+ glTexCoord2f(0.0, 0.0); glVertex3f(-2.0, -1.0, 0.0);
+ glTexCoord2f(0.0, tcm); glVertex3f(-2.0, 1.0, 0.0);
+ glTexCoord2f(tcm * 3000.0, tcm); glVertex3f(3000.0, 1.0, -6000.0);
+ glTexCoord2f(tcm * 3000.0, 0.0); glVertex3f(3000.0, -1.0, -6000.0);
+ glEnd();
+ glFlush();
+}
+
+
+static void
+myReshape(int w, int h)
+{
+ glViewport(0, 0, w, h);
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ gluPerspective(60.0, 1.0*(GLfloat)w/(GLfloat)h, 1.0, 30000.0);
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+}
+
+
+static void
+key(unsigned char k, int x, int y)
+{
+ (void) x;
+ (void) y;
+ switch (k) {
+ case 'b':
+ BaseLevel--;
+ if (BaseLevel < 0)
+ BaseLevel = 0;
+ break;
+ case 'B':
+ BaseLevel++;
+ if (BaseLevel > 10)
+ BaseLevel = 10;
+ break;
+ case 'm':
+ MaxLevel--;
+ if (MaxLevel < 0)
+ MaxLevel = 0;
+ break;
+ case 'M':
+ MaxLevel++;
+ if (MaxLevel > 10)
+ MaxLevel = 10;
+ break;
+ case 'l':
+ LodBias -= 0.25;
+ break;
+ case 'L':
+ LodBias += 0.25;
+ break;
+ case 'n':
+ MinLod -= 0.25;
+ break;
+ case 'N':
+ MinLod += 0.25;
+ break;
+ case 'x':
+ MaxLod -= 0.25;
+ break;
+ case 'X':
+ MaxLod += 0.25;
+ break;
+ case 'f':
+ NearestFilter = !NearestFilter;
+ break;
+ case ' ':
+ initValues();
+ break;
+ case 27: /* Escape */
+ exit(0);
+ break;
+ default:
+ return;
+ }
+ glutPostRedisplay();
+}
+
+
+static void
+usage(void)
+{
+ printf("usage:\n");
+ printf(" b/B decrease/increase GL_TEXTURE_BASE_LEVEL\n");
+ printf(" m/M decrease/increase GL_TEXTURE_MAX_LEVEL\n");
+ printf(" n/N decrease/increase GL_TEXTURE_MIN_LOD\n");
+ printf(" x/X decrease/increase GL_TEXTURE_MAX_LOD\n");
+ printf(" l/L decrease/increase GL_TEXTURE_LOD_BIAS\n");
+ printf(" f toggle nearest/linear filtering\n");
+ printf(" SPACE reset values\n");
+}
+
+
+int
+main(int argc, char** argv)
+{
+ glutInit(&argc, argv);
+ glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH);
+ glutInitWindowSize (600, 600);
+ glutCreateWindow (argv[0]);
+ glewInit();
+ myInit();
+ glutReshapeFunc (myReshape);
+ glutDisplayFunc(display);
+ glutKeyboardFunc(key);
+ usage();
+ glutMainLoop();
+ return 0; /* ANSI C requires main to return int. */
+}
--
cgit v1.2.3
From 289dc69418d834e44bd2f63f69382c1f1d3d7c00 Mon Sep 17 00:00:00 2001
From: Jakob Bornecrantz
Date: Wed, 29 Apr 2009 20:44:03 +0100
Subject: progs/tests: Update ignores
---
progs/tests/.gitignore | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/progs/tests/.gitignore b/progs/tests/.gitignore
index 8d05668c07..959ddcc51f 100644
--- a/progs/tests/.gitignore
+++ b/progs/tests/.gitignore
@@ -16,22 +16,20 @@ blendminmax
blendsquare
blendxor
bufferobj
-bumpmap
bug_3050
bug_3101
bug_3195
bug_texstore_i8
+bumpmap
calibrate_rast
copypixrate
crossbar
cva
-dinoshade
drawbuffers
extfuncs.h
exactrast
fbotest1
fbotest2
-fbotexture
fillrate
floattex
fog
@@ -40,6 +38,7 @@ fptest1
fptexture
getprocaddress
getproclist.h
+glutfx
interleave
invert
jkrahntest
@@ -57,7 +56,6 @@ no_s3tc
packedpixels
pbo
prog_parameter
-projtex
quads
random
readrate
@@ -65,22 +63,22 @@ readtex.c
readtex.h
rubberband
seccolor
-sharedtex
shader_api
shaderutil.c
shaderutil.h
+sharedtex
stencil_twoside
-stencil_wrap
stencilwrap
stencil_wrap
+streaming_rect
subtex
subtexrate
tex1d
-texcmp
texcompress2
+texdown
texfilt
-texgenmix
texline
+texobj
texobjshare
texrect
texwrap
--
cgit v1.2.3
From cc68cd20d9fbb87486eb69a50fa14a3d6b9c6798 Mon Sep 17 00:00:00 2001
From: Dan Nicholson
Date: Wed, 29 Apr 2009 20:33:50 -0700
Subject: egl: Don't install demodriver
I don't think anyone besides a developer would ever want to use the demo
egl driver. Furthermore, egl would only ever load demodriver if it was
set via EGL_DRIVER in the environment. In that case, I think you can
point it to your mesa source directory.
---
src/egl/drivers/demo/Makefile | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/egl/drivers/demo/Makefile b/src/egl/drivers/demo/Makefile
index d908cdb4b2..26694c92fa 100644
--- a/src/egl/drivers/demo/Makefile
+++ b/src/egl/drivers/demo/Makefile
@@ -26,8 +26,6 @@ $(TOP)/$(LIB_DIR)/demodriver.so: $(OBJECTS)
$(OBJECTS)
install:
- $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
- $(INSTALL) $(TOP)/$(LIB_DIR)/demodriver.so $(DESTDIR)$(INSTALL_LIB_DIR)
clean:
-rm -f *.o
--
cgit v1.2.3
From ba27fe3710af4933a16278a3e97162bef1737b56 Mon Sep 17 00:00:00 2001
From: Michel Dänzer
Date: Thu, 30 Apr 2009 09:39:29 +0200
Subject: gallium: Add SCons build support for the DRI state tracker.
---
src/gallium/SConscript | 1 +
src/gallium/state_trackers/dri/SConscript | 23 +++++++++++++++++++++++
2 files changed, 24 insertions(+)
create mode 100644 src/gallium/state_trackers/dri/SConscript
diff --git a/src/gallium/SConscript b/src/gallium/SConscript
index 0c632ac2b8..b6ceaf3edf 100644
--- a/src/gallium/SConscript
+++ b/src/gallium/SConscript
@@ -29,6 +29,7 @@ for driver in env['drivers']:
SConscript('state_trackers/python/SConscript')
SConscript('state_trackers/glx/xlib/SConscript')
+SConscript('state_trackers/dri/SConscript')
if platform == 'windows':
SConscript('state_trackers/wgl/SConscript')
diff --git a/src/gallium/state_trackers/dri/SConscript b/src/gallium/state_trackers/dri/SConscript
new file mode 100644
index 0000000000..ce2c273597
--- /dev/null
+++ b/src/gallium/state_trackers/dri/SConscript
@@ -0,0 +1,23 @@
+#######################################################################
+# SConscript for dri state_tracker
+
+Import('*')
+
+if env['dri']:
+
+ env = env.Clone()
+
+ env.Append(CPPPATH = [
+ '#/src/mesa',
+ '#/src/mesa/drivers/dri/common',
+ ])
+
+ st_dri = env.ConvenienceLibrary(
+ target = 'st_dri',
+ source = [ 'dri_context.c',
+ 'dri_drawable.c',
+ 'dri_extensions.c',
+ 'dri_screen.c',
+ ]
+ )
+ Export('st_dri')
--
cgit v1.2.3
From c28707b50701b1cf8727be29d61e2d939c6ee58f Mon Sep 17 00:00:00 2001
From: Michel Dänzer
Date: Thu, 30 Apr 2009 13:21:08 +0200
Subject: r300: Increase reference count of texture objects referenced by
current state.
Fixes a use-after-free reported in
http://bugs.freedesktop.org/show_bug.cgi?id=20539, so this possibly fixes that
bug. It has been confirmed to fix
http://bugs.freedesktop.org/show_bug.cgi?id=17895 .
---
src/mesa/drivers/dri/r300/r300_context.h | 2 +-
src/mesa/drivers/dri/r300/r300_state.c | 2 +-
src/mesa/drivers/dri/r300/r300_texmem.c | 5 +++--
src/mesa/drivers/dri/r300/r300_texstate.c | 11 ++++++-----
4 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h
index 9c49586998..96a3205f1a 100644
--- a/src/mesa/drivers/dri/r300/r300_context.h
+++ b/src/mesa/drivers/dri/r300/r300_context.h
@@ -215,7 +215,7 @@ struct r300_tex_obj {
};
struct r300_texture_env_state {
- r300TexObjPtr texobj;
+ struct gl_texture_object *texobj;
GLenum format;
GLenum envMode;
};
diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c
index 6b79aa4313..79f0b3625c 100644
--- a/src/mesa/drivers/dri/r300/r300_state.c
+++ b/src/mesa/drivers/dri/r300/r300_state.c
@@ -1362,7 +1362,7 @@ static void r300SetupTextures(GLcontext * ctx)
#endif
tmu_mappings[i] = hw_tmu;
- t = r300->state.texture.unit[i].texobj;
+ t = (r300TexObjPtr) r300->state.texture.unit[i].texobj->DriverData;
/* XXX questionable fix for bug 9170: */
if (!t)
continue;
diff --git a/src/mesa/drivers/dri/r300/r300_texmem.c b/src/mesa/drivers/dri/r300/r300_texmem.c
index 0fe51b0c68..a89ab83d94 100644
--- a/src/mesa/drivers/dri/r300/r300_texmem.c
+++ b/src/mesa/drivers/dri/r300/r300_texmem.c
@@ -44,6 +44,7 @@ SOFTWARE.
#include "main/colormac.h"
#include "main/macros.h"
#include "main/simple_list.h"
+#include "main/texobj.h"
#include "radeon_reg.h" /* gets definition for usleep */
#include "r300_context.h"
#include "r300_state.h"
@@ -71,8 +72,8 @@ void r300DestroyTexObj(r300ContextPtr rmesa, r300TexObjPtr t)
}
for (i = 0; i < rmesa->radeon.glCtx->Const.MaxTextureUnits; i++) {
- if (rmesa->state.texture.unit[i].texobj == t) {
- rmesa->state.texture.unit[i].texobj = NULL;
+ if (rmesa->state.texture.unit[i].texobj == t->base.tObj) {
+ _mesa_reference_texobj(&rmesa->state.texture.unit[i].texobj, NULL);
}
}
}
diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c
index cadec7f3ec..abe613e27b 100644
--- a/src/mesa/drivers/dri/r300/r300_texstate.c
+++ b/src/mesa/drivers/dri/r300/r300_texstate.c
@@ -567,19 +567,20 @@ static GLboolean r300UpdateTexture(GLcontext * ctx, int unit)
/* Update state if this is a different texture object to last
* time.
*/
- if (rmesa->state.texture.unit[unit].texobj != t) {
+ if (rmesa->state.texture.unit[unit].texobj != tObj) {
if (rmesa->state.texture.unit[unit].texobj != NULL) {
+ r300TexObjPtr t_old = (r300TexObjPtr) rmesa->state.texture.unit[unit].texobj->DriverData;
+
/* The old texture is no longer bound to this texture unit.
* Mark it as such.
*/
- rmesa->state.texture.unit[unit].texobj->base.bound &=
- ~(1 << unit);
+ t_old->base.bound &= ~(1 << unit);
}
- rmesa->state.texture.unit[unit].texobj = t;
+ _mesa_reference_texobj(&rmesa->state.texture.unit[unit].texobj, tObj);
t->base.bound |= (1 << unit);
- driUpdateTextureLRU((driTextureObject *) t); /* XXX: should be locked! */
+ driUpdateTextureLRU(&t->base); /* XXX: should be locked! */
}
return !t->border_fallback;
--
cgit v1.2.3
From 60927f97f7b0df9ce352d0c8b4b973e97d53f20a Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Thu, 30 Apr 2009 16:52:02 -0600
Subject: i915simple: remove duplicated i915_context.c in C_SOURCES
---
src/gallium/drivers/i915simple/Makefile | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/gallium/drivers/i915simple/Makefile b/src/gallium/drivers/i915simple/Makefile
index 12821c5a76..8870b39866 100644
--- a/src/gallium/drivers/i915simple/Makefile
+++ b/src/gallium/drivers/i915simple/Makefile
@@ -8,7 +8,6 @@ C_SOURCES = \
i915_clear.c \
i915_flush.c \
i915_context.c \
- i915_context.c \
i915_debug.c \
i915_debug_fp.c \
i915_state.c \
--
cgit v1.2.3
From 9cb3cdec76b679f15c591955084bd48e91a32142 Mon Sep 17 00:00:00 2001
From: Tormod Volden
Date: Thu, 30 Apr 2009 16:52:56 -0600
Subject: mesa: Prepend "-Wl," to linking options
Let mklib ignore -Wl options inside the object list when building
static libraries
---
bin/mklib | 17 +++++++++++++++++
src/gallium/winsys/egl_xlib/Makefile | 2 +-
src/gallium/winsys/xlib/Makefile | 2 +-
3 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/bin/mklib b/bin/mklib
index a3e826abac..db3bc8325f 100755
--- a/bin/mklib
+++ b/bin/mklib
@@ -176,6 +176,23 @@ if [ ${ARCH} = "auto" ] ; then
fi
+if [ $STATIC = 1 ]; then
+ # filter out linker options inside object list
+ NEWOBJECTS=""
+ for OBJ in $OBJECTS ; do
+ case $OBJ in
+ -Wl,*)
+ echo "mklib: warning: ignoring $OBJ for static library"
+ ;;
+ *)
+ NEWOBJECTS="$NEWOBJECTS $OBJ"
+ ;;
+ esac
+ done
+ OBJECTS=$NEWOBJECTS
+fi
+
+
#
# Error checking
#
diff --git a/src/gallium/winsys/egl_xlib/Makefile b/src/gallium/winsys/egl_xlib/Makefile
index 02ac47caa4..8646ee3b52 100644
--- a/src/gallium/winsys/egl_xlib/Makefile
+++ b/src/gallium/winsys/egl_xlib/Makefile
@@ -60,7 +60,7 @@ $(TOP)/$(LIB_DIR)/$(DRIVER_NAME): $(WINSYS_OBJECTS) $(LIBS)
-noprefix \
-install $(TOP)/$(LIB_DIR) \
$(MKLIB_OPTIONS) $(WINSYS_OBJECTS) \
- --whole-archive $(LIBS) --no-whole-archive
+ -Wl,--whole-archive $(LIBS) -Wl,--no-whole-archive
depend: $(ALL_SOURCES)
diff --git a/src/gallium/winsys/xlib/Makefile b/src/gallium/winsys/xlib/Makefile
index bb187cc14a..04309e67ee 100644
--- a/src/gallium/winsys/xlib/Makefile
+++ b/src/gallium/winsys/xlib/Makefile
@@ -74,7 +74,7 @@ $(TOP)/$(LIB_DIR)/gallium/$(GL_LIB_NAME): $(XLIB_WINSYS_OBJECTS) $(LIBS) Makefil
-major $(GL_MAJOR) -minor $(GL_MINOR) -patch $(GL_TINY) \
-install $(TOP)/$(LIB_DIR)/gallium \
$(MKLIB_OPTIONS) $(XLIB_WINSYS_OBJECTS) \
- --start-group $(LIBS) --end-group $(GL_LIB_DEPS)
+ -Wl,--start-group $(LIBS) -Wl,--end-group $(GL_LIB_DEPS)
depend: $(XLIB_WINSYS_SOURCES)
--
cgit v1.2.3
From eef79d50bf160a0278266cac56a915027538ac1e Mon Sep 17 00:00:00 2001
From: Tormod Volden
Date: Thu, 30 Apr 2009 16:55:54 -0600
Subject: mklib: replace if/expr with case
Saves forking an expr for every object.
---
bin/mklib | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
diff --git a/bin/mklib b/bin/mklib
index db3bc8325f..2fd95ba775 100755
--- a/bin/mklib
+++ b/bin/mklib
@@ -281,18 +281,21 @@ case $ARCH in
# expand any .a objects into constituent .o files.
NEWOBJECTS=""
DELETIA=""
- for OBJ in ${OBJECTS} ; do
- if [ `expr match $OBJ '.*\.a'` -gt 0 ] ; then
- # extract the .o files from this .a archive
- FILES=`ar t $OBJ`
- ar x $OBJ
- NEWOBJECTS="$NEWOBJECTS $FILES"
- # keep track of temporary .o files and delete them below
- DELETIA="$DELETIA $FILES"
- else
- # ordinary .o file
- NEWOBJECTS="$NEWOBJECTS $OBJ"
- fi
+ for OBJ in $OBJECTS ; do
+ case $OBJ in
+ *.a)
+ # extract the .o files from this .a archive
+ FILES=`ar t $OBJ`
+ ar x $OBJ
+ NEWOBJECTS="$NEWOBJECTS $FILES"
+ # keep track of temporary .o files and delete them below
+ DELETIA="$DELETIA $FILES"
+ ;;
+ *)
+ # ordinary .o file
+ NEWOBJECTS="$NEWOBJECTS $OBJ"
+ ;;
+ esac
done
# make lib
--
cgit v1.2.3
From 3dfe672c851756e5ee09443dfafb1295c912da31 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Thu, 30 Apr 2009 17:03:54 -0600
Subject: demos: silence warning
---
progs/demos/dinoshade.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/progs/demos/dinoshade.c b/progs/demos/dinoshade.c
index 41b19d5a92..cbf8751e25 100644
--- a/progs/demos/dinoshade.c
+++ b/progs/demos/dinoshade.c
@@ -382,7 +382,7 @@ static GLfloat floorShadow[4][4];
static void
redraw(void)
{
- int start, end;
+ int start = 0, end = 0;
if (reportSpeed) {
start = glutGet(GLUT_ELAPSED_TIME);
--
cgit v1.2.3
From aef475c8893b7f524b2314f9f8d1083655db7fe2 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Thu, 30 Apr 2009 17:04:01 -0600
Subject: mesa: update linux-static, linux-x86-static configs
---
configs/linux-static | 6 ++----
configs/linux-x86-static | 5 ++---
2 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/configs/linux-static b/configs/linux-static
index 2fc39ff83e..907904bda4 100644
--- a/configs/linux-static
+++ b/configs/linux-static
@@ -22,7 +22,5 @@ GLUT_LIB_DEPS =
GLW_LIB_DEPS =
# Need to specify all libraries we may need
-APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -Wl,--start-group \
- -l$(GL_LIB) $(TOP)/src/mesa/pipe/softpipe/libsoftpipe.a -Wl,--end-group -lm \
- -L/usr/X11R6/lib/ -lX11 -lXext -lXmu -lXi -lpthread
-
+APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) \
+ -l$(GL_LIB) -lm -L/usr/X11R6/lib/ -lX11 -lXext -lXmu -lXi -lpthread
diff --git a/configs/linux-x86-static b/configs/linux-x86-static
index 65c92cf352..16c8731c1d 100644
--- a/configs/linux-x86-static
+++ b/configs/linux-x86-static
@@ -22,6 +22,5 @@ GLUT_LIB_DEPS =
GLW_LIB_DEPS =
# Need to specify all libraries we may need
-APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -Wl,--start-group \
- -l$(GL_LIB) $(TOP)/src/mesa/pipe/softpipe/libsoftpipe.a -Wl,--end-group \
- $(EXTRA_LIB_PATH) -lX11 -lXext -lXmu -lXt -lXi -lpthread -lstdc++ -lm
+APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) \
+ -l$(GL_LIB) $(EXTRA_LIB_PATH) -lX11 -lXext -lXmu -lXt -lXi -lpthread -lstdc++ -lm
--
cgit v1.2.3
From 675b1cacf7e41310771791b15f3d44bd3eb9b70e Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Thu, 30 Apr 2009 17:11:20 -0600
Subject: docs: notes about new version number meaning in release notes
---
docs/relnotes-7.5.html | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/docs/relnotes-7.5.html b/docs/relnotes-7.5.html
index bfeea3f433..27c64b42b6 100644
--- a/docs/relnotes-7.5.html
+++ b/docs/relnotes-7.5.html
@@ -27,7 +27,14 @@ Some drivers don't support all the features required in OpenGL 2.1.
See the Compiling/Installing page for prerequisites
-for DRI ardware acceleration.
+for DRI hardware acceleration.
+
+
+Note that the Mesa project is no longer using odd/even version numbers
+to indicate development/stable releases.
+The so-called development releases have been fairly stable.
+If you're especially concerned with stability you should probably look for
+"point" releases such as 7.5.1 which will be a bug-fix release.
+Mesa 7.4.1 is released.
+This is a stable release fixing bugs since the 7.4 release.
+
+
+
+
March 27, 2009
+
+Mesa 7.4 is released.
+This is a stable release fixing bugs since the 7.3 release.
+
+
+
January 22, 2009
Mesa 7.3 is released.
diff --git a/docs/relnotes-7.4.1.html b/docs/relnotes-7.4.1.html
new file mode 100644
index 0000000000..40f4fb1722
--- /dev/null
+++ b/docs/relnotes-7.4.1.html
@@ -0,0 +1,79 @@
+
+
+
Mesa Release Notes
+
+
+
+
+
+
+
+
Mesa 7.4.1 Release Notes / 18 April 2009
+
+
+Mesa 7.4.1 is a stable development release fixing bugs since the 7.4 release.
+
+
+Mesa 7.4.1 implements the OpenGL 2.1 API, but the version reported by
+glGetString(GL_VERSION) depends on the particular driver being used.
+Some drivers don't support all the features required in OpenGL 2.1.
+
Mesa 7.4 is a stable development release fixing bugs since the 7.3 release.
@@ -20,28 +20,48 @@ Some drivers don't support all the features required in OpenGL 2.1.
See the Compiling/Installing page for prerequisites
-for DRI ardware acceleration.
+for DRI hardware acceleration.
Added MESA_GLX_FORCE_DIRECT env var for Xlib/software driver
+
GLSL version 1.20 is returnd by the GL_SHADING_LANGUAGE_VERSION query
Bug fixes
+
glGetActiveUniform() returned wrong size for some array types
+
Fixed some error checking in glUniform()
+
Fixed a potential glTexImage('proxy target') segfault
+
Fixed bad reference counting for 1D/2D texture arrays
+
Fixed VBO + glPush/PopClientAttrib() bug #19835
Assorted i965 driver bug fixes
+
Fixed a Windows compilation failure in s_triangle.c
+
Fixed a GLSL array indexing bug
+
Fixes for building on Haiku
Changes
+
Updated GL/glxext.h to version 48
+
Assorted updates for building on Solaris
diff --git a/docs/relnotes.html b/docs/relnotes.html
index c5ed109390..298352038c 100644
--- a/docs/relnotes.html
+++ b/docs/relnotes.html
@@ -21,6 +21,7 @@ The release notes summarize what's new or changed in each Mesa release.
Mesa 7.4.1 is released.
diff --git a/docs/relnotes-7.5.html b/docs/relnotes-7.5.html
index 27c64b42b6..c10ccd7a5c 100644
--- a/docs/relnotes-7.5.html
+++ b/docs/relnotes-7.5.html
@@ -13,7 +13,7 @@
Mesa 7.5 is a new development release.
People who are concerned with stability and reliability should stick
-with the 7.4.x branch or wait for Mesa 7.6.
+with the 7.4.x branch or wait for Mesa 7.5.1.
The main new feature of Mesa 7.5 is the
--
cgit v1.2.3
From 1f43cc1d841d3be04433224842f89ff03ba28a02 Mon Sep 17 00:00:00 2001
From: Corbin Simpson
Date: Tue, 28 Apr 2009 04:37:56 -0700
Subject: radeon: Fix cast and comment.
---
src/gallium/winsys/drm/radeon/core/radeon_r300.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c
index 3302d623bf..adbf23ab51 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c
+++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c
@@ -56,8 +56,7 @@ static void do_ioctls(struct r300_winsys* winsys, int fd)
int target;
int retval;
- /* XXX is this cast safe? */
- gp.value = (int*)⌖
+ gp.value = ⌖
/* First, get the number of pixel pipes */
gp.param = RADEON_PARAM_NUM_GB_PIPES;
--
cgit v1.2.3
From a609f78cf688c97eda8cde3d876397e042fdb60d Mon Sep 17 00:00:00 2001
From: Corbin Simpson
Date: Fri, 1 May 2009 04:47:50 -0700
Subject: r300-gallium: Don't bother with conditional double define.
We'll just forever leave it in r300_winsys.h since it's needed for
whichever winsys is hosting the pipe.
---
src/gallium/drivers/r300/r300_context.h | 7 -------
1 file changed, 7 deletions(-)
diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
index 4c695c1195..6f62998b35 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -314,11 +314,4 @@ struct draw_stage* r300_draw_stage(struct r300_context* r300);
void r300_init_state_functions(struct r300_context* r300);
void r300_init_surface_functions(struct r300_context* r300);
-/* Fun with includes: r300_winsys also declares this prototype.
- * We'll just step out in that case... */
-#ifndef R300_WINSYS_H
-struct pipe_context* r300_create_context(struct pipe_screen* screen,
- struct r300_winsys* r300_winsys);
-#endif
-
#endif /* R300_CONTEXT_H */
--
cgit v1.2.3
From d7f4ac9f34a72efe53a1a140557f1822afbadf16 Mon Sep 17 00:00:00 2001
From: Corbin Simpson
Date: Fri, 1 May 2009 05:03:56 -0700
Subject: r300-gallium, radeon-winsys: Reorganize r300_winsys header, break
ABI.
Make things more consistent, prepare for more function hooks.
---
src/gallium/drivers/r300/r300_cs.h | 18 ++++----
src/gallium/drivers/r300/r300_winsys.h | 46 ++++++++++----------
src/gallium/winsys/drm/radeon/core/radeon_r300.c | 53 +++++++++++++++++-------
3 files changed, 70 insertions(+), 47 deletions(-)
diff --git a/src/gallium/drivers/r300/r300_cs.h b/src/gallium/drivers/r300/r300_cs.h
index 5d9799dd72..82a3942248 100644
--- a/src/gallium/drivers/r300/r300_cs.h
+++ b/src/gallium/drivers/r300/r300_cs.h
@@ -49,27 +49,27 @@
#define CS_LOCALS(context) \
struct r300_winsys* cs_winsys = context->winsys; \
- struct radeon_cs* cs = cs_winsys->cs; \
int cs_count = 0;
#define CHECK_CS(size) \
- cs_winsys->check_cs(cs, (size))
+ cs_winsys->check_cs(cs_winsys, (size))
#define BEGIN_CS(size) do { \
CHECK_CS(size); \
debug_printf("r300: BEGIN_CS, count %d, in %s (%s:%d)\n", \
size, __FUNCTION__, __FILE__, __LINE__); \
- cs_winsys->begin_cs(cs, (size), __FILE__, __FUNCTION__, __LINE__); \
+ cs_winsys->begin_cs(cs_winsys, (size), \
+ __FILE__, __FUNCTION__, __LINE__); \
cs_count = size; \
} while (0)
#define OUT_CS(value) do { \
- cs_winsys->write_cs_dword(cs, (value)); \
+ cs_winsys->write_cs_dword(cs_winsys, (value)); \
cs_count--; \
} while (0)
#define OUT_CS_32F(value) do { \
- cs_winsys->write_cs_dword(cs, fui(value)); \
+ cs_winsys->write_cs_dword(cs_winsys, fui(value)); \
cs_count--; \
} while (0)
@@ -97,7 +97,7 @@
bo, offset); \
assert(bo); \
OUT_CS(offset); \
- cs_winsys->write_cs_reloc(cs, bo, rd, wd, flags); \
+ cs_winsys->write_cs_reloc(cs_winsys, bo, rd, wd, flags); \
cs_count -= 2; \
} while (0)
@@ -106,13 +106,13 @@
__LINE__); \
if (cs_count != 0) \
debug_printf("r300: Warning: cs_count off by %d\n", cs_count); \
- cs_winsys->end_cs(cs, __FILE__, __FUNCTION__, __LINE__); \
+ cs_winsys->end_cs(cs_winsys, __FILE__, __FUNCTION__, __LINE__); \
} while (0)
#define FLUSH_CS do { \
debug_printf("r300: FLUSH_CS in %s (%s:%d)\n\n", __FUNCTION__, __FILE__, \
__LINE__); \
- cs_winsys->flush_cs(cs); \
+ cs_winsys->flush_cs(cs_winsys); \
} while (0)
#define RADEON_ONE_REG_WR (1 << 15)
@@ -138,7 +138,7 @@
assert(bo); \
OUT_CS(offset); \
OUT_CS(count); \
- cs_winsys->write_cs_reloc(cs, bo, rd, wd, flags); \
+ cs_winsys->write_cs_reloc(cs_winsys, bo, rd, wd, flags); \
cs_count -= 2; \
} while (0)
diff --git a/src/gallium/drivers/r300/r300_winsys.h b/src/gallium/drivers/r300/r300_winsys.h
index baa95282c3..393ba07012 100644
--- a/src/gallium/drivers/r300/r300_winsys.h
+++ b/src/gallium/drivers/r300/r300_winsys.h
@@ -35,8 +35,6 @@ extern "C" {
#include "pipe/p_state.h"
#include "pipe/internal/p_winsys_screen.h"
-struct radeon_cs;
-
struct r300_winsys {
/* Parent class */
struct pipe_winsys base;
@@ -44,45 +42,45 @@ struct r300_winsys {
/* Opaque Radeon-specific winsys object. */
void* radeon_winsys;
+ /* CS object. This is very much like Intel's batchbuffer.
+ * Fill it full of dwords and relocs and then submit.
+ * Repeat as needed. */
+ struct radeon_cs* cs;
+
/* PCI ID */
uint32_t pci_id;
/* GB pipe count */
uint32_t gb_pipes;
- /* CS object. This is very much like Intel's batchbuffer.
- * Fill it full of dwords and relocs and then submit.
- * Repeat as needed. */
- struct radeon_cs* cs;
-
/* Check to see if there's room for commands. */
- boolean (*check_cs)(struct radeon_cs* cs, int size);
+ boolean (*check_cs)(struct r300_winsys* winsys, int size);
/* Start a command emit. */
- void (*begin_cs)(struct radeon_cs* cs,
- int size,
- const char* file,
- const char* function,
- int line);
+ void (*begin_cs)(struct r300_winsys* winsys,
+ int size,
+ const char* file,
+ const char* function,
+ int line);
/* Write a dword to the command buffer. */
- void (*write_cs_dword)(struct radeon_cs* cs, uint32_t dword);
+ void (*write_cs_dword)(struct r300_winsys* winsys, uint32_t dword);
/* Write a relocated dword to the command buffer. */
- void (*write_cs_reloc)(struct radeon_cs* cs,
- struct pipe_buffer* bo,
- uint32_t rd,
- uint32_t wd,
- uint32_t flags);
+ void (*write_cs_reloc)(struct r300_winsys* winsys,
+ struct pipe_buffer* bo,
+ uint32_t rd,
+ uint32_t wd,
+ uint32_t flags);
/* Finish a command emit. */
- void (*end_cs)(struct radeon_cs* cs,
- const char* file,
- const char* function,
- int line);
+ void (*end_cs)(struct r300_winsys* winsys,
+ const char* file,
+ const char* function,
+ int line);
/* Flush the CS. */
- void (*flush_cs)(struct radeon_cs* cs);
+ void (*flush_cs)(struct r300_winsys* winsys);
};
struct pipe_context* r300_create_context(struct pipe_screen* screen,
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c
index adbf23ab51..929e4842cc 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c
+++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c
@@ -22,31 +22,56 @@
#include "radeon_r300.h"
-static boolean radeon_r300_check_cs(struct radeon_cs* cs, int size)
+static boolean radeon_r300_check_cs(struct r300_winsys* winsys, int size)
{
/* XXX check size here, lazy ass! */
+ /* XXX also validate buffers */
return TRUE;
}
-static void radeon_r300_write_cs_reloc(struct radeon_cs* cs,
- struct pipe_buffer* pbuffer,
- uint32_t rd,
- uint32_t wd,
- uint32_t flags)
+static void radeon_r300_begin_cs(struct r300_winsys* winsys,
+ int size,
+ const char* file,
+ const char* function,
+ int line)
{
- radeon_cs_write_reloc(cs, ((struct radeon_pipe_buffer*)pbuffer)->bo, rd, wd, flags);
+ radeon_cs_begin(winsys->cs, size, file, function, line);
}
-static void radeon_r300_flush_cs(struct radeon_cs* cs)
+static void radeon_r300_write_cs_dword(struct r300_winsys* winsys,
+ uint32_t dword)
+{
+ radeon_cs_write_dword(winsys->cs, dword);
+}
+
+static void radeon_r300_write_cs_reloc(struct r300_winsys* winsys,
+ struct pipe_buffer* pbuffer,
+ uint32_t rd,
+ uint32_t wd,
+ uint32_t flags)
+{
+ radeon_cs_write_reloc(winsys->cs,
+ ((struct radeon_pipe_buffer*)pbuffer)->bo, rd, wd, flags);
+}
+
+static void radeon_r300_end_cs(struct r300_winsys* winsys,
+ const char* file,
+ const char* function,
+ int line)
+{
+ radeon_cs_end(winsys->cs, file, function, line);
+}
+
+static void radeon_r300_flush_cs(struct r300_winsys* winsys)
{
int retval = 0;
- retval = radeon_cs_emit(cs);
+ retval = radeon_cs_emit(winsys->cs);
if (retval) {
debug_printf("radeon: Bad CS, dumping...\n");
- radeon_cs_print(cs, stderr);
+ radeon_cs_print(winsys->cs, stderr);
}
- radeon_cs_erase(cs);
+ radeon_cs_erase(winsys->cs);
}
/* Helper function to do the ioctls needed for setup and init. */
@@ -96,10 +121,10 @@ radeon_create_r300_winsys(int fd, struct radeon_winsys* old_winsys)
winsys->cs = radeon_cs_create(csm, 1024 * 64 / 4);
winsys->check_cs = radeon_r300_check_cs;
- winsys->begin_cs = radeon_cs_begin;
- winsys->write_cs_dword = radeon_cs_write_dword;
+ winsys->begin_cs = radeon_r300_begin_cs;
+ winsys->write_cs_dword = radeon_r300_write_cs_dword;
winsys->write_cs_reloc = radeon_r300_write_cs_reloc;
- winsys->end_cs = radeon_cs_end;
+ winsys->end_cs = radeon_r300_end_cs;
winsys->flush_cs = radeon_r300_flush_cs;
memcpy(winsys, old_winsys, sizeof(struct radeon_winsys));
--
cgit v1.2.3
From c11ad489e7432f3ed2fcaf5b15b8fe3538ae6d30 Mon Sep 17 00:00:00 2001
From: Corbin Simpson
Date: Fri, 1 May 2009 05:54:53 -0700
Subject: r300-gallium, radeon-winsys: Space accounting.
It is no longer optional in current libdrm, so it was time to actually
start counting our BOs.
---
src/gallium/drivers/r300/r300_emit.c | 10 +++-
src/gallium/drivers/r300/r300_surface.c | 7 +++
src/gallium/drivers/r300/r300_winsys.h | 16 +++++
src/gallium/winsys/drm/radeon/core/radeon_buffer.c | 12 +++-
src/gallium/winsys/drm/radeon/core/radeon_buffer.h | 18 +++++-
src/gallium/winsys/drm/radeon/core/radeon_drm.c | 4 +-
src/gallium/winsys/drm/radeon/core/radeon_r300.c | 68 ++++++++++++++++++++++
7 files changed, 126 insertions(+), 9 deletions(-)
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index 74d63ffe41..01bac5f759 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -424,13 +424,21 @@ void r300_emit_dirty_state(struct r300_context* r300)
int i;
int dirty_tex = 0;
- if (!(r300->dirty_state) && !(r300->dirty_hw)) {
+ if (!(r300->dirty_hw)) {
return;
}
r300_update_derived_state(r300);
/* XXX check size */
+ struct r300_texture* fb_tex =
+ (struct r300_texture*)r300->framebuffer_state.cbufs[0];
+ r300->winsys->add_buffer(r300->winsys, fb_tex->buffer,
+ 0, RADEON_GEM_DOMAIN_VRAM);
+ if (r300->winsys->validate(r300->winsys)) {
+ /* XXX */
+ r300->context.flush(&r300->context, 0, NULL);
+ }
if (r300->dirty_state & R300_NEW_BLEND) {
r300_emit_blend_state(r300, r300->blend_state);
diff --git a/src/gallium/drivers/r300/r300_surface.c b/src/gallium/drivers/r300/r300_surface.c
index 79bed03253..4dd5b8af99 100644
--- a/src/gallium/drivers/r300/r300_surface.c
+++ b/src/gallium/drivers/r300/r300_surface.c
@@ -34,6 +34,13 @@ static void r300_surface_setup(struct pipe_context* pipe,
unsigned pixpitch = tex->stride / tex->tex.block.size;
CS_LOCALS(r300);
+ /* Make sure our target BO is okay. */
+ r300->winsys->add_buffer(r300->winsys, tex->buffer,
+ 0, RADEON_GEM_DOMAIN_VRAM);
+ if (r300->winsys->validate(r300->winsys)) {
+ r300->context.flush(&r300->context, 0, NULL);
+ }
+
r300_emit_blend_state(r300, &blend_clear_state);
r300_emit_blend_color_state(r300, &blend_color_clear_state);
r300_emit_dsa_state(r300, &dsa_clear_state);
diff --git a/src/gallium/drivers/r300/r300_winsys.h b/src/gallium/drivers/r300/r300_winsys.h
index 393ba07012..761aedebfc 100644
--- a/src/gallium/drivers/r300/r300_winsys.h
+++ b/src/gallium/drivers/r300/r300_winsys.h
@@ -53,6 +53,22 @@ struct r300_winsys {
/* GB pipe count */
uint32_t gb_pipes;
+ /* GART size. */
+ uint32_t gart_size;
+
+ /* VRAM size. */
+ uint32_t vram_size;
+
+ /* Add a pipe_buffer to the list of buffer objects to validate. */
+ void (*add_buffer)(struct r300_winsys* winsys,
+ struct pipe_buffer* pbuffer,
+ uint32_t rd,
+ uint32_t wd);
+
+ /* Revalidate all currently setup pipe_buffers.
+ * Returns TRUE if a flush is required. */
+ boolean (*validate)(struct r300_winsys* winsys);
+
/* Check to see if there's room for commands. */
boolean (*check_cs)(struct r300_winsys* winsys, int size);
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c
index 611ee68da6..6313eb219e 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c
+++ b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c
@@ -68,8 +68,8 @@ static struct pipe_buffer *radeon_buffer_create(struct pipe_winsys *ws,
domain |= RADEON_GEM_DOMAIN_GTT;
}
- radeon_buffer->bo = radeon_bo_open(radeon_ws->bom, 0, size, alignment,
- domain, 0);
+ radeon_buffer->bo = radeon_bo_open(radeon_ws->priv->bom, 0, size,
+ alignment, domain, 0);
if (radeon_buffer->bo == NULL) {
FREE(radeon_buffer);
}
@@ -169,8 +169,14 @@ struct radeon_winsys* radeon_pipe_winsys(int fd)
return NULL;
}
+ radeon_ws->priv = CALLOC_STRUCT(radeon_winsys_priv);
+ if (radeon_ws->priv == NULL) {
+ FREE(radeon_ws);
+ return NULL;
+ }
+
bom = radeon_bo_manager_gem_ctor(fd);
- radeon_ws->bom = bom;
+ radeon_ws->priv->bom = bom;
radeon_ws->base.flush_frontbuffer = radeon_flush_frontbuffer;
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_buffer.h b/src/gallium/winsys/drm/radeon/core/radeon_buffer.h
index 163422f296..73fa362aca 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_buffer.h
+++ b/src/gallium/winsys/drm/radeon/core/radeon_buffer.h
@@ -41,6 +41,7 @@
#include "util/u_memory.h"
#include "radeon_bo.h"
+#include "radeon_cs.h"
#include "radeon_drm.h"
@@ -49,13 +50,24 @@ struct radeon_pipe_buffer {
struct radeon_bo *bo;
};
+#define RADEON_MAX_BOS 24
+
+struct radeon_winsys_priv {
+ /* Radeon BO manager. */
+ struct radeon_bo_manager* bom;
+
+ /* Radeon BO space checker. */
+ struct radeon_cs_space_check sc[RADEON_MAX_BOS];
+ /* Current BO count. */
+ unsigned bo_count;
+};
+
struct radeon_winsys {
/* Parent class. */
struct pipe_winsys base;
- /* Radeon BO manager.
- * This corresponds to void* radeon_winsys in r300_winsys. */
- struct radeon_bo_manager* bom;
+ /* This corresponds to void* radeon_winsys in r300_winsys. */
+ struct radeon_winsys_priv* priv;
};
struct radeon_winsys* radeon_pipe_winsys(int fb);
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_drm.c b/src/gallium/winsys/drm/radeon/core/radeon_drm.c
index 1f89d1b1d1..428d3f65a1 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_drm.c
+++ b/src/gallium/winsys/drm/radeon/core/radeon_drm.c
@@ -32,7 +32,7 @@
/* Create a pipe_screen. */
struct pipe_screen* radeon_create_screen(int drmFB,
- struct drm_create_screen_arg *arg )
+ struct drm_create_screen_arg *arg)
{
struct radeon_winsys* winsys = radeon_pipe_winsys(drmFB);
@@ -69,7 +69,7 @@ struct pipe_buffer* radeon_buffer_from_handle(struct pipe_screen* screen,
unsigned handle)
{
struct radeon_bo_manager* bom =
- ((struct radeon_winsys*)screen->winsys)->bom;
+ ((struct radeon_winsys*)screen->winsys)->priv->bom;
struct radeon_pipe_buffer* radeon_buffer;
struct radeon_bo* bo = NULL;
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c
index 929e4842cc..b172107432 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c
+++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c
@@ -22,6 +22,54 @@
#include "radeon_r300.h"
+static void radeon_r300_add_buffer(struct r300_winsys* winsys,
+ struct pipe_buffer* pbuffer,
+ uint32_t rd,
+ uint32_t wd)
+{
+ int i;
+ struct radeon_winsys_priv* priv =
+ (struct radeon_winsys_priv*)winsys->radeon_winsys;
+ struct radeon_cs_space_check* sc = priv->sc;
+ struct radeon_bo* bo = ((struct radeon_pipe_buffer*)pbuffer)->bo;
+
+ /* Check to see if this BO is already in line for validation;
+ * find a slot for it otherwise. */
+ for (i = 0; i < RADEON_MAX_BOS; i++) {
+ if (sc[i].bo == bo) {
+ return;
+ } else if (sc[i].bo == NULL) {
+ sc[i].bo = bo;
+ sc[i].read_domains = rd;
+ sc[i].write_domain = wd;
+ priv->bo_count = i + 1;
+ return;
+ }
+ }
+
+ assert(FALSE && "Oh God too many BOs!");
+}
+
+static boolean radeon_r300_validate(struct r300_winsys* winsys)
+{
+ int retval;
+ struct radeon_winsys_priv* priv =
+ (struct radeon_winsys_priv*)winsys->radeon_winsys;
+ struct radeon_cs_space_check* sc = priv->sc;
+
+ retval = radeon_cs_space_check(winsys->cs, sc, priv->bo_count);
+
+ if (retval == RADEON_CS_SPACE_OP_TO_BIG) {
+ /* XXX we need to failover here */
+ } else if (retval == RADEON_CS_SPACE_FLUSH) {
+ /* We must flush before more rendering can commence. */
+ return TRUE;
+ }
+
+ /* Things are fine, we can proceed as normal. */
+ return FALSE;
+}
+
static boolean radeon_r300_check_cs(struct r300_winsys* winsys, int size)
{
/* XXX check size here, lazy ass! */
@@ -77,6 +125,7 @@ static void radeon_r300_flush_cs(struct r300_winsys* winsys)
/* Helper function to do the ioctls needed for setup and init. */
static void do_ioctls(struct r300_winsys* winsys, int fd)
{
+ struct drm_radeon_gem_info info;
drm_radeon_getparam_t gp;
int target;
int retval;
@@ -102,6 +151,18 @@ static void do_ioctls(struct r300_winsys* winsys, int fd)
exit(1);
}
winsys->pci_id = target;
+
+ /* Finally, retrieve MM info */
+ retval = drmCommandWriteRead(fd, DRM_RADEON_GEM_INFO,
+ &info, sizeof(info));
+ if (retval) {
+ fprintf(stderr, "%s: Failed to get MM info, error number %d\n",
+ __FUNCTION__, retval);
+ exit(1);
+ }
+ winsys->gart_size = info.gart_size;
+ /* XXX */
+ winsys->vram_size = info.vram_visible;
}
struct r300_winsys*
@@ -119,6 +180,13 @@ radeon_create_r300_winsys(int fd, struct radeon_winsys* old_winsys)
csm = radeon_cs_manager_gem_ctor(fd);
winsys->cs = radeon_cs_create(csm, 1024 * 64 / 4);
+ radeon_cs_set_limit(winsys->cs,
+ RADEON_GEM_DOMAIN_GTT, winsys->gart_size);
+ radeon_cs_set_limit(winsys->cs,
+ RADEON_GEM_DOMAIN_VRAM, winsys->vram_size);
+
+ winsys->add_buffer = radeon_r300_add_buffer;
+ winsys->validate = radeon_r300_validate;
winsys->check_cs = radeon_r300_check_cs;
winsys->begin_cs = radeon_r300_begin_cs;
--
cgit v1.2.3
From 5b15cc312f16c6147e1f8f3d25c6ed34076aa3a1 Mon Sep 17 00:00:00 2001
From: Corbin Simpson
Date: Fri, 1 May 2009 06:01:52 -0700
Subject: r300-gallium, radeon-winsys: Hide radeon_cs from r300 pipe.
---
src/gallium/drivers/r300/r300_winsys.h | 5 ---
src/gallium/winsys/drm/radeon/core/radeon_buffer.c | 3 +-
src/gallium/winsys/drm/radeon/core/radeon_buffer.h | 6 ++++
src/gallium/winsys/drm/radeon/core/radeon_r300.c | 42 +++++++++++++++-------
4 files changed, 36 insertions(+), 20 deletions(-)
diff --git a/src/gallium/drivers/r300/r300_winsys.h b/src/gallium/drivers/r300/r300_winsys.h
index 761aedebfc..a833bb0399 100644
--- a/src/gallium/drivers/r300/r300_winsys.h
+++ b/src/gallium/drivers/r300/r300_winsys.h
@@ -42,11 +42,6 @@ struct r300_winsys {
/* Opaque Radeon-specific winsys object. */
void* radeon_winsys;
- /* CS object. This is very much like Intel's batchbuffer.
- * Fill it full of dwords and relocs and then submit.
- * Repeat as needed. */
- struct radeon_cs* cs;
-
/* PCI ID */
uint32_t pci_id;
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c
index 6313eb219e..a15487352b 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c
+++ b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c
@@ -175,8 +175,7 @@ struct radeon_winsys* radeon_pipe_winsys(int fd)
return NULL;
}
- bom = radeon_bo_manager_gem_ctor(fd);
- radeon_ws->priv->bom = bom;
+ radeon_ws->priv->bom = radeon_bo_manager_gem_ctor(fd);
radeon_ws->base.flush_frontbuffer = radeon_flush_frontbuffer;
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_buffer.h b/src/gallium/winsys/drm/radeon/core/radeon_buffer.h
index 73fa362aca..ca8bbb3c11 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_buffer.h
+++ b/src/gallium/winsys/drm/radeon/core/radeon_buffer.h
@@ -60,6 +60,12 @@ struct radeon_winsys_priv {
struct radeon_cs_space_check sc[RADEON_MAX_BOS];
/* Current BO count. */
unsigned bo_count;
+
+ /* Radeon CS manager. */
+ struct radeon_cs_manager* csm;
+
+ /* Current CS. */
+ struct radeon_cs* cs;
};
struct radeon_winsys {
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c
index b172107432..ac6cca36bf 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c
+++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c
@@ -57,7 +57,7 @@ static boolean radeon_r300_validate(struct r300_winsys* winsys)
(struct radeon_winsys_priv*)winsys->radeon_winsys;
struct radeon_cs_space_check* sc = priv->sc;
- retval = radeon_cs_space_check(winsys->cs, sc, priv->bo_count);
+ retval = radeon_cs_space_check(priv->cs, sc, priv->bo_count);
if (retval == RADEON_CS_SPACE_OP_TO_BIG) {
/* XXX we need to failover here */
@@ -83,13 +83,19 @@ static void radeon_r300_begin_cs(struct r300_winsys* winsys,
const char* function,
int line)
{
- radeon_cs_begin(winsys->cs, size, file, function, line);
+ struct radeon_winsys_priv* priv =
+ (struct radeon_winsys_priv*)winsys->radeon_winsys;
+
+ radeon_cs_begin(priv->cs, size, file, function, line);
}
static void radeon_r300_write_cs_dword(struct r300_winsys* winsys,
uint32_t dword)
{
- radeon_cs_write_dword(winsys->cs, dword);
+ struct radeon_winsys_priv* priv =
+ (struct radeon_winsys_priv*)winsys->radeon_winsys;
+
+ radeon_cs_write_dword(priv->cs, dword);
}
static void radeon_r300_write_cs_reloc(struct r300_winsys* winsys,
@@ -98,7 +104,10 @@ static void radeon_r300_write_cs_reloc(struct r300_winsys* winsys,
uint32_t wd,
uint32_t flags)
{
- radeon_cs_write_reloc(winsys->cs,
+ struct radeon_winsys_priv* priv =
+ (struct radeon_winsys_priv*)winsys->radeon_winsys;
+
+ radeon_cs_write_reloc(priv->cs,
((struct radeon_pipe_buffer*)pbuffer)->bo, rd, wd, flags);
}
@@ -107,19 +116,24 @@ static void radeon_r300_end_cs(struct r300_winsys* winsys,
const char* function,
int line)
{
- radeon_cs_end(winsys->cs, file, function, line);
+ struct radeon_winsys_priv* priv =
+ (struct radeon_winsys_priv*)winsys->radeon_winsys;
+
+ radeon_cs_end(priv->cs, file, function, line);
}
static void radeon_r300_flush_cs(struct r300_winsys* winsys)
{
+ struct radeon_winsys_priv* priv =
+ (struct radeon_winsys_priv*)winsys->radeon_winsys;
int retval = 0;
- retval = radeon_cs_emit(winsys->cs);
+ retval = radeon_cs_emit(priv->cs);
if (retval) {
debug_printf("radeon: Bad CS, dumping...\n");
- radeon_cs_print(winsys->cs, stderr);
+ radeon_cs_print(priv->cs, stderr);
}
- radeon_cs_erase(winsys->cs);
+ radeon_cs_erase(priv->cs);
}
/* Helper function to do the ioctls needed for setup and init. */
@@ -169,20 +183,22 @@ struct r300_winsys*
radeon_create_r300_winsys(int fd, struct radeon_winsys* old_winsys)
{
struct r300_winsys* winsys = CALLOC_STRUCT(r300_winsys);
- struct radeon_cs_manager* csm;
+ struct radeon_winsys_priv* priv;
if (winsys == NULL) {
return NULL;
}
+ priv = old_winsys->priv;
+
do_ioctls(winsys, fd);
- csm = radeon_cs_manager_gem_ctor(fd);
+ priv->csm = radeon_cs_manager_gem_ctor(fd);
- winsys->cs = radeon_cs_create(csm, 1024 * 64 / 4);
- radeon_cs_set_limit(winsys->cs,
+ priv->cs = radeon_cs_create(priv->csm, 1024 * 64 / 4);
+ radeon_cs_set_limit(priv->cs,
RADEON_GEM_DOMAIN_GTT, winsys->gart_size);
- radeon_cs_set_limit(winsys->cs,
+ radeon_cs_set_limit(priv->cs,
RADEON_GEM_DOMAIN_VRAM, winsys->vram_size);
winsys->add_buffer = radeon_r300_add_buffer;
--
cgit v1.2.3
From 2953b180044df602fbbf5882715774a779ff2123 Mon Sep 17 00:00:00 2001
From: Corbin Simpson
Date: Fri, 1 May 2009 07:29:14 -0700
Subject: radeon: Don't even bother with things too big to fit into our card.
---
src/gallium/winsys/drm/radeon/core/radeon_r300.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c
index ac6cca36bf..da233203d7 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c
+++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c
@@ -60,7 +60,9 @@ static boolean radeon_r300_validate(struct r300_winsys* winsys)
retval = radeon_cs_space_check(priv->cs, sc, priv->bo_count);
if (retval == RADEON_CS_SPACE_OP_TO_BIG) {
- /* XXX we need to failover here */
+ /* We might as well HCF, since this is not going to fit in the card,
+ * period. */
+ exit(1);
} else if (retval == RADEON_CS_SPACE_FLUSH) {
/* We must flush before more rendering can commence. */
return TRUE;
--
cgit v1.2.3
From edd2bbe4a70fcb9f8e8365f19c1aba6deb4a272d Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Thu, 30 Apr 2009 17:27:51 -0600
Subject: docs: fix typo
---
docs/relnotes-7.5.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/relnotes-7.5.html b/docs/relnotes-7.5.html
index c10ccd7a5c..3de243d1b2 100644
--- a/docs/relnotes-7.5.html
+++ b/docs/relnotes-7.5.html
@@ -79,7 +79,7 @@ including GL_ATI_separate_stencil, GL_EXT_stencil_two_side and OpenGL 2.0
Remove support for GL_SGIX_shadow, GL_SGIX_shadow_ambient and
GL_SGIX_depth_texture extensions. Superseded by the ARB versions.
-
Omittd some old Mesa demos from the release tarballs, added some others.
+
Omitted some old Mesa demos from the release tarballs, added some others.
--
cgit v1.2.3
From 3eafd25aa3b8d7680d3a0ac4869681e951484371 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Fri, 1 May 2009 09:15:14 -0600
Subject: configs: bump MESA_MINOR to 5
---
configs/default | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configs/default b/configs/default
index eab36a3677..b5ef80afb3 100644
--- a/configs/default
+++ b/configs/default
@@ -9,7 +9,7 @@ CONFIG_NAME = default
# Version info
MESA_MAJOR=7
-MESA_MINOR=3
+MESA_MINOR=5
MESA_TINY=0
MESA_VERSION = $(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY)
--
cgit v1.2.3
From 8a488b1be720247339f5c86fea5d2bff3d0fe084 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Fri, 1 May 2009 09:19:59 -0600
Subject: mesa: remove -devel suffix from version
---
src/mesa/main/version.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h
index f5bf6e2c85..ba027465d4 100644
--- a/src/mesa/main/version.h
+++ b/src/mesa/main/version.h
@@ -31,7 +31,7 @@
#define MESA_MAJOR 7
#define MESA_MINOR 5
#define MESA_PATCH 0
-#define MESA_VERSION_STRING "7.5-devel"
+#define MESA_VERSION_STRING "7.5"
/* To make version comparison easy */
#define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
--
cgit v1.2.3
From 666e5bf4a6728484b4bc0c7e2583f141f1f2b2b7 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Fri, 1 May 2009 09:22:20 -0600
Subject: mesa: bump version to 7.6 (devel)
---
Makefile | 2 +-
configs/default | 2 +-
src/mesa/main/version.h | 7 ++++---
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile
index a77825e8f9..ab41116795 100644
--- a/Makefile
+++ b/Makefile
@@ -181,7 +181,7 @@ ultrix-gcc:
# Rules for making release tarballs
-VERSION=7.5-devel
+VERSION=7.6-devel
DIRECTORY = Mesa-$(VERSION)
LIB_NAME = MesaLib-$(VERSION)
DEMO_NAME = MesaDemos-$(VERSION)
diff --git a/configs/default b/configs/default
index b5ef80afb3..9c479fccdf 100644
--- a/configs/default
+++ b/configs/default
@@ -9,7 +9,7 @@ CONFIG_NAME = default
# Version info
MESA_MAJOR=7
-MESA_MINOR=5
+MESA_MINOR=6
MESA_TINY=0
MESA_VERSION = $(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY)
diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h
index f5bf6e2c85..d4d3dd1a94 100644
--- a/src/mesa/main/version.h
+++ b/src/mesa/main/version.h
@@ -1,8 +1,9 @@
/*
* Mesa 3-D graphics library
- * Version: 7.5
+ * Version: 7.6
*
* Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
+ * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -29,9 +30,9 @@
/* Mesa version */
#define MESA_MAJOR 7
-#define MESA_MINOR 5
+#define MESA_MINOR 6
#define MESA_PATCH 0
-#define MESA_VERSION_STRING "7.5-devel"
+#define MESA_VERSION_STRING "7.6-devel"
/* To make version comparison easy */
#define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
--
cgit v1.2.3
From 7ca04273387fb1af1b67d1359f2b0da4874a0e4c Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Fri, 1 May 2009 09:24:19 -0600
Subject: docs: initial 7.6 release notes page
---
docs/relnotes-7.6.html | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++
docs/relnotes.html | 1 +
2 files changed, 62 insertions(+)
create mode 100644 docs/relnotes-7.6.html
diff --git a/docs/relnotes-7.6.html b/docs/relnotes-7.6.html
new file mode 100644
index 0000000000..77ce013d43
--- /dev/null
+++ b/docs/relnotes-7.6.html
@@ -0,0 +1,61 @@
+
+
+Mesa Release Notes
+
+
+
+
+
+
+
+
Mesa 7.6 Release Notes / date TBD
+
+
+Mesa 7.6 is a new development release.
+People who are concerned with stability and reliability should stick
+with a previous release or wait for Mesa 7.6.1.
+
+
+Mesa 7.6 implements the OpenGL 2.1 API, but the version reported by
+glGetString(GL_VERSION) depends on the particular driver being used.
+Some drivers don't support all the features required in OpenGL 2.1.
+
+Note that the Mesa project is no longer using odd/even version numbers
+to indicate development/stable releases.
+The so-called development releases have been fairly stable.
+If you're especially concerned with stability you should probably look for
+"point" releases such as 7.5.1 which will be a bug-fix release.
+
+
+
+
MD5 checksums
+
+tbd
+
+
+
+
New features
+
+
OpenVG front-end (state tracker for Gallium).
+This was written by Zack Rusin at Tungsten Graphics.
+
+
+
+
Bug fixes
+
+
i965 DRI driver fixes, including support for "unlimited" size constant
+ buffers (GLSL uniforms)
+
+
+
+
Changes
+
+
+
+
+
diff --git a/docs/relnotes.html b/docs/relnotes.html
index 298352038c..936f565236 100644
--- a/docs/relnotes.html
+++ b/docs/relnotes.html
@@ -20,6 +20,7 @@ The release notes summarize what's new or changed in each Mesa release.