Mesa (master): glsl/pp: Do not try to enable extension `all'.

2010-02-16 Thread Michał Król
Module: Mesa
Branch: master
Commit: fa8acb052839da3b9e77e58ad17d94190f4d2f24
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=fa8acb052839da3b9e77e58ad17d94190f4d2f24

Author: Michal Krol 
Date:   Tue Feb 16 10:04:58 2010 +0100

glsl/pp: Do not try to enable extension `all'.

---

 src/glsl/pp/sl_pp_extension.c |   28 
 1 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/src/glsl/pp/sl_pp_extension.c b/src/glsl/pp/sl_pp_extension.c
index 677fb8a..1f00d94 100644
--- a/src/glsl/pp/sl_pp_extension.c
+++ b/src/glsl/pp/sl_pp_extension.c
@@ -137,8 +137,11 @@ sl_pp_process_extension(struct sl_pp_context *context,
  return -1;
   }
   out.token = SL_PP_EXTENSION_REQUIRE;
-  assert(extension);
-  extension->enabled = 1;
+
+  if (extension_name != context->dict.all) {
+ assert(extension);
+ extension->enabled = 1;
+  }
} else if (behavior == context->dict.enable) {
   if (out.data.extension == -1) {
  /* Warning: the extension cannot be enabled. */
@@ -149,24 +152,33 @@ sl_pp_process_extension(struct sl_pp_context *context,
  return -1;
   }
   out.token = SL_PP_EXTENSION_ENABLE;
-  assert(extension);
-  extension->enabled = 1;
+
+  if (extension_name != context->dict.all) {
+ assert(extension);
+ extension->enabled = 1;
+  }
} else if (behavior == context->dict.warn) {
   if (out.data.extension == -1) {
  /* Warning: the extension is not supported. */
  return 0;
   }
   out.token = SL_PP_EXTENSION_WARN;
-  assert(extension);
-  extension->enabled = 1;
+
+  if (extension_name != context->dict.all) {
+ assert(extension);
+ extension->enabled = 1;
+  }
} else if (behavior == context->dict.disable) {
   if (out.data.extension == -1) {
  /* Warning: the extension is not supported. */
  return 0;
   }
   out.token = SL_PP_EXTENSION_DISABLE;
-  assert(extension);
-  extension->enabled = 0;
+
+  if (extension_name != context->dict.all) {
+ assert(extension);
+ extension->enabled = 0;
+  }
} else {
   strcpy(context->error_msg, "unrecognised behavior name");
   return -1;

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (mesa_7_7_branch): slang: Fix handling of if/elif/else cases.

2010-02-16 Thread Michał Król
Module: Mesa
Branch: mesa_7_7_branch
Commit: 2eedbc94c22bc13575e7639620f0d1957f205b34
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2eedbc94c22bc13575e7639620f0d1957f205b34

Author: Michal Krol 
Date:   Tue Feb 16 10:34:07 2010 +0100

slang: Fix handling of if/elif/else cases.

Once if/elif evalutes to true, all subsequent conditions are always false.

---

 src/mesa/shader/slang/slang_preprocess.c |   15 +++
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/mesa/shader/slang/slang_preprocess.c 
b/src/mesa/shader/slang/slang_preprocess.c
index ba40bad..b92a933 100644
--- a/src/mesa/shader/slang/slang_preprocess.c
+++ b/src/mesa/shader/slang/slang_preprocess.c
@@ -447,6 +447,7 @@ typedef struct
GLboolean else_allowed;/* TRUE if in #if-#else section, FALSE if in 
#else-#endif section
* and for global context. */
GLboolean endif_required;  /* FALSE for global context only. */
+   GLboolean had_true;/* TRUE if any sibiling #if or #elif had 
condition value of TRUE. */
 } pp_cond_ctx;
 
 /* Should be enuff. */
@@ -612,6 +613,7 @@ pp_state_init (pp_state *self, slang_info_log *elog,
self->cond.top->effective = GL_TRUE;
self->cond.top->else_allowed = GL_FALSE;
self->cond.top->endif_required = GL_FALSE;
+   self->cond.top->had_true = GL_TRUE;
 }
 
 static GLvoid
@@ -1135,6 +1137,7 @@ preprocess_source (slang_string *output, const char 
*source,
state.cond.top->current = result ? GL_TRUE : GL_FALSE;
state.cond.top->else_allowed = GL_TRUE;
state.cond.top->endif_required = GL_TRUE;
+   state.cond.top->had_true = GL_FALSE;
pp_cond_stack_reevaluate (&state.cond);
 }
 break;
@@ -1146,8 +1149,10 @@ preprocess_source (slang_string *output, const char 
*source,
goto error;
 }
 
-/* Negate current condition and reevaluate it. */
-state.cond.top->current = !state.cond.top->current;
+state.cond.top->had_true = state.cond.top->had_true || 
state.cond.top->current;
+
+/* Update current condition and reevaluate it. */
+state.cond.top->current = !(state.cond.top->had_true || 
state.cond.top->current);
 state.cond.top->else_allowed = GL_FALSE;
 pp_cond_stack_reevaluate (&state.cond);
 if (state.cond.top->effective)
@@ -1161,8 +1166,10 @@ preprocess_source (slang_string *output, const char 
*source,
goto error;
 }
 
-/* Negate current condition and reevaluate it. */
-state.cond.top->current = !state.cond.top->current;
+state.cond.top->had_true = state.cond.top->had_true || 
state.cond.top->current;
+
+/* Update current condition and reevaluate it. */
+state.cond.top->current = !(state.cond.top->had_true || 
state.cond.top->current);
 pp_cond_stack_reevaluate (&state.cond);
 
 if (state.cond.top->effective)

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): Revert "progs/redbook: Temporarily disable the demos that extensions not part of windows to fix build ."

2010-02-16 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: b0f9717105301ee85afee0d03ee7e62e3e883326
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b0f9717105301ee85afee0d03ee7e62e3e883326

Author: José Fonseca 
Date:   Tue Feb 16 11:23:18 2010 +

Revert "progs/redbook: Temporarily disable the demos that extensions not part 
of windows to fix build."

This reverts commit 1587eff1b6d6ab74c302ca2ccb767d917ce3b1dd.

---

 progs/redbook/SConscript |   20 ++--
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/progs/redbook/SConscript b/progs/redbook/SConscript
index df7e8da..750ad36 100644
--- a/progs/redbook/SConscript
+++ b/progs/redbook/SConscript
@@ -14,8 +14,8 @@ progs = [
 'checker',
 'clip',
 'colormat',
-#'combiner',
-#'convolution',
+'combiner',
+'convolution',
 'cube',
 'cubemap',
 'depthcue',
@@ -24,29 +24,29 @@ progs = [
 'drawf',
 'feedback',
 'fog',
-#'fogcoord',
+'fogcoord',
 'fogindex',
 'font',
 'hello',
-#'histogram',
+'histogram',
 'image',
 'light',
 'lines',
 'list',
 'material',
-#'minmax',
+'minmax',
 'mipmap',
 'model',
 'movelight',
 'multisamp',
-#'multitex',
-#'mvarray',
+'multitex',
+'mvarray',
 'nurbs',
 'pickdepth',
 'picksquare',
 'plane',
 'planet',
-#'pointp',
+'pointp',
 'polyoff',
 'polys',
 'quadric',
@@ -56,7 +56,7 @@ progs = [
 'scene',
 'sceneflat',
 'select',
-#'shadowmap',
+'shadowmap',
 'smooth',
 'stencil',
 'stroke',
@@ -71,7 +71,7 @@ progs = [
 'texprox',
 'texsub',
 'texturesurf',
-#'texture3d',
+'texture3d',
 'torus',
 'trim',
 'unproject',

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (mesa_7_7_branch): vbo: Ensure vertices are always unmapped before the context is flushed.

2010-02-16 Thread Jose Fonseca
Module: Mesa
Branch: mesa_7_7_branch
Commit: af2023e31cde5ad2cf8ce740e20a98c4cbab37ce
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=af2023e31cde5ad2cf8ce740e20a98c4cbab37ce

Author: José Fonseca 
Date:   Tue Feb 16 12:21:55 2010 +

vbo: Ensure vertices are always unmapped before the context is flushed.

Purpose is two fold:

- when doing user-space memory management mapping a buffer stored in the
  graphics aperture effectively pins it there, increasing the likelyhood
  of failure of validating other buffers when flushing

- certain hardware/platform combinations do not allow a buffer to be
  simultaneously mapped and validated

This fixes assertion failures in HL Uplink with the svga driver, where
vbo was holding a map to a buffer which was also referred in the command
stream.

Note: this a non-invasive fix and shouldn't be just cherry-picked into
master as-is -- a cleaner fix for this problem should be searched.

---

 src/mesa/main/context.h  |8 
 src/mesa/state_tracker/st_draw.c |2 ++
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h
index c3be106..5a4f860 100644
--- a/src/mesa/main/context.h
+++ b/src/mesa/main/context.h
@@ -207,8 +207,8 @@ _mesa_Flush( void );
 do {   \
if (MESA_VERBOSE & VERBOSE_STATE)   \
   _mesa_debug(ctx, "FLUSH_VERTICES in %s\n", MESA_FUNCTION);\
-   if (ctx->Driver.NeedFlush & FLUSH_STORED_VERTICES)  \
-  ctx->Driver.FlushVertices(ctx, FLUSH_STORED_VERTICES);   \
+   if (ctx->Driver.NeedFlush)  \
+  ctx->Driver.FlushVertices(ctx, FLUSH_STORED_VERTICES | 
FLUSH_UPDATE_CURRENT); \
ctx->NewState |= newstate;  \
 } while (0)
 
@@ -226,8 +226,8 @@ do {
\
 do {   \
if (MESA_VERBOSE & VERBOSE_STATE)   \
   _mesa_debug(ctx, "FLUSH_CURRENT in %s\n", MESA_FUNCTION);\
-   if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT)   \
-  ctx->Driver.FlushVertices(ctx, FLUSH_UPDATE_CURRENT);\
+   if (ctx->Driver.NeedFlush)  \
+  ctx->Driver.FlushVertices(ctx, FLUSH_STORED_VERTICES | 
FLUSH_UPDATE_CURRENT);\
ctx->NewState |= newstate;  \
 } while (0)
 
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index d3b22db..823c72d 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -404,6 +404,7 @@ setup_interleaved_attribs(GLcontext *ctx,
 vbuffer->buffer_offset = 0;
  }
  else {
+assert(!bufobj->Pointer);
 vbuffer->buffer = NULL;
 pipe_buffer_reference(&vbuffer->buffer, stobj->buffer);
 vbuffer->buffer_offset = pointer_to_offset(low);
@@ -460,6 +461,7 @@ setup_non_interleaved_attribs(GLcontext *ctx,
  assert(stobj->buffer);
  /*printf("stobj %u = %p\n", attr, (void*) stobj);*/
 
+ assert(!bufobj->Pointer);
  vbuffer[attr].buffer = NULL;
  pipe_buffer_reference(&vbuffer[attr].buffer, stobj->buffer);
  vbuffer[attr].buffer_offset = 
pointer_to_offset(arrays[mesaAttr]->Ptr);

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (mesa_7_7_branch): mesa: Test for failed malloc in _mesa_HashInsert.

2010-02-16 Thread Brian Paul
Module: Mesa
Branch: mesa_7_7_branch
Commit: 7c7247ddbf6e3f7f93e44c1cb52490044f1a2215
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7c7247ddbf6e3f7f93e44c1cb52490044f1a2215

Author: Mike Stroyan 
Date:   Mon Feb 15 17:43:33 2010 -0700

mesa: Test for failed malloc in _mesa_HashInsert.

Signed-off-by: Brian Paul 

---

 src/mesa/main/hash.c |   10 ++
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/mesa/main/hash.c b/src/mesa/main/hash.c
index 08c6456..7c3c7a6 100644
--- a/src/mesa/main/hash.c
+++ b/src/mesa/main/hash.c
@@ -191,10 +191,12 @@ _mesa_HashInsert(struct _mesa_HashTable *table, GLuint 
key, void *data)
 
/* alloc and insert new table entry */
entry = MALLOC_STRUCT(HashEntry);
-   entry->Key = key;
-   entry->Data = data;
-   entry->Next = table->Table[pos];
-   table->Table[pos] = entry;
+   if (entry) {
+  entry->Key = key;
+  entry->Data = data;
+  entry->Next = table->Table[pos];
+  table->Table[pos] = entry;
+   }
 
_glthread_UNLOCK_MUTEX(table->Mutex);
 }

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (mesa_7_7_branch): mesa: Lock mutex around _mesa_HashLookup linked list chase.

2010-02-16 Thread Brian Paul
Module: Mesa
Branch: mesa_7_7_branch
Commit: 3094adb3caeb90124359db2356df3bf8ee94800a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3094adb3caeb90124359db2356df3bf8ee94800a

Author: Mike Stroyan 
Date:   Tue Feb 16 08:18:12 2010 -0700

mesa: Lock mutex around _mesa_HashLookup linked list chase.

Remove const qualifier from _mesa_HashLookup() table parameter to
avoid LOCK/UNLOCK warnings in the function body.

Signed-off-by: Brian Paul 

---

 src/mesa/main/hash.c |7 +--
 src/mesa/main/hash.h |2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/hash.c b/src/mesa/main/hash.c
index 7c3c7a6..fdfbe6b 100644
--- a/src/mesa/main/hash.c
+++ b/src/mesa/main/hash.c
@@ -128,7 +128,7 @@ _mesa_DeleteHashTable(struct _mesa_HashTable *table)
  * \return pointer to user's data or NULL if key not in table
  */
 void *
-_mesa_HashLookup(const struct _mesa_HashTable *table, GLuint key)
+_mesa_HashLookup(struct _mesa_HashTable *table, GLuint key)
 {
GLuint pos;
const struct HashEntry *entry;
@@ -137,13 +137,16 @@ _mesa_HashLookup(const struct _mesa_HashTable *table, 
GLuint key)
assert(key);
 
pos = HASH_FUNC(key);
+   _glthread_LOCK_MUTEX(table->Mutex);
entry = table->Table[pos];
while (entry) {
   if (entry->Key == key) {
-return entry->Data;
+ _glthread_UNLOCK_MUTEX(table->Mutex);
+ return entry->Data;
   }
   entry = entry->Next;
}
+   _glthread_UNLOCK_MUTEX(table->Mutex);
return NULL;
 }
 
diff --git a/src/mesa/main/hash.h b/src/mesa/main/hash.h
index d18db76..4f916f9 100644
--- a/src/mesa/main/hash.h
+++ b/src/mesa/main/hash.h
@@ -39,7 +39,7 @@ extern struct _mesa_HashTable *_mesa_NewHashTable(void);
 
 extern void _mesa_DeleteHashTable(struct _mesa_HashTable *table);
 
-extern void *_mesa_HashLookup(const struct _mesa_HashTable *table, GLuint key);
+extern void *_mesa_HashLookup(struct _mesa_HashTable *table, GLuint key);
 
 extern void _mesa_HashInsert(struct _mesa_HashTable *table, GLuint key, void 
*data);
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): mesa: Test for failed malloc in _mesa_HashInsert.

2010-02-16 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 693f4af63dd98b963e91259029cc0131b791721c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=693f4af63dd98b963e91259029cc0131b791721c

Author: Brian Paul 
Date:   Tue Feb 16 08:21:28 2010 -0700

mesa: Test for failed malloc in _mesa_HashInsert.

Signed-off-by: Brian Paul 

(cherry picked from commit 7c7247ddbf6e3f7f93e44c1cb52490044f1a2215)

---

 src/mesa/main/hash.c |   10 ++
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/mesa/main/hash.c b/src/mesa/main/hash.c
index 08c6456..7c3c7a6 100644
--- a/src/mesa/main/hash.c
+++ b/src/mesa/main/hash.c
@@ -191,10 +191,12 @@ _mesa_HashInsert(struct _mesa_HashTable *table, GLuint 
key, void *data)
 
/* alloc and insert new table entry */
entry = MALLOC_STRUCT(HashEntry);
-   entry->Key = key;
-   entry->Data = data;
-   entry->Next = table->Table[pos];
-   table->Table[pos] = entry;
+   if (entry) {
+  entry->Key = key;
+  entry->Data = data;
+  entry->Next = table->Table[pos];
+  table->Table[pos] = entry;
+   }
 
_glthread_UNLOCK_MUTEX(table->Mutex);
 }

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): mesa: Lock mutex around _mesa_HashLookup linked list chase.

2010-02-16 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 107a2ec9eef53dee038c1bcc0d956c5667e0b68f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=107a2ec9eef53dee038c1bcc0d956c5667e0b68f

Author: Brian Paul 
Date:   Tue Feb 16 08:21:38 2010 -0700

mesa: Lock mutex around _mesa_HashLookup linked list chase.

Remove const qualifier from _mesa_HashLookup() table parameter to
avoid LOCK/UNLOCK warnings in the function body.

Signed-off-by: Brian Paul 

(cherry picked from commit 3094adb3caeb90124359db2356df3bf8ee94800a)

---

 src/mesa/main/hash.c |7 +--
 src/mesa/main/hash.h |2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/hash.c b/src/mesa/main/hash.c
index 7c3c7a6..fdfbe6b 100644
--- a/src/mesa/main/hash.c
+++ b/src/mesa/main/hash.c
@@ -128,7 +128,7 @@ _mesa_DeleteHashTable(struct _mesa_HashTable *table)
  * \return pointer to user's data or NULL if key not in table
  */
 void *
-_mesa_HashLookup(const struct _mesa_HashTable *table, GLuint key)
+_mesa_HashLookup(struct _mesa_HashTable *table, GLuint key)
 {
GLuint pos;
const struct HashEntry *entry;
@@ -137,13 +137,16 @@ _mesa_HashLookup(const struct _mesa_HashTable *table, 
GLuint key)
assert(key);
 
pos = HASH_FUNC(key);
+   _glthread_LOCK_MUTEX(table->Mutex);
entry = table->Table[pos];
while (entry) {
   if (entry->Key == key) {
-return entry->Data;
+ _glthread_UNLOCK_MUTEX(table->Mutex);
+ return entry->Data;
   }
   entry = entry->Next;
}
+   _glthread_UNLOCK_MUTEX(table->Mutex);
return NULL;
 }
 
diff --git a/src/mesa/main/hash.h b/src/mesa/main/hash.h
index d18db76..4f916f9 100644
--- a/src/mesa/main/hash.h
+++ b/src/mesa/main/hash.h
@@ -39,7 +39,7 @@ extern struct _mesa_HashTable *_mesa_NewHashTable(void);
 
 extern void _mesa_DeleteHashTable(struct _mesa_HashTable *table);
 
-extern void *_mesa_HashLookup(const struct _mesa_HashTable *table, GLuint key);
+extern void *_mesa_HashLookup(struct _mesa_HashTable *table, GLuint key);
 
 extern void _mesa_HashInsert(struct _mesa_HashTable *table, GLuint key, void 
*data);
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): configure.ac: Lower require dri2proto version to 2.1

2010-02-16 Thread Kristian Høgsberg
Module: Mesa
Branch: master
Commit: aa0cd707af59efe322426420f68d42eb35ee922b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=aa0cd707af59efe322426420f68d42eb35ee922b

Author: Kristian Høgsberg 
Date:   Mon Feb 15 10:44:05 2010 -0500

configure.ac: Lower require dri2proto version to 2.1

Additions after 2.1 are implemented in a conditional way and will be
supported if available.

---

 configure.ac |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index 27405bb..be06adf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,7 +20,7 @@ AC_CANONICAL_HOST
 dnl Versions for external dependencies
 LIBDRM_REQUIRED=2.4.15
 LIBDRM_RADEON_REQUIRED=2.4.17
-DRI2PROTO_REQUIRED=2.2
+DRI2PROTO_REQUIRED=2.1
 GLPROTO_REQUIRED=1.4.11
 
 dnl Check for progs

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): glx: Move GetGLXDRIDrawable() prototype to glxclient.h

