Re: [Mesa-dev] [PATCH] mesa: Use the proper feature test macros for strtod_l and strtof[_l].

2012-05-12 Thread Bryan Henderson
>Tell that to the config files.  It was added to darwin's config file,
>presumably because we supported the functionality it enabled.

I guess there are a number of things this sentence could mean.  Based on the
juxtaposition of -D_GNU_SOURCE with -D_BSD_SOURCE and -D_DARWIN_C_SOURCE, this
suggests that the Darwin C library responds to _GNU_SOURCE being defined by
providing all those GNU-specific facilities.  Do you know?  Is the Darwin C
library supposed to provide a superset of the GNU C library?

Some people do like to put the definition of these source type declarations on
the compile command (-D) instead of in the source file itself (#define).  I
tend to think it's because they don't understand what the macro is for, but it
could also be because it's more convenient in some ways.

But another reason -D_GNU_SOURCE is in the Darwin config file might be that
someone noticed its incorrect use in strtod.c and exploited it.

Whatever the reason, "if _GNU_SOURCE" evidently cannot just be replaced with
"if __GLIBC__", but has to be "if __GLIBC__ or __APPLE__" and if there are
another other platforms that do -D_GNU_SOURCE but aren't using either the GNU
or Apple C libraries, those have to be added in there too to avoid a
regression.

-- 
Bryan Henderson   San Jose, California
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 49830] New: [compile error] Makefile:29: *** target file `default' has both : and :: entries. Stop.

2012-05-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=49830

 Bug #: 49830
   Summary: [compile error] Makefile:29: *** target file `default'
has both : and :: entries.  Stop.
Classification: Unclassified
   Product: Mesa
   Version: git
  Platform: All
OS/Version: Linux (All)
Status: NEW
  Severity: critical
  Priority: high
 Component: Mesa core
AssignedTo: mesa-dev@lists.freedesktop.org
ReportedBy: fabio@libero.it


Since yesterday git  I get this error while compiling mesa:
make[4]: Entering directory
`/build/buildd/mesa-8.1~git1205121108.31a25d~gd~p/build/dri/src/gallium/auxiliary'
Makefile:29: *** target file `default' has both : and :: entries.  Stop.

Full log available at:
https://launchpadlibrarian.net/104886783/buildlog_ubuntu-precise-amd64.mesa_8.1~git1205121108.31a25d~gd~p_FAILEDTOBUILD.txt.gz

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/3] gallium/util: remove unused parameter nr_vertex_buffers in util_draw_max_index

2012-05-12 Thread Marek Olšák
---
 src/gallium/auxiliary/draw/draw_pt.c |1 -
 src/gallium/auxiliary/util/u_draw.c  |1 -
 src/gallium/auxiliary/util/u_draw.h  |1 -
 3 files changed, 3 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_pt.c 
