[Mesa-dev] [PATCH] i965: Enable EWA anisotropic filtering algorithm

2014-03-04 Thread Ian Romanick
From: Ian Romanick 

Volume 4, part 1 of the Ivybridge PRM says, "Generally, the EWA
approximation algorithm results in higher image quality than the legacy
algorithm."  Using a classic anisotropic filtering "tunnel" demo, it
appears that there is *no* anisotropic filtering on IVB without this bit
set.

Signed-off-by: Ian Romanick 
Cc: Eero Tamminen 
---
 src/mesa/drivers/dri/i965/gen7_sampler_state.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/mesa/drivers/dri/i965/gen7_sampler_state.c 
b/src/mesa/drivers/dri/i965/gen7_sampler_state.c
index 968c410..709a783 100644
--- a/src/mesa/drivers/dri/i965/gen7_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_sampler_state.c
@@ -82,6 +82,7 @@ gen7_update_sampler_state(struct brw_context *brw, int unit, 
int ss_index,
if (gl_sampler->MaxAnisotropy > 1.0) {
   sampler->ss0.min_filter = BRW_MAPFILTER_ANISOTROPIC;
   sampler->ss0.mag_filter = BRW_MAPFILTER_ANISOTROPIC;
+  sampler->ss0.aniso_algorithm = 1;
 
   if (gl_sampler->MaxAnisotropy > 2.0) {
 sampler->ss3.max_aniso = MIN2((gl_sampler->MaxAnisotropy - 2) / 2,
-- 
1.8.1.4

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


[Mesa-dev] [Bug 75543] OSMesa Gallium OSMesaMakeCurrent

2014-03-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=75543

nacho...@gmail.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #3 from nacho...@gmail.com ---
Verified, that's working. 

Thanks!

-- 
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


Re: [Mesa-dev] [PATCH 1/2] mesa: fix the format of glEdgeFlagPointer

2014-03-04 Thread Marek Olšák
On Tue, Mar 4, 2014 at 8:05 AM, Ian Romanick  wrote:
> On 03/03/2014 03:25 AM, Marek Olšák wrote:
>>
>> From: Marek Olšák 
>>
>> Softpipe expects a float in the vertex shader, which is what glEdgeFlag
>> generates.
>>
>> This fixes piglit/gl-2.0-edgeflag.
>
>
> I think this may be a problem elsewhere inside softpipe.  This test passes
> with or without this patch on i965.  It was also previously passing on i915
> and r200.  I don't have that hardware with me right now, so I can't test it
> with the patch.  Does this test fail on Gallium hardware drivers?

As far as I know, the test fails on all Gallium drivers. It couldn't
have passed on r200, because it doesn't support GL 2.0. The type
cannot be integer, because the immediate mode function glEdgeFlag
emits a float, so if an edge flag array works on i965, glEdgeFlag must
be broken. I'm just following what glEdgeFlag does. Drivers can emit a
float-to-int conversion in the shader like r600g and radeonsi already
do to make glEdgeFlag work.

> The "integer" column was added in OpenGL 3.0 (though the old comment says
> GL_EXT_gpu_shader4), so maybe this setting should be conditional with the GL
> version?

A float-to-int conversion in the shader solves this.

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


[Mesa-dev] [PATCH 1/2] radeonsi: fix blit compressed texture workaround to support 2D arrays

2014-03-04 Thread Marek Olšák
From: Marek Olšák 

We don't have a piglit test for this, but I think it's correct.
---
 src/gallium/drivers/radeonsi/si_state.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/si_state.c 
b/src/gallium/drivers/radeonsi/si_state.c
index 5591fb1..79c7096 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -2593,7 +2593,8 @@ static struct pipe_sampler_view 
*si_create_sampler_view(struct pipe_context *ctx
 
va = r600_resource_va(ctx->screen, texture);
va += surflevel[0].offset;
-   va += tmp->mipmap_shift * surflevel[texture->last_level].slice_size;
+   va += tmp->mipmap_shift * surflevel[texture->last_level].slice_size * 
tmp->surface.array_size;
+
view->state[0] = va >> 8;
view->state[1] = (S_008F14_BASE_ADDRESS_HI(va >> 40) |
  S_008F14_DATA_FORMAT(format) |
-- 
1.8.3.2

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


[Mesa-dev] [PATCH 2/2] r600g: fix blitting the last 2 mipmap levels for Evergreen

2014-03-04 Thread Marek Olšák
From: Marek Olšák 

This fixes a lot of compressedteximage piglit tests.

R600-R700 don't have this issue.

Cc: mesa-sta...@lists.freedesktop.org
---
 src/gallium/drivers/r600/evergreen_state.c | 40 ++
 src/gallium/drivers/r600/r600_blit.c   |  6 -
 src/gallium/drivers/r600/r600_pipe.h   |  3 ++-
 3 files changed, 36 insertions(+), 13 deletions(-)

diff --git a/src/gallium/drivers/r600/evergreen_state.c 
b/src/gallium/drivers/r600/evergreen_state.c
index 1cabf19..d4900e6 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -644,7 +644,8 @@ struct pipe_sampler_view *
 evergreen_create_sampler_view_custom(struct pipe_context *ctx,
 struct pipe_resource *texture,
 const struct pipe_sampler_view *state,
-unsigned width0, unsigned height0)
+unsigned width0, unsigned height0,
+unsigned force_level)
 {
struct r600_screen *rscreen = (struct r600_screen*)ctx->screen;
struct r600_pipe_sampler_view *view = 
CALLOC_STRUCT(r600_pipe_sampler_view);
@@ -656,6 +657,8 @@ evergreen_create_sampler_view_custom(struct pipe_context 
*ctx,
unsigned macro_aspect, tile_split, bankh, bankw, nbanks, fmask_bankh;
enum pipe_format pipe_format = state->format;
struct radeon_surface_level *surflevel;
+   unsigned base_level, first_level, last_level;
+   uint64_t va;
 
if (view == NULL)
return NULL;
@@ -712,13 +715,26 @@ evergreen_create_sampler_view_custom(struct pipe_context 
*ctx,
 
endian = r600_colorformat_endian_swap(format);
 
+   base_level = 0;
+   first_level = state->u.tex.first_level;
+   last_level = state->u.tex.last_level;
width = width0;
height = height0;
depth = texture->depth0;
-   pitch = surflevel[0].nblk_x * util_format_get_blockwidth(pipe_format);
+
+   if (force_level) {
+   base_level = force_level;
+   first_level = 0;
+   last_level = 0;
+   width = u_minify(width, force_level);
+   height = u_minify(height, force_level);
+   depth = u_minify(depth, force_level);
+   }
+
+   pitch = surflevel[base_level].nblk_x * 
util_format_get_blockwidth(pipe_format);
non_disp_tiling = tmp->non_disp_tiling;
 
-   switch (surflevel[0].mode) {
+   switch (surflevel[base_level].mode) {
case RADEON_SURF_MODE_LINEAR_ALIGNED:
array_mode = V_028C70_ARRAY_LINEAR_ALIGNED;
break;
@@ -757,6 +773,8 @@ evergreen_create_sampler_view_custom(struct pipe_context 
*ctx,
} else if (texture->target == PIPE_TEXTURE_CUBE_ARRAY)
depth = texture->array_size / 6;
 
+   va = r600_resource_va(ctx->screen, texture);
+
view->tex_resource = &tmp->resource;
view->tex_resource_words[0] = 
(S_03_DIM(r600_tex_dim(texture->target, texture->nr_samples)) |
   S_03_PITCH((pitch / 8) - 1) |
@@ -768,7 +786,7 @@ evergreen_create_sampler_view_custom(struct pipe_context 
*ctx,
view->tex_resource_words[1] = (S_030004_TEX_HEIGHT(height - 1) |
   S_030004_TEX_DEPTH(depth - 1) |
   S_030004_ARRAY_MODE(array_mode));
-   view->tex_resource_words[2] = (surflevel[0].offset + 
r600_resource_va(ctx->screen, texture)) >> 8;
+   view->tex_resource_words[2] = (surflevel[base_level].offset + va) >> 8;
 
/* TEX_RESOURCE_WORD3.MIP_ADDRESS */
if (texture->nr_samples > 1 && rscreen->has_compressed_msaa_texturing) {
@@ -778,12 +796,12 @@ evergreen_create_sampler_view_custom(struct pipe_context 
*ctx,
view->skip_mip_address_reloc = true;
} else {
/* FMASK should be in MIP_ADDRESS for multisample 
textures */
-   view->tex_resource_words[3] = (tmp->fmask.offset + 
r600_resource_va(ctx->screen, texture)) >> 8;
+   view->tex_resource_words[3] = (tmp->fmask.offset + va) 
>> 8;
}
-   } else if (state->u.tex.last_level && texture->nr_samples <= 1) {
-   view->tex_resource_words[3] = (surflevel[1].offset + 
r600_resource_va(ctx->screen, texture)) >> 8;
+   } else if (last_level && texture->nr_samples <= 1) {
+   view->tex_resource_words[3] = (surflevel[1].offset + va) >> 8;
} else {
-   view->tex_resource_words[3] = (surflevel[0].offset + 
r600_resource_va(ctx->screen, texture)) >> 8;
+   view->tex_resource_words[3] = (surflevel[base_level].offset + 
va) >> 8;
}
 
view->tex_resource_words[4] = (word4 |
@@ -802,8 +820,8 @@ evergreen_create_sampler_view_custom(struct pipe_context 
*ctx,

[Mesa-dev] [PATCH] mesa: fix glGet size queries for L/LA/I color buffers

2014-03-04 Thread Marek Olšák
From: Marek Olšák 

There is no API for returning the number of luminance and intensity bits and
the 3.3 spec doesn't seem to specify any behavior for the queries if the format
is one of L, LA, I. It seems to be a spec bug.

This helps to fix piglit tests that rely on the number of color bits to be
non-zero, for example:
  spec/EXT_texture_integer/multisample-formats  GL_EXT_texture_integer
---
 src/mesa/main/formats.c   | 24 ++---
 src/mesa/main/glformats.c | 53 ---
 2 files changed, 62 insertions(+), 15 deletions(-)

diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
index f6c399e..8f847cb 100644
--- a/src/mesa/main/formats.c
+++ b/src/mesa/main/formats.c
@@ -1842,25 +1842,34 @@ _mesa_get_format_bits(mesa_format format, GLenum pname)
const struct gl_format_info *info = _mesa_get_format_info(format);
 
switch (pname) {
+   /* color buffer enums */
case GL_RED_BITS:
-   case GL_TEXTURE_RED_SIZE:
case GL_RENDERBUFFER_RED_SIZE_EXT:
case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE:
-  return info->RedBits;
+  return info->IntensityBits ? info->IntensityBits :
+ info->LuminanceBits ? info->LuminanceBits : info->RedBits;
case GL_GREEN_BITS:
-   case GL_TEXTURE_GREEN_SIZE:
case GL_RENDERBUFFER_GREEN_SIZE_EXT:
case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:
-  return info->GreenBits;
+  return info->IntensityBits ? info->IntensityBits :
+ info->LuminanceBits ? info->LuminanceBits : info->GreenBits;
case GL_BLUE_BITS:
-   case GL_TEXTURE_BLUE_SIZE:
case GL_RENDERBUFFER_BLUE_SIZE_EXT:
case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:
-  return info->BlueBits;
+  return info->IntensityBits ? info->IntensityBits :
+ info->LuminanceBits ? info->LuminanceBits : info->BlueBits;
case GL_ALPHA_BITS:
-   case GL_TEXTURE_ALPHA_SIZE:
case GL_RENDERBUFFER_ALPHA_SIZE_EXT:
case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:
+  return info->IntensityBits ? info->IntensityBits : info->AlphaBits;
+   /* texture enums */
+   case GL_TEXTURE_RED_SIZE:
+  return info->RedBits;
+   case GL_TEXTURE_GREEN_SIZE:
+  return info->GreenBits;
+   case GL_TEXTURE_BLUE_SIZE:
+  return info->BlueBits;
+   case GL_TEXTURE_ALPHA_SIZE:
   return info->AlphaBits;
case GL_TEXTURE_INTENSITY_SIZE:
   return info->IntensityBits;
@@ -1868,6 +1877,7 @@ _mesa_get_format_bits(mesa_format format, GLenum pname)
   return info->LuminanceBits;
case GL_INDEX_BITS:
   return info->IndexBits;
+   /* depth/stencil enums */
case GL_DEPTH_BITS:
case GL_TEXTURE_DEPTH_SIZE_ARB:
case GL_RENDERBUFFER_DEPTH_SIZE_EXT:
diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index 77cf263..71064ed 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -984,11 +984,53 @@ GLboolean
 _mesa_base_format_has_channel(GLenum base_format, GLenum pname)
 {
switch (pname) {
-   case GL_TEXTURE_RED_SIZE:
-   case GL_TEXTURE_RED_TYPE:
+   /* color buffer enums */
case GL_RENDERBUFFER_RED_SIZE_EXT:
case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE:
   if (base_format == GL_RED ||
+  base_format == GL_RG ||
+  base_format == GL_RGB ||
+  base_format == GL_RGBA ||
+  base_format == GL_LUMINANCE ||
+  base_format == GL_LUMINANCE_ALPHA ||
+  base_format == GL_INTENSITY) {
+ return GL_TRUE;
+  }
+  return GL_FALSE;
+   case GL_RENDERBUFFER_GREEN_SIZE_EXT:
+   case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:
+  if (base_format == GL_RG ||
+  base_format == GL_RGB ||
+  base_format == GL_RGBA ||
+  base_format == GL_LUMINANCE ||
+  base_format == GL_LUMINANCE_ALPHA ||
+  base_format == GL_INTENSITY) {
+ return GL_TRUE;
+  }
+  return GL_FALSE;
+   case GL_RENDERBUFFER_BLUE_SIZE_EXT:
+   case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:
+  if (base_format == GL_RGB ||
+  base_format == GL_RGBA ||
+  base_format == GL_LUMINANCE ||
+  base_format == GL_LUMINANCE_ALPHA ||
+  base_format == GL_INTENSITY) {
+ return GL_TRUE;
+  }
+  return GL_FALSE;
+   case GL_RENDERBUFFER_ALPHA_SIZE_EXT:
+   case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:
+  if (base_format == GL_RGBA ||
+  base_format == GL_ALPHA ||
+  base_format == GL_LUMINANCE_ALPHA ||
+  base_format == GL_INTENSITY) {
+ return GL_TRUE;
+  }
+  return GL_FALSE;
+   /* texture enums */
+   case GL_TEXTURE_RED_SIZE:
+   case GL_TEXTURE_RED_TYPE:
+  if (base_format == GL_RED ||
  base_format == GL_RG ||
  base_format == GL_RGB ||
  base_format == GL_RGBA) {
@@ -997,8 +1039,6 @@ _mesa_base_format_has_channel(GLenum base_format, GLenum 
pname)
   return GL_FALSE;
case GL_TEXTURE_GREEN_SIZE:
case GL_TEXTURE_GREEN_TYPE:
-   case GL_RENDERBUFFER_GREEN_SIZE_EXT:
-   case GL_FR

[Mesa-dev] [PATCH 2/3] st/mesa: implement zero-stride edge flag by culling primitives

2014-03-04 Thread Marek Olšák
From: Marek Olšák 

This was unimplemented.
---
 src/mesa/state_tracker/st_atom.c| 9 -
 src/mesa/state_tracker/st_atom_rasterizer.c | 8 
 src/mesa/state_tracker/st_context.h | 1 +
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c
index 378254d..00149f8 100644
--- a/src/mesa/state_tracker/st_atom.c
+++ b/src/mesa/state_tracker/st_atom.c
@@ -132,7 +132,7 @@ static void check_program_state( struct st_context *st )
 static void check_attrib_edgeflag(struct st_context *st)
 {
const struct gl_client_array **arrays = st->ctx->Array._DrawArrays;
-   GLboolean vertdata_edgeflags;
+   GLboolean vertdata_edgeflags, edgeflag_culls_prims;
 
if (!arrays)
   return;
@@ -142,6 +142,13 @@ static void check_attrib_edgeflag(struct st_context *st)
   st->vertdata_edgeflags = vertdata_edgeflags;
   st->dirty.st |= ST_NEW_EDGEFLAGS_DATA;
}
+
+   edgeflag_culls_prims = !vertdata_edgeflags &&
+  !st->ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0];
+   if (edgeflag_culls_prims != st->edgeflag_culls_prims) {
+  st->edgeflag_culls_prims = edgeflag_culls_prims;
+  st->dirty.st |= ST_NEW_RASTERIZER;
+   }
 }
 
 
diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c 
b/src/mesa/state_tracker/st_atom_rasterizer.c
index a4f3ffe..ee5e9e5 100644
--- a/src/mesa/state_tracker/st_atom_rasterizer.c
+++ b/src/mesa/state_tracker/st_atom_rasterizer.c
@@ -236,6 +236,14 @@ static void update_raster_state( struct st_context *st )
/* ST_NEW_RASTERIZER */
raster->rasterizer_discard = ctx->RasterDiscard;
 
+   if (st->edgeflag_culls_prims) {
+  /* All edge flags are FALSE. Cull the affected faces. */
+  if (raster->fill_front != PIPE_POLYGON_MODE_FILL)
+ raster->cull_face |= PIPE_FACE_FRONT;
+  if (raster->fill_back != PIPE_POLYGON_MODE_FILL)
+ raster->cull_face |= PIPE_FACE_BACK;
+   }
+
/* _NEW_TRANSFORM */
raster->depth_clip = ctx->Transform.DepthClamp == GL_FALSE;
raster->clip_plane_enable = ctx->Transform.ClipPlanesEnabled;
diff --git a/src/mesa/state_tracker/st_context.h 
b/src/mesa/state_tracker/st_context.h
index 9c699a0..2957b37 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -131,6 +131,7 @@ struct st_context
 
GLboolean missing_textures;
GLboolean vertdata_edgeflags;
+   GLboolean edgeflag_culls_prims;
 
/** Mapping from VARYING_SLOT_x to post-transformed vertex slot */
const GLuint *vertex_result_to_slot;
-- 
1.8.3.2

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


[Mesa-dev] [PATCH 1/3] st/mesa: fix per-vertex edge flags and GLSL support (v2)

2014-03-04 Thread Marek Olšák
From: Marek Olšák 

This fixes piglit/gl-2.0-edgeflag.

v2: use StrideB to recognize per-vertex edge flags

Cc: mesa-sta...@lists.freedesktop.org
---
 src/mesa/state_tracker/st_atom.c| 9 -
 src/mesa/state_tracker/st_program.c | 4 ++--
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c
index 32ce1ea..378254d 100644
--- a/src/mesa/state_tracker/st_atom.c
+++ b/src/mesa/state_tracker/st_atom.c
@@ -132,15 +132,14 @@ static void check_program_state( struct st_context *st )
 static void check_attrib_edgeflag(struct st_context *st)
 {
const struct gl_client_array **arrays = st->ctx->Array._DrawArrays;
-   GLboolean vertDataEdgeFlags;
+   GLboolean vertdata_edgeflags;
 
if (!arrays)
   return;
 
-   vertDataEdgeFlags = arrays[VERT_ATTRIB_EDGEFLAG]->BufferObj &&
-   arrays[VERT_ATTRIB_EDGEFLAG]->BufferObj->Name;
-   if (vertDataEdgeFlags != st->vertdata_edgeflags) {
-  st->vertdata_edgeflags = vertDataEdgeFlags;
+   vertdata_edgeflags = arrays[VERT_ATTRIB_EDGEFLAG]->StrideB != 0;
+   if (vertdata_edgeflags != st->vertdata_edgeflags) {
+  st->vertdata_edgeflags = vertdata_edgeflags;
   st->dirty.st |= ST_NEW_EDGEFLAGS_DATA;
}
 }
diff --git a/src/mesa/state_tracker/st_program.c 
b/src/mesa/state_tracker/st_program.c
index e9074ac..692a570 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -342,14 +342,14 @@ st_translate_vertex_program(struct st_context *st,
stvp->glsl_to_tgsi,
&stvp->Base.Base,
/* inputs */
-   stvp->num_inputs,
+   vpv->num_inputs,
stvp->input_to_index,
NULL, /* input semantic name */
NULL, /* input semantic index */
NULL, /* interp mode */
NULL, /* is centroid */
/* outputs */
-   stvp->num_outputs,
+   num_outputs,
stvp->result_to_output,
stvp->output_semantic_name,
stvp->output_semantic_index,
-- 
1.8.3.2

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


[Mesa-dev] [PATCH 3/3] st/mesa: remove _NEW_POLYGON dependency from vertex shader

2014-03-04 Thread Marek Olšák
From: Marek Olšák 

We can just check the polygon mode when updating the edge flag state.
Also, we can just flag ST_NEW_VERTEX_PROGRAM directly, which makes
ST_NEW_EDGEFLAGS_DATA useless.
---
 src/mesa/state_tracker/st_atom.c| 12 
 src/mesa/state_tracker/st_atom_shader.c |  9 +++--
 src/mesa/state_tracker/st_context.h |  2 +-
 3 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c
index 00149f8..99e9df2 100644
--- a/src/mesa/state_tracker/st_atom.c
+++ b/src/mesa/state_tracker/st_atom.c
@@ -132,18 +132,22 @@ static void check_program_state( struct st_context *st )
 static void check_attrib_edgeflag(struct st_context *st)
 {
const struct gl_client_array **arrays = st->ctx->Array._DrawArrays;
-   GLboolean vertdata_edgeflags, edgeflag_culls_prims;
+   GLboolean vertdata_edgeflags, edgeflag_culls_prims, edgeflags_enabled;
 
if (!arrays)
   return;
 
-   vertdata_edgeflags = arrays[VERT_ATTRIB_EDGEFLAG]->StrideB != 0;
+   edgeflags_enabled = st->ctx->Polygon.FrontMode != GL_FILL ||
+   st->ctx->Polygon.BackMode != GL_FILL;
+
+   vertdata_edgeflags = edgeflags_enabled &&
+arrays[VERT_ATTRIB_EDGEFLAG]->StrideB != 0;
if (vertdata_edgeflags != st->vertdata_edgeflags) {
   st->vertdata_edgeflags = vertdata_edgeflags;
-  st->dirty.st |= ST_NEW_EDGEFLAGS_DATA;
+  st->dirty.st |= ST_NEW_VERTEX_PROGRAM;
}
 
-   edgeflag_culls_prims = !vertdata_edgeflags &&
+   edgeflag_culls_prims = edgeflags_enabled && !vertdata_edgeflags &&
   !st->ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0];
if (edgeflag_culls_prims != st->edgeflag_culls_prims) {
   st->edgeflag_culls_prims = edgeflag_culls_prims;
diff --git a/src/mesa/state_tracker/st_atom_shader.c 
b/src/mesa/state_tracker/st_atom_shader.c
index ba04c1f..67c6157 100644
--- a/src/mesa/state_tracker/st_atom_shader.c
+++ b/src/mesa/state_tracker/st_atom_shader.c
@@ -141,11 +141,8 @@ update_vp( struct st_context *st )
 * edgeflag semantics, and extend the vertex shader to pass through
 * the input to the output.  We'll need to use similar logic to set
 * up the extra vertex_element input for edgeflags.
-* _NEW_POLYGON, ST_NEW_EDGEFLAGS_DATA
 */
-   key.passthrough_edgeflags = (st->vertdata_edgeflags && (
-st->ctx->Polygon.FrontMode != GL_FILL ||
-st->ctx->Polygon.BackMode != GL_FILL));
+   key.passthrough_edgeflags = st->vertdata_edgeflags;
 
key.clamp_color = st->clamp_vert_color_in_shader &&
  st->ctx->Light._ClampVertexColor;
@@ -164,8 +161,8 @@ update_vp( struct st_context *st )
 const struct st_tracked_state st_update_vp = {
"st_update_vp", /* name */
{   /* dirty */
-  _NEW_POLYGON,/* mesa */
-  ST_NEW_VERTEX_PROGRAM | ST_NEW_EDGEFLAGS_DATA/* st */
+  0,/* mesa */
+  ST_NEW_VERTEX_PROGRAM /* st */
},
update_vp   /* update */
 };
diff --git a/src/mesa/state_tracker/st_context.h 
b/src/mesa/state_tracker/st_context.h
index 2957b37..0e00dd4 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -47,7 +47,7 @@ struct u_upload_mgr;
 #define ST_NEW_FRAGMENT_PROGRAM(1 << 1)
 #define ST_NEW_VERTEX_PROGRAM  (1 << 2)
 #define ST_NEW_FRAMEBUFFER (1 << 3)
-#define ST_NEW_EDGEFLAGS_DATA  (1 << 4)
+/* gap, re-use it */
 #define ST_NEW_GEOMETRY_PROGRAM(1 << 5)
 #define ST_NEW_VERTEX_ARRAYS   (1 << 6)
 #define ST_NEW_RASTERIZER  (1 << 7)
-- 
1.8.3.2

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


[Mesa-dev] [PATCH] gallium: rename R4A4 and A4R4 formats to match their swizzle

2014-03-04 Thread Marek Olšák
From: Marek Olšák 

Like L4A4.
---
 src/gallium/auxiliary/util/u_format.csv  | 4 ++--
 src/gallium/auxiliary/util/u_format.h| 3 +--
 src/gallium/drivers/ilo/ilo_format.c | 2 +-
 src/gallium/include/pipe/p_format.h  | 4 ++--
 src/gallium/state_trackers/vdpau/vdpau_private.h | 4 ++--
 src/gallium/state_trackers/xvmc/subpicture.c | 6 +++---
 6 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_format.csv 
b/src/gallium/auxiliary/util/u_format.csv
index 8d04b00..8fb068b 100644
--- a/src/gallium/auxiliary/util/u_format.csv
+++ b/src/gallium/auxiliary/util/u_format.csv
@@ -272,8 +272,8 @@ PIPE_FORMAT_NV12  , other, 1, 1, x8  , x8  
, x8  , x8  , xyzw, y
 PIPE_FORMAT_NV21  , other, 1, 1, x8  , x8  , x8  , x8  , xyzw, 
yuv
 
 # Usually used to implement IA44 and AI44 formats in video decoding
-PIPE_FORMAT_R4A4_UNORM, plain, 1, 1, un4 , un4 , , , y00x, 
rgb
-PIPE_FORMAT_A4R4_UNORM, plain, 1, 1, un4 , un4 , , , x00y, 
rgb
+PIPE_FORMAT_A4R4_UNORM, plain, 1, 1, un4 , un4 , , , y00x, 
rgb
+PIPE_FORMAT_R4A4_UNORM, plain, 1, 1, un4 , un4 , , , x00y, 
rgb
 PIPE_FORMAT_R8A8_UNORM, plain, 1, 1, un8 , un8 , , , x00y, 
rgb
 PIPE_FORMAT_A8R8_UNORM, plain, 1, 1, un8 , un8 , , , y00x, 
rgb
 
diff --git a/src/gallium/auxiliary/util/u_format.h 
b/src/gallium/auxiliary/util/u_format.h
index e36a9e2..747e142 100644
--- a/src/gallium/auxiliary/util/u_format.h
+++ b/src/gallium/auxiliary/util/u_format.h
@@ -1060,8 +1060,7 @@ util_format_luminance_to_red(enum pipe_format format)
   return PIPE_FORMAT_RGTC1_SNORM;
 
case PIPE_FORMAT_L4A4_UNORM:
-  /* XXX A4R4 is defined as x00y in u_format.csv */
-  return PIPE_FORMAT_A4R4_UNORM;
+  return PIPE_FORMAT_R4A4_UNORM;
 
case PIPE_FORMAT_L8A8_UNORM:
   return PIPE_FORMAT_R8A8_UNORM;
diff --git a/src/gallium/drivers/ilo/ilo_format.c 
b/src/gallium/drivers/ilo/ilo_format.c
index 72575f4..30e4958 100644
--- a/src/gallium/drivers/ilo/ilo_format.c
+++ b/src/gallium/drivers/ilo/ilo_format.c
@@ -504,8 +504,8 @@ ilo_translate_color_format(enum pipe_format format)
   [PIPE_FORMAT_IYUV]  = 0,
   [PIPE_FORMAT_NV12]  = 0,
   [PIPE_FORMAT_NV21]  = 0,
-  [PIPE_FORMAT_R4A4_UNORM]= 0,
   [PIPE_FORMAT_A4R4_UNORM]= 0,
+  [PIPE_FORMAT_R4A4_UNORM]= 0,
   [PIPE_FORMAT_R8A8_UNORM]= 0,
   [PIPE_FORMAT_A8R8_UNORM]= 0,
   [PIPE_FORMAT_R10G10B10A2_SSCALED]   = 
BRW_SURFACEFORMAT_R10G10B10A2_SSCALED,
diff --git a/src/gallium/include/pipe/p_format.h 
b/src/gallium/include/pipe/p_format.h
index daa3be2..34ab662 100644
--- a/src/gallium/include/pipe/p_format.h
+++ b/src/gallium/include/pipe/p_format.h
@@ -236,8 +236,8 @@ enum pipe_format {
PIPE_FORMAT_NV12= 166,
PIPE_FORMAT_NV21= 167,
 
-   PIPE_FORMAT_R4A4_UNORM  = 168,
-   PIPE_FORMAT_A4R4_UNORM  = 169,
+   PIPE_FORMAT_A4R4_UNORM  = 168,
+   PIPE_FORMAT_R4A4_UNORM  = 169,
PIPE_FORMAT_R8A8_UNORM  = 170,
PIPE_FORMAT_A8R8_UNORM  = 171,
 
diff --git a/src/gallium/state_trackers/vdpau/vdpau_private.h 
b/src/gallium/state_trackers/vdpau/vdpau_private.h
index 078f0f9..ce6852b 100644
--- a/src/gallium/state_trackers/vdpau/vdpau_private.h
+++ b/src/gallium/state_trackers/vdpau/vdpau_private.h
@@ -209,9 +209,9 @@ FormatIndexedToPipe(VdpRGBAFormat vdpau_format)
 {
switch (vdpau_format) {
   case VDP_INDEXED_FORMAT_A4I4:
- return PIPE_FORMAT_A4R4_UNORM;
-  case VDP_INDEXED_FORMAT_I4A4:
  return PIPE_FORMAT_R4A4_UNORM;
+  case VDP_INDEXED_FORMAT_I4A4:
+ return PIPE_FORMAT_A4R4_UNORM;
   case VDP_INDEXED_FORMAT_A8I8:
  return PIPE_FORMAT_A8R8_UNORM;
   case VDP_INDEXED_FORMAT_I8A8:
diff --git a/src/gallium/state_trackers/xvmc/subpicture.c 
b/src/gallium/state_trackers/xvmc/subpicture.c
index 3497399..7a951fa 100644
--- a/src/gallium/state_trackers/xvmc/subpicture.c
+++ b/src/gallium/state_trackers/xvmc/subpicture.c
@@ -55,10 +55,10 @@ static enum pipe_format XvIDToPipe(int xvimage_id)
  return PIPE_FORMAT_B8G8R8X8_UNORM;
 
   case FOURCC_AI44:
- return PIPE_FORMAT_A4R4_UNORM;
+ return PIPE_FORMAT_R4A4_UNORM;
 
   case FOURCC_IA44:
- return PIPE_FORMAT_R4A4_UNORM;
+ return PIPE_FORMAT_A4R4_UNORM;
 
   default:
  XVMC_MSG(XVMC_ERR, "[XvMC] Unrecognized Xv image ID 0x%08X.\n", 
xvimage_id);
@@ -90,8 +90,8 @@ static int PipeToComponentOrder(enum pipe_format format, char 
*component_order)
   case PIPE_FORMAT_B8G8R8X8_UNORM:
  return 0;
 
-  case PIPE_FORMAT_R4A4_UNORM:
   case PIPE_FORMAT_A4R4_UNORM:
+  case PIPE_FORMAT

Re: [Mesa-dev] [PATCH 1/3] c11: Fix nano to second conversion.

2014-03-04 Thread Jose Fonseca
- Original Message -
> On Mon, 2014-03-03 at 21:41 +, jfons...@vmware.com wrote:
> > From: José Fonseca 
> 
> I think the commit summary should say 'nano to millisecond'?

Indeed. Thanks.

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


Re: [Mesa-dev] [PATCH] translate: fix buffer overflows

2014-03-04 Thread Jose Fonseca
Looks good.

Adding a few assertions before dereferencing these arrays might come handy in 
the future.

Jose

- Original Message -
> Because in draw we always inject position at slot 0 whenever
> fragment shader would take the maximum number of inputs (32) it
> meant that we had PIPE_MAX_ATTRIBS + 1 slots to translate, which
> meant that we were crashing with fragment shaders that took
> the maximum number of attributes as inputs. The actual max number
> of attributes we need to translate thus is PIPE_MAX_ATTRIBS + 1.
> ---
>  src/gallium/auxiliary/translate/translate_generic.c | 2 +-
>  src/gallium/auxiliary/translate/translate_sse.c | 6 +++---
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/src/gallium/auxiliary/translate/translate_generic.c
> b/src/gallium/auxiliary/translate/translate_generic.c
> index 5ffce32..82b4d00 100644
> --- a/src/gallium/auxiliary/translate/translate_generic.c
> +++ b/src/gallium/auxiliary/translate/translate_generic.c
> @@ -73,7 +73,7 @@ struct translate_generic {
> */
>int copy_size;
>  
> -   } attrib[PIPE_MAX_ATTRIBS];
> +   } attrib[PIPE_MAX_ATTRIBS + 1];
>  
> unsigned nr_attrib;
>  };
> diff --git a/src/gallium/auxiliary/translate/translate_sse.c
> b/src/gallium/auxiliary/translate/translate_sse.c
> index b6bc222..1833d8a 100644
> --- a/src/gallium/auxiliary/translate/translate_sse.c
> +++ b/src/gallium/auxiliary/translate/translate_sse.c
> @@ -104,15 +104,15 @@ struct translate_sse
> int8_t reg_to_const[16];
> int8_t const_to_reg[NUM_CONSTS];
>  
> -   struct translate_buffer buffer[PIPE_MAX_ATTRIBS];
> +   struct translate_buffer buffer[PIPE_MAX_ATTRIBS + 1];
> unsigned nr_buffers;
>  
> /* Multiple buffer variants can map to a single buffer. */
> -   struct translate_buffer_variant buffer_variant[PIPE_MAX_ATTRIBS];
> +   struct translate_buffer_variant buffer_variant[PIPE_MAX_ATTRIBS + 1];
> unsigned nr_buffer_variants;
>  
> /* Multiple elements can map to a single buffer variant. */
> -   unsigned element_to_buffer_variant[PIPE_MAX_ATTRIBS];
> +   unsigned element_to_buffer_variant[PIPE_MAX_ATTRIBS + 1];
>  
> boolean use_instancing;
> unsigned instance_id;
> --
> 1.9.0
> 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] draw/llvm: fix generation of the VS with GS present

2014-03-04 Thread Jose Fonseca
Makes sense. Good catch.

BTW, both changes seem candidate for stable branch.

Jose

- Original Message -
> draw_current_shader_* functions return a final output when considering
> both the geometry shader and the vertex shader. But when code generating
> vertex shader we can not be using output slots from the geometry shader
> because, obviously, those can be completely different. This fixes a
> number of very non-obvious crashes.
> A side-effect of this bug was that sometimes the vertex shading code
> could save some random outputs as position/clip when the geometry
> shader was writing them and vertex shader had different outputs at
> those slots (sometimes writing garbage and sometimes something correct).
> ---
>  src/gallium/auxiliary/draw/draw_llvm.c | 14 +++---
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/src/gallium/auxiliary/draw/draw_llvm.c
> b/src/gallium/auxiliary/draw/draw_llvm.c
> index 0bbb680..53d13f3 100644
> --- a/src/gallium/auxiliary/draw/draw_llvm.c
> +++ b/src/gallium/auxiliary/draw/draw_llvm.c
> @@ -1104,7 +1104,7 @@ generate_viewport(struct draw_llvm_variant *variant,
> int i;
> struct gallivm_state *gallivm = variant->gallivm;
> struct lp_type f32_type = vs_type;
> -   const unsigned pos =
> draw_current_shader_position_output(variant->llvm->draw);
> +   const unsigned pos = variant->llvm->draw->vs.position_output;
> LLVMTypeRef vs_type_llvm = lp_build_vec_type(gallivm, vs_type);
> LLVMValueRef out3 = LLVMBuildLoad(builder, outputs[pos][3], ""); /*w0 w1
> .. wn*/
> LLVMValueRef const1 = lp_build_const_vec(gallivm, f32_type, 1.0);
> /*1.0 1.0 1.0 1.0*/
> @@ -1173,14 +1173,14 @@ generate_clipmask(struct draw_llvm *llvm,
> LLVMValueRef plane1, planes, plane_ptr, sum;
> struct lp_type f32_type = vs_type;
> struct lp_type i32_type = lp_int_type(vs_type);
> -   const unsigned pos = draw_current_shader_position_output(llvm->draw);
> -   const unsigned cv = draw_current_shader_clipvertex_output(llvm->draw);
> +   const unsigned pos = llvm->draw->vs.position_output;
> +   const unsigned cv = llvm->draw->vs.clipvertex_output;
> int num_written_clipdistance =
> llvm->draw->vs.vertex_shader->info.num_written_clipdistance;
> bool have_cd = false;
> unsigned cd[2];
>  
> -   cd[0] = draw_current_shader_clipdistance_output(llvm->draw, 0);
> -   cd[1] = draw_current_shader_clipdistance_output(llvm->draw, 1);
> +   cd[0] = llvm->draw->vs.clipdistance_output[0];
> +   cd[1] = llvm->draw->vs.clipdistance_output[1];
>  
> if (cd[0] != pos || cd[1] != pos)
>have_cd = true;
> @@ -1551,8 +1551,8 @@ draw_llvm_generate(struct draw_llvm *llvm, struct
> draw_llvm_variant *variant,
> key->clip_z  ||
> key->clip_user);
> LLVMValueRef variant_func;
> -   const unsigned pos = draw_current_shader_position_output(llvm->draw);
> -   const unsigned cv = draw_current_shader_clipvertex_output(llvm->draw);
> +   const unsigned pos = llvm->draw->vs.position_output;
> +   const unsigned cv = llvm->draw->vs.clipvertex_output;
> boolean have_clipdist = FALSE;
> struct lp_bld_tgsi_system_values system_values;
>  
> --
> 1.9.0
> 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Student interested in gsoc at xorg

2014-03-04 Thread Emil Velikov
On 04/03/14 06:58, lazaro E Lespes wrote:
> Hello All,
Hi Lazaro,

> The last February 26, I sent and introduction mail to mesa-dev@
> lists.freedesktop.org  because I'm interested in participate in gsoc at
> xorg. I did not get any feedback so I don't know if my mail arrived to the
> list. Below, I send the mail again. Thanks and regards.
> 
There was a similar email around the same time so I'm guessing that
people may have confused yours as a duplicate.

> Hello All,
> I'm a PhD candidate at CIMAT(www.cimat.mx) . I'm interested in participate
> as a student in the gsoc in some of your project. In special, I'd like to
> develop for the project "GL/GLSL test for GL 4.0 and newer". That's way I
> worked with OpenGL 4.2/GLSL for my master thesis degree finished on
> September, 2013. I implemented a Real-time Physically-based Deformable
> Objects Simulation Framework using GLSL 4.2 shader programming, some
> results in videos .
> I submitted my work to GTC 2014 and it was accepted. I have skills in C/C++
> programming on intermediate to expert level.
> I'd like to get more information about the above project: Do you provide a
> predefined test suit?  What environment do you consider for testing? Others
> hint about what you expect
The project involves that the student will be writings a series of
simple GL/GLSL programs that exercise certain parts of the GL /GLSL
specification. The programs should be written in a way that they can be
merged with piglit - mesa's current test suit [1]. In addition to that
you might want to take a look at Ken's reply on the same topic [2].

> I also like the project "WGL support in Waffle"
I'm hoping that you're aware what WGL and GLX are, which leaves Waffle
[3]. Waffle is a library used to abstract/delay all the windowing system
and API decisions until runtime - i.e. one could write an app linked
against waffle that can run on top of GLX, EGL etc, in a windowing
system agnostic way. You can kind of think of it as SDL but for graphics
only. Currently waffle is short of a WGL backend and this is where you come.

Waffle's project page has a very nice introduction and a presentation
that will cover pretty much everything you want to know on the topic.


>  Hardware I have today: Dell PC, intel core-i7, 8GB ram, nvidia geforce gt
> 640.
Nice you have a GL 4.4 hardware, meaning that you'll be able to test
your programs against the proprietary drivers from nvidia (if you decide
to go with the former project)

Hope that clear things up a bit.
-Emil

> Regards,
> Lazaro Lesmes.
> 
> pd: I wold like to request to mail list administrators to change my
> configuration to daily receive mail summary.
> 
All the configuration can be done via the ML web interface [4]


[1] http://lists.freedesktop.org/archives/mesa-dev/2014-February/055011.html
[2] http://cgit.freedesktop.org/piglit/tree/README
[3] http://people.freedesktop.org/~chadversary/waffle/
[4] 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
> 

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


[Mesa-dev] [Bug 75751] New: egl_gallium always requires libdrm

2014-03-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=75751

  Priority: medium
Bug ID: 75751
  Assignee: mesa-dev@lists.freedesktop.org
   Summary: egl_gallium always requires libdrm
  Severity: normal
Classification: Unclassified
OS: All
  Reporter: christian.procha...@genode-labs.com
  Hardware: Other
Status: NEW
   Version: git
 Component: EGL
   Product: Mesa

(git master 1a568e0f2b65e4e1e1d19a6dece3a792a33da825)

I'm building Mesa with the following configuration:

./autogen.sh --enable-gles2 --disable-dri --enable-gallium-egl
--with-egl-platforms=fbdev --with-gallium-drivers=swrast

This configuration should not depend on libdrm, but when libdrm is missing, the
configure script aborts:

configure: error: egl_gallium requires libdrm >= 2.4.38

I think the check for libdrm in configure.ac should also depend on
'enable_dri'.

-- 
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] [Bug 75751] egl_gallium always requires libdrm

2014-03-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=75751

--- Comment #1 from Christian Prochaska  
---
When I temporarily disabled the libdrm check, Mesa built fine with this
configuration and the 'es2gears' demo ran without problems.

But there's another case related to this which doesn't seem right:

With the same configuration, if libdrm is available, it gets linked to
libGLESv2.so and egl_gallium.so, even though it should not be needed.

In my understanding, if '--disable-dri' is given, libdrm should neither be a
requirement of the configure script nor should it get linked/used if it is
available.

-- 
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] mesa: Add _mesa_error_no_memory for logging out-of-memory messages

2014-03-04 Thread Ian Romanick
From: Ian Romanick 

This can be called from locations that don't have a context pointer
handy.  This patch also adds enough infrastructure so that the unit
tests for the GLSL compiler and the stand-alone compiler will build and
function.

Signed-off-by: Ian Romanick 
Cc: Juha-Pekka Heikkila 
---
 src/glsl/Makefile.am| 10 +++---
 src/glsl/main.cpp   |  6 ++
 src/glsl/tests/common.c | 30 ++
 src/mesa/main/errors.c  |  6 ++
 src/mesa/main/errors.h  |  3 +++
 5 files changed, 52 insertions(+), 3 deletions(-)
 create mode 100644 src/glsl/tests/common.c

diff --git a/src/glsl/Makefile.am b/src/glsl/Makefile.am
index 27e180e..10181da 100644
--- a/src/glsl/Makefile.am
+++ b/src/glsl/Makefile.am
@@ -61,7 +61,8 @@ tests_general_ir_test_SOURCES =   \
$(GLSL_SRCDIR)/standalone_scaffolding.cpp \
tests/builtin_variable_test.cpp \
tests/invalidate_locations_test.cpp \
-   tests/general_ir_test.cpp
+   tests/general_ir_test.cpp   \
+   tests/common.c
 tests_general_ir_test_CFLAGS = \
$(PTHREAD_CFLAGS)
 tests_general_ir_test_LDADD =  \
@@ -76,7 +77,8 @@ tests_uniform_initializer_test_SOURCES =  \
$(top_srcdir)/src/mesa/program/symbol_table.c   \
tests/copy_constant_to_storage_tests.cpp\
tests/set_uniform_initializer_tests.cpp \
-   tests/uniform_initializer_utils.cpp
+   tests/uniform_initializer_utils.cpp \
+   tests/common.c
 tests_uniform_initializer_test_CFLAGS =\
$(PTHREAD_CFLAGS)
 tests_uniform_initializer_test_LDADD = \
@@ -95,7 +97,8 @@ tests_ralloc_test_LDADD = \
 tests_sampler_types_test_SOURCES = \
$(top_srcdir)/src/mesa/program/prog_hash_table.c\
$(top_srcdir)/src/mesa/program/symbol_table.c   \
-   tests/sampler_types_test.cpp
+   tests/sampler_types_test.cpp\
+   tests/common.c
 tests_sampler_types_test_CFLAGS =  \
$(PTHREAD_CFLAGS)
 tests_sampler_types_test_LDADD =   \
@@ -136,6 +139,7 @@ glsl_test_SOURCES = \
$(top_srcdir)/src/mesa/program/prog_hash_table.c \
$(top_srcdir)/src/mesa/program/symbol_table.c \
$(GLSL_SRCDIR)/standalone_scaffolding.cpp \
+   tests/common.c \
test.cpp \
test_optpass.cpp
 
diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp
index 4ae8f09..a4452e0 100644
--- a/src/glsl/main.cpp
+++ b/src/glsl/main.cpp
@@ -40,6 +40,12 @@
 
 static int glsl_version = 330;
 
+extern "C" void
+_mesa_error_no_memory(const char *caller)
+{
+   fprintf(stderr, "Mesa error: out of memory in %s", caller);
+}
+
 static void
 initialize_context(struct gl_context *ctx, gl_api api)
 {
diff --git a/src/glsl/tests/common.c b/src/glsl/tests/common.c
new file mode 100644
index 000..d69f54d
--- /dev/null
+++ b/src/glsl/tests/common.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright © 2014 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.
+ */
+#include 
+#include "main/errors.h"
+
+void
+_mesa_error_no_memory(const char *caller)
+{
+   fprintf(stderr, "Mesa error: out of memory in %s", caller);
+}
diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c
index ca73a66..8126e1f 100644
--- a/src/mesa/main/errors.c
+++ b/src/mesa/main/errors.c
@@ -1377,6 +1377,12 @@ _mesa_error( struct gl_context *ctx, GLenum error, const 
char *fmtString, ... )
_mesa_record_error(ctx, error);
 }
 
+void
+_mesa_error_no_memory(const char *caller)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   _mesa_error(ctx, GL_OUT_OF_MEMORY, "out of memory in %s", caller);
+}
 
 /**
  * Report debug information.  Print error message to stderr via fprintf().
diff --git a/src/mesa/main/e

Re: [Mesa-dev] [PATCH] mesa: Add _mesa_error_no_memory for logging out-of-memory messages

2014-03-04 Thread Juha-Pekka Heikkilä
On Tue, Mar 4, 2014 at 3:41 PM, Ian Romanick  wrote:
> From: Ian Romanick 
>
> This can be called from locations that don't have a context pointer
> handy.  This patch also adds enough infrastructure so that the unit
> tests for the GLSL compiler and the stand-alone compiler will build and
> function.
>
> Signed-off-by: Ian Romanick 
> Cc: Juha-Pekka Heikkila 
> ---
>  src/glsl/Makefile.am| 10 +++---
>  src/glsl/main.cpp   |  6 ++
>  src/glsl/tests/common.c | 30 ++
>  src/mesa/main/errors.c  |  6 ++
>  src/mesa/main/errors.h  |  3 +++
>  5 files changed, 52 insertions(+), 3 deletions(-)
>  create mode 100644 src/glsl/tests/common.c
>
> diff --git a/src/glsl/Makefile.am b/src/glsl/Makefile.am
> index 27e180e..10181da 100644
> --- a/src/glsl/Makefile.am
> +++ b/src/glsl/Makefile.am
> @@ -61,7 +61,8 @@ tests_general_ir_test_SOURCES =   \
> $(GLSL_SRCDIR)/standalone_scaffolding.cpp \
> tests/builtin_variable_test.cpp \
> tests/invalidate_locations_test.cpp \
> -   tests/general_ir_test.cpp
> +   tests/general_ir_test.cpp   \
> +   tests/common.c
>  tests_general_ir_test_CFLAGS = \
> $(PTHREAD_CFLAGS)
>  tests_general_ir_test_LDADD =  \
> @@ -76,7 +77,8 @@ tests_uniform_initializer_test_SOURCES =  \
> $(top_srcdir)/src/mesa/program/symbol_table.c   \
> tests/copy_constant_to_storage_tests.cpp\
> tests/set_uniform_initializer_tests.cpp \
> -   tests/uniform_initializer_utils.cpp
> +   tests/uniform_initializer_utils.cpp \
> +   tests/common.c
>  tests_uniform_initializer_test_CFLAGS =\
> $(PTHREAD_CFLAGS)
>  tests_uniform_initializer_test_LDADD = \
> @@ -95,7 +97,8 @@ tests_ralloc_test_LDADD = \
>  tests_sampler_types_test_SOURCES = \
> $(top_srcdir)/src/mesa/program/prog_hash_table.c\
> $(top_srcdir)/src/mesa/program/symbol_table.c   \
> -   tests/sampler_types_test.cpp
> +   tests/sampler_types_test.cpp\
> +   tests/common.c
>  tests_sampler_types_test_CFLAGS =  \
> $(PTHREAD_CFLAGS)
>  tests_sampler_types_test_LDADD =   \
> @@ -136,6 +139,7 @@ glsl_test_SOURCES = \
> $(top_srcdir)/src/mesa/program/prog_hash_table.c \
> $(top_srcdir)/src/mesa/program/symbol_table.c \
> $(GLSL_SRCDIR)/standalone_scaffolding.cpp \
> +   tests/common.c \
> test.cpp \
> test_optpass.cpp
>
> diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp
> index 4ae8f09..a4452e0 100644
> --- a/src/glsl/main.cpp
> +++ b/src/glsl/main.cpp
> @@ -40,6 +40,12 @@
>
>  static int glsl_version = 330;
>
> +extern "C" void
> +_mesa_error_no_memory(const char *caller)
> +{
> +   fprintf(stderr, "Mesa error: out of memory in %s", caller);
> +}
> +
>  static void
>  initialize_context(struct gl_context *ctx, gl_api api)
>  {
> diff --git a/src/glsl/tests/common.c b/src/glsl/tests/common.c
> new file mode 100644
> index 000..d69f54d
> --- /dev/null
> +++ b/src/glsl/tests/common.c
> @@ -0,0 +1,30 @@
> +/*
> + * Copyright © 2014 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.
> + */
> +#include 
> +#include "main/errors.h"
> +
> +void
> +_mesa_error_no_memory(const char *caller)
> +{
> +   fprintf(stderr, "Mesa error: out of memory in %s", caller);
> +}
> diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c
> index ca73a66..8126e1f 100644
> --- a/src/mesa/main/errors.c
> +++ b/src/mesa/main/errors.c
> @@ -1377,6 +1377,12 @@ _mesa_error( struct gl_context *ctx, GLenum error, 
> const char *fmtString, ... )
> _mesa_record_error(c

[Mesa-dev] [PATCH 2/3] st/mesa: add mappings for MESA_FORMAT_B8G8R8X8_SRGB

2014-03-04 Thread Chia-I Wu
The format is mapped to PIPE_FORMAT_B8G8R8X8_SRGB.
---
 src/mesa/state_tracker/st_format.c | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/mesa/state_tracker/st_format.c 
b/src/mesa/state_tracker/st_format.c
index 5f951eb..25577ac 100644
--- a/src/mesa/state_tracker/st_format.c
+++ b/src/mesa/state_tracker/st_format.c
@@ -393,6 +393,9 @@ st_mesa_format_to_pipe_format(mesa_format mesaFormat)
case MESA_FORMAT_RGBX_SINT32:
   return PIPE_FORMAT_R32G32B32X32_SINT;
 
+   case MESA_FORMAT_B8G8R8X8_SRGB:
+  return PIPE_FORMAT_B8G8R8X8_SRGB;
+
default:
   return PIPE_FORMAT_NONE;
}
@@ -748,6 +751,9 @@ st_pipe_format_to_mesa_format(enum pipe_format format)
case PIPE_FORMAT_R32G32B32X32_SINT:
   return MESA_FORMAT_RGBX_SINT32;
 
+   case PIPE_FORMAT_B8G8R8X8_SRGB:
+  return MESA_FORMAT_B8G8R8X8_SRGB;
+
default:
   assert(0);
   return MESA_FORMAT_NONE;
@@ -1006,7 +1012,8 @@ static const struct format_mapping format_map[] = {
/* sRGB formats */
{
   { GL_SRGB_EXT, GL_SRGB8_EXT, 0 },
-  { PIPE_FORMAT_R8G8B8X8_SRGB, DEFAULT_SRGBA_FORMATS }
+  { PIPE_FORMAT_R8G8B8X8_SRGB, PIPE_FORMAT_B8G8R8X8_SRGB,
+DEFAULT_SRGBA_FORMATS }
},
{
   { GL_SRGB_ALPHA_EXT, GL_SRGB8_ALPHA8_EXT, 0 },
@@ -1015,7 +1022,7 @@ static const struct format_mapping format_map[] = {
{
   { GL_COMPRESSED_SRGB_EXT, GL_COMPRESSED_SRGB_S3TC_DXT1_EXT, 0 },
   { PIPE_FORMAT_DXT1_SRGB, PIPE_FORMAT_R8G8B8X8_SRGB,
-DEFAULT_SRGBA_FORMATS }
+PIPE_FORMAT_B8G8R8X8_SRGB, DEFAULT_SRGBA_FORMATS }
},
{
   { GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, 0 },
-- 
1.8.5.3

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


[Mesa-dev] [PATCH 1/3] mesa: add MESA_FORMAT_B8G8R8X8_SRGB

2014-03-04 Thread Chia-I Wu
The format is needed to represent an RGB-only winsys framebuffer that is
sRGB-capable.
---
 src/mesa/main/format_pack.c   | 18 ++
 src/mesa/main/format_unpack.c | 15 +++
 src/mesa/main/formats.c   | 21 +
 src/mesa/main/formats.h   |  3 +++
 src/mesa/main/texstore.c  | 17 +
 src/mesa/swrast/s_texfetch.c  |  6 ++
 6 files changed, 76 insertions(+), 4 deletions(-)

diff --git a/src/mesa/main/format_pack.c b/src/mesa/main/format_pack.c
index 2772ff2..29a68a8 100644
--- a/src/mesa/main/format_pack.c
+++ b/src/mesa/main/format_pack.c
@@ -1880,6 +1880,20 @@ pack_float_SIGNED_RG1616(const GLfloat src[4], void *dst)
*d = (r << 16) | (g & 0x);
 }
 
+/*
+ * MESA_FORMAT_B8G8R8X8_SRGB
+ */
+
+static void
+pack_float_XRGB_SRGB(const GLfloat src[4], void *dst)
+{
+   GLuint *d = (GLuint *) dst;
+   GLubyte r = linear_float_to_srgb_ubyte(src[RCOMP]);
+   GLubyte g = linear_float_to_srgb_ubyte(src[GCOMP]);
+   GLubyte b = linear_float_to_srgb_ubyte(src[BCOMP]);
+   *d = PACK_COLOR_(127, r, g, b);
+}
+
 /**
  * Return a function that can pack a GLubyte rgba[4] color.
  */
@@ -2034,6 +2048,8 @@ _mesa_get_pack_ubyte_rgba_function(mesa_format format)
 
   table[MESA_FORMAT_R10G10B10A2_UNORM] = pack_ubyte_ABGR2101010;
 
+  table[MESA_FORMAT_B8G8R8X8_SRGB] = NULL;
+
   initialized = GL_TRUE;
}
 
@@ -2197,6 +2213,8 @@ _mesa_get_pack_float_rgba_function(mesa_format format)
   table[MESA_FORMAT_G8R8_SNORM] = pack_float_SIGNED_RG88;
   table[MESA_FORMAT_G16R16_SNORM] = pack_float_SIGNED_RG1616;
 
+  table[MESA_FORMAT_B8G8R8X8_SRGB] = pack_float_XRGB_SRGB;
+
   initialized = GL_TRUE;
}
 
diff --git a/src/mesa/main/format_unpack.c b/src/mesa/main/format_unpack.c
index 276ba55..31b04a2 100644
--- a/src/mesa/main/format_unpack.c
+++ b/src/mesa/main/format_unpack.c
@@ -2313,6 +2313,19 @@ unpack_SIGNED_RG1616(const void *src, GLfloat dst[][4], 
GLuint n)
}
 }
 
+static void
+unpack_XRGB_SRGB(const void *src, GLfloat dst[][4], GLuint n)
+{
+   const GLuint *s = ((const GLuint *) src);
+   GLuint i;
+   for (i = 0; i < n; i++) {
+  dst[i][RCOMP] = _mesa_nonlinear_to_linear( (s[i] >> 16) & 0xff );
+  dst[i][GCOMP] = _mesa_nonlinear_to_linear( (s[i] >>  8) & 0xff );
+  dst[i][BCOMP] = _mesa_nonlinear_to_linear( (s[i]  ) & 0xff );
+  dst[i][ACOMP] = 1.0F;
+   }
+}
+
 /**
  * Return the unpacker function for the given format.
  */
@@ -2530,6 +2543,8 @@ get_unpack_rgba_function(mesa_format format)
   table[MESA_FORMAT_G8R8_SNORM] = unpack_SIGNED_RG88;
   table[MESA_FORMAT_G16R16_SNORM] = unpack_SIGNED_RG1616;
 
+  table[MESA_FORMAT_B8G8R8X8_SRGB] = unpack_XRGB_SRGB;
+
   initialized = GL_TRUE;
}
 
diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
index f6c399e..e0b774e 100644
--- a/src/mesa/main/formats.c
+++ b/src/mesa/main/formats.c
@@ -1790,6 +1790,15 @@ static struct gl_format_info 
format_info[MESA_FORMAT_COUNT] =
   0, 0, 0, 0, 0,
   1, 1, 4
},
+   {
+  MESA_FORMAT_B8G8R8X8_SRGB,
+  "MESA_FORMAT_B8G8R8X8_SRGB",
+  GL_RGB,
+  GL_UNSIGNED_NORMALIZED,
+  8, 8, 8, 0,
+  0, 0, 0, 0, 0,
+  1, 1, 4
+   },
 };
 
 
@@ -2035,6 +2044,7 @@ _mesa_get_format_color_encoding(mesa_format format)
case MESA_FORMAT_ETC2_SRGB8:
case MESA_FORMAT_ETC2_SRGB8_ALPHA8_EAC:
case MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1:
+   case MESA_FORMAT_B8G8R8X8_SRGB:
   return GL_SRGB;
default:
   return GL_LINEAR;
@@ -2089,6 +2099,9 @@ _mesa_get_srgb_format_linear(mesa_format format)
case MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1:
   format = MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1;
   break;
+   case MESA_FORMAT_B8G8R8X8_SRGB:
+  format = MESA_FORMAT_B8G8R8X8_UNORM;
+  break;
default:
   break;
}
@@ -2895,6 +2908,11 @@ _mesa_format_to_type_and_comps(mesa_format format,
   *comps = 2;
   return;
 
+   case MESA_FORMAT_B8G8R8X8_SRGB:
+  *datatype = GL_UNSIGNED_BYTE;
+  *comps = 4;
+  return;
+
case MESA_FORMAT_COUNT:
   assert(0);
   return;
@@ -3448,6 +3466,9 @@ _mesa_format_matches_format_and_type(mesa_format 
mesa_format,
case MESA_FORMAT_G16R16_SNORM:
   return format == GL_RG && type == GL_SHORT && !littleEndian &&
  !swapBytes;
+
+   case MESA_FORMAT_B8G8R8X8_SRGB:
+  return GL_FALSE;
}
 
return GL_FALSE;
diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h
index 3102584..07b84d6 100644
--- a/src/mesa/main/formats.h
+++ b/src/mesa/main/formats.h
@@ -333,6 +333,7 @@ typedef enum
 *  R10G10B10A2_UNORM
 *  G8R8_SINT
 *  G16R16_SINT
+*  B8G8R8X8_SRGB
 *
 */
/*@{*/
@@ -647,6 +648,8 @@ typedef enum
MESA_FORMAT_G8R8_SNORM,/*     */
MESA_FORMAT_G16R16_SNORM,  /*         */
 
+   MESA_FORMAT_B8G8R8X8_SR

[Mesa-dev] [PATCHv2 0/3] st/mesa: make winsys framebuffer sRGB-capable

2014-03-04 Thread Chia-I Wu
Hi,

Until now, we do not support sRGB write for winsys framebuffers.  This series
changes that so that winsys framebuffers are marked sRGB-capable when the pipe
driver supports it.

This is not to be confused with GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB.  The
attribute guarantees the created winsys framebuffers to be sRGB-capable.  This
series is just a prerequisite if we ever want to export fbconfigs that are
sRGB-capable.

And we mark winsys framebuffers to be sRGB-capable only for desktop GL
contexts.  In GLES, sRGB capability implies sRGB write.  There is no
GL_FRAMEBUFFER_SRGB to control whether sRGB write is enabled or not.  We do
not want to surprise applications that do not expect sRGB.  This could change
when EGL_KHR_gl_colorspace is supported.

v2:
 - add MESA_FORMAT_B8G8R8X8_SRGB
 - never mark winsys framebuffer sRGB-capable for GLES contexts

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


[Mesa-dev] [PATCHv2 3/3] st/mesa: make winsys fbo sRGB-capable when supported

2014-03-04 Thread Chia-I Wu
The texture formats of winsys fbo are always linear becase the st manager
(st/dri for example) could not know the colorspace used.  But it does not mean
that we cannot make the fbo sRGB-capable.  By

 - setting rb->Visual.sRGBCapable to GL_TRUE when the pipe driver supports the
   format in sRGB colorspace,
 - giving rb an sRGB internal format, and
 - updating code to check rb->Format instead of strb->texture->format,

we should be good.

Fixed bug 75226 for at least llvmpipe and ilo, with no piglit regression.

v2: do not set rb->Visual.sRGBCapable for GLES contexts to avoid surprises

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75226
---
 src/mesa/state_tracker/st_atom_framebuffer.c |  4 +--
 src/mesa/state_tracker/st_cb_fbo.c   | 25 --
 src/mesa/state_tracker/st_manager.c  | 49 
 3 files changed, 66 insertions(+), 12 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom_framebuffer.c 
b/src/mesa/state_tracker/st_atom_framebuffer.c
index c08d912..4c4f839 100644
--- a/src/mesa/state_tracker/st_atom_framebuffer.c
+++ b/src/mesa/state_tracker/st_atom_framebuffer.c
@@ -73,8 +73,8 @@ update_framebuffer_state( struct st_context *st )
   strb = st_renderbuffer(fb->_ColorDrawBuffers[i]);
 
   if (strb) {
- if (strb->is_rtt ||
- (strb->texture && util_format_is_srgb(strb->texture->format))) {
+ if (strb->is_rtt || (strb->texture &&
+ _mesa_get_format_color_encoding(strb->Base.Format) == GL_SRGB)) {
 /* rendering to a GL texture, may have to update surface */
 st_update_renderbuffer_surface(st, strb);
  }
diff --git a/src/mesa/state_tracker/st_cb_fbo.c 
b/src/mesa/state_tracker/st_cb_fbo.c
index 6449c62..ce8d915 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -295,7 +295,7 @@ st_new_renderbuffer_fb(enum pipe_format format, int 
samples, boolean sw)
strb->Base.Format = st_pipe_format_to_mesa_format(format);
strb->Base._BaseFormat = _mesa_get_format_base_format(strb->Base.Format);
strb->software = sw;
-   
+
switch (format) {
case PIPE_FORMAT_R8G8B8A8_UNORM:
case PIPE_FORMAT_B8G8R8A8_UNORM:
@@ -307,6 +307,16 @@ st_new_renderbuffer_fb(enum pipe_format format, int 
samples, boolean sw)
case PIPE_FORMAT_X8R8G8B8_UNORM:
   strb->Base.InternalFormat = GL_RGB8;
   break;
+   case PIPE_FORMAT_R8G8B8A8_SRGB:
+   case PIPE_FORMAT_B8G8R8A8_SRGB:
+   case PIPE_FORMAT_A8R8G8B8_SRGB:
+  strb->Base.InternalFormat = GL_SRGB8_ALPHA8;
+  break;
+   case PIPE_FORMAT_R8G8B8X8_SRGB:
+   case PIPE_FORMAT_B8G8R8X8_SRGB:
+   case PIPE_FORMAT_X8R8G8B8_SRGB:
+  strb->Base.InternalFormat = GL_SRGB8;
+  break;
case PIPE_FORMAT_B5G5R5A1_UNORM:
   strb->Base.InternalFormat = GL_RGB5_A1;
   break;
@@ -401,8 +411,17 @@ st_update_renderbuffer_surface(struct st_context *st,
int rtt_width = strb->Base.Width;
int rtt_height = strb->Base.Height;
int rtt_depth = strb->Base.Depth;
-   enum pipe_format format = st->ctx->Color.sRGBEnabled ? resource->format :
- util_format_linear(resource->format);
+   /*
+* For winsys fbo, it is possible that the renderbuffer is sRGB-capable but
+* the format of strb->texture is linear (because we have no control over
+* the format).  Check strb->Base.Format instead of strb->texture->format
+* to determine if the rb is sRGB-capable.
+*/
+   boolean enable_srgb = (st->ctx->Color.sRGBEnabled &&
+ _mesa_get_format_color_encoding(strb->Base.Format) == GL_SRGB);
+   enum pipe_format format = (enable_srgb) ?
+  util_format_srgb(resource->format) :
+  util_format_linear(resource->format);
unsigned first_layer, last_layer, level;
 
if (resource->target == PIPE_TEXTURE_1D_ARRAY) {
diff --git a/src/mesa/state_tracker/st_manager.c 
b/src/mesa/state_tracker/st_manager.c
index 6a776a8..68cb5de 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -302,6 +302,8 @@ st_framebuffer_add_renderbuffer(struct st_framebuffer *stfb,
   break;
default:
   format = stfb->iface->visual->color_format;
+  if (stfb->Base.Visual.sRGBCapable)
+ format = util_format_srgb(format);
   sw = FALSE;
   break;
}
@@ -400,7 +402,8 @@ st_visual_to_context_mode(const struct st_visual *visual,
  * Create a framebuffer from a manager interface.
  */
 static struct st_framebuffer *
-st_framebuffer_create(struct st_framebuffer_iface *stfbi)
+st_framebuffer_create(struct st_context *st,
+  struct st_framebuffer_iface *stfbi)
 {
struct st_framebuffer *stfb;
struct gl_config mode;
@@ -414,6 +417,37 @@ st_framebuffer_create(struct st_framebuffer_iface *stfbi)
   return NULL;
 
st_visual_to_context_mode(stfbi->visual, &mode);
+
+   /*
+* For desktop GL, sRGB framebuffer write is controlled by both the
+* capability of the framebuffer an

Re: [Mesa-dev] [PATCH] mesa: fix glGet size queries for L/LA/I color buffers

2014-03-04 Thread luigi

>
> From: Marek Ol??k 
>
> There is no API for returning the number of luminance and intensity bits and
> the 3.3 spec doesn't seem to specify any behavior for the queries if the 
> format
> is one of L, LA, I. It seems to be a spec bug.
>
>

hi.i just notice that:

GL 3.3 Core spec Chapter E.2.2  Removed Features (title)  page 345  says

"""
• Legacy pixel formats - all ALPHA, LUMINANCE, LUMINANCE_ALPHA, and
INTENSITY external and internal formats, including compressed, floating-
point, and integer variants; all references to luminance and intensity formats
elsewhere in the specification, including conversion to and from those for-
mats; and all associated state. including state describing the allocation or
format of luminance and intensity texture or framebuffer components.
"""
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] mesa: fix glGet size queries for L/LA/I color buffers

2014-03-04 Thread Marek Olšák
This is about the compatibility profile, that is 3.0, and our piglit
tests which test these legacy formats. This isn't an issue with the
core profile for the reason you mentioned.

Marek

On Tue, Mar 4, 2014 at 3:31 PM, luigi  wrote:
>
>>
>> From: Marek Ol??k 
>>
>> There is no API for returning the number of luminance and intensity bits and
>> the 3.3 spec doesn't seem to specify any behavior for the queries if the 
>> format
>> is one of L, LA, I. It seems to be a spec bug.
>>
>>
>
> hi.i just notice that:
>
> GL 3.3 Core spec Chapter E.2.2  Removed Features (title)  page 345  says
>
> """
> • Legacy pixel formats - all ALPHA, LUMINANCE, LUMINANCE_ALPHA, and
> INTENSITY external and internal formats, including compressed, floating-
> point, and integer variants; all references to luminance and intensity formats
> elsewhere in the specification, including conversion to and from those for-
> mats; and all associated state. including state describing the allocation or
> format of luminance and intensity texture or framebuffer components.
> """
> ___
> 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] i965 GL_ARB_buffer_storage

2014-03-04 Thread Jose Fonseca
- Original Message -
> One thing I noticed while working on this was that we only reallocate buffer
> storage for INVALIDATE_BUFFER_BIT when UNSYNCHRONIZED_BIT is unset.  The
> ARB_mbr spec says that the contents "may be discarded", not "must be
> discarded".  However, while writing the glamor code I happened to type this
> for the wraparound case:
> 
> glamor_priv->vb = glMapBufferRange(GL_ARRAY_BUFFER,
>0, size,
>GL_MAP_WRITE_BIT |
>GL_MAP_INVALIDATE_BUFFER_BIT |
>GL_MAP_UNSYNCHRONIZED_BIT |
>GL_MAP_PERSISTENT_BIT |
>GL_MAP_COHERENT_BIT);
> 
> intending that the buffer storage get reallocated, and that we not worry
> about
> any synchronization after that.  My code would have been broken on the i965
> driver.  I'm wondering if this is the intended behavior of the spec, or if we
> want to treat the "may" as a "must".

It's a good question.  And it seems a common problem [1].

I think the point of "may" in the spec is that, if there are no pending draw 
commands on the buffer, then there is no point in reallocating the buffer 
storage -- reusing the existing storage could be actually faster.  Hence "may" 
instead of "must".  (That is, the application should make no assumptions that 
the contents will be zero'd or anything of the sort.)


If the buffer being mapped has pending commands, then it could be safe for the 
driver to ignore GL_MAP_INVALIDATE_BUFFER_BIT, but only if it also ignores 
GL_MAP_UNSYNCHRONIZED_BIT too, i.e, the driver should sync at that point.


Jose


[1] http://www.winehq.org/pipermail/wine-patches/2011-July/104376.html
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] i965 GL_ARB_buffer_storage

2014-03-04 Thread Jose Fonseca


- Original Message -
> - Original Message -
> > One thing I noticed while working on this was that we only reallocate
> > buffer
> > storage for INVALIDATE_BUFFER_BIT when UNSYNCHRONIZED_BIT is unset.  The
> > ARB_mbr spec says that the contents "may be discarded", not "must be
> > discarded".  However, while writing the glamor code I happened to type this
> > for the wraparound case:
> > 
> > glamor_priv->vb = glMapBufferRange(GL_ARRAY_BUFFER,
> >0, size,
> >GL_MAP_WRITE_BIT |
> >GL_MAP_INVALIDATE_BUFFER_BIT
> >|
> >GL_MAP_UNSYNCHRONIZED_BIT |
> >GL_MAP_PERSISTENT_BIT |
> >GL_MAP_COHERENT_BIT);
> > 
> > intending that the buffer storage get reallocated, and that we not worry
> > about
> > any synchronization after that.  My code would have been broken on the i965
> > driver.  I'm wondering if this is the intended behavior of the spec, or if
> > we
> > want to treat the "may" as a "must".
> 
> It's a good question.  And it seems a common problem [1].
> 
> I think the point of "may" in the spec is that, if there are no pending draw
> commands on the buffer, then there is no point in reallocating the buffer
> storage -- reusing the existing storage could be actually faster.  Hence
> "may" instead of "must".  (That is, the application should make no
> assumptions that the contents will be zero'd or anything of the sort.)
> 
> 
> If the buffer being mapped has pending commands, then it could be safe for
> the driver to ignore GL_MAP_INVALIDATE_BUFFER_BIT, but only if it also
> ignores GL_MAP_UNSYNCHRONIZED_BIT too, i.e, the driver should sync at that
> point.

Just to be clear, IMO the ideal is for the driver never syncs, and honours 
GL_MAP_INVALIDATE_BUFFER_BIT and re-allocates storage if sync is about to 
happen.  Sync is just 2nd best if the driver prefers not to honour 
GL_MAP_INVALIDATE_BUFFER_BIT.


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


[Mesa-dev] [Bug 75751] egl_gallium always requires libdrm

2014-03-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=75751

--- Comment #2 from Chia-I Wu  ---
(In reply to comment #1)
> When I temporarily disabled the libdrm check, Mesa built fine with this
> configuration and the 'es2gears' demo ran without problems.
Right, libdrm should not be needed in your configuration.

> But there's another case related to this which doesn't seem right:
> 
> With the same configuration, if libdrm is available, it gets linked to
> libGLESv2.so and egl_gallium.so, even though it should not be needed.
It looks like the dependency is brought in by libloader (src/loader/).  It is
unnecessary for the configuration, but is no harm.  It is potentially useful
when egl_gallium can do accelerated rendering on fbdev.
> In my understanding, if '--disable-dri' is given, libdrm should neither be a
> requirement of the configure script nor should it get linked/used if it is
> available.
--disable-dri disables DRI drivers.

I will leave the bug open as I might not be able to fix it anytime soon. 
Patches are welcomed.

-- 
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


Re: [Mesa-dev] i965 GL_ARB_buffer_storage

2014-03-04 Thread Marek Olšák
In my opinion, MAP_UNSYNCHRONIZED says that you don't have to sync,
which makes MAP_INVALIDATE_* useless, because the invalidate flags are
only useful for avoiding synchronization and you already know you
don't have to do it.

Marek

On Thu, Feb 27, 2014 at 11:52 PM, Eric Anholt  wrote:
> One thing I noticed while working on this was that we only reallocate buffer
> storage for INVALIDATE_BUFFER_BIT when UNSYNCHRONIZED_BIT is unset.  The
> ARB_mbr spec says that the contents "may be discarded", not "must be
> discarded".  However, while writing the glamor code I happened to type this
> for the wraparound case:
>
> glamor_priv->vb = glMapBufferRange(GL_ARRAY_BUFFER,
>0, size,
>GL_MAP_WRITE_BIT |
>GL_MAP_INVALIDATE_BUFFER_BIT |
>GL_MAP_UNSYNCHRONIZED_BIT |
>GL_MAP_PERSISTENT_BIT |
>GL_MAP_COHERENT_BIT);
>
> intending that the buffer storage get reallocated, and that we not worry about
> any synchronization after that.  My code would have been broken on the i965
> driver.  I'm wondering if this is the intended behavior of the spec, or if we
> want to treat the "may" as a "must".
>
> ___
> 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


[Mesa-dev] [Bug 75751] egl_gallium always requires libdrm

2014-03-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=75751

--- Comment #3 from Christian Prochaska  
---
> > In my understanding, if '--disable-dri' is given, libdrm should neither be a
> > requirement of the configure script nor should it get linked/used if it is
> > available.
>
> --disable-dri disables DRI drivers.
> 

Currently, it also disables the DRM winsys for egl_gallium with the i915 driver
(see bug 75286).

So it seems there are different interpretations about what '--disable-dri'
actually means. 'configure --help' says 'enable DRI modules'. Perhaps 'modules'
should get renamed to 'drivers' then and perhaps the option renamed to
'--enable-dri-drivers' to make it more clear?

-- 
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


Re: [Mesa-dev] i965 GL_ARB_buffer_storage

2014-03-04 Thread Jose Fonseca
I agree that apps that only write to a buffer shouldn't use both 
MAP_UNSYNCHRONIZED and MAP_INVALIDATE_BUFFER_BIT, if that's your point.  Apps 
should stick so a single strategy.  But it seems a common pitfall.

Note that MAP_INVALIDATE_*_BIT purpose is not just avoid synchronization. They 
also avoid copying data from GPU to CPU accessible memory for buffers that were 
previously written by the GPU, or for write-only buffers which reside in 
non-CPU-accessible GPU memory.  In fact GL_MAP_INVALIDATE_RANGE_BIT has nothing 
to do with synchronization at all -- it's more like "WRITE-ONLY" flag.

Jose

- Original Message -
> In my opinion, MAP_UNSYNCHRONIZED says that you don't have to sync,
> which makes MAP_INVALIDATE_* useless, because the invalidate flags are
> only useful for avoiding synchronization and you already know you
> don't have to do it.
> 
> Marek
> 
> On Thu, Feb 27, 2014 at 11:52 PM, Eric Anholt  wrote:
> > One thing I noticed while working on this was that we only reallocate
> > buffer
> > storage for INVALIDATE_BUFFER_BIT when UNSYNCHRONIZED_BIT is unset.  The
> > ARB_mbr spec says that the contents "may be discarded", not "must be
> > discarded".  However, while writing the glamor code I happened to type this
> > for the wraparound case:
> >
> > glamor_priv->vb = glMapBufferRange(GL_ARRAY_BUFFER,
> >0, size,
> >GL_MAP_WRITE_BIT |
> >GL_MAP_INVALIDATE_BUFFER_BIT
> >|
> >GL_MAP_UNSYNCHRONIZED_BIT |
> >GL_MAP_PERSISTENT_BIT |
> >GL_MAP_COHERENT_BIT);
> >
> > intending that the buffer storage get reallocated, and that we not worry
> > about
> > any synchronization after that.  My code would have been broken on the i965
> > driver.  I'm wondering if this is the intended behavior of the spec, or if
> > we
> > want to treat the "may" as a "must".
> >
> > ___
> > mesa-dev mailing list
> > mesa-dev@lists.freedesktop.org
> > https://urldefense.proofpoint.com/v1/url?u=http://lists.freedesktop.org/mailman/listinfo/mesa-dev&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=NMr9uy2iTjWVixC0wOcYCWEIYhfo80qKwRgdodpoDzA%3D%0A&m=Wh4R%2Bsr%2BRNuNltGaNWrb8ry%2F5tmSBePKlh6ZRzfxv%2FQ%3D%0A&s=41ea8aa8392e49b1e1288fcb745f45451785da17af9341393d4e07db41ed1161
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://urldefense.proofpoint.com/v1/url?u=http://lists.freedesktop.org/mailman/listinfo/mesa-dev&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=NMr9uy2iTjWVixC0wOcYCWEIYhfo80qKwRgdodpoDzA%3D%0A&m=Wh4R%2Bsr%2BRNuNltGaNWrb8ry%2F5tmSBePKlh6ZRzfxv%2FQ%3D%0A&s=41ea8aa8392e49b1e1288fcb745f45451785da17af9341393d4e07db41ed1161
> 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] gallium: rename R4A4 and A4R4 formats to match their swizzle

2014-03-04 Thread Brian Paul

On 03/04/2014 04:43 AM, Marek Olšák wrote:

From: Marek Olšák 

Like L4A4.
---
  src/gallium/auxiliary/util/u_format.csv  | 4 ++--
  src/gallium/auxiliary/util/u_format.h| 3 +--
  src/gallium/drivers/ilo/ilo_format.c | 2 +-
  src/gallium/include/pipe/p_format.h  | 4 ++--
  src/gallium/state_trackers/vdpau/vdpau_private.h | 4 ++--
  src/gallium/state_trackers/xvmc/subpicture.c | 6 +++---
  6 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_format.csv 
b/src/gallium/auxiliary/util/u_format.csv
index 8d04b00..8fb068b 100644
--- a/src/gallium/auxiliary/util/u_format.csv
+++ b/src/gallium/auxiliary/util/u_format.csv
@@ -272,8 +272,8 @@ PIPE_FORMAT_NV12  , other, 1, 1, x8  , x8  
, x8  , x8  , xyzw, y
  PIPE_FORMAT_NV21  , other, 1, 1, x8  , x8  , x8  , x8  , 
xyzw, yuv

  # Usually used to implement IA44 and AI44 formats in video decoding
-PIPE_FORMAT_R4A4_UNORM, plain, 1, 1, un4 , un4 , , , y00x, 
rgb
-PIPE_FORMAT_A4R4_UNORM, plain, 1, 1, un4 , un4 , , , x00y, 
rgb
+PIPE_FORMAT_A4R4_UNORM, plain, 1, 1, un4 , un4 , , , y00x, 
rgb
+PIPE_FORMAT_R4A4_UNORM, plain, 1, 1, un4 , un4 , , , x00y, 
rgb
  PIPE_FORMAT_R8A8_UNORM, plain, 1, 1, un8 , un8 , , , 
x00y, rgb
  PIPE_FORMAT_A8R8_UNORM, plain, 1, 1, un8 , un8 , , , 
y00x, rgb

diff --git a/src/gallium/auxiliary/util/u_format.h 
b/src/gallium/auxiliary/util/u_format.h
index e36a9e2..747e142 100644
--- a/src/gallium/auxiliary/util/u_format.h
+++ b/src/gallium/auxiliary/util/u_format.h
@@ -1060,8 +1060,7 @@ util_format_luminance_to_red(enum pipe_format format)
return PIPE_FORMAT_RGTC1_SNORM;

 case PIPE_FORMAT_L4A4_UNORM:
-  /* XXX A4R4 is defined as x00y in u_format.csv */
-  return PIPE_FORMAT_A4R4_UNORM;
+  return PIPE_FORMAT_R4A4_UNORM;

 case PIPE_FORMAT_L8A8_UNORM:
return PIPE_FORMAT_R8A8_UNORM;
diff --git a/src/gallium/drivers/ilo/ilo_format.c 
b/src/gallium/drivers/ilo/ilo_format.c
index 72575f4..30e4958 100644
--- a/src/gallium/drivers/ilo/ilo_format.c
+++ b/src/gallium/drivers/ilo/ilo_format.c
@@ -504,8 +504,8 @@ ilo_translate_color_format(enum pipe_format format)
[PIPE_FORMAT_IYUV]  = 0,
[PIPE_FORMAT_NV12]  = 0,
[PIPE_FORMAT_NV21]  = 0,
-  [PIPE_FORMAT_R4A4_UNORM]= 0,
[PIPE_FORMAT_A4R4_UNORM]= 0,
+  [PIPE_FORMAT_R4A4_UNORM]= 0,
[PIPE_FORMAT_R8A8_UNORM]= 0,
[PIPE_FORMAT_A8R8_UNORM]= 0,
[PIPE_FORMAT_R10G10B10A2_SSCALED]   = 
BRW_SURFACEFORMAT_R10G10B10A2_SSCALED,
diff --git a/src/gallium/include/pipe/p_format.h 
b/src/gallium/include/pipe/p_format.h
index daa3be2..34ab662 100644
--- a/src/gallium/include/pipe/p_format.h
+++ b/src/gallium/include/pipe/p_format.h
@@ -236,8 +236,8 @@ enum pipe_format {
 PIPE_FORMAT_NV12= 166,
 PIPE_FORMAT_NV21= 167,

-   PIPE_FORMAT_R4A4_UNORM  = 168,
-   PIPE_FORMAT_A4R4_UNORM  = 169,
+   PIPE_FORMAT_A4R4_UNORM  = 168,
+   PIPE_FORMAT_R4A4_UNORM  = 169,
 PIPE_FORMAT_R8A8_UNORM  = 170,
 PIPE_FORMAT_A8R8_UNORM  = 171,

diff --git a/src/gallium/state_trackers/vdpau/vdpau_private.h 
b/src/gallium/state_trackers/vdpau/vdpau_private.h
index 078f0f9..ce6852b 100644
--- a/src/gallium/state_trackers/vdpau/vdpau_private.h
+++ b/src/gallium/state_trackers/vdpau/vdpau_private.h
@@ -209,9 +209,9 @@ FormatIndexedToPipe(VdpRGBAFormat vdpau_format)
  {
 switch (vdpau_format) {
case VDP_INDEXED_FORMAT_A4I4:
- return PIPE_FORMAT_A4R4_UNORM;
-  case VDP_INDEXED_FORMAT_I4A4:
   return PIPE_FORMAT_R4A4_UNORM;
+  case VDP_INDEXED_FORMAT_I4A4:
+ return PIPE_FORMAT_A4R4_UNORM;
case VDP_INDEXED_FORMAT_A8I8:
   return PIPE_FORMAT_A8R8_UNORM;
case VDP_INDEXED_FORMAT_I8A8:
diff --git a/src/gallium/state_trackers/xvmc/subpicture.c 
b/src/gallium/state_trackers/xvmc/subpicture.c
index 3497399..7a951fa 100644
--- a/src/gallium/state_trackers/xvmc/subpicture.c
+++ b/src/gallium/state_trackers/xvmc/subpicture.c
@@ -55,10 +55,10 @@ static enum pipe_format XvIDToPipe(int xvimage_id)
   return PIPE_FORMAT_B8G8R8X8_UNORM;

case FOURCC_AI44:
- return PIPE_FORMAT_A4R4_UNORM;
+ return PIPE_FORMAT_R4A4_UNORM;

case FOURCC_IA44:
- return PIPE_FORMAT_R4A4_UNORM;
+ return PIPE_FORMAT_A4R4_UNORM;

default:
   XVMC_MSG(XVMC_ERR, "[XvMC] Unrecognized Xv image ID 0x%08X.\n", 
xvimage_id);
@@ -90,8 +90,8 @@ static int PipeToComponentOrder(enum pipe_format format, char 
*component_order)
case PIPE_FORMAT_B8G8R8X8_UNORM:
   return 0;

-  case PIPE_FOR

[Mesa-dev] [Bug 75543] OSMesa Gallium OSMesaMakeCurrent

2014-03-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=75543

--- Comment #4 from Brian Paul  ---
Committed: cbacee207faf866b0444beb583d3d6f341a8ee78

-- 
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


Re: [Mesa-dev] [PATCH] mesa: update packed format layout comments

2014-03-04 Thread Brian Paul

On 03/03/2014 08:38 PM, Chia-I Wu wrote:

On Sat, Mar 1, 2014 at 1:59 AM, Brian Paul  wrote:

Update the comments for the packed formats to accurately reflect the
layout of the bits in the pixel.  For example, for the packed format
MESA_FORMAT_R8G8B8A8, R is in the least significant position while A
is in the most-significant position of the 32-bit word.

Two comments below, and the patch is

Reviewed-by: Chia-I Wu 


---
  src/mesa/main/formats.h |   98 +++
  1 file changed, 49 insertions(+), 49 deletions(-)

diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h
index 3f44de9..72a6600 100644
--- a/src/mesa/main/formats.h
+++ b/src/mesa/main/formats.h
@@ -339,33 +339,33 @@ typedef enum

 /* Type P formats */  /* msb <-- TEXEL BITS ---> lsb */
   /*         */
-   MESA_FORMAT_A8B8G8R8_UNORM,   /*         */
-   MESA_FORMAT_R8G8B8A8_UNORM,   /*         */
-   MESA_FORMAT_B8G8R8A8_UNORM,   /*         */
-   MESA_FORMAT_A8R8G8B8_UNORM,   /*         */
-   MESA_FORMAT_X8B8G8R8_UNORM,   /*         */
-   MESA_FORMAT_R8G8B8X8_UNORM,   /*         */
-   MESA_FORMAT_B8G8R8X8_UNORM,   /*         */
-   MESA_FORMAT_X8R8G8B8_UNORM,   /*         */
+   MESA_FORMAT_A8B8G8R8_UNORM,   /*         */
+   MESA_FORMAT_R8G8B8A8_UNORM,   /*         */
+   MESA_FORMAT_B8G8R8A8_UNORM,   /*         */
+   MESA_FORMAT_A8R8G8B8_UNORM,   /*         */
+   MESA_FORMAT_X8B8G8R8_UNORM,   /*         */
+   MESA_FORMAT_R8G8B8X8_UNORM,   /*         */
+   MESA_FORMAT_B8G8R8X8_UNORM,   /*         */
+   MESA_FORMAT_X8R8G8B8_UNORM,   /*         */

 /* Type A formats */
 MESA_FORMAT_BGR_UNORM8,/* uchar[i * 3] = B, [i * 3 + 1] = G, [i *3 + 
2] = R */
 MESA_FORMAT_RGB_UNORM8,/* uchar[i * 3] = R, [i * 3 + 1] = G, [i *3 + 
2] = B */

 /* Type P formats */
-   MESA_FORMAT_B5G6R5_UNORM, /*  BGGG GGGR  */
-   MESA_FORMAT_R5G6B5_UNORM, /*  RGGG GGGB  */
-   MESA_FORMAT_B4G4R4A4_UNORM,   /*     */
-   MESA_FORMAT_A4R4G4B4_UNORM,   /*     */
+   MESA_FORMAT_B5G6R5_UNORM, /*  RGGG GGGB  */
+   MESA_FORMAT_R5G6B5_UNORM, /*  BGGG GGGR  */
+   MESA_FORMAT_B4G4R4A4_UNORM,   /*     */
+   MESA_FORMAT_A4R4G4B4_UNORM,   /*     */

The unpack function, unpack_ARGB_REV, assumes    .
  Looks like a bug in the unpack function.


Yes, I'll post a patch for that.



There are some other unpack functions that do not match the format
definitions (and are noted with warnings).  Should they be fixed too,
after this patch landed?


Yes.  I could try to fix those too later, unless someone else beats me 
to it.






 MESA_FORMAT_A1B5G5R5_UNORM,   /* ABBB BBGG GGGR  */

Should be  RGGG GGBB BBBA.


Roland spotted that too.  I fixed it.

-Brian


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


[Mesa-dev] [PATCH] mesa: fix packing/unpacking for MESA_FORMAT_A4R4G4B4_UNORM

2014-03-04 Thread Brian Paul
Spotted by Chia-I Wu.
---
 src/mesa/main/format_pack.c  |2 +-
 src/mesa/main/format_unpack.c|8 
 src/mesa/swrast/s_texfetch_tmp.h |8 
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/mesa/main/format_pack.c b/src/mesa/main/format_pack.c
index 2772ff2..ee505ec 100644
--- a/src/mesa/main/format_pack.c
+++ b/src/mesa/main/format_pack.c
@@ -567,7 +567,7 @@ static void
 pack_ubyte_ARGB_REV(const GLubyte src[4], void *dst)
 {
GLushort *d = ((GLushort *) dst);
-   *d = PACK_COLOR_(src[GCOMP], src[BCOMP], src[ACOMP], src[RCOMP]);
+   *d = PACK_COLOR_(src[BCOMP], src[GCOMP], src[RCOMP], src[ACOMP]);
 }
 
 static void
diff --git a/src/mesa/main/format_unpack.c b/src/mesa/main/format_unpack.c
index 276ba55..d8bf57d 100644
--- a/src/mesa/main/format_unpack.c
+++ b/src/mesa/main/format_unpack.c
@@ -267,10 +267,10 @@ unpack_ARGB_REV(const void *src, GLfloat dst[][4], 
GLuint n)
const GLushort *s = ((const GLushort *) src);
GLuint i;
for (i = 0; i < n; i++) {
-  dst[i][RCOMP] = ((s[i]  ) & 0xf) * (1.0F / 15.0F);
-  dst[i][GCOMP] = ((s[i] >> 12) & 0xf) * (1.0F / 15.0F);
-  dst[i][BCOMP] = ((s[i] >>  8) & 0xf) * (1.0F / 15.0F);
-  dst[i][ACOMP] = ((s[i] >>  4) & 0xf) * (1.0F / 15.0F);
+  dst[i][RCOMP] = ((s[i] >>  4) & 0xf) * (1.0F / 15.0F);
+  dst[i][GCOMP] = ((s[i] >>  8) & 0xf) * (1.0F / 15.0F);
+  dst[i][BCOMP] = ((s[i] >> 12) & 0xf) * (1.0F / 15.0F);
+  dst[i][ACOMP] = ((s[i]  ) & 0xf) * (1.0F / 15.0F);
}
 }
 
diff --git a/src/mesa/swrast/s_texfetch_tmp.h b/src/mesa/swrast/s_texfetch_tmp.h
index 806f0fd..1db3adc 100644
--- a/src/mesa/swrast/s_texfetch_tmp.h
+++ b/src/mesa/swrast/s_texfetch_tmp.h
@@ -611,10 +611,10 @@ static void FETCH(f_argb_rev)( const struct 
swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
 {
const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   texel[RCOMP] = ((s  ) & 0xf) * (1.0F / 15.0F);
-   texel[GCOMP] = ((s >> 12) & 0xf) * (1.0F / 15.0F);
-   texel[BCOMP] = ((s >>  8) & 0xf) * (1.0F / 15.0F);
-   texel[ACOMP] = ((s >>  4) & 0xf) * (1.0F / 15.0F);
+   texel[RCOMP] = ((s >>  4) & 0xf) * (1.0F / 15.0F);
+   texel[GCOMP] = ((s >>  8) & 0xf) * (1.0F / 15.0F);
+   texel[BCOMP] = ((s >> 12) & 0xf) * (1.0F / 15.0F);
+   texel[ACOMP] = ((s  ) & 0xf) * (1.0F / 15.0F);
 }
 
 
-- 
1.7.10.4

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


[Mesa-dev] [PATCH] mesa: new init_teximage_fields_ms() function to init MS texture images

2014-03-04 Thread Brian Paul
Before, it was kind of ugly to set the multisample fields with
assignments after we called _mesa_init_teximage_fields().
---
 src/mesa/main/teximage.c |   44 +---
 1 file changed, 29 insertions(+), 15 deletions(-)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 0519d22..a3a7e44 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1290,16 +1290,19 @@ clear_teximage_fields(struct gl_texture_image *img)
  * \param border image border.
  * \param internalFormat internal format.
  * \param format  the actual hardware format (one of MESA_FORMAT_*)
+ * \param numSamples  number of samples per texel, or zero for non-MS.
+ * \param fixedSampleLocations  are sample locations fixed?
  *
  * Fills in the fields of \p img with the given information.
  * Note: width, height and depth include the border.
  */
-void
-_mesa_init_teximage_fields(struct gl_context *ctx,
-   struct gl_texture_image *img,
-   GLsizei width, GLsizei height, GLsizei depth,
-   GLint border, GLenum internalFormat,
-   mesa_format format)
+static void
+init_teximage_fields_ms(struct gl_context *ctx,
+struct gl_texture_image *img,
+GLsizei width, GLsizei height, GLsizei depth,
+GLint border, GLenum internalFormat,
+mesa_format format,
+GLuint numSamples, GLboolean fixedSampleLocations)
 {
GLenum target;
ASSERT(img);
@@ -1397,6 +1400,20 @@ _mesa_init_teximage_fields(struct gl_context *ctx,
   _mesa_get_tex_max_num_levels(target,
img->Width2, img->Height2, img->Depth2);
img->TexFormat = format;
+   img->NumSamples = numSamples;
+   img->FixedSampleLocations = fixedSampleLocations;
+}
+
+
+void
+_mesa_init_teximage_fields(struct gl_context *ctx,
+   struct gl_texture_image *img,
+   GLsizei width, GLsizei height, GLsizei depth,
+   GLint border, GLenum internalFormat,
+   mesa_format format)
+{
+   init_teximage_fields_ms(ctx, img, width, height, depth, border,
+   internalFormat, format, 0, GL_TRUE);
 }
 
 
@@ -4420,10 +4437,9 @@ teximagemultisample(GLuint dims, GLenum target, GLsizei 
samples,
 
if (_mesa_is_proxy_texture(target)) {
   if (dimensionsOK && sizeOK) {
- _mesa_init_teximage_fields(ctx, texImage,
-   width, height, depth, 0, internalformat, texFormat);
- texImage->NumSamples = samples;
- texImage->FixedSampleLocations = fixedsamplelocations;
+ init_teximage_fields_ms(ctx, texImage, width, height, depth, 0,
+ internalformat, texFormat,
+ samples, fixedsamplelocations);
   }
   else {
  /* clear all image fields */
@@ -4452,11 +4468,9 @@ teximagemultisample(GLuint dims, GLenum target, GLsizei 
samples,
 
   ctx->Driver.FreeTextureImageBuffer(ctx, texImage);
 
-  _mesa_init_teximage_fields(ctx, texImage,
-width, height, depth, 0, internalformat, texFormat);
-
-  texImage->NumSamples = samples;
-  texImage->FixedSampleLocations = fixedsamplelocations;
+  init_teximage_fields_ms(ctx, texImage, width, height, depth, 0,
+  internalformat, texFormat,
+  samples, fixedsamplelocations);
 
   if (width > 0 && height > 0 && depth > 0) {
  if (!ctx->Driver.AllocTextureStorage(ctx, texObj, 1,
-- 
1.7.10.4

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


Re: [Mesa-dev] [PATCH] mesa: fix packing/unpacking for MESA_FORMAT_A4R4G4B4_UNORM

2014-03-04 Thread Roland Scheidegger
Am 04.03.2014 17:10, schrieb Brian Paul:
> Spotted by Chia-I Wu.
> ---
>  src/mesa/main/format_pack.c  |2 +-
>  src/mesa/main/format_unpack.c|8 
>  src/mesa/swrast/s_texfetch_tmp.h |8 
>  3 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/src/mesa/main/format_pack.c b/src/mesa/main/format_pack.c
> index 2772ff2..ee505ec 100644
> --- a/src/mesa/main/format_pack.c
> +++ b/src/mesa/main/format_pack.c
> @@ -567,7 +567,7 @@ static void
>  pack_ubyte_ARGB_REV(const GLubyte src[4], void *dst)
>  {
> GLushort *d = ((GLushort *) dst);
> -   *d = PACK_COLOR_(src[GCOMP], src[BCOMP], src[ACOMP], src[RCOMP]);
> +   *d = PACK_COLOR_(src[BCOMP], src[GCOMP], src[RCOMP], src[ACOMP]);
>  }
>  
>  static void
> diff --git a/src/mesa/main/format_unpack.c b/src/mesa/main/format_unpack.c
> index 276ba55..d8bf57d 100644
> --- a/src/mesa/main/format_unpack.c
> +++ b/src/mesa/main/format_unpack.c
> @@ -267,10 +267,10 @@ unpack_ARGB_REV(const void *src, GLfloat dst[][4], 
> GLuint n)
> const GLushort *s = ((const GLushort *) src);
> GLuint i;
> for (i = 0; i < n; i++) {
> -  dst[i][RCOMP] = ((s[i]  ) & 0xf) * (1.0F / 15.0F);
> -  dst[i][GCOMP] = ((s[i] >> 12) & 0xf) * (1.0F / 15.0F);
> -  dst[i][BCOMP] = ((s[i] >>  8) & 0xf) * (1.0F / 15.0F);
> -  dst[i][ACOMP] = ((s[i] >>  4) & 0xf) * (1.0F / 15.0F);
> +  dst[i][RCOMP] = ((s[i] >>  4) & 0xf) * (1.0F / 15.0F);
> +  dst[i][GCOMP] = ((s[i] >>  8) & 0xf) * (1.0F / 15.0F);
> +  dst[i][BCOMP] = ((s[i] >> 12) & 0xf) * (1.0F / 15.0F);
> +  dst[i][ACOMP] = ((s[i]  ) & 0xf) * (1.0F / 15.0F);
> }
>  }
>  
> diff --git a/src/mesa/swrast/s_texfetch_tmp.h 
> b/src/mesa/swrast/s_texfetch_tmp.h
> index 806f0fd..1db3adc 100644
> --- a/src/mesa/swrast/s_texfetch_tmp.h
> +++ b/src/mesa/swrast/s_texfetch_tmp.h
> @@ -611,10 +611,10 @@ static void FETCH(f_argb_rev)( const struct 
> swrast_texture_image *texImage,
> GLint i, GLint j, GLint k, GLfloat *texel 
> )
>  {
> const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
> -   texel[RCOMP] = ((s  ) & 0xf) * (1.0F / 15.0F);
> -   texel[GCOMP] = ((s >> 12) & 0xf) * (1.0F / 15.0F);
> -   texel[BCOMP] = ((s >>  8) & 0xf) * (1.0F / 15.0F);
> -   texel[ACOMP] = ((s >>  4) & 0xf) * (1.0F / 15.0F);
> +   texel[RCOMP] = ((s >>  4) & 0xf) * (1.0F / 15.0F);
> +   texel[GCOMP] = ((s >>  8) & 0xf) * (1.0F / 15.0F);
> +   texel[BCOMP] = ((s >> 12) & 0xf) * (1.0F / 15.0F);
> +   texel[ACOMP] = ((s  ) & 0xf) * (1.0F / 15.0F);
>  }
>  
>  
> 

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


Re: [Mesa-dev] [PATCHv2 0/3] st/mesa: make winsys framebuffer sRGB-capable

2014-03-04 Thread Brian Paul

On 03/04/2014 07:31 AM, Chia-I Wu wrote:

Hi,

Until now, we do not support sRGB write for winsys framebuffers.  This series
changes that so that winsys framebuffers are marked sRGB-capable when the pipe
driver supports it.

This is not to be confused with GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB.  The
attribute guarantees the created winsys framebuffers to be sRGB-capable.  This
series is just a prerequisite if we ever want to export fbconfigs that are
sRGB-capable.

And we mark winsys framebuffers to be sRGB-capable only for desktop GL
contexts.  In GLES, sRGB capability implies sRGB write.  There is no
GL_FRAMEBUFFER_SRGB to control whether sRGB write is enabled or not.  We do
not want to surprise applications that do not expect sRGB.  This could change
when EGL_KHR_gl_colorspace is supported.

v2:
  - add MESA_FORMAT_B8G8R8X8_SRGB
  - never mark winsys framebuffer sRGB-capable for GLES contexts


The series LGTM, but you may want to wait for Michel to review/test too.

Reviewed-by: Brian Paul 


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


Re: [Mesa-dev] [PATCH] draw/llvm: fix generation of the VS with GS present

2014-03-04 Thread Roland Scheidegger
Am 04.03.2014 05:08, schrieb Zack Rusin:
> draw_current_shader_* functions return a final output when considering
> both the geometry shader and the vertex shader. But when code generating
> vertex shader we can not be using output slots from the geometry shader
> because, obviously, those can be completely different. This fixes a
> number of very non-obvious crashes.
> A side-effect of this bug was that sometimes the vertex shading code
> could save some random outputs as position/clip when the geometry
> shader was writing them and vertex shader had different outputs at
> those slots (sometimes writing garbage and sometimes something correct).
> ---
>  src/gallium/auxiliary/draw/draw_llvm.c | 14 +++---
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/src/gallium/auxiliary/draw/draw_llvm.c 
> b/src/gallium/auxiliary/draw/draw_llvm.c
> index 0bbb680..53d13f3 100644
> --- a/src/gallium/auxiliary/draw/draw_llvm.c
> +++ b/src/gallium/auxiliary/draw/draw_llvm.c
> @@ -1104,7 +1104,7 @@ generate_viewport(struct draw_llvm_variant *variant,
> int i;
> struct gallivm_state *gallivm = variant->gallivm;
> struct lp_type f32_type = vs_type;
> -   const unsigned pos = 
> draw_current_shader_position_output(variant->llvm->draw);
> +   const unsigned pos = variant->llvm->draw->vs.position_output;
> LLVMTypeRef vs_type_llvm = lp_build_vec_type(gallivm, vs_type);
> LLVMValueRef out3 = LLVMBuildLoad(builder, outputs[pos][3], ""); /*w0 w1 
> .. wn*/
> LLVMValueRef const1 = lp_build_const_vec(gallivm, f32_type, 1.0);   
> /*1.0 1.0 1.0 1.0*/
> @@ -1173,14 +1173,14 @@ generate_clipmask(struct draw_llvm *llvm,
> LLVMValueRef plane1, planes, plane_ptr, sum;
> struct lp_type f32_type = vs_type;
> struct lp_type i32_type = lp_int_type(vs_type);
> -   const unsigned pos = draw_current_shader_position_output(llvm->draw);
> -   const unsigned cv = draw_current_shader_clipvertex_output(llvm->draw);
> +   const unsigned pos = llvm->draw->vs.position_output;
> +   const unsigned cv = llvm->draw->vs.clipvertex_output;
> int num_written_clipdistance = 
> llvm->draw->vs.vertex_shader->info.num_written_clipdistance;
> bool have_cd = false;
> unsigned cd[2];
>  
> -   cd[0] = draw_current_shader_clipdistance_output(llvm->draw, 0);
> -   cd[1] = draw_current_shader_clipdistance_output(llvm->draw, 1);
> +   cd[0] = llvm->draw->vs.clipdistance_output[0];
> +   cd[1] = llvm->draw->vs.clipdistance_output[1];
>  
> if (cd[0] != pos || cd[1] != pos)
>have_cd = true;
> @@ -1551,8 +1551,8 @@ draw_llvm_generate(struct draw_llvm *llvm, struct 
> draw_llvm_variant *variant,
> key->clip_z  ||
> key->clip_user);
> LLVMValueRef variant_func;
> -   const unsigned pos = draw_current_shader_position_output(llvm->draw);
> -   const unsigned cv = draw_current_shader_clipvertex_output(llvm->draw);
> +   const unsigned pos = llvm->draw->vs.position_output;
> +   const unsigned cv = llvm->draw->vs.clipvertex_output;
> boolean have_clipdist = FALSE;
> struct lp_bld_tgsi_system_values system_values;
>  
> 

Both patches make sense to me, good catch!

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


[Mesa-dev] [PATCH v2] radeon: Use upload manager for buffer downloads

2014-03-04 Thread Niels Ole Salscheider
Using DMA for reads is much faster.

Signed-off-by: Niels Ole Salscheider 
---
 src/gallium/drivers/radeon/r600_buffer_common.c | 78 +++--
 1 file changed, 60 insertions(+), 18 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c 
b/src/gallium/drivers/radeon/r600_buffer_common.c
index 340ebb2..ed3a08c 100644
--- a/src/gallium/drivers/radeon/r600_buffer_common.c
+++ b/src/gallium/drivers/radeon/r600_buffer_common.c
@@ -260,6 +260,46 @@ static void *r600_buffer_transfer_map(struct pipe_context 
*ctx,
/* At this point, the buffer is always idle (we checked it 
above). */
usage |= PIPE_TRANSFER_UNSYNCHRONIZED;
}
+   /* Using DMA for larger reads is much faster */
+   else if ((usage & PIPE_TRANSFER_READ) &&
+!(usage & PIPE_TRANSFER_WRITE) &&
+(rbuffer->domains == RADEON_DOMAIN_VRAM) &&
+(rscreen->has_cp_dma ||
+ (rscreen->has_streamout &&
+  /* The buffer range must be aligned to 4 with streamout. */
+  box->x % 4 == 0 && box->width % 4 == 0))) {
+   unsigned offset;
+   struct r600_resource *staging = NULL;
+
+   u_upload_alloc(rctx->uploader, 0,
+  box->width + (box->x % 
R600_MAP_BUFFER_ALIGNMENT),
+  &offset, (struct pipe_resource**)&staging, 
(void**)&data);
+
+   if (staging) {
+   data += box->x % R600_MAP_BUFFER_ALIGNMENT;
+
+   /* Copy the staging buffer into the original one. */
+   if (rctx->dma_copy(ctx, (struct pipe_resource*)staging, 
0,
+box->x % 
R600_MAP_BUFFER_ALIGNMENT,
+0, 0, resource, level, box)) {
+   rctx->rings.gfx.flush(rctx, 0);
+   if (rctx->rings.dma.cs)
+   rctx->rings.dma.flush(rctx, 0);
+
+   /* Wait for any offloaded CS flush to complete
+* to avoid busy-waiting in the winsys. */
+   rctx->ws->cs_sync_flush(rctx->rings.gfx.cs);
+   if (rctx->rings.dma.cs)
+   
rctx->ws->cs_sync_flush(rctx->rings.dma.cs);
+
+   rctx->ws->buffer_wait(staging->buf, 
RADEON_USAGE_READ);
+   return r600_buffer_get_transfer(ctx, resource, 
level, usage, box,
+   ptransfer, 
data, staging, offset);
+   } else {
+   pipe_resource_reference((struct 
pipe_resource**)&staging, NULL);
+   }
+   }
+   }
 
data = r600_buffer_map_sync_with_rings(rctx, rbuffer, usage);
if (!data) {
@@ -279,24 +319,26 @@ static void r600_buffer_transfer_unmap(struct 
pipe_context *ctx,
struct r600_resource *rbuffer = r600_resource(transfer->resource);
 
if (rtransfer->staging) {
-   struct pipe_resource *dst, *src;
-   unsigned soffset, doffset, size;
-   struct pipe_box box;
-
-   dst = transfer->resource;
-   src = &rtransfer->staging->b.b;
-   size = transfer->box.width;
-   doffset = transfer->box.x;
-   soffset = rtransfer->offset + transfer->box.x % 
R600_MAP_BUFFER_ALIGNMENT;
-
-   u_box_1d(soffset, size, &box);
-
-   /* Copy the staging buffer into the original one. */
-   if (!(size % 4) && !(doffset % 4) && !(soffset % 4) &&
-   rctx->dma_copy(ctx, dst, 0, doffset, 0, 0, src, 0, &box)) {
-   /* DONE. */
-   } else {
-   ctx->resource_copy_region(ctx, dst, 0, doffset, 0, 0, 
src, 0, &box);
+   if (rtransfer->transfer.usage & PIPE_TRANSFER_WRITE) {
+   struct pipe_resource *dst, *src;
+   unsigned soffset, doffset, size;
+   struct pipe_box box;
+
+   dst = transfer->resource;
+   src = &rtransfer->staging->b.b;
+   size = transfer->box.width;
+   doffset = transfer->box.x;
+   soffset = rtransfer->offset + transfer->box.x % 
R600_MAP_BUFFER_ALIGNMENT;
+
+   u_box_1d(soffset, size, &box);
+
+   /* Copy the staging buffer into the original one. */
+   if (!(size % 4) && !(doffset % 4) && !(soffset % 4) &&
+   rctx->dma_copy(ctx, dst, 0, doffset, 0, 0, src, 0, 
&box)) {
+   /* DONE. */
+   } else {
+   

Re: [Mesa-dev] [PATCH 0/2] radeon: Use the DMA engine for buffer downloads

2014-03-04 Thread Niels Ole Salscheider
> Could you please do this without changing u_upload_mgr? You can still
> use u_upload_alloc to allocate buffer memory in the driver and the map
> buffer read/write flags are not important with persistent coherent
> buffer mappings anyway.

I have sent an updated patch to the list.

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


Re: [Mesa-dev] [PATCH] draw/llvm: fix generation of the VS with GS present

2014-03-04 Thread Matthew McClure
Looks good to me too!

Reviewed-by: Matthew McClure 

Matthew

- Original Message -
From: "Roland Scheidegger" 
To: "Zack Rusin" , mesa-dev@lists.freedesktop.org
Cc: jfons...@vmware.com, mcclu...@vmware.com
Sent: Tuesday, March 4, 2014 8:57:30 AM
Subject: Re: [PATCH] draw/llvm: fix generation of the VS with GS present

Am 04.03.2014 05:08, schrieb Zack Rusin:
> draw_current_shader_* functions return a final output when considering
> both the geometry shader and the vertex shader. But when code generating
> vertex shader we can not be using output slots from the geometry shader
> because, obviously, those can be completely different. This fixes a
> number of very non-obvious crashes.
> A side-effect of this bug was that sometimes the vertex shading code
> could save some random outputs as position/clip when the geometry
> shader was writing them and vertex shader had different outputs at
> those slots (sometimes writing garbage and sometimes something correct).
> ---
>  src/gallium/auxiliary/draw/draw_llvm.c | 14 +++---
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/src/gallium/auxiliary/draw/draw_llvm.c 
> b/src/gallium/auxiliary/draw/draw_llvm.c
> index 0bbb680..53d13f3 100644
> --- a/src/gallium/auxiliary/draw/draw_llvm.c
> +++ b/src/gallium/auxiliary/draw/draw_llvm.c
> @@ -1104,7 +1104,7 @@ generate_viewport(struct draw_llvm_variant *variant,
> int i;
> struct gallivm_state *gallivm = variant->gallivm;
> struct lp_type f32_type = vs_type;
> -   const unsigned pos = 
> draw_current_shader_position_output(variant->llvm->draw);
> +   const unsigned pos = variant->llvm->draw->vs.position_output;
> LLVMTypeRef vs_type_llvm = lp_build_vec_type(gallivm, vs_type);
> LLVMValueRef out3 = LLVMBuildLoad(builder, outputs[pos][3], ""); /*w0 w1 
> .. wn*/
> LLVMValueRef const1 = lp_build_const_vec(gallivm, f32_type, 1.0);   
> /*1.0 1.0 1.0 1.0*/
> @@ -1173,14 +1173,14 @@ generate_clipmask(struct draw_llvm *llvm,
> LLVMValueRef plane1, planes, plane_ptr, sum;
> struct lp_type f32_type = vs_type;
> struct lp_type i32_type = lp_int_type(vs_type);
> -   const unsigned pos = draw_current_shader_position_output(llvm->draw);
> -   const unsigned cv = draw_current_shader_clipvertex_output(llvm->draw);
> +   const unsigned pos = llvm->draw->vs.position_output;
> +   const unsigned cv = llvm->draw->vs.clipvertex_output;
> int num_written_clipdistance = 
> llvm->draw->vs.vertex_shader->info.num_written_clipdistance;
> bool have_cd = false;
> unsigned cd[2];
>  
> -   cd[0] = draw_current_shader_clipdistance_output(llvm->draw, 0);
> -   cd[1] = draw_current_shader_clipdistance_output(llvm->draw, 1);
> +   cd[0] = llvm->draw->vs.clipdistance_output[0];
> +   cd[1] = llvm->draw->vs.clipdistance_output[1];
>  
> if (cd[0] != pos || cd[1] != pos)
>have_cd = true;
> @@ -1551,8 +1551,8 @@ draw_llvm_generate(struct draw_llvm *llvm, struct 
> draw_llvm_variant *variant,
> key->clip_z  ||
> key->clip_user);
> LLVMValueRef variant_func;
> -   const unsigned pos = draw_current_shader_position_output(llvm->draw);
> -   const unsigned cv = draw_current_shader_clipvertex_output(llvm->draw);
> +   const unsigned pos = llvm->draw->vs.position_output;
> +   const unsigned cv = llvm->draw->vs.clipvertex_output;
> boolean have_clipdist = FALSE;
> struct lp_bld_tgsi_system_values system_values;
>  
> 

Both patches make sense to me, good catch!

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


Re: [Mesa-dev] [PATCH] mesa/main: add ARB_clear_texture entrypoints

2014-03-04 Thread Ilia Mirkin
On Tue, Mar 4, 2014 at 2:14 AM, Ian Romanick  wrote:
> On 03/02/2014 12:09 AM, Ilia Mirkin wrote:
>>
>> This adds enough code to let drivers implement texture clearing, but
>> doesn't actually do that for any of them.
>
>
> There's always the usual... this should be split into two patches. :)
> Generally the changes in gl_API, dispatch_sanity, and "stub" functions is
> the first patch.  Changes to dd.h is a patch.  Implementing the functions is
> a third.

OK, will do.

>
>
>>
>> Signed-off-by: Ilia Mirkin 
>> ---
>>
>> Thought I'd give this a shot. Am I on the right track here? Is the dd API
>> reasonable? I haven't written a piglit test for all the "generic" error
>> cases
>> yet, but I'll get to that in a bit. I'm a little confused between all the
>> different formats on a teximage... BaseFormat appears to be some
>> generalization of the format, but what's the difference between
>> InternalFormat
>> and TexFormat? Just the type, but otherwise equivalent? Or are they
>> representing different things?
>
>
> BaseFormat is the generic format.  So, GL_RGB or GL_RED are the base formats
> that go with GL_RGB8 or GL_RED16.  internalFormat is usually the GL format
> (e.g., GL_RGBA32F), and TexFormat is usually the Mesa format (e.g.,
> MESA_FORMAT_RGBA_FLOAT32).

So TexFormat == InternalFormat, right? (Just different types)

>
>
>> BTW, this is the first time I'm adding stuff to mesa/main, so forgive me
>> if I
>> left out a step.
>>
>>   src/mapi/glapi/gen/ARB_clear_texture.xml |  34 
>>   src/mapi/glapi/gen/gl_API.xml|   2 +
>>   src/mesa/main/dd.h   |  11 +++
>>   src/mesa/main/formatquery.c  |   9 +++
>>   src/mesa/main/mtypes.h   |   1 +
>>   src/mesa/main/tests/dispatch_sanity.cpp  |   4 +
>>   src/mesa/main/teximage.c | 131
>> +++
>>   src/mesa/main/teximage.h |  10 +++
>>   8 files changed, 202 insertions(+)
>>   create mode 100644 src/mapi/glapi/gen/ARB_clear_texture.xml
>>
>> diff --git a/src/mapi/glapi/gen/ARB_clear_texture.xml
>> b/src/mapi/glapi/gen/ARB_clear_texture.xml
>> new file mode 100644
>> index 000..bd9116f
>> --- /dev/null
>> +++ b/src/mapi/glapi/gen/ARB_clear_texture.xml
>> @@ -0,0 +1,34 @@
>> +
>> +
>> +
>> +
>> +
>> +
>> +
>> +
>> +
>> +
>> +
>> +
>> +
>> +
>> +
>> +
>> +
>> +
>> +
>> +
>> +
>> +
>> +
>> +
>> +
>> +
>> +
>> +
>> +
>> +
>> +
>> +
>> +
>> +
>> diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml
>> index 7e1946e..15f8e32 100644
>> --- a/src/mapi/glapi/gen/gl_API.xml
>> +++ b/src/mapi/glapi/gen/gl_API.xml
>> @@ -8515,6 +8515,8 @@
>>   
>>   
>>
>> +> xmlns:xi="http://www.w3.org/2001/XInclude"/>
>> +
>>   
>>
>>   
>> diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
>> index 9715241..d824bca 100644
>> --- a/src/mesa/main/dd.h
>> +++ b/src/mesa/main/dd.h
>> @@ -275,6 +275,17 @@ struct dd_function_table {
>> GLint level, mesa_format format,
>> GLint width, GLint height,
>> GLint depth, GLint border);
>> +
>> +
>> +   void (*ClearTexSubImage)(struct gl_context *ctx,
>> +struct gl_texture_image *texImage,
>> +GLint xoffset, GLint yoffset, GLint zoffset,
>> +GLsizei width, GLsizei height, GLsizei depth,
>> +GLenum format, GLenum type, const GLvoid
>> *data);
>> +
>> +   GLenum (*QuerySupportForClearTex)(struct gl_context *ctx,
>> + GLenum internalFormat);
>
>
> I think I'd rather add a generic query function. GL_ARB_query_internalformt2
> add a large number of target/internalFormat/pname queries.  I'm having
> difficulty deciding whether it's better to just pipe this interface directly
> into the driver or use something slightly more abstract.  Maybe add a
> function like
>
> GLenum (*QueryFormatSupport)(struct gl_context *ctx,
>  GLenum internalFormat,
>  GLenum pname);

Others have also pointed out to me that query2 isn't supported, so I'm
just going to drop it for now.

>
>
>
>> +
>>  /*@}*/
>>
>>
>> diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c
>> index 40eca87..7997cb4 100644
>> --- a/src/mesa/main/formatquery.c
>> +++ b/src/mesa/main/formatquery.c
>> @@ -140,6 +140,15 @@ _mesa_GetInternalformativ(GLenum target, GLenum
>> internalformat, GLenum pname,
>> count = 1;
>> break;
>>  }
>> +   case GL_CLEAR_TEXTURE:
>> +  if (ctx->Extensions.ARB_clear_texture) {
>> + const GLenum support = ctx->Driver.QuerySupportForClearTex(
>> +   ctx, internalformat);
>> + buffer[0] = (GLint

[Mesa-dev] [Bug 75751] egl_gallium always requires libdrm

2014-03-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=75751

--- Comment #4 from Kenneth Graunke  ---
That's what --with-dri-drivers='' does.  So presumably --disable-dri does
something else.

-- 
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


Re: [Mesa-dev] [PATCH] mesa: new init_teximage_fields_ms() function to init MS texture images

2014-03-04 Thread Anuj Phogat
On Tue, Mar 4, 2014 at 8:13 AM, Brian Paul  wrote:
> Before, it was kind of ugly to set the multisample fields with
> assignments after we called _mesa_init_teximage_fields().
> ---
>  src/mesa/main/teximage.c |   44 +---
>  1 file changed, 29 insertions(+), 15 deletions(-)
>
> diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
> index 0519d22..a3a7e44 100644
> --- a/src/mesa/main/teximage.c
> +++ b/src/mesa/main/teximage.c
> @@ -1290,16 +1290,19 @@ clear_teximage_fields(struct gl_texture_image *img)
>   * \param border image border.
>   * \param internalFormat internal format.
>   * \param format  the actual hardware format (one of MESA_FORMAT_*)
> + * \param numSamples  number of samples per texel, or zero for non-MS.
> + * \param fixedSampleLocations  are sample locations fixed?
>   *
>   * Fills in the fields of \p img with the given information.
>   * Note: width, height and depth include the border.
>   */
> -void
> -_mesa_init_teximage_fields(struct gl_context *ctx,
> -   struct gl_texture_image *img,
> -   GLsizei width, GLsizei height, GLsizei depth,
> -   GLint border, GLenum internalFormat,
> -   mesa_format format)
> +static void
> +init_teximage_fields_ms(struct gl_context *ctx,
> +struct gl_texture_image *img,
> +GLsizei width, GLsizei height, GLsizei depth,
> +GLint border, GLenum internalFormat,
> +mesa_format format,
> +GLuint numSamples, GLboolean fixedSampleLocations)
>  {
> GLenum target;
> ASSERT(img);
> @@ -1397,6 +1400,20 @@ _mesa_init_teximage_fields(struct gl_context *ctx,
>_mesa_get_tex_max_num_levels(target,
> img->Width2, img->Height2, img->Depth2);
> img->TexFormat = format;
> +   img->NumSamples = numSamples;
> +   img->FixedSampleLocations = fixedSampleLocations;
> +}
> +
> +
> +void
> +_mesa_init_teximage_fields(struct gl_context *ctx,
> +   struct gl_texture_image *img,
> +   GLsizei width, GLsizei height, GLsizei depth,
> +   GLint border, GLenum internalFormat,
> +   mesa_format format)
> +{
> +   init_teximage_fields_ms(ctx, img, width, height, depth, border,
> +   internalFormat, format, 0, GL_TRUE);
>  }
>
>
> @@ -4420,10 +4437,9 @@ teximagemultisample(GLuint dims, GLenum target, 
> GLsizei samples,
>
> if (_mesa_is_proxy_texture(target)) {
>if (dimensionsOK && sizeOK) {
> - _mesa_init_teximage_fields(ctx, texImage,
> -   width, height, depth, 0, internalformat, texFormat);
> - texImage->NumSamples = samples;
> - texImage->FixedSampleLocations = fixedsamplelocations;
> + init_teximage_fields_ms(ctx, texImage, width, height, depth, 0,
> + internalformat, texFormat,
> + samples, fixedsamplelocations);
>}
>else {
>   /* clear all image fields */
> @@ -4452,11 +4468,9 @@ teximagemultisample(GLuint dims, GLenum target, 
> GLsizei samples,
>
>ctx->Driver.FreeTextureImageBuffer(ctx, texImage);
>
> -  _mesa_init_teximage_fields(ctx, texImage,
> -width, height, depth, 0, internalformat, texFormat);
> -
> -  texImage->NumSamples = samples;
> -  texImage->FixedSampleLocations = fixedsamplelocations;
> +  init_teximage_fields_ms(ctx, texImage, width, height, depth, 0,
> +  internalformat, texFormat,
> +  samples, fixedsamplelocations);
>
>if (width > 0 && height > 0 && depth > 0) {
>   if (!ctx->Driver.AllocTextureStorage(ctx, texObj, 1,
> --
> 1.7.10.4
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


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


Re: [Mesa-dev] [PATCH] i965: Enable EWA anisotropic filtering algorithm

2014-03-04 Thread Anuj Phogat
On Tue, Mar 4, 2014 at 1:08 AM, Ian Romanick  wrote:
> From: Ian Romanick 
>
> Volume 4, part 1 of the Ivybridge PRM says, "Generally, the EWA
> approximation algorithm results in higher image quality than the legacy
> algorithm."  Using a classic anisotropic filtering "tunnel" demo, it
> appears that there is *no* anisotropic filtering on IVB without this bit
> set.
So, the legacy algorithm for anisotropic filtering doesn't work. Do you
suspect a hardware bug?
>
> Signed-off-by: Ian Romanick 
> Cc: Eero Tamminen 
> ---
>  src/mesa/drivers/dri/i965/gen7_sampler_state.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/src/mesa/drivers/dri/i965/gen7_sampler_state.c 
> b/src/mesa/drivers/dri/i965/gen7_sampler_state.c
> index 968c410..709a783 100644
> --- a/src/mesa/drivers/dri/i965/gen7_sampler_state.c
> +++ b/src/mesa/drivers/dri/i965/gen7_sampler_state.c
> @@ -82,6 +82,7 @@ gen7_update_sampler_state(struct brw_context *brw, int 
> unit, int ss_index,
> if (gl_sampler->MaxAnisotropy > 1.0) {
>sampler->ss0.min_filter = BRW_MAPFILTER_ANISOTROPIC;
>sampler->ss0.mag_filter = BRW_MAPFILTER_ANISOTROPIC;
> +  sampler->ss0.aniso_algorithm = 1;
>
>if (gl_sampler->MaxAnisotropy > 2.0) {
>  sampler->ss3.max_aniso = MIN2((gl_sampler->MaxAnisotropy - 2) / 2,
> --
> 1.8.1.4
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev

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


[Mesa-dev] [PATCH 01/20] automake: use MKDIR_P when possible

2014-03-04 Thread Emil Velikov
Use the automake predefined macro over hardcoding mkdir -p everywhere.

Signed-off-by: Emil Velikov 
---
 src/mapi/glapi/gen/glapi_gen.mk | 6 +++---
 src/mesa/drivers/dri/common/xmlpool/Makefile.am | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mapi/glapi/gen/glapi_gen.mk b/src/mapi/glapi/gen/glapi_gen.mk
index 242ae5f..726d19e 100644
--- a/src/mapi/glapi/gen/glapi_gen.mk
+++ b/src/mapi/glapi/gen/glapi_gen.mk
@@ -12,7 +12,7 @@ glapi_gen_mapi_deps := \
 # $(1): path to an XML file
 # $(2): name of the printer
 define glapi_gen_mapi
-@mkdir -p $(dir $@)
+@$(MKDIR_P) $(dir $@)
 $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS) $(glapi_gen_mapi_script) \
--mode lib --printer $(2) $(1) > $@
 endef
@@ -23,7 +23,7 @@ glapi_gen_dispatch_deps := $(glapi_gen_common_deps)
 # $(1): path to an XML file
 # $(2): empty, es1, or es2 for entry point filtering
 define glapi_gen_dispatch
-@mkdir -p $(dir $@)
+@(MKDIR_P) $(dir $@)
 $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS) $(glapi_gen_dispatch_script) \
-f $(1) -m remap_table $(if $(2),-c $(2),) > $@
 endef
@@ -34,7 +34,7 @@ glapi_gen_remap_deps := $(glapi_gen_common_deps)
 # $(1): path to an XML file
 # $(2): empty, es1, or es2 for entry point filtering
 define glapi_gen_remap
-@mkdir -p $(dir $@)
+@(MKDIR_P) $(dir $@)
 $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS) $(glapi_gen_remap_script) \
-f $(1) $(if $(2),-c $(2),) > $@
 endef
diff --git a/src/mesa/drivers/dri/common/xmlpool/Makefile.am 
b/src/mesa/drivers/dri/common/xmlpool/Makefile.am
index 0908c82..57e6048 100644
--- a/src/mesa/drivers/dri/common/xmlpool/Makefile.am
+++ b/src/mesa/drivers/dri/common/xmlpool/Makefile.am
@@ -69,7 +69,7 @@ options.h: t_options.h $(MOS)
@mo="$@"; \
lang=$${mo%%/*}; \
echo "Updating ($$lang) $@ from $?."; \
-   mkdir -p $$lang/LC_MESSAGES; \
+   $(MKDIR_P) $$lang/LC_MESSAGES; \
msgfmt -o $@ $?
 
 # Use this target to create or update .po files with new messages in
-- 
1.9.0

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


[Mesa-dev] [PATCH 00/20] Automake cleanups and Cygwin fixes

2014-03-04 Thread Emil Velikov
Hi all,

An interesting cleanup series inspired by Jon Turney's tinderbox.

Highlights:
 - Cleanup unused configure.ac variables dating from the static makefile days.
 - Use platform specific library extension for links generation.
 - Move all the link generation in three files.
 - Make check fix when building without direct rendering.
 - A few cosmetic configure.ac fixes.
 - And last but not least, always build mesa shared. Most of the build system
assumed that already, so update the warning messages, and cleanup configure.

An interesting point brought my Jon, is that Cygwin needs to link all the dri
drivers agaist libglapi, which mesa explicitly does not do. AFAICS the idea
is that the correct glapi should be loaded (statically or dl_open'ed) by the
GL provider prior to managing the dri.

Does anyone know the reason behind this ?

The series can be found in the cygwin-fixes branch in my repo at
https://github.com/evelikov/Mesa/

Review and comments are greatly appreciated.

Thanks
Emil

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


[Mesa-dev] [PATCH 04/20] automake: make install-lib-links less chatty

2014-03-04 Thread Emil Velikov
There is little point in echoing everything that the script does
to stdout. Wrap it in AM_V_GEN so that a reasonable message is
printed as a indication of it's invocation.

Signed-off-by: Emil Velikov 
---
 install-lib-links.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/install-lib-links.mk b/install-lib-links.mk
index 73d9e14..9dd4c30 100644
--- a/install-lib-links.mk
+++ b/install-lib-links.mk
@@ -4,7 +4,7 @@
 all-local : .libs/install-mesa-links
 
 .libs/install-mesa-links : $(lib_LTLIBRARIES)
-   $(MKDIR_P) $(top_builddir)/$(LIB_DIR)
+   $(AM_V_GEN)$(MKDIR_P) $(top_builddir)/$(LIB_DIR);   \
for f in $(lib_LTLIBRARIES:%.la=.libs/%.so*); do\
if test -h .libs/$$f; then  \
cp -d $$f $(top_builddir)/$(LIB_DIR);   \
-- 
1.9.0

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


[Mesa-dev] [PATCH 03/20] automake: use only the folder name if it's a subfolder of the present one

2014-03-04 Thread Emil Velikov
Signed-off-by: Emil Velikov 
---
 src/glsl/Makefile.am | 4 ++--
 src/mesa/Makefile.am | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/glsl/Makefile.am b/src/glsl/Makefile.am
index 528f6f8..9f1507e 100644
--- a/src/glsl/Makefile.am
+++ b/src/glsl/Makefile.am
@@ -178,11 +178,11 @@ glsl_lexer.cpp: glsl_lexer.ll
$(AM_V_LEX) $(LEX) $(LFLAGS) -o $@ $<
 
 glcpp/glcpp-parse.c glcpp/glcpp-parse.h: glcpp/glcpp-parse.y
-   @$(MKDIR_P) $(GLSL_BUILDDIR)/glcpp
+   @$(MKDIR_P) glcpp
$(AM_V_YACC) $(YACC) $(YFLAGS) -o $@ -p "glcpp_parser_" 
--defines=$(GLSL_BUILDDIR)/glcpp/glcpp-parse.h $<
 
 glcpp/glcpp-lex.c: glcpp/glcpp-lex.l
-   @$(MKDIR_P) $(GLSL_BUILDDIR)/glcpp
+   @$(MKDIR_P) glcpp
$(AM_V_LEX) $(LEX) $(LFLAGS) -o $@ $<
 
 # Only the parsers (specifically the header files generated at the same time)
diff --git a/src/mesa/Makefile.am b/src/mesa/Makefile.am
index bda9851..5577868 100644
--- a/src/mesa/Makefile.am
+++ b/src/mesa/Makefile.am
@@ -150,11 +150,11 @@ pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = gl.pc
 
 $(BUILDDIR)program/lex.yy.c: program/program_lexer.l
-   @$(MKDIR_P) $(builddir)/program
+   @$(MKDIR_P) program
$(AM_V_GEN) $(LEX) --never-interactive --outfile=$@ $<
 
 $(BUILDDIR)program/program_parse.tab.c $(BUILDDIR)program/program_parse.tab.h: 
program/program_parse.y
-   @$(MKDIR_P) $(builddir)/program
+   @$(MKDIR_P) program
$(AM_V_GEN) $(YACC) -p "_mesa_program_" -v -d 
--output=$(BUILDDIR)program/program_parse.tab.c $<
 
 if GEN_ASM_OFFSETS
-- 
1.9.0

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


[Mesa-dev] [PATCH 05/20] automake: use install-lib-links.mk across all classic mesa

2014-03-04 Thread Emil Velikov
Use the handy script and minimise the boilerplate in the makefiles.

Signed-off-by: Emil Velikov 
---
 src/egl/wayland/wayland-egl/Makefile.am | 2 ++
 src/mesa/drivers/osmesa/Makefile.am | 8 +---
 src/mesa/drivers/x11/Makefile.am| 7 +--
 3 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/src/egl/wayland/wayland-egl/Makefile.am 
b/src/egl/wayland/wayland-egl/Makefile.am
index 6e92b29..c8d0196 100644
--- a/src/egl/wayland/wayland-egl/Makefile.am
+++ b/src/egl/wayland/wayland-egl/Makefile.am
@@ -11,3 +11,5 @@ libwayland_egl_la_SOURCES = wayland-egl.c
 libwayland_egl_la_LDFLAGS = -version-info 1
 
 TESTS = wayland-egl-symbols-check
+
+include $(top_srcdir)/install-lib-links.mk
diff --git a/src/mesa/drivers/osmesa/Makefile.am 
b/src/mesa/drivers/osmesa/Makefile.am
index 4935335..2fdd6fd 100644
--- a/src/mesa/drivers/osmesa/Makefile.am
+++ b/src/mesa/drivers/osmesa/Makefile.am
@@ -48,13 +48,7 @@ lib@OSMESA_LIB@_la_LIBADD = \
$(OSMESA_LIB_DEPS)
 
 if BUILD_SHARED
-# Provide compatibility with scripts for the old Mesa build system for
-# a while by putting a link to the driver into /lib of the build tree.
-all-local: lib@OSMESA_LIB@.la
-   $(MKDIR_P) $(top_builddir)/$(LIB_DIR);
-   ln -f .libs/lib@OSMESA_LIB@.so 
$(top_builddir)/$(LIB_DIR)/lib@OSMESA_LIB@.so;
-   ln -f .libs/lib@OSMESA_LIB@.so.@OSMESA_VERSION@ 
$(top_builddir)/$(LIB_DIR)/lib@OSMESA_LIB@.so.@OSMESA_VERSION@;
-   ln -f .libs/lib@OSMESA_LIB@.so.@OSMESA_VERSION@.0.0 
$(top_builddir)/$(LIB_DIR)/
+include $(top_srcdir)/install-lib-links.mk
 endif
 
 pkgconfigdir = $(libdir)/pkgconfig
diff --git a/src/mesa/drivers/x11/Makefile.am b/src/mesa/drivers/x11/Makefile.am
index 32bd385..3f3a24b 100644
--- a/src/mesa/drivers/x11/Makefile.am
+++ b/src/mesa/drivers/x11/Makefile.am
@@ -65,10 +65,5 @@ lib@GL_LIB@_la_LDFLAGS = \
$(GL_LIB_DEPS)
 
 if BUILD_SHARED
-# Provide compatibility with scripts for the old Mesa build system for
-# a while by putting a link to the driver into /lib of the build tree.
-all-local: lib@GL_LIB@.la
-   $(MKDIR_P) $(top_builddir)/$(LIB_DIR);
-   ln -f .libs/lib@GL_LIB@.so.$(GL_MAJOR).$(GL_MINOR).$(GL_PATCH) 
$(top_builddir)/$(LIB_DIR)/lib@GL_LIB@.so.$(GL_MAJOR)
-   ln -sf lib@GL_LIB@.so.$(GL_MAJOR) 
$(top_builddir)/$(LIB_DIR)/lib@GL_LIB@.so
+include $(top_srcdir)/install-lib-links.mk
 endif
-- 
1.9.0

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


[Mesa-dev] [PATCH 02/20] automake: silence folder creation

2014-03-04 Thread Emil Velikov
There is little gain in printing whenever a folder is created.

Signed-off-by: Emil Velikov 
---
 src/gallium/auxiliary/Makefile.am | 8 
 src/glsl/Makefile.am  | 4 ++--
 src/mesa/Makefile.am  | 4 ++--
 src/mesa/drivers/dri/Makefile.am  | 2 +-
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/gallium/auxiliary/Makefile.am 
b/src/gallium/auxiliary/Makefile.am
index 2d2d8d4..afeeef9 100644
--- a/src/gallium/auxiliary/Makefile.am
+++ b/src/gallium/auxiliary/Makefile.am
@@ -32,17 +32,17 @@ libgallium_la_SOURCES += \
 endif
 
 indices/u_indices_gen.c: $(srcdir)/indices/u_indices_gen.py
-   $(MKDIR_P) indices
+   @$(MKDIR_P) indices
$(AM_V_GEN) $(PYTHON2) $< > $@
 
 indices/u_unfilled_gen.c: $(srcdir)/indices/u_unfilled_gen.py
-   $(MKDIR_P) indices
+   @$(MKDIR_P) indices
$(AM_V_GEN) $(PYTHON2) $< > $@
 
 util/u_format_srgb.c: $(srcdir)/util/u_format_srgb.py
-   $(MKDIR_P) util
+   @$(MKDIR_P) util
$(AM_V_GEN) $(PYTHON2) $< > $@
 
 util/u_format_table.c: $(srcdir)/util/u_format_table.py 
$(srcdir)/util/u_format_pack.py $(srcdir)/util/u_format_parse.py 
$(srcdir)/util/u_format.csv
-   $(MKDIR_P) util
+   @$(MKDIR_P) util
$(AM_V_GEN) $(PYTHON2) $(srcdir)/util/u_format_table.py 
$(srcdir)/util/u_format.csv > $@
diff --git a/src/glsl/Makefile.am b/src/glsl/Makefile.am
index 27e180e..528f6f8 100644
--- a/src/glsl/Makefile.am
+++ b/src/glsl/Makefile.am
@@ -178,11 +178,11 @@ glsl_lexer.cpp: glsl_lexer.ll
$(AM_V_LEX) $(LEX) $(LFLAGS) -o $@ $<
 
 glcpp/glcpp-parse.c glcpp/glcpp-parse.h: glcpp/glcpp-parse.y
-   $(MKDIR_P) $(GLSL_BUILDDIR)/glcpp
+   @$(MKDIR_P) $(GLSL_BUILDDIR)/glcpp
$(AM_V_YACC) $(YACC) $(YFLAGS) -o $@ -p "glcpp_parser_" 
--defines=$(GLSL_BUILDDIR)/glcpp/glcpp-parse.h $<
 
 glcpp/glcpp-lex.c: glcpp/glcpp-lex.l
-   $(MKDIR_P) $(GLSL_BUILDDIR)/glcpp
+   @$(MKDIR_P) $(GLSL_BUILDDIR)/glcpp
$(AM_V_LEX) $(LEX) $(LFLAGS) -o $@ $<
 
 # Only the parsers (specifically the header files generated at the same time)
diff --git a/src/mesa/Makefile.am b/src/mesa/Makefile.am
index ffe6599..bda9851 100644
--- a/src/mesa/Makefile.am
+++ b/src/mesa/Makefile.am
@@ -150,11 +150,11 @@ pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = gl.pc
 
 $(BUILDDIR)program/lex.yy.c: program/program_lexer.l
-   $(MKDIR_P) $(builddir)/program
+   @$(MKDIR_P) $(builddir)/program
$(AM_V_GEN) $(LEX) --never-interactive --outfile=$@ $<
 
 $(BUILDDIR)program/program_parse.tab.c $(BUILDDIR)program/program_parse.tab.h: 
program/program_parse.y
-   $(MKDIR_P) $(builddir)/program
+   @$(MKDIR_P) $(builddir)/program
$(AM_V_GEN) $(YACC) -p "_mesa_program_" -v -d 
--output=$(BUILDDIR)program/program_parse.tab.c $<
 
 if GEN_ASM_OFFSETS
diff --git a/src/mesa/drivers/dri/Makefile.am b/src/mesa/drivers/dri/Makefile.am
index a85a5aa..18f880a 100644
--- a/src/mesa/drivers/dri/Makefile.am
+++ b/src/mesa/drivers/dri/Makefile.am
@@ -67,7 +67,7 @@ dri_LTLIBRARIES = mesa_dri_drivers.la
 
 # Add a link to allow setting LD_LIBRARY_PATH/LIBGL_DRIVERS_PATH to /lib of 
the build tree.
 all-local: mesa_dri_drivers.la
-   $(MKDIR_P) $(top_builddir)/$(LIB_DIR);
+   @$(MKDIR_P) $(top_builddir)/$(LIB_DIR);
$(AM_V_GEN)ln -f .libs/mesa_dri_drivers.so \
 $(top_builddir)/$(LIB_DIR)/mesa_dri_drivers.so;
$(AM_V_GEN)for i in $(MEGADRIVERS); do \
-- 
1.9.0

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


[Mesa-dev] [PATCH 06/20] automake: introduce install-gallium-links.mk

2014-03-04 Thread Emil Velikov
This helper script will be used to minimise the duplication
during link generation across all gallium targets.

Signed-off-by: Emil Velikov 
---
 install-gallium-links.mk | 22 ++
 1 file changed, 22 insertions(+)
 create mode 100644 install-gallium-links.mk

diff --git a/install-gallium-links.mk b/install-gallium-links.mk
new file mode 100644
index 000..5c897af
--- /dev/null
+++ b/install-gallium-links.mk
@@ -0,0 +1,22 @@
+# Provide compatibility with scripts for the old Mesa build system for
+# a while by putting a link to the driver into /lib of the build tree.
+
+all-local : .libs/install-gallium-links
+
+.libs/install-gallium-links : $(dri_LTLIBRARIES) $(egl_LTLIBRARIES) 
$(lib_LTLIBRARIES)
+   $(AM_V_GEN)$(MKDIR_P) $(top_builddir)/$(LIB_DIR);   \
+   link_dir=$(top_builddir)/$(LIB_DIR)/gallium;\
+   if test x$(egl_LTLIBRARIES) != x; then  \
+   link_dir=$(top_builddir)/$(LIB_DIR)/egl;\
+   fi; \
+   $(MKDIR_P) $$link_dir;  \
+   file_list=$(dri_LTLIBRARIES:%.la=.libs/%.so*);  \
+   file_list+=$(egl_LTLIBRARIES:%.la=.libs/%.so*); \
+   file_list+=$(lib_LTLIBRARIES:%.la=.libs/%.so*); \
+   for f in $$file_list; do\
+   if test -h .libs/$$f; then  \
+   cp -d $$f $$link_dir;   \
+   else\
+   ln -f $$f $$link_dir;   \
+   fi; \
+   done && touch $@
-- 
1.9.0

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


[Mesa-dev] [PATCH 09/20] gallium/targets: use install-gallium-targets.mk

2014-03-04 Thread Emil Velikov
Signed-off-by: Emil Velikov 
---
 src/gallium/targets/egl-static/Makefile.am | 20 +---
 src/gallium/targets/libgl-xlib/Makefile.am |  6 +-
 src/gallium/targets/opencl/Makefile.am |  6 +-
 src/gallium/targets/osmesa/Makefile.am |  9 +
 4 files changed, 4 insertions(+), 37 deletions(-)

diff --git a/src/gallium/targets/egl-static/Makefile.am 
b/src/gallium/targets/egl-static/Makefile.am
index 50a6122..282fa66 100644
--- a/src/gallium/targets/egl-static/Makefile.am
+++ b/src/gallium/targets/egl-static/Makefile.am
@@ -242,22 +242,4 @@ endif
 endif
 endif
 
-# Provide compatibility with scripts for the old Mesa build system for
-# a while by putting a link to the driver into /lib of the build tree.
-if HAVE_OPENGL
-if !HAVE_SHARED_GLAPI
-all-local: egl_gallium.la st_GL.la
-   $(MKDIR_P) $(top_builddir)/$(LIB_DIR)/egl
-   ln -f .libs/egl_gallium.so $(top_builddir)/$(LIB_DIR)/egl/egl_gallium.so
-   ln -f .libs/st_GL.so $(top_builddir)/$(LIB_DIR)/egl/st_GL.so
-else
-all-local: egl_gallium.la
-   $(MKDIR_P) $(top_builddir)/$(LIB_DIR)/egl
-   ln -f .libs/egl_gallium.so $(top_builddir)/$(LIB_DIR)/egl/egl_gallium.so
-
-endif
-else
-all-local: egl_gallium.la
-   $(MKDIR_P) $(top_builddir)/$(LIB_DIR)/egl
-   ln -f .libs/egl_gallium.so $(top_builddir)/$(LIB_DIR)/egl/egl_gallium.so
-endif
+include $(top_srcdir)/install-gallium-links.mk
diff --git a/src/gallium/targets/libgl-xlib/Makefile.am 
b/src/gallium/targets/libgl-xlib/Makefile.am
index 3753e8a..7e84ffe 100644
--- a/src/gallium/targets/libgl-xlib/Makefile.am
+++ b/src/gallium/targets/libgl-xlib/Makefile.am
@@ -72,8 +72,4 @@ libGL_la_LINK = $(CXXLINK) $(libGL_la_LDFLAGS)
 nodist_EXTRA_libGL_la_SOURCES = dummy-c.c
 endif
 
-# Provide compatibility with scripts for the old Mesa build system for
-# a while by putting a link to the driver into /lib of the build tree.
-all-local: libGL.la
-   $(MKDIR_P) $(top_builddir)/$(LIB_DIR)/gallium
-   ln -f .libs/libGL.so* $(top_builddir)/$(LIB_DIR)/gallium/
+include $(top_srcdir)/install-gallium-links.mk
diff --git a/src/gallium/targets/opencl/Makefile.am 
b/src/gallium/targets/opencl/Makefile.am
index a94a518..20a5247 100644
--- a/src/gallium/targets/opencl/Makefile.am
+++ b/src/gallium/targets/opencl/Makefile.am
@@ -51,8 +51,4 @@ icddir = /etc/OpenCL/vendors/
 icd_DATA = mesa.icd
 endif
 
-# Provide compatibility with scripts for the old Mesa build system for
-# a while by putting a link to the driver into /lib of the build tree.
-all-local: lib@OPENCL_LIBNAME@.la
-   $(MKDIR_P) $(top_builddir)/$(LIB_DIR)
-   ln -f .libs/lib@OPENCL_LIBNAME@.so* $(top_builddir)/$(LIB_DIR)/
+include $(top_srcdir)/install-gallium-links.mk
diff --git a/src/gallium/targets/osmesa/Makefile.am 
b/src/gallium/targets/osmesa/Makefile.am
index 8e6aff6..beb9bba 100644
--- a/src/gallium/targets/osmesa/Makefile.am
+++ b/src/gallium/targets/osmesa/Makefile.am
@@ -68,14 +68,7 @@ endif
 
 
 if BUILD_SHARED
-# Provide compatibility with scripts for the old Mesa build system for
-# a while by putting a link to the driver into /lib of the build tree.
-all-local: lib@OSMESA_LIB@.la
-   $(MKDIR_P) $(top_builddir)/$(LIB_DIR);
-   $(MKDIR_P) $(top_builddir)/$(LIB_DIR)/gallium;
-   ln -f .libs/lib@OSMESA_LIB@.so 
$(top_builddir)/$(LIB_DIR)/gallium/lib@OSMESA_LIB@.so;
-   ln -f .libs/lib@OSMESA_LIB@.so.@OSMESA_VERSION@ 
$(top_builddir)/$(LIB_DIR)/gallium/lib@OSMESA_LIB@.so.@OSMESA_VERSION@;
-   ln -f .libs/lib@OSMESA_LIB@.so.@OSMESA_VERSION@.0.0 
$(top_builddir)/$(LIB_DIR)/gallium/
+include $(top_srcdir)/install-gallium-links.mk
 endif
 
 pkgconfigdir = $(libdir)/pkgconfig
-- 
1.9.0

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


[Mesa-dev] [PATCH 12/20] drivers/dri: link megadriver with -no-undefined

2014-03-04 Thread Emil Velikov
From: Jon TURNEY 

v2: (Emil)
 - Do not link agaist libglapi.

Signed-off-by: Jon TURNEY 
Signed-off-by: Emil Velikov 
---
 src/mesa/drivers/dri/Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/Makefile.am b/src/mesa/drivers/dri/Makefile.am
index 18f880a..eea1939 100644
--- a/src/mesa/drivers/dri/Makefile.am
+++ b/src/mesa/drivers/dri/Makefile.am
@@ -51,7 +51,7 @@ driinclude_HEADERS = 
$(top_srcdir)/include/GL/internal/dri_interface.h
 nodist_EXTRA_mesa_dri_drivers_la_SOURCES = dummy.cpp
 mesa_dri_drivers_la_SOURCES =
 mesa_dri_drivers_la_LDFLAGS = \
--module -avoid-version -shared \
+-module -avoid-version -shared -no-undefined \
 -Wl,-Bsymbolic \
 $()
 mesa_dri_drivers_la_LIBADD = \
-- 
1.9.0

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


[Mesa-dev] [PATCH 07/20] targets/dri: use install-gallium-links.mk

2014-03-04 Thread Emil Velikov
Drop the duplication accross all dri targets.

Signed-off-by: Emil Velikov 
---
 src/gallium/targets/dri-freedreno/Makefile.am | 7 +--
 src/gallium/targets/dri-i915/Makefile.am  | 6 +-
 src/gallium/targets/dri-ilo/Makefile.am   | 7 +--
 src/gallium/targets/dri-nouveau/Makefile.am   | 6 +-
 src/gallium/targets/dri-swrast/Makefile.am| 6 +-
 src/gallium/targets/dri-vmwgfx/Makefile.am| 6 +-
 src/gallium/targets/r300/dri/Makefile.am  | 6 +-
 src/gallium/targets/r600/dri/Makefile.am  | 6 +-
 src/gallium/targets/radeonsi/dri/Makefile.am  | 6 +-
 9 files changed, 9 insertions(+), 47 deletions(-)

diff --git a/src/gallium/targets/dri-freedreno/Makefile.am 
b/src/gallium/targets/dri-freedreno/Makefile.am
index 94500b0..f71fd32 100644
--- a/src/gallium/targets/dri-freedreno/Makefile.am
+++ b/src/gallium/targets/dri-freedreno/Makefile.am
@@ -63,9 +63,4 @@ msm_dri_la_SOURCES  = target-msm.c
 msm_dri_la_LDFLAGS  = $(COMMON_LDFLAGS)
 msm_dri_la_LIBADD   = $(COMMON_LIBADD)
 
-# Provide compatibility with scripts for the old Mesa build system for
-# a while by putting a link to the driver into /lib of the build tree.
-all-local: kgsl_dri.la msm_dri.la
-   $(MKDIR_P) $(top_builddir)/$(LIB_DIR)/gallium
-   ln -f .libs/kgsl_dri.so $(top_builddir)/$(LIB_DIR)/gallium/kgsl_dri.so
-   ln -f .libs/msm_dri.so $(top_builddir)/$(LIB_DIR)/gallium/msm_dri.so
+include $(top_srcdir)/install-gallium-links.mk
diff --git a/src/gallium/targets/dri-i915/Makefile.am 
b/src/gallium/targets/dri-i915/Makefile.am
index 3f8468f..bba0886 100644
--- a/src/gallium/targets/dri-i915/Makefile.am
+++ b/src/gallium/targets/dri-i915/Makefile.am
@@ -59,8 +59,4 @@ AM_CPPFLAGS += -DGALLIUM_LLVMPIPE
 i915_dri_la_LIBADD += 
$(top_builddir)/src/gallium/drivers/llvmpipe/libllvmpipe.la $(LLVM_LIBS)
 endif
 
-# Provide compatibility with scripts for the old Mesa build system for
-# a while by putting a link to the driver into /lib of the build tree.
-all-local: i915_dri.la
-   $(MKDIR_P) $(top_builddir)/$(LIB_DIR)/gallium
-   ln -f .libs/i915_dri.so $(top_builddir)/$(LIB_DIR)/gallium/i915_dri.so
+include $(top_srcdir)/install-gallium-links.mk
diff --git a/src/gallium/targets/dri-ilo/Makefile.am 
b/src/gallium/targets/dri-ilo/Makefile.am
index 418e2ea..18d3c44 100644
--- a/src/gallium/targets/dri-ilo/Makefile.am
+++ b/src/gallium/targets/dri-ilo/Makefile.am
@@ -59,9 +59,4 @@ ilo_dri_la_LDFLAGS += $(LLVM_LDFLAGS)
 ilo_dri_la_LIBADD += $(LLVM_LIBS)
 endif
 
-# Provide compatibility with scripts for the old Mesa build system for
-# a while by putting a link to the driver into /lib of the build tree.
-all-local: ilo_dri.la
-   $(MKDIR_P) $(top_builddir)/$(LIB_DIR)/gallium
-   ln -f .libs/ilo_dri.so $(top_builddir)/$(LIB_DIR)/gallium/ilo_dri.so
-   ln -sf ilo_dri.so $(top_builddir)/$(LIB_DIR)/gallium/i965_dri.so
+include $(top_srcdir)/install-gallium-links.mk
diff --git a/src/gallium/targets/dri-nouveau/Makefile.am 
b/src/gallium/targets/dri-nouveau/Makefile.am
index 4bd4e21..6a00a66 100644
--- a/src/gallium/targets/dri-nouveau/Makefile.am
+++ b/src/gallium/targets/dri-nouveau/Makefile.am
@@ -55,8 +55,4 @@ nouveau_dri_la_LDFLAGS += $(LLVM_LDFLAGS)
 nouveau_dri_la_LIBADD += $(LLVM_LIBS)
 endif
 
-# Provide compatibility with scripts for the old Mesa build system for
-# a while by putting a link to the driver into /lib of the build tree.
-all-local: nouveau_dri.la
-   $(MKDIR_P) $(top_builddir)/$(LIB_DIR)/gallium
-   ln -f .libs/nouveau_dri.so 
$(top_builddir)/$(LIB_DIR)/gallium/nouveau_dri.so
+include $(top_srcdir)/install-gallium-links.mk
diff --git a/src/gallium/targets/dri-swrast/Makefile.am 
b/src/gallium/targets/dri-swrast/Makefile.am
index ec1576b..e05e99d 100644
--- a/src/gallium/targets/dri-swrast/Makefile.am
+++ b/src/gallium/targets/dri-swrast/Makefile.am
@@ -62,8 +62,4 @@ swrast_dri_la_LDFLAGS += $(LLVM_LDFLAGS)
 swrast_dri_la_LIBADD += 
$(top_builddir)/src/gallium/drivers/llvmpipe/libllvmpipe.la $(LLVM_LIBS)
 endif
 
-# Provide compatibility with scripts for the old Mesa build system for
-# a while by putting a link to the driver into /lib of the build tree.
-all-local: swrast_dri.la
-   $(MKDIR_P) $(top_builddir)/$(LIB_DIR)/gallium
-   ln -f .libs/swrast_dri.so 
$(top_builddir)/$(LIB_DIR)/gallium/swrast_dri.so
+include $(top_srcdir)/install-gallium-links.mk
diff --git a/src/gallium/targets/dri-vmwgfx/Makefile.am 
b/src/gallium/targets/dri-vmwgfx/Makefile.am
index 712e570..85b02da 100644
--- a/src/gallium/targets/dri-vmwgfx/Makefile.am
+++ b/src/gallium/targets/dri-vmwgfx/Makefile.am
@@ -58,8 +58,4 @@ vmwgfx_dri_la_LDFLAGS += $(LLVM_LDFLAGS)
 vmwgfx_dri_la_LIBADD += $(LLVM_LIBS)
 endif
 
-# Provide compatibility with scripts for the old Mesa build system for
-# a while by putting a link to the driver into /lib of the build tree.
-all-local: vmwgfx_dri.la
-   $(MKDIR_P) $(top_builddir)/$(LIB_DIR)/gallium
-   ln -f .libs/vmwgfx_dri.so 
$(top_builddi

[Mesa-dev] [PATCH 10/20] configure: remove old makefile variables

2014-03-04 Thread Emil Velikov
All the variables were used before the automake conversion
and do not make sense (nor are used) currently.

Replace GL_LIB_NAME with lib$(GL_LIB).$(LIB_EXTENSION) for
apple-glx. The build has been broken for ages, but this will
ease the recovery process as it happens.

Signed-off-by: Emil Velikov 
---
 configure.ac   | 36 
 src/glx/apple/Makefile |  9 -
 2 files changed, 4 insertions(+), 41 deletions(-)

diff --git a/configure.ac b/configure.ac
index af5f4c6..fc20910 100644
--- a/configure.ac
+++ b/configure.ac
@@ -319,8 +319,6 @@ fi
 dnl
 dnl library names
 dnl
-LIB_PREFIX_GLOB='lib'
-LIB_VERSION_SEPARATOR='.'
 if test "$enable_static" = yes; then
 LIB_EXTENSION='a'
 else
@@ -328,9 +326,6 @@ else
 darwin* )
 LIB_EXTENSION='dylib' ;;
 cygwin* )
-dnl prefix can be 'cyg' or 'lib'
-LIB_PREFIX_GLOB='???'
-LIB_VERSION_SEPARATOR='-'
 LIB_EXTENSION='dll' ;;
 aix* )
 LIB_EXTENSION='a' ;;
@@ -383,37 +378,6 @@ if test "x$enable_texture_float" = xyes; then
 DEFINES="$DEFINES -DTEXTURE_FLOAT_ENABLED"
 fi
 
-GL_LIB_NAME='lib$(GL_LIB).'${LIB_EXTENSION}
-OSMESA_LIB_NAME='lib$(OSMESA_LIB).'${LIB_EXTENSION}
-EGL_LIB_NAME='lib$(EGL_LIB).'${LIB_EXTENSION}
-GLESv1_CM_LIB_NAME='lib$(GLESv1_CM_LIB).'${LIB_EXTENSION}
-GLESv2_LIB_NAME='lib$(GLESv2_LIB).'${LIB_EXTENSION}
-VG_LIB_NAME='lib$(VG_LIB).'${LIB_EXTENSION}
-GLAPI_LIB_NAME='lib$(GLAPI_LIB).'${LIB_EXTENSION}
-
-GL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
-EGL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(EGL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
-EGL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(EGL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
-GLESv1_CM_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLESv1_CM_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
-GLESv2_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLESv2_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
-VG_LIB_GLOB=${LIB_PREFIX_GLOB}'$(VG_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
-GLAPI_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLAPI_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
-
-AC_SUBST([GL_LIB_NAME])
-AC_SUBST([OSMESA_LIB_NAME])
-AC_SUBST([EGL_LIB_NAME])
-AC_SUBST([GLESv1_CM_LIB_NAME])
-AC_SUBST([GLESv2_LIB_NAME])
-AC_SUBST([VG_LIB_NAME])
-AC_SUBST([GLAPI_LIB_NAME])
-
-AC_SUBST([GL_LIB_GLOB])
-AC_SUBST([EGL_LIB_GLOB])
-AC_SUBST([GLESv1_CM_LIB_GLOB])
-AC_SUBST([GLESv2_LIB_GLOB])
-AC_SUBST([VG_LIB_GLOB])
-AC_SUBST([GLAPI_LIB_GLOB])
-
 dnl
 dnl Arch/platform-specific settings
 dnl
diff --git a/src/glx/apple/Makefile b/src/glx/apple/Makefile
index 7dab068..39cfec3 100644
--- a/src/glx/apple/Makefile
+++ b/src/glx/apple/Makefile
@@ -23,7 +23,7 @@ RM=rm
 #The directory with the final binaries.
 BUILD_DIR=builds
 
-default: $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)
+default: $(TOP)/$(LIB_DIR)/lib$(GL_LIB).$(LIB_EXTENSION)
 
 SOURCES = \
apple_cgl.c \
@@ -88,10 +88,10 @@ INCLUDES = -I. -Iinclude -I..\
 
 # TARGETS #
 
-default: depend $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)
+default: depend $(TOP)/$(LIB_DIR)/lib$(GL_LIB).$(LIB_EXTENSION)
 
 # Make libGL
-$(TOP)/$(LIB_DIR)/$(GL_LIB_NAME):  $(OBJECTS) $(GLAPI_LIB) Makefile
+$(TOP)/$(LIB_DIR)/lib$(GL_LIB).$(LIB_EXTENSION):  $(OBJECTS) $(GLAPI_LIB) 
Makefile
$(MKLIB) -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
-major 1 -minor 2 $(MKLIB_OPTIONS) \
-install $(TOP)/$(LIB_DIR) -id 
$(INSTALL_LIB_DIR)/lib$(GL_LIB).1.dylib \
@@ -114,7 +114,7 @@ install_headers: include/GL/gl.h
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL
$(INSTALL) -m 644 include/GL/gl.h $(DESTDIR)$(INSTALL_DIR)/include/GL
 
-install_libraries: $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)
+install_libraries: $(TOP)/$(LIB_DIR)/lib$(GL_LIB).$(LIB_EXTENSION)
$(MAKE) -C $(TOP)/src/mesa install-libgl
 
 install: install_libraries
@@ -125,7 +125,6 @@ clean:
-rm -f *.c~ *.h~
-rm -f *.dylib
-rm -f include/GL/gl.h
-   -rm -f $(TOP)/$(LIB_DIR)/$(GL_LIB_GLOB)
-rm -f *.o *~
-rm -f depend depend.bak
 
-- 
1.9.0

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


[Mesa-dev] [PATCH 08/20] gallium/targets: drop link generation for non DRI targets

2014-03-04 Thread Emil Velikov
All three (xvmc, vdpau and omx) do not have an alternative loading
similar to the dri modules. Thus one needs to explicitly install
them in order to use/test them.

Signed-off-by: Emil Velikov 
---
 src/gallium/targets/r600/omx/Makefile.am   | 6 --
 src/gallium/targets/r600/vdpau/Makefile.am | 6 --
 src/gallium/targets/r600/xvmc/Makefile.am  | 6 --
 src/gallium/targets/radeonsi/omx/Makefile.am   | 6 --
 src/gallium/targets/radeonsi/vdpau/Makefile.am | 6 --
 src/gallium/targets/vdpau-nouveau/Makefile.am  | 6 --
 src/gallium/targets/xvmc-nouveau/Makefile.am   | 6 --
 7 files changed, 42 deletions(-)

diff --git a/src/gallium/targets/r600/omx/Makefile.am 
b/src/gallium/targets/r600/omx/Makefile.am
index 3aef9e1..98b064f 100644
--- a/src/gallium/targets/r600/omx/Makefile.am
+++ b/src/gallium/targets/r600/omx/Makefile.am
@@ -70,9 +70,3 @@ libomx_r600_la_LINK = $(LINK) $(libomx_r600_la_LDFLAGS)
 # Mention a dummy pure C file to trigger generation of the $(LINK) variable
 nodist_EXTRA_libomx_r600_la_SOURCES = dummy-c.c
 endif
-
-# Provide compatibility with scripts for the old Mesa build system for
-# a while by putting a link to the driver into /lib of the build tree.
-all-local: libomx_r600.la
-   $(MKDIR_P) $(top_builddir)/$(LIB_DIR)/gallium
-   ln -f .libs/libomx_r600.so* $(top_builddir)/$(LIB_DIR)/gallium/
diff --git a/src/gallium/targets/r600/vdpau/Makefile.am 
b/src/gallium/targets/r600/vdpau/Makefile.am
index 509b954..f4ecfcc 100644
--- a/src/gallium/targets/r600/vdpau/Makefile.am
+++ b/src/gallium/targets/r600/vdpau/Makefile.am
@@ -51,9 +51,3 @@ if HAVE_MESA_LLVM
 libvdpau_r600_la_LDFLAGS += $(LLVM_LDFLAGS)
 libvdpau_r600_la_LIBADD += $(LLVM_LIBS)
 endif
-
-# Provide compatibility with scripts for the old Mesa build system for
-# a while by putting a link to the driver into /lib of the build tree.
-all-local: libvdpau_r600.la
-   $(MKDIR_P) $(top_builddir)/$(LIB_DIR)/gallium
-   ln -f .libs/libvdpau_r600.so* $(top_builddir)/$(LIB_DIR)/gallium/
diff --git a/src/gallium/targets/r600/xvmc/Makefile.am 
b/src/gallium/targets/r600/xvmc/Makefile.am
index 7fe9b1a..6e71ffa 100644
--- a/src/gallium/targets/r600/xvmc/Makefile.am
+++ b/src/gallium/targets/r600/xvmc/Makefile.am
@@ -54,9 +54,3 @@ libXvMCr600_la_LINK = $(LINK) $(libXvMCr600_la_LDFLAGS)
 # Mention a dummy pure C file to trigger generation of the $(LINK) variable
 nodist_EXTRA_libXvMCr600_la_SOURCES = dummy-c.c
 endif
-
-# Provide compatibility with scripts for the old Mesa build system for
-# a while by putting a link to the driver into /lib of the build tree.
-all-local: libXvMCr600.la
-   $(MKDIR_P) $(top_builddir)/$(LIB_DIR)/gallium
-   ln -f .libs/libXvMCr600.so* $(top_builddir)/$(LIB_DIR)/gallium/
diff --git a/src/gallium/targets/radeonsi/omx/Makefile.am 
b/src/gallium/targets/radeonsi/omx/Makefile.am
index 0d47912..14e9dbb 100644
--- a/src/gallium/targets/radeonsi/omx/Makefile.am
+++ b/src/gallium/targets/radeonsi/omx/Makefile.am
@@ -65,9 +65,3 @@ nodist_EXTRA_libomx_radeonsi_la_SOURCES = dummy-cpp.cpp
 libomx_radeonsi_la_LDFLAGS += $(LLVM_LDFLAGS)
 libomx_radeonsi_la_LIBADD += $(LLVM_LIBS)
 endif
-
-# Provide compatibility with scripts for the old Mesa build system for
-# a while by putting a link to the driver into /lib of the build tree.
-all-local: libomx_radeonsi.la
-   $(MKDIR_P) $(top_builddir)/$(LIB_DIR)/gallium
-   ln -f .libs/libomx_radeonsi.so* $(top_builddir)/$(LIB_DIR)/gallium/
diff --git a/src/gallium/targets/radeonsi/vdpau/Makefile.am 
b/src/gallium/targets/radeonsi/vdpau/Makefile.am
index 54d65b3..1d56bb3 100644
--- a/src/gallium/targets/radeonsi/vdpau/Makefile.am
+++ b/src/gallium/targets/radeonsi/vdpau/Makefile.am
@@ -48,9 +48,3 @@ if HAVE_MESA_LLVM
 libvdpau_radeonsi_la_LDFLAGS += $(LLVM_LDFLAGS)
 libvdpau_radeonsi_la_LIBADD += $(LLVM_LIBS)
 endif
-
-# Provide compatibility with scripts for the old Mesa build system for
-# a while by putting a link to the driver into /lib of the build tree.
-all-local: libvdpau_radeonsi.la
-   $(MKDIR_P) $(top_builddir)/$(LIB_DIR)/gallium
-   ln -f .libs/libvdpau_radeonsi.so* $(top_builddir)/$(LIB_DIR)/gallium/
diff --git a/src/gallium/targets/vdpau-nouveau/Makefile.am 
b/src/gallium/targets/vdpau-nouveau/Makefile.am
index 3cdf103..0066e02 100644
--- a/src/gallium/targets/vdpau-nouveau/Makefile.am
+++ b/src/gallium/targets/vdpau-nouveau/Makefile.am
@@ -48,9 +48,3 @@ if HAVE_MESA_LLVM
 libvdpau_nouveau_la_LDFLAGS += $(LLVM_LDFLAGS)
 libvdpau_nouveau_la_LIBADD += $(LLVM_LIBS)
 endif
-
-# Provide compatibility with scripts for the old Mesa build system for
-# a while by putting a link to the driver into /lib of the build tree.
-all-local: libvdpau_nouveau.la
-   $(MKDIR_P) $(top_builddir)/$(LIB_DIR)/gallium
-   ln -f .libs/libvdpau_nouveau.so* $(top_builddir)/$(LIB_DIR)/gallium/
diff --git a/src/gallium/targets/xvmc-nouveau/Makefile.am 
b/src/gallium/targets/xvmc-nouveau/Makefile.am
index 4a45f41..4abf81c 100644

[Mesa-dev] [PATCH 17/20] glx: cleanup unneeded headers

2014-03-04 Thread Emil Velikov
 - xf86dri.h is the old dri1 header, not required by dri2 nor dri3
 - fold xf86drm.h inclusiong inside dri2.h
 - dri3_glx does not have any drm specific dependencies
 - glapi.h is not required by the dri2 and dri3 codepaths

Signed-off-by: Emil Velikov 
---
 src/glx/dri2.c   | 1 -
 src/glx/dri2.h   | 1 +
 src/glx/dri2_glx.c   | 3 ---
 src/glx/dri2_query_renderer.c| 1 -
 src/glx/dri3_glx.c   | 3 ---
 src/glx/glxcmds.c| 2 --
 src/glx/tests/query_renderer_implementation_unittest.cpp | 1 -
 7 files changed, 1 insertion(+), 11 deletions(-)

diff --git a/src/glx/dri2.c b/src/glx/dri2.c
index 7e8fdea..7cb9d2d 100644
--- a/src/glx/dri2.c
+++ b/src/glx/dri2.c
@@ -38,7 +38,6 @@
 #include 
 #include 
 #include 
-#include "xf86drm.h"
 #include "dri2.h"
 #include "glxclient.h"
 #include "GL/glxext.h"
diff --git a/src/glx/dri2.h b/src/glx/dri2.h
index 90efde8..72a608c 100644
--- a/src/glx/dri2.h
+++ b/src/glx/dri2.h
@@ -33,6 +33,7 @@
 #ifndef _DRI2_H_
 #define _DRI2_H_
 
+#include 
 #include 
 #include 
 
diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index deeffa4..75fc951 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -37,17 +37,14 @@
 #include 
 #include 
 #include 
-#include "glapi.h"
 #include "glxclient.h"
 #include 
-#include "xf86dri.h"
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include "xf86drm.h"
 #include "dri2.h"
 #include "dri_common.h"
 #include "dri2_priv.h"
diff --git a/src/glx/dri2_query_renderer.c b/src/glx/dri2_query_renderer.c
index 95560cb..a28ced6 100644
--- a/src/glx/dri2_query_renderer.c
+++ b/src/glx/dri2_query_renderer.c
@@ -25,7 +25,6 @@
 
 #include "glxclient.h"
 #include "glx_error.h"
-#include "xf86drm.h"
 #include "dri2.h"
 #include "dri_interface.h"
 #include "dri2_priv.h"
diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
index 8fbf125..f27a773 100644
--- a/src/glx/dri3_glx.c
+++ b/src/glx/dri3_glx.c
@@ -65,9 +65,7 @@
 #include 
 #include 
 #include 
-#include "glapi.h"
 #include "glxclient.h"
-#include "xf86dri.h"
 #include 
 #include 
 #include 
@@ -75,7 +73,6 @@
 #include 
 #include 
 
-#include "xf86drm.h"
 #include "dri_common.h"
 #include "dri3_priv.h"
 #include "loader.h"
diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
index 837d8a2..4b17d7c 100644
--- a/src/glx/glxcmds.c
+++ b/src/glx/glxcmds.c
@@ -48,9 +48,7 @@
 #ifdef XF86VIDMODE
 #include 
 #endif
-#include "xf86dri.h"
 #endif
-#else
 #endif
 
 #include 
diff --git a/src/glx/tests/query_renderer_implementation_unittest.cpp 
b/src/glx/tests/query_renderer_implementation_unittest.cpp
index 2bf8843..35b3972 100644
--- a/src/glx/tests/query_renderer_implementation_unittest.cpp
+++ b/src/glx/tests/query_renderer_implementation_unittest.cpp
@@ -29,7 +29,6 @@
 extern "C" {
 #include "glxclient.h"
 #include "glx_error.h"
-#include "xf86drm.h"
 #include "dri2.h"
 #include "dri_interface.h"
 #include "dri2_priv.h"
-- 
1.9.0

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


[Mesa-dev] [PATCH 15/20] configure: read libomxil-bellagio.pc only when it exists

2014-03-04 Thread Emil Velikov
Currenly configure.ac will print a warning when one is missing the package.

Signed-off-by: Emil Velikov 
---
 configure.ac | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 21db389..36d7895 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1646,11 +1646,16 @@ AC_ARG_WITH([vdpau-libdir],
 [VDPAU_LIB_INSTALL_DIR='${libdir}/vdpau'])
 AC_SUBST([VDPAU_LIB_INSTALL_DIR])
 
+OMX_LIB_INSTALL_DIR_DEFAULT=''
+if test "x$enable_omx" = xyes; then
+OMX_LIB_INSTALL_DIR_DEFAULT=`$PKG_CONFIG --variable=pluginsdir 
libomxil-bellagio`
+fi
+
 AC_ARG_WITH([omx-libdir],
 [AS_HELP_STRING([--with-omx-libdir=DIR],
 [directory for the OMX libraries])],
 [OMX_LIB_INSTALL_DIR="$withval"],
-[OMX_LIB_INSTALL_DIR=`$PKG_CONFIG --variable=pluginsdir 
libomxil-bellagio`])
+[OMX_LIB_INSTALL_DIR="$OMX_LIB_INSTALL_DIR_DEFAULT"])
 AC_SUBST([OMX_LIB_INSTALL_DIR])
 
 dnl Directory for OpenCL libs
-- 
1.9.0

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


[Mesa-dev] [PATCH 13/20] configure: use LIB_EXT rather than hardcoded .so

2014-03-04 Thread Emil Velikov
Some platforms different library extension - dll, dylib, a.
Honor that when we are creating the required links.

Rename LIB_EXTENSION to LIB_EXT while we're here.

XXX: With libglapi linking aside, building classic drivers
on non-linux platforms should be possible now.

Cc: Jon TURNEY 
Signed-off-by: Emil Velikov 
---
 configure.ac | 13 -
 install-gallium-links.mk |  6 +++---
 install-lib-links.mk |  2 +-
 src/glx/apple/Makefile   |  8 
 src/mesa/drivers/dri/Makefile.am | 24 
 5 files changed, 28 insertions(+), 25 deletions(-)

diff --git a/configure.ac b/configure.ac
index fc20910..a7c479c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -320,19 +320,22 @@ dnl
 dnl library names
 dnl
 if test "$enable_static" = yes; then
-LIB_EXTENSION='a'
+LIB_EXT='a'
 else
 case "$host_os" in
 darwin* )
-LIB_EXTENSION='dylib' ;;
+LIB_EXT='dylib' ;;
 cygwin* )
-LIB_EXTENSION='dll' ;;
+LIB_EXT='dll' ;;
 aix* )
-LIB_EXTENSION='a' ;;
+LIB_EXT='a' ;;
 * )
-LIB_EXTENSION='so' ;;
+LIB_EXT='so' ;;
 esac
 fi
+
+AC_SUBST([LIB_EXT])
+
 AC_ARG_WITH([gl-lib-name],
   [AS_HELP_STRING([--with-gl-lib-name@<:@=NAME@:>@],
 [specify GL library name @<:@default=GL@:>@])],
diff --git a/install-gallium-links.mk b/install-gallium-links.mk
index 5c897af..6c2857d 100644
--- a/install-gallium-links.mk
+++ b/install-gallium-links.mk
@@ -10,9 +10,9 @@ all-local : .libs/install-gallium-links
link_dir=$(top_builddir)/$(LIB_DIR)/egl;\
fi; \
$(MKDIR_P) $$link_dir;  \
-   file_list=$(dri_LTLIBRARIES:%.la=.libs/%.so*);  \
-   file_list+=$(egl_LTLIBRARIES:%.la=.libs/%.so*); \
-   file_list+=$(lib_LTLIBRARIES:%.la=.libs/%.so*); \
+   file_list=$(dri_LTLIBRARIES:%.la=.libs/%.$(LIB_EXT)*);  \
+   file_list+=$(egl_LTLIBRARIES:%.la=.libs/%.$(LIB_EXT)*); \
+   file_list+=$(lib_LTLIBRARIES:%.la=.libs/%.$(LIB_EXT)*); \
for f in $$file_list; do\
if test -h .libs/$$f; then  \
cp -d $$f $$link_dir;   \
diff --git a/install-lib-links.mk b/install-lib-links.mk
index 9dd4c30..2707eb8 100644
--- a/install-lib-links.mk
+++ b/install-lib-links.mk
@@ -5,7 +5,7 @@ all-local : .libs/install-mesa-links
 
 .libs/install-mesa-links : $(lib_LTLIBRARIES)
$(AM_V_GEN)$(MKDIR_P) $(top_builddir)/$(LIB_DIR);   \
-   for f in $(lib_LTLIBRARIES:%.la=.libs/%.so*); do\
+   for f in $(lib_LTLIBRARIES:%.la=.libs/%.$(LIB_EXT)*); do \
if test -h .libs/$$f; then  \
cp -d $$f $(top_builddir)/$(LIB_DIR);   \
else\
diff --git a/src/glx/apple/Makefile b/src/glx/apple/Makefile
index 39cfec3..91a7218 100644
--- a/src/glx/apple/Makefile
+++ b/src/glx/apple/Makefile
@@ -23,7 +23,7 @@ RM=rm
 #The directory with the final binaries.
 BUILD_DIR=builds
 
-default: $(TOP)/$(LIB_DIR)/lib$(GL_LIB).$(LIB_EXTENSION)
+default: $(TOP)/$(LIB_DIR)/lib$(GL_LIB).$(LIB_EXT)
 
 SOURCES = \
apple_cgl.c \
@@ -88,10 +88,10 @@ INCLUDES = -I. -Iinclude -I..\
 
 # TARGETS #
 
-default: depend $(TOP)/$(LIB_DIR)/lib$(GL_LIB).$(LIB_EXTENSION)
+default: depend $(TOP)/$(LIB_DIR)/lib$(GL_LIB).$(LIB_EXT)
 
 # Make libGL
-$(TOP)/$(LIB_DIR)/lib$(GL_LIB).$(LIB_EXTENSION):  $(OBJECTS) $(GLAPI_LIB) 
Makefile
+$(TOP)/$(LIB_DIR)/lib$(GL_LIB).$(LIB_EXT):  $(OBJECTS) $(GLAPI_LIB) Makefile
$(MKLIB) -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
-major 1 -minor 2 $(MKLIB_OPTIONS) \
-install $(TOP)/$(LIB_DIR) -id 
$(INSTALL_LIB_DIR)/lib$(GL_LIB).1.dylib \
@@ -114,7 +114,7 @@ install_headers: include/GL/gl.h
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL
$(INSTALL) -m 644 include/GL/gl.h $(DESTDIR)$(INSTALL_DIR)/include/GL
 
-install_libraries: $(TOP)/$(LIB_DIR)/lib$(GL_LIB).$(LIB_EXTENSION)
+install_libraries: $(TOP)/$(LIB_DIR)/lib$(GL_LIB).$(LIB_EXT)
$(MAKE) -C $(TOP)/src/mesa install-libgl
 
 install: install_libraries
diff --git a/src/mesa/drivers/dri/Makefile.am b/src/mesa/drivers/dri/Makefile.am
index eea1939..65b5454 100644
--- a/src/mesa/drivers/dri/Makefile.am
+++ b/src/mesa/drivers/dri/Makefile.am
@@ -9,37 +9,37 @@ SUBDIRS+=common
 if HAVE_I915_DRI
 SUBDIRS += i915
 MEGADRIVERS_DEPS += i915/libi915_dri.la
-MEGADRIVERS += i915_dri.so
+MEGADRIVERS += i915_dri.@LIB_EXT@
 endif
 
 if HAVE_I965_DRI
 SUBDIRS += i965
 MEGADRIVERS_DEPS += i965/libi965_dri.la
-MEGADRIVERS += i965_dri.so
+MEGADRIVERS += i965_dri.@LIB_EXT@
 endif
 
 if HAVE_NOUVEAU_DRI
 SUBDIRS += nouveau
 MEGADRIVERS_DEPS += nouveau/libnouveau_dri.la
-MEGADRIVERS += nouveau_

[Mesa-dev] [PATCH 18/20] st/dri: build the drm backend when libdrm is present

2014-03-04 Thread Emil Velikov
Prevent build issues on systems lacking libdrm.

Cc: Jon TURNEY 
Signed-off-by: Emil Velikov 
---
 src/gallium/state_trackers/dri/Makefile.am | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/dri/Makefile.am 
b/src/gallium/state_trackers/dri/Makefile.am
index 485627c..9428b55 100644
--- a/src/gallium/state_trackers/dri/Makefile.am
+++ b/src/gallium/state_trackers/dri/Makefile.am
@@ -20,4 +20,8 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 # DEALINGS IN THE SOFTWARE.
 
-SUBDIRS = drm sw
+SUBDIRS = sw
+
+if HAVE_LIBDRM
+SUBDIRS += drm
+endif
-- 
1.9.0

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


[Mesa-dev] [PATCH 16/20] glx/tests: honor enable-driglx-direct configure flag

2014-03-04 Thread Emil Velikov
From: Jon TURNEY 

Recent commit fixed build issues in dri2_query_renderer.c by
wrapping in defined(direct_rendering) && !defined(applegl)

This patch targets the query_renderer tests, so that make check
passes on platforms such as hurd and cygwin.

v2: (Emil)
 - Rebase and update commit message.

Cc: Jon TURNEY 
Signed-off-by: Jon TURNEY 
Signed-off-by: Emil Velikov 
---
 src/glx/tests/query_renderer_implementation_unittest.cpp | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/glx/tests/query_renderer_implementation_unittest.cpp 
b/src/glx/tests/query_renderer_implementation_unittest.cpp
index 4749089..2bf8843 100644
--- a/src/glx/tests/query_renderer_implementation_unittest.cpp
+++ b/src/glx/tests/query_renderer_implementation_unittest.cpp
@@ -24,6 +24,8 @@
 #include 
 #include 
 
+#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
+
 extern "C" {
 #include "glxclient.h"
 #include "glx_error.h"
@@ -308,3 +310,5 @@ TEST_F(dri2_query_renderer_integer_test, 
valid_attribute_mapping)
   EXPECT_FALSE(got_sigsegv);
}
 }
+
+#endif /* GLX_DIRECT_RENDERING */
-- 
1.9.0

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


[Mesa-dev] [PATCH 20/20] automake: allow only shared builds

2014-03-04 Thread Emil Velikov
Static and shared builds were possible in the good old days
of static makefiles. Currently the build system does not
distinguish nor does anything special when one requests a
static build.

Print a warning message for the packager that static builds
are not supported and continue building shared libs.

Currently only Debian and derivatives use static build, and
they use it for building a Xlib powered libGL. This patch
will only change the warning message they are seeing but
the binaries produced will be identical.

Signed-off-by: Emil Velikov 
---
 configure.ac   | 56 +++---
 src/gallium/targets/osmesa/Makefile.am |  3 --
 src/mesa/drivers/osmesa/Makefile.am|  2 --
 src/mesa/drivers/x11/Makefile.am   |  2 --
 4 files changed, 18 insertions(+), 45 deletions(-)

diff --git a/configure.ac b/configure.ac
index 7130f6d..83c36b5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -285,18 +285,15 @@ dnl Can't have static and shared libraries, default to 
static if user
 dnl explicitly requested. If both disabled, set to static since shared
 dnl was explicitly requested.
 case "x$enable_static$enable_shared" in
-xyesyes )
-AC_MSG_WARN([Cannot build static and shared libraries, disabling shared])
-enable_shared=no
+xnoyes )
 ;;
-xnono )
-AC_MSG_WARN([Cannot disable both static and shared libraries, enabling 
static])
-enable_static=yes
+* )
+AC_MSG_WARN([Messa build supports only shared libraries, enabling shared])
+enable_shared=yes
+enable_static=no
 ;;
 esac
 
-AM_CONDITIONAL(BUILD_SHARED, test "x$enable_shared" = xyes)
-
 dnl
 dnl other compiler options
 dnl
@@ -331,20 +328,16 @@ AM_CONDITIONAL(HAVE_COMPAT_SYMLINKS, test 
x$HAVE_COMPAT_SYMLINKS = xyes)
 dnl
 dnl library names
 dnl
-if test "$enable_static" = yes; then
-LIB_EXT='a'
-else
-case "$host_os" in
-darwin* )
-LIB_EXT='dylib' ;;
-cygwin* )
-LIB_EXT='dll' ;;
-aix* )
-LIB_EXT='a' ;;
-* )
-LIB_EXT='so' ;;
-esac
-fi
+case "$host_os" in
+darwin* )
+LIB_EXT='dylib' ;;
+cygwin* )
+LIB_EXT='dll' ;;
+aix* )
+LIB_EXT='a' ;;
+* )
+LIB_EXT='so' ;;
+esac
 
 AC_SUBST([LIB_EXT])
 
@@ -781,11 +774,6 @@ PKG_CHECK_MODULES([LIBUDEV], [libudev >= 
$LIBUDEV_REQUIRED],
   have_libudev=yes, have_libudev=no)
 
 if test "x$enable_dri" = xyes; then
-# DRI must be shared, I think
-if test "$enable_static" = yes; then
-AC_MSG_ERROR([Cannot use static libraries for DRI drivers])
-fi
-
 # not a hard requirement as swrast does not depend on it
 if test "x$have_libdrm" = xyes; then
 DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
@@ -1113,12 +1101,7 @@ x16|x32)
 esac
 
 if test "x$enable_osmesa" = xyes -o "x$enable_gallium_osmesa" = xyes; then
-# only link libraries with osmesa if shared
-if test "$enable_static" = no; then
-OSMESA_LIB_DEPS="-lm $PTHREAD_LIBS $SELINUX_LIBS $DLOPEN_LIBS"
-else
-OSMESA_LIB_DEPS=""
-fi
+OSMESA_LIB_DEPS="-lm $PTHREAD_LIBS $SELINUX_LIBS $DLOPEN_LIBS"
 OSMESA_MESA_DEPS=""
 OSMESA_PC_LIB_PRIV="-lm $PTHREAD_LIBS $SELINUX_LIBS $DLOPEN_LIBS"
 fi
@@ -1167,11 +1150,8 @@ if test "x$enable_egl" = xyes; then
 
 AC_CHECK_FUNC(mincore, [DEFINES="$DEFINES -DHAVE_MINCORE"])
 
-if test "$enable_static" != yes; then
-if test "x$enable_dri" = xyes; then
-   HAVE_EGL_DRIVER_DRI2=1
-   fi
-
+if test "x$enable_dri" = xyes; then
+HAVE_EGL_DRIVER_DRI2=1
 fi
 fi
 AM_CONDITIONAL(HAVE_EGL, test "x$enable_egl" = xyes)
diff --git a/src/gallium/targets/osmesa/Makefile.am 
b/src/gallium/targets/osmesa/Makefile.am
index c065773..775abd9 100644
--- a/src/gallium/targets/osmesa/Makefile.am
+++ b/src/gallium/targets/osmesa/Makefile.am
@@ -66,12 +66,9 @@ lib@OSMESA_LIB@_la_LIBADD += 
$(top_builddir)/src/gallium/drivers/llvmpipe/libllv
 endif
 
 
-
-if BUILD_SHARED
 if HAVE_COMPAT_SYMLINKS
 include $(top_srcdir)/install-gallium-links.mk
 endif
-endif
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = osmesa.pc
diff --git a/src/mesa/drivers/osmesa/Makefile.am 
b/src/mesa/drivers/osmesa/Makefile.am
index 9ab6820..4d61b14 100644
--- a/src/mesa/drivers/osmesa/Makefile.am
+++ b/src/mesa/drivers/osmesa/Makefile.am
@@ -47,11 +47,9 @@ lib@OSMESA_LIB@_la_LIBADD = \
$(SHARED_GLAPI_LIB) \
$(OSMESA_LIB_DEPS)
 
-if BUILD_SHARED
 if HAVE_COMPAT_SYMLINKS
 include $(top_srcdir)/install-lib-links.mk
 endif
-endif
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = osmesa.pc
diff --git a/src/mesa/drivers/x11/Makefile.am b/src/mesa/drivers/x11/Makefile.am
index cc83793..63321be 100644
--- a/src/mesa/drivers/x11/Makefile.am
+++ b/src/mesa/drivers/x11/Makefile.am
@@ -64,8 +64,6 @@ lib@GL_LIB@_la_LDFLAGS = \
-no-undefined \
$(GL_LIB_DEPS)
 
-if BUILD_SHARED
 if HAVE_COMPAT_SYMLINKS
 include $(top_srcdir)/install-lib-links.mk
 endif
-endif
-- 
1.9.0

___

[Mesa-dev] [PATCH 19/20] configure: update enable-llvm-shared-libs comments

2014-03-04 Thread Emil Velikov
 - As of commit cb080a10b68(configure.ac: Don't require shared LLVM when
building OpenCL) opencl does not mandate using shared llvm.
 - Add a warning message that building with static llvm may cause
compilation problems.

XXX: Tom please update the wiki [1]. Currently it lists the old configure
switch --with-llvm-shared-libs

[1] http://dri.freedesktop.org/wiki/GalliumCompute/

Cc: Tom Stellard 
Signed-off-by: Emil Velikov 
---
 configure.ac | 23 ++-
 1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/configure.ac b/configure.ac
index 36d7895..7130f6d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -589,10 +589,8 @@ AC_ARG_ENABLE([omx],
[enable_omx=no])
 AC_ARG_ENABLE([opencl],
[AS_HELP_STRING([--enable-opencl],
- [enable OpenCL library NOTE: Enabling this option will also enable
-  --enable-llvm-shared-libs
-  @<:@default=no@:>@])],
-   [],
+ [enable OpenCL library @<:@default=no@:>@])],
+   [enable_opencl="$enableval"],
[enable_opencl=no])
 AC_ARG_ENABLE([opencl_icd],
[AS_HELP_STRING([--enable-opencl-icd],
@@ -1510,8 +1508,8 @@ AC_ARG_ENABLE([gallium-llvm],
 AC_ARG_ENABLE([llvm-shared-libs],
 [AS_HELP_STRING([--enable-llvm-shared-libs],
 [link with LLVM shared libraries @<:@default=enabled@:>@])],
-[],
-[with_llvm_shared_libs=yes])
+[enable_llvm_shared_libs="$enableval"],
+[enable_llvm_shared_libs=yes])
 
 AC_ARG_WITH([llvm-prefix],
 [AS_HELP_STRING([--with-llvm-prefix],
@@ -1853,7 +1851,7 @@ if test "x$MESA_LLVM" != x0; then
 
 LLVM_LIBS="`$LLVM_CONFIG --libs ${LLVM_COMPONENTS}`"
 
-if test "x$with_llvm_shared_libs" = xyes; then
+if test "x$enable_llvm_shared_libs" = xyes; then
 dnl We can't use $LLVM_VERSION because it has 'svn' stripped out,
 LLVM_SO_NAME=LLVM-`$LLVM_CONFIG --version`
 AS_IF([test -f "$LLVM_LIBDIR/lib$LLVM_SO_NAME.so"], 
[llvm_have_one_so=yes])
@@ -1870,18 +1868,17 @@ if test "x$MESA_LLVM" != x0; then
and that your llvm libraries are installed in $LLVM_LIBDIR
If you have installed your llvm libraries to a different directory you
can use the --with-llvm-prefix= configure flag to specify this 
directory.
-   NOTE: Mesa is attempting to use llvm shared libraries because you have
-   passed one of the following options to configure:
-   --enable-llvm-shared-libs
-   --enable-opencl
+   NOTE: Mesa is attempting to use llvm shared libraries by default.
If you do not want to build with llvm shared libraries and instead want 
to
-   use llvm static libraries then remove these options from your configure
-   invocation and reconfigure.])])
+   use llvm static libraries then add --disable-llvm-shared-libs to your 
configure
+   invocation and rebuild.])])
 
dnl We don't need to update LLVM_LIBS in this case because the LLVM
dnl install uses a shared object for each compoenent and we have
dnl already added all of these objects to LLVM_LIBS.
 fi
+else
+AC_MSG_WARN([Building mesa with staticly linked LLVM may cause 
compilation issues])
 fi
 fi
 
-- 
1.9.0

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


[Mesa-dev] [PATCH 14/20] automake: create compat symlinks only for linux systems

2014-03-04 Thread Emil Velikov
The primary users of these are linux developers, although
it can be extended for *BSD and others if needed.

Fixes make install for Cygwin and OpenBSD at least.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=63269
Cc: Jon TURNEY 
Signed-off-by: Emil Velikov 
---
 configure.ac  | 12 
 src/egl/main/Makefile.am  |  2 ++
 src/egl/wayland/wayland-egl/Makefile.am   |  2 ++
 src/gallium/targets/dri-freedreno/Makefile.am |  2 ++
 src/gallium/targets/dri-i915/Makefile.am  |  2 ++
 src/gallium/targets/dri-ilo/Makefile.am   |  2 ++
 src/gallium/targets/dri-nouveau/Makefile.am   |  2 ++
 src/gallium/targets/dri-swrast/Makefile.am|  2 ++
 src/gallium/targets/dri-vmwgfx/Makefile.am|  2 ++
 src/gallium/targets/egl-static/Makefile.am|  2 ++
 src/gallium/targets/libgl-xlib/Makefile.am|  2 ++
 src/gallium/targets/opencl/Makefile.am|  2 ++
 src/gallium/targets/osmesa/Makefile.am|  2 ++
 src/gallium/targets/r300/dri/Makefile.am  |  2 ++
 src/gallium/targets/r600/dri/Makefile.am  |  2 ++
 src/gallium/targets/radeonsi/dri/Makefile.am  |  2 ++
 src/gallium/targets/xa/Makefile.am|  2 ++
 src/gbm/Makefile.am   |  2 ++
 src/glx/Makefile.am   |  2 ++
 src/mapi/es1api/Makefile.am   |  2 ++
 src/mapi/es2api/Makefile.am   |  2 ++
 src/mapi/shared-glapi/Makefile.am |  2 ++
 src/mapi/vgapi/Makefile.am|  2 ++
 src/mesa/drivers/osmesa/Makefile.am   |  2 ++
 src/mesa/drivers/x11/Makefile.am  |  2 ++
 25 files changed, 60 insertions(+)

diff --git a/configure.ac b/configure.ac
index a7c479c..21db389 100644
--- a/configure.ac
+++ b/configure.ac
@@ -317,6 +317,18 @@ if test "x$enable_debug" = xyes; then
 fi
 
 dnl
+dnl compatibility symlinks
+dnl
+case "$host_os" in
+linux* )
+HAVE_COMPAT_SYMLINKS=yes ;;
+* )
+HAVE_COMPAT_SYMLINKS=no ;;
+esac
+
+AM_CONDITIONAL(HAVE_COMPAT_SYMLINKS, test x$HAVE_COMPAT_SYMLINKS = xyes)
+
+dnl
 dnl library names
 dnl
 if test "$enable_static" = yes; then
diff --git a/src/egl/main/Makefile.am b/src/egl/main/Makefile.am
index 46e890a..e08a06c 100644
--- a/src/egl/main/Makefile.am
+++ b/src/egl/main/Makefile.am
@@ -109,7 +109,9 @@ libEGL_la_LIBADD += ../drivers/dri2/libegl_dri2.la
 libEGL_la_LIBADD += $(DLOPEN_LIBS) $(LIBDRM_LIBS)
 endif
 
+if HAVE_COMPAT_SYMLINKS
 include $(top_srcdir)/install-lib-links.mk
+endif
 
 pkgconfigdir = $(libdir)/pkgconfig
 
diff --git a/src/egl/wayland/wayland-egl/Makefile.am 
b/src/egl/wayland/wayland-egl/Makefile.am
index c8d0196..264d7ad 100644
--- a/src/egl/wayland/wayland-egl/Makefile.am
+++ b/src/egl/wayland/wayland-egl/Makefile.am
@@ -12,4 +12,6 @@ libwayland_egl_la_LDFLAGS = -version-info 1
 
 TESTS = wayland-egl-symbols-check
 
+if HAVE_COMPAT_SYMLINKS
 include $(top_srcdir)/install-lib-links.mk
+endif
diff --git a/src/gallium/targets/dri-freedreno/Makefile.am 
b/src/gallium/targets/dri-freedreno/Makefile.am
index f71fd32..5810e45 100644
--- a/src/gallium/targets/dri-freedreno/Makefile.am
+++ b/src/gallium/targets/dri-freedreno/Makefile.am
@@ -63,4 +63,6 @@ msm_dri_la_SOURCES  = target-msm.c
 msm_dri_la_LDFLAGS  = $(COMMON_LDFLAGS)
 msm_dri_la_LIBADD   = $(COMMON_LIBADD)
 
+if HAVE_COMPAT_SYMLINKS
 include $(top_srcdir)/install-gallium-links.mk
+endif
diff --git a/src/gallium/targets/dri-i915/Makefile.am 
b/src/gallium/targets/dri-i915/Makefile.am
index bba0886..f2852a6 100644
--- a/src/gallium/targets/dri-i915/Makefile.am
+++ b/src/gallium/targets/dri-i915/Makefile.am
@@ -59,4 +59,6 @@ AM_CPPFLAGS += -DGALLIUM_LLVMPIPE
 i915_dri_la_LIBADD += 
$(top_builddir)/src/gallium/drivers/llvmpipe/libllvmpipe.la $(LLVM_LIBS)
 endif
 
+if HAVE_COMPAT_SYMLINKS
 include $(top_srcdir)/install-gallium-links.mk
+endif
diff --git a/src/gallium/targets/dri-ilo/Makefile.am 
b/src/gallium/targets/dri-ilo/Makefile.am
index 18d3c44..10eb7c4 100644
--- a/src/gallium/targets/dri-ilo/Makefile.am
+++ b/src/gallium/targets/dri-ilo/Makefile.am
@@ -59,4 +59,6 @@ ilo_dri_la_LDFLAGS += $(LLVM_LDFLAGS)
 ilo_dri_la_LIBADD += $(LLVM_LIBS)
 endif
 
+if HAVE_COMPAT_SYMLINKS
 include $(top_srcdir)/install-gallium-links.mk
+endif
diff --git a/src/gallium/targets/dri-nouveau/Makefile.am 
b/src/gallium/targets/dri-nouveau/Makefile.am
index 6a00a66..8c3a6f5 100644
--- a/src/gallium/targets/dri-nouveau/Makefile.am
+++ b/src/gallium/targets/dri-nouveau/Makefile.am
@@ -55,4 +55,6 @@ nouveau_dri_la_LDFLAGS += $(LLVM_LDFLAGS)
 nouveau_dri_la_LIBADD += $(LLVM_LIBS)
 endif
 
+if HAVE_COMPAT_SYMLINKS
 include $(top_srcdir)/install-gallium-links.mk
+endif
diff --git a/src/gallium/targets/dri-swrast/Makefile.am 
b/src/gallium/targets/dri-swrast/Makefile.am
index e05e99d..a629da6 100644
--- a/src/gallium/targets/dri-swrast/Makefile.am
+++ b/src/gallium/targets/dri-swrast/Makefile.am
@@ -62,4 +62,6 @@ swrast_dri_la_LDFLAGS += $(LLVM_LDFLAGS)
 swrast_dri_la_L

[Mesa-dev] [PATCH 11/20] automake: do not use symbols names for static glapi.la

2014-03-04 Thread Emil Velikov
In the cases where one links against the static glapi.la there
is no need to create temporary variables only to explicitly
link agaist it.

Instead use SHARED_GLAPI_LIB to explicitly indicate when one
is building and linking with the shared glapi provider.

Signed-off-by: Emil Velikov 
---
 src/gallium/targets/osmesa/Makefile.am | 8 
 src/glx/Makefile.am| 8 +++-
 src/mesa/drivers/osmesa/Makefile.am| 6 +++---
 3 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/src/gallium/targets/osmesa/Makefile.am 
b/src/gallium/targets/osmesa/Makefile.am
index beb9bba..66ddf93 100644
--- a/src/gallium/targets/osmesa/Makefile.am
+++ b/src/gallium/targets/osmesa/Makefile.am
@@ -40,9 +40,8 @@ lib@OSMESA_LIB@_la_SOURCES = target.c
 
 lib@OSMESA_LIB@_la_LDFLAGS = -module -version-number @OSMESA_VERSION@ 
-no-undefined
 
-GLAPI_LIB = $(top_builddir)/src/mapi/glapi/libglapi.la
 if HAVE_SHARED_GLAPI
-GLAPI_LIB += $(top_builddir)/src/mapi/shared-glapi/libglapi.la
+SHARED_GLAPI_LIB = $(top_builddir)/src/mapi/shared-glapi/libglapi.la
 endif
 
 lib@OSMESA_LIB@_la_LIBADD = \
@@ -51,8 +50,9 @@ lib@OSMESA_LIB@_la_LIBADD = \
$(top_builddir)/src/gallium/winsys/sw/null/libws_null.la \
$(top_builddir)/src/gallium/drivers/trace/libtrace.la \
$(top_builddir)/src/gallium/drivers/softpipe/libsoftpipe.la \
-$(top_builddir)/src/gallium/state_trackers/osmesa/libosmesa.la \
-   $(GLAPI_LIB) \
+   $(top_builddir)/src/gallium/state_trackers/osmesa/libosmesa.la \
+   $(top_builddir)/src/mapi/glapi/libglapi.la \
+   $(SHARED_GLAPI_LIB) \
$(OSMESA_LIB_DEPS) \
$(CLOCK_LIB)
 
diff --git a/src/glx/Makefile.am b/src/glx/Makefile.am
index c8dfb86..eb20240 100644
--- a/src/glx/Makefile.am
+++ b/src/glx/Makefile.am
@@ -21,13 +21,11 @@
 
 if HAVE_SHARED_GLAPI
 SHARED_GLAPI_CFLAGS = -DGLX_SHARED_GLAPI
-SHARED_GLAPI_LIBS = $(top_builddir)/src/mapi/shared-glapi/libglapi.la
+SHARED_GLAPI_LIB = $(top_builddir)/src/mapi/shared-glapi/libglapi.la
 endif
 
 SUBDIRS=. tests
 
-GLAPI_LIB = $(top_builddir)/src/mapi/glapi/libglapi.la
-
 if HAVE_XF86VIDMODE
 EXTRA_DEFINES_XF86VIDMODE = -DXF86VIDMODE
 endif
@@ -106,8 +104,8 @@ libglx_la_LIBADD = $(top_builddir)/src/loader/libloader.la
 
 GL_LIBS = \
libglx.la \
-   $(SHARED_GLAPI_LIBS) \
-   $(GLAPI_LIB) \
+   $(top_builddir)/src/mapi/glapi/libglapi.la \
+   $(SHARED_GLAPI_LIB) \
$(GL_LIB_DEPS)
 
 GL_LDFLAGS = \
diff --git a/src/mesa/drivers/osmesa/Makefile.am 
b/src/mesa/drivers/osmesa/Makefile.am
index 2fdd6fd..e18b735 100644
--- a/src/mesa/drivers/osmesa/Makefile.am
+++ b/src/mesa/drivers/osmesa/Makefile.am
@@ -37,14 +37,14 @@ lib@OSMESA_LIB@_la_SOURCES = osmesa.c
 
 lib@OSMESA_LIB@_la_LDFLAGS = -module -version-number @OSMESA_VERSION@ 
-no-undefined
 
-GLAPI_LIB = $(top_builddir)/src/mapi/glapi/libglapi.la
 if HAVE_SHARED_GLAPI
-GLAPI_LIB += $(top_builddir)/src/mapi/shared-glapi/libglapi.la
+SHARED_GLAPI_LIB = $(top_builddir)/src/mapi/shared-glapi/libglapi.la
 endif
 
 lib@OSMESA_LIB@_la_LIBADD = \
$(top_builddir)/src/mesa/libmesa.la \
-   $(GLAPI_LIB) \
+   $(top_builddir)/src/mapi/glapi/libglapi.la \
+   $(SHARED_GLAPI_LIB) \
$(OSMESA_LIB_DEPS)
 
 if BUILD_SHARED
-- 
1.9.0

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


Re: [Mesa-dev] [PATCH 19/20] configure: update enable-llvm-shared-libs comments

2014-03-04 Thread Tom Stellard
On Tue, Mar 04, 2014 at 09:12:43PM +, Emil Velikov wrote:
>  - As of commit cb080a10b68(configure.ac: Don't require shared LLVM when
> building OpenCL) opencl does not mandate using shared llvm.
>  - Add a warning message that building with static llvm may cause
> compilation problems.
> 
> XXX: Tom please update the wiki [1]. Currently it lists the old configure
> switch --with-llvm-shared-libs

I've updated the wiki.

The patch is:
Reviewed-by: Tom Stellard 

> 
> [1] http://dri.freedesktop.org/wiki/GalliumCompute/
> 
> Cc: Tom Stellard 
> Signed-off-by: Emil Velikov 
> ---
>  configure.ac | 23 ++-
>  1 file changed, 10 insertions(+), 13 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 36d7895..7130f6d 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -589,10 +589,8 @@ AC_ARG_ENABLE([omx],
> [enable_omx=no])
>  AC_ARG_ENABLE([opencl],
> [AS_HELP_STRING([--enable-opencl],
> - [enable OpenCL library NOTE: Enabling this option will also enable
> -  --enable-llvm-shared-libs
> -  @<:@default=no@:>@])],
> -   [],
> + [enable OpenCL library @<:@default=no@:>@])],
> +   [enable_opencl="$enableval"],
> [enable_opencl=no])
>  AC_ARG_ENABLE([opencl_icd],
> [AS_HELP_STRING([--enable-opencl-icd],
> @@ -1510,8 +1508,8 @@ AC_ARG_ENABLE([gallium-llvm],
>  AC_ARG_ENABLE([llvm-shared-libs],
>  [AS_HELP_STRING([--enable-llvm-shared-libs],
>  [link with LLVM shared libraries @<:@default=enabled@:>@])],
> -[],
> -[with_llvm_shared_libs=yes])
> +[enable_llvm_shared_libs="$enableval"],
> +[enable_llvm_shared_libs=yes])
>  
>  AC_ARG_WITH([llvm-prefix],
>  [AS_HELP_STRING([--with-llvm-prefix],
> @@ -1853,7 +1851,7 @@ if test "x$MESA_LLVM" != x0; then
>  
>  LLVM_LIBS="`$LLVM_CONFIG --libs ${LLVM_COMPONENTS}`"
>  
> -if test "x$with_llvm_shared_libs" = xyes; then
> +if test "x$enable_llvm_shared_libs" = xyes; then
>  dnl We can't use $LLVM_VERSION because it has 'svn' stripped out,
>  LLVM_SO_NAME=LLVM-`$LLVM_CONFIG --version`
>  AS_IF([test -f "$LLVM_LIBDIR/lib$LLVM_SO_NAME.so"], 
> [llvm_have_one_so=yes])
> @@ -1870,18 +1868,17 @@ if test "x$MESA_LLVM" != x0; then
>   and that your llvm libraries are installed in $LLVM_LIBDIR
>   If you have installed your llvm libraries to a different directory you
>   can use the --with-llvm-prefix= configure flag to specify this 
> directory.
> - NOTE: Mesa is attempting to use llvm shared libraries because you have
> - passed one of the following options to configure:
> - --enable-llvm-shared-libs
> - --enable-opencl
> + NOTE: Mesa is attempting to use llvm shared libraries by default.
>   If you do not want to build with llvm shared libraries and instead want 
> to
> - use llvm static libraries then remove these options from your configure
> - invocation and reconfigure.])])
> + use llvm static libraries then add --disable-llvm-shared-libs to your 
> configure
> + invocation and rebuild.])])
>  
> dnl We don't need to update LLVM_LIBS in this case because the 
> LLVM
> dnl install uses a shared object for each compoenent and we have
> dnl already added all of these objects to LLVM_LIBS.
>  fi
> +else
> +AC_MSG_WARN([Building mesa with staticly linked LLVM may cause 
> compilation issues])
>  fi
>  fi
>  
> -- 
> 1.9.0
> 
> ___
> 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


[Mesa-dev] [Bug 75226] Dark rendering of War for the Overworld

2014-03-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=75226

--- Comment #16 from Fredrik Höglund  ---
(In reply to comment #15)
> Created attachment 95005 [details] [review]
> make winsys fbo sRGB-capable when supported
> 
> This new patch is tested with llvmpipe and ilo, and is also sent to the list
> 
>   http://lists.freedesktop.org/archives/mesa-dev/2014-March/055172.html
> 
> For r600g, Fredrik Höglund's patch is likely still be needed.  Not sure what
> is the best way to get Tested-by and Reviewed-by for the patch.
> 
> @Fredrik Höglund: do you want to send your patch as an independent change?

I think the format translation rewrite Marek pushed also fixes this, so that
patch is probably not needed anymore.

-- 
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 03/10] i965: Drop intel_check_front_buffer_rendering().

2014-03-04 Thread Eric Anholt
This was being applied in a subset of the places that
intel_prepare_render() was called, to set the same flag that
intel_prepare_render() was setting.
---
 src/mesa/drivers/dri/i965/brw_state_upload.c   |  2 --
 src/mesa/drivers/dri/i965/intel_buffers.c  | 18 --
 src/mesa/drivers/dri/i965/intel_buffers.h  |  2 --
 src/mesa/drivers/dri/i965/intel_pixel_bitmap.c |  2 --
 src/mesa/drivers/dri/i965/intel_pixel_copy.c   |  1 -
 src/mesa/drivers/dri/i965/intel_pixel_draw.c   |  2 --
 6 files changed, 27 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c 
b/src/mesa/drivers/dri/i965/brw_state_upload.c
index 226a9c0..7ae2e1e 100644
--- a/src/mesa/drivers/dri/i965/brw_state_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_state_upload.c
@@ -607,8 +607,6 @@ void brw_upload_state(struct brw_context *brw)
if ((state->mesa | state->cache | state->brw) == 0)
   return;
 
-   intel_check_front_buffer_rendering(brw);
-
if (unlikely(INTEL_DEBUG)) {
   /* Debug version which enforces various sanity checks on the
* state flags which are generated and checked to help ensure
diff --git a/src/mesa/drivers/dri/i965/intel_buffers.c 
b/src/mesa/drivers/dri/i965/intel_buffers.c
index 23d936f..f151287 100644
--- a/src/mesa/drivers/dri/i965/intel_buffers.c
+++ b/src/mesa/drivers/dri/i965/intel_buffers.c
@@ -34,24 +34,6 @@
 #include "main/framebuffer.h"
 #include "main/renderbuffer.h"
 
-/**
- * Check if we're about to draw into the front color buffer.
- * If so, set the brw->front_buffer_dirty field to true.
- */
-void
-intel_check_front_buffer_rendering(struct brw_context *brw)
-{
-   struct gl_context *ctx = &brw->ctx;
-   const struct gl_framebuffer *fb = ctx->DrawBuffer;
-   if (_mesa_is_winsys_fbo(fb)) {
-  /* drawing to window system buffer */
-  if (fb->_NumColorDrawBuffers > 0) {
- if (fb->_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT) {
-   brw->front_buffer_dirty = true;
-}
-  }
-   }
-}
 
 bool
 brw_is_front_buffer_reading(struct gl_framebuffer *fb)
diff --git a/src/mesa/drivers/dri/i965/intel_buffers.h 
b/src/mesa/drivers/dri/i965/intel_buffers.h
index f0f6b68..9014029 100644
--- a/src/mesa/drivers/dri/i965/intel_buffers.h
+++ b/src/mesa/drivers/dri/i965/intel_buffers.h
@@ -35,8 +35,6 @@
 
 struct intel_framebuffer;
 
-extern void intel_check_front_buffer_rendering(struct brw_context *brw);
-
 extern void intelInitBufferFuncs(struct dd_function_table *functions);
 
 bool brw_is_front_buffer_reading(struct gl_framebuffer *fb);
diff --git a/src/mesa/drivers/dri/i965/intel_pixel_bitmap.c 
b/src/mesa/drivers/dri/i965/intel_pixel_bitmap.c
index 49a9bed..29c2d28 100644
--- a/src/mesa/drivers/dri/i965/intel_pixel_bitmap.c
+++ b/src/mesa/drivers/dri/i965/intel_pixel_bitmap.c
@@ -321,8 +321,6 @@ out:
   ctx->Driver.UnmapBuffer(ctx, unpack->BufferObj, MAP_INTERNAL);
}
 
-   intel_check_front_buffer_rendering(brw);
-
return true;
 }
 
diff --git a/src/mesa/drivers/dri/i965/intel_pixel_copy.c 
b/src/mesa/drivers/dri/i965/intel_pixel_copy.c
index 486e308..858be26 100644
--- a/src/mesa/drivers/dri/i965/intel_pixel_copy.c
+++ b/src/mesa/drivers/dri/i965/intel_pixel_copy.c
@@ -190,7 +190,6 @@ do_blit_copypixels(struct gl_context * ctx,
   ctx->Query.CurrentOcclusionObject->Result += width * height;
 
 out:
-   intel_check_front_buffer_rendering(brw);
 
DBG("%s: success\n", __FUNCTION__);
return true;
diff --git a/src/mesa/drivers/dri/i965/intel_pixel_draw.c 
b/src/mesa/drivers/dri/i965/intel_pixel_draw.c
index 2925b63..8ca8ae4 100644
--- a/src/mesa/drivers/dri/i965/intel_pixel_draw.c
+++ b/src/mesa/drivers/dri/i965/intel_pixel_draw.c
@@ -133,8 +133,6 @@ do_blit_drawpixels(struct gl_context * ctx,
if (ctx->Query.CurrentOcclusionObject)
   ctx->Query.CurrentOcclusionObject->Result += width * height;
 
-   intel_check_front_buffer_rendering(brw);
-
DBG("%s: success\n", __FUNCTION__);
return true;
 }
-- 
1.9.rc1

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


[Mesa-dev] [PATCH 01/10] intel: When checking for updating front buffer reading, use the right fb.

2014-03-04 Thread Eric Anholt
It's the ctx->ReadBuffer that gets read from, not the ctx->DrawBuffer.
So, if you happened to have a ctx->ReadBuffer that was the winsys buffer,
and it had previously been intel_prepare_render()ed but not invalidated
since then, and you called glReadBuffer() to switch to front buffer
instead of back buffer reading on the winsys fbo while your drawbuffer was
a user FBO, you'd never get the front buffer's miptree fetched, and
segfault.
---
 src/mesa/drivers/dri/i915/intel_buffers.c | 2 +-
 src/mesa/drivers/dri/i965/intel_buffers.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/intel_buffers.c 
b/src/mesa/drivers/dri/i915/intel_buffers.c
index cf4ba4b..51eaea4 100644
--- a/src/mesa/drivers/dri/i915/intel_buffers.c
+++ b/src/mesa/drivers/dri/i915/intel_buffers.c
@@ -78,7 +78,7 @@ intelDrawBuffer(struct gl_context * ctx, GLenum mode)
 static void
 intelReadBuffer(struct gl_context * ctx, GLenum mode)
 {
-   if (ctx->DrawBuffer && _mesa_is_winsys_fbo(ctx->DrawBuffer)) {
+   if (ctx->ReadBuffer && _mesa_is_winsys_fbo(ctx->ReadBuffer)) {
   struct intel_context *const intel = intel_context(ctx);
   const bool was_front_buffer_reading =
intel->is_front_buffer_reading;
diff --git a/src/mesa/drivers/dri/i965/intel_buffers.c 
b/src/mesa/drivers/dri/i965/intel_buffers.c
index 9e3b585..1ece875 100644
--- a/src/mesa/drivers/dri/i965/intel_buffers.c
+++ b/src/mesa/drivers/dri/i965/intel_buffers.c
@@ -76,7 +76,7 @@ intelDrawBuffer(struct gl_context * ctx, GLenum mode)
 static void
 intelReadBuffer(struct gl_context * ctx, GLenum mode)
 {
-   if (ctx->DrawBuffer && _mesa_is_winsys_fbo(ctx->DrawBuffer)) {
+   if (ctx->ReadBuffer && _mesa_is_winsys_fbo(ctx->ReadBuffer)) {
   struct brw_context *const brw = brw_context(ctx);
   const bool was_front_buffer_reading = brw->is_front_buffer_reading;
 
-- 
1.9.rc1

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


[Mesa-dev] [PATCH 06/10] i965: Change the winsys MSAA blits from blorp to meta.

2014-03-04 Thread Eric Anholt
This gets us equivalent code paths on BDW and pre-BDW, except for stencil
(where we don't have MSAA stencil resolve code yet)
---
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 111 --
 1 file changed, 103 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c 
b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 202bb52..3c09a42 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -40,12 +40,16 @@
 #include "brw_blorp.h"
 #include "brw_context.h"
 
+#include "main/blit.h"
+#include "main/buffers.h"
 #include "main/enums.h"
+#include "main/fbobject.h"
 #include "main/formats.h"
 #include "main/glformats.h"
 #include "main/texcompress_etc.h"
 #include "main/teximage.h"
 #include "main/streaming-load-memcpy.h"
+#include "drivers/common/meta.h"
 
 #define FILE_DEBUG_FLAG DEBUG_MIPTREE
 
@@ -1538,19 +1542,110 @@ intel_offset_S8(uint32_t stride, uint32_t x, uint32_t 
y, bool swizzled)
return u;
 }
 
+static void
+intel_rb_storage_first_mt_slice(struct brw_context *brw,
+GLuint rbo,
+struct intel_mipmap_tree *mt)
+{
+   struct gl_context *ctx = &brw->ctx;
+   struct gl_renderbuffer *rb;
+   struct intel_renderbuffer *irb;
+
+   /* This turns the GenRenderbuffers name into an actual struct
+* intel_renderbuffer.
+*/
+   _mesa_BindRenderbuffer(GL_RENDERBUFFER, rbo);
+
+   rb = ctx->CurrentRenderbuffer;
+   irb = intel_renderbuffer(rb);
+
+   rb->Format = mt->format;
+   rb->_BaseFormat = _mesa_base_fbo_format(ctx, mt->format);
+
+   rb->NumSamples = mt->num_samples;
+   rb->Width = mt->logical_width0;
+   rb->Height = mt->logical_height0;
+
+   intel_miptree_reference(&irb->mt, mt);
+}
+
+/**
+ * Implementation of up or downsampling for window-system MSAA miptrees.
+ */
+static void
+intel_miptree_msaa_copy(struct brw_context *brw,
+struct intel_mipmap_tree *src_mt,
+struct intel_mipmap_tree *dst_mt)
+{
+   struct gl_context *ctx = &brw->ctx;
+   GLuint rbos[2], fbos[2], src_rbo, dst_rbo, src_fbo, dst_fbo;
+   GLenum drawbuffer;
+   GLbitfield attachment, blit_bit;
+
+   if (_mesa_get_format_base_format(src_mt->format) == GL_DEPTH_COMPONENT ||
+   _mesa_get_format_base_format(src_mt->format) == GL_DEPTH_STENCIL) {
+  attachment = GL_DEPTH_ATTACHMENT;
+  drawbuffer = GL_NONE;
+  blit_bit = GL_DEPTH_BUFFER_BIT;
+   } else {
+  attachment = GL_COLOR_ATTACHMENT0;
+  drawbuffer = GL_COLOR_ATTACHMENT0;
+  blit_bit = GL_COLOR_BUFFER_BIT;
+   }
+
+   intel_batchbuffer_emit_mi_flush(brw);
+
+   _mesa_meta_begin(ctx, MESA_META_ALL);
+   _mesa_GenRenderbuffers(2, rbos);
+   _mesa_GenFramebuffers(2, fbos);
+   src_rbo = rbos[0];
+   dst_rbo = rbos[1];
+   src_fbo = fbos[0];
+   dst_fbo = fbos[1];
+
+   _mesa_BindFramebuffer(GL_READ_FRAMEBUFFER, src_fbo);
+   intel_rb_storage_first_mt_slice(brw, src_rbo, src_mt);
+   _mesa_FramebufferRenderbuffer(GL_READ_FRAMEBUFFER, attachment,
+ GL_RENDERBUFFER, src_rbo);
+   _mesa_ReadBuffer(drawbuffer);
+
+   _mesa_BindFramebuffer(GL_DRAW_FRAMEBUFFER, dst_fbo);
+   intel_rb_storage_first_mt_slice(brw, dst_rbo, dst_mt);
+   _mesa_FramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, attachment,
+ GL_RENDERBUFFER, dst_rbo);
+   _mesa_DrawBuffer(drawbuffer);
+
+   _mesa_BlitFramebuffer(0, 0,
+ src_mt->logical_width0, src_mt->logical_height0,
+ 0, 0,
+ dst_mt->logical_width0, dst_mt->logical_height0,
+ blit_bit, GL_NEAREST);
+
+   _mesa_DeleteRenderbuffers(2, rbos);
+   _mesa_DeleteFramebuffers(2, fbos);
+
+   _mesa_meta_end(ctx);
+
+   intel_batchbuffer_emit_mi_flush(brw);
+}
+
 void
 intel_miptree_updownsample(struct brw_context *brw,
struct intel_mipmap_tree *src,
struct intel_mipmap_tree *dst)
 {
-   brw_blorp_blit_miptrees(brw,
-   src, 0 /* level */, 0 /* layer */,
-   dst, 0 /* level */, 0 /* layer */,
-   0, 0,
-   src->logical_width0, src->logical_height0,
-   0, 0,
-   dst->logical_width0, dst->logical_height0,
-   GL_NEAREST, false, false /*mirror x, y*/);
+   if (src->format == MESA_FORMAT_S_UINT8) {
+  brw_blorp_blit_miptrees(brw,
+  src, 0 /* level */, 0 /* layer */,
+  dst, 0 /* level */, 0 /* layer */,
+  0, 0,
+  src->logical_width0, src->logical_height0,
+  0, 0,
+  dst->logical_width0, dst->logical_height0,
+  GL_NEAREST, false, false /*mirro

[Mesa-dev] [PATCH 09/10] meta: Add support for MSAA resolves from 2D_MS_ARRAY textures.

2014-03-04 Thread Eric Anholt
---
 src/mesa/drivers/common/meta.h  |  8 
 src/mesa/drivers/common/meta_blit.c | 23 +++
 2 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h
index 00553e2..5d60690 100644
--- a/src/mesa/drivers/common/meta.h
+++ b/src/mesa/drivers/common/meta.h
@@ -238,6 +238,14 @@ enum blit_msaa_shader {
BLIT_MSAA_SHADER_2D_MULTISAMPLE_COPY_UINT,
BLIT_MSAA_SHADER_2D_MULTISAMPLE_DEPTH_RESOLVE,
BLIT_MSAA_SHADER_2D_MULTISAMPLE_DEPTH_COPY,
+   BLIT_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE,
+   BLIT_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE_INT,
+   BLIT_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE_UINT,
+   BLIT_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_COPY,
+   BLIT_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_COPY_INT,
+   BLIT_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_COPY_UINT,
+   BLIT_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_DEPTH_RESOLVE,
+   BLIT_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_DEPTH_COPY,
BLIT_MSAA_SHADER_COUNT,
 };
 
diff --git a/src/mesa/drivers/common/meta_blit.c 
b/src/mesa/drivers/common/meta_blit.c
index 9756d86..550133f 100644
--- a/src/mesa/drivers/common/meta_blit.c
+++ b/src/mesa/drivers/common/meta_blit.c
@@ -97,6 +97,7 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
bool dst_is_msaa = false;
GLenum src_datatype;
const char *vec4_prefix;
+   const char *sampler_array_suffix = "";
char *name;
 
if (src_rb) {
@@ -125,6 +126,7 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
 
switch (target) {
case GL_TEXTURE_2D_MULTISAMPLE:
+   case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
   if (src_rb->_BaseFormat == GL_DEPTH_COMPONENT ||
   src_rb->_BaseFormat == GL_DEPTH_STENCIL) {
  if (dst_is_msaa)
@@ -137,6 +139,12 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
  else
 shader_index = BLIT_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE;
   }
+
+  if (target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY) {
+ shader_index += (BLIT_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE -
+  BLIT_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE);
+ sampler_array_suffix = "Array";
+  }
   break;
default:
   _mesa_problem(ctx, "Unkown texture target %s\n",
@@ -167,6 +175,8 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
mem_ctx = ralloc_context(NULL);
 
if (shader_index == BLIT_MSAA_SHADER_2D_MULTISAMPLE_DEPTH_RESOLVE ||
+   shader_index == BLIT_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_DEPTH_RESOLVE ||
+   shader_index == BLIT_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_DEPTH_COPY ||
shader_index == BLIT_MSAA_SHADER_2D_MULTISAMPLE_DEPTH_COPY) {
   char *sample_index;
   const char *arb_sample_shading_extension_string;
@@ -208,7 +218,7 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
   "#version 130\n"
   "#extension GL_ARB_texture_multisample : 
enable\n"
   "%s\n"
-  "uniform sampler2DMS texSampler;\n"
+  "uniform sampler2DMS%s texSampler;\n"
   "in vec2 texCoords;\n"
   "out vec4 out_color;\n"
   "\n"
@@ -217,6 +227,7 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
   "   gl_FragDepth = texelFetch(texSampler, 
ivec2(texCoords), %s).r;\n"
   "}\n",
   arb_sample_shading_extension_string,
+  sampler_array_suffix,
   sample_index);
} else {
   /* You can create 2D_MULTISAMPLE textures with 0 sample count (meaning 1
@@ -306,7 +317,7 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
   "#extension GL_ARB_texture_multisample : 
enable\n"
   "%s\n"
   "#define gvec4 %svec4\n"
-  "uniform %ssampler2DMS texSampler;\n"
+  "uniform %ssampler2DMS%s texSampler;\n"
   "in vec2 texCoords;\n"
   "out gvec4 out_color;\n"
   "\n"
@@ -318,6 +329,7 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
   arb_sample_shading_extension_string,
   vec4_prefix,
   vec4_prefix,
+  sampler_array_suffix,
   merge_function,
   sample_resolve);
}
@@ -350,7 +362,8 @@ setup_glsl_blit_framebuffer(struct gl_context *ctx,
 
_mesa_meta_setup_vertex_objects(&blit->VAO, &blit->VBO, true, 2, 2, 0);
 
-   if (target == GL_TEXTURE_2D_MULTISAMPLE) {
+   if (target == GL_TEXTURE_2D_MULTI

[Mesa-dev] [PATCH 07/10] meta: Add an accelerated glCopyTexSubImage using glBlitFramebuffer.

2014-03-04 Thread Eric Anholt
We have to be a little careful here, because BlitFB itself has a fallback
path that calls CopyTexSubImage(), so we reach over into its state to tell
it to skip that case.
---
 src/mesa/drivers/common/meta.c  | 177 ++--
 src/mesa/drivers/common/meta.h  |   1 +
 src/mesa/drivers/common/meta_blit.c |   3 +-
 3 files changed, 130 insertions(+), 51 deletions(-)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 24eb0a3..90e49fd 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -37,6 +37,7 @@
 #include "main/arbprogram.h"
 #include "main/arrayobj.h"
 #include "main/blend.h"
+#include "main/blit.h"
 #include "main/bufferobj.h"
 #include "main/buffers.h"
 #include "main/colortab.h"
@@ -93,6 +94,41 @@ static void meta_glsl_generate_mipmap_cleanup(struct 
gen_mipmap_state *mipmap);
 static void meta_decompress_cleanup(struct decompress_state *decompress);
 static void meta_drawpix_cleanup(struct drawpix_state *drawpix);
 
+static void
+meta_framebuffer_texture_layer(GLenum fb_target,
+   GLenum attachment,
+   const struct gl_texture_image *texImage,
+   int layer)
+{
+   struct gl_texture_object *texObj = texImage->TexObject;
+   int level = texImage->Level;
+
+   switch (texObj->Target) {
+   case GL_TEXTURE_1D:
+  _mesa_FramebufferTexture1D(fb_target, attachment,
+ texObj->Target, texObj->Name, level);
+  break;
+   case GL_TEXTURE_1D_ARRAY:
+   case GL_TEXTURE_2D_ARRAY:
+   case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
+   case GL_TEXTURE_CUBE_MAP_ARRAY:
+   case GL_TEXTURE_3D:
+  _mesa_FramebufferTextureLayer(fb_target, attachment,
+texObj->Name, level, layer);
+  break;
+   case GL_TEXTURE_CUBE_MAP:
+  _mesa_FramebufferTexture2D(fb_target, attachment,
+ (GL_TEXTURE_CUBE_MAP_POSITIVE_X +
+  texImage->Face),
+ texObj->Name, level);
+  break;
+   default:
+  _mesa_FramebufferTexture2D(fb_target, attachment,
+ texObj->Target, texObj->Name, level);
+  break;
+   }
+}
+
 GLuint
 _mesa_meta_compile_shader_with_debug(struct gl_context *ctx, GLenum target,
  const GLcharARB *source)
@@ -2436,26 +2472,8 @@ _mesa_meta_check_generate_mipmap_fallback(struct 
gl_context *ctx, GLenum target,
   _mesa_GenFramebuffers(1, &mipmap->FBO);
_mesa_BindFramebuffer(GL_FRAMEBUFFER_EXT, mipmap->FBO);
 
-   if (target == GL_TEXTURE_1D) {
-  _mesa_FramebufferTexture1D(GL_FRAMEBUFFER_EXT,
-GL_COLOR_ATTACHMENT0_EXT,
-target, texObj->Name, srcLevel);
-   }
-#if 0
-   /* other work is needed to enable 3D mipmap generation */
-   else if (target == GL_TEXTURE_3D) {
-  GLint zoffset = 0;
-  _mesa_FramebufferTexture3D(GL_FRAMEBUFFER_EXT,
-GL_COLOR_ATTACHMENT0_EXT,
-target, texObj->Name, srcLevel, zoffset);
-   }
-#endif
-   else {
-  /* 2D / cube */
-  _mesa_FramebufferTexture2D(GL_FRAMEBUFFER_EXT,
-GL_COLOR_ATTACHMENT0_EXT,
-target, texObj->Name, srcLevel);
-   }
+   meta_framebuffer_texture_layer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+  baseImage, 0);
 
status = _mesa_CheckFramebufferStatus(GL_FRAMEBUFFER_EXT);
 
@@ -2848,7 +2866,7 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum 
target,
_mesa_unlock_texture(ctx, texObj);
 
for (dstLevel = baseLevel + 1; dstLevel <= maxLevel; dstLevel++) {
-  const struct gl_texture_image *srcImage;
+  const struct gl_texture_image *srcImage, *dstImage;
   const GLuint srcLevel = dstLevel - 1;
   GLsizei srcWidth, srcHeight, srcDepth;
   GLsizei dstWidth, dstHeight, dstDepth;
@@ -2889,34 +2907,13 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, 
GLenum target,
   */
  break;
   }
+  dstImage = _mesa_select_tex_image(ctx, texObj, faceTarget, dstLevel);
 
   /* limit minification to src level */
   _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, srcLevel);
 
-  /* Set to draw into the current dstLevel */
-  if (target == GL_TEXTURE_1D) {
- _mesa_FramebufferTexture1D(GL_FRAMEBUFFER_EXT,
-   GL_COLOR_ATTACHMENT0_EXT,
-   target,
-   texObj->Name,
-   dstLevel);
-  }
-  else if (target == GL_TEXTURE_3D) {
- GLint zoffset = 0; /* XXX unfinished */
- _mesa_FramebufferTexture3D(GL_FRAMEBUFFER_EXT,
-   GL_COLOR_AT

[Mesa-dev] meta CopyTexSubImage and BlitFramebuffer, intel front buffer bugs

2014-03-04 Thread Eric Anholt
Here's another series of meta stuff: Replacing the winsys MSAA blits with
meta instead of blorp where possible, and making CopyTexSubImage use meta
instead of blorp.  In the process I found I had to fix some other bugs in
meta's BlitFramebuffer.

There are a few intel patches at the start to avoid regressions from this
code -- the way I happened to bind the renderbuffers for the MSAA blits
tickled those bugs.  However, front buffer rendering is so incredibly
fragile that, even though I think they're correct bugfixes, I don't want
to mark them as stable candidates.

This is on the meta-ctsi-2 branch of my tree.

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


[Mesa-dev] [PATCH 04/10] meta: Always restore the framebuffers and current renderbuffer.

2014-03-04 Thread Eric Anholt
The few paths that were playing with framebuffers and renderbuffer were
saving and restoring them, but I was writing another path doing so in this
series, and forgot to.
---
 src/mesa/drivers/common/meta.c | 36 +++-
 src/mesa/drivers/common/meta.h |  2 ++
 2 files changed, 17 insertions(+), 21 deletions(-)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index cde34f9..24eb0a3 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -734,6 +734,11 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
   save->RasterDiscard = ctx->RasterDiscard;
   if (ctx->RasterDiscard)
  _mesa_set_enable(ctx, GL_RASTERIZER_DISCARD, GL_FALSE);
+
+  save->DrawBufferName = ctx->DrawBuffer->Name;
+  save->ReadBufferName = ctx->ReadBuffer->Name;
+  save->RenderbufferName = (ctx->CurrentRenderbuffer ?
+ctx->CurrentRenderbuffer->Name : 0);
}
 }
 
@@ -1080,6 +1085,16 @@ _mesa_meta_end(struct gl_context *ctx)
if (save->TransformFeedbackNeedsResume)
   _mesa_ResumeTransformFeedback();
 
+   if (ctx->DrawBuffer->Name != save->DrawBufferName)
+  _mesa_BindFramebuffer(GL_DRAW_FRAMEBUFFER, save->DrawBufferName);
+
+   if (ctx->ReadBuffer->Name != save->ReadBufferName)
+  _mesa_BindFramebuffer(GL_READ_FRAMEBUFFER, save->ReadBufferName);
+
+   if (!ctx->CurrentRenderbuffer ||
+   ctx->CurrentRenderbuffer->Name != save->RenderbufferName)
+  _mesa_BindRenderbuffer(GL_RENDERBUFFER, save->RenderbufferName);
+
ctx->Meta->SaveStackDepth--;
 
ctx->API = save->API;
@@ -2727,7 +2742,6 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum 
target,
const GLuint maxLevel = texObj->MaxLevel;
const GLint maxLevelSave = texObj->MaxLevel;
const GLboolean genMipmapSave = texObj->GenerateMipmap;
-   const GLuint fboSave = ctx->DrawBuffer->Name;
const GLuint currentTexUnitSave = ctx->Texture.CurrentUnit;
const GLboolean use_glsl_version = ctx->Extensions.ARB_vertex_shader &&
   ctx->Extensions.ARB_fragment_shader;
@@ -2932,8 +2946,6 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum 
target,
_mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, maxLevelSave);
if (genMipmapSave)
   _mesa_TexParameteri(target, GL_GENERATE_MIPMAP, genMipmapSave);
-
-   _mesa_BindFramebuffer(GL_FRAMEBUFFER_EXT, fboSave);
 }
 
 
@@ -2988,7 +3000,6 @@ get_temp_image_type(struct gl_context *ctx, mesa_format 
format)
}
 }
 
-
 /**
  * Helper for _mesa_meta_CopyTexSubImage1/2/3D() functions.
  * Have to be careful with locking and meta state for pixel transfer.
@@ -3122,8 +3133,6 @@ decompress_texture_image(struct gl_context *ctx,
const GLenum target = texObj->Target;
GLenum faceTarget;
struct vertex verts[4];
-   GLuint fboDrawSave, fboReadSave;
-   GLuint rbSave;
GLuint samplerSave;
const bool use_glsl_version = ctx->Extensions.ARB_vertex_shader &&
   ctx->Extensions.ARB_fragment_shader;
@@ -3157,11 +3166,6 @@ decompress_texture_image(struct gl_context *ctx,
   break;
}
 
-   /* save fbo bindings (not saved by _mesa_meta_begin()) */
-   fboDrawSave = ctx->DrawBuffer->Name;
-   fboReadSave = ctx->ReadBuffer->Name;
-   rbSave = ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0;
-
_mesa_meta_begin(ctx, MESA_META_ALL & ~MESA_META_PIXEL_STORE);
 
samplerSave = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Sampler ?
@@ -3310,16 +3314,6 @@ decompress_texture_image(struct gl_context *ctx,
_mesa_BindSampler(ctx->Texture.CurrentUnit, samplerSave);
 
_mesa_meta_end(ctx);
-
-   /* restore fbo bindings */
-   if (fboDrawSave == fboReadSave) {
-  _mesa_BindFramebuffer(GL_FRAMEBUFFER_EXT, fboDrawSave);
-   }
-   else {
-  _mesa_BindFramebuffer(GL_DRAW_FRAMEBUFFER_EXT, fboDrawSave);
-  _mesa_BindFramebuffer(GL_READ_FRAMEBUFFER_EXT, fboReadSave);
-   }
-   _mesa_BindRenderbuffer(GL_RENDERBUFFER_EXT, rbSave);
 }
 
 
diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h
index fcf45c4..104849a 100644
--- a/src/mesa/drivers/common/meta.h
+++ b/src/mesa/drivers/common/meta.h
@@ -177,6 +177,8 @@ struct save_state
GLboolean Lighting;
GLboolean RasterDiscard;
GLboolean TransformFeedbackNeedsResume;
+
+   GLuint DrawBufferName, ReadBufferName, RenderbufferName;
 };
 
 /**
-- 
1.9.rc1

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


[Mesa-dev] [PATCH 08/10] i965: Remove the blorp CTSI path.

2014-03-04 Thread Eric Anholt
The meta patch supports all the same, except for the stencil case being
unaccelerated.
---
 src/mesa/drivers/dri/i965/brw_blorp_blit.cpp | 105 ---
 src/mesa/drivers/dri/i965/brw_context.h  |   9 ---
 src/mesa/drivers/dri/i965/intel_tex_copy.c   |   9 +--
 3 files changed, 1 insertion(+), 122 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp 
b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
index acdc9c7..fbed8ce 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
@@ -334,111 +334,6 @@ try_blorp_blit(struct brw_context *brw,
return true;
 }
 
-bool
-brw_blorp_copytexsubimage(struct brw_context *brw,
-  struct gl_renderbuffer *src_rb,
-  struct gl_texture_image *dst_image,
-  int slice,
-  int srcX0, int srcY0,
-  int dstX0, int dstY0,
-  int width, int height)
-{
-   struct gl_context *ctx = &brw->ctx;
-   struct intel_renderbuffer *src_irb = intel_renderbuffer(src_rb);
-   struct intel_texture_image *intel_image = intel_texture_image(dst_image);
-
-   /* Sync up the state of window system buffers.  We need to do this before
-* we go looking at the src renderbuffer's miptree.
-*/
-   intel_prepare_render(brw);
-
-   struct intel_mipmap_tree *src_mt = src_irb->mt;
-   struct intel_mipmap_tree *dst_mt = intel_image->mt;
-
-   /* BLORP is not supported before Gen6. */
-   if (brw->gen < 6 || brw->gen >= 8)
-  return false;
-
-   if (_mesa_get_format_base_format(src_mt->format) !=
-   _mesa_get_format_base_format(dst_mt->format)) {
-  return false;
-   }
-
-   /* We can't handle format conversions between Z24 and other formats since
-* we have to lie about the surface format.  See the comments in
-* brw_blorp_surface_info::set().
-*/
-   if ((src_mt->format == MESA_FORMAT_Z24_UNORM_X8_UINT) !=
-   (dst_mt->format == MESA_FORMAT_Z24_UNORM_X8_UINT)) {
-  return false;
-   }
-
-   if (!brw->format_supported_as_render_target[dst_mt->format])
-  return false;
-
-   /* Source clipping shouldn't be necessary, since copytexsubimage (in
-* src/mesa/main/teximage.c) calls _mesa_clip_copytexsubimage() which
-* takes care of it.
-*
-* Destination clipping shouldn't be necessary since the restrictions on
-* glCopyTexSubImage prevent the user from specifying a destination 
rectangle
-* that falls outside the bounds of the destination texture.
-* See error_check_subtexture_dimensions().
-*/
-
-   int srcY1 = srcY0 + height;
-   int srcX1 = srcX0 + width;
-   int dstX1 = dstX0 + width;
-   int dstY1 = dstY0 + height;
-
-   /* Account for the fact that in the system framebuffer, the origin is at
-* the lower left.
-*/
-   bool mirror_y = false;
-   if (_mesa_is_winsys_fbo(ctx->ReadBuffer)) {
-  GLint tmp = src_rb->Height - srcY0;
-  srcY0 = src_rb->Height - srcY1;
-  srcY1 = tmp;
-  mirror_y = true;
-   }
-
-   brw_blorp_blit_miptrees(brw,
-   src_mt, src_irb->mt_level, src_irb->mt_layer,
-   dst_mt, dst_image->Level, dst_image->Face + slice,
-   srcX0, srcY0, srcX1, srcY1,
-   dstX0, dstY0, dstX1, dstY1,
-   GL_NEAREST, false, mirror_y);
-
-   /* If we're copying to a packed depth stencil texture and the source
-* framebuffer has separate stencil, we need to also copy the stencil data
-* over.
-*/
-   src_rb = ctx->ReadBuffer->Attachment[BUFFER_STENCIL].Renderbuffer;
-   if (_mesa_get_format_bits(dst_image->TexFormat, GL_STENCIL_BITS) > 0 &&
-   src_rb != NULL) {
-  src_irb = intel_renderbuffer(src_rb);
-  src_mt = src_irb->mt;
-
-  if (src_mt->stencil_mt)
- src_mt = src_mt->stencil_mt;
-  if (dst_mt->stencil_mt)
- dst_mt = dst_mt->stencil_mt;
-
-  if (src_mt != dst_mt) {
- brw_blorp_blit_miptrees(brw,
- src_mt, src_irb->mt_level, src_irb->mt_layer,
- dst_mt, dst_image->Level,
- dst_image->Face + slice,
- srcX0, srcY0, srcX1, srcY1,
- dstX0, dstY0, dstX1, dstY1,
- GL_NEAREST, false, mirror_y);
-  }
-   }
-
-   return true;
-}
-
-
 GLbitfield
 brw_blorp_framebuffer(struct brw_context *brw,
   GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
diff --git a/src/mesa/drivers/dri/i965/brw_context.h 
b/src/mesa/drivers/dri/i965/brw_context.h
index ccbe9ea..5568fcb 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -1710,15 +1710,6 @@ brw_blorp_framebuffer(struct brw_context *brw,
   GLint dstX0, GLint dstY0, GLint dstX1, GLint 

[Mesa-dev] [PATCH 02/10] i965: Drop broken front_buffer_reading/drawing optimization.

2014-03-04 Thread Eric Anholt
The flag wasn't getting updated correctly when the ctx->DrawBuffer or
ctx->ReadBuffer changed.  It usually ended up working out because most
apps only have one window system framebuffer, or if they have more than
one and they have any front read/drawing, they will have called
glReadBuffer()/glDrawBuffer() on it when they get started on the new
buffer.
---
 src/mesa/drivers/dri/i965/brw_context.c   | 19 -
 src/mesa/drivers/dri/i965/brw_context.h   | 17 
 src/mesa/drivers/dri/i965/brw_draw.c  |  3 ++-
 src/mesa/drivers/dri/i965/intel_buffers.c | 44 +++
 src/mesa/drivers/dri/i965/intel_buffers.h |  3 +++
 5 files changed, 44 insertions(+), 42 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
b/src/mesa/drivers/dri/i965/brw_context.c
index 1441b46..6e21bb8 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -204,7 +204,7 @@ intel_glFlush(struct gl_context *ctx)
 
intel_batchbuffer_flush(brw);
intel_flush_front(ctx);
-   if (brw->is_front_buffer_rendering)
+   if (brw_is_front_buffer_drawing(ctx->DrawBuffer))
   brw->need_throttle = true;
 }
 
@@ -1115,6 +1115,7 @@ intel_update_renderbuffers(__DRIcontext *context, 
__DRIdrawable *drawable)
 void
 intel_prepare_render(struct brw_context *brw)
 {
+   struct gl_context *ctx = &brw->ctx;
__DRIcontext *driContext = brw->driContext;
__DRIdrawable *drawable;
 
@@ -1136,7 +1137,7 @@ intel_prepare_render(struct brw_context *brw)
 * that will happen next will probably dirty the front buffer.  So
 * mark it as dirty here.
 */
-   if (brw->is_front_buffer_rendering)
+   if (brw_is_front_buffer_drawing(ctx->DrawBuffer))
   brw->front_buffer_dirty = true;
 
/* Wait for the swapbuffers before the one we just emitted, so we
@@ -1198,8 +1199,8 @@ intel_query_dri2_buffers(struct brw_context *brw,
back_rb = intel_get_renderbuffer(fb, BUFFER_BACK_LEFT);
 
memset(attachments, 0, sizeof(attachments));
-   if ((brw->is_front_buffer_rendering ||
-brw->is_front_buffer_reading ||
+   if ((brw_is_front_buffer_drawing(fb) ||
+brw_is_front_buffer_reading(fb) ||
 !back_rb) && front_rb) {
   /* If a fake front buffer is in use, then querying for
* __DRI_BUFFER_FRONT_LEFT will cause the server to copy the image from
@@ -1261,6 +1262,7 @@ intel_process_dri2_buffer(struct brw_context *brw,
   const char *buffer_name)
 {
struct intel_region *region = NULL;
+   struct gl_framebuffer *fb = drawable->driverPrivate;
 
if (!rb)
   return;
@@ -1310,7 +1312,7 @@ intel_process_dri2_buffer(struct brw_context *brw,
 
intel_update_winsys_renderbuffer_miptree(brw, rb, region);
 
-   if (brw->is_front_buffer_rendering &&
+   if (brw_is_front_buffer_drawing(fb) &&
(buffer->attachment == __DRI_BUFFER_FRONT_LEFT ||
 buffer->attachment == __DRI_BUFFER_FAKE_FRONT_LEFT) &&
rb->Base.Base.NumSamples > 1) {
@@ -1346,6 +1348,7 @@ intel_update_image_buffer(struct brw_context *intel,
   enum __DRIimageBufferMask buffer_type)
 {
struct intel_region *region = buffer->region;
+   struct gl_framebuffer *fb = drawable->driverPrivate;
 
if (!rb || !region)
   return;
@@ -1369,7 +1372,7 @@ intel_update_image_buffer(struct brw_context *intel,
 
intel_update_winsys_renderbuffer_miptree(intel, rb, region);
 
-   if (intel->is_front_buffer_rendering &&
+   if (brw_is_front_buffer_drawing(fb) &&
buffer_type == __DRI_IMAGE_BUFFER_FRONT &&
rb->Base.Base.NumSamples > 1) {
   intel_renderbuffer_upsample(intel, rb);
@@ -1397,8 +1400,10 @@ intel_update_image_buffers(struct brw_context *brw, 
__DRIdrawable *drawable)
else
   return;
 
-   if ((brw->is_front_buffer_rendering || brw->is_front_buffer_reading || 
!back_rb) && front_rb)
+   if (front_rb && (brw_is_front_buffer_drawing(fb) ||
+brw_is_front_buffer_reading(fb) || !back_rb)) {
   buffer_mask |= __DRI_IMAGE_BUFFER_FRONT;
+   }
 
if (back_rb)
   buffer_mask |= __DRI_IMAGE_BUFFER_BACK;
diff --git a/src/mesa/drivers/dri/i965/brw_context.h 
b/src/mesa/drivers/dri/i965/brw_context.h
index dbb30f2..ccbe9ea 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -1056,23 +1056,6 @@ struct brw_context
 */
bool front_buffer_dirty;
 
-   /**
-* Track whether front-buffer rendering is currently enabled
-*
-* A separate flag is used to track this in order to support MRT more
-* easily.
-*/
-   bool is_front_buffer_rendering;
-
-   /**
-* Track whether front-buffer is the current read target.
-*
-* This is closely associated with is_front_buffer_rendering, but may
-* be set separately.  The DRI2 fake front buffer must be referenced
-* either way.
-*/
-   bool is_front_buffer_reading;
-
/** Framerate throttling: @{ */
drm_inte

[Mesa-dev] [PATCH 05/10] mesa: Stop skipping the FinishRenderTexture calls for winsys FBOs.

2014-03-04 Thread Eric Anholt
Now that BindRenderbufferTexImage() is a thing that drivers can do, winsys
FBOs *can* have NeedsFinishRenderTexture set.  The early exit here
predated the NFRT flag, so it did make sense at the time.
---
 src/mesa/main/fbobject.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index a9dcc51..12d6332 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -2008,9 +2008,6 @@ check_begin_texture_render(struct gl_context *ctx, struct 
gl_framebuffer *fb)
 static void
 check_end_texture_render(struct gl_context *ctx, struct gl_framebuffer *fb)
 {
-   if (_mesa_is_winsys_fbo(fb))
-  return; /* can't render to texture with winsys framebuffers */
-
if (ctx->Driver.FinishRenderTexture) {
   GLuint i;
   for (i = 0; i < BUFFER_COUNT; i++) {
-- 
1.9.rc1

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


[Mesa-dev] [PATCH] mesa: use clear_teximage_fields() in another place

2014-03-04 Thread Brian Paul
Similar to Anuj's change 0f6f92e284cb5.
---
 src/mesa/main/teximage.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index a6c3581..4346c31 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -4487,8 +4487,7 @@ teximagemultisample(GLuint dims, GLenum target, GLsizei 
samples,
  * we're allowed to just leave this in whatever state we
  * like, but being tidy is good.
  */
-_mesa_init_teximage_fields(ctx, texImage,
-  0, 0, 0, 0, GL_NONE, MESA_FORMAT_NONE);
+clear_teximage_fields(texImage);
  }
   }
 
-- 
1.7.10.4

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


[Mesa-dev] [PATCH 10/10] meta: Support BlitFramebuffer from all the other texture targets.

2014-03-04 Thread Eric Anholt
There's already code for them due to the GenerateMipmap path, so we just
need to make sure we've got our coordinates present.
---
 src/mesa/drivers/common/meta_blit.c | 17 +++--
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/src/mesa/drivers/common/meta_blit.c 
b/src/mesa/drivers/common/meta_blit.c
index 550133f..a2046d8 100644
--- a/src/mesa/drivers/common/meta_blit.c
+++ b/src/mesa/drivers/common/meta_blit.c
@@ -418,16 +418,6 @@ blitframebuffer_texture(struct gl_context *ctx,
   srcLevel = readAtt->TextureLevel;
   texObj = readAtt->Texture;
   target = texObj->Target;
-
-  switch (target) {
-  case GL_TEXTURE_2D:
-  case GL_TEXTURE_RECTANGLE:
-  case GL_TEXTURE_2D_MULTISAMPLE:
-  case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
- break;
-  default:
- return false;
-  }
} else if (ctx->Driver.BindRenderbufferTexImage) {
   /* Otherwise, we need the driver to be able to bind a renderbuffer as
* a texture image.
@@ -537,7 +527,9 @@ blitframebuffer_texture(struct gl_context *ctx,
   struct vertex verts[4];
   GLfloat s0, t0, s1, t1;
 
-  if (target == GL_TEXTURE_2D) {
+  if (!(target == GL_TEXTURE_RECTANGLE_ARB ||
+target == GL_TEXTURE_2D_MULTISAMPLE ||
+target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY)) {
  const struct gl_texture_image *texImage
 = _mesa_select_tex_image(ctx, texObj, target, srcLevel);
  s0 = srcX0 / (float) texImage->Width;
@@ -546,9 +538,6 @@ blitframebuffer_texture(struct gl_context *ctx,
  t1 = srcY1 / (float) texImage->Height;
   }
   else {
- assert(target == GL_TEXTURE_RECTANGLE_ARB ||
-target == GL_TEXTURE_2D_MULTISAMPLE ||
-target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY);
  s0 = (float) srcX0;
  s1 = (float) srcX1;
  t0 = (float) srcY0;
-- 
1.9.rc1

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


[Mesa-dev] [PATCH] mesa: remove remaining uses of _glthread_GetID()

2014-03-04 Thread Brian Paul
It was really only used in the radeon driver for a debug printf.
And evidently, libGL.so referenced it just to work around some sort
of linker issue.

This patch removes the two calls to the function and the function
itself.

Fixes undefined _glthread_GetID symbol in libGL reported by 'nm'.
Though, the missing symbol doesn't cause any issues on my system but
it does cause glxinfo to fail on one of our test systems.
---
 src/glx/glxcurrent.c |   10 --
 src/mapi/glapi/glapi.h   |4 
 src/mapi/mapi_glapi.c|6 --
 src/mapi/u_thread.h  |4 ++--
 src/mesa/drivers/dri/common/dri_test.c   |6 --
 src/mesa/drivers/dri/radeon/radeon_fbo.c |3 +--
 6 files changed, 3 insertions(+), 30 deletions(-)

diff --git a/src/glx/glxcurrent.c b/src/glx/glxcurrent.c
index a6884cf..2e5111b 100644
--- a/src/glx/glxcurrent.c
+++ b/src/glx/glxcurrent.c
@@ -213,16 +213,6 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
struct glx_context *gc = (struct glx_context *) gc_user;
struct glx_context *oldGC = __glXGetCurrentContext();
 
-   /* XXX: If this is left out, then libGL ends up not having this
-* symbol, and drivers using it fail to load.  Compare the
-* implementation of this symbol to _glapi_noop_enable_warnings(),
-* though, which gets into the library despite no callers, the same
-* prototypes, and the same compile flags to the files containing
-* them.  Moving the definition to glapi_nop.c gets it into the
-* library, though.
-*/
-   (void)_glthread_GetID();
-
/* Make sure that the new context has a nonzero ID.  In the request,
 * a zero context ID is used only to mean that we bind to no current
 * context.
diff --git a/src/mapi/glapi/glapi.h b/src/mapi/glapi/glapi.h
index dcf91a7..7c22985 100644
--- a/src/mapi/glapi/glapi.h
+++ b/src/mapi/glapi/glapi.h
@@ -168,10 +168,6 @@ _GLAPI_EXPORT struct _glapi_table *
 _glapi_create_table_from_handle(void *handle, const char *symbol_prefix);
 
 
-_GLAPI_EXPORT unsigned long
-_glthread_GetID(void);
-
-
 /*
  * These stubs are kept so that the old DRI drivers still load.
  */
diff --git a/src/mapi/mapi_glapi.c b/src/mapi/mapi_glapi.c
index 7b9f1ae..925caf3 100644
--- a/src/mapi/mapi_glapi.c
+++ b/src/mapi/mapi_glapi.c
@@ -222,12 +222,6 @@ _glapi_get_proc_name(unsigned int offset)
return stub ? stub_get_name(stub) : NULL;
 }
 
-unsigned long
-_glthread_GetID(void)
-{
-   return u_thread_self();
-}
-
 void
 _glapi_noop_enable_warnings(unsigned char enable)
 {
diff --git a/src/mapi/u_thread.h b/src/mapi/u_thread.h
index 3e18358..0fc9392 100644
--- a/src/mapi/u_thread.h
+++ b/src/mapi/u_thread.h
@@ -101,8 +101,8 @@ u_thread_self(void)
 * So for now, we side-step this mess and use Windows thread primitives
 * directly here.
 *
-* FIXME: On the other hand, u_thread_self() and _glthread_GetID() are bad
-* abstractions.  Even with pthreads, there is no guarantee that
+* FIXME: On the other hand, u_thread_self() is a bad
+* abstraction.  Even with pthreads, there is no guarantee that
 * pthread_self() will return numeric IDs -- we should be using
 * pthread_equal() instead of assuming we can compare thread ids...
 */
diff --git a/src/mesa/drivers/dri/common/dri_test.c 
b/src/mesa/drivers/dri/common/dri_test.c
index 3573285..7ab50d9 100644
--- a/src/mesa/drivers/dri/common/dri_test.c
+++ b/src/mesa/drivers/dri/common/dri_test.c
@@ -76,12 +76,6 @@ _glapi_get_dispatch_table_size(void)
return 0;
 }
 
-PUBLIC unsigned long
-_glthread_GetID(void)
-{
-   return 0;
-}
-
 #ifndef NO_MAIN
 int main(int argc, char** argv)
 {
diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c 
b/src/mesa/drivers/dri/radeon/radeon_fbo.c
index 537ab49..12ad438 100644
--- a/src/mesa/drivers/dri/radeon/radeon_fbo.c
+++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c
@@ -783,8 +783,7 @@ radeon_render_texture(struct gl_context * ctx,
return;
}
 
-   DBG("Begin render texture tid %lx tex=%u w=%d h=%d refcount=%d\n",
-   _glthread_GetID(),
+   DBG("Begin render texture tex=%u w=%d h=%d refcount=%d\n",
att->Texture->Name, newImage->Width, newImage->Height,
rb->RefCount);
 
-- 
1.7.10.4

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


[Mesa-dev] [Bug 75212] Mesa selects wrong DRI driver

2014-03-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=75212

Eric Anholt  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #3 from Eric Anholt  ---
I'm guessing the problem was just this:

commit b959fd9674938e127a34d42d34b903e3a9ae7ad9
Author: Eric Anholt 
Date:   Thu Jan 30 10:19:44 2014 -0800

dri: Require libudev-dev for building DRI on Linux.

-- 
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] configure: Fix bashism.

2014-03-04 Thread Eric Anholt
/bin/sh defaults to dash on debian.
---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 258cb3d..3f75266 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1072,7 +1072,7 @@ if test -n "$with_dri_drivers"; then
 
 dri_drivers=`IFS=', '; echo $with_dri_drivers`
 for driver in $dri_drivers; do
-DRI_DIRS+="$driver "
+DRI_DIRS="$DRI_DIRS $driver"
 case "x$driver" in
 xi915)
 HAVE_I915_DRI=yes;
-- 
1.9.rc1

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


Re: [Mesa-dev] [PATCH v2] radeon: Use upload manager for buffer downloads

2014-03-04 Thread Marek Olšák
You check for streamout and CP DMA support, but you don't use
resource_copy_region if DMA is not supported. The CP DMA and
streamout-based buffer copying is only used by resource_copy_region.

The last parameter of buffer_wait should be RADEON_USAGE_WRITE (you're
waiting for the last write to the staging buffer), but that parameter
is not used by the winsys yet.

Other than those two, the patch looks good.

CP DMA != async DMA (dma_copy). CP DMA is actually a feature of the
graphics ring.

Marek

On Tue, Mar 4, 2014 at 6:23 PM, Niels Ole Salscheider
 wrote:
> Using DMA for reads is much faster.
>
> Signed-off-by: Niels Ole Salscheider 
> ---
>  src/gallium/drivers/radeon/r600_buffer_common.c | 78 
> +++--
>  1 file changed, 60 insertions(+), 18 deletions(-)
>
> diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c 
> b/src/gallium/drivers/radeon/r600_buffer_common.c
> index 340ebb2..ed3a08c 100644
> --- a/src/gallium/drivers/radeon/r600_buffer_common.c
> +++ b/src/gallium/drivers/radeon/r600_buffer_common.c
> @@ -260,6 +260,46 @@ static void *r600_buffer_transfer_map(struct 
> pipe_context *ctx,
> /* At this point, the buffer is always idle (we checked it 
> above). */
> usage |= PIPE_TRANSFER_UNSYNCHRONIZED;
> }
> +   /* Using DMA for larger reads is much faster */
> +   else if ((usage & PIPE_TRANSFER_READ) &&
> +!(usage & PIPE_TRANSFER_WRITE) &&
> +(rbuffer->domains == RADEON_DOMAIN_VRAM) &&
> +(rscreen->has_cp_dma ||
> + (rscreen->has_streamout &&
> +  /* The buffer range must be aligned to 4 with streamout. */
> +  box->x % 4 == 0 && box->width % 4 == 0))) {
> +   unsigned offset;
> +   struct r600_resource *staging = NULL;
> +
> +   u_upload_alloc(rctx->uploader, 0,
> +  box->width + (box->x % 
> R600_MAP_BUFFER_ALIGNMENT),
> +  &offset, (struct pipe_resource**)&staging, 
> (void**)&data);
> +
> +   if (staging) {
> +   data += box->x % R600_MAP_BUFFER_ALIGNMENT;
> +
> +   /* Copy the staging buffer into the original one. */
> +   if (rctx->dma_copy(ctx, (struct 
> pipe_resource*)staging, 0,
> +box->x % 
> R600_MAP_BUFFER_ALIGNMENT,
> +0, 0, resource, level, box)) 
> {
> +   rctx->rings.gfx.flush(rctx, 0);
> +   if (rctx->rings.dma.cs)
> +   rctx->rings.dma.flush(rctx, 0);
> +
> +   /* Wait for any offloaded CS flush to complete
> +* to avoid busy-waiting in the winsys. */
> +   rctx->ws->cs_sync_flush(rctx->rings.gfx.cs);
> +   if (rctx->rings.dma.cs)
> +   
> rctx->ws->cs_sync_flush(rctx->rings.dma.cs);
> +
> +   rctx->ws->buffer_wait(staging->buf, 
> RADEON_USAGE_READ);
> +   return r600_buffer_get_transfer(ctx, 
> resource, level, usage, box,
> +   ptransfer, 
> data, staging, offset);
> +   } else {
> +   pipe_resource_reference((struct 
> pipe_resource**)&staging, NULL);
> +   }
> +   }
> +   }
>
> data = r600_buffer_map_sync_with_rings(rctx, rbuffer, usage);
> if (!data) {
> @@ -279,24 +319,26 @@ static void r600_buffer_transfer_unmap(struct 
> pipe_context *ctx,
> struct r600_resource *rbuffer = r600_resource(transfer->resource);
>
> if (rtransfer->staging) {
> -   struct pipe_resource *dst, *src;
> -   unsigned soffset, doffset, size;
> -   struct pipe_box box;
> -
> -   dst = transfer->resource;
> -   src = &rtransfer->staging->b.b;
> -   size = transfer->box.width;
> -   doffset = transfer->box.x;
> -   soffset = rtransfer->offset + transfer->box.x % 
> R600_MAP_BUFFER_ALIGNMENT;
> -
> -   u_box_1d(soffset, size, &box);
> -
> -   /* Copy the staging buffer into the original one. */
> -   if (!(size % 4) && !(doffset % 4) && !(soffset % 4) &&
> -   rctx->dma_copy(ctx, dst, 0, doffset, 0, 0, src, 0, &box)) 
> {
> -   /* DONE. */
> -   } else {
> -   ctx->resource_copy_region(ctx, dst, 0, doffset, 0, 0, 
> src, 0, &box);
> +   if (rtransfer->transfer.usage & PIPE_TRANSFER_WRITE) {
> +   struct pipe_resource *dst, *src;
> +   unsigned soffset, doffset, size

Re: [Mesa-dev] [PATCH] configure: Fix bashism.

2014-03-04 Thread Brian Paul

On 03/04/2014 03:43 PM, Eric Anholt wrote:

/bin/sh defaults to dash on debian.
---
  configure.ac | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 258cb3d..3f75266 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1072,7 +1072,7 @@ if test -n "$with_dri_drivers"; then

  dri_drivers=`IFS=', '; echo $with_dri_drivers`
  for driver in $dri_drivers; do
-DRI_DIRS+="$driver "
+DRI_DIRS="$DRI_DIRS $driver"
  case "x$driver" in
  xi915)
  HAVE_I915_DRI=yes;



Looks OK to me.  Reviewed-by: Brian Paul 

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


[Mesa-dev] [PATCH] gallium/util: Fix memory leak

2014-03-04 Thread Aaron Watry
Fix a leaked vertex shader in u_blitter.c

Signed-off-by: Aaron Watry 

CC: "10.1" 
---
 src/gallium/auxiliary/util/u_blitter.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/gallium/auxiliary/util/u_blitter.c 
b/src/gallium/auxiliary/util/u_blitter.c
index 95e7fb6..66b511e 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -364,6 +364,8 @@ void util_blitter_destroy(struct blitter_context *blitter)
pipe->delete_vs_state(pipe, ctx->vs);
if (ctx->vs_pos_only)
   pipe->delete_vs_state(pipe, ctx->vs_pos_only);
+   if (ctx->vs_layered)
+  pipe->delete_vs_state(pipe, ctx->vs_layered);
pipe->delete_vertex_elements_state(pipe, ctx->velem_state);
for (i = 0; i < 4; i++) {
   if (ctx->velem_state_readbuf[i]) {
-- 
1.8.3.2

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


Re: [Mesa-dev] [PATCH] radeonsi: Prevent geometry shader from emitting too many vertices

2014-03-04 Thread Marek Olšák
I think this patch breaks geometry shaders with LLVM that doesn't
support the kill instruction in GS. All GS piglit tests fail with:

SILowerControlFlow.cpp:296: void
{anonymous}::SILowerControlFlowPass::Kill(llvm::MachineInstr&):
Assertion `MBB.getParent()->getInfo()->ShaderType
== ShaderType::PIXEL' failed.

Marek



On Mon, Feb 24, 2014 at 10:03 AM, Michel Dänzer  wrote:
> From: Michel Daenzer 
>
> Signed-off-by: Michel Dänzer 
> ---
>  src/gallium/drivers/radeonsi/si_shader.c | 16 
>  1 file changed, 16 insertions(+)
>
> diff --git a/src/gallium/drivers/radeonsi/si_shader.c 
> b/src/gallium/drivers/radeonsi/si_shader.c
> index 54270cd..b22db0b 100644
> --- a/src/gallium/drivers/radeonsi/si_shader.c
> +++ b/src/gallium/drivers/radeonsi/si_shader.c
> @@ -1905,6 +1905,7 @@ static void si_llvm_emit_vertex(
> LLVMValueRef soffset = LLVMGetParam(si_shader_ctx->radeon_bld.main_fn,
> SI_PARAM_GS2VS_OFFSET);
> LLVMValueRef gs_next_vertex;
> +   LLVMValueRef can_emit, kill;
> LLVMValueRef t_list_ptr;
> LLVMValueRef t_list;
> LLVMValueRef args[2];
> @@ -1934,6 +1935,21 @@ static void si_llvm_emit_vertex(
>
> /* Write vertex attribute values to GSVS ring */
> gs_next_vertex = LLVMBuildLoad(gallivm->builder, 
> si_shader_ctx->gs_next_vertex, "");
> +
> +   /* If this thread has already emitted the declared maximum number of
> +* vertices, kill it: excessive vertex emissions are not supposed to
> +* have any effect, and GS threads have no externally observable
> +* effects other than emitting vertices.
> +*/
> +   can_emit = LLVMBuildICmp(gallivm->builder, LLVMIntULE, gs_next_vertex,
> +lp_build_const_int32(gallivm,
> + 
> shader->gs_max_out_vertices), "");
> +   kill = lp_build_select(&bld_base->base, can_emit,
> +  lp_build_const_float(gallivm, 1.0f),
> +  lp_build_const_float(gallivm, -1.0f));
> +   build_intrinsic(gallivm->builder, "llvm.AMDGPU.kill",
> +   LLVMVoidTypeInContext(gallivm->context), &kill, 1, 0);
> +
> for (i = 0; i < shader->noutput; i++) {
> LLVMValueRef *out_ptr =
> 
> si_shader_ctx->radeon_bld.soa.outputs[shader->output[i].index];
> --
> 1.9.0
>
> ___
> 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


[Mesa-dev] [Bug 75779] New: wglCreateContextAttribsARB is missing in software rasterizer and does not work properly in gallium gdi target either

2014-03-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=75779

  Priority: medium
Bug ID: 75779
  Assignee: mesa-dev@lists.freedesktop.org
   Summary: wglCreateContextAttribsARB is missing in software
rasterizer and does not work properly in gallium gdi
target either
  Severity: major
Classification: Unclassified
OS: Windows (All)
  Reporter: turbolo...@gmail.com
  Hardware: x86 (IA32)
Status: NEW
   Version: 10.0
 Component: Other
   Product: Mesa

I have built both 10.0.1 and 10.0.3 on Windows XP and am trying to make
framebuffers work using glGenFrameBuffers. So I tried all variations with the
normal wglCreateContext but that does not work. The function is there but it
fails. The reported version is like 2.1 or something.

So now I try with wglCreateContextAttribsARB and it is not working either,
except when the version in the attribs is 2.1 or less. 

The function wglCreateContextAttribsARB is simply not there with the windows
gdi target, but is there with the gallium gdi target.

However whether a 2.1 context is created with wglCreateContextAttribsARB or
with wglCreateContext there is an error as a result of calling
glGenFrameBuffers etc...

When requesting a 3.1 context using wglCreateContextAttribsARB it returns zero
and there is no error reported.

The WGL_ARB_create_context string is nowhere to be seen, and yes I did create a
dummy context before reading in the function pointers and checking the
extensions.

I have been trying for days now to make it work and it would be really good if
even the software rasterizer can make a 3.1 context but nothing seems to be
there. Even if it does not have programs and shaders that is fine but how do
you make glGenFrameBuffers work on windows?


The code is something like this

if Assigned(glCtx.wglCreateContextAttribsArb) then begin

  fillchar(attribs,sizeof(attribs),0);
  attribs[0] := WGL_CONTEXT_MAJOR_VERSION_ARB;
  attribs[1] := 2;
  attribs[2] := WGL_CONTEXT_MINOR_VERSION_ARB;
  attribs[3] := 1;
  attribs[4] := WGL_CONTEXT_FLAGS_ARB;
  attribs[5] := 0;
  //attribs[6] := WGL_CONTEXT_PROFILE_MASK_ARB;
  //attribs[7] := WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
  attribs[8] := 0;
  attribs[9] := 0;

  //temp_rc := glCtx^.wglCreateContext(dc);
  //wglMakeCurrent(dc,temp_rc);
  // These calls to glGEtIntegerV do not work either. 
  //glCtx.glGetIntegerv(GL_MAJOR_VERSION, @ver[0]);
  //glCtx.glGetIntegerv(GL_MINOR_VERSION, @ver[1]);
  //if ver[0] = 345 then throw_x;

  fRc := glCtx.wglCreateContextAttribsArb(dc,0,@attribs[0]);
  //wglMakeCurrent(dc,fRc);
  //wglMakeCurrent(0,0);
  //wglDeleteContext(temp_rc);
  //wglMakeCurrent(dc,fRc);
  //glGenFrameBuffers();
  if glCtx^.glGetError() <> 0 then
fRc := 0;
end;
if fRc = 0 then begin
  fRc := glCtx^.wglCreateContext(dc);
  if (fRc = 0) then
throw_x;
end;


So please to save other people time if all this is not possible, change the
documentation where it says OpenGL 3.1 is supported to something like that it
in fact simply is not there. Or is it me? It says that OpenGl 3.1 is supported
but then trails off with saying you only get an OpenGL 3.1 context by
specifying one. So how does that work?

-- 
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] [Bug 75779] wglCreateContextAttribsARB is missing in software rasterizer and does not work properly in gallium gdi target either

2014-03-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=75779

--- Comment #1 from Brian Paul  ---
The windows gdi target/driver only supports OpenGL 2.1.  Where do you see that
version 3.1 is supported on Windows in the docs?

In any case, glGenFrameBuffers() should work with an OpenGL 2.1 context.  In
what way is that failing?

-- 
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] [Bug 75779] wglCreateContextAttribsARB is missing in software rasterizer and does not work properly in gallium gdi target either

2014-03-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=75779

turbolo...@gmail.com changed:

   What|Removed |Added

 CC||turbolo...@gmail.com

--- Comment #2 from turbolo...@gmail.com ---
Ok, so I can make the glGenFrameBuffers work now and also it seems to work
better by just calling the wglCreateContextAttribs function with absolutely no
attribs, just a pointer to zeroes. I would still like to know how to make it
OpenGL 3.1 proper as the release documentation says.

-- 
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


Re: [Mesa-dev] [PATCH 2/2] clover: Fix building with latest llvm

2014-03-04 Thread Marek Olšák
I'm not an automake expect, but this might need to be done for gallivm
too. It currently fails to compile with latest LLVM.

Marek

On Sun, Mar 2, 2014 at 10:39 PM, Bruno Jiménez  wrote:
> ---
>  src/gallium/state_trackers/clover/Makefile.am | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/src/gallium/state_trackers/clover/Makefile.am 
> b/src/gallium/state_trackers/clover/Makefile.am
> index ece2b38..75eae86 100644
> --- a/src/gallium/state_trackers/clover/Makefile.am
> +++ b/src/gallium/state_trackers/clover/Makefile.am
> @@ -37,9 +37,8 @@ libcltgsi_la_SOURCES = \
> tgsi/compiler.cpp
>
>  libclllvm_la_CXXFLAGS = \
> -   -std=c++98 \
> $(VISIBILITY_CXXFLAGS) \
> -   $(LLVM_CPPFLAGS) \
> +   $(LLVM_CXXFLAGS) \
> $(DEFINES) \
> -DLIBCLC_INCLUDEDIR=\"$(LIBCLC_INCLUDEDIR)/\" \
> -DLIBCLC_LIBEXECDIR=\"$(LIBCLC_LIBEXECDIR)/\" \
> @@ -49,7 +48,7 @@ libclllvm_la_SOURCES = \
> llvm/invocation.cpp
>
>  libclover_la_CXXFLAGS = \
> -   -std=c++0x \
> +   -std=c++11 \
> $(VISIBILITY_CXXFLAGS)
>
>  libclover_la_LIBADD = \
> --
> 1.9.0
>
> ___
> 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


[Mesa-dev] [Bug 75779] wglCreateContextAttribsARB is missing in software rasterizer and does not work properly in gallium gdi target either

2014-03-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=75779

--- Comment #3 from turbolo...@gmail.com ---
In the release notes of the newer versions it states that version OpenGL 3.1 is
supported but the version returned is 2.1 by glGetString. Then it goes on to
say that the 3.1 is available by creating a context that supports 3.1. 

I mean it does not say anything specific about Windows or Linux etc, so I was
thinking now I could start running all the shaders and things using the
software rasterizer which would help to build some other API. But the
glGenFrameBuffers is good, and the error seems to be related to something in my
code, but the wglCreateContextAttribsARB is a headache from any perspective
when trying to get at OpenGL 3.1.

-- 
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] [Bug 75779] wglCreateContextAttribsARB is missing in software rasterizer and does not work properly in gallium gdi target either

2014-03-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=75779

--- Comment #4 from turbolo...@gmail.com ---
I think you can just go ahead and close this report, I mean if it simply is not
there then no problem. A table of supported stuff per target instead of Mesa
version would be very cool for those looking to get busy on windows. I was
browsing through the code and saw shaders and what seemed like swrast compilers
so I just assumed from the release notes that OpenGL 3.1 was ready to go for
the software rasterizer. My mistake. Thanks.

-- 
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] [Bug 75779] wglCreateContextAttribsARB is missing in software rasterizer and does not work properly in gallium gdi target either

2014-03-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=75779

turbolo...@gmail.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |NOTABUG

-- 
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] [Bug 63717] Poor performance in games with Intel 965GM

2014-03-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=63717

Felix Schwarz  changed:

   What|Removed |Added

 CC||felix.schwarz@oss.schwarz.e
   ||u

-- 
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


Re: [Mesa-dev] [PATCH 2/2] clover: Fix building with latest llvm

2014-03-04 Thread Bruno Jimenez
It's strange, I have just compiled with the latest llvm revision at
Arch's mesa-git repo (202852) without problems.

I'm not an automake expert either, but at gallium/auxiliary/Makefile.am
there's this:

AM_CXXFLAGS += \
$(GALLIUM_CFLAGS) \
$(LLVM_CXXFLAGS)

So I suppose, of course I may be wrong, that it is using the correct
flags for llvm.

How does it fail to compile? does it complains about '-std=X' or other
flags?

Bruno

On Wed, 2014-03-05 at 00:43 +0100, Marek Olšák wrote:
> I'm not an automake expect, but this might need to be done for gallivm
> too. It currently fails to compile with latest LLVM.
> 
> Marek
> 
> On Sun, Mar 2, 2014 at 10:39 PM, Bruno Jiménez  wrote:
> > ---
> >  src/gallium/state_trackers/clover/Makefile.am | 5 ++---
> >  1 file changed, 2 insertions(+), 3 deletions(-)
> >
> > diff --git a/src/gallium/state_trackers/clover/Makefile.am 
> > b/src/gallium/state_trackers/clover/Makefile.am
> > index ece2b38..75eae86 100644
> > --- a/src/gallium/state_trackers/clover/Makefile.am
> > +++ b/src/gallium/state_trackers/clover/Makefile.am
> > @@ -37,9 +37,8 @@ libcltgsi_la_SOURCES = \
> > tgsi/compiler.cpp
> >
> >  libclllvm_la_CXXFLAGS = \
> > -   -std=c++98 \
> > $(VISIBILITY_CXXFLAGS) \
> > -   $(LLVM_CPPFLAGS) \
> > +   $(LLVM_CXXFLAGS) \
> > $(DEFINES) \
> > -DLIBCLC_INCLUDEDIR=\"$(LIBCLC_INCLUDEDIR)/\" \
> > -DLIBCLC_LIBEXECDIR=\"$(LIBCLC_LIBEXECDIR)/\" \
> > @@ -49,7 +48,7 @@ libclllvm_la_SOURCES = \
> > llvm/invocation.cpp
> >
> >  libclover_la_CXXFLAGS = \
> > -   -std=c++0x \
> > +   -std=c++11 \
> > $(VISIBILITY_CXXFLAGS)
> >
> >  libclover_la_LIBADD = \
> > --
> > 1.9.0
> >
> > ___
> > 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] i965: Add GPU BLIT of texture image to PBO in Intel driver

2014-03-04 Thread Jon Ashburn


On 02/28/2014 12:56 PM, Ian Romanick wrote:

On 02/28/2014 08:08 AM, Jon Ashburn wrote:
Add Intel driver hook for glGetTexImage to accelerate the case of 
reading
texture image into a PBO.  This case gets huge performance gains by 
using
GPU BLIT directly to PBO rather than GPU BLIT to temporary texture 
followed

by memcpy.

No regressions on Piglit tests  with Intel driver.
Performance gain (1280 x 800 FBO, Ivybridge):
glGetTexImage + glMapBufferRange  with patch 1.45 msec
glGetTexImage + glMapBufferRange without patch 4.68 msec


Depending on the exact paths they're hitting, it may be worth 
investigating methods that will use the 3D engine.  We have some 
evidence that for larger than very small size, the 3D engine is much 
faster than the blit engine.  Maybe add a driver hook to use a BO as 
the backing store for a texture. Texture-from-buffer-object, if you 
will. Then use that texture with meta's CopyTexImage path or 
something.  That might also avoid the fallbacks for array textures.


Using  3D engine (brw_blorp_blit_miptrees ) is a little slower on some 
benchmarks in virtualized environments.  3D engine is faster on my 
simple test on native Linux that has very very small GPU workload.  
Thus, it appears  the BLIT engine is the way to go for real world workloads.



---
  src/mesa/drivers/dri/i965/intel_tex_image.c | 114 


  1 file changed, 114 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/intel_tex_image.c 
b/src/mesa/drivers/dri/i965/intel_tex_image.c

index ee02e68..1d0d72d 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_image.c
+++ b/src/mesa/drivers/dri/i965/intel_tex_image.c
@@ -15,6 +15,8 @@
  #include "main/teximage.h"
  #include "main/texstore.h"

+#include "drivers/common/meta.h"
+
  #include "intel_mipmap_tree.h"
  #include "intel_buffer_objects.h"
  #include "intel_batchbuffer.h"
@@ -415,10 +417,122 @@ intel_image_target_texture_2d(struct 
gl_context *ctx, GLenum target,

image->tile_x, image->tile_y);
  }

+static bool
+IntelBlitTexToPbo(struct gl_context * ctx,
+   GLenum format, GLenum type,
+   GLvoid * pixels, struct gl_texture_image *texImage)
+{
+   struct intel_texture_image *intelImage = 
intel_texture_image(texImage);

+   struct brw_context *brw = brw_context(ctx);
+   const struct gl_pixelstore_attrib *pack = &(ctx->Pack);
+   struct intel_buffer_object *dst = 
intel_buffer_object(pack->BufferObj);

+   GLuint dst_offset;
+   drm_intel_bo *dst_buffer;
+   GLenum target = texImage->TexObject->Target;
+
+   DBG("%s\n", __FUNCTION__);
+
+   /*
+* Check if we can use GPU blit to copy from the hardware texture
+* format to the user's format/type.
+* Note that GL's pixel transfer ops don't apply to glGetTexImage()
+*/
+
+   if (!_mesa_format_matches_format_and_type(
+   intelImage->mt->format, format, type, false) ||
+ (_mesa_is_format_compressed(texImage->TexFormat) &&
+  _mesa_get_format_datatype(texImage->TexFormat) == 
GL_UNSIGNED_NORMALIZED)) {


I'm confused about this check.  You can't get the compressed data 
using glGetTexImage.  You have to use glGetCompressedTexImage. The 
blitter can't do decompression, so shouldn't this check just be


   if (!_mesa_format_matches_format_and_type(
   intelImage->mt->format, format, type, false)) {
  ...
   }


Yes you are right.
This will let us hit the fast path for ETC textures that we internally 
store as uncompressed RGB.



+  DBG("%s - bad format for blit to PBO\n", __FUNCTION__);


I think these should be perf_debug.  For most of the performance 
warnings we want to tell the application developer why they didn't get 
the fast path.  That gives them some indication how to change their 
code to get back on the fast path.

okay



+  return false;
+   }
+
+   if (ctx->_ImageTransferState) {
+  DBG("%s - bad transfer state for blit to PBO\n", __FUNCTION__);
+  return false;
+   }
+
+   if (pack->SkipPixels  || pack->SkipRows) {
+  DBG("%s - bad skip params for blit to PBO\n", __FUNCTION__);
+  return false;
+   }


Does pack->RowLength need to be checked?
no since use _mesa_image_row_stride() which takes RowLength into 
consideration. And actually the skipPixels and SkipRows test aren't 
needed after further testing.



+   if (pack->SwapBytes || pack->LsbFirst) {
+  DBG("%s: bad packing params\n", __FUNCTION__);
+  return false;
+   }
+
+   if (target == GL_TEXTURE_1D_ARRAY || target == 
GL_TEXTURE_CUBE_MAP_ARRAY ||

+   target == GL_TEXTURE_2D_ARRAY) {
+  DBG("%s: no support for array textures\n", __FUNCTION__);


Do regular cubemaps actually work?  3D textures?  I don't know whether 
we have piglit tests that would hit that path...


Regular cubemaps work (see piglit cubemap-getteximage-pbo). See my new 
Piglit tests for 3D texture, and Array texture targets, which all work.

+  return false;
+   }
+
+   int dst_stride = _mes

[Mesa-dev] [PATCH] i965: Set Broadwell MOCS values everywhere it's possible.

2014-03-04 Thread Kenneth Graunke
This patch introduces two pre-canned MOCS values: BDW_MOCS_WB
(write-back, all caches) and BDW_MOCS_WT (write-through, all caches).

We use write-through caching for render targets, and write-back for
all other data.  (At least on Haswell, I believe write-back LLC/eLLC
didn't work for scan-out buffers, while write-through did.)

No performance analysis has been done on the impact of this patch.

Signed-off-by: Kenneth Graunke 
---
 src/mesa/drivers/dri/i965/brw_defines.h|  8 
 src/mesa/drivers/dri/i965/gen8_depth_state.c   |  7 ---
 src/mesa/drivers/dri/i965/gen8_draw_upload.c   |  1 +
 src/mesa/drivers/dri/i965/gen8_misc_state.c| 15 +--
 src/mesa/drivers/dri/i965/gen8_sol_state.c |  3 ++-
 src/mesa/drivers/dri/i965/gen8_surface_state.c |  5 +++--
 6 files changed, 27 insertions(+), 12 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_defines.h 
b/src/mesa/drivers/dri/i965/brw_defines.h
index 01d3cb6..c91aef6 100644
--- a/src/mesa/drivers/dri/i965/brw_defines.h
+++ b/src/mesa/drivers/dri/i965/brw_defines.h
@@ -520,6 +520,10 @@
 #define GEN7_SURFACE_ARYSPC_FULL   (0 << 10)
 #define GEN7_SURFACE_ARYSPC_LOD0   (1 << 10)
 
+/* Surface state DW0 */
+#define GEN8_SURFACE_MOCS_SHIFT 24
+#define GEN8_SURFACE_MOCS_MASK  INTEL_MASK(30, 24)
+
 /* Surface state DW2 */
 #define BRW_SURFACE_HEIGHT_SHIFT   19
 #define BRW_SURFACE_HEIGHT_MASKINTEL_MASK(31, 19)
@@ -2192,6 +2196,10 @@ enum brw_wm_barycentric_interp_mode {
 #define HSW_MOCS_WB_LLC_WB_ELLC (2 << 1)
 #define HSW_MOCS_UC_LLC_WB_ELLC (3 << 1)
 
+/* Broadwell: write-back or write-through; always use all the caches. */
+#define BDW_MOCS_WB 0x78
+#define BDW_MOCS_WT 0x58
+
 #include "intel_chipset.h"
 
 #endif
diff --git a/src/mesa/drivers/dri/i965/gen8_depth_state.c 
b/src/mesa/drivers/dri/i965/gen8_depth_state.c
index 379a2c3..621951e 100644
--- a/src/mesa/drivers/dri/i965/gen8_depth_state.c
+++ b/src/mesa/drivers/dri/i965/gen8_depth_state.c
@@ -68,7 +68,7 @@ emit_depth_packets(struct brw_context *brw,
   OUT_BATCH(0);
}
OUT_BATCH(((width - 1) << 4) | ((height - 1) << 18) | lod);
-   OUT_BATCH(((depth - 1) << 21) | (min_array_element << 10));
+   OUT_BATCH(((depth - 1) << 21) | (min_array_element << 10) | BDW_MOCS_WB);
OUT_BATCH(0);
OUT_BATCH(depth_mt ? depth_mt->qpitch >> 2 : 0);
ADVANCE_BATCH();
@@ -84,7 +84,7 @@ emit_depth_packets(struct brw_context *brw,
} else {
   BEGIN_BATCH(5);
   OUT_BATCH(GEN7_3DSTATE_HIER_DEPTH_BUFFER << 16 | (5 - 2));
-  OUT_BATCH(depth_mt->hiz_mt->region->pitch - 1);
+  OUT_BATCH((depth_mt->hiz_mt->region->pitch - 1) | BDW_MOCS_WB << 25);
   OUT_RELOC64(depth_mt->hiz_mt->region->bo,
   I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER, 0);
   OUT_BATCH(depth_mt->hiz_mt->qpitch >> 2);
@@ -116,7 +116,8 @@ emit_depth_packets(struct brw_context *brw,
* page (which would imply that it does).  Experiments with the hardware
* indicate that it does.
*/
-  OUT_BATCH(HSW_STENCIL_ENABLED | (2 * stencil_mt->region->pitch - 1));
+  OUT_BATCH(HSW_STENCIL_ENABLED | BDW_MOCS_WB << 22 |
+(2 * stencil_mt->region->pitch - 1));
   OUT_RELOC64(stencil_mt->region->bo,
   I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
   stencil_offset);
diff --git a/src/mesa/drivers/dri/i965/gen8_draw_upload.c 
b/src/mesa/drivers/dri/i965/gen8_draw_upload.c
index f927c13..83bc240 100644
--- a/src/mesa/drivers/dri/i965/gen8_draw_upload.c
+++ b/src/mesa/drivers/dri/i965/gen8_draw_upload.c
@@ -105,6 +105,7 @@ gen8_emit_vertices(struct brw_context *brw)
  dw0 |= i << GEN6_VB0_INDEX_SHIFT;
  dw0 |= GEN7_VB0_ADDRESS_MODIFYENABLE;
  dw0 |= buffer->stride << BRW_VB0_PITCH_SHIFT;
+ dw0 |= BDW_MOCS_WB << 16;
 
  OUT_BATCH(dw0);
  OUT_RELOC64(buffer->bo, I915_GEM_DOMAIN_VERTEX, 0, buffer->offset);
diff --git a/src/mesa/drivers/dri/i965/gen8_misc_state.c 
b/src/mesa/drivers/dri/i965/gen8_misc_state.c
index 72ac2b2..4641388 100644
--- a/src/mesa/drivers/dri/i965/gen8_misc_state.c
+++ b/src/mesa/drivers/dri/i965/gen8_misc_state.c
@@ -37,18 +37,21 @@ static void upload_state_base_address(struct brw_context 
*brw)
OUT_BATCH(CMD_STATE_BASE_ADDRESS << 16 | (16 - 2));
/* General state base address: stateless DP read/write requests */
OUT_BATCH(0);
-   OUT_BATCH(1);
-   OUT_BATCH(0);
+   OUT_BATCH(BDW_MOCS_WB << 2 | 1);
+   OUT_BATCH(BDW_MOCS_WB << 16);
/* Surface state base address: */
-   OUT_RELOC64(brw->batch.bo, I915_GEM_DOMAIN_SAMPLER, 0, 1);
+   OUT_RELOC64(brw->batch.bo, I915_GEM_DOMAIN_SAMPLER, 0,
+   BDW_MOCS_WB << 4 | 1);
/* Dynamic state base address: */
OUT_RELOC64(brw->batch.bo,
-   I915_GEM_DOMAIN_RENDER | I915_GEM_DOMAIN_INSTRUCTION, 0, 1);
+   I915_GEM_DOMAIN_RENDER | I915_GEM_DOMAIN_INSTRUCTION, 0,
+   B

[Mesa-dev] [PATCH v2] i965: Add GPU BLIT of texture image to PBO in Intel driver

2014-03-04 Thread Jon Ashburn
Add Intel driver hook for glGetTexImage to accelerate the case of reading
texture image into a PBO.  This case gets huge performance gains by using
GPU BLIT directly to PBO rather than GPU BLIT to temporary texture followed
by memcpy.

No regressions on Piglit tests  with Intel driver.
Performance gain (1280 x 800 FBO, Ivybridge):
glGetTexImage + glMapBufferRange  with patch 1.45 msec
glGetTexImage + glMapBufferRange without patch 4.68 msec
---
 src/mesa/drivers/dri/i965/intel_tex_image.c | 105 
 1 file changed, 105 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/intel_tex_image.c 
b/src/mesa/drivers/dri/i965/intel_tex_image.c
index ee02e68..13a34d5 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_image.c
+++ b/src/mesa/drivers/dri/i965/intel_tex_image.c
@@ -15,6 +15,8 @@
 #include "main/teximage.h"
 #include "main/texstore.h"
 
+#include "drivers/common/meta.h"
+
 #include "intel_mipmap_tree.h"
 #include "intel_buffer_objects.h"
 #include "intel_batchbuffer.h"
@@ -415,10 +417,113 @@ intel_image_target_texture_2d(struct gl_context *ctx, 
GLenum target,
   image->tile_x, image->tile_y);
 }
 
+static bool
+IntelBlitTexToPbo(struct gl_context * ctx,
+   GLenum format, GLenum type,
+   GLvoid * pixels, struct gl_texture_image *texImage)
+{
+   struct intel_texture_image *intelImage = intel_texture_image(texImage);
+   struct brw_context *brw = brw_context(ctx);
+   const struct gl_pixelstore_attrib *pack = &(ctx->Pack);
+   struct intel_buffer_object *dst = intel_buffer_object(pack->BufferObj);
+   GLuint dst_offset;
+   drm_intel_bo *dst_buffer;
+   GLenum target = texImage->TexObject->Target;
+
+   /*
+* Check if we can use GPU blit to copy from the hardware texture
+* format to the user's format/type.
+* Note that GL's pixel transfer ops don't apply to glGetTexImage()
+*/
+
+   if (!_mesa_format_matches_format_and_type(
+  intelImage->mt->format, format, type, false))
+   {
+  perf_debug("%s: unsupported format, fallback to CPU mapping for PBO\n", 
__FUNCTION__);
+
+  return false;
+   }
+
+   if (ctx->_ImageTransferState) {
+  perf_debug("%s: bad transfer state, fallback to CPU mapping for PBO\n", 
__FUNCTION__);
+  return false;
+   }
+
+   if (pack->SwapBytes || pack->LsbFirst) {
+  perf_debug("%s: unsupported pack swap params\n", __FUNCTION__);
+  return false;
+   }
+
+   if (target == GL_TEXTURE_1D_ARRAY || target == GL_TEXTURE_CUBE_MAP_ARRAY ||
+   target == GL_TEXTURE_2D_ARRAY) {
+  perf_debug("%s: no support for array textures, fallback to CPU mapping 
for PBO\n", __FUNCTION__);
+  return false;
+   }
+
+   int dst_stride = _mesa_image_row_stride(pack, texImage->Width, format, 
type);
+   bool dst_flip = false;
+   /* Mesa flips the dst_stride for ctx->Pack.Invert, our mt must have a
+* normal dst_stride.
+*/
+   struct gl_pixelstore_attrib uninverted_pack = *pack;
+   if (ctx->Pack.Invert) {
+  dst_stride = -dst_stride;
+  dst_flip = true;
+  uninverted_pack.Invert = false;
+   }
+   dst_offset = (GLintptr) pixels;
+   dst_offset += _mesa_image_offset(2, &uninverted_pack, texImage->Width,
+texImage->Height, format, type, 0, 0, 0);
+   dst_buffer = intel_bufferobj_buffer(brw, dst, dst_offset,
+   texImage->Height * dst_stride);
+
+   struct intel_mipmap_tree *pbo_mt =
+intel_miptree_create_for_bo(brw,
+dst_buffer,
+intelImage->mt->format,
+dst_offset,
+texImage->Width, texImage->Height,
+dst_stride, I915_TILING_NONE);
+
+   if (!pbo_mt)
+  return false;
+
+   if (!intel_miptree_blit(brw,
+   intelImage->mt, texImage->Level, texImage->Face,
+   0, 0, false,
+   pbo_mt, 0, 0,
+   0, 0, dst_flip,
+   texImage->Width, texImage->Height, GL_COPY))
+  return false;
+
+   intel_miptree_release(&pbo_mt);
+
+   return true;
+}
+
+static void
+intel_get_tex_image(struct gl_context *ctx,
+   GLenum format, GLenum type, GLvoid *pixels,
+   struct gl_texture_image *texImage) {
+   DBG("%s\n", __FUNCTION__);
+
+   if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
+  /* Using PBOs, so try the BLT based path. */
+  if (IntelBlitTexToPbo(ctx, format, type, pixels, texImage))
+ return;
+
+   }
+
+   _mesa_meta_GetTexImage(ctx, format, type, pixels, texImage);
+
+   DBG("%s - DONE\n", __FUNCTION__);
+}
+
 void
 intelInitTextureImageFuncs(struct dd_function_table *functions)
 {
functions->TexImage = intelTexImage;
functions->EGLImageTargetTexture2D = intel_image_target_texture_2d;

[Mesa-dev] [PATCH] i965: Fix predicated-send-based discards with MRT.

2014-03-04 Thread Eric Anholt
We need the header setup to not be predicated on which pixels are
undiscarded.  I'm not sure originally if I had thought that the mask
disable implied predicate disable, or if I had just misread the mask
disable as predicate disable.  Either way, I know I had spent more time
thinking about this in the gen8 generator than the gen7 generator.

Plus, it turns out that I had mis-implemented the "the GPU will use the
predicate unless this header is present" comment, by skipping setting up
the pixel mask when the header was present.

Fixes GPU hangs in piglit glsl-fs-discard-mrt, Trine, Trine 2 and
preusmably MLL.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75207
---
 src/mesa/drivers/dri/i965/brw_fs_generator.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp 
b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
index 748a2e2..e590bdf 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
@@ -103,14 +103,14 @@ fs_generator::generate_fb_write(fs_inst *inst)
 */
brw_push_insn_state(p);
brw_set_mask_control(p, BRW_MASK_DISABLE);
+   brw_set_predicate_control(p, BRW_PREDICATE_NONE);
brw_set_compression_control(p, BRW_COMPRESSION_NONE);
 
if (inst->header_present) {
   /* On HSW, the GPU will use the predicate on SENDC, unless the header is
* present.
*/
-  if (!brw->is_haswell && ((fp && fp->UsesKill) ||
-   c->key.alpha_test_func)) {
+  if ((fp && fp->UsesKill) || c->key.alpha_test_func) {
  struct brw_reg pixel_mask;
 
  if (brw->gen >= 6)
-- 
1.9.rc1

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


  1   2   >