2010-02-16 Thread Kristian Høgsberg
Module: Mesa
Branch: master
Commit: 97ec6076f596a3820a9b7c4b7eae18bd98c6676b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=97ec6076f596a3820a9b7c4b7eae18bd98c6676b

Author: Kristian Høgsberg 
Date:   Mon Feb 15 11:12:28 2010 -0500

glx: Move GetGLXDRIDrawable() prototype to glxclient.h

---

 src/glx/glx_pbuffer.c |4 
 src/glx/glxclient.h   |4 
 src/glx/glxcmds.c |4 
 3 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/glx/glx_pbuffer.c b/src/glx/glx_pbuffer.c
index a0a0223..4c122ba 100644
--- a/src/glx/glx_pbuffer.c
+++ b/src/glx/glx_pbuffer.c
@@ -186,10 +186,6 @@ DestroyPbuffer(Display * dpy, GLXDrawable drawable)
 
 
 #ifdef GLX_DIRECT_RENDERING
-extern __GLXDRIdrawable *GetGLXDRIDrawable(Display * dpy,
-   GLXDrawable drawable,
-   int *const scrn_num);
-
 static GLenum
 determineTextureTarget(const int *attribs, int numAttribs)
 {
diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h
index e0b286b..f88e9fb 100644
--- a/src/glx/glxclient.h
+++ b/src/glx/glxclient.h
@@ -798,6 +798,10 @@ __driGetMscRateOML(__DRIdrawable * draw,
 /* So that dri2.c:DRI2WireToEvent() can access
  * glx_info->codes->first_event */
 XExtDisplayInfo *__glXFindDisplay (Display *dpy);
+
+extern __GLXDRIdrawable *
+GetGLXDRIDrawable(Display *dpy, GLXDrawable drawable, int *const scrn_num);
+
 #endif
 
 #endif /* !__GLX_client_h__ */
diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
index c3be974..da0dcf1 100644
--- a/src/glx/glxcmds.c
+++ b/src/glx/glxcmds.c
@@ -105,10 +105,6 @@ GarbageCollectDRIDrawables(Display * dpy, 
__GLXscreenConfigs * sc)
XSetErrorHandler(oldXErrorHandler);
 }
 
-extern __GLXDRIdrawable *GetGLXDRIDrawable(Display * dpy,
-   GLXDrawable drawable,
-   int *const scrn_num);
-
 /**
  * Get the __DRIdrawable for the drawable associated with a GLXContext
  *

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): dri2: Event driven buffer validation.

2010-02-16 Thread Kristian Høgsberg
Module: Mesa
Branch: master
Commit: 61d26bc82e7c4100acfb551cbb0ba9d84bbc4ba5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=61d26bc82e7c4100acfb551cbb0ba9d84bbc4ba5

Author: Francisco Jerez 
Date:   Mon Feb  8 19:27:56 2010 +0100

dri2: Event driven buffer validation.

When a buffer invalidation event is received from the X server, the
"invalidate" hook of the DRI2 flush extension is executed: A generic
implementation (dri2InvalidateDrawable) is provided that just bumps
the "pStamp" sequence number in __DRIdrawableRec.

For old servers not supporting buffer invalidation events, the
invalidate hook will be called before flushing the fake front/back
buffer (that's typically once per frame -- not a lot worse than the
situation we were in before).

No effort has been made on preserving backwards compatibility with
version 2 of the flush extension, but I think it's acceptable because
AFAIK no released stack is making use of it.

Signed-off-by: Kristian Høgsberg 

---

 include/GL/internal/dri_interface.h  |   14 -
 src/glx/dri2.c   |   10 +-
 src/glx/dri2_glx.c   |   42 +
 src/glx/glxclient.h  |2 +
 src/mesa/drivers/dri/common/dri_util.c   |   10 +-
 src/mesa/drivers/dri/common/dri_util.h   |9 --
 src/mesa/drivers/dri/intel/intel_context.c   |2 +-
 src/mesa/drivers/dri/intel/intel_screen.c|9 ++
 src/mesa/drivers/dri/intel/intel_tex_image.c |2 +-
 9 files changed, 65 insertions(+), 35 deletions(-)

diff --git a/include/GL/internal/dri_interface.h 
b/include/GL/internal/dri_interface.h
index 58540d6..cb99c27 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -269,22 +269,20 @@ struct __DRItexBufferExtensionRec {
  * Used by drivers that implement DRI2
  */
 #define __DRI2_FLUSH "DRI2_Flush"
-#define __DRI2_FLUSH_VERSION 2
+#define __DRI2_FLUSH_VERSION 3
 struct __DRI2flushExtensionRec {
 __DRIextension base;
 void (*flush)(__DRIdrawable *drawable);
 
 /**
- * Flush all rendering queue in the driver to the drm and
- * invalidate all buffers.  The driver will call out to
- * getBuffers/getBuffersWithFormat before it starts rendering
- * again.
+ * Ask the driver to call getBuffers/getBuffersWithFormat before
+ * it starts rendering again.
  *
- * \param drawable the drawable to flush and invalidate
+ * \param drawable the drawable to invalidate
  *
- * \since 2
+ * \since 3
  */
-void (*flushInvalidate)(__DRIdrawable *drawable);
+void (*invalidate)(__DRIdrawable *drawable);
 };
 
 
diff --git a/src/glx/dri2.c b/src/glx/dri2.c
index 91053d3..a7a8cb5 100644
--- a/src/glx/dri2.c
+++ b/src/glx/dri2.c
@@ -81,7 +81,7 @@ static XEXT_GENERATE_FIND_DISPLAY (DRI2FindDisplay,
dri2Info,
dri2ExtensionName,
&dri2ExtensionHooks,
-   1, NULL)
+   DRI2NumberEvents, NULL)
 
 static Bool
 DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire)