b/src/gallium/auxiliary/draw/draw_pt.c
index 025d539..dbe5e94 100644
--- a/src/gallium/auxiliary/draw/draw_pt.c
+++ b/src/gallium/auxiliary/draw/draw_pt.c
@@ -505,7 +505,6 @@ draw_vbo(struct draw_context *draw,
   draw_print_arrays(draw, info->mode, info->start, MIN2(info->count, 20));
 
index_limit = util_draw_max_index(draw->pt.vertex_buffer,
- draw->pt.nr_vertex_buffers,
  draw->pt.vertex_element,
  draw->pt.nr_vertex_elements,
  info);
diff --git a/src/gallium/auxiliary/util/u_draw.c 
b/src/gallium/auxiliary/util/u_draw.c
index 1f3eb88..5b3c412 100644
--- a/src/gallium/auxiliary/util/u_draw.c
+++ b/src/gallium/auxiliary/util/u_draw.c
@@ -44,7 +44,6 @@
 unsigned
 util_draw_max_index(
   const struct pipe_vertex_buffer *vertex_buffers,
-  unsigned nr_vertex_buffers,
   const struct pipe_vertex_element *vertex_elements,
   unsigned nr_vertex_elements,
   const struct pipe_draw_info *info)
diff --git a/src/gallium/auxiliary/util/u_draw.h 
b/src/gallium/auxiliary/util/u_draw.h
index fdb683c..3dc6918 100644
--- a/src/gallium/auxiliary/util/u_draw.h
+++ b/src/gallium/auxiliary/util/u_draw.h
@@ -145,7 +145,6 @@ util_draw_range_elements(struct pipe_context *pipe,
 unsigned
 util_draw_max_index(
   const struct pipe_vertex_buffer *vertex_buffers,
-  unsigned nr_vertex_buffers,
   const struct pipe_vertex_element *vertex_elements,
   unsigned nr_vertex_elements,
   const struct pipe_draw_info *info);
-- 
1.7.9.5

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


[Mesa-dev] [PATCH 2/3] gallium/graw: stop using user_buffer_create

2012-05-12 Thread Marek Olšák
This is compile-tested.
---
 src/gallium/auxiliary/util/u_inlines.h   |   13 +
 src/gallium/tests/graw/fs-fragcoord.c|9 +
 src/gallium/tests/graw/fs-frontface.c|9 +
 src/gallium/tests/graw/fs-test.c |9 +
 src/gallium/tests/graw/fs-write-z.c  |9 +
 src/gallium/tests/graw/gs-test.c |   18 ++
 src/gallium/tests/graw/occlusion-query.c |9 +
 src/gallium/tests/graw/quad-sample.c |9 +
 src/gallium/tests/graw/quad-tex.c|9 +
 src/gallium/tests/graw/shader-leak.c |   10 ++
 src/gallium/tests/graw/tex-srgb.c|9 +
 src/gallium/tests/graw/tex-swizzle.c |9 +
 src/gallium/tests/graw/tri-gs.c  |   10 ++
 src/gallium/tests/graw/tri-instanced.c   |   29 -
 src/gallium/tests/graw/tri.c |9 +
 src/gallium/tests/graw/vs-test.c |9 +
 16 files changed, 106 insertions(+), 73 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_inlines.h 
b/src/gallium/auxiliary/util/u_inlines.h
index 651f7c2..e78cdda 100644
--- a/src/gallium/auxiliary/util/u_inlines.h
+++ b/src/gallium/auxiliary/util/u_inlines.h
@@ -376,6 +376,19 @@ pipe_buffer_write_nooverlap(struct pipe_context *pipe,
0, 0);
 }
 
+static INLINE struct pipe_resource *
+pipe_buffer_create_with_data(struct pipe_context *pipe,
+ unsigned bind,
+ unsigned usage,
+ unsigned size,
+ void *ptr)
+{
+   struct pipe_resource *res = pipe_buffer_create(pipe->screen,
+  bind, usage, size);
+   pipe_buffer_write_nooverlap(pipe, res, 0, size, ptr);
+   return res;
+}
+
 static INLINE void
 pipe_buffer_read(struct pipe_context *pipe,
  struct pipe_resource *buf,
diff --git a/src/gallium/tests/graw/fs-fragcoord.c 
b/src/gallium/tests/graw/fs-fragcoord.c
index 471acbb..893170f 100644
--- a/src/gallium/tests/graw/fs-fragcoord.c
+++ b/src/gallium/tests/graw/fs-fragcoord.c
@@ -67,10 +67,11 @@ set_vertices(void)
 
vbuf.stride = sizeof(struct vertex);
vbuf.buffer_offset = 0;
-   vbuf.buffer = info.screen->user_buffer_create(info.screen,
-vertices,
-sizeof(vertices),
-PIPE_BIND_VERTEX_BUFFER);
+   vbuf.buffer = pipe_buffer_create_with_data(info.ctx,
+  PIPE_BIND_VERTEX_BUFFER,
+  PIPE_USAGE_STATIC,
+  sizeof(vertices),
+  vertices);
 
info.ctx->set_vertex_buffers(info.ctx, 1, &vbuf);
 }
diff --git a/src/gallium/tests/graw/fs-frontface.c 
b/src/gallium/tests/graw/fs-frontface.c
index e725255..d46ce55 100644
--- a/src/gallium/tests/graw/fs-frontface.c
+++ b/src/gallium/tests/graw/fs-frontface.c
@@ -89,10 +89,11 @@ set_vertices(void)
 
vbuf.stride = sizeof(struct vertex);
vbuf.buffer_offset = 0;
-   vbuf.buffer = info.screen->user_buffer_create(info.screen,
- vertices,
- sizeof(vertices),
- PIPE_BIND_VERTEX_BUFFER);
+   vbuf.buffer = pipe_buffer_create_with_data(info.ctx,
+  PIPE_BIND_VERTEX_BUFFER,
+  PIPE_USAGE_STATIC,
+  sizeof(vertices),
+  vertices);
 
info.ctx->set_vertex_buffers(info.ctx, 1, &vbuf);
 }
diff --git a/src/gallium/tests/graw/fs-test.c b/src/gallium/tests/graw/fs-test.c
index b42a86c..1c0d514 100644
--- a/src/gallium/tests/graw/fs-test.c
+++ b/src/gallium/tests/graw/fs-test.c
@@ -216,10 +216,11 @@ static void set_vertices( void )
 
vbuf.stride = sizeof( struct vertex );
vbuf.buffer_offset = 0;
-   vbuf.buffer = screen->user_buffer_create(screen,
-vertices,
-sizeof(vertices),
-PIPE_BIND_VERTEX_BUFFER);
+   vbuf.buffer = pipe_buffer_create_with_data(ctx,
+  PIPE_BIND_VERTEX_BUFFER,
+  PIPE_USAGE_STATIC,
+  sizeof(vertices),
+  vertices);
 
ctx->set_vertex_buffers(ctx, 1, &vbuf);
 }
diff --git a/src/gallium/tests/graw/fs-write-z.c 
b/src/gallium/tests/graw/fs-write-z.c
index 186e3ec..3eee2b2 100644
--- a/src/gallium/tests/graw/fs-write-z.c
+++ b/src

[Mesa-dev] [PATCH 3/3] gallium: remove user_buffer_create from the interface

2012-05-12 Thread Marek Olšák
Nothing uses it now.
---
 src/gallium/auxiliary/util/u_inlines.h   |8 -
 src/gallium/auxiliary/util/u_slab.h  |2 +-
 src/gallium/drivers/galahad/glhd_screen.c|   23 --
 src/gallium/drivers/i915/i915_resource.c |1 -
 src/gallium/drivers/identity/id_screen.c |   23 --
 src/gallium/drivers/llvmpipe/lp_texture.c|2 --
 src/gallium/drivers/noop/noop_pipe.c |   18 ---
 src/gallium/drivers/nv30/nv30_resource.c |1 -
 src/gallium/drivers/nv50/nv50_resource.c |1 -
 src/gallium/drivers/nvc0/nvc0_resource.c |1 -
 src/gallium/drivers/r600/r600_buffer.c   |   25 ---
 src/gallium/drivers/r600/r600_pipe.h |3 --
 src/gallium/drivers/r600/r600_resource.c |1 -
 src/gallium/drivers/radeonsi/r600_buffer.c   |   25 ---
 src/gallium/drivers/radeonsi/r600_resource.c |1 -
 src/gallium/drivers/radeonsi/radeonsi_pipe.h |3 --
 src/gallium/drivers/rbug/rbug_screen.c   |   23 --
 src/gallium/drivers/softpipe/sp_texture.c|2 --
 src/gallium/drivers/svga/svga_resource.c |1 -
 src/gallium/drivers/trace/tr_screen.c|   44 --
 src/gallium/include/pipe/p_screen.h  |   26 ---
 21 files changed, 1 insertion(+), 233 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_inlines.h 
b/src/gallium/auxiliary/util/u_inlines.h
index e78cdda..ebc64a2 100644
--- a/src/gallium/auxiliary/util/u_inlines.h
+++ b/src/gallium/auxiliary/util/u_inlines.h
@@ -233,14 +233,6 @@ pipe_buffer_create( struct pipe_screen *screen,
return screen->resource_create(screen, &buffer);
 }
 
-
-static INLINE struct pipe_resource *
-pipe_user_buffer_create( struct pipe_screen *screen, void *ptr, unsigned size,
-unsigned usage )
-{
-   return screen->user_buffer_create(screen, ptr, size, usage);
-}
-
 static INLINE void *
 pipe_buffer_map_range(struct pipe_context *pipe,
  struct pipe_resource *buffer,
diff --git a/src/gallium/auxiliary/util/u_slab.h 
b/src/gallium/auxiliary/util/u_slab.h
index 6b9718d..3ed8b12 100644
--- a/src/gallium/auxiliary/util/u_slab.h
+++ b/src/gallium/auxiliary/util/u_slab.h
@@ -28,7 +28,7 @@
  * Good for allocations which have very low lifetime and are allocated
  * and freed very often. Use a profiler first to know if it's worth using it!
  *
- * Candidates: get_transfer, user_buffer_create
+ * Candidates: get_transfer
  *
  * @author Marek Olšák
  */
diff --git a/src/gallium/drivers/galahad/glhd_screen.c 
b/src/gallium/drivers/galahad/glhd_screen.c
index 49702b6..7d03763 100644
--- a/src/gallium/drivers/galahad/glhd_screen.c
+++ b/src/gallium/drivers/galahad/glhd_screen.c
@@ -222,28 +222,6 @@ galahad_screen_resource_destroy(struct pipe_screen *screen,
 }
 
 
-static struct pipe_resource *
-galahad_screen_user_buffer_create(struct pipe_screen *_screen,
-   void *ptr,
-   unsigned bytes,
-   unsigned usage)
-{
-   struct galahad_screen *glhd_screen = galahad_screen(_screen);
-   struct pipe_screen *screen = glhd_screen->screen;
-   struct pipe_resource *result;
-
-   result = screen->user_buffer_create(screen,
-   ptr,
-   bytes,
-   usage);
-
-   if (result)
-  return galahad_resource_create(glhd_screen, result);
-   return NULL;
-}
-
-
-
 static void
 galahad_screen_flush_frontbuffer(struct pipe_screen *_screen,
   struct pipe_resource *_resource,
@@ -323,7 +301,6 @@ galahad_screen_create(struct pipe_screen *screen)
glhd_screen->base.resource_from_handle = 
galahad_screen_resource_from_handle;
glhd_screen->base.resource_get_handle = galahad_screen_resource_get_handle;
glhd_screen->base.resource_destroy = galahad_screen_resource_destroy;
-   glhd_screen->base.user_buffer_create = galahad_screen_user_buffer_create;
glhd_screen->base.flush_frontbuffer = galahad_screen_flush_frontbuffer;
glhd_screen->base.fence_reference = galahad_screen_fence_reference;
glhd_screen->base.fence_signalled = galahad_screen_fence_signalled;
diff --git a/src/gallium/drivers/i915/i915_resource.c 
b/src/gallium/drivers/i915/i915_resource.c
index b4719af..253c7d0 100644
--- a/src/gallium/drivers/i915/i915_resource.c
+++ b/src/gallium/drivers/i915/i915_resource.c
@@ -46,5 +46,4 @@ i915_init_screen_resource_functions(struct i915_screen *is)
is->base.resource_from_handle = i915_resource_from_handle;
is->base.resource_get_handle = u_resource_get_handle_vtbl;
is->base.resource_destroy = u_resource_destroy_vtbl;
-   is->base.user_buffer_create = i915_user_buffer_create;
 }
diff --git a/src/gallium/drivers/identity/id_screen.c 
b/src/gallium/drivers/identity/id_screen.c
index a173235..ab82e29 100644
--- a/src/gallium/driv

[Mesa-dev] [PATCH] mesa: initialize renderbuffer fields even if AllocStorage fails

2012-05-12 Thread Marek Olšák
It may fail with an unsupported format, but that's not an allowed case where
RenderbufferStorage may fail. And on success, we should return valid values
from GetRenderbufferParameteriv.

This fixes piglit: get-renderbuffer-internalformat
---
 src/mesa/main/fbobject.c |   18 +-
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 83e..c67b5be 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -1402,13 +1402,21 @@ renderbuffer_storage(GLenum target, GLenum 
internalFormat,
   assert(rb->_BaseFormat != 0);
}
else {
-  /* Probably ran out of memory - clear the fields */
-  rb->Width = 0;
-  rb->Height = 0;
+  /* Probably ran out of memory - set the fields anyway, because
+   * the ARB_fbo spec says:
+   *
+   *   "Upon success, ... RENDERBUFFER_WIDTH is set to ,
+   *RENDERBUFFER_HEIGHT is set to , and
+   *RENDERBUFFER_INTERNAL_FORMAT is set to ."
+   *
+   * Assuming the "success" means no GL errors.
+   */
+  rb->Width = width;
+  rb->Height = height;
   rb->Format = MESA_FORMAT_NONE;
-  rb->InternalFormat = GL_NONE;
+  rb->InternalFormat = internalFormat;
   rb->_BaseFormat = GL_NONE;
-  rb->NumSamples = 0;
+  rb->NumSamples = samples;
}
 
/* Invalidate the framebuffers the renderbuffer is attached in. */
-- 
1.7.9.5

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


Re: [Mesa-dev] [PATCH 1/3] gallium/util: remove unused parameter nr_vertex_buffers in util_draw_max_index

2012-05-12 Thread Jose Fonseca
This may come handy in the future, so instead of changing the prototype, please 
just add a (void)nr_vertex_buffers in the body.

Joe

- Original Message -
> ---
>  src/gallium/auxiliary/draw/draw_pt.c |1 -
>  src/gallium/auxiliary/util/u_draw.c  |1 -
>  src/gallium/auxiliary/util/u_draw.h  |1 -
>  3 files changed, 3 deletions(-)
> 
> diff --git a/src/gallium/auxiliary/draw/draw_pt.c
> b/src/gallium/auxiliary/draw/draw_pt.c
> index 025d539..dbe5e94 100644
> --- a/src/gallium/auxiliary/draw/draw_pt.c
> +++ b/src/gallium/auxiliary/draw/draw_pt.c
> @@ -505,7 +505,6 @@ draw_vbo(struct draw_context *draw,
>draw_print_arrays(draw, info->mode, info->start,
>MIN2(info->count, 20));
>  
> index_limit = util_draw_max_index(draw->pt.vertex_buffer,
> - draw->pt.nr_vertex_buffers,
>   draw->pt.vertex_element,
>   draw->pt.nr_vertex_elements,
>   info);
> diff --git a/src/gallium/auxiliary/util/u_draw.c
> b/src/gallium/auxiliary/util/u_draw.c
> index 1f3eb88..5b3c412 100644
> --- a/src/gallium/auxiliary/util/u_draw.c
> +++ b/src/gallium/auxiliary/util/u_draw.c
> @@ -44,7 +44,6 @@
>  unsigned
>  util_draw_max_index(
>const struct pipe_vertex_buffer *vertex_buffers,
> -  unsigned nr_vertex_buffers,
>const struct pipe_vertex_element *vertex_elements,
>unsigned nr_vertex_elements,
>const struct pipe_draw_info *info)
> diff --git a/src/gallium/auxiliary/util/u_draw.h
> b/src/gallium/auxiliary/util/u_draw.h
> index fdb683c..3dc6918 100644
> --- a/src/gallium/auxiliary/util/u_draw.h
> +++ b/src/gallium/auxiliary/util/u_draw.h
> @@ -145,7 +145,6 @@ util_draw_range_elements(struct pipe_context
> *pipe,
>  unsigned
>  util_draw_max_index(
>const struct pipe_vertex_buffer *vertex_buffers,
> -  unsigned nr_vertex_buffers,
>const struct pipe_vertex_element *vertex_elements,
>unsigned nr_vertex_elements,
>const struct pipe_draw_info *info);
> --
> 1.7.9.5
> 
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/3] gallium: remove user_buffer_create from the interface

2012-05-12 Thread Jose Fonseca
Patch 2 and 3 look good to me.

I think this is a nice cleanup.

Jose

- Original Message -
> Nothing uses it now.
> ---
>  src/gallium/auxiliary/util/u_inlines.h   |8 -
>  src/gallium/auxiliary/util/u_slab.h  |2 +-
>  src/gallium/drivers/galahad/glhd_screen.c|   23 --
>  src/gallium/drivers/i915/i915_resource.c |1 -
>  src/gallium/drivers/identity/id_screen.c |   23 --
>  src/gallium/drivers/llvmpipe/lp_texture.c|2 --
>  src/gallium/drivers/noop/noop_pipe.c |   18 ---
>  src/gallium/drivers/nv30/nv30_resource.c |1 -
>  src/gallium/drivers/nv50/nv50_resource.c |1 -
>  src/gallium/drivers/nvc0/nvc0_resource.c |1 -
>  src/gallium/drivers/r600/r600_buffer.c   |   25 ---
>  src/gallium/drivers/r600/r600_pipe.h |3 --
>  src/gallium/drivers/r600/r600_resource.c |1 -
>  src/gallium/drivers/radeonsi/r600_buffer.c   |   25 ---
>  src/gallium/drivers/radeonsi/r600_resource.c |1 -
>  src/gallium/drivers/radeonsi/radeonsi_pipe.h |3 --
>  src/gallium/drivers/rbug/rbug_screen.c   |   23 --
>  src/gallium/drivers/softpipe/sp_texture.c|2 --
>  src/gallium/drivers/svga/svga_resource.c |1 -
>  src/gallium/drivers/trace/tr_screen.c|   44
>  --
>  src/gallium/include/pipe/p_screen.h  |   26 ---
>  21 files changed, 1 insertion(+), 233 deletions(-)
> 
> diff --git a/src/gallium/auxiliary/util/u_inlines.h
> b/src/gallium/auxiliary/util/u_inlines.h
> index e78cdda..ebc64a2 100644
> --- a/src/gallium/auxiliary/util/u_inlines.h
> +++ b/src/gallium/auxiliary/util/u_inlines.h
> @@ -233,14 +233,6 @@ pipe_buffer_create( struct pipe_screen *screen,
> return screen->resource_create(screen, &buffer);
>  }
>  
> -
> -static INLINE struct pipe_resource *
> -pipe_user_buffer_create( struct pipe_screen *screen, void *ptr,
> unsigned size,
> -  unsigned usage )
> -{
> -   return screen->user_buffer_create(screen, ptr, size, usage);
> -}
> -
>  static INLINE void *
>  pipe_buffer_map_range(struct pipe_context *pipe,
> struct pipe_resource *buffer,
> diff --git a/src/gallium/auxiliary/util/u_slab.h
> b/src/gallium/auxiliary/util/u_slab.h
> index 6b9718d..3ed8b12 100644
> --- a/src/gallium/auxiliary/util/u_slab.h
> +++ b/src/gallium/auxiliary/util/u_slab.h
> @@ -28,7 +28,7 @@
>   * Good for allocations which have very low lifetime and are
>   allocated
>   * and freed very often. Use a profiler first to know if it's worth
>   using it!
>   *
> - * Candidates: get_transfer, user_buffer_create
> + * Candidates: get_transfer
>   *
>   * @author Marek Olšák
>   */
> diff --git a/src/gallium/drivers/galahad/glhd_screen.c
> b/src/gallium/drivers/galahad/glhd_screen.c
> index 49702b6..7d03763 100644
> --- a/src/gallium/drivers/galahad/glhd_screen.c
> +++ b/src/gallium/drivers/galahad/glhd_screen.c
> @@ -222,28 +222,6 @@ galahad_screen_resource_destroy(struct
> pipe_screen *screen,
>  }
>  
>  
> -static struct pipe_resource *
> -galahad_screen_user_buffer_create(struct pipe_screen *_screen,
> -   void *ptr,
> -   unsigned bytes,
> -   unsigned usage)
> -{
> -   struct galahad_screen *glhd_screen = galahad_screen(_screen);
> -   struct pipe_screen *screen = glhd_screen->screen;
> -   struct pipe_resource *result;
> -
> -   result = screen->user_buffer_create(screen,
> -   ptr,
> -   bytes,
> -   usage);
> -
> -   if (result)
> -  return galahad_resource_create(glhd_screen, result);
> -   return NULL;
> -}
> -
> -
> -
>  static void
>  galahad_screen_flush_frontbuffer(struct pipe_screen *_screen,
>struct pipe_resource *_resource,
> @@ -323,7 +301,6 @@ galahad_screen_create(struct pipe_screen *screen)
> glhd_screen->base.resource_from_handle =
> galahad_screen_resource_from_handle;
> glhd_screen->base.resource_get_handle =
> galahad_screen_resource_get_handle;
> glhd_screen->base.resource_destroy =
> galahad_screen_resource_destroy;
> -   glhd_screen->base.user_buffer_create =
> galahad_screen_user_buffer_create;
> glhd_screen->base.flush_frontbuffer =
> galahad_screen_flush_frontbuffer;
> glhd_screen->base.fence_reference =
> galahad_screen_fence_reference;
> glhd_screen->base.fence_signalled =
> galahad_screen_fence_signalled;
> diff --git a/src/gallium/drivers/i915/i915_resource.c
> b/src/gallium/drivers/i915/i915_resource.c
> index b4719af..253c7d0 100644
> --- a/src/gallium/drivers/i915/i915_resource.c
> +++ b/src/gallium/drivers/i915/i915_resource.c
> @@ -46,5 +46,4 @@ i915_init_screen_resource_functions(struct
> i915_screen *is)
> is->base.resource_from_handle

Re: [Mesa-dev] [PATCH 1/3] gallium/util: remove unused parameter nr_vertex_buffers in util_draw_max_index

2012-05-12 Thread Marek Olšák
On Sat, May 12, 2012 at 6:28 PM, Jose Fonseca  wrote:
> This may come handy in the future, so instead of changing the prototype, 
> please just add a (void)nr_vertex_buffers in the body.

It doesn't produce a warning, so I'll just leave it the way it is.

FWIW, once we add the start_slot parameter into set_vertex_buffers,
nr_vertex_buffers will very likely disappear from most places, because
each vertex buffer slot will be a separate and independent state. The
only things that will matter to drivers are:
1) which slots are used by the vertex element state
2) which slots are enabled (e.g. a non-null resource is bound)

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


Re: [Mesa-dev] [PATCH 1/3] gallium/util: remove unused parameter nr_vertex_buffers in util_draw_max_index

2012-05-12 Thread Jose Fonseca


- Original Message -
> On Sat, May 12, 2012 at 6:28 PM, Jose Fonseca 
> wrote:
> > This may come handy in the future, so instead of changing the
> > prototype, please just add a (void)nr_vertex_buffers in the body.
> 
> It doesn't produce a warning, so I'll just leave it the way it is.
> 
> FWIW, once we add the start_slot parameter into set_vertex_buffers,
> nr_vertex_buffers will very likely disappear from most places,
> because
> each vertex buffer slot will be a separate and independent state. The
> only things that will matter to drivers are:
> 1) which slots are used by the vertex element state
> 2) which slots are enabled (e.g. a non-null resource is bound)

I see. You can go ahead then.

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


Re: [Mesa-dev] [PATCH] clover, gallium: add PIPE_COMPUTE_CAP_MAX_THREADS_PER_BLOCK

2012-05-12 Thread Francisco Jerez
Christoph Bumiller  writes:

> This is not necessarily the product of MAX_BLOCK_SIZE[i].

Thanks, looks good.  I've pushed it along with a fix for
clEnqueueNDRangeKernel() to check that the work-group dimensions
specified by the user are within the limit set by this cap.

> ---
>  src/gallium/docs/source/screen.rst|5 +
>  src/gallium/include/pipe/p_defines.h  |1 +
>  src/gallium/state_trackers/clover/api/device.cpp  |3 ++-
>  src/gallium/state_trackers/clover/core/device.cpp |7 +++
>  src/gallium/state_trackers/clover/core/device.hpp |1 +
>  5 files changed, 16 insertions(+), 1 deletions(-)
>
> diff --git a/src/gallium/docs/source/screen.rst 
> b/src/gallium/docs/source/screen.rst
> index d912dc6..4e82d34 100644
> --- a/src/gallium/docs/source/screen.rst
> +++ b/src/gallium/docs/source/screen.rst
> @@ -203,6 +203,11 @@ pipe_screen::get_compute_param.
>units.  Value type: ``uint64_t []``.
>  * ``PIPE_COMPUTE_CAP_MAX_BLOCK_SIZE``: Maximum block size in thread
>units.  Value type: ``uint64_t []``.
> +* ``PIPE_COMPUTE_CAP_MAX_THREADS_PER_BLOCK``: Maximum number of threads that
> +  a single block can contain.  Value type: ``uint64_t``.
> +  This may be less than the product of the components of MAX_BLOCK_SIZE and 
> is
> +  usually limited by the number of threads that can be resident 
> simultaneously
> +  on a compute unit.
>  * ``PIPE_COMPUTE_CAP_MAX_GLOBAL_SIZE``: Maximum size of the GLOBAL
>resource.  Value type: ``uint64_t``.
>  * ``PIPE_COMPUTE_CAP_MAX_LOCAL_SIZE``: Maximum size of the LOCAL
> diff --git a/src/gallium/include/pipe/p_defines.h 
> b/src/gallium/include/pipe/p_defines.h
> index edcca23..2b6d1be 100644
> --- a/src/gallium/include/pipe/p_defines.h
> +++ b/src/gallium/include/pipe/p_defines.h
> @@ -545,6 +545,7 @@ enum pipe_compute_cap
> PIPE_COMPUTE_CAP_GRID_DIMENSION,
> PIPE_COMPUTE_CAP_MAX_GRID_SIZE,
> PIPE_COMPUTE_CAP_MAX_BLOCK_SIZE,
> +   PIPE_COMPUTE_CAP_MAX_THREADS_PER_BLOCK,
> PIPE_COMPUTE_CAP_MAX_GLOBAL_SIZE,
> PIPE_COMPUTE_CAP_MAX_LOCAL_SIZE,
> PIPE_COMPUTE_CAP_MAX_PRIVATE_SIZE,
> diff --git a/src/gallium/state_trackers/clover/api/device.cpp 
> b/src/gallium/state_trackers/clover/api/device.cpp
> index 0376751..1a9127b 100644
> --- a/src/gallium/state_trackers/clover/api/device.cpp
> +++ b/src/gallium/state_trackers/clover/api/device.cpp
> @@ -87,7 +87,8 @@ clGetDeviceInfo(cl_device_id dev, cl_device_info param,
>   dev->max_block_size());
>  
> case CL_DEVICE_MAX_WORK_GROUP_SIZE:
> -  return scalar_property(buf, size, size_ret, SIZE_MAX);
> +  return scalar_property(buf, size, size_ret,
> + dev->max_threads_per_block());
>  
> case CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR:
>return scalar_property(buf, size, size_ret, 16);
> diff --git a/src/gallium/state_trackers/clover/core/device.cpp 
> b/src/gallium/state_trackers/clover/core/device.cpp
> index 8390f3f..661f33a 100644
> --- a/src/gallium/state_trackers/clover/core/device.cpp
> +++ b/src/gallium/state_trackers/clover/core/device.cpp
> @@ -143,6 +143,13 @@ _cl_device_id::max_block_size() const {
> return get_compute_param(pipe, PIPE_COMPUTE_CAP_MAX_BLOCK_SIZE);
>  }
>  
> +size_t
> +_cl_device_id::max_threads_per_block() const {
> +   return
> +  get_compute_param(pipe,
> +  PIPE_COMPUTE_CAP_MAX_THREADS_PER_BLOCK)[0];
> +}
> +
>  std::string
>  _cl_device_id::device_name() const {
> return pipe->get_name(pipe);
> diff --git a/src/gallium/state_trackers/clover/core/device.hpp 
> b/src/gallium/state_trackers/clover/core/device.hpp
> index 8f284ba..b69e61f 100644
> --- a/src/gallium/state_trackers/clover/core/device.hpp
> +++ b/src/gallium/state_trackers/clover/core/device.hpp
> @@ -57,6 +57,7 @@ public:
> cl_uint max_const_buffers() const;
>  
> std::vector max_block_size() const;
> +   size_t max_threads_per_block() const;
> std::string device_name() const;
> std::string vendor_name() const;
> std::string ir_target() const;


pgpFnaog5iTvB.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 10/11] clover: Add function for building a clover::module for non-TGSI targets

2012-05-12 Thread Francisco Jerez
Tom Stellard  writes:

> ---
>  .../state_trackers/clover/llvm/invocation.cpp  |  174 
> +++-
>  1 files changed, 165 insertions(+), 9 deletions(-)
>
> diff --git a/src/gallium/state_trackers/clover/llvm/invocation.cpp 
> b/src/gallium/state_trackers/clover/llvm/invocation.cpp
> index 89e21bf..b31fddc 100644
> --- a/src/gallium/state_trackers/clover/llvm/invocation.cpp
> +++ b/src/gallium/state_trackers/clover/llvm/invocation.cpp
> @@ -22,24 +22,33 @@
>  
>  #include "core/compiler.hpp"
>  
> -#if 0
>  #include 
>  #include 
>  #include 
> +#include 
> +#include 
> +#include 
> +#include 
>  #include 
> +#include 
> +#include 
>  #include 
>  #include 
> +#include 
> +#include 
> +#include 
> +
> +#include "util/u_memory.h"
>  
>  #include 
>  #include 
>  #include 
>  #include 
> -#endif
>  
>  using namespace clover;
>  
> -#if 0
>  namespace {
> +#if 0
> void
> build_binary(const std::string &source, const std::string &target,
>  const std::string &name) {
> @@ -78,17 +87,164 @@ namespace {
>compat::istream cs(str);
>return module::deserialize(cs);
> }
> -}
>  #endif
> +   module
> +   build_module_llvm(const std::string &source, const std::string &target,
> + const std::string &name) {
> +
> +  /* Compile the kernel */
> +  clang::CompilerInstance c;
> +  module m;
> +  clang::EmitLLVMOnlyAction act(&llvm::getGlobalContext());
> +  std::string log;
> +  std::string target_triple = target + "--";
> +  llvm::raw_string_ostream s_log(log);
> +
> +#if HAVE_LLVM <= 0x0300
> +  c.getFrontendOpts().Inputs.push_back(
> + std::make_pair(clang::IK_OpenCL, "cl_input"));
> +#else
> +  c.getFrontendOpts().Inputs.push_back(
> + clang::FrontendInputFile("cl_input", clang::IK_OpenCL));
> +#endif
> +  c.getFrontendOpts().ProgramAction = clang::frontend::EmitLLVMOnly;
> +  c.getHeaderSearchOpts().UseBuiltinIncludes = true;
> +#if HAVE_LLVM < 0x0300
> +  c.getHeaderSearchOpts().UseStandardIncludes = true;
> +#else
> +  c.getHeaderSearchOpts().UseStandardSystemIncludes = true;
> +#endif
> +  c.getHeaderSearchOpts().ResourceDir = CLANG_RESOURCE_DIR;
> +
> +  /* Add libclc generic search path */
> +  c.getHeaderSearchOpts().AddPath(LIBCLC_PATH "/generic/include/",
> +  clang::frontend::Angled,
> +  false, false, false);
> +
> +  /* Add libclc target specific search path */
> +  c.getHeaderSearchOpts().AddPath(LIBCLC_PATH + target + "/include/",
> +  clang::frontend::Angled,
> +  false, false, false);
> +
> +  /* Add libclc include */
> +  c.getPreprocessorOpts().Includes.push_back("clc/clc.h");
> +  /* clc.h requires that this macro be defined: */
> +  
> c.getPreprocessorOpts().addMacroDef("cl_clang_storage_class_specifiers");
> +
> +  c.getLangOpts().NoBuiltin = true;
> +  c.getTargetOpts().Triple = target_triple;
> +  c.getInvocation().setLangDefaults(clang::IK_OpenCL);
> +  c.createDiagnostics(0, NULL, new clang::TextDiagnosticPrinter(
> + s_log, c.getDiagnosticOpts()));
> +
> +  c.getPreprocessorOpts().addRemappedFile(
> + "cl_input", llvm::MemoryBuffer::getMemBuffer(source));
> +
> +  /* Compile the code */
> +  if (!c.ExecuteAction(act))
> + throw build_error(log);
> +
> +  /* Link the kernel with libclc */
> +  llvm::PassManager PM;
> +  llvm::PassManagerBuilder Builder;
> +  bool isNative;
> +  llvm::Module * mod = act.takeModule();
> +  llvm::Linker linker("clover", mod);
> +
> +  linker.LinkInFile(llvm::sys::Path(LIBCLC_PATH + target_triple + 
> "/lib/builtins.bc"), isNative);
> +  mod = linker.releaseModule();
> +
> +  /* Run link time optimizations */
> +  Builder.populateLTOPassManager(PM, false, true);
> +  Builder.OptLevel = 2;
> +  PM.run(*mod);
> +
> +  /* Build the clover::module */
> +  unsigned char * prog;
> +  uint32_t prog_sz;
> +
> +#if HAVE_LLVM > 0x0300
> +  llvm::SmallVector llvm_bitcode;
> +  llvm::raw_svector_ostream bitcode_ostream(llvm_bitcode);
> +#else
> +  std::vector llvm_bitcode;
> +#endif
> +  llvm::BitstreamWriter writer(llvm_bitcode);
> +
> +#if HAVE_LLVM <= 0x0300
> +  llvm::WriteBitcodeToStream(mod, writer);
> +#else
> +  llvm::WriteBitcodeToFile(mod, bitcode_ostream);
> +  bitcode_ostream.flush();
> +#endif
> +
> +  prog_sz = llvm_bitcode.size() * sizeof(unsigned char);
> +
> +  /* We need to add 4 to the program size, because we will
> +   * be preprending the length of the program to the bitcode string. */
> +  prog = (unsigned char *)MALLOC(prog_sz + 4);
> +  ((uint32_t *)prog)[0] = prog_sz;
> +  memcpy(prog + 4, &llvm_bitcode[0], prog_sz);
> +
> +  std::string kernel_

Re: [Mesa-dev] [PATCH 10/11] clover: Add function for building a clover::module for non-TGSI targets

2012-05-12 Thread Tom Stellard
On Sun, May 13, 2012 at 12:40:43AM +0200, Francisco Jerez wrote:
> Tom Stellard  writes:
> 
> > ---
> >  .../state_trackers/clover/llvm/invocation.cpp  |  174 
> > +++-
> >  1 files changed, 165 insertions(+), 9 deletions(-)
> >
> > diff --git a/src/gallium/state_trackers/clover/llvm/invocation.cpp 
> > b/src/gallium/state_trackers/clover/llvm/invocation.cpp
> > index 89e21bf..b31fddc 100644
> > --- a/src/gallium/state_trackers/clover/llvm/invocation.cpp
> > +++ b/src/gallium/state_trackers/clover/llvm/invocation.cpp
> > @@ -22,24 +22,33 @@
> >  
> >  #include "core/compiler.hpp"
> >  
> > -#if 0
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> >  #include 
> > +#include 
> > +#include 
> >  #include 
> >  #include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +#include "util/u_memory.h"
> >  
> >  #include 
> >  #include 
> >  #include 
> >  #include 
> > -#endif
> >  
> >  using namespace clover;
> >  
> > -#if 0
> >  namespace {
> > +#if 0
> > void
> > build_binary(const std::string &source, const std::string &target,
> >  const std::string &name) {
> > @@ -78,17 +87,164 @@ namespace {
> >compat::istream cs(str);
> >return module::deserialize(cs);
> > }
> > -}
> >  #endif
> > +   module
> > +   build_module_llvm(const std::string &source, const std::string &target,
> > + const std::string &name) {
> > +
> > +  /* Compile the kernel */
> > +  clang::CompilerInstance c;
> > +  module m;
> > +  clang::EmitLLVMOnlyAction act(&llvm::getGlobalContext());
> > +  std::string log;
> > +  std::string target_triple = target + "--";
> > +  llvm::raw_string_ostream s_log(log);
> > +
> > +#if HAVE_LLVM <= 0x0300
> > +  c.getFrontendOpts().Inputs.push_back(
> > + std::make_pair(clang::IK_OpenCL, "cl_input"));
> > +#else
> > +  c.getFrontendOpts().Inputs.push_back(
> > + clang::FrontendInputFile("cl_input", clang::IK_OpenCL));
> > +#endif
> > +  c.getFrontendOpts().ProgramAction = clang::frontend::EmitLLVMOnly;
> > +  c.getHeaderSearchOpts().UseBuiltinIncludes = true;
> > +#if HAVE_LLVM < 0x0300
> > +  c.getHeaderSearchOpts().UseStandardIncludes = true;
> > +#else
> > +  c.getHeaderSearchOpts().UseStandardSystemIncludes = true;
> > +#endif
> > +  c.getHeaderSearchOpts().ResourceDir = CLANG_RESOURCE_DIR;
> > +
> > +  /* Add libclc generic search path */
> > +  c.getHeaderSearchOpts().AddPath(LIBCLC_PATH "/generic/include/",
> > +  clang::frontend::Angled,
> > +  false, false, false);
> > +
> > +  /* Add libclc target specific search path */
> > +  c.getHeaderSearchOpts().AddPath(LIBCLC_PATH + target + "/include/",
> > +  clang::frontend::Angled,
> > +  false, false, false);
> > +
> > +  /* Add libclc include */
> > +  c.getPreprocessorOpts().Includes.push_back("clc/clc.h");
> > +  /* clc.h requires that this macro be defined: */
> > +  
> > c.getPreprocessorOpts().addMacroDef("cl_clang_storage_class_specifiers");
> > +
> > +  c.getLangOpts().NoBuiltin = true;
> > +  c.getTargetOpts().Triple = target_triple;
> > +  c.getInvocation().setLangDefaults(clang::IK_OpenCL);
> > +  c.createDiagnostics(0, NULL, new clang::TextDiagnosticPrinter(
> > + s_log, c.getDiagnosticOpts()));
> > +
> > +  c.getPreprocessorOpts().addRemappedFile(
> > + "cl_input", llvm::MemoryBuffer::getMemBuffer(source));
> > +
> > +  /* Compile the code */
> > +  if (!c.ExecuteAction(act))
> > + throw build_error(log);
> > +
> > +  /* Link the kernel with libclc */
> > +  llvm::PassManager PM;
> > +  llvm::PassManagerBuilder Builder;
> > +  bool isNative;
> > +  llvm::Module * mod = act.takeModule();
> > +  llvm::Linker linker("clover", mod);
> > +
> > +  linker.LinkInFile(llvm::sys::Path(LIBCLC_PATH + target_triple + 
> > "/lib/builtins.bc"), isNative);
> > +  mod = linker.releaseModule();
> > +
> > +  /* Run link time optimizations */
> > +  Builder.populateLTOPassManager(PM, false, true);
> > +  Builder.OptLevel = 2;
> > +  PM.run(*mod);
> > +
> > +  /* Build the clover::module */
> > +  unsigned char * prog;
> > +  uint32_t prog_sz;
> > +
> > +#if HAVE_LLVM > 0x0300
> > +  llvm::SmallVector llvm_bitcode;
> > +  llvm::raw_svector_ostream bitcode_ostream(llvm_bitcode);
> > +#else
> > +  std::vector llvm_bitcode;
> > +#endif
> > +  llvm::BitstreamWriter writer(llvm_bitcode);
> > +
> > +#if HAVE_LLVM <= 0x0300
> > +  llvm::WriteBitcodeToStream(mod, writer);
> > +#else
> > +  llvm::WriteBitcodeToFile(mod, bitcode_ostream);
> > +  bitcode_ostream.flush();
> > +#endif
> > +
> > +  prog_sz = llvm_bitcode.si

[Mesa-dev] [Bug 49717] SCons build error with clang

2012-05-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=49717

--- Comment #4 from Vinson Lee  2012-05-12 22:38:20 PDT 
---
(In reply to comment #3)
> I suspect so. Is $CXX set to clang++?

Yes, $CXX is set to clang++.

SCons build with clang also fails at the same place on Mac OS X.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev