Mesa (master): mesa: Add asserts to check inputs to memcpy.

2010-03-04 Thread Vinson Lee
Module: Mesa
Branch: master
Commit: df62b0da92f50b309d79d6552ecdf5a59910c80a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=df62b0da92f50b309d79d6552ecdf5a59910c80a

Author: Vinson Lee v...@vmware.com
Date:   Thu Mar  4 00:41:21 2010 -0800

mesa: Add asserts to check inputs to memcpy.

---

 src/mesa/main/mipmap.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c
index e2efe81..51f7edf 100644
--- a/src/mesa/main/mipmap.c
+++ b/src/mesa/main/mipmap.c
@@ -1325,6 +1325,8 @@ make_2d_stack_mipmap(GLenum datatype, GLuint comps, GLint 
border,
   if (border  0) {
  /* fill in dest border */
  /* lower-left border pixel */
+ assert(dstPtr);
+ assert(srcPtr);
  memcpy(dstPtr, srcPtr, bpt);
  /* lower-right border pixel */
  memcpy(dstPtr + (dstWidth - 1) * bpt,

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


Mesa (master): glsl: Add assert to check input to strcmp.

2010-03-04 Thread Vinson Lee
Module: Mesa
Branch: master
Commit: df20c3943ab4e20055f8e731f112aa9fd8d66068
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=df20c3943ab4e20055f8e731f112aa9fd8d66068

Author: Vinson Lee v...@vmware.com
Date:   Thu Mar  4 00:53:52 2010 -0800

glsl: Add assert to check input to strcmp.

---

 src/mesa/shader/slang/slang_builtin.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/mesa/shader/slang/slang_builtin.c 
b/src/mesa/shader/slang/slang_builtin.c
index f0659a8..791e751 100644
--- a/src/mesa/shader/slang/slang_builtin.c
+++ b/src/mesa/shader/slang/slang_builtin.c
@@ -182,6 +182,7 @@ lookup_statevar(const char *var, GLint index1, GLint 
index2, const char *field,
  tokens[1] = 0;
   else
  tokens[1] = 1;
+  assert(field);
   if (strcmp(field, emission) == 0) {
  tokens[2] = STATE_EMISSION;
   }

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


Mesa (master): glsl: Remove unsigned greater than or equal zero comparison.

2010-03-04 Thread Vinson Lee
Module: Mesa
Branch: master
Commit: 0dd40cc20af78146c1d1d3ad1df0652b7cedc078
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0dd40cc20af78146c1d1d3ad1df0652b7cedc078

Author: Vinson Lee v...@vmware.com
Date:   Thu Mar  4 01:10:44 2010 -0800

glsl: Remove unsigned greater than or equal zero comparison.

---

 src/mesa/shader/slang/slang_codegen.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/shader/slang/slang_codegen.c 
b/src/mesa/shader/slang/slang_codegen.c
index 809355c..96acad1 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/shader/slang/slang_codegen.c
@@ -1754,7 +1754,7 @@ swizzle_to_writemask(slang_assemble_ctx *A, GLuint 
swizzle,
  /* end */
  break;
   }
-  assert(swz = 0  swz = 3);
+  assert(swz = 3);
 
   if (swizzle != SWIZZLE_ 
   swizzle != SWIZZLE_ 

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


Mesa (master): mesa: Fix unsigned comparison.

2010-03-04 Thread Vinson Lee
Module: Mesa
Branch: master
Commit: f9504e75f02586a8561733e0e2711c65efa2979d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f9504e75f02586a8561733e0e2711c65efa2979d

Author: Vinson Lee v...@vmware.com
Date:   Thu Mar  4 01:24:44 2010 -0800

mesa: Fix unsigned comparison.

---

 src/mesa/main/api_validate.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
index 326ad6f..80bc826 100644
--- a/src/mesa/main/api_validate.c
+++ b/src/mesa/main/api_validate.c
@@ -147,7 +147,7 @@ check_index_bounds(GLcontext *ctx, GLsizei count, GLenum 
type,
 
vbo_get_minmax_index(ctx, prim, ib, min, max);
 
-   if (min + basevertex  0 ||
+   if (min  basevertex ||
max + basevertex  ctx-Array.ArrayObj-_MaxElement) {
   /* the max element is out of bounds of one or more enabled arrays */
   _mesa_warning(ctx, glDrawElements() index=%u is 

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


Mesa (master): glsl: Remove unsigned greater than or equal zero comparison.

2010-03-04 Thread Vinson Lee
Module: Mesa
Branch: master
Commit: ac610ab830287029b2636522625f56ed09c3870b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ac610ab830287029b2636522625f56ed09c3870b

Author: Vinson Lee v...@vmware.com
Date:   Thu Mar  4 01:35:28 2010 -0800

glsl: Remove unsigned greater than or equal zero comparison.

---

 src/mesa/shader/slang/slang_codegen.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/shader/slang/slang_codegen.c 
b/src/mesa/shader/slang/slang_codegen.c
index 96acad1..ecb2f6d 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/shader/slang/slang_codegen.c
@@ -4208,7 +4208,7 @@ swizzle_size(GLuint swizzle)
GLuint size = 0, i;
for (i = 0; i  4; i++) {
   GLuint swz = GET_SWZ(swizzle, i);
-  size += (swz = 0  swz = 3);
+  size += (swz = 3);
}
return size;
 }

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


Mesa (master): Revert mesa: Fix unsigned comparison.

2010-03-04 Thread Vinson Lee
Module: Mesa
Branch: master
Commit: 34b2cec95c9e7781f4d32deed9980f05ee553d1d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=34b2cec95c9e7781f4d32deed9980f05ee553d1d

Author: Vinson Lee v...@vmware.com
Date:   Thu Mar  4 01:51:50 2010 -0800

Revert mesa: Fix unsigned comparison.

This reverts commit f9504e75f02586a8561733e0e2711c65efa2979d.

This patch is incorrect.

---

 src/mesa/main/api_validate.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
index 80bc826..326ad6f 100644
--- a/src/mesa/main/api_validate.c
+++ b/src/mesa/main/api_validate.c
@@ -147,7 +147,7 @@ check_index_bounds(GLcontext *ctx, GLsizei count, GLenum 
type,
 
vbo_get_minmax_index(ctx, prim, ib, min, max);
 
-   if (min  basevertex ||
+   if (min + basevertex  0 ||
max + basevertex  ctx-Array.ArrayObj-_MaxElement) {
   /* the max element is out of bounds of one or more enabled arrays */
   _mesa_warning(ctx, glDrawElements() index=%u is 

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


Mesa (master): DRI: Put back missing break-statement

2010-03-04 Thread Ian Romanick
Module: Mesa
Branch: master
Commit: c7f7a309af54c76eccb451aa0c4f007656ebe7e1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c7f7a309af54c76eccb451aa0c4f007656ebe7e1

Author: Ian Romanick ian.d.roman...@intel.com
Date:   Thu Mar  4 01:56:20 2010 -0800

DRI: Put back missing break-statement

The break in the __DRI_ATTRIB_RENDER_TYPE case was accidentally
removed in commit 5cf2c5851bcd29c2d53bb04ab692b4b156f5a74d.  This puts
it back.

Signed-off-by: Ian Romanick ian.d.roman...@intel.com

---

 src/mesa/drivers/dri/common/utils.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/common/utils.c 
b/src/mesa/drivers/dri/common/utils.c
index 9a21f2c..b85b364 100644
--- a/src/mesa/drivers/dri/common/utils.c
+++ b/src/mesa/drivers/dri/common/utils.c
@@ -726,6 +726,7 @@ driGetConfigAttribIndex(const __DRIconfig *config,
 switch (attribMap[index].attrib) {
 case __DRI_ATTRIB_RENDER_TYPE:
*value = __DRI_ATTRIB_RGBA_BIT;
+   break;
 case __DRI_ATTRIB_CONFIG_CAVEAT:
if (config-modes.visualRating == GLX_NON_CONFORMANT_CONFIG)
*value = __DRI_ATTRIB_NON_CONFORMANT_CONFIG;

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


Mesa (gallium-winsys-handle-rebased): softpipe: remove dead get_texture_buffer function

2010-03-04 Thread Keith Whitwell
Module: Mesa
Branch: gallium-winsys-handle-rebased
Commit: 86e146df977d8df97026291c46aa4adfc13309e1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=86e146df977d8df97026291c46aa4adfc13309e1

Author: Keith Whitwell kei...@vmware.com
Date:   Thu Mar  4 13:22:37 2010 +

softpipe: remove dead get_texture_buffer function

---

 src/gallium/drivers/softpipe/sp_texture.c |   20 
 src/gallium/drivers/softpipe/sp_winsys.h  |6 --
 2 files changed, 0 insertions(+), 26 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_texture.c 
b/src/gallium/drivers/softpipe/sp_texture.c
index d399785..44710d9 100644
--- a/src/gallium/drivers/softpipe/sp_texture.c
+++ b/src/gallium/drivers/softpipe/sp_texture.c
@@ -475,24 +475,4 @@ softpipe_init_screen_texture_funcs(struct pipe_screen 
*screen)
 }
 
 
-/**
- * Return pipe_buffer handle and stride for given texture object.
- * XXX used for???
- */
-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 6e3920c..edc49f2 100644
--- a/src/gallium/drivers/softpipe/sp_winsys.h
+++ b/src/gallium/drivers/softpipe/sp_winsys.h
@@ -60,12 +60,6 @@ struct pipe_screen *softpipe_create_screen( struct 
pipe_winsys * );
  */
 struct pipe_screen *softpipe_create_screen_malloc(void);
 
-boolean
-softpipe_get_texture_buffer( struct pipe_texture *texture,
- struct pipe_buffer **buf,
- unsigned *stride );
-
-
 #ifdef __cplusplus
 }
 #endif

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


Mesa (gallium-winsys-handle-rebased): r300g: remove dead r300_get_texture_buffer function

2010-03-04 Thread Keith Whitwell
Module: Mesa
Branch: gallium-winsys-handle-rebased
Commit: 4b61fd22a87342bafc3da2264b68537c6eb80375
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4b61fd22a87342bafc3da2264b68537c6eb80375

Author: Keith Whitwell kei...@vmware.com
Date:   Thu Mar  4 13:22:21 2010 +

r300g: remove dead r300_get_texture_buffer function

---

 src/gallium/drivers/r300/r300_context.c |   16 ++--
 src/gallium/drivers/r300/r300_texture.c |   18 --
 src/gallium/drivers/r300/r300_texture.h |6 ++
 src/gallium/drivers/r300/r300_winsys.h  |5 -
 4 files changed, 12 insertions(+), 33 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_context.c 
b/src/gallium/drivers/r300/r300_context.c
index 86b98a4..6308d3a 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -72,11 +72,8 @@ r300_is_texture_referenced(struct pipe_context *pipe,
struct pipe_texture *texture,
unsigned face, unsigned level)
 {
-struct pipe_buffer* buf = 0;
-
-r300_get_texture_buffer(pipe-screen, texture, buf, NULL);
-
-return pipe-is_buffer_referenced(pipe, buf);
+return pipe-is_buffer_referenced(pipe,
+  ((struct r300_texture 
*)texture)-buffer);
 }
 
 static unsigned int
@@ -86,7 +83,14 @@ r300_is_buffer_referenced(struct pipe_context *pipe,
 /* This only checks to see whether actual hardware buffers are
  * referenced. Since we use managed BOs and transfers, it's actually not
  * possible for pipe_buffers to ever reference the actual hardware, so
- * buffers are never referenced. */
+ * buffers are never referenced. 
+ */
+
+/* XXX: that doesn't make sense given that
+ * r300_is_texture_referenced is implemented on top of this
+ * function and hardware can certainly refer to textures
+ * directly...
+ */
 return 0;
 }
 
diff --git a/src/gallium/drivers/r300/r300_texture.c 
b/src/gallium/drivers/r300/r300_texture.c
index 3b39207..93224e8 100644
--- a/src/gallium/drivers/r300/r300_texture.c
+++ b/src/gallium/drivers/r300/r300_texture.c
@@ -974,21 +974,3 @@ void r300_init_screen_texture_functions(struct 
pipe_screen* screen)
 screen-video_surface_destroy= r300_video_surface_destroy;
 }
 
-boolean r300_get_texture_buffer(struct pipe_screen* screen,
-struct pipe_texture* texture,
-struct pipe_buffer** buffer,
-unsigned* stride)
-{
-struct r300_texture* tex = (struct r300_texture*)texture;
-if (!tex) {
-return FALSE;
-}
-
-pipe_buffer_reference(buffer, tex-buffer);
-
-if (stride) {
-*stride = r300_texture_get_stride(r300_screen(screen), tex, 0);
-}
-
-return TRUE;
-}
diff --git a/src/gallium/drivers/r300/r300_texture.h 
b/src/gallium/drivers/r300/r300_texture.h
index 46a5fb6..138b627 100644
--- a/src/gallium/drivers/r300/r300_texture.h
+++ b/src/gallium/drivers/r300/r300_texture.h
@@ -60,13 +60,11 @@ r300_video_surface(struct pipe_video_surface *pvs)
 return (struct r300_video_surface *)pvs;
 }
 
-#ifndef R300_WINSYS_H
-
+/* Used internally for texture_is_referenced()
+ */
 boolean r300_get_texture_buffer(struct pipe_screen* screen,
 struct pipe_texture* texture,
 struct pipe_buffer** buffer,
 unsigned* stride);
 
-#endif /* R300_WINSYS_H */
-
 #endif /* R300_TEXTURE_H */
diff --git a/src/gallium/drivers/r300/r300_winsys.h 
b/src/gallium/drivers/r300/r300_winsys.h
index 40fb8a9..ddf2b79 100644
--- a/src/gallium/drivers/r300/r300_winsys.h
+++ b/src/gallium/drivers/r300/r300_winsys.h
@@ -40,11 +40,6 @@ struct radeon_winsys;
 struct pipe_screen* r300_create_screen(struct radeon_winsys* radeon_winsys);
 
 
-boolean r300_get_texture_buffer(struct pipe_screen* screen,
-struct pipe_texture* texture,
-struct pipe_buffer** buffer,
-unsigned* stride);
-
 #ifdef __cplusplus
 }
 #endif

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


Mesa (master): fix getprocaddress test

2010-03-04 Thread George Sapountzis
Module: Mesa
Branch: master
Commit: aae81a76816b8e04f0636df90a16b620bae3f652
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=aae81a76816b8e04f0636df90a16b620bae3f652

Author: George Sapountzis gsapount...@gmail.com
Date:   Thu Mar  4 16:33:39 2010 +0200

fix getprocaddress test

---

 progs/tests/getprocaddress.py |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/progs/tests/getprocaddress.py b/progs/tests/getprocaddress.py
index e88ad4c..60111cb 100644
--- a/progs/tests/getprocaddress.py
+++ b/progs/tests/getprocaddress.py
@@ -4,7 +4,7 @@
 # Helper for the getprocaddress.c test.
 
 import sys, getopt, re
-sys.path.append(../../src/mesa/glapi/ )
+sys.path.append(../../src/mesa/glapi/gen )
 import gl_XML
 import license
 

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


Mesa (gallium-winsys-handle-rebased): nouveau: Conversion to winsys handle

2010-03-04 Thread Jakob Bornecrantz
Module: Mesa
Branch: gallium-winsys-handle-rebased
Commit: 3bd622d64ec3826d3563a5cd9790cd7accc123b4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3bd622d64ec3826d3563a5cd9790cd7accc123b4

Author: Jakob Bornecrantz ja...@vmware.com
Date:   Thu Mar  4 14:36:51 2010 +

nouveau: Conversion to winsys handle

Not the best conversion that could be done.

---

 src/gallium/drivers/nouveau/nouveau_screen.c   |   72 
 .../winsys/drm/nouveau/drm/nouveau_drm_api.c   |   72 ++--
 2 files changed, 78 insertions(+), 66 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c 
b/src/gallium/drivers/nouveau/nouveau_screen.c
index 3c2f771..2013eef 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.c
+++ b/src/gallium/drivers/nouveau/nouveau_screen.c
@@ -4,6 +4,7 @@
 
 #include util/u_memory.h
 #include util/u_inlines.h
+#include util/u_format.h
 
 #include stdio.h
 #include errno.h
@@ -12,6 +13,9 @@
 #include nouveau_winsys.h
 #include nouveau_screen.h
 
+/* XXX this should go away */
+#include state_tracker/drm_api.h
+
 static const char *
 nouveau_screen_get_name(struct pipe_screen *pscreen)
 {
@@ -231,6 +235,71 @@ nouveau_screen_fence_finish(struct pipe_screen *screen,
return 0;
 }
 
+
+/*
+ * Both texture_{from|get}_handle use drm api defines directly which they
+ * shouldn't do. The problem is that from|get are pipe functions and as
+ * such they should be defined in the pipe level. If nouveau had a propper
+ * winsys interface we would have added from|get to that interface using
+ * the winsys_handle struct as done with other drivers. However this code
+ * calls directly into the libdrm_nouveau.so functions (nouveau_bo_*). So
+ * we need to translate the handle into something they understand.
+ */
+static struct pipe_texture *
+nouveau_screen_texture_from_handle(struct pipe_screen *pscreen,
+  const struct pipe_texture *templ,
+  struct winsys_handle *whandle)
+{
+   struct nouveau_device *dev = nouveau_screen(pscreen)-device;
+   struct pipe_texture *pt;
+   struct pipe_buffer *pb;
+   int ret;
+
+   pb = CALLOC(1, sizeof(struct pipe_buffer) + sizeof(struct nouveau_bo*));
+   if (!pb)
+   return NULL;
+
+   ret = nouveau_bo_handle_ref(dev, whandle-handle, (struct 
nouveau_bo**)(pb+1));
+   if (ret) {
+   debug_printf(%s: ref name 0x%08x failed with %d\n,
+__func__, whandle-handle, ret);
+   FREE(pb);
+   return NULL;
+   }
+
+   pipe_reference_init(pb-reference, 1);
+   pb-screen = pscreen;
+   pb-alignment = 0;
+   pb-usage = PIPE_BUFFER_USAGE_GPU_READ_WRITE |
+   PIPE_BUFFER_USAGE_CPU_READ_WRITE;
+   pb-size = nouveau_bo(pb)-size;
+   pt = pscreen-texture_blanket(pscreen, templ, whandle-stride, pb);
+   pipe_buffer_reference(pb, NULL);
+   return pt;
+}
+
+static boolean
+nouveau_screen_texture_get_handle(struct pipe_screen *pscreen,
+ struct pipe_texture *pt,
+ struct winsys_handle *whandle)
+{
+   struct nouveau_miptree *mt = nouveau_miptree(pt);
+
+   if (!mt || !mt-bo)
+   return false;
+
+   whandle-stride = util_format_get_stride(mt-base.format, 
mt-base.width0);
+
+   if (whandle-type == DRM_API_HANDLE_TYPE_SHARED) { 
+   return nouveau_bo_handle_get(mt-bo, whandle-handle) == 0;
+   } else if (whandle-type == DRM_API_HANDLE_TYPE_KMS) {
+   whandle-handle = mt-bo-handle;
+   return TRUE;
+   } else {
+   return FALSE;
+   }
+}
+
 int
 nouveau_screen_init(struct nouveau_screen *screen, struct nouveau_device *dev)
 {
@@ -258,6 +327,9 @@ nouveau_screen_init(struct nouveau_screen *screen, struct 
nouveau_device *dev)
pscreen-fence_signalled = nouveau_screen_fence_signalled;
pscreen-fence_finish = nouveau_screen_fence_finish;
 
+   pscreen-texture_from_handle = nouveau_screen_texture_from_handle;
+   pscreen-texture_get_handle = nouveau_screen_texture_get_handle;
+
return 0;
 }
 
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 80b5a4c..af9e92e 100644
--- a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c
+++ b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c
@@ -21,6 +21,7 @@ dri_surface_from_handle(struct drm_api *api, struct 
pipe_screen *pscreen,
struct pipe_surface *ps = NULL;
struct pipe_texture *pt = NULL;
struct pipe_texture tmpl;
+   struct winsys_handle whandle;
 
memset(tmpl, 0, sizeof(tmpl));
tmpl.tex_usage = PIPE_TEXTURE_USAGE_SCANOUT;
@@ -31,8 +32,11 @@ dri_surface_from_handle(struct drm_api *api, struct 
pipe_screen *pscreen,
tmpl.width0 = width;
tmpl.height0 = 

Mesa (gallium-winsys-handle-rebased): svga: Forgot one bit in rebase

2010-03-04 Thread Jakob Bornecrantz
Module: Mesa
Branch: gallium-winsys-handle-rebased
Commit: caa8a365c512d477b9698e79f55da9c041eb1bef
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=caa8a365c512d477b9698e79f55da9c041eb1bef

Author: Jakob Bornecrantz ja...@vmware.com
Date:   Thu Mar  4 14:57:44 2010 +

svga: Forgot one bit in rebase

---

 .../winsys/drm/vmware/core/vmw_screen_dri.c|3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/src/gallium/winsys/drm/vmware/core/vmw_screen_dri.c 
b/src/gallium/winsys/drm/vmware/core/vmw_screen_dri.c
index 0e3dad8..657544d 100644
--- a/src/gallium/winsys/drm/vmware/core/vmw_screen_dri.c
+++ b/src/gallium/winsys/drm/vmware/core/vmw_screen_dri.c
@@ -365,9 +365,6 @@ static struct drm_api vmw_drm_api_hooks = {
.name = vmwgfx,
.driver_name = vmwgfx,
.create_screen = vmw_drm_create_screen,
-   .texture_from_shared_handle = vmw_drm_texture_from_handle,
-   .shared_handle_from_texture = vmw_drm_handle_from_texture,
-   .local_handle_from_texture = vmw_drm_handle_from_texture,
 };
 
 struct drm_api* drm_api_create()

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


Mesa (gallium-no-texture-blanket): gallium: remove texture blanket call

2010-03-04 Thread Keith Whitwell
Module: Mesa
Branch: gallium-no-texture-blanket
Commit: 4be2436316929e3dfc55bc34d810920c06556b66
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4be2436316929e3dfc55bc34d810920c06556b66

Author: Keith Whitwell kei...@vmware.com
Date:   Thu Mar  4 14:59:26 2010 +

gallium: remove texture blanket call

No longer needed, except for nouveau and egl/xll/native_ximage.c.

Fix for nouveau is to keep the call, but move it to an internal
function within nouveau.

Fix for that egl/x11 relies on gallium-sw-api branch or its successor.

---

 src/gallium/drivers/i915/i915_texture.c|   38 --
 src/gallium/drivers/i965/brw_screen_texture.c  |9 +---
 src/gallium/drivers/i965/brw_winsys.h  |   22 
 src/gallium/drivers/identity/id_screen.c   |   21 
 src/gallium/drivers/llvmpipe/lp_texture.c  |   38 --
 src/gallium/drivers/nouveau/nouveau_screen.c   |3 +-
 src/gallium/drivers/nouveau/nouveau_screen.h   |   12 
 src/gallium/drivers/nv30/nv30_miptree.c|3 +-
 src/gallium/drivers/nv40/nv40_miptree.c|3 +-
 src/gallium/drivers/nv50/nv50_miptree.c|3 +-
 src/gallium/drivers/r300/r300_texture.c|   36 -
 src/gallium/drivers/softpipe/sp_texture.c  |   33 
 src/gallium/drivers/svga/svga_screen_texture.c |   65 
 src/gallium/drivers/trace/tr_screen.c  |   31 ---
 src/gallium/include/pipe/p_screen.h|   11 
 15 files changed, 21 insertions(+), 307 deletions(-)

diff --git a/src/gallium/drivers/i915/i915_texture.c 
b/src/gallium/drivers/i915/i915_texture.c
index 334959c..341bd78 100644
--- a/src/gallium/drivers/i915/i915_texture.c
+++ b/src/gallium/drivers/i915/i915_texture.c
@@ -724,43 +724,6 @@ i915_texture_get_handle(struct pipe_screen * screen,
return iws-buffer_get_handle(iws, tex-buffer, whandle, tex-stride);
 }
 
-static struct pipe_texture *
-i915_texture_blanket(struct pipe_screen * screen,
- const struct pipe_texture *base,
- const unsigned *stride,
- struct pipe_buffer *buffer)
-{
-#if 0
-   struct i915_texture *tex;
-   assert(screen);
-
-   /* Only supports one type */
-   if (base-target != PIPE_TEXTURE_2D ||
-   base-last_level != 0 ||
-   base-depth0 != 1) {
-  return NULL;
-   }
-
-   tex = CALLOC_STRUCT(i915_texture);
-   if (!tex)
-  return NULL;
-
-   tex-base = *base;
-   pipe_reference_init(tex-base.reference, 1);
-   tex-base.screen = screen;
-
-   tex-stride = stride[0];
-
-   i915_miptree_set_level_info(tex, 0, 1, base-width0, base-height0, 1);
-   i915_miptree_set_image_offset(tex, 0, 0, 0, 0);
-
-   pipe_buffer_reference(tex-buffer, buffer);
-
-   return tex-base;
-#else
-   return NULL;
-#endif
-}
 
 static void
 i915_texture_destroy(struct pipe_texture *pt)
@@ -923,7 +886,6 @@ i915_init_screen_texture_functions(struct i915_screen *is)
is-base.texture_create = i915_texture_create;
is-base.texture_from_handle = i915_texture_from_handle;
is-base.texture_get_handle = i915_texture_get_handle;
-   is-base.texture_blanket = i915_texture_blanket;
is-base.texture_destroy = i915_texture_destroy;
is-base.get_tex_surface = i915_get_tex_surface;
is-base.tex_surface_destroy = i915_tex_surface_destroy;
diff --git a/src/gallium/drivers/i965/brw_screen_texture.c 
b/src/gallium/drivers/i965/brw_screen_texture.c
index 995a6f1..790f041 100644
--- a/src/gallium/drivers/i965/brw_screen_texture.c
+++ b/src/gallium/drivers/i965/brw_screen_texture.c
@@ -416,13 +416,7 @@ brw_texture_get_handle(struct pipe_screen *screen,
return bscreen-sws-bo_get_handle(tex-bo, whandle, stride);
 }
 
-static struct pipe_texture *brw_texture_blanket(struct pipe_screen *screen,
-   const struct pipe_texture 
*templ,
-   const unsigned *stride,
-   struct pipe_buffer *buffer)
-{
-   return NULL;
-}
+
 
 static void brw_texture_destroy(struct pipe_texture *pt)
 {
@@ -571,7 +565,6 @@ void brw_screen_tex_init( struct brw_screen *brw_screen )
brw_screen-base.texture_from_handle = brw_texture_from_handle;
brw_screen-base.texture_get_handle = brw_texture_get_handle;
brw_screen-base.texture_destroy = brw_texture_destroy;
-   brw_screen-base.texture_blanket = brw_texture_blanket;
brw_screen-base.get_tex_transfer = brw_get_tex_transfer;
brw_screen-base.transfer_map = brw_transfer_map;
brw_screen-base.transfer_unmap = brw_transfer_unmap;
diff --git a/src/gallium/drivers/i965/brw_winsys.h 
b/src/gallium/drivers/i965/brw_winsys.h
index 139e26e..f30c7f1 100644
--- a/src/gallium/drivers/i965/brw_winsys.h
+++ b/src/gallium/drivers/i965/brw_winsys.h
@@ -267,28 +267,6 @@ bo_reference(struct brw_winsys_buffer **ptr, struct 
brw_winsys_buffer *buf)
 struct pipe_screen *brw_create_screen(struct 

Mesa (gallium-sw-api-2): softpipe: rework to use the llvmpipe winsys

2010-03-04 Thread Keith Whitwell
Module: Mesa
Branch: gallium-sw-api-2
Commit: 94ce4eb3c27706d992226d847d123c46b14b1c4f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=94ce4eb3c27706d992226d847d123c46b14b1c4f

Author: Keith Whitwell kei...@vmware.com
Date:   Thu Mar  4 16:09:33 2010 +

softpipe: rework to use the llvmpipe winsys

Promote the llvmpipe winsys more or less unchanged to
state_trackers/sw_winsys.h.

Some minor breakages:
  - softpipe::texture_blanket is broken, but scheduled for removal anyway.
  - haven't fixed up g3vdl yet.

---

 src/gallium/drivers/llvmpipe/lp_screen.c   |8 +-
 src/gallium/drivers/llvmpipe/lp_screen.h   |4 +-
 src/gallium/drivers/llvmpipe/lp_setup.c|2 +-
 src/gallium/drivers/llvmpipe/lp_texture.c  |8 +-
 src/gallium/drivers/llvmpipe/lp_texture.h  |5 +-
 src/gallium/drivers/softpipe/Makefile  |4 +-
 src/gallium/drivers/softpipe/SConscript|4 +-
 src/gallium/drivers/softpipe/sp_buffer.c   |  118 +
 .../drivers/softpipe/{sp_winsys.h = sp_buffer.h}  |   70 ++--
 src/gallium/drivers/softpipe/sp_context.c  |2 +-
 src/gallium/drivers/softpipe/sp_draw_arrays.c  |   96 +
 src/gallium/drivers/softpipe/sp_screen.c   |   43 ++-
 src/gallium/drivers/softpipe/sp_screen.h   |   12 +
 src/gallium/drivers/softpipe/sp_state_fs.c |   20 +-
 src/gallium/drivers/softpipe/sp_texture.c  |  115 +++---
 src/gallium/drivers/softpipe/sp_texture.h  |   11 +-
 src/gallium/drivers/softpipe/sp_winsys.c   |  245 ---
 .../state_tracker/sw_winsys.h} |   44 +-
 src/gallium/winsys/gdi/SConscript  |2 +-
 src/gallium/winsys/gdi/gdi_llvmpipe_winsys.c   |  157 +---
 src/gallium/winsys/gdi/gdi_softpipe_winsys.c   |  239 +-
 src/gallium/winsys/xlib/Makefile   |1 +
 src/gallium/winsys/xlib/SConscript |4 +-
 src/gallium/winsys/xlib/xlib.c |4 +-
 src/gallium/winsys/xlib/xlib.h |7 +
 src/gallium/winsys/xlib/xlib_llvmpipe.c|  363 +---
 src/gallium/winsys/xlib/xlib_softpipe.c|  464 +---
 src/gallium/winsys/xlib/xlib_sw_winsys.c   |  394 +
 28 files changed, 767 insertions(+), 1679 deletions(-)

Diff:   
http://cgit.freedesktop.org/mesa/mesa/diff/?id=94ce4eb3c27706d992226d847d123c46b14b1c4f
___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): i915: Fix up i830 for tiled drawing offsets.

2010-03-04 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: 41d3fdc380655b701fab2537bdc7e254b6155286
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=41d3fdc380655b701fab2537bdc7e254b6155286

Author: Eric Anholt e...@anholt.net
Date:   Wed Mar  3 11:49:39 2010 -0800

i915: Fix up i830 for tiled drawing offsets.

Corresponds to b87406e55f029d29594ae76a4b39a4fe1007fe4f.

---

 src/mesa/drivers/dri/i915/i830_context.h |3 +-
 src/mesa/drivers/dri/i915/i830_vtbl.c|   43 +++--
 2 files changed, 36 insertions(+), 10 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/i830_context.h 
b/src/mesa/drivers/dri/i915/i830_context.h
index b755d48..d7eb9c2 100644
--- a/src/mesa/drivers/dri/i915/i830_context.h
+++ b/src/mesa/drivers/dri/i915/i830_context.h
@@ -34,7 +34,8 @@
 #define I830_FALLBACK_COLORMASK 0x2000
 #define I830_FALLBACK_STENCIL   0x4000
 #define I830_FALLBACK_STIPPLE   0x8000
-#define I830_FALLBACK_LOGICOP   0x1
+#define I830_FALLBACK_LOGICOP   0x2
+#define I830_FALLBACK_DRAW_OFFSET   0x20
 
 #define I830_UPLOAD_CTX  0x1
 #define I830_UPLOAD_BUFFERS  0x2
diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c 
b/src/mesa/drivers/dri/i915/i830_vtbl.c
index a8df77c..be96419 100644
--- a/src/mesa/drivers/dri/i915/i830_vtbl.c
+++ b/src/mesa/drivers/dri/i915/i830_vtbl.c
@@ -496,15 +496,13 @@ i830_emit_state(struct intel_context *intel)
   OUT_BATCH(state-Buffer[I830_DESTREG_CBUFADDR0]);
   OUT_BATCH(state-Buffer[I830_DESTREG_CBUFADDR1]);
   OUT_RELOC(state-draw_region-buffer,
-   I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
-state-draw_region-draw_offset);
+   I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER, 0);
 
   if (state-depth_region) {
  OUT_BATCH(state-Buffer[I830_DESTREG_DBUFADDR0]);
  OUT_BATCH(state-Buffer[I830_DESTREG_DBUFADDR1]);
  OUT_RELOC(state-depth_region-buffer,
-  I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
-   state-depth_region-draw_offset);
+  I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER, 0);
   }
 
   OUT_BATCH(state-Buffer[I830_DESTREG_DV0]);
@@ -598,6 +596,7 @@ i830_set_draw_region(struct intel_context *intel,
struct intel_renderbuffer *irb = intel_renderbuffer(rb);
GLuint value;
struct i830_hw_state *state = i830-state;
+   uint32_t draw_x, draw_y;
 
if (state-draw_region != color_regions[0]) {
   intel_region_release(state-draw_region);
@@ -652,14 +651,40 @@ i830_set_draw_region(struct intel_context *intel,
}
state-Buffer[I830_DESTREG_DV1] = value;
 
+   /* We set up the drawing rectangle to be offset into the color
+* region's location in the miptree.  If it doesn't match with
+* depth's offsets, we can't render to it.
+*
+* (Well, not actually true -- the hw grew a bit to let depth's
+* offset get forced to 0,0.  We may want to use that if people are
+* hitting that case.  Also, some configurations may be supportable
+* by tweaking the start offset of the buffers around, which we
+* can't do in general due to tiling)
+*/
+   FALLBACK(intel, I830_FALLBACK_DRAW_OFFSET,
+   (depth_region  color_regions[0]) 
+   (depth_region-draw_x != color_regions[0]-draw_x ||
+depth_region-draw_y != color_regions[0]-draw_y));
+
+   if (color_regions[0]) {
+  draw_x = color_regions[0]-draw_x;
+  draw_y = color_regions[0]-draw_y;
+   } else if (depth_region) {
+  draw_x = depth_region-draw_x;
+  draw_y = depth_region-draw_y;
+   } else {
+  draw_x = 0;
+  draw_y = 0;
+   }
+
state-Buffer[I830_DESTREG_DRAWRECT0] = _3DSTATE_DRAWRECT_INFO;
state-Buffer[I830_DESTREG_DRAWRECT1] = 0;
-   state-Buffer[I830_DESTREG_DRAWRECT2] = 0; /* xmin, ymin */
+   state-Buffer[I830_DESTREG_DRAWRECT2] = (draw_y  16) | draw_x;
state-Buffer[I830_DESTREG_DRAWRECT3] =
-  (ctx-DrawBuffer-Width  0x) |
-  (ctx-DrawBuffer-Height  16);
-   state-Buffer[I830_DESTREG_DRAWRECT4] = 0; /* xoff, yoff */
-   state-Buffer[I830_DESTREG_DRAWRECT5] = 0;
+  ((ctx-DrawBuffer-Width + draw_x)  0x) |
+  ((ctx-DrawBuffer-Height + draw_y)  16);
+   state-Buffer[I830_DESTREG_DRAWRECT4] = (draw_y  16) | draw_x;
+   state-Buffer[I830_DESTREG_DRAWRECT5] = MI_NOOP;
 
I830_STATECHANGE(i830, I830_UPLOAD_BUFFERS);
 }

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


Mesa (master): i915: Enable texture tiling by default.

2010-03-04 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: 8e7a8d65931a650534e0f5c4e0d8118cd6f7636e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8e7a8d65931a650534e0f5c4e0d8118cd6f7636e

Author: Eric Anholt e...@anholt.net
Date:   Wed Mar  3 11:51:51 2010 -0800

i915: Enable texture tiling by default.

This now passes piglit testcases, and shows performance improvements
on openarena.  Blit-heavy apps may see degradation, but the
expectation is that the common case of 3D rendering will see
significant wins.

This regresses gen-teximage on my 855, and no piglit tests on my 945.

---

 src/mesa/drivers/dri/intel/intel_screen.c |   11 +++
 1 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_screen.c 
b/src/mesa/drivers/dri/intel/intel_screen.c
index a42af71..959ccfb 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -47,9 +47,6 @@
 #include i915_drm.h
 
 #define DRI_CONF_TEXTURE_TILING(def) \
-   DRI_CONF_OPT_BEGIN(texture_tiling, bool, def)   \
-   DRI_CONF_DESC(en, Enable texture tiling)  \
-   DRI_CONF_OPT_END\
 
 PUBLIC const char __driConfigOptions[] =
DRI_CONF_BEGIN
@@ -65,11 +62,9 @@ PUBLIC const char __driConfigOptions[] =
 DRI_CONF_DESC_END
   DRI_CONF_OPT_END
 
-#ifdef I915
- DRI_CONF_TEXTURE_TILING(false)
-#else
- DRI_CONF_TEXTURE_TILING(true)
-#endif
+  DRI_CONF_OPT_BEGIN(texture_tiling, bool, true)
+DRI_CONF_DESC(en, Enable texture tiling)
+  DRI_CONF_OPT_END
 
   DRI_CONF_OPT_BEGIN(early_z, bool, false)
 DRI_CONF_DESC(en, Enable early Z in classic mode (unstable, 
945-only).)

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


Mesa (gallium-sw-api-2): gallium: remove redundant includes

2010-03-04 Thread Keith Whitwell
Module: Mesa
Branch: gallium-sw-api-2
Commit: c549593931ef08bb48e601189fa97c86b5e780b2
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c549593931ef08bb48e601189fa97c86b5e780b2

Author: Keith Whitwell kei...@vmware.com
Date:   Thu Mar  4 16:33:45 2010 +

gallium: remove redundant includes

---

 src/gallium/drivers/cell/ppu/cell_context.c   |1 -
 src/gallium/drivers/cell/ppu/cell_draw_arrays.c   |1 -
 src/gallium/drivers/cell/ppu/cell_screen.c|1 -
 src/gallium/drivers/cell/ppu/cell_state_shader.c  |1 -
 src/gallium/drivers/cell/ppu/cell_texture.c   |1 -
 src/gallium/drivers/cell/ppu/cell_vertex_shader.c |1 -
 src/gallium/drivers/failover/fo_context.c |1 -
 src/gallium/drivers/i915/i915_debug_fp.c  |1 -
 src/gallium/drivers/softpipe/sp_draw_arrays.c |1 -
 src/gallium/drivers/softpipe/sp_screen.c  |2 --
 10 files changed, 0 insertions(+), 11 deletions(-)

diff --git a/src/gallium/drivers/cell/ppu/cell_context.c 
b/src/gallium/drivers/cell/ppu/cell_context.c
index 5bff986..4751ca8 100644
--- a/src/gallium/drivers/cell/ppu/cell_context.c
+++ b/src/gallium/drivers/cell/ppu/cell_context.c
@@ -36,7 +36,6 @@
 #include pipe/p_defines.h
 #include pipe/p_format.h
 #include util/u_memory.h
-#include util/u_simple_screen.h
 #include pipe/p_screen.h
 
 #include draw/draw_context.h
diff --git a/src/gallium/drivers/cell/ppu/cell_draw_arrays.c 
b/src/gallium/drivers/cell/ppu/cell_draw_arrays.c
index bffd0fa..db28c26 100644
--- a/src/gallium/drivers/cell/ppu/cell_draw_arrays.c
+++ b/src/gallium/drivers/cell/ppu/cell_draw_arrays.c
@@ -33,7 +33,6 @@
 
 #include pipe/p_defines.h
 #include pipe/p_context.h
-#include util/u_simple_screen.h
 #include util/u_inlines.h
 
 #include cell_context.h
diff --git a/src/gallium/drivers/cell/ppu/cell_screen.c 
b/src/gallium/drivers/cell/ppu/cell_screen.c
index a43f863..77bd849 100644
--- a/src/gallium/drivers/cell/ppu/cell_screen.c
+++ b/src/gallium/drivers/cell/ppu/cell_screen.c
@@ -28,7 +28,6 @@
 
 #include util/u_memory.h
 #include util/u_simple_screen.h
-#include util/u_simple_screen.h
 #include pipe/p_defines.h
 #include pipe/p_screen.h
 
diff --git a/src/gallium/drivers/cell/ppu/cell_state_shader.c 
b/src/gallium/drivers/cell/ppu/cell_state_shader.c
index 9b2f86f..bc6127d 100644
--- a/src/gallium/drivers/cell/ppu/cell_state_shader.c
+++ b/src/gallium/drivers/cell/ppu/cell_state_shader.c
@@ -28,7 +28,6 @@
 #include pipe/p_defines.h
 #include util/u_memory.h
 #include util/u_inlines.h
-#include util/u_simple_screen.h
 #include draw/draw_context.h
 #include tgsi/tgsi_parse.h
 
diff --git a/src/gallium/drivers/cell/ppu/cell_texture.c 
b/src/gallium/drivers/cell/ppu/cell_texture.c
index fad290d..a5f4267 100644
--- a/src/gallium/drivers/cell/ppu/cell_texture.c
+++ b/src/gallium/drivers/cell/ppu/cell_texture.c
@@ -34,7 +34,6 @@
 #include pipe/p_context.h
 #include pipe/p_defines.h
 #include util/u_inlines.h
-#include util/u_simple_screen.h
 
 #include util/u_format.h
 #include util/u_math.h
diff --git a/src/gallium/drivers/cell/ppu/cell_vertex_shader.c 
b/src/gallium/drivers/cell/ppu/cell_vertex_shader.c
index cf8cd41..3d389d6 100644
--- a/src/gallium/drivers/cell/ppu/cell_vertex_shader.c
+++ b/src/gallium/drivers/cell/ppu/cell_vertex_shader.c
@@ -31,7 +31,6 @@
 
 #include pipe/p_defines.h
 #include pipe/p_context.h
-#include util/u_simple_screen.h
 #include util/u_math.h
 
 #include cell_context.h
diff --git a/src/gallium/drivers/failover/fo_context.c 
b/src/gallium/drivers/failover/fo_context.c
index 2ccc5d3..659e40c 100644
--- a/src/gallium/drivers/failover/fo_context.c
+++ b/src/gallium/drivers/failover/fo_context.c
@@ -27,7 +27,6 @@
 
 
 #include pipe/p_defines.h
-#include util/u_simple_screen.h
 #include util/u_memory.h
 #include pipe/p_context.h
 
diff --git a/src/gallium/drivers/i915/i915_debug_fp.c 
b/src/gallium/drivers/i915/i915_debug_fp.c
index 066e739..f41c51f 100644
--- a/src/gallium/drivers/i915/i915_debug_fp.c
+++ b/src/gallium/drivers/i915/i915_debug_fp.c
@@ -28,7 +28,6 @@
 
 #include i915_reg.h
 #include i915_debug.h
-#include util/u_simple_screen.h
 #include util/u_debug.h
 
 
diff --git a/src/gallium/drivers/softpipe/sp_draw_arrays.c 
b/src/gallium/drivers/softpipe/sp_draw_arrays.c
index 0899e11..7b77eb2 100644
--- a/src/gallium/drivers/softpipe/sp_draw_arrays.c
+++ b/src/gallium/drivers/softpipe/sp_draw_arrays.c
@@ -33,7 +33,6 @@
 
 #include pipe/p_defines.h
 #include pipe/p_context.h
-#include util/u_simple_screen.h
 #include util/u_inlines.h
 #include util/u_prim.h
 
diff --git a/src/gallium/drivers/softpipe/sp_screen.c 
b/src/gallium/drivers/softpipe/sp_screen.c
index 107631f..9eb3ff6 100644
--- a/src/gallium/drivers/softpipe/sp_screen.c
+++ b/src/gallium/drivers/softpipe/sp_screen.c
@@ -27,8 +27,6 @@
 
 
 #include util/u_memory.h
-#include util/u_simple_screen.h
-#include util/u_simple_screen.h
 #include pipe/p_defines.h
 #include pipe/p_screen.h
 


Mesa (master): gallivm: clarify unsigned vs. signed integer type construction

2010-03-04 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 38110fd1c3a6c57d1ff089d546a3456ca1a78da8
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=38110fd1c3a6c57d1ff089d546a3456ca1a78da8

Author: Brian Paul bri...@vmware.com
Date:   Fri Feb 26 17:44:10 2010 -0700

gallivm: clarify unsigned vs. signed integer type construction

The lp_int_type() function was creating an unsigned type.  So rename
that function to lp_uint_type() and create new lp_int_type() that
creates a signed type.

---

 src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c |   38 ++--
 src/gallium/auxiliary/gallivm/lp_bld_type.c   |   20 +++
 src/gallium/auxiliary/gallivm/lp_bld_type.h   |4 ++
 3 files changed, 43 insertions(+), 19 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c 
b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
index e268862..64698c6 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
@@ -70,8 +70,8 @@ struct lp_build_sample_context
struct lp_build_context coord_bld;
 
/** Integer coordinates */
-   struct lp_type int_coord_type;
-   struct lp_build_context int_coord_bld;
+   struct lp_type uint_coord_type;
+   struct lp_build_context uint_coord_bld;
 
/** Output texels type and build context */
struct lp_type texel_type;
@@ -90,7 +90,7 @@ lp_build_sample_texel_soa(struct lp_build_sample_context *bld,
LLVMValueRef offset;
LLVMValueRef packed;
 
-   offset = lp_build_sample_offset(bld-int_coord_bld,
+   offset = lp_build_sample_offset(bld-uint_coord_bld,
bld-format_desc,
x, y, y_stride,
data_ptr);
@@ -121,7 +121,7 @@ lp_build_sample_packed(struct lp_build_sample_context *bld,
 {
LLVMValueRef offset;
 
-   offset = lp_build_sample_offset(bld-int_coord_bld,
+   offset = lp_build_sample_offset(bld-uint_coord_bld,
bld-format_desc,
x, y, y_stride,
data_ptr);
@@ -145,10 +145,10 @@ lp_build_sample_wrap(struct lp_build_sample_context *bld,
  boolean is_pot,
  unsigned wrap_mode)
 {
-   struct lp_build_context *int_coord_bld = bld-int_coord_bld;
+   struct lp_build_context *uint_coord_bld = bld-uint_coord_bld;
LLVMValueRef length_minus_one;
 
-   length_minus_one = lp_build_sub(int_coord_bld, length, int_coord_bld-one);
+   length_minus_one = lp_build_sub(uint_coord_bld, length, 
uint_coord_bld-one);
 
switch(wrap_mode) {
case PIPE_TEX_WRAP_REPEAT:
@@ -161,8 +161,8 @@ lp_build_sample_wrap(struct lp_build_sample_context *bld,
   break;
 
case PIPE_TEX_WRAP_CLAMP:
-  coord = lp_build_max(int_coord_bld, coord, int_coord_bld-zero);
-  coord = lp_build_min(int_coord_bld, coord, length_minus_one);
+  coord = lp_build_max(uint_coord_bld, coord, uint_coord_bld-zero);
+  coord = lp_build_min(uint_coord_bld, coord, length_minus_one);
   break;
 
case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
@@ -174,8 +174,8 @@ lp_build_sample_wrap(struct lp_build_sample_context *bld,
   /* FIXME */
   _debug_printf(llvmpipe: failed to translate texture wrap mode %s\n,
 util_dump_tex_wrap(wrap_mode, TRUE));
-  coord = lp_build_max(int_coord_bld, coord, int_coord_bld-zero);
-  coord = lp_build_min(int_coord_bld, coord, length_minus_one);
+  coord = lp_build_max(uint_coord_bld, coord, uint_coord_bld-zero);
+  coord = lp_build_min(uint_coord_bld, coord, length_minus_one);
   break;
 
default:
@@ -249,8 +249,8 @@ lp_build_sample_2d_linear_soa(struct 
lp_build_sample_context *bld,
x0 = lp_build_sample_wrap(bld, x0, width,  bld-static_state-pot_width,  
bld-static_state-wrap_s);
y0 = lp_build_sample_wrap(bld, y0, height, bld-static_state-pot_height, 
bld-static_state-wrap_t);
 
-   x1 = lp_build_add(bld-int_coord_bld, x0, bld-int_coord_bld.one);
-   y1 = lp_build_add(bld-int_coord_bld, y0, bld-int_coord_bld.one);
+   x1 = lp_build_add(bld-uint_coord_bld, x0, bld-uint_coord_bld.one);
+   y1 = lp_build_add(bld-uint_coord_bld, y0, bld-uint_coord_bld.one);
 
x1 = lp_build_sample_wrap(bld, x1, width,  bld-static_state-pot_width,  
bld-static_state-wrap_s);
y1 = lp_build_sample_wrap(bld, y1, height, bld-static_state-pot_height, 
bld-static_state-wrap_t);
@@ -358,8 +358,8 @@ lp_build_sample_2d_linear_aos(struct 
lp_build_sample_context *bld,
x0 = lp_build_sample_wrap(bld, x0, width,  bld-static_state-pot_width,  
bld-static_state-wrap_s);
y0 = lp_build_sample_wrap(bld, y0, height, bld-static_state-pot_height, 
bld-static_state-wrap_t);
 
-   x1 = lp_build_add(bld-int_coord_bld, x0, bld-int_coord_bld.one);
-   y1 = lp_build_add(bld-int_coord_bld, y0, bld-int_coord_bld.one);
+   x1 = lp_build_add(bld-uint_coord_bld, x0, bld-uint_coord_bld.one);
+   y1 = 

Mesa (master): gallivm: added lp_build_set_sign()

2010-03-04 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 6464d81e779e8c05ef96c9e5dab4422ff1f25464
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6464d81e779e8c05ef96c9e5dab4422ff1f25464

Author: Brian Paul bri...@vmware.com
Date:   Thu Mar  4 09:45:34 2010 -0700

gallivm: added lp_build_set_sign()

---

 src/gallium/auxiliary/gallivm/lp_bld_arit.c |   35 +++
 src/gallium/auxiliary/gallivm/lp_bld_arit.h |4 +++
 2 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c 
b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
index f60a7a2..42ae9f6 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
@@ -718,6 +718,41 @@ lp_build_sgn(struct lp_build_context *bld,
 
 
 /**
+ * Set the sign of float vector 'a' according to 'sign'.
+ * If sign==0, return abs(a).
+ * If sign==1, return -abs(a);
+ * Other values for sign produce undefined results.
+ */
+LLVMValueRef
+lp_build_set_sign(struct lp_build_context *bld,
+  LLVMValueRef a, LLVMValueRef sign)
+{
+   const struct lp_type type = bld-type;
+   LLVMTypeRef int_vec_type = lp_build_int_vec_type(type);
+   LLVMTypeRef vec_type = lp_build_vec_type(type);
+   LLVMValueRef shift = lp_build_int_const_scalar(type, type.width - 1);
+   LLVMValueRef mask = lp_build_int_const_scalar(type,
+ ~((unsigned long long) 1  (type.width - 1)));
+   LLVMValueRef val, res;
+
+   assert(type.floating);
+
+   /* val = reinterpret_castint(a) */
+   val = LLVMBuildBitCast(bld-builder, a, int_vec_type, );
+   /* val = val  mask */
+   val = LLVMBuildAnd(bld-builder, val, mask, );
+   /* sign = sign  shift */
+   sign = LLVMBuildShl(bld-builder, sign, shift, );
+   /* res = val | sign */
+   res = LLVMBuildOr(bld-builder, val, sign, );
+   /* res = reinterpret_castfloat(res) */
+   res = LLVMBuildBitCast(bld-builder, res, vec_type, );
+
+   return res;
+}
+
+
+/**
  * Convert vector of int to vector of float.
  */
 LLVMValueRef
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.h 
b/src/gallium/auxiliary/gallivm/lp_bld_arit.h
index 2d19ec0..866349d 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_arit.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.h
@@ -125,6 +125,10 @@ lp_build_sgn(struct lp_build_context *bld,
  LLVMValueRef a);
 
 LLVMValueRef
+lp_build_set_sign(struct lp_build_context *bld,
+  LLVMValueRef a, LLVMValueRef sign);
+
+LLVMValueRef
 lp_build_int_to_float(struct lp_build_context *bld,
   LLVMValueRef a);
 

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


Mesa (master): gallivm: added lp_build_negate()

2010-03-04 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 7d230dae70e8caa67cc6bd7501f892d44c40a5d4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7d230dae70e8caa67cc6bd7501f892d44c40a5d4

Author: Brian Paul bri...@vmware.com
Date:   Thu Mar  4 08:36:26 2010 -0700

gallivm: added lp_build_negate()

---

 src/gallium/auxiliary/gallivm/lp_bld_arit.c |8 
 src/gallium/auxiliary/gallivm/lp_bld_arit.h |4 
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c 
b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
index bbce31f..f60a7a2 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
@@ -669,6 +669,14 @@ lp_build_abs(struct lp_build_context *bld,
 
 
 LLVMValueRef
+lp_build_negate(struct lp_build_context *bld,
+LLVMValueRef a)
+{
+   return LLVMBuildNeg(bld-builder, a, );
+}
+
+
+LLVMValueRef
 lp_build_sgn(struct lp_build_context *bld,
  LLVMValueRef a)
 {
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.h 
b/src/gallium/auxiliary/gallivm/lp_bld_arit.h
index da84b7c..2d19ec0 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_arit.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.h
@@ -117,6 +117,10 @@ lp_build_abs(struct lp_build_context *bld,
  LLVMValueRef a);
 
 LLVMValueRef
+lp_build_negate(struct lp_build_context *bld,
+LLVMValueRef a);
+
+LLVMValueRef
 lp_build_sgn(struct lp_build_context *bld,
  LLVMValueRef a);
 

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


Mesa (master): gallivm: rework and implement more texture wrap modes

2010-03-04 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 4c0c728b2a3c8ebee09ddacd1390be31b1a73e23
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4c0c728b2a3c8ebee09ddacd1390be31b1a73e23

Author: Brian Paul bri...@vmware.com
Date:   Thu Mar  4 10:51:31 2010 -0700

gallivm: rework and implement more texture wrap modes

All the texture wrap modes are now implemented for linear and nearest
sampling.

However, texture border color is not yet supported so some wrap modes
will produce int coords outside the texture bounds.  We'll get garbage
values insted of the texture border color for now.

---

 src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c |  508 ++---
 1 files changed, 448 insertions(+), 60 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c 
b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
index 64698c6..1ba139c 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
@@ -69,10 +69,14 @@ struct lp_build_sample_context
struct lp_type coord_type;
struct lp_build_context coord_bld;
 
-   /** Integer coordinates */
+   /** Unsigned integer coordinates */
struct lp_type uint_coord_type;
struct lp_build_context uint_coord_bld;
 
+   /** Signed integer coordinates */
+   struct lp_type int_coord_type;
+   struct lp_build_context int_coord_bld;
+
/** Output texels type and build context */
struct lp_type texel_type;
struct lp_build_context texel_bld;
@@ -138,14 +142,74 @@ lp_build_sample_packed(struct lp_build_sample_context 
*bld,
 }
 
 
+/**
+ * Helper to compute the mirror function for the PIPE_WRAP_MIRROR modes.
+ */
+static LLVMValueRef
+lp_build_coord_mirror(struct lp_build_sample_context *bld,
+  LLVMValueRef coord)
+{
+   struct lp_build_context *coord_bld = bld-coord_bld;
+   struct lp_build_context *int_coord_bld = bld-int_coord_bld;
+   LLVMValueRef fract, flr, isOdd;
+
+   /* fract = coord - floor(coord) */
+   fract = lp_build_sub(coord_bld, coord, lp_build_floor(coord_bld, coord));
+
+   /* flr = ifloor(coord); */
+   flr = lp_build_ifloor(coord_bld, coord);
+
+   /* isOdd = flr  1 */
+   isOdd = LLVMBuildAnd(bld-builder, flr, int_coord_bld-one, );
+
+   /* make coord positive or negative depending on isOdd */
+   coord = lp_build_set_sign(coord_bld, fract, isOdd);
+
+   /* convert isOdd to float */
+   isOdd = lp_build_int_to_float(coord_bld, isOdd);
+
+   /* add isOdd to coord */
+   coord = lp_build_add(coord_bld, coord, isOdd);
+
+   return coord;
+}
+
+
+/**
+ * We only support a few wrap modes in lp_build_sample_wrap_int() at this time.
+ * Return whether the given mode is supported by that function.
+ */
+static boolean
+is_simple_wrap_mode(int mode)
+{
+   switch (mode) {
+   case PIPE_TEX_WRAP_REPEAT:
+   case PIPE_TEX_WRAP_CLAMP:
+   case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
+   case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
+  return TRUE;
+   default:
+  return FALSE;
+   }
+}
+
+
+/**
+ * Build LLVM code for texture wrap mode, for scaled integer texcoords.
+ * \param coord  the incoming texcoord (s,t,r or q) scaled to the texture size
+ * \param length  the texture size along one dimension
+ * \param is_pot  if TRUE, length is a power of two
+ * \param wrap_mode  one of PIPE_TEX_WRAP_x
+ */
 static LLVMValueRef
-lp_build_sample_wrap(struct lp_build_sample_context *bld,
- LLVMValueRef coord,
- LLVMValueRef length,
- boolean is_pot,
- unsigned wrap_mode)
+lp_build_sample_wrap_int(struct lp_build_sample_context *bld,
+ LLVMValueRef coord,
+ LLVMValueRef length,
+ boolean is_pot,
+ unsigned wrap_mode)
 {
struct lp_build_context *uint_coord_bld = bld-uint_coord_bld;
+   struct lp_build_context *int_coord_bld = bld-int_coord_bld;
LLVMValueRef length_minus_one;
 
length_minus_one = lp_build_sub(uint_coord_bld, length, 
uint_coord_bld-one);
@@ -161,12 +225,12 @@ lp_build_sample_wrap(struct lp_build_sample_context *bld,
   break;
 
case PIPE_TEX_WRAP_CLAMP:
-  coord = lp_build_max(uint_coord_bld, coord, uint_coord_bld-zero);
-  coord = lp_build_min(uint_coord_bld, coord, length_minus_one);
-  break;
-
case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
+  coord = lp_build_max(int_coord_bld, coord, int_coord_bld-zero);
+  coord = lp_build_min(int_coord_bld, coord, length_minus_one);
+  break;
+
case PIPE_TEX_WRAP_MIRROR_REPEAT:
case PIPE_TEX_WRAP_MIRROR_CLAMP:
case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE:
@@ -186,6 +250,332 @@ lp_build_sample_wrap(struct lp_build_sample_context *bld,
 }
 
 
+/**
+ * Build LLVM code for texture wrap mode for linear filtering.
+ * \param x0_out  returns first integer texcoord
+ * \param x1_out  returns second integer texcoord
+ * \param weight_out  returns linear interpolation weight

Mesa (master): gallivm: added lp_build_fract()

2010-03-04 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 516bad2272aa9bb3c85516e0023ddd2ed236dcef
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=516bad2272aa9bb3c85516e0023ddd2ed236dcef

Author: Brian Paul bri...@vmware.com
Date:   Thu Mar  4 10:50:26 2010 -0700

gallivm: added lp_build_fract()

---

 src/gallium/auxiliary/gallivm/lp_bld_arit.c |   13 +
 src/gallium/auxiliary/gallivm/lp_bld_arit.h |4 
 2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c 
b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
index 42ae9f6..32f9e52 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
@@ -900,6 +900,19 @@ lp_build_ceil(struct lp_build_context *bld,
 
 
 /**
+ * Return fractional part of 'a' computed as a - floor(f)
+ * Typically used in texture coord arithmetic.
+ */
+LLVMValueRef
+lp_build_fract(struct lp_build_context *bld,
+   LLVMValueRef a)
+{
+   assert(bld-type.floating);
+   return lp_build_sub(bld, a, lp_build_floor(bld, a));
+}
+
+
+/**
  * Convert to integer, through whichever rounding method that's fastest,
  * typically truncating toward zero.
  */
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.h 
b/src/gallium/auxiliary/gallivm/lp_bld_arit.h
index 866349d..55385e3 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_arit.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.h
@@ -149,6 +149,10 @@ lp_build_trunc(struct lp_build_context *bld,
LLVMValueRef a);
 
 LLVMValueRef
+lp_build_fract(struct lp_build_context *bld,
+   LLVMValueRef a);
+
+LLVMValueRef
 lp_build_ifloor(struct lp_build_context *bld,
 LLVMValueRef a);
 LLVMValueRef

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


Mesa (master): r300g: Fix indexbuf upper limits.

2010-03-04 Thread Corbin Simpson
Module: Mesa
Branch: master
Commit: 566390bedf4e5f24b5234e9dc08ecb1a6fd4d13b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=566390bedf4e5f24b5234e9dc08ecb1a6fd4d13b

Author: Corbin Simpson mostawesomed...@gmail.com
Date:   Thu Mar  4 12:46:20 2010 -0800

r300g: Fix indexbuf upper limits.

Wine tends to pessimistically use ~0 for its max index, but r300s
only can go up to 2^24-1, causing the kernel checker to freak out.

Civ4 is marginally improved now. Still crashes, but not as bad.

---

 src/gallium/drivers/r300/r300_render.c |7 ++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_render.c 
b/src/gallium/drivers/r300/r300_render.c
index 770a92b..6c89102 100644
--- a/src/gallium/drivers/r300/r300_render.c
+++ b/src/gallium/drivers/r300/r300_render.c
@@ -273,9 +273,14 @@ static void r300_emit_draw_elements(struct r300_context 
*r300,
 CS_LOCALS(r300);
 
 assert((start * indexSize)  % 4 == 0);
+assert(count  (1  24));
+
+DBG(r300, DBG_DRAW, r300: Indexbuf of %u indices, min %u max %u\n,
+count, minIndex, maxIndex);
+
+maxIndex = MIN2(maxIndex, ((1  24) - 1));
 
 if (alt_num_verts) {
-assert(count  (1  24));
 BEGIN_CS(16);
 OUT_CS_REG(R500_VAP_ALT_NUM_VERTICES, count);
 } else {

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


Mesa (master): xdemos: add OML sync test

2010-03-04 Thread Jesse Barnes
Module: Mesa
Branch: master
Commit: b6456dc234b4736e2490e346c776ad4f2c7f7769
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b6456dc234b4736e2490e346c776ad4f2c7f7769

Author: Jesse Barnes jbar...@virtuousgeek.org
Date:   Thu Mar  4 13:14:59 2010 -0800

xdemos: add OML sync test

Add program to test glXSwapBuffersMscOML behavior.  Based on glsync.c.

---

 progs/xdemos/.gitignore |1 +
 progs/xdemos/Makefile   |1 +
 progs/xdemos/omlsync.c  |  250 +++
 3 files changed, 252 insertions(+), 0 deletions(-)

diff --git a/progs/xdemos/.gitignore b/progs/xdemos/.gitignore
index 5ae0f5a..a65b890 100644
--- a/progs/xdemos/.gitignore
+++ b/progs/xdemos/.gitignore
@@ -27,3 +27,4 @@ xfont
 xrotfontdemo
 yuvrect_client
 msctest
+omlsync
diff --git a/progs/xdemos/Makefile b/progs/xdemos/Makefile
index f866a32..9cf984b 100644
--- a/progs/xdemos/Makefile
+++ b/progs/xdemos/Makefile
@@ -32,6 +32,7 @@ PROGS = \
msctest \
multictx \
offset \
+   omlsync \
overlay \
pbinfo \
pbdemo \
diff --git a/progs/xdemos/omlsync.c b/progs/xdemos/omlsync.c
new file mode 100644
index 000..4eee849
--- /dev/null
+++ b/progs/xdemos/omlsync.c
@@ -0,0 +1,250 @@
+/*
+ * Copyright © 2007-2010 Intel Corporation
+ *
+ * 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, sublicense,
+ * 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 NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ *
+ * Authors:
+ *Jesse Barnes jesse.bar...@intel.com
+ *
+ */
+
+/** @file omlsync.c
+ * The program is simple:  it paints a window alternating colors (red 
+ * white) either as fast as possible or synchronized to vblank events
+ *
+ * If run normally, the program should display a window that exhibits
+ * significant tearing between red and white colors (e.g. you might get
+ * a waterfall effect of red and white horizontal bars).
+ *
+ * If run with the '-s b' option, the program should synchronize the
+ * window color changes with the vertical blank period, resulting in a
+ * window that looks orangish with a high frequency flicker (which may
+ * be invisible).  If the window is moved to another screen, this
+ * property should be preserved.  If the window spans two screens, it
+ * shouldn't tear on whichever screen most of the window is on; the
+ * portion on the other screen may show some tearing (like the
+ * waterfall effect above).
+ *
+ * Other options include '-w width' and '-h height' to set the
+ * window size.
+ */
+#include stdio.h
+#include stdlib.h
+#include string.h
+#include unistd.h
+#include GL/gl.h
+#include GL/glu.h
+#include GL/glx.h
+#include GL/glxext.h
+#include X11/X.h
+#include X11/Xlib.h
+#include X11/Xutil.h
+
+Bool (*glXGetSyncValuesOML)(Display *dpy, GLXDrawable drawable,
+   int64_t *ust, int64_t *msc, int64_t *sbc);
+Bool (*glXGetMscRateOML)(Display *dpy, GLXDrawable drawable, int32_t 
*numerator,
+int32_t *denominator);
+int64_t (*glXSwapBuffersMscOML)(Display *dpy, GLXDrawable drawable,
+   int64_t target_msc, int64_t divisor,
+   int64_t remainder);
+Bool (*glXWaitForMscOML)(Display *dpy, GLXDrawable drawable, int64_t 
target_msc,
+int64_t divisor, int64_t remainder, int64_t *ust,
+int64_t *msc, int64_t *sbc);
+Bool (*glXWaitForSbcOML)(Display *dpy, GLXDrawable drawable, int64_t 
target_sbc,
+int64_t *ust, int64_t *msc, int64_t *sbc);
+
+static int GLXExtensionSupported(Display *dpy, const char *extension)
+{
+   const char *extensionsString, *client_extensions, *pos;
+
+   extensionsString = glXQueryExtensionsString(dpy, DefaultScreen(dpy));
+   client_extensions = glXGetClientString(dpy, GLX_EXTENSIONS);
+
+   pos = strstr(extensionsString, extension);
+
+   if (pos != NULL  (pos == extensionsString || pos[-1] == ' ') 
+   (pos[strlen(extension)] == ' ' || pos[strlen(extension)] 

Mesa (master): dri/nouveau: Pack client arrays as they' re copied to the real BO.

2010-03-04 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 43c347c63ee10db95bd912fc39b1127fa35305a4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=43c347c63ee10db95bd912fc39b1127fa35305a4

Author: Francisco Jerez curroje...@riseup.net
Date:   Thu Mar  4 21:27:11 2010 +0100

dri/nouveau: Pack client arrays as they're copied to the real BO.

---

 src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c |   44 +++---
 1 files changed, 32 insertions(+), 12 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c 
b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
index 02c8580..8a2caff 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
@@ -24,8 +24,11 @@
  *
  */
 
-#include main/bufferobj.h
 #include nouveau_bufferobj.h
+#include nouveau_util.h
+
+#include main/bufferobj.h
+#include main/image.h
 
 /* Arbitrary pushbuf length we can assume we can get with a single
  * WAIT_RING. */
@@ -58,7 +61,11 @@ vbo_init_array(struct nouveau_array_state *a, int attr, int 
stride,
} else {
nouveau_bo_ref(NULL, a-bo);
a-offset = 0;
-   a-buf = ptr;
+
+   if (map)
+   a-buf = ptr;
+   else
+   a-buf = NULL;
}
 
if (a-buf)
@@ -94,11 +101,20 @@ vbo_init_arrays(GLcontext *ctx, const struct 
_mesa_index_buffer *ib,
 
if (attr = 0) {
const struct gl_client_array *array = arrays[attr];
+   int stride;
+
+   if (render-mode == VBO 
+   !_mesa_is_bufferobj(array-BufferObj))
+   /* Pack client buffers. */
+   stride = align(_mesa_sizeof_type(array-Type)
+  * array-Size, 4);
+   else
+   stride = array-StrideB;
 
vbo_init_array(render-attrs[attr], attr,
-  array-StrideB, array-Size,
-  array-Type, array-BufferObj,
-  array-Ptr, render-mode == IMM);
+  stride, array-Size, array-Type,
+  array-BufferObj, array-Ptr,
+  render-mode == IMM);
}
}
 }
@@ -276,17 +292,21 @@ vbo_bind_vertices(GLcontext *ctx, const struct 
gl_client_array **arrays,
if (attr = 0) {
const struct gl_client_array *array = arrays[attr];
struct nouveau_array_state *a = render-attrs[attr];
-   unsigned delta = (basevertex + min_index) * a-stride,
-   size = (max_index - min_index + 1) * a-stride;
+   unsigned delta = (basevertex + min_index)
+   * array-StrideB;
 
if (a-bo) {
a-offset = (intptr_t)array-Ptr + delta;
} else {
-   void *scratch = get_scratch_vbo(ctx, size,
-   a-bo,
-   a-offset);
-
-   memcpy(scratch, a-buf + delta, size);
+   int j, n = max_index - min_index + 1;
+   char *sp = (char *)array-Ptr + delta;
+   char *dp = get_scratch_vbo(ctx, n * a-stride,
+  a-bo, a-offset);
+
+   for (j = 0; j  n; j++)
+   memcpy(dp + j * a-stride,
+  sp + j * array-StrideB,
+  a-stride);
}
}
}

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


Mesa (master): dri/nouveau: Try to keep client buffers smaller than the scratch VBO length.

2010-03-04 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 80316cbefaa28454ab9d6da44ac93805608c3685
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=80316cbefaa28454ab9d6da44ac93805608c3685

Author: Francisco Jerez curroje...@riseup.net
Date:   Thu Mar  4 21:32:07 2010 +0100

dri/nouveau: Try to keep client buffers smaller than the scratch VBO length.

---

 src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c |   26 ++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c 
b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
index 8a2caff..69a9b96 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
@@ -243,6 +243,23 @@ vbo_choose_attrs(GLcontext *ctx, const struct 
gl_client_array **arrays)
vbo_emit_attr(ctx, arrays, VERT_ATTRIB_POS);
 }
 
+static unsigned
+get_max_client_stride(GLcontext *ctx)
+{
+   struct nouveau_render_state *render = to_render_state(ctx);
+   int i, s = 0;
+
+   for (i = 0; i  render-attr_count; i++) {
+   int attr = render-map[i];
+   struct nouveau_array_state *a = render-attrs[attr];
+
+   if (attr = 0  !a-bo)
+   s = MAX2(a-stride, s);
+   }
+
+   return s;
+}
+
 static void
 TAG(vbo_render_prims)(GLcontext *ctx, const struct gl_client_array **arrays,
  const struct _mesa_prim *prims, GLuint nr_prims,
@@ -257,9 +274,18 @@ vbo_maybe_split(GLcontext *ctx, const struct 
gl_client_array **arrays,
GLuint min_index, GLuint max_index)
 {
struct nouveau_context *nctx = to_nouveau_context(ctx);
+   struct nouveau_render_state *render = to_render_state(ctx);
unsigned pushbuf_avail = PUSHBUF_DWORDS - 2 * nctx-bo.count,
vert_avail = get_max_vertices(ctx, NULL, pushbuf_avail),
idx_avail = get_max_vertices(ctx, ib, pushbuf_avail);
+   int stride;
+
+   /* Try to keep client buffers smaller than the scratch BOs. */
+   if (!ib  render-mode == VBO 
+   (stride = get_max_client_stride(ctx)))
+   vert_avail = MIN2(vert_avail,
+ RENDER_SCRATCH_SIZE / stride);
+
 
if ((ib  ib-count  idx_avail) ||
(!ib  max_index - min_index  vert_avail)) {

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


Mesa (master): dri/nouveau: Trivially add GL_ARB_texture_mirrored_repeat.

2010-03-04 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 9c4937524e15dc685eb0c83cbdab8b637803fd78
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9c4937524e15dc685eb0c83cbdab8b637803fd78

Author: Andrew Randrianasulu rand...@mail.ru
Date:   Thu Mar  4 23:15:47 2010 +0100

dri/nouveau: Trivially add GL_ARB_texture_mirrored_repeat.

Signed-off-by: Francisco Jerez curroje...@riseup.net

---

 src/mesa/drivers/dri/nouveau/nouveau_context.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c 
b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index ef26a19..52185a2 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -53,6 +53,7 @@ static const struct dri_extension nouveau_extensions[] = {
{ GL_ARB_texture_env_add, NULL },
{ GL_EXT_texture_lod_bias,NULL },
{ GL_EXT_framebuffer_object,  GL_EXT_framebuffer_object_functions },
+   { GL_ARB_texture_mirrored_repeat, NULL },
{ GL_EXT_stencil_wrap,NULL },
{ GL_EXT_fog_coord,   GL_EXT_fog_coord_functions },
{ GL_SGIS_generate_mipmap,NULL },

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


Mesa (master): dri/nouveau: Fix rb-DataType for z24s8 renderbuffers.

2010-03-04 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 9c21c1e865ad3008eb6f4d6d4e4a48c2ed94472d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9c21c1e865ad3008eb6f4d6d4e4a48c2ed94472d

Author: Francisco Jerez curroje...@riseup.net
Date:   Thu Mar  4 21:40:47 2010 +0100

dri/nouveau: Fix rb-DataType for z24s8 renderbuffers.

---

 src/mesa/drivers/dri/nouveau/nouveau_fbo.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c 
b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
index 8464786..2ec3dc9 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
@@ -72,7 +72,7 @@ set_renderbuffer_format(struct gl_renderbuffer *rb, GLenum 
internalFormat)
case GL_DEPTH24_STENCIL8_EXT:
rb-_BaseFormat  = GL_DEPTH_STENCIL;
rb-Format = MESA_FORMAT_Z24_S8;
-   rb-DataType = GL_UNSIGNED_INT;
+   rb-DataType = GL_UNSIGNED_INT_24_8_EXT;
s-cpp = 4;
break;
default:

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


Mesa (master): dri/nouveau: Add GL_EXT_stencil_wrap for nv04.

2010-03-04 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 210bcf6d156aba5994f25f1bd9c50586ebc3bada
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=210bcf6d156aba5994f25f1bd9c50586ebc3bada

Author: Andrew Randrianasulu rand...@mail.ru
Date:   Mon Mar  1 23:58:17 2010 +

dri/nouveau: Add GL_EXT_stencil_wrap for nv04.

Signed-off-by: Francisco Jerez curroje...@riseup.net

---

 src/mesa/drivers/dri/nouveau/nv04_state_raster.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_raster.c 
b/src/mesa/drivers/dri/nouveau/nv04_state_raster.c
index 89c6753..4314fc3 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_state_raster.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_state_raster.c
@@ -71,6 +71,10 @@ get_stencil_op(unsigned op)
return 0x5;
case GL_INVERT:
return 0x6;
+   case GL_INCR_WRAP:
+   return 0x7;
+   case GL_DECR_WRAP:
+   return 0x8;
default:
assert(0);
}

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


Mesa (master): dri/nouveau: Enable GL_EXT_stencil_wrap.

2010-03-04 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 44df3577a77818d6e87f1b728f0aa19698133981
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=44df3577a77818d6e87f1b728f0aa19698133981

Author: Andrew Randrianasulu rand...@mail.ru
Date:   Mon Mar  1 23:45:50 2010 +

dri/nouveau: Enable GL_EXT_stencil_wrap.

Signed-off-by: Francisco Jerez curroje...@riseup.net

---

 src/mesa/drivers/dri/nouveau/nouveau_context.c |7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c 
b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index 2629733..ef26a19 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -47,14 +47,15 @@
 #include main/remap_helper.h
 
 static const struct dri_extension nouveau_extensions[] = {
-   { GL_EXT_framebuffer_object,  GL_EXT_framebuffer_object_functions },
{ GL_ARB_multitexture,NULL },
-   { GL_EXT_texture_lod_bias,NULL },
-   { GL_SGIS_generate_mipmap,NULL },
{ GL_ARB_texture_env_combine, NULL },
{ GL_ARB_texture_env_dot3,NULL },
{ GL_ARB_texture_env_add, NULL },
+   { GL_EXT_texture_lod_bias,NULL },
+   { GL_EXT_framebuffer_object,  GL_EXT_framebuffer_object_functions },
+   { GL_EXT_stencil_wrap,NULL },
{ GL_EXT_fog_coord,   GL_EXT_fog_coord_functions },
+   { GL_SGIS_generate_mipmap,NULL },
{ NULL, NULL }
 };
 

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


Mesa (master): dri/nouveau: Remove some CI remnants.

2010-03-04 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: a42fd95f43929c1e2c7acf2a6e49c473e1a2a178
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a42fd95f43929c1e2c7acf2a6e49c473e1a2a178

Author: Francisco Jerez curroje...@riseup.net
Date:   Thu Mar  4 23:19:49 2010 +0100

dri/nouveau: Remove some CI remnants.

---

 src/mesa/drivers/dri/nouveau/nouveau_state.h |1 -
 src/mesa/drivers/dri/nouveau/nv04_context.c  |1 -
 src/mesa/drivers/dri/nouveau/nv10_context.c  |1 -
 src/mesa/drivers/dri/nouveau/nv10_driver.h   |3 ---
 src/mesa/drivers/dri/nouveau/nv10_state_raster.c |5 -
 src/mesa/drivers/dri/nouveau/nv20_context.c  |1 -
 6 files changed, 0 insertions(+), 12 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_state.h 
b/src/mesa/drivers/dri/nouveau/nouveau_state.h
index d001fa2..d01d962 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_state.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_state.h
@@ -47,7 +47,6 @@ enum {
NOUVEAU_STATE_FRAG,
NOUVEAU_STATE_FRAMEBUFFER,
NOUVEAU_STATE_FOG,
-   NOUVEAU_STATE_INDEX_MASK,
NOUVEAU_STATE_LIGHT_ENABLE,
NOUVEAU_STATE_LIGHT_MODEL,
NOUVEAU_STATE_LIGHT_SOURCE0,
diff --git a/src/mesa/drivers/dri/nouveau/nv04_context.c 
b/src/mesa/drivers/dri/nouveau/nv04_context.c
index 1acd41d..a442425 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_context.c
@@ -265,7 +265,6 @@ const struct nouveau_driver nv04_driver = {
nouveau_emit_nothing,
nouveau_emit_nothing,
nouveau_emit_nothing,
-   nouveau_emit_nothing,
nv04_emit_scissor,
nv04_defer_blend,
nv04_defer_control,
diff --git a/src/mesa/drivers/dri/nouveau/nv10_context.c 
b/src/mesa/drivers/dri/nouveau/nv10_context.c
index 8e70c41..860d0ae 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_context.c
@@ -370,7 +370,6 @@ const struct nouveau_driver nv10_driver = {
nv10_emit_frag,
nv10_emit_framebuffer,
nv10_emit_fog,
-   nv10_emit_index_mask,
nv10_emit_light_enable,
nv10_emit_light_model,
nv10_emit_light_source,
diff --git a/src/mesa/drivers/dri/nouveau/nv10_driver.h 
b/src/mesa/drivers/dri/nouveau/nv10_driver.h
index b5ab19b..d662712 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_driver.h
+++ b/src/mesa/drivers/dri/nouveau/nv10_driver.h
@@ -100,9 +100,6 @@ void
 nv10_emit_dither(GLcontext *ctx, int emit);
 
 void
-nv10_emit_index_mask(GLcontext *ctx, int emit);
-
-void
 nv10_emit_logic_opcode(GLcontext *ctx, int emit);
 
 void
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_raster.c 
b/src/mesa/drivers/dri/nouveau/nv10_state_raster.c
index 68882ef..a62cd80 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_raster.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_raster.c
@@ -119,11 +119,6 @@ nv10_emit_dither(GLcontext *ctx, int emit)
 }
 
 void
-nv10_emit_index_mask(GLcontext *ctx, int emit)
-{
-}
-
-void
 nv10_emit_logic_opcode(GLcontext *ctx, int emit)
 {
struct nouveau_channel *chan = context_chan(ctx);
diff --git a/src/mesa/drivers/dri/nouveau/nv20_context.c 
b/src/mesa/drivers/dri/nouveau/nv20_context.c
index 635b5c0..db39ef7 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_context.c
@@ -459,7 +459,6 @@ const struct nouveau_driver nv20_driver = {
nv20_emit_frag,
nv20_emit_framebuffer,
nv20_emit_fog,
-   nv10_emit_index_mask,
nv10_emit_light_enable,
nv20_emit_light_model,
nv20_emit_light_source,

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


Mesa (master): gallivm: comments

2010-03-04 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 877f2356b2ab7caa16beed496f36eca64ee201e1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=877f2356b2ab7caa16beed496f36eca64ee201e1

Author: Brian Paul bri...@vmware.com
Date:   Thu Mar  4 15:49:39 2010 -0700

gallivm: comments

---

 src/gallium/auxiliary/gallivm/lp_bld_logic.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_logic.c 
b/src/gallium/auxiliary/gallivm/lp_bld_logic.c
index 41ac81b..2726747 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_logic.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_logic.c
@@ -45,6 +45,7 @@
 /**
  * Build code to compare two values 'a' and 'b' of 'type' using the given func.
  * \param func  one of PIPE_FUNC_x
+ * The result values will be 0 for false or ~0 for true.
  */
 LLVMValueRef
 lp_build_compare(LLVMBuilderRef builder,
@@ -311,6 +312,7 @@ lp_build_compare(LLVMBuilderRef builder,
 /**
  * Build code to compare two values 'a' and 'b' using the given func.
  * \param func  one of PIPE_FUNC_x
+ * The result values will be 0 for false or ~0 for true.
  */
 LLVMValueRef
 lp_build_cmp(struct lp_build_context *bld,
@@ -322,6 +324,9 @@ lp_build_cmp(struct lp_build_context *bld,
 }
 
 
+/**
+ * Return mask ? a : b;
+ */
 LLVMValueRef
 lp_build_select(struct lp_build_context *bld,
 LLVMValueRef mask,

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


Mesa (master): gallivm: implement texture border color, plus tweaks to some wrap modes

2010-03-04 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 2b5c5c0dcf16062676ecfdf5efb7de650a4c5938
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2b5c5c0dcf16062676ecfdf5efb7de650a4c5938

Author: Brian Paul bri...@vmware.com
Date:   Thu Mar  4 15:50:19 2010 -0700

gallivm: implement texture border color, plus tweaks to some wrap modes

The progs/test/texwrap demo looks pretty good, but there are still some
tiny differences from softpipe.  There may be a sub-pixel texcoord
interpolation error somewhere.

There's some room for optimization.  Many of the wrap modes compute
intermediate values that are constant for the texture size (see the
min/max values).  These could be computed earlier and stored somewhere
for later use.

---

 src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c |  152 +---
 1 files changed, 129 insertions(+), 23 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c 
b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
index 1ba139c..fe41d5e 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
@@ -83,17 +83,92 @@ struct lp_build_sample_context
 };
 
 
+/**
+ * Does the given texture wrap mode allow sampling the texture border color?
+ * XXX maybe move this into gallium util code.
+ */
+static boolean
+wrap_mode_uses_border_color(unsigned mode)
+{
+   switch (mode) {
+   case PIPE_TEX_WRAP_REPEAT:
+   case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
+   case PIPE_TEX_WRAP_MIRROR_REPEAT:
+   case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE:
+  return FALSE;
+   case PIPE_TEX_WRAP_CLAMP:
+   case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
+   case PIPE_TEX_WRAP_MIRROR_CLAMP:
+   case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER:
+  return TRUE;
+   default:
+  assert(0  unexpected wrap mode);
+  return FALSE;
+   }
+}
+
+
+
+/**
+ * Gen code to fetch a texel from a texture at int coords (x, y).
+ * The result, texel, will be:
+ *   texel[0] = red values
+ *   texel[1] = green values
+ *   texel[2] = blue values
+ *   texel[3] = alpha values
+ */
 static void
 lp_build_sample_texel_soa(struct lp_build_sample_context *bld,
+  LLVMValueRef width,
+  LLVMValueRef height,
   LLVMValueRef x,
   LLVMValueRef y,
   LLVMValueRef y_stride,
   LLVMValueRef data_ptr,
   LLVMValueRef *texel)
 {
+   struct lp_build_context *int_coord_bld = bld-int_coord_bld;
LLVMValueRef offset;
LLVMValueRef packed;
+   LLVMValueRef use_border = NULL;
+
+   /* use_border = x  0 || x = width || y  0 || y = height */
+   if (wrap_mode_uses_border_color(bld-static_state-wrap_s)) {
+  LLVMValueRef b1, b2;
+  b1 = lp_build_cmp(int_coord_bld, PIPE_FUNC_LESS, x, int_coord_bld-zero);
+  b2 = lp_build_cmp(int_coord_bld, PIPE_FUNC_GEQUAL, x, width);
+  use_border = LLVMBuildOr(bld-builder, b1, b2, b1_or_b2);
+   }
+
+   if (wrap_mode_uses_border_color(bld-static_state-wrap_t)) {
+  LLVMValueRef b1, b2;
+  b1 = lp_build_cmp(int_coord_bld, PIPE_FUNC_LESS, y, int_coord_bld-zero);
+  b2 = lp_build_cmp(int_coord_bld, PIPE_FUNC_GEQUAL, y, height);
+  if (use_border) {
+ use_border = LLVMBuildOr(bld-builder, use_border, b1, ub_or_b1);
+ use_border = LLVMBuildOr(bld-builder, use_border, b2, ub_or_b2);
+  }
+  else {
+ use_border = LLVMBuildOr(bld-builder, b1, b2, b1_or_b2);
+  }
+   }
 
+   /*
+* Note: if we find an app which frequently samples the texture border
+* we might want to implement a true conditional here to avoid sampling
+* the texture whenever possible (since that's quite a bit of code).
+* Ex:
+*   if (use_border) {
+*  texel = border_color;
+*   }
+*   else {
+*  texel = sample_texture(coord);
+*   }
+* As it is now, we always sample the texture, then selectively replace
+* the texel color results with the border color.
+*/
+
+   /* convert x,y coords to linear offset from start of texture, in bytes */
offset = lp_build_sample_offset(bld-uint_coord_bld,
bld-format_desc,
x, y, y_stride,
@@ -103,16 +178,30 @@ lp_build_sample_texel_soa(struct lp_build_sample_context 
*bld,
assert(bld-format_desc-block.height == 1);
assert(bld-format_desc-block.bits = bld-texel_type.width);
 
+   /* gather the texels from the texture */
packed = lp_build_gather(bld-builder,
 bld-texel_type.length,
 bld-format_desc-block.bits,
 bld-texel_type.width,
 data_ptr, offset);
 
+   /* convert texels to float rgba */
lp_build_unpack_rgba_soa(bld-builder,
 bld-format_desc,
 bld-texel_type,
 packed, texel);
+
+   

Mesa (master): Fix comparison of unsigned value against 0.

2010-03-04 Thread Michel Dänzer
Module: Mesa
Branch: master
Commit: 391b396f3fb300a912e6d9bfbf26f49cc30e52df
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=391b396f3fb300a912e6d9bfbf26f49cc30e52df

Author: Michel Dänzer daen...@vmware.com
Date:   Fri Mar  5 00:15:40 2010 +0100

Fix comparison of unsigned value against  0.

---

 src/mesa/main/api_validate.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
index 326ad6f..e9359db 100644
--- a/src/mesa/main/api_validate.c
+++ b/src/mesa/main/api_validate.c
@@ -147,7 +147,7 @@ check_index_bounds(GLcontext *ctx, GLsizei count, GLenum 
type,
 
vbo_get_minmax_index(ctx, prim, ib, min, max);
 
-   if (min + basevertex  0 ||
+   if ((int)(min + basevertex)  0 ||
max + basevertex  ctx-Array.ArrayObj-_MaxElement) {
   /* the max element is out of bounds of one or more enabled arrays */
   _mesa_warning(ctx, glDrawElements() index=%u is 

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


Mesa (master): intel: Remove non-kernel-exec-fencing support.

2010-03-04 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: bb35000b4b6dfe60048b2f5d60bc102c4a7fd791
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bb35000b4b6dfe60048b2f5d60bc102c4a7fd791

Author: Eric Anholt e...@anholt.net
Date:   Thu Mar  4 15:47:19 2010 -0800

intel: Remove non-kernel-exec-fencing support.

Shaves 60k off the driver from removing the broken spans code.  This
means we now require 2.6.29, which seems fair given that it's a year
old and we've removed support for non-KMS already in the last release
of 2D.

---

 src/mesa/drivers/dri/i965/brw_curbe.c |5 +-
 src/mesa/drivers/dri/i965/brw_draw_upload.c   |   63 +---
 src/mesa/drivers/dri/i965/brw_vs_surface_state.c  |4 +-
 src/mesa/drivers/dri/i965/brw_vtbl.c  |2 +-
 src/mesa/drivers/dri/i965/gen6_vs_state.c |4 +-
 src/mesa/drivers/dri/i965/gen6_wm_state.c |4 +-
 src/mesa/drivers/dri/intel/intel_blit.c   |8 +-
 src/mesa/drivers/dri/intel/intel_buffer_objects.c |8 +-
 src/mesa/drivers/dri/intel/intel_context.c|6 -
 src/mesa/drivers/dri/intel/intel_context.h|   21 -
 src/mesa/drivers/dri/intel/intel_depthtmp.h   |   64 ---
 src/mesa/drivers/dri/intel/intel_fbo.c|3 -
 src/mesa/drivers/dri/intel/intel_fbo.h|3 -
 src/mesa/drivers/dri/intel/intel_mipmap_tree.c|3 +-
 src/mesa/drivers/dri/intel/intel_regions.c|6 +-
 src/mesa/drivers/dri/intel/intel_screen.c |9 +-
 src/mesa/drivers/dri/intel/intel_screen.h |1 -
 src/mesa/drivers/dri/intel/intel_span.c   |  451 +++--
 src/mesa/drivers/dri/intel/intel_spantmp.h|   67 ---
 19 files changed, 94 insertions(+), 638 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c 
b/src/mesa/drivers/dri/i965/brw_curbe.c
index 6f2ead7..4e78b08 100644
--- a/src/mesa/drivers/dri/i965/brw_curbe.c
+++ b/src/mesa/drivers/dri/i965/brw_curbe.c
@@ -179,7 +179,6 @@ static GLfloat fixed_plane[6][4] = {
  */
 static void prepare_constant_buffer(struct brw_context *brw)
 {
-   struct intel_context *intel = brw-intel;
GLcontext *ctx = brw-intel.ctx;
const struct brw_vertex_program *vp =
   brw_vertex_program_const(brw-vertex_program);
@@ -307,7 +306,7 @@ static void prepare_constant_buffer(struct brw_context *brw)
   if (brw-curbe.curbe_bo != NULL 
  brw-curbe.curbe_next_offset + bufsz  brw-curbe.curbe_bo-size)
   {
-intel_bo_unmap_gtt_preferred(intel, brw-curbe.curbe_bo);
+drm_intel_gem_bo_unmap_gtt(brw-curbe.curbe_bo);
 dri_bo_unreference(brw-curbe.curbe_bo);
 brw-curbe.curbe_bo = NULL;
   }
@@ -319,7 +318,7 @@ static void prepare_constant_buffer(struct brw_context *brw)
 brw-curbe.curbe_bo = dri_bo_alloc(brw-intel.bufmgr, CURBE,
4096, 1  6);
 brw-curbe.curbe_next_offset = 0;
-intel_bo_map_gtt_preferred(intel, brw-curbe.curbe_bo, GL_TRUE);
+drm_intel_gem_bo_map_gtt(brw-curbe.curbe_bo);
   }
 
   brw-curbe.curbe_offset = brw-curbe.curbe_next_offset;
diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c 
b/src/mesa/drivers/dri/i965/brw_draw_upload.c
index f0a4e8a..71a4357 100644
--- a/src/mesa/drivers/dri/i965/brw_draw_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c
@@ -276,7 +276,6 @@ copy_array_to_vbo_array( struct brw_context *brw,
 struct brw_vertex_element *element,
 GLuint dst_stride)
 {
-   struct intel_context *intel = brw-intel;
GLuint size = element-count * dst_stride;
 
get_space(brw, size, element-bo, element-offset);
@@ -289,52 +288,26 @@ copy_array_to_vbo_array( struct brw_context *brw,
}
 
if (dst_stride == element-glarray-StrideB) {
-  if (intel-intelScreen-kernel_exec_fencing) {
-drm_intel_gem_bo_map_gtt(element-bo);
-memcpy((char *)element-bo-virtual + element-offset,
-   element-glarray-Ptr, size);
-drm_intel_gem_bo_unmap_gtt(element-bo);
-  } else {
-dri_bo_subdata(element-bo,
-   element-offset,
-   size,
-   element-glarray-Ptr);
-  }
+  drm_intel_gem_bo_map_gtt(element-bo);
+  memcpy((char *)element-bo-virtual + element-offset,
+element-glarray-Ptr, size);
+  drm_intel_gem_bo_unmap_gtt(element-bo);
} else {
   char *dest;
   const unsigned char *src = element-glarray-Ptr;
   int i;
 
-  if (intel-intelScreen-kernel_exec_fencing) {
-drm_intel_gem_bo_map_gtt(element-bo);
-dest = element-bo-virtual;
-dest += element-offset;
-
-for (i = 0; i  element-count; i++) {
-   memcpy(dest, src, dst_stride);
-   src += element-glarray-StrideB;
-   dest += dst_stride;
-}
-
-drm_intel_gem_bo_unmap_gtt(element-bo);
-  } else {
-void *data;
-
-data = 

Mesa (master): Revert mesa: Remove pointless comparison of unsigned integer with a negative constant.

2010-03-04 Thread Vinson Lee
Module: Mesa
Branch: master
Commit: 45df4bad9fc0379f05197bee10c03fd351f24094
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=45df4bad9fc0379f05197bee10c03fd351f24094

Author: Vinson Lee v...@vmware.com
Date:   Thu Mar  4 17:40:36 2010 -0800

Revert mesa: Remove pointless comparison of unsigned integer with a negative 
constant.

This reverts commit a05fdbcb719ac64e6be842372813f0f4ca2f4f93.

Removing the comparison is wrong. The comparison with -1 should be changed
to another value (probably PROGRAM_UNDEFINED) along with another
change in the shader assembler.

Conflicts:

src/mesa/shader/prog_execute.c

---

 src/mesa/shader/prog_execute.c |   13 +
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/mesa/shader/prog_execute.c b/src/mesa/shader/prog_execute.c
index a1c20a3..37750cc 100644
--- a/src/mesa/shader/prog_execute.c
+++ b/src/mesa/shader/prog_execute.c
@@ -1767,10 +1767,15 @@ _mesa_execute_program(GLcontext * ctx,
  break;
   case OPCODE_PRINT:
  {
-GLfloat a[4];
-fetch_vector4(inst-SrcReg[0], machine, a);
-printf(%s%g, %g, %g, %g\n, (const char *) inst-Data,
-  a[0], a[1], a[2], a[3]);
+if (inst-SrcReg[0].File != -1) {
+   GLfloat a[4];
+   fetch_vector4(inst-SrcReg[0], machine, a);
+   printf(%s%g, %g, %g, %g\n, (const char *) inst-Data,
+a[0], a[1], a[2], a[3]);
+}
+else {
+   printf(%s\n, (const char *) inst-Data);
+}
  }
  break;
   case OPCODE_END:

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


Mesa (master): st/egl: Move modeset interface to native_modeset.h.

2010-03-04 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 89a75b763467d83d4d402c91db55548682be14f0
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=89a75b763467d83d4d402c91db55548682be14f0

Author: Chia-I Wu o...@lunarg.com
Date:   Fri Mar  5 10:40:15 2010 +0800

st/egl: Move modeset interface to native_modeset.h.

native.h is getting more and more complex.  Move the independent modeset
interface to native_modeset.h to simplify native.h a little.

---

 src/gallium/state_trackers/egl/common/native.h |   57 +
 .../state_trackers/egl/common/native_modeset.h |   87 
 2 files changed, 89 insertions(+), 55 deletions(-)

diff --git a/src/gallium/state_trackers/egl/common/native.h 
b/src/gallium/state_trackers/egl/common/native.h
index 1bf2804..4533b3a 100644
--- a/src/gallium/state_trackers/egl/common/native.h
+++ b/src/gallium/state_trackers/egl/common/native.h
@@ -34,6 +34,8 @@
 #include pipe/p_context.h
 #include pipe/p_state.h
 
+#include native_modeset.h
+
 /**
  * Only color buffers are listed.  The others are allocated privately through,
  * for example, st_renderbuffer_alloc_storage().
@@ -122,18 +124,6 @@ struct native_config {
boolean scanout_bit;
 };
 
-struct native_connector {
-   int dummy;
-};
-
-struct native_mode {
-   const char *desc;
-   int width, height;
-   int refresh_rate;
-};
-
-struct native_display_modeset;
-
 /**
  * A pipe winsys abstracts the OS.  A pipe screen abstracts the graphcis
  * hardware.  A native display consists of a pipe winsys, a pipe screen, and
@@ -206,49 +196,6 @@ struct native_display {
 };
 
 /**
- * Mode setting interface of the native display.  It exposes the mode setting
- * capabilities of the underlying graphics hardware.
- */
-struct native_display_modeset {
-   /**
-* Get the available physical connectors and the number of CRTCs.
-*/
-   const struct native_connector **(*get_connectors)(struct native_display 
*ndpy,
- int *num_connectors,
- int *num_crtcs);
-
-   /**
-* Get the current supported modes of a connector.  The returned modes may
-* change every time this function is called and those from previous calls
-* might become invalid.
-*/
-   const struct native_mode **(*get_modes)(struct native_display *ndpy,
-   const struct native_connector 
*nconn,
-   int *num_modes);
-
-   /**
-* Create a scan-out surface.  Required unless no config has
-* GLX_SCREEN_BIT_MESA set.
-*/
-   struct native_surface *(*create_scanout_surface)(struct native_display 
*ndpy,
-const struct native_config 
*nconf,
-uint width, uint height);
-
-   /**
-* Program the CRTC to output the surface to the given connectors with the
-* given mode.  When surface is not given, the CRTC is disabled.
-*
-* This interface does not export a way to query capabilities of the CRTCs.
-* The native display usually needs to dynamically map the index to a CRTC
-* that supports the given connectors.
-*/
-   boolean (*program)(struct native_display *ndpy, int crtc_idx,
-  struct native_surface *nsurf, uint x, uint y,
-  const struct native_connector **nconns, int num_nconns,
-  const struct native_mode *nmode);
-};
-
-/**
  * The handler for events that a native display may generate.  The events are
  * generated asynchronously and the handler may be called by any thread at any
  * time.
diff --git a/src/gallium/state_trackers/egl/common/native_modeset.h 
b/src/gallium/state_trackers/egl/common/native_modeset.h
new file mode 100644
index 000..71dc3ec
--- /dev/null
+++ b/src/gallium/state_trackers/egl/common/native_modeset.h
@@ -0,0 +1,87 @@
+/*
+ * Mesa 3-D graphics library
+ * Version:  7.8
+ *
+ * Copyright (C) 2009-2010 Chia-I Wu o...@0xlab.org
+ *
+ * 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, sublicense,
+ * 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 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 NONINFRINGEMENT.  IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF 

Mesa (master): st/egl: Add event support to the native display interface.

2010-03-04 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: e38f28ddedd6d4902ae18b1bf243e67d4b16decb
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e38f28ddedd6d4902ae18b1bf243e67d4b16decb

Author: Chia-I Wu o...@lunarg.com
Date:   Sun Feb 21 10:58:22 2010 +0800

st/egl: Add event support to the native display interface.

There is only invalid_surface event right now.  When EGL receives the
event, it sets the force_validate flag of the context binding to the
surface.  This helps skip an unnecessary check.

---

 src/gallium/state_trackers/egl/common/egl_g3d.c|   23 -
 src/gallium/state_trackers/egl/common/native.h |   27 +++-
 src/gallium/state_trackers/egl/kms/native_kms.c|   13 +++--
 src/gallium/state_trackers/egl/kms/native_kms.h|2 +
 src/gallium/state_trackers/egl/x11/native_dri2.c   |   20 --
 src/gallium/state_trackers/egl/x11/native_x11.c|7 +++--
 src/gallium/state_trackers/egl/x11/native_x11.h|8 -
 src/gallium/state_trackers/egl/x11/native_ximage.c |   20 ++-
 8 files changed, 106 insertions(+), 14 deletions(-)

diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c 
b/src/gallium/state_trackers/egl/common/egl_g3d.c
index 04268c7..ddb1ef1 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d.c
@@ -531,6 +531,24 @@ egl_g3d_update_buffer(struct pipe_screen *screen, void 
*context_private)
egl_g3d_validate_context(gctx-base.Resource.Display, gctx-base);
 }
 
+static void
+egl_g3d_invalid_surface(struct native_display *ndpy,
+struct native_surface *nsurf,
+unsigned int seq_num)
+{
+   /* XXX not thread safe? */
+   struct egl_g3d_surface *gsurf = egl_g3d_surface(nsurf-user_data);
+   struct egl_g3d_context *gctx = egl_g3d_context(gsurf-base.CurrentContext);
+
+   /* set force_validate to skip an unnecessary check */
+   if (gctx)
+  gctx-force_validate = TRUE;
+}
+
+static struct native_event_handler egl_g3d_native_event_handler = {
+   .invalid_surface = egl_g3d_invalid_surface
+};
+
 static EGLBoolean
 egl_g3d_terminate(_EGLDriver *drv, _EGLDisplay *dpy)
 {
@@ -575,12 +593,14 @@ egl_g3d_initialize(_EGLDriver *drv, _EGLDisplay *dpy,
}
dpy-DriverData = gdpy;
 
-   gdpy-native = native_create_display(dpy-NativeDisplay);
+   gdpy-native = native_create_display(dpy-NativeDisplay,
+ egl_g3d_native_event_handler);
if (!gdpy-native) {
   _eglError(EGL_NOT_INITIALIZED, eglInitialize(no usable display));
   goto fail;
}
 
+   gdpy-native-user_data = (void *) dpy;
gdpy-native-screen-flush_frontbuffer = egl_g3d_flush_frontbuffer;
gdpy-native-screen-update_buffer = egl_g3d_update_buffer;
 
@@ -776,6 +796,7 @@ egl_g3d_create_surface(_EGLDriver *drv, _EGLDisplay *dpy, 
_EGLConfig *conf,
   return NULL;
}
 
+   nsurf-user_data = gsurf-base;
gsurf-native = nsurf;
 
gsurf-render_att = (gsurf-base.RenderBuffer == EGL_SINGLE_BUFFER) ?
diff --git a/src/gallium/state_trackers/egl/common/native.h 
b/src/gallium/state_trackers/egl/common/native.h
index 4f97585..1bf2804 100644
--- a/src/gallium/state_trackers/egl/common/native.h
+++ b/src/gallium/state_trackers/egl/common/native.h
@@ -69,6 +69,11 @@ struct native_probe {
 };
 
 struct native_surface {
+   /**
+* Available for caller's use.
+*/
+   void *user_data;
+
void (*destroy)(struct native_surface *nsurf);
 
/**
@@ -143,6 +148,11 @@ struct native_display {
 */
struct pipe_screen *screen;
 
+   /**
+* Available for caller's use.
+*/
+   void *user_data;
+
void (*destroy)(struct native_display *ndpy);
 
/**
@@ -239,6 +249,20 @@ struct native_display_modeset {
 };
 
 /**
+ * The handler for events that a native display may generate.  The events are
+ * generated asynchronously and the handler may be called by any thread at any
+ * time.
+ */
+struct native_event_handler {
+   /**
+* This function is called when a surface needs to be validated.
+*/
+   void (*invalid_surface)(struct native_display *ndpy,
+   struct native_surface *nsurf,
+   unsigned int seq_num);
+};
+
+/**
  * Test whether an attachment is set in the mask.
  */
 static INLINE boolean
@@ -267,6 +291,7 @@ const char *
 native_get_name(void);
 
 struct native_display *
-native_create_display(EGLNativeDisplayType dpy);
+native_create_display(EGLNativeDisplayType dpy,
+  struct native_event_handler *handler);
 
 #endif /* _NATIVE_H_ */
diff --git a/src/gallium/state_trackers/egl/kms/native_kms.c 
b/src/gallium/state_trackers/egl/kms/native_kms.c
index aedf3d4..90c82ea 100644
--- a/src/gallium/state_trackers/egl/kms/native_kms.c
+++ b/src/gallium/state_trackers/egl/kms/native_kms.c
@@ -201,6 +201,8 @@ kms_surface_swap_buffers(struct native_surface *nsurf)
 
/* the front/back textures are swapped */
ksurf-sequence_number++;
+   

Mesa (master): mesa/es: Update GLAPI and APISpec for GL_OES_EGL_image.

2010-03-04 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 3490923c817cd81d46a405de117e9ba8a8aeef3c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3490923c817cd81d46a405de117e9ba8a8aeef3c

Author: Chia-I Wu o...@lunarg.com
Date:   Thu Feb 25 16:37:04 2010 +0800

mesa/es: Update GLAPI and APISpec for GL_OES_EGL_image.

This generates the entrypoints and dispatches for GL_OES_EGL_image.
There is no real support yet.

---

 src/mesa/es/glapi/es_EXT.xml |3 ++
 src/mesa/es/main/APIspec.xml |   39 ++
 src/mesa/es/main/mfeatures_es1.h |2 +
 src/mesa/es/main/mfeatures_es2.h |2 +
 4 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/src/mesa/es/glapi/es_EXT.xml b/src/mesa/es/glapi/es_EXT.xml
index 629ba90..291a53b 100644
--- a/src/mesa/es/glapi/es_EXT.xml
+++ b/src/mesa/es/glapi/es_EXT.xml
@@ -18,6 +18,9 @@
 enum name=PALETTE8_RGB5_A1_OES value=0x8B99/
 /category
 
+!-- 23. GL_OES_EGL_image --
+xi:include href=../../glapi/gen/OES_EGL_image.xml 
xmlns:xi=http://www.w3.org/2001/XInclude/
+
 category name=GL_OES_depth24 number=24
 enum name=DEPTH_COMPONENT24_OESvalue=0x81A6/
 /category
diff --git a/src/mesa/es/main/APIspec.xml b/src/mesa/es/main/APIspec.xml
index f6f3313..17665d8 100644
--- a/src/mesa/es/main/APIspec.xml
+++ b/src/mesa/es/main/APIspec.xml
@@ -3502,6 +3502,31 @@
/desc
 /template
 
+template name=EGLImageTargetTexture2D
+   proto
+   return type=void/
+   param name=target type=GLenum/
+   param name=image type=GLeglImageOES/
+   /proto
+
+   desc name=target
+   value name=GL_TEXTURE_2D/
+   /desc
+/template
+
+template name=EGLImageTargetRenderbufferStorage
+   proto
+   return type=void/
+   param name=target type=GLenum/
+   param name=image type=GLeglImageOES/
+   /proto
+
+   desc name=target
+   value name=GL_RENDERBUFFER_OES 
category=OES_framebuffer_object/
+   value name=GL_RENDERBUFFER category=GLES2.0/
+   /desc
+/template
+
 api name=mesa implementation=true
category name=MESA/
 
@@ -3770,6 +3795,10 @@
 !-- EXT_multi_draw_arrays --
 function name=MultiDrawArraysEXT template=MultiDrawArrays/
 function name=MultiDrawElementsEXT template=MultiDrawElements/
+
+!-- OES_EGL_image --
+function name=EGLImageTargetTexture2DOES 
template=EGLImageTargetTexture2D/
+function name=EGLImageTargetRenderbufferStorageOES 
template=EGLImageTargetRenderbufferStorage/
 /api
 
 api name=GLES1.1
@@ -3811,6 +3840,7 @@
category name=EXT_blend_minmax/
--
category name=EXT_multi_draw_arrays/
+   category name=OES_EGL_image/
 
category name=OES_matrix_palette/
 
@@ -4068,6 +4098,10 @@
 !-- EXT_multi_draw_arrays --
 function name=MultiDrawArraysEXT template=MultiDrawArrays/
 function name=MultiDrawElementsEXT template=MultiDrawElements/
+
+!-- OES_EGL_image --
+function name=EGLImageTargetTexture2DOES 
template=EGLImageTargetTexture2D/
+function name=EGLImageTargetRenderbufferStorageOES 
template=EGLImageTargetRenderbufferStorage/
 /api
 
 api name=GLES2.0
@@ -4095,6 +4129,7 @@
category name=EXT_blend_minmax/
--
category name=EXT_multi_draw_arrays/
+   category name=OES_EGL_image/
 
function name=CullFace template=CullFace/
 
@@ -4292,6 +4327,10 @@
 !-- EXT_multi_draw_arrays --
 function name=MultiDrawArraysEXT template=MultiDrawArrays/
 function name=MultiDrawElementsEXT template=MultiDrawElements/
+
+!-- OES_EGL_image --
+function name=EGLImageTargetTexture2DOES 
template=EGLImageTargetTexture2D/
+function name=EGLImageTargetRenderbufferStorageOES 
template=EGLImageTargetRenderbufferStorage/
 /api
 
 /apispec
diff --git a/src/mesa/es/main/mfeatures_es1.h b/src/mesa/es/main/mfeatures_es1.h
index 6c2ece2..1793550 100644
--- a/src/mesa/es/main/mfeatures_es1.h
+++ b/src/mesa/es/main/mfeatures_es1.h
@@ -106,6 +106,8 @@
 #define FEATURE_OES_draw_texture 1
 #define FEATURE_OES_mapbuffer 1
 
+#define FEATURE_OES_EGL_image 1
+
 #define FEATURE_extra_context_init 1
 
 /*...@}*/
diff --git a/src/mesa/es/main/mfeatures_es2.h b/src/mesa/es/main/mfeatures_es2.h
index f34782f..a463bed 100644
--- a/src/mesa/es/main/mfeatures_es2.h
+++ b/src/mesa/es/main/mfeatures_es2.h
@@ -106,6 +106,8 @@
 #define FEATURE_OES_draw_texture 0
 #define FEATURE_OES_mapbuffer 1
 
+#define FEATURE_OES_EGL_image 1
+
 #define FEATURE_extra_context_init 1
 
 /*...@}*/

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