@@ -126,7 +126,15 @@ DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire)
   return True;
}
 #endif
+#ifdef DRI2_InvalidateBuffers
+   case DRI2_InvalidateBuffers:
+   {
+  xDRI2InvalidateBuffers *awire = (xDRI2InvalidateBuffers *)wire;
 
+  dri2InvalidateBuffers(dpy, awire->drawable);
+  return False;
+   }
+#endif
default:
   /* client doesn't support server event */
   break;
diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index 15a3ea5..29d589c 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -67,6 +67,7 @@ struct __GLXDRIdisplayPrivateRec
int driMinor;
int driPatch;
int swapAvailable;
+   int invalidateAvailable;
 };
 
 struct __GLXDRIcontextPrivateRec
@@ -310,12 +311,18 @@ dri2WaitGL(__GLXDRIdrawable * pdraw)
XFixesDestroyRegion(pdraw->psc->dpy, region);
 }
 
-
 static void
-dri2FlushFrontBuffer(__DRIdrawable * driDrawable, void *loaderPrivate)
+dri2FlushFrontBuffer(__DRIdrawable *driDrawable, void *loaderPrivate)
 {
-   (void) driDrawable;
-   dri2WaitGL((__GLXDRIdrawable *) loaderPrivate);
+   __GLXDRIdrawablePrivate *pdraw = loaderPrivate;
+   __GLXdisplayPrivate *priv = __glXInitialize(pdraw->base.psc->dpy);
+   __GLXDRIdisplayPrivate *pdp = (__GLXDRIdisplayPrivate *)priv->dri2Display;
+
+   /* Old servers don't send invalidate events */
+   if (!pdp->invalidateAvailable)
+   dri2InvalidateBuffers(priv->dpy, pdraw->base.xDrawable);
+
+   dri2WaitGL(loaderPrivate);
 }
 
 
@@ -375,6 +382,10 @@ dri2SwapBuffers(__GLXDRIdrawable *pdraw, int64_t 
target_msc, int64_t divisor,
(*pdraw->psc->f->flush)(pdraw->driDrawable);
 #endif
 
+/* Old servers don't send invalidate events */
+if (!pdp->invalidateAvailable)
+   dri2InvalidateBuffers(dpyPriv->

Mesa (master): dri2: Allocate cliprect as part of the __DRIdrawableRec

2010-02-16 Thread Kristian Høgsberg
Module: Mesa
Branch: master
Commit: 925b901ba313a3ddd7567eca088951be39414430
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=925b901ba313a3ddd7567eca088951be39414430

Author: Kristian Høgsberg 
Date:   Mon Feb 15 15:15:05 2010 -0500

dri2: Allocate cliprect as part of the __DRIdrawableRec

---

 src/mesa/drivers/dri/common/dri_util.c |8 
 src/mesa/drivers/dri/common/dri_util.h |4 
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/common/dri_util.c 
b/src/mesa/drivers/dri/common/dri_util.c
index f5e7923..befe167 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -485,8 +485,8 @@ dri2CreateNewDrawable(__DRIscreen *screen,
 if (!pdraw)
return NULL;
 
-pdraw->pClipRects = _mesa_malloc(sizeof *pdraw->pBackClipRects);
-pdraw->pBackClipRects = _mesa_malloc(sizeof *pdraw->pBackClipRects);
+pdraw->pClipRects = &pdraw->dri2.clipRect;
+pdraw->pBackClipRects = &pdraw->dri2.clipRect;
 
 return pdraw;
 }
@@ -507,11 +507,11 @@ static void dri_put_drawable(__DRIdrawable *pdp)
 
psp = pdp->driScreenPriv;
 (*psp->DriverAPI.DestroyBuffer)(pdp);
-   if (pdp->pClipRects) {
+   if (pdp->pClipRects && pdp->pClipRects != &pdp->dri2.clipRect) {
_mesa_free(pdp->pClipRects);
pdp->pClipRects = NULL;
}
-   if (pdp->pBackClipRects) {
+   if (pdp->pBackClipRects && pdp->pClipRects != &pdp->dri2.clipRect) {
_mesa_free(pdp->pBackClipRects);
pdp->pBackClipRects = NULL;
}
diff --git a/src/mesa/drivers/dri/common/dri_util.h 
b/src/mesa/drivers/dri/common/dri_util.h
index e9d5a9d..8d02524 100644
--- a/src/mesa/drivers/dri/common/dri_util.h
+++ b/src/mesa/drivers/dri/common/dri_util.h
@@ -378,6 +378,10 @@ struct __DRIdrawableRec {
 unsigned int swap_interval;
 
 GLboolean validBuffers;
+
+struct {
+   drm_clip_rect_t clipRect;
+} dri2;
 };
 
 /**

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): dri/nouveau: Use event driven buffer validation.

2010-02-16 Thread Kristian Høgsberg
Module: Mesa
Branch: master
Commit: 88a560691b904cc8eacda62d9bf80987d3c430c1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=88a560691b904cc8eacda62d9bf80987d3c430c1

Author: Francisco Jerez 
Date:   Mon Feb  8 19:27:57 2010 +0100

dri/nouveau: Use event driven buffer validation.

---

 src/mesa/drivers/dri/nouveau/nouveau_context.c |   33 +---
 src/mesa/drivers/dri/nouveau/nouveau_screen.c  |   12 
 2 files changed, 41 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c 
b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index b87b8db..6117f68 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -140,6 +140,8 @@ nouveau_update_renderbuffers(__DRIcontext *context, 
__DRIdrawable *drawable,
__DRIbuffer *buffers = NULL;
int i = 0, count, ret;
 
+   *stamp = *drawable->pStamp;
+
attachments[i++] = __DRI_BUFFER_FRONT_LEFT;
if (fb->Visual.doubleBufferMode)
attachments[i++] = __DRI_BUFFER_BACK_LEFT;
@@ -218,10 +220,11 @@ nouveau_context_make_current(__DRIcontext *dri_ctx, 
__DRIdrawable *dri_draw,
struct nouveau_context *nctx = dri_ctx->driverPrivate;
GLcontext *ctx = &nctx->base;
 
-   if (nctx->screen->context != nctx) {
-   nctx->screen->context = nctx;
-   BITSET_ONES(nctx->dirty);
-   }
+   if (nctx->screen->context == nctx)
+   return GL_TRUE;
+
+   nctx->screen->context = nctx;
+   BITSET_ONES(nctx->dirty);
 
/* Ask the X server for new renderbuffers. */
nouveau_update_renderbuffers(dri_ctx, dri_draw,
@@ -267,6 +270,28 @@ void
 nouveau_validate_framebuffer(GLcontext *ctx)
 {
struct nouveau_context *nctx = to_nouveau_context(ctx);
+   __DRIcontext *dri_ctx = to_nouveau_context(ctx)->dri_context;
+   __DRIdrawable *dri_draw = dri_ctx->driDrawablePriv;
+   __DRIdrawable *dri_read = dri_ctx->driReadablePriv;
+
+   if ((ctx->DrawBuffer->Name == 0 &&
+nctx->drawable.d_stamp != *dri_draw->pStamp) ||
+   (dri_draw != dri_read &&
+ctx->ReadBuffer->Name == 0 &&
+nctx->drawable.r_stamp != *dri_read->pStamp)) {
+   if (nctx->drawable.dirty)
+   ctx->Driver.Flush(ctx);
+
+   /* Ask the X server for new renderbuffers. */
+   nouveau_update_renderbuffers(dri_ctx, dri_draw,
+&nctx->drawable.d_stamp);
+   if (dri_draw != dri_read)
+   nouveau_update_renderbuffers(dri_ctx, dri_read,
+&nctx->drawable.r_stamp);
+
+   if (nouveau_next_dirty_state(ctx) >= 0)
+   FIRE_RING(context_chan(ctx));
+   }
 
/* Someone's planning to draw something really soon. */
nctx->drawable.dirty = GL_TRUE;
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c 
b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
index 6abab8c..3f9f3a3 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_screen.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
@@ -247,7 +247,19 @@ nouveau_destroy_buffer(__DRIdrawable *drawable)
(struct gl_framebuffer **)&drawable->driverPrivate, NULL);
 }
 
+static void
+nouveau_drawable_flush(__DRIdrawable *draw)
+{
+}
+
+static const struct __DRI2flushExtensionRec nouveau_flush_extension = {
+{ __DRI2_FLUSH, __DRI2_FLUSH_VERSION },
+nouveau_drawable_flush,
+dri2InvalidateDrawable,
+};
+
 static const __DRIextension *nouveau_screen_extensions[] = {
+&nouveau_flush_extension.base,
 NULL
 };
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): st/dri2: Use event-driven buffer validation.

2010-02-16 Thread Kristian Høgsberg
Module: Mesa
Branch: master
Commit: f845e4ff1bf4e7e2f804024157494a12eedec174
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f845e4ff1bf4e7e2f804024157494a12eedec174

Author: Francisco Jerez 
Date:   Mon Feb  8 19:27:58 2010 +0100

st/dri2: Use event-driven buffer validation.

---

 src/gallium/state_trackers/dri/dri_context.c  |6 +--
 src/gallium/state_trackers/dri/dri_drawable.c |   13 ++
 src/gallium/state_trackers/dri/dri_screen.c   |   12 ++
 src/mesa/SConscript   |1 -
 src/mesa/sources.mak  |1 -
 src/mesa/state_tracker/st_atom.c  |7 +++-
 src/mesa/state_tracker/st_cb_viewport.c   |   50 -
 src/mesa/state_tracker/st_cb_viewport.h   |   29 --
 src/mesa/state_tracker/st_context.c   |2 -
 9 files changed, 33 insertions(+), 88 deletions(-)

diff --git a/src/gallium/state_trackers/dri/dri_context.c 
b/src/gallium/state_trackers/dri/dri_context.c
index 5033c3c..908cef4 100644
--- a/src/gallium/state_trackers/dri/dri_context.c
+++ b/src/gallium/state_trackers/dri/dri_context.c
@@ -166,10 +166,8 @@ dri_make_current(__DRIcontext * cPriv,
   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);
+dri_update_buffer(ctx->pipe->screen,
+  ctx->pipe->priv);
   }
} else {
   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 97277c0..4d7596a 100644
--- a/src/gallium/state_trackers/dri/dri_drawable.c
+++ b/src/gallium/state_trackers/dri/dri_drawable.c
@@ -284,7 +284,20 @@ dri_update_buffer(struct pipe_screen *screen, void 
*context_private)
 {
struct dri_context *ctx = (struct dri_context *)context_private;
 
+   if (ctx->d_stamp == *ctx->dPriv->pStamp &&
+   ctx->r_stamp == *ctx->rPriv->pStamp)
+  return;
+
+   ctx->d_stamp = *ctx->dPriv->pStamp;
+   ctx->r_stamp = *ctx->rPriv->pStamp;
+
+   st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
+
+   /* Ask the X server for new renderbuffers. */
dri_get_buffers(ctx->dPriv);
+   if (ctx->dPriv != ctx->rPriv)
+  dri_get_buffers(ctx->rPriv);
+
 }
 
 void
diff --git a/src/gallium/state_trackers/dri/dri_screen.c 
b/src/gallium/state_trackers/dri/dri_screen.c
index b36ea43..77d6402 100644
--- a/src/gallium/state_trackers/dri/dri_screen.c
+++ b/src/gallium/state_trackers/dri/dri_screen.c
@@ -61,6 +61,17 @@ static const __DRItexBufferExtension dri2TexBufferExtension 
= {
dri2_set_tex_buffer2,
 };
 
+static void
+dri2_flush_drawable(__DRIdrawable *draw)
+{
+}
+
+static const __DRI2flushExtension dri2FlushExtension = {
+{ __DRI2_FLUSH, __DRI2_FLUSH_VERSION },
+dri2_flush_drawable,
+dri2InvalidateDrawable,
+};
+
static const __DRIextension *dri_screen_extensions[] = {
   &driReadDrawableExtension,
   &driCopySubBufferExtension.base,
@@ -68,6 +79,7 @@ static const __DRItexBufferExtension dri2TexBufferExtension = 
{
   &driFrameTrackingExtension.base,
   &driMediaStreamCounterExtension.base,
   &dri2TexBufferExtension.base,
+  &dri2FlushExtension.base,
   NULL
};
 
diff --git a/src/mesa/SConscript b/src/mesa/SConscript
index ea5bad2..0726fcb 100644
--- a/src/mesa/SConscript
+++ b/src/mesa/SConscript
@@ -174,7 +174,6 @@ if env['platform'] != 'winddk':
'state_tracker/st_cb_readpixels.c',
'state_tracker/st_cb_strings.c',
'state_tracker/st_cb_texture.c',
-   'state_tracker/st_cb_viewport.c',
'state_tracker/st_context.c',
'state_tracker/st_debug.c',
'state_tracker/st_draw.c',
diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak
index 12d4c28..3543319 100644
--- a/src/mesa/sources.mak
+++ b/src/mesa/sources.mak
@@ -204,7 +204,6 @@ STATETRACKER_SOURCES = \
state_tracker/st_cb_readpixels.c \
state_tracker/st_cb_strings.c \
state_tracker/st_cb_texture.c \
-   state_tracker/st_cb_viewport.c \
state_tracker/st_context.c \
state_tracker/st_debug.c \
state_tracker/st_draw.c \
diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c
index 73df44d..6a7ebff 100644
--- a/src/mesa/state_tracker/st_atom.c
+++ b/src/mesa/state_tracker/st_atom.c
@@ -35,7 +35,8 @@
 #include "st_cb_bitmap.h"
 #include "st_program.h"
 
-   
+#include "pipe/p_context.h"
+
 
 /**
  * This is used to initialize st->atoms[].
@@ -135,6 +136,10 @@ void st_validate_state( struct st_context *st )
 
check_program_state( st );
 
+   if (st->pipe->screen->update_buffer)
+  st->pipe->screen->update_buffer(st->pipe->screen,
+ st->pipe->priv);
+
  

Mesa (master): glx: Only register wire handlers for the events the server supports

2010-02-16 Thread Kristian Høgsberg
Module: Mesa
Branch: master
Commit: 215d0dae6151e83ca4dc1a65c96d56b0835d27e7
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=215d0dae6151e83ca4dc1a65c96d56b0835d27e7

Author: Kristian Høgsberg 
Date:   Tue Feb 16 10:27:57 2010 -0500

glx: Only register wire handlers for the events the server supports

---

 src/glx/dri2.c |   21 -
 1 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/src/glx/dri2.c b/src/glx/dri2.c
index a7a8cb5..963c587 100644
--- a/src/glx/dri2.c
+++ b/src/glx/dri2.c
@@ -81,7 +81,7 @@ static XEXT_GENERATE_FIND_DISPLAY (DRI2FindDisplay,
dri2Info,
dri2ExtensionName,
&dri2ExtensionHooks,
-   DRI2NumberEvents, NULL)
+   0, NULL)
 
 static Bool
 DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire)
@@ -182,6 +182,7 @@ DRI2QueryVersion(Display * dpy, int *major, int *minor)
XExtDisplayInfo *info = DRI2FindDisplay(dpy);
xDRI2QueryVersionReply rep;
xDRI2QueryVersionReq *req;
+   int i, nevents;
 
XextCheckExtension(dpy, info, dri2ExtensionName, False);
 
@@ -201,6 +202,24 @@ DRI2QueryVersion(Display * dpy, int *major, int *minor)
UnlockDisplay(dpy);
SyncHandle();
 
+   switch (rep.minorVersion) {
+   case 1:
+  nevents = 0;
+  break;
+   case 2:
+  nevents = 1;
+  break;
+   case 3:
+   default:
+  nevents = 2;
+  break;
+   }
+   
+   for (i = 0; i < nevents; i++) {
+   XESetWireToEvent (dpy, info->codes->first_event + i, DRI2WireToEvent);
+   XESetEventToWire (dpy, info->codes->first_event + i, DRI2EventToWire);
+   }
+
return True;
 }
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): glx: Fix a couple of warnings

2010-02-16 Thread Kristian Høgsberg
Module: Mesa
Branch: master
Commit: 846cf495226be78b05e74064662eba4e7eb8280e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=846cf495226be78b05e74064662eba4e7eb8280e

Author: Kristian Høgsberg 
Date:   Tue Feb 16 10:37:48 2010 -0500

glx: Fix a couple of warnings

---

 src/glx/dri2.c |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/src/glx/dri2.c b/src/glx/dri2.c
index 963c587..5de55cd 100644
--- a/src/glx/dri2.c
+++ b/src/glx/dri2.c
@@ -88,8 +88,6 @@ DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire)
 {
XExtDisplayInfo *info = DRI2FindDisplay(dpy);
XExtDisplayInfo *glx_info = __glXFindDisplay(dpy);
-   static int glx_event_base;
-   static Bool found_glx_info = False;
 
XextCheckExtension(dpy, info, dri2ExtensionName, False);
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): nv40: Fix incorrect so_new() numbering.

2010-02-16 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: f7aea808a4724a9e50bf3afa5a1bf547d0da5d65
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f7aea808a4724a9e50bf3afa5a1bf547d0da5d65

Author: Francisco Jerez 
Date:   Tue Feb 16 18:37:43 2010 +0100

nv40: Fix incorrect so_new() numbering.

---

 src/gallium/drivers/nv40/nv40_state.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/nv40/nv40_state.c 
b/src/gallium/drivers/nv40/nv40_state.c
index 2073bf0..4f28675 100644
--- a/src/gallium/drivers/nv40/nv40_state.c
+++ b/src/gallium/drivers/nv40/nv40_state.c
@@ -310,7 +310,7 @@ nv40_rasterizer_state_create(struct pipe_context *pipe,
 {
struct nv40_context *nv40 = nv40_context(pipe);
struct nv40_rasterizer_state *rsso = CALLOC(1, sizeof(*rsso));
-   struct nouveau_stateobj *so = so_new(8, 18, 0);
+   struct nouveau_stateobj *so = so_new(9, 19, 0);
struct nouveau_grobj *curie = nv40->screen->curie;
 
/*XXX: ignored:

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): nv40: Implement PIPE_CAP_MAX_COMBINED_SAMPLERS.

2010-02-16 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 8bd62dbd7caa59edb739c65df7e94973b896d98e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8bd62dbd7caa59edb739c65df7e94973b896d98e

Author: Francisco Jerez 
Date:   Tue Feb 16 18:36:47 2010 +0100

nv40: Implement PIPE_CAP_MAX_COMBINED_SAMPLERS.

---

 src/gallium/drivers/nv40/nv40_screen.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/nv40/nv40_screen.c 
b/src/gallium/drivers/nv40/nv40_screen.c
index 001147e..edee4b9 100644
--- a/src/gallium/drivers/nv40/nv40_screen.c
+++ b/src/gallium/drivers/nv40/nv40_screen.c
@@ -62,6 +62,8 @@ nv40_screen_get_param(struct pipe_screen *pscreen, int param)
case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
return 0;
+   case PIPE_CAP_MAX_COMBINED_SAMPLERS:
+   return 16;
default:
NOUVEAU_ERR("Unknown PIPE_CAP %d\n", param);
return 0;

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): sl/pp: re-do extension testing code

2010-02-16 Thread Brian Paul
Module: Mesa
Branch: master
Commit: de5928a61549a6ca66e6b9ff6e50b305f653888c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=de5928a61549a6ca66e6b9ff6e50b305f653888c

Author: Brian Paul 
Date:   Tue Feb 16 10:42:05 2010 -0700

sl/pp: re-do extension testing code

The #extension directive should not effect which extension preprocessor
symbols are defined/undefined; only whether/how the compiler accepts
language features defined by the extension.

---

 src/glsl/pp/sl_pp_context.h   |9 -
 src/glsl/pp/sl_pp_extension.c |   28 +++-
 src/glsl/pp/sl_pp_if.c|2 +-
 src/glsl/pp/sl_pp_public.h|4 
 4 files changed, 36 insertions(+), 7 deletions(-)

diff --git a/src/glsl/pp/sl_pp_context.h b/src/glsl/pp/sl_pp_context.h
index b5419bc..1232f1e 100644
--- a/src/glsl/pp/sl_pp_context.h
+++ b/src/glsl/pp/sl_pp_context.h
@@ -43,9 +43,16 @@
 
 #define SL_PP_MAX_PREDEFINED  16
 
+enum sl_pp_extension_state {
+   SL_PP_EXTENSION_STATE_ENABLED,
+   SL_PP_EXTENSION_STATE_DISABLED,
+   SL_PP_EXTENSION_STATE_WARN,
+   SL_PP_EXTENSION_STATE_REQUIRE
+};
+
 struct sl_pp_extension {
int name;   /*< GL_VENDOR_extension_name */
-   int enabled;
+   enum sl_pp_extension_state state;
 };
 
 struct sl_pp_predefined {
diff --git a/src/glsl/pp/sl_pp_extension.c b/src/glsl/pp/sl_pp_extension.c
index 1f00d94..0816e81 100644
--- a/src/glsl/pp/sl_pp_extension.c
+++ b/src/glsl/pp/sl_pp_extension.c
@@ -53,7 +53,7 @@ sl_pp_context_add_extension(struct sl_pp_context *context,
   return -1;
}
 
-   ext.enabled = 0;
+   ext.state = SL_PP_EXTENSION_STATE_DISABLED;
 
context->extensions[context->num_extensions++] = ext;
 
@@ -62,6 +62,24 @@ sl_pp_context_add_extension(struct sl_pp_context *context,
return 0;
 }
 
+
+enum sl_pp_extension_state
+sl_pp_get_extension_state(const struct sl_pp_context *context,
+  int extension_name)
+{
+   unsigned i;
+
+   for (i = 0; i < context->num_extensions; i++) {
+  if (extension_name == context->extensions[i].name) {
+ return context->extensions[i].state;
+  }
+   }
+
+   assert(0 && "unknown extension");
+   return SL_PP_EXTENSION_STATE_DISABLED;
+}
+
+
 /**
  * Process a "#extension name: behavior" directive.
  */
@@ -140,7 +158,7 @@ sl_pp_process_extension(struct sl_pp_context *context,
 
   if (extension_name != context->dict.all) {
  assert(extension);
- extension->enabled = 1;
+ extension->state = SL_PP_EXTENSION_STATE_REQUIRE;
   }
} else if (behavior == context->dict.enable) {
   if (out.data.extension == -1) {
@@ -155,7 +173,7 @@ sl_pp_process_extension(struct sl_pp_context *context,
 
   if (extension_name != context->dict.all) {
  assert(extension);
- extension->enabled = 1;
+ extension->state = SL_PP_EXTENSION_STATE_ENABLED;
   }
} else if (behavior == context->dict.warn) {
   if (out.data.extension == -1) {
@@ -166,7 +184,7 @@ sl_pp_process_extension(struct sl_pp_context *context,
 
   if (extension_name != context->dict.all) {
  assert(extension);
- extension->enabled = 1;
+ extension->state = SL_PP_EXTENSION_STATE_WARN;
   }
} else if (behavior == context->dict.disable) {
   if (out.data.extension == -1) {
@@ -177,7 +195,7 @@ sl_pp_process_extension(struct sl_pp_context *context,
 
   if (extension_name != context->dict.all) {
  assert(extension);
- extension->enabled = 0;
+ extension->state = SL_PP_EXTENSION_STATE_DISABLED;
   }
} else {
   strcpy(context->error_msg, "unrecognised behavior name");
diff --git a/src/glsl/pp/sl_pp_if.c b/src/glsl/pp/sl_pp_if.c
index e233999..25cb7a3 100644
--- a/src/glsl/pp/sl_pp_if.c
+++ b/src/glsl/pp/sl_pp_if.c
@@ -40,7 +40,7 @@ _macro_is_defined(struct sl_pp_context *context,
 
for (i = 0; i < context->num_extensions; i++) {
   if (macro_name == context->extensions[i].name) {
- return context->extensions[i].enabled;
+ return 1;
   }
}
 
diff --git a/src/glsl/pp/sl_pp_public.h b/src/glsl/pp/sl_pp_public.h
index ca6f722..e4ad80d 100644
--- a/src/glsl/pp/sl_pp_public.h
+++ b/src/glsl/pp/sl_pp_public.h
@@ -55,6 +55,10 @@ int
 sl_pp_context_add_extension(struct sl_pp_context *context,
 const char *name);
 
+enum sl_pp_extension_state
+sl_pp_get_extension_state(const struct sl_pp_context *context,
+  int extension_name);
+
 int
 sl_pp_context_add_predefined(struct sl_pp_context *context,
  const char *name,

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (mesa_7_7_branch): svga: Translate point_sprite rasterizer state.

2010-02-16 Thread Michał Król
Module: Mesa
Branch: mesa_7_7_branch
Commit: 055265b0a3e704ffca97976ff8e5f336a2d6286e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=055265b0a3e704ffca97976ff8e5f336a2d6286e

Author: Michal Krol 
Date:   Tue Feb 16 19:53:13 2010 +0100

svga: Translate point_sprite rasterizer state.

---

 src/gallium/drivers/svga/svga_context.h |1 +
 src/gallium/drivers/svga/svga_pipe_rasterizer.c |2 +-
 src/gallium/drivers/svga/svga_state_rss.c   |1 +
 3 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_context.h 
b/src/gallium/drivers/svga/svga_context.h
index 52d4704..b8ab37e 100644
--- a/src/gallium/drivers/svga/svga_context.h
+++ b/src/gallium/drivers/svga/svga_context.h
@@ -139,6 +139,7 @@ struct svga_rasterizer_state {
unsigned multisampleantialias:1;
unsigned antialiasedlineenable:1;
unsigned lastpixel:1;
+   unsigned pointspriteenable:1;
 
unsigned linepattern;
 
diff --git a/src/gallium/drivers/svga/svga_pipe_rasterizer.c 
b/src/gallium/drivers/svga/svga_pipe_rasterizer.c
index 9ea11aa..a4e9bf5 100644
--- a/src/gallium/drivers/svga/svga_pipe_rasterizer.c
+++ b/src/gallium/drivers/svga/svga_pipe_rasterizer.c
@@ -70,7 +70,6 @@ svga_create_rasterizer_state(struct pipe_context *pipe,
/* light_twoside  - XXX: need fragment shader varient */
/* poly_smooth- XXX: no fallback available */
/* poly_stipple_enable- draw module */
-   /* point_sprite   - ? */
/* point_size_per_vertex  - ? */
/* sprite_coord_mode  - ??? */
/* bypass_vs_viewport_and_clip- handled by viewport setup */
@@ -86,6 +85,7 @@ svga_create_rasterizer_state(struct pipe_context *pipe,
rast->multisampleantialias = templ->multisample;
rast->antialiasedlineenable = templ->line_smooth;
rast->lastpixel = templ->line_last_pixel;
+   rast->pointspriteenable = templ->point_sprite;
rast->pointsize = templ->point_size;
rast->pointsize_min = templ->point_size_min;
rast->pointsize_max = templ->point_size_max;
diff --git a/src/gallium/drivers/svga/svga_state_rss.c 
b/src/gallium/drivers/svga/svga_state_rss.c
index 46a2d5e..aa21069 100644
--- a/src/gallium/drivers/svga/svga_state_rss.c
+++ b/src/gallium/drivers/svga/svga_state_rss.c
@@ -204,6 +204,7 @@ static int emit_rss( struct svga_context *svga,
   EMIT_RS( svga, curr->scissortestenable, SCISSORTESTENABLE, fail );
   EMIT_RS( svga, curr->multisampleantialias, MULTISAMPLEANTIALIAS, fail );
   EMIT_RS( svga, curr->lastpixel, LASTPIXEL, fail );
+  EMIT_RS( svga, curr->pointspriteenable, POINTSPRITEENABLE, fail );
   EMIT_RS( svga, curr->linepattern, LINEPATTERN, fail );
   EMIT_RS_FLOAT( svga, curr->pointsize, POINTSIZE, fail );
   EMIT_RS_FLOAT( svga, curr->pointsize_min, POINTSIZEMIN, fail );

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (mesa_7_7_branch): pipebuffer: Don' t synchronize when checking for buffer overflows.

2010-02-16 Thread Jose Fonseca
Module: Mesa
Branch: mesa_7_7_branch
Commit: 2077f375c7e3a45044b62ae45e779d9201ca39f7
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2077f375c7e3a45044b62ae45e779d9201ca39f7

Author: José Fonseca 
Date:   Tue Feb 16 15:51:34 2010 +

pipebuffer: Don't synchronize when checking for buffer overflows.

To avoid masking synchronization issues in debug builds.

---

 src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c 
b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
index 8f74180..a64f2ea 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
@@ -179,7 +179,9 @@ pb_debug_buffer_check(struct pb_debug_buffer *buf)
 {
uint8_t *map;

-   map = pb_map(buf->buffer, PIPE_BUFFER_USAGE_CPU_READ);
+   map = pb_map(buf->buffer,
+PIPE_BUFFER_USAGE_CPU_READ |
+PIPE_BUFFER_USAGE_UNSYNCHRONIZED);
assert(map);
if(map) {
   boolean underflow, overflow;

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): nouveau: fix legacy dri driver build

2010-02-16 Thread Ben Skeggs
Module: Mesa
Branch: master
Commit: 41b19c279a0eae61f0f95c3b66376a25635241fd
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=41b19c279a0eae61f0f95c3b66376a25635241fd

Author: Johannes Obermayr 
Date:   Wed Feb 17 16:16:50 2010 +1000

nouveau: fix legacy dri driver build

---

 src/mesa/drivers/dri/nouveau/nouveau_bo_state.c |8 +++-
 src/mesa/drivers/dri/nouveau/nouveau_swtnl_t.c  |2 +-
 src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c|4 ++--
 3 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_bo_state.c 
b/src/mesa/drivers/dri/nouveau/nouveau_bo_state.c
index 664632f..fc5f77b 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_bo_state.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_bo_state.c
@@ -32,7 +32,6 @@ nouveau_bo_marker_emit(GLcontext *ctx, struct 
nouveau_bo_marker *m,
   uint32_t flags)
 {
struct nouveau_channel *chan = context_chan(ctx);
-   struct nouveau_pushbuf *push = chan->pushbuf;
uint32_t packet;
 
if (m->gr->bound == NOUVEAU_GROBJ_UNBOUND)
@@ -41,11 +40,10 @@ nouveau_bo_marker_emit(GLcontext *ctx, struct 
nouveau_bo_marker *m,
if (MARK_RING(chan, 2, 2))
return GL_FALSE;
 
-   push->remaining -= 2;
packet = (m->gr->subc << 13) | (1 << 18) | m->mthd;
 
if (flags) {
-   if (nouveau_pushbuf_emit_reloc(chan, push->cur++, m->bo,
+   if (nouveau_pushbuf_emit_reloc(chan, chan->cur++, m->bo,
   packet, 0, flags |
   (m->flags & (NOUVEAU_BO_VRAM |
NOUVEAU_BO_GART |
@@ -53,10 +51,10 @@ nouveau_bo_marker_emit(GLcontext *ctx, struct 
nouveau_bo_marker *m,
   0, 0))
goto fail;
} else {
-   *(push->cur++) = packet;
+   *(chan->cur++) = packet;
}
 
-   if (nouveau_pushbuf_emit_reloc(chan, push->cur++, m->bo, m->data,
+   if (nouveau_pushbuf_emit_reloc(chan, chan->cur++, m->bo, m->data,
   m->data2, flags | m->flags,
   m->vor, m->tor))
goto fail;
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_swtnl_t.c 
b/src/mesa/drivers/dri/nouveau/nouveau_swtnl_t.c
index 8fa922f..a1609a0 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_swtnl_t.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_swtnl_t.c
@@ -210,7 +210,7 @@ swtnl_flush_vertices(GLcontext *ctx)
swtnl_bind_vertices(ctx);
 
while (count) {
-   push = get_max_vertices(ctx, NULL, chan->pushbuf->remaining);
+   push = get_max_vertices(ctx, NULL, AVAIL_RING(chan));
push = MIN2(push / 12 * 12, count);
count -= push;
 
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c 
b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
index ba1192a..02c8580 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
@@ -319,7 +319,7 @@ vbo_draw_vbo(GLcontext *ctx, const struct gl_client_array 
**arrays,
  min_index, max_index);
}
 
-   if (count > get_max_vertices(ctx, ib, chan->pushbuf->remaining))
+   if (count > get_max_vertices(ctx, ib, AVAIL_RING(chan)))
WAIT_RING(chan, PUSHBUF_DWORDS);
 
BATCH_BEGIN(nvgl_primitive(prims[i].mode));
@@ -355,7 +355,7 @@ vbo_draw_imm(GLcontext *ctx, const struct gl_client_array 
**arrays,
end = start + prims[i].count;
 
if (prims[i].count > get_max_vertices(ctx, ib,
- chan->pushbuf->remaining))
+ AVAIL_RING(chan)))
WAIT_RING(chan, PUSHBUF_DWORDS);
 
BATCH_BEGIN(nvgl_primitive(prims[i].mode));

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit