[Mesa-dev] [Bug 98851] triangle clipping causes wrong interpolation of non-perspective corrected attributes

2016-11-24 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=98851

Ilia Mirkin  changed:

   What|Removed |Added

Summary|triangle clipping causes|triangle clipping causes
   |wrong ... something |wrong interpolation of
   ||non-perspective corrected
   ||attributes

--- Comment #2 from Ilia Mirkin  ---
Ah yeah, looks like that's exactly what's going on -

src/gallium/auxiliary/draw/draw_pipe_clip.c:interp has the following logic:

   /**
* Compute the t in screen-space instead of 3d space to use
* for noperspective interpolation.
*
* The points can be aligned with the X axis, so in that case try
* the Y.  When both points are at the same screen position, we can
* pick whatever value (the interpolated point won't be in front
* anyway), so just use the 3d t.
*/
   if (clip->num_linear_attribs) {
  int k;
  t_nopersp = t;
  /* find either in.x != out.x or in.y != out.y */
  for (k = 0; k < 2; k++) {
 if (in->clip_pos[k] != out->clip_pos[k]) {
/* do divide by W, then compute linear interpolation factor */
float in_coord = in->clip_pos[k] / in->clip_pos[3];
float out_coord = out->clip_pos[k] / out->clip_pos[3];
float dst_coord = dst->clip_pos[k] / dst->clip_pos[3];
t_nopersp = (dst_coord - out_coord) / (in_coord - out_coord);
break;
 }
  }
  for (j = 0; j < clip->num_linear_attribs; j++) {
 const unsigned attr = clip->linear_attribs[j];
 interp_attr(dst->data[attr], t_nopersp, in->data[attr],
out->data[attr]);
  }
   }

swr needs to grow a linear-interpolated attribute mask and incorporate the
above logic for those.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 98851] triangle clipping causes wrong ... something

2016-11-24 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=98851

--- Comment #1 from Ilia Mirkin  ---
One thing I wonder about is whether the clipper needs to know that it's a
no-perspective attribute. There's an interpolation step done in
clip.h:intersect, and I'm not sure that's right for the
non-perspective-correcting case. (I'm also not sure that it's wrong...)

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are the QA Contact for the bug.___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] anv/state: if enabled, use anisotropic filtering also with VK_FILTER_NEAREST

2016-11-24 Thread Iago Toral
On Thu, 2016-11-24 at 16:28 -0800, Jason Ekstrand wrote:
> 
> On Nov 24, 2016 7:12 AM, "Iago Toral"  wrote:
> >
> > On Thu, 2016-11-24 at 14:33 +0100, Iago Toral wrote:
> > > Hi Lionel,
> > >
> > > On Thu, 2016-11-24 at 13:08 +, Lionel Landwerlin wrote:
> > > >
> > > > Hi Iago,
> > > >
> > > > Looking at the history, before
> > > > ed4fe3e9ba9018e68afe6fdd4f267218a537fdaa 
> > > > we seem to set min/mag filter to MAPFILTER_ANISOTROPIC if
> > > > maxAnisotropy 
> > > >  > 1. It seems your patch makes sense in using
> > > > MAPFILTER_ANISOTROPIC
> > > > in 
> > > > the NEAREST case, but I wonder whether we should also check
> for 
> > > > maxAnisotropy > 1.
> > > Right, good catch, although I think that if we do that it should
> be a
> > > separate change since we are not currently checking that for the
> > > linear
> > > filter either.
> In GL, there is no explicit enable.  It's just assumed that it's
> "always on" and the anisotropy value being 1.0 or > 1.0 enables and
> disables it.  Vulkan has an explicit bit so we should use that.
> > > It seems that we do check for this in OpenGL so I think we
> probably
> > > should do that here as well unless Jason dropped it for Vulkan on
> > > purpose for some reason in that commit.
> > >
> > > I'll send a separate patch for this after I confirm that it does
> not
> > > alter the results for the tests in CTS if we add that check.
> >
> > Actually, thinking about this a bit more, I don't think we need
>  That
> > commit is about honoring SamplerCreateInfo.anisotropyEnable to
> decide
> > whether to activate anisotropic filtering, so if that is true we
> want
> > to use that. Notice that since that commit we clamp the anisotropy
> > ratio to ensure it is in a valid range. If we pass a maxAnisotropy
> > value < 1, it will clamp it to the minimum value we can work with,
> so I
> > think Jason did that change on purpose.
> You overestimate the amount of thought I put into anisotropic
> filtering.  :-)
> I think this patch is probably correct.  At the very least, I don't
> think it's wrong.  I'm not sure that it makes sense to use
> anisotropic filtering with NEAREST.  I'm not even quite sure what
> that would mean.  The spec certainly doesn't say.  Anyway, I think
> I'm fine with this but a bit more digging to make sure we're actually
> doing it right might be in order.

If you're using anisotropic filtering to enhance texture quality it
would seem odd that someone would use it with a nearest filter, but I
have not seen any indication that this combination should not be
allowed. After all, anisotropic filtering is conceptually orthogonal to
nearest/linear filtering.

I did not find any references in the Vulkan docs, but at least in
OpenGL this is explained in EXT_texture_filter_anisotropic  and they
actually mention the combination of nearest+anisotropic filtering
explicitly: 

https://www.opengl.org/registry/specs/EXT/texture_filter_anisotropic.tx
t

   "A texture's maximum degree of anisotropy is specified independent
from the texture's minification and magnification filter (as
opposed to being supported as an entirely new filtering mode).
Implementations are free to use the specified minification and
magnification filter to select a particular anisotropic texture
filtering scheme.  For example, a NEAREST filter with a maximum
degree of anisotropy of two could be treated as a 2-tap filter that
accounts for the direction of anisotropy.  Implementations are also
permitted to ignore the minification or magnification filter and
    implement the highest quality of anisotropic filtering possible."

So basically, some drivers/hardware may have nearest + anisotropy work
slightly different than linear + anisotropy. Not sure when that is
helpful, but it seems that it should be possible to do it.

Iago

> Reviewed-by: Jason Ekstrand 
> > Sounds reasonable?
> >
> > > Iago
> > >
> > > >
> > > > On 24/11/16 11:30, Iago Toral Quiroga wrote:
> > > > >
> > > > >
> > > > > Fixes multiple Vulkan CTS tests that combine anisotropy and
> > > > > VK_FILTER_NEAREST
> > > > > in dEQP-VK.texture.filtering_anisotropy.*
> > > > > ---
> > > > >   src/intel/vulkan/genX_state.c | 2 +-
> > > > >   1 file changed, 1 insertion(+), 1 deletion(-)
> > > > >
> > > > > diff --git a/src/intel/vulkan/genX_state.c
> > > > > b/src/intel/vulkan/genX_state.c
> > > > > index 4122395..0f621f9 100644
> > > > > --- a/src/intel/vulkan/genX_state.c
> > > > > +++ b/src/intel/vulkan/genX_state.c
> > > > > @@ -101,7 +101,7 @@ vk_to_gen_tex_filter(VkFilter filter,
> bool
> > > > > anisotropyEnable)
> > > > >  default:
> > > > > assert(!"Invalid filter");
> > > > >  case VK_FILTER_NEAREST:
> > > > > -  return MAPFILTER_NEAREST;
> > > > > +  return anisotropyEnable ? MAPFILTER_ANISOTROPIC :
> > > > > MAPFILTER_NEAREST;
> > > > >  case VK_FILTER_LINEAR:
> > > > > return anisotropyEnable ? MAPFILTER_ANISOTROPIC :

[Mesa-dev] [Bug 98851] triangle clipping causes wrong ... something

2016-11-24 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=98851

Bug ID: 98851
   Summary: triangle clipping causes wrong ... something
   Product: Mesa
   Version: git
  Hardware: Other
OS: All
Status: NEW
  Severity: normal
  Priority: medium
 Component: Drivers/Gallium/swr
  Assignee: mesa-dev@lists.freedesktop.org
  Reporter: imir...@alum.mit.edu
QA Contact: mesa-dev@lists.freedesktop.org

Sorry for the non-descript subject. I'm just not sure what's wrong. The
following test fails:

generated_tests/spec/glsl-1.30/execution/interpolation/interpolation-noperspective-gl_FrontColor-flat-fixed.shader_test

as do many of its friends. Note that the color is meant to be
non-perspective-interpolated. Also note that the flat-none.shader_test variant
of this works as expected. As does the flat-vertex.shader_test variant after my
perspective-interpolation for clip distances fix is applied. So it's something
wrong with the clipper.

Comparing to
generated_tests/spec/glsl-1.30/execution/interpolation/interpolation-smooth-gl_FrontColor-flat-fixed.shader_test,
it looks different (which smoothly-interpolates the color). And there's no
reason to think that color is being perspective-interpolated, as that is
decided in the user frag shader. However I'm not sure what's going on - 1/w is
getting messed up perhaps? Not sure.

Furthermore, note that
generated_tests/spec/glsl-1.30/execution/interpolation/interpolation-smooth-gl_FrontColor-flat-fixed.shader_test
does pass with swr, and the only difference is that the color is
perspective-interpolated vs no-perspective-interpolated.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 98846] triangle clipping causes wrong vertex's attribute to be broadcasted for flat interpolation

2016-11-24 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=98846

--- Comment #1 from Ilia Mirkin  ---
Actually I tracked it down to this little bit in clip.h:

void ClipSimd(const simdscalar& vPrimMask, const simdscalar& vClipMask,
PA_STATE& pa, const simdscalari& vPrimId, const simdscalari& vViewportIdx)
{
...
uint32_t provokingVertex = 0;
if(pa.binTopology == TOP_TRIANGLE_FAN)
{
provokingVertex = this->state.frontendState.provokingVertex.triFan;
}
///@todo: line topology for wireframe?

Which is ... obviously wrong. That said, I'm not sure what the right thing is,
esp in light of how the topologyProvokingVertex is selected in the FE. I leave
it to the pro's.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are the QA Contact for the bug.___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] clover: OpenCL image support

2016-11-24 Thread Francisco Jerez
Edward O'Callaghan  writes:

> The following series implements what is needed on clover's
> side for OpenCL image support. This seems to work with some
> basic applications with radeonsi. Although, I have not yet
> included the patch to enable by default until the LLVM bugs
> this can potentially trigger with more complex kernels are
> resolved.
>
> Please kindly review,
>
> Edward O'Callaghan (4):
>  [PATCH 1/4] clover: Implement 'CL_MEM_OBJECT_IMAGE2D_ARRAY'
>  [PATCH 2/4] clover: Implement 'CL_MEM_OBJECT_IMAGE1D'
>  [PATCH 3/4] clover: Implement 'CL_MEM_OBJECT_IMAGE1D_BUFFER'
>  [PATCH 4/4] clover: Implement 'CL_MEM_OBJECT_IMAGE1D_ARRAY'

I don't think this is sufficient to get the CL 1.2+ image formats fully
working, at least you're going to need to add support for array and
buffer images to the memory transfer commands from api/transfer.cpp,
implement several missing image-related queries from CL 1.2, fix the
gallium pipe_resource and transfer glue code to work with the new memory
object types, and fix the LLVM interfacing code and compute kernel
handling to accept the new image types as kernel argument.  Still a
bunch of work to do, but this seems like a good start... :)

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


signature.asc
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 4/4] clover: Implement 'CL_MEM_OBJECT_IMAGE1D_ARRAY'

2016-11-24 Thread Francisco Jerez
Edward O'Callaghan  writes:

> Signed-off-by: Edward O'Callaghan 
> ---
>  src/gallium/state_trackers/clover/api/memory.cpp  | 13 +
>  src/gallium/state_trackers/clover/core/memory.cpp | 14 ++
>  src/gallium/state_trackers/clover/core/memory.hpp | 11 +++
>  3 files changed, 34 insertions(+), 4 deletions(-)
>
> diff --git a/src/gallium/state_trackers/clover/api/memory.cpp 
> b/src/gallium/state_trackers/clover/api/memory.cpp
> index 7aee417..9b3b70e 100644
> --- a/src/gallium/state_trackers/clover/api/memory.cpp
> +++ b/src/gallium/state_trackers/clover/api/memory.cpp
> @@ -182,6 +182,15 @@ clCreateImage(cl_context d_ctx, cl_mem_flags d_flags,
>  desc->image_width,
>  desc->image_row_pitch, host_ptr);
>  
> +   case CL_MEM_OBJECT_IMAGE1D_ARRAY:
> +  if (!desc->image_width)
> + throw error(CL_INVALID_IMAGE_SIZE);
> +

Missing width and array size checking.

> +  return new image1d_array(ctx, flags, format,
> +   desc->image_width,
> +   desc->image_array_size, 
> desc->image_slice_pitch,
> +   host_ptr);
> +
> case CL_MEM_OBJECT_IMAGE2D:
>if (!desc->image_width || !desc->image_height)
>   throw error(CL_INVALID_IMAGE_SIZE);
> @@ -230,10 +239,6 @@ clCreateImage(cl_context d_ctx, cl_mem_flags d_flags,
>   desc->image_depth, desc->image_row_pitch,
>   desc->image_slice_pitch, host_ptr);
>  
> -   case CL_MEM_OBJECT_IMAGE1D_ARRAY:
> -  // XXX - Not implemented.
> -  throw error(CL_IMAGE_FORMAT_NOT_SUPPORTED);
> -
> default:
>throw error(CL_INVALID_IMAGE_DESCRIPTOR);
> }
> diff --git a/src/gallium/state_trackers/clover/core/memory.cpp 
> b/src/gallium/state_trackers/clover/core/memory.cpp
> index 94b1273..517d53f 100644
> --- a/src/gallium/state_trackers/clover/core/memory.cpp
> +++ b/src/gallium/state_trackers/clover/core/memory.cpp
> @@ -211,6 +211,20 @@ image1d_buffer::type() const {
> return CL_MEM_OBJECT_IMAGE1D_BUFFER;
>  }
>  
> +image1d_array::image1d_array(clover::context , cl_mem_flags flags,
> + const cl_image_format *format,
> + size_t width,
> + size_t array_size, size_t slice_pitch,
> + void *host_ptr) :
> +   image(ctx, flags, format, width, 0, 1,
> + 0, slice_pitch, slice_pitch * array_size, host_ptr) {

Set unused height argument to one, and make sure we don't lose track of
the array size of the image.

> +}
> +
> +cl_mem_object_type
> +image1d_array::type() const {
> +   return CL_MEM_OBJECT_IMAGE1D_ARRAY;
> +}
> +
>  image2d::image2d(clover::context , cl_mem_flags flags,
>   const cl_image_format *format, size_t width,
>   size_t height, size_t row_pitch,
> diff --git a/src/gallium/state_trackers/clover/core/memory.hpp 
> b/src/gallium/state_trackers/clover/core/memory.hpp
> index 1394fe6..a54db83 100644
> --- a/src/gallium/state_trackers/clover/core/memory.hpp
> +++ b/src/gallium/state_trackers/clover/core/memory.hpp
> @@ -154,6 +154,17 @@ namespace clover {
>virtual cl_mem_object_type type() const;
> };
>  
> +   class image1d_array : public image {
> +   public:
> +  image1d_array(clover::context , cl_mem_flags flags,
> +const cl_image_format *format,
> +size_t width,
> +size_t array_size, size_t slice_pitch,
> +void *host_ptr);
> +
> +  virtual cl_mem_object_type type() const;
> +   };
> +
> class image2d : public image {
> public:
>image2d(clover::context , cl_mem_flags flags,
> -- 
> 2.7.4
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


signature.asc
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/4] clover: Implement 'CL_MEM_OBJECT_IMAGE1D_BUFFER'

2016-11-24 Thread Francisco Jerez
Edward O'Callaghan  writes:

> Signed-off-by: Edward O'Callaghan 
> ---
>  src/gallium/state_trackers/clover/api/memory.cpp  |  9 -
>  src/gallium/state_trackers/clover/core/memory.cpp | 13 +
>  src/gallium/state_trackers/clover/core/memory.hpp | 10 ++
>  3 files changed, 31 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/state_trackers/clover/api/memory.cpp 
> b/src/gallium/state_trackers/clover/api/memory.cpp
> index 41e344e..7aee417 100644
> --- a/src/gallium/state_trackers/clover/api/memory.cpp
> +++ b/src/gallium/state_trackers/clover/api/memory.cpp
> @@ -174,6 +174,14 @@ clCreateImage(cl_context d_ctx, cl_mem_flags d_flags,
>   desc->image_width,
>   desc->image_row_pitch, host_ptr);
>  
> +   case CL_MEM_OBJECT_IMAGE1D_BUFFER:
> +  if (!desc->image_width)
> + throw error(CL_INVALID_IMAGE_SIZE);
> +
> +  return new image1d_buffer(ctx, flags, format,
> +desc->image_width,
> +desc->image_row_pitch, host_ptr);
> +
> case CL_MEM_OBJECT_IMAGE2D:
>if (!desc->image_width || !desc->image_height)
>   throw error(CL_INVALID_IMAGE_SIZE);
> @@ -223,7 +231,6 @@ clCreateImage(cl_context d_ctx, cl_mem_flags d_flags,
>   desc->image_slice_pitch, host_ptr);
>  
> case CL_MEM_OBJECT_IMAGE1D_ARRAY:
> -   case CL_MEM_OBJECT_IMAGE1D_BUFFER:
>// XXX - Not implemented.
>throw error(CL_IMAGE_FORMAT_NOT_SUPPORTED);
>  
> diff --git a/src/gallium/state_trackers/clover/core/memory.cpp 
> b/src/gallium/state_trackers/clover/core/memory.cpp
> index 246bd2d..94b1273 100644
> --- a/src/gallium/state_trackers/clover/core/memory.cpp
> +++ b/src/gallium/state_trackers/clover/core/memory.cpp
> @@ -198,6 +198,19 @@ image1d::type() const {
> return CL_MEM_OBJECT_IMAGE1D;
>  }
>  
> +image1d_buffer::image1d_buffer(clover::context , cl_mem_flags flags,
> +   const cl_image_format *format,
> +   size_t width, size_t row_pitch,
> +   void *host_ptr) :
> +   image(ctx, flags, format, width, 0, 1,
> + row_pitch, 0, row_pitch, host_ptr) {
> +}
> +
> +cl_mem_object_type
> +image1d_buffer::type() const {
> +   return CL_MEM_OBJECT_IMAGE1D_BUFFER;
> +}
> +
>  image2d::image2d(clover::context , cl_mem_flags flags,
>   const cl_image_format *format, size_t width,
>   size_t height, size_t row_pitch,
> diff --git a/src/gallium/state_trackers/clover/core/memory.hpp 
> b/src/gallium/state_trackers/clover/core/memory.hpp
> index ad9052b..1394fe6 100644
> --- a/src/gallium/state_trackers/clover/core/memory.hpp
> +++ b/src/gallium/state_trackers/clover/core/memory.hpp
> @@ -144,6 +144,16 @@ namespace clover {
>virtual cl_mem_object_type type() const;
> };
>  
> +   class image1d_buffer : public image {
> +   public:
> +  image1d_buffer(clover::context , cl_mem_flags flags,
> + const cl_image_format *format,
> + size_t width, size_t row_pitch,
> + void *host_ptr);
> +
> +  virtual cl_mem_object_type type() const;
> +   };
> +
> class image2d : public image {
> public:
>image2d(clover::context , cl_mem_flags flags,

AFAICT my comments to your previous patch apply here as well.

> -- 
> 2.7.4
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


signature.asc
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/4] clover: Implement 'CL_MEM_OBJECT_IMAGE1D'

2016-11-24 Thread Francisco Jerez
Edward O'Callaghan  writes:

> Signed-off-by: Edward O'Callaghan 
> ---
>  src/gallium/state_trackers/clover/api/memory.cpp  |  9 -
>  src/gallium/state_trackers/clover/core/memory.cpp | 13 +
>  src/gallium/state_trackers/clover/core/memory.hpp | 10 ++
>  3 files changed, 31 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/state_trackers/clover/api/memory.cpp 
> b/src/gallium/state_trackers/clover/api/memory.cpp
> index 58f56d1..41e344e 100644
> --- a/src/gallium/state_trackers/clover/api/memory.cpp
> +++ b/src/gallium/state_trackers/clover/api/memory.cpp
> @@ -166,6 +166,14 @@ clCreateImage(cl_context d_ctx, cl_mem_flags d_flags,
> ret_error(r_errcode, CL_SUCCESS);
>  
> switch (desc->image_type) {
> +   case CL_MEM_OBJECT_IMAGE1D:
> +  if (!desc->image_width)
> + throw error(CL_INVALID_IMAGE_SIZE);
> +

We probably need to check that the specified image width is within the
device limits -- There's no device::max_image_levels_1d() query but
max_image_levels_2d() should work as well.

> +  return new image1d(ctx, flags, format,
> + desc->image_width,
> + desc->image_row_pitch, host_ptr);
> +
> case CL_MEM_OBJECT_IMAGE2D:
>if (!desc->image_width || !desc->image_height)
>   throw error(CL_INVALID_IMAGE_SIZE);
> @@ -214,7 +222,6 @@ clCreateImage(cl_context d_ctx, cl_mem_flags d_flags,
>   desc->image_depth, desc->image_row_pitch,
>   desc->image_slice_pitch, host_ptr);
>  
> -   case CL_MEM_OBJECT_IMAGE1D:
> case CL_MEM_OBJECT_IMAGE1D_ARRAY:
> case CL_MEM_OBJECT_IMAGE1D_BUFFER:
>// XXX - Not implemented.
> diff --git a/src/gallium/state_trackers/clover/core/memory.cpp 
> b/src/gallium/state_trackers/clover/core/memory.cpp
> index de1862b..246bd2d 100644
> --- a/src/gallium/state_trackers/clover/core/memory.cpp
> +++ b/src/gallium/state_trackers/clover/core/memory.cpp
> @@ -185,6 +185,19 @@ image::slice_pitch() const {
> return _slice_pitch;
>  }
>  
> +image1d::image1d(clover::context , cl_mem_flags flags,
> + const cl_image_format *format,
> + size_t width, size_t row_pitch,
> + void *host_ptr) :
> +   image(ctx, flags, format, width, 0, 1,

All surface dimension fields (width, height, depth) of a clover::image
object are considered valid regardless of the image type, so we should
set unused dimensions to 1 in order to avoid unexpected results while
doing arithmetic or various error checking with them.

> + row_pitch, 0, row_pitch, host_ptr) {

I don't think you can rely on the row pitch to be meaningful for 1D
images, it's probably necessary to pass it as argument to the
constructor, we're probably better off calculating the size by hand.

> +}
> +
> +cl_mem_object_type
> +image1d::type() const {
> +   return CL_MEM_OBJECT_IMAGE1D;
> +}
> +
>  image2d::image2d(clover::context , cl_mem_flags flags,
>   const cl_image_format *format, size_t width,
>   size_t height, size_t row_pitch,
> diff --git a/src/gallium/state_trackers/clover/core/memory.hpp 
> b/src/gallium/state_trackers/clover/core/memory.hpp
> index 1a3e8c9..ad9052b 100644
> --- a/src/gallium/state_trackers/clover/core/memory.hpp
> +++ b/src/gallium/state_trackers/clover/core/memory.hpp
> @@ -134,6 +134,16 @@ namespace clover {
> std::unique_ptr> resources;
> };
>  
> +   class image1d : public image {
> +   public:
> +  image1d(clover::context , cl_mem_flags flags,
> +  const cl_image_format *format,
> +  size_t width, size_t row_pitch,
> +  void *host_ptr);
> +
> +  virtual cl_mem_object_type type() const;
> +   };
> +
> class image2d : public image {
> public:
>image2d(clover::context , cl_mem_flags flags,
> -- 
> 2.7.4
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


signature.asc
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/4] clover: Implement 'CL_MEM_OBJECT_IMAGE2D_ARRAY'

2016-11-24 Thread Francisco Jerez
Edward O'Callaghan  writes:

> Signed-off-by: Edward O'Callaghan 
> ---
>  src/gallium/state_trackers/clover/api/memory.cpp  | 17 -
>  src/gallium/state_trackers/clover/core/memory.cpp | 14 ++
>  src/gallium/state_trackers/clover/core/memory.hpp | 11 +++
>  3 files changed, 41 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/state_trackers/clover/api/memory.cpp 
> b/src/gallium/state_trackers/clover/api/memory.cpp
> index 9b3cd8b..58f56d1 100644
> --- a/src/gallium/state_trackers/clover/api/memory.cpp
> +++ b/src/gallium/state_trackers/clover/api/memory.cpp
> @@ -181,6 +181,22 @@ clCreateImage(cl_context d_ctx, cl_mem_flags d_flags,
>   desc->image_width, desc->image_height,
>   desc->image_row_pitch, host_ptr);
>  
> +   case CL_MEM_OBJECT_IMAGE2D_ARRAY:
> +  if (!desc->image_width || !desc->image_height)
> + throw error(CL_INVALID_IMAGE_SIZE);
> +
> +  if (all_of([=](const device ) {
> +   const size_t max = 1 << dev.max_image_levels_2d();
> +   return (desc->image_width > max ||
> +   desc->image_height > max);
> +}, ctx.devices()))
> + throw error(CL_INVALID_IMAGE_SIZE);
> +
> +  return new image2d_array(ctx, flags, format,
> +   desc->image_width, desc->image_height,
> +   desc->image_array_size, 
> desc->image_slice_pitch,
> +   host_ptr);
> +
> case CL_MEM_OBJECT_IMAGE3D:
>if (!desc->image_width || !desc->image_height || !desc->image_depth)
>   throw error(CL_INVALID_IMAGE_SIZE);
> @@ -201,7 +217,6 @@ clCreateImage(cl_context d_ctx, cl_mem_flags d_flags,
> case CL_MEM_OBJECT_IMAGE1D:
> case CL_MEM_OBJECT_IMAGE1D_ARRAY:
> case CL_MEM_OBJECT_IMAGE1D_BUFFER:
> -   case CL_MEM_OBJECT_IMAGE2D_ARRAY:
>// XXX - Not implemented.
>throw error(CL_IMAGE_FORMAT_NOT_SUPPORTED);
>  
> diff --git a/src/gallium/state_trackers/clover/core/memory.cpp 
> b/src/gallium/state_trackers/clover/core/memory.cpp
> index b852e68..de1862b 100644
> --- a/src/gallium/state_trackers/clover/core/memory.cpp
> +++ b/src/gallium/state_trackers/clover/core/memory.cpp
> @@ -198,6 +198,20 @@ image2d::type() const {
> return CL_MEM_OBJECT_IMAGE2D;
>  }
>  
> +image2d_array::image2d_array(clover::context , cl_mem_flags flags,
> + const cl_image_format *format,
> + size_t width, size_t height,
> + size_t array_size, size_t slice_pitch,
> + void *host_ptr) :
> +   image(ctx, flags, format, width, height, 1,
> + 0, slice_pitch, slice_pitch * array_size, host_ptr) {
> +}

Seems like you aren't passing the row pitch as argument, and the array
size is getting lost so you won't be able to recover it in order to
implement memory transfer functions and CL image queries.

> +
> +cl_mem_object_type
> +image2d_array::type() const {
> +   return CL_MEM_OBJECT_IMAGE2D_ARRAY;
> +}
> +
>  image3d::image3d(clover::context , cl_mem_flags flags,
>   const cl_image_format *format,
>   size_t width, size_t height, size_t depth,
> diff --git a/src/gallium/state_trackers/clover/core/memory.hpp 
> b/src/gallium/state_trackers/clover/core/memory.hpp
> index bd6da6b..1a3e8c9 100644
> --- a/src/gallium/state_trackers/clover/core/memory.hpp
> +++ b/src/gallium/state_trackers/clover/core/memory.hpp
> @@ -144,6 +144,17 @@ namespace clover {
>virtual cl_mem_object_type type() const;
> };
>  
> +   class image2d_array : public image {
> +   public:
> +  image2d_array(clover::context , cl_mem_flags flags,
> +const cl_image_format *format,
> +size_t width, size_t height,
> +size_t array_size, size_t slice_pitch,
> +void *host_ptr);
> +
> +  virtual cl_mem_object_type type() const;
> +   };
> +
> class image3d : public image {
> public:
>image3d(clover::context , cl_mem_flags flags,
> -- 
> 2.7.4
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


signature.asc
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] EGL/android: Enhance pbuffer implementation

2016-11-24 Thread Liu Zhiquan
Some dri drivers will pass multiple bits in buffer_mask parameter
to droid_image_get_buffer(), more than the actual supported buffer
type combination. For such case, will go through all the bits, and
will not return error when unsupported buffer is requested, only
return error when the allocation for supported buffer failed.

Signed-off-by: Liu Zhiquan 
Signed-off-by: Long, Zhifang 
---
 src/egl/drivers/dri2/platform_android.c | 209 +++-
 1 file changed, 126 insertions(+), 83 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_android.c 
b/src/egl/drivers/dri2/platform_android.c
index 373e2c0..c70423d 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -392,13 +392,13 @@ droid_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, 
_EGLSurface *surf)
}
 
if (dri2_surf->dri_image_back) {
-  _eglLog(_EGL_DEBUG, "%s : %d : destroy dri_image_back", __func__, 
__LINE__);
+  _eglLog(_EGL_DEBUG, "destroy dri_image_back");
   dri2_dpy->image->destroyImage(dri2_surf->dri_image_back);
   dri2_surf->dri_image_back = NULL;
}
 
if (dri2_surf->dri_image_front) {
-  _eglLog(_EGL_DEBUG, "%s : %d : destroy dri_image_front", __func__, 
__LINE__);
+  _eglLog(_EGL_DEBUG, "destroy dri_image_front");
   dri2_dpy->image->destroyImage(dri2_surf->dri_image_front);
   dri2_surf->dri_image_front = NULL;
}
@@ -434,81 +434,98 @@ update_buffers(struct dri2_egl_surface *dri2_surf)
 }
 
 static int
-get_back_bo(struct dri2_egl_surface *dri2_surf)
+get_front_bo(struct dri2_egl_surface *dri2_surf, unsigned int format)
 {
struct dri2_egl_display *dri2_dpy =
   dri2_egl_display(dri2_surf->base.Resource.Display);
-   int fourcc, pitch;
-   int offset = 0, fd;
 
-   if (dri2_surf->dri_image_back)
+   if (dri2_surf->dri_image_front)
+   {
+  _eglLog(_EGL_WARNING, "dri2_image_front allocated !");
   return 0;
-
-   if (!dri2_surf->buffer)
-  return -1;
-
-   fd = get_native_buffer_fd(dri2_surf->buffer);
-   if (fd < 0) {
-  _eglLog(_EGL_WARNING, "Could not get native buffer FD");
-  return -1;
}
 
-   fourcc = get_fourcc(dri2_surf->buffer->format);
-
-   pitch = dri2_surf->buffer->stride *
-  get_format_bpp(dri2_surf->buffer->format);
-
-   if (fourcc == -1 || pitch == 0) {
-  _eglLog(_EGL_WARNING, "Invalid buffer fourcc(%x) or pitch(%d)",
-  fourcc, pitch);
-  return -1;
+   if (dri2_surf->base.Type == EGL_WINDOW_BIT) {
+  /* According current EGL spec, front buffer rendering
+   * for window surface is not supported now.
+   * and mesa doesn't have the implemetation of this case.
+   * Add warnning message, but not treat it as error.
+   */
+   _eglLog(_EGL_DEBUG, "front buffer for window surface is not supported 
now !");
+
+   } else if (dri2_surf->base.Type == EGL_PBUFFER_BIT) {
+
+   dri2_surf->dri_image_front =
+  dri2_dpy->image->createImage(dri2_dpy->dri_screen,
+  dri2_surf->base.Width,
+  dri2_surf->base.Height,
+  format,
+  0,
+  dri2_surf);
+  if (!dri2_surf->dri_image_front)
+  {
+ _eglLog(_EGL_WARNING, "dri2_image_front allocation failed !");
+ return -1;
+  }
+   } else {
+  _eglLog(_EGL_WARNING, "pixmap is not supported now !");
}
 
-   dri2_surf->dri_image_back =
-  dri2_dpy->image->createImageFromFds(dri2_dpy->dri_screen,
-  dri2_surf->base.Width,
-  dri2_surf->base.Height,
-  fourcc,
-  ,
-  1,
-  ,
-  ,
-  dri2_surf);
-   if (!dri2_surf->dri_image_back)
-  return -1;
-
return 0;
 }
 
 static int
-droid_image_get_buffers(__DRIdrawable *driDrawable,
-  unsigned int format,
-  uint32_t *stamp,
-  void *loaderPrivate,
-  uint32_t buffer_mask,
-  struct __DRIimageList *images)
+get_back_bo(struct dri2_egl_surface *dri2_surf, unsigned int format)
 {
-   struct dri2_egl_surface *dri2_surf = loaderPrivate;
struct dri2_egl_display *dri2_dpy =
   dri2_egl_display(dri2_surf->base.Resource.Display);
+   int fourcc, pitch;
+   int offset = 0, fd;
 
-   images->image_mask = 0;
-   images->front = NULL;
-   images->back = NULL;
-
-   if (update_buffers(dri2_surf) < 0)
+   if (dri2_surf->dri_image_back) {
+  _eglLog(_EGL_WARNING, "dri_image_back allocated !");
   return 0;
+   }
 
-   if (buffer_mask & 

Re: [Mesa-dev] loader: Add amdgpu code to loader.c

2016-11-24 Thread Albert Freeman
A different patch to that code has been applied that does the same
thing in a different (better) way.

On 24 November 2016 at 05:25, Albert Freeman  wrote:
> I wrote this code in response to a issue someone on mesa-users had
> (https://lists.freedesktop.org/archives/mesa-users/2016-October/001231.html).
> They didn't reply so I don't know if the patch resolved the issue. Can
> someone please determine its usefulness. Also please check if
> drmCommandWrite() is the correct function to use. I can't test the
> code, I don't have amdgpu.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] loader: Add amdgpu code to loader.c

2016-11-24 Thread Albert Freeman
I wrote this code in response to a issue someone on mesa-users had
(https://lists.freedesktop.org/archives/mesa-users/2016-October/001231.html).
They didn't reply so I don't know if the patch resolved the issue. Can
someone please determine its usefulness. Also please check if
drmCommandWrite() is the correct function to use. I can't test the
code, I don't have amdgpu.
diff --git a/mesa/src/loader/loader.c b/mesa2/src/loader/loader.c
index 3e60e4c..4a89ba4 100644
--- a/mesa/src/loader/loader.c
+++ b/mesa2/src/loader/loader.c
@@ -515,6 +515,8 @@ sysfs_get_pci_id_for_fd(int fd, int *vendor_id, int 
*chip_id)
 #include 
 /* for radeon */
 #include 
+/* for amdgpu */
+#include 
 
 static int
 drm_get_pci_id_for_fd(int fd, int *vendor_id, int *chip_id)
@@ -564,6 +566,26 @@ drm_get_pci_id_for_fd(int fd, int *vendor_id, int *chip_id)
 *chip_id = -1;
   }
}
+   else if (strcmp(version->name, "amdgpu") == 0) {
+  struct drm_amdgpu_info info;
+  struct drm_amdgpu_info_device info_device;
+  int ret;
+
+  *vendor_id = 0x1002;
+
+  memset(, 0, sizeof(info));
+  memset(_device, 0, sizeof(info_device));
+  info.query = AMDGPU_INFO_DEV_INFO;
+  info.return_pointer = (uint64_t) _device;
+  info.return_size = sizeof(struct drm_amdgpu_info_device);
+  ret = drmCommandWrite(fd, DRM_AMDGPU_INFO, , sizeof(info));
+  if (ret) {
+ log_(_LOADER_WARNING, "MESA-LOADER: failed to get info for amdgpu\n");
+ *chip_id = -1;
+  } else {
+ *chip_id = info_device.device_id;
+  }
+   }
else if (strcmp(version->name, "nouveau") == 0) {
   *vendor_id = 0x10de;
   /* not used */
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Mesa 13.0.2 release candidate

2016-11-24 Thread Jonathan Gray
On Thu, Nov 24, 2016 at 05:25:26PM +, Emil Velikov wrote:
> Hello list,
> 
> The candidate for the Mesa 13.0.2 is now available. Currently we have:
>  - 49 queued
>  - 4 nominated (outstanding)
>  - and 1 rejected patch(es)
> 
> 
> With this series we have - fixes for vc4, i965 and radeon drivers. In addition
> to that PCI IDs for Geminilake have been added to the i965 driver,
> 
> The respective Vulkan drivers have seen multiple improvements some of which
> include improved smoketesting and addressed memory leaks.
> 
> Races during _mesa_HashWalk() (while using glDeleteFramebuffers alongside
> glTexImage2D) and "#version 0" in GLSL programs have been addressed.
> 
> BSD and Hurd users should be above to build the latest code as we no longer
> use PATH_MAX.

You seem to be confusing things there.

BSD has had PATH_MAX since 1989.

commit dcc36b4d161e5d44274cc4bd6d375d04b758b61e
Author: Keith Bostic 
Date:   Thu Feb 16 14:11:48 1989 -0800

system limits for POSIX 1003.1; included by include/limits.h

SCCS-vsn: 7.1

diff --git a/sys/sys/syslimits.h b/sys/sys/syslimits.h
new file mode 100644
index 000..c60f25d
--- /dev/null
+++ b/sys/sys/syslimits.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 1988 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, Berkeley.  The name of the
+ * University may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * @(#)syslimits.h 7.1 (Berkeley) 02/16/89
+ */
+
+#defineARG_MAX 20480   /* max bytes for an exec function */
+#defineCHILD_MAX   40  /* max simultaneous processes */
+#defineLINK_MAX8   /* max file link count */
+#defineMAX_CANON   255 /* max bytes in terminal canonical 
input line */
+#defineMAX_INPUT   255 /* max bytes in terminal input */
+#defineNAME_MAX255 /* max number of bytes in a file name */
+#defineNGROUPS_MAX 16  /* max number of supplemental group 
id's */
+#defineOPEN_MAX64  /* max open files per process */
+#definePATH_MAX1024/* max number of bytes in pathname */
+#definePIPE_BUF512 /* max number of bytes for atomic pipe 
writes */

> 
> 
> Take a look at section "Mesa stable queue" for more information.
> 
> 
> Testing reports/general approval
> 
> Any testing reports (or general approval of the state of the branch) will be
> greatly appreciated.
> 
> The plan is to have 13.0.2 this Saturday (25th of November), around or
> shortly after 17:00 GMT.
> 
> If you have any questions or suggestions - be that about the current patch
> queue or otherwise, please go ahead.
> 
> 
> Trivial merge conflicts
> ---
> commit 9d5c3fc12b05d944508ef4e3b1f2ddc4f23c0a82
> Author: Jason Ekstrand 
> 
> i965/gs: Allow primitive id to be a system value
> 
> (cherry picked from commit a5e88e66e633aaeb587b274d80e21cd46c8ee2cb)
> 
> 
> commit 8dbdbc21910a6d37c381535186f9e728fff8690d
> Author: Jason Ekstrand 
> 
> anv: Handle null in all destructors
> 
> (cherry picked from commit 49f08ad77f51cc344e4bfe60ba9f8d9fccfbd753)
> 
> 
> commit 1809f17bda56d4f9d6385f63a9c4a5df890e3cad
> Author: Kenneth Graunke 
> 
> mesa: Drop PATH_MAX usage.
> 
> (cherry picked from commit 9bfee7047b70cb0aa026ca9536465762f96cb2b1)
> 
> Cheers,
> Emil
> 
> 
> Mesa stable queue
> -
> 
> Nominated (4)
> =
> 
> Dave Airlie (1):
>   2de85eb radv: fix texturesamples to handle single sample case
> 
> Jason Ekstrand (2):
>   e73d136 vulkan/wsi/x11: Implement FIFO mode.
> 
> Note: temporary on hold.
> Commit seems to be a feature and provides no clear indication about the bugs
> it addresses. Jason, is this really applicable for stable ?
> 
>   054e48e anv/cmd_buffer: Re-emit MEDIA_CURBE_LOAD when CS push
> constants are dirty
> 
> Note: temporary on hold.
> Depends on the refactoring d33e2ad67c3 (anv: Move INTERFACE_DESCRIPTOR_DATA
> setup to the pipeline) which in itself depends on another refactoring 
> (cleanup)
> commit 623e1e06d8c and likely others. Jason, any input ?
> 
> Kevin Strasser (1):
>   932bb3f vulkan/wsi: Add a thread-safe queue implementation
> 

Re: [Mesa-dev] [PATCH v5] clover: restore support for LLVM <= 3.9

2016-11-24 Thread Francisco Jerez
Jan Vesely  writes:

> On Tue, 2016-11-22 at 20:25 +0100, Vedran Miletić wrote:
>> The commit 8e430ff8b060b4e8e922bae24b3c57837da6ea77 support for LLVM
>> 3.9 and older versionsin  Clover. This patch restores it and refactors
>> the support using Clover compatibility layer for LLVM.
>> 
>> v2: merged #ifdef blocks
>> v3: added support for LLVM 3.6-3.8
>> v4: add missing #ifdef around 
>> v5: simplify using templates and lambda
>> 
>> Signed-off-by: Vedran Miletić 
>> Reviewed-by[v2]: Jan Vesely 
>> Tested-by[v4]: Vinson Lee 
>> Tested-by[v4]: Pierre Moreau 
>> Reviewed-by: Francisco Jerez 
>> ---
>>  .../state_trackers/clover/llvm/codegen/bitcode.cpp |  9 +++--
>>  src/gallium/state_trackers/clover/llvm/compat.hpp  | 18 
>> ++
>>  2 files changed, 21 insertions(+), 6 deletions(-)
>> 
>> diff --git a/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp 
>> b/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp
>> index 5dcc4f8..d09207b 100644
>> --- a/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp
>> +++ b/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp
>> @@ -32,6 +32,7 @@
>>  ///
>>  
>>  #include "llvm/codegen.hpp"
>> +#include "llvm/compat.hpp"
>>  #include "llvm/metadata.hpp"
>>  #include "core/error.hpp"
>>  #include "util/algorithm.hpp"
>> @@ -99,13 +100,9 @@ clover::llvm::parse_module_library(const module , 
>> ::llvm::LLVMContext ,
>> auto mod = ::llvm::parseBitcodeFile(::llvm::MemoryBufferRef(
>>  as_string(m.secs[0].data), " "), 
>> ctx);
>>  
>> -   if (::llvm::Error err = mod.takeError()) {
>> -  std::string msg;
>> -  ::llvm::handleAllErrors(std::move(err), [&](::llvm::ErrorInfoBase 
>> ) {
>> - msg = EIB.message();
>> - fail(r_log, error(CL_INVALID_PROGRAM), msg.c_str());
>
> interesting that this used to pass char * and now switched to
> std::string. was that a leftover from the times of compat::string?

I don't think so, it was 8e430ff8b060b4e8e922bae24b3c57837da6ea77 that
changed the argument to be a char * for some reason.

> you can add my RB to v5.
>
> Reviewed-by: Jan Vesely 
>
> Jan
>
>> +   compat::handle_module_error(mod, [&](const std::string ) {
>> + fail(r_log, error(CL_INVALID_PROGRAM), s);
>>});
>> -   }
>>  
>> return std::unique_ptr<::llvm::Module>(std::move(*mod));
>>  }
>> diff --git a/src/gallium/state_trackers/clover/llvm/compat.hpp 
>> b/src/gallium/state_trackers/clover/llvm/compat.hpp
>> index a963cff..fc257ec 100644
>> --- a/src/gallium/state_trackers/clover/llvm/compat.hpp
>> +++ b/src/gallium/state_trackers/clover/llvm/compat.hpp
>> @@ -39,6 +39,11 @@
>>  #include 
>>  #include 
>>  #include 
>> +#if HAVE_LLVM >= 0x0400
>> +#include 
>> +#else
>> +#include 
>> +#endif
>>  
>>  #if HAVE_LLVM >= 0x0307
>>  #include 
>> @@ -158,6 +163,19 @@ namespace clover {
>>  #else
>>   const auto default_reloc_model = ::llvm::Reloc::Default;
>>  #endif
>> +
>> + template inline void
>> + handle_module_error(M , const F ) {
>> +#if HAVE_LLVM >= 0x0400
>> +if (::llvm::Error err = mod.takeError())
>> +   ::llvm::handleAllErrors(std::move(err), 
>> [&](::llvm::ErrorInfoBase ) {
>> + f(eib.message());
>> +  });
>> +#else
>> +if (!mod)
>> +   f(mod.getError().message());
>> +#endif
>> + }
>>}
>> }
>>  }
>
> -- 
> Jan Vesely 


signature.asc
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v5] clover: restore support for LLVM <= 3.9

2016-11-24 Thread Francisco Jerez
Vedran Miletić  writes:

> The commit 8e430ff8b060b4e8e922bae24b3c57837da6ea77 support for LLVM
> 3.9 and older versionsin  Clover. This patch restores it and refactors
> the support using Clover compatibility layer for LLVM.
>
> v2: merged #ifdef blocks
> v3: added support for LLVM 3.6-3.8
> v4: add missing #ifdef around 
> v5: simplify using templates and lambda
>
> Signed-off-by: Vedran Miletić 
> Reviewed-by[v2]: Jan Vesely 
> Tested-by[v4]: Vinson Lee 
> Tested-by[v4]: Pierre Moreau 
> Reviewed-by: Francisco Jerez 
> ---
>  .../state_trackers/clover/llvm/codegen/bitcode.cpp |  9 +++--
>  src/gallium/state_trackers/clover/llvm/compat.hpp  | 18 
> ++
>  2 files changed, 21 insertions(+), 6 deletions(-)
>
> diff --git a/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp 
> b/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp
> index 5dcc4f8..d09207b 100644
> --- a/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp
> +++ b/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp
> @@ -32,6 +32,7 @@
>  ///
>  
>  #include "llvm/codegen.hpp"
> +#include "llvm/compat.hpp"
>  #include "llvm/metadata.hpp"
>  #include "core/error.hpp"
>  #include "util/algorithm.hpp"
> @@ -99,13 +100,9 @@ clover::llvm::parse_module_library(const module , 
> ::llvm::LLVMContext ,
> auto mod = ::llvm::parseBitcodeFile(::llvm::MemoryBufferRef(
>  as_string(m.secs[0].data), " "), 
> ctx);
>  
> -   if (::llvm::Error err = mod.takeError()) {
> -  std::string msg;
> -  ::llvm::handleAllErrors(std::move(err), [&](::llvm::ErrorInfoBase 
> ) {
> - msg = EIB.message();
> - fail(r_log, error(CL_INVALID_PROGRAM), msg.c_str());
> +   compat::handle_module_error(mod, [&](const std::string ) {
> + fail(r_log, error(CL_INVALID_PROGRAM), s);
>});
> -   }
>  
> return std::unique_ptr<::llvm::Module>(std::move(*mod));
>  }
> diff --git a/src/gallium/state_trackers/clover/llvm/compat.hpp 
> b/src/gallium/state_trackers/clover/llvm/compat.hpp
> index a963cff..fc257ec 100644
> --- a/src/gallium/state_trackers/clover/llvm/compat.hpp
> +++ b/src/gallium/state_trackers/clover/llvm/compat.hpp
> @@ -39,6 +39,11 @@
>  #include 
>  #include 
>  #include 
> +#if HAVE_LLVM >= 0x0400
> +#include 
> +#else
> +#include 
> +#endif
>  
>  #if HAVE_LLVM >= 0x0307
>  #include 
> @@ -158,6 +163,19 @@ namespace clover {
>  #else
>   const auto default_reloc_model = ::llvm::Reloc::Default;
>  #endif
> +
> + template inline void

I've dropped the 'inline' keyword (template functions implicitly have
inline linkage in C++), fixed some minor spelling issues in the commit
message and landed the patch.  Thanks!

> + handle_module_error(M , const F ) {
> +#if HAVE_LLVM >= 0x0400
> +if (::llvm::Error err = mod.takeError())
> +   ::llvm::handleAllErrors(std::move(err), 
> [&](::llvm::ErrorInfoBase ) {
> + f(eib.message());
> +  });
> +#else
> +if (!mod)
> +   f(mod.getError().message());
> +#endif
> + }
>}
> }
>  }
> -- 
> 2.7.4


signature.asc
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2] clover: restore support for LLVM <= 3.9

2016-11-24 Thread Francisco Jerez
Emil Velikov  writes:

> On 17 November 2016 at 17:27, Emil Velikov  wrote:
>
>> Admittedly not a huge C++ expert, but what's wrong with having a
>> simple 5 line patch that adds the original code in a if guard ?
>> If then the LLVM <= 3.9 codepath is (somewhat) wrong, let's tackle
>> that separately.
>>
> Anyone ?
>
Hi Emil, that's basically what v5 of Vedran's patch does, but the macro
magic is factored into a separate function to keep the running code free
of compatibility clutter, otherwise his patch should behave identically
to the pre-existing code (prior to
8e430ff8b060b4e8e922bae24b3c57837da6ea77) on LLVM v3.9 and older.

> Emil
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


signature.asc
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] anv/state: if enabled, use anisotropic filtering also with VK_FILTER_NEAREST

2016-11-24 Thread Jason Ekstrand
On Nov 24, 2016 7:12 AM, "Iago Toral"  wrote:
>
> On Thu, 2016-11-24 at 14:33 +0100, Iago Toral wrote:
> > Hi Lionel,
> >
> > On Thu, 2016-11-24 at 13:08 +, Lionel Landwerlin wrote:
> > >
> > > Hi Iago,
> > >
> > > Looking at the history, before
> > > ed4fe3e9ba9018e68afe6fdd4f267218a537fdaa
> > > we seem to set min/mag filter to MAPFILTER_ANISOTROPIC if
> > > maxAnisotropy
> > >  > 1. It seems your patch makes sense in using
> > > MAPFILTER_ANISOTROPIC
> > > in
> > > the NEAREST case, but I wonder whether we should also check for
> > > maxAnisotropy > 1.
> > Right, good catch, although I think that if we do that it should be a
> > separate change since we are not currently checking that for the
> > linear
> > filter either.

In GL, there is no explicit enable.  It's just assumed that it's "always
on" and the anisotropy value being 1.0 or > 1.0 enables and disables it.
Vulkan has an explicit bit so we should use that.

> > It seems that we do check for this in OpenGL so I think we probably
> > should do that here as well unless Jason dropped it for Vulkan on
> > purpose for some reason in that commit.
> >
> > I'll send a separate patch for this after I confirm that it does not
> > alter the results for the tests in CTS if we add that check.
>
> Actually, thinking about this a bit more, I don't think we need  That
> commit is about honoring SamplerCreateInfo.anisotropyEnable to decide
> whether to activate anisotropic filtering, so if that is true we want
> to use that. Notice that since that commit we clamp the anisotropy
> ratio to ensure it is in a valid range. If we pass a maxAnisotropy
> value < 1, it will clamp it to the minimum value we can work with, so I
> think Jason did that change on purpose.

You overestimate the amount of thought I put into anisotropic filtering.
:-)

I think this patch is probably correct.  At the very least, I don't think
it's wrong.  I'm not sure that it makes sense to use anisotropic filtering
with NEAREST.  I'm not even quite sure what that would mean.  The spec
certainly doesn't say.  Anyway, I think I'm fine with this but a bit more
digging to make sure we're actually doing it right might be in order.

Reviewed-by: Jason Ekstrand 

> Sounds reasonable?
>
> > Iago
> >
> > >
> > > On 24/11/16 11:30, Iago Toral Quiroga wrote:
> > > >
> > > >
> > > > Fixes multiple Vulkan CTS tests that combine anisotropy and
> > > > VK_FILTER_NEAREST
> > > > in dEQP-VK.texture.filtering_anisotropy.*
> > > > ---
> > > >   src/intel/vulkan/genX_state.c | 2 +-
> > > >   1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/src/intel/vulkan/genX_state.c
> > > > b/src/intel/vulkan/genX_state.c
> > > > index 4122395..0f621f9 100644
> > > > --- a/src/intel/vulkan/genX_state.c
> > > > +++ b/src/intel/vulkan/genX_state.c
> > > > @@ -101,7 +101,7 @@ vk_to_gen_tex_filter(VkFilter filter, bool
> > > > anisotropyEnable)
> > > >  default:
> > > > assert(!"Invalid filter");
> > > >  case VK_FILTER_NEAREST:
> > > > -  return MAPFILTER_NEAREST;
> > > > +  return anisotropyEnable ? MAPFILTER_ANISOTROPIC :
> > > > MAPFILTER_NEAREST;
> > > >  case VK_FILTER_LINEAR:
> > > > return anisotropyEnable ? MAPFILTER_ANISOTROPIC :
> > > > MAPFILTER_LINEAR;
> > > >  }
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2] clover: restore support for LLVM <= 3.9

2016-11-24 Thread Jan Vesely
On Fri, 2016-11-25 at 00:00 +, Emil Velikov wrote:
> On 17 November 2016 at 17:27, Emil Velikov  wrote:
> 
> > Admittedly not a huge C++ expert, but what's wrong with having a
> > simple 5 line patch that adds the original code in a if guard ?
> > If then the LLVM <= 3.9 codepath is (somewhat) wrong, let's tackle
> > that separately.
> > 
> 
> Anyone ?

you might get a more complete answer from someone else (curro), but
given the volatility of LLVM's C++ interface and the range of versions
supported by mesa, all the ifdef mess is concentrated in the compat
layer (llvm/compat.h).
Vedran's v5 took that approach.

Jan

> 
> Emil
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev

-- 
Jan Vesely 

signature.asc
Description: This is a digitally signed message part
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v5] clover: restore support for LLVM <= 3.9

2016-11-24 Thread Jan Vesely
On Tue, 2016-11-22 at 20:25 +0100, Vedran Miletić wrote:
> The commit 8e430ff8b060b4e8e922bae24b3c57837da6ea77 support for LLVM
> 3.9 and older versionsin  Clover. This patch restores it and refactors
> the support using Clover compatibility layer for LLVM.
> 
> v2: merged #ifdef blocks
> v3: added support for LLVM 3.6-3.8
> v4: add missing #ifdef around 
> v5: simplify using templates and lambda
> 
> Signed-off-by: Vedran Miletić 
> Reviewed-by[v2]: Jan Vesely 
> Tested-by[v4]: Vinson Lee 
> Tested-by[v4]: Pierre Moreau 
> Reviewed-by: Francisco Jerez 
> ---
>  .../state_trackers/clover/llvm/codegen/bitcode.cpp |  9 +++--
>  src/gallium/state_trackers/clover/llvm/compat.hpp  | 18 
> ++
>  2 files changed, 21 insertions(+), 6 deletions(-)
> 
> diff --git a/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp 
> b/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp
> index 5dcc4f8..d09207b 100644
> --- a/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp
> +++ b/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp
> @@ -32,6 +32,7 @@
>  ///
>  
>  #include "llvm/codegen.hpp"
> +#include "llvm/compat.hpp"
>  #include "llvm/metadata.hpp"
>  #include "core/error.hpp"
>  #include "util/algorithm.hpp"
> @@ -99,13 +100,9 @@ clover::llvm::parse_module_library(const module , 
> ::llvm::LLVMContext ,
> auto mod = ::llvm::parseBitcodeFile(::llvm::MemoryBufferRef(
>  as_string(m.secs[0].data), " "), 
> ctx);
>  
> -   if (::llvm::Error err = mod.takeError()) {
> -  std::string msg;
> -  ::llvm::handleAllErrors(std::move(err), [&](::llvm::ErrorInfoBase 
> ) {
> - msg = EIB.message();
> - fail(r_log, error(CL_INVALID_PROGRAM), msg.c_str());

interesting that this used to pass char * and now switched to
std::string. was that a leftover from the times of compat::string?
you can add my RB to v5.

Reviewed-by: Jan Vesely 

Jan

> +   compat::handle_module_error(mod, [&](const std::string ) {
> + fail(r_log, error(CL_INVALID_PROGRAM), s);
>});
> -   }
>  
> return std::unique_ptr<::llvm::Module>(std::move(*mod));
>  }
> diff --git a/src/gallium/state_trackers/clover/llvm/compat.hpp 
> b/src/gallium/state_trackers/clover/llvm/compat.hpp
> index a963cff..fc257ec 100644
> --- a/src/gallium/state_trackers/clover/llvm/compat.hpp
> +++ b/src/gallium/state_trackers/clover/llvm/compat.hpp
> @@ -39,6 +39,11 @@
>  #include 
>  #include 
>  #include 
> +#if HAVE_LLVM >= 0x0400
> +#include 
> +#else
> +#include 
> +#endif
>  
>  #if HAVE_LLVM >= 0x0307
>  #include 
> @@ -158,6 +163,19 @@ namespace clover {
>  #else
>   const auto default_reloc_model = ::llvm::Reloc::Default;
>  #endif
> +
> + template inline void
> + handle_module_error(M , const F ) {
> +#if HAVE_LLVM >= 0x0400
> +if (::llvm::Error err = mod.takeError())
> +   ::llvm::handleAllErrors(std::move(err), 
> [&](::llvm::ErrorInfoBase ) {
> + f(eib.message());
> +  });
> +#else
> +if (!mod)
> +   f(mod.getError().message());
> +#endif
> + }
>}
> }
>  }

-- 
Jan Vesely 

signature.asc
Description: This is a digitally signed message part
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 08/14] glsl: refactor duplicated validations between 2 layout-qualifiers

2016-11-24 Thread Timothy Arceri
Thanks.

Patches 7 & 8 are:

Reviewed-by: Timothy Arceri 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2] clover: restore support for LLVM <= 3.9

2016-11-24 Thread Emil Velikov
On 17 November 2016 at 17:27, Emil Velikov  wrote:

> Admittedly not a huge C++ expert, but what's wrong with having a
> simple 5 line patch that adds the original code in a if guard ?
> If then the LLVM <= 3.9 codepath is (somewhat) wrong, let's tackle
> that separately.
>
Anyone ?

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


Re: [Mesa-dev] [PATCH 3/3] isl: Make radv_finishme only warn once per call-site

2016-11-24 Thread Emil Velikov
On 24 November 2016 at 18:35, Bas Nieuwenhuizen  
wrote:
> You might want to rename the title of this patch.
>
That's correct, thanks. Fixed locally.

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


[Mesa-dev] [PATCH] swr: [rasterizer jit] use signed integer representation for logic op

2016-11-24 Thread Ilia Mirkin
Instead of (incorrectly) biasing the snorm value to make it look like a
unorm, just use signed integer math.

This fixes arb_color_buffer_float-render GL_RGBA8_SNORM

Signed-off-by: Ilia Mirkin 
---
 src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp | 17 -
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp 
b/src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp
index ad809c4..339ca52 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp
@@ -692,9 +692,13 @@ struct BlendJit : public Builder
 dst[i] = BITCAST(dst[i], mSimdInt32Ty);
 break;
 case SWR_TYPE_SNORM:
-src[i] = FADD(src[i], VIMMED1(0.5f));
-dst[i] = FADD(dst[i], VIMMED1(0.5f));
-/* fallthrough */
+src[i] = FP_TO_SI(
+FMUL(src[i], VIMMED1(scale[i])),
+mSimdInt32Ty);
+dst[i] = FP_TO_SI(
+FMUL(dst[i], VIMMED1(scale[i])),
+mSimdInt32Ty);
+break;
 case SWR_TYPE_UNORM:
 src[i] = FP_TO_UI(
 FMUL(src[i], VIMMED1(scale[i])),
@@ -728,11 +732,14 @@ struct BlendJit : public Builder
 result[i] = BITCAST(result[i], mSimdFP32Ty);
 break;
 case SWR_TYPE_SNORM:
+result[i] = SHL(result[i], 32 - info.bpc[i]);
+result[i] = ASHR(result[i], 32 - info.bpc[i]);
+result[i] = FMUL(SI_TO_FP(result[i], mSimdFP32Ty),
+ VIMMED1(1.0f / scale[i]));
+break;
 case SWR_TYPE_UNORM:
 result[i] = FMUL(UI_TO_FP(result[i], mSimdFP32Ty),
  VIMMED1(1.0f / scale[i]));
-if (info.type[i] == SWR_TYPE_SNORM)
-result[i] = FADD(result[i], VIMMED1(-0.5f));
 break;
 }
 
-- 
2.7.3

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


Re: [Mesa-dev] [PATCH 2/8] anv: Use library mtime for cache UUID.

2016-11-24 Thread Emil Velikov
On 24 November 2016 at 20:58, Jason Ekstrand  wrote:
> I'm not sure what I think of this... It has some interesting implications.
> I'll think about it and write something more detailed on Monday.
But but... it helps up get rid of the lovely timestamp experience 

Thanks for having a look - how go back and enjoy Thanks Giving ;-)
Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Mesa 13.0.2 release candidate

2016-11-24 Thread Emil Velikov
On 24 November 2016 at 20:44, Jason Ekstrand  wrote:
> On Nov 24, 2016 9:26 AM, "Emil Velikov"  wrote:
>>
>> Hello list,
>>
>> The candidate for the Mesa 13.0.2 is now available. Currently we have:
>>  - 49 queued
>>  - 4 nominated (outstanding)
>>  - and 1 rejected patch(es)
>>
>>
>> With this series we have - fixes for vc4, i965 and radeon drivers. In
>> addition
>> to that PCI IDs for Geminilake have been added to the i965 driver,
>>
>> The respective Vulkan drivers have seen multiple improvements some of
>> which
>> include improved smoketesting and addressed memory leaks.
>>
>> Races during _mesa_HashWalk() (while using glDeleteFramebuffers alongside
>> glTexImage2D) and "#version 0" in GLSL programs have been addressed.
>>
>> BSD and Hurd users should be above to build the latest code as we no
>> longer
>> use PATH_MAX.
>>
>>
>> Take a look at section "Mesa stable queue" for more information.
>>
>>
>> Testing reports/general approval
>> 
>> Any testing reports (or general approval of the state of the branch) will
>> be
>> greatly appreciated.
>>
>> The plan is to have 13.0.2 this Saturday (25th of November), around or
>> shortly after 17:00 GMT.
>>
>> If you have any questions or suggestions - be that about the current patch
>> queue or otherwise, please go ahead.
>>
>>
>> Trivial merge conflicts
>> ---
>> commit 9d5c3fc12b05d944508ef4e3b1f2ddc4f23c0a82
>> Author: Jason Ekstrand 
>>
>> i965/gs: Allow primitive id to be a system value
>>
>> (cherry picked from commit a5e88e66e633aaeb587b274d80e21cd46c8ee2cb)
>>
>>
>> commit 8dbdbc21910a6d37c381535186f9e728fff8690d
>> Author: Jason Ekstrand 
>>
>> anv: Handle null in all destructors
>>
>> (cherry picked from commit 49f08ad77f51cc344e4bfe60ba9f8d9fccfbd753)
>>
>>
>> commit 1809f17bda56d4f9d6385f63a9c4a5df890e3cad
>> Author: Kenneth Graunke 
>>
>> mesa: Drop PATH_MAX usage.
>>
>> (cherry picked from commit 9bfee7047b70cb0aa026ca9536465762f96cb2b1)
>>
>> Cheers,
>> Emil
>>
>>
>> Mesa stable queue
>> -
>>
>> Nominated (4)
>> =
>>
>> Dave Airlie (1):
>>   2de85eb radv: fix texturesamples to handle single sample case
>>
>> Jason Ekstrand (2):
>>   e73d136 vulkan/wsi/x11: Implement FIFO mode.
>>
>> Note: temporary on hold.
>> Commit seems to be a feature and provides no clear indication about the
>> bugs
>> it addresses. Jason, is this really applicable for stable ?
>
> Yes. I wouldn't have Cc'd otherwise. :-)  The spec requires FIFO mode so the
> fact that we didn't have it is a bug.
>
Ack it wasn't clear from the commit message whether this is optional
feature or a hard requirement. For the future please mention and/or
any implications that are likely to be addressed - performance,
lock-ups, failing programs, tests, other or anything else that comes
to mind.

Thanks
Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 7/8] radv: don't leak the fd if radv_physical_device_init() succeeds

2016-11-24 Thread Bas Nieuwenhuizen
Seems like libdrm_amdgpu does a dup indeed. Patches 7-8 are

Reviewed-by: Bas Nieuwenhuizen 

On Thu, Nov 24, 2016 at 9:30 PM, Emil Velikov  wrote:
> From: Emil Velikov 
>
> radv_amdgpu_winsys_create() does not take ownership of the fd, thus we
> end up leaking it as we return with VK_SUCCESS.
>
> Cc: Dave Airlie 
> Cc: "13.0" 
> Signed-off-by: Emil Velikov 
> ---
> Not 100% sure on this one.
> ---
>  src/amd/vulkan/radv_device.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
> index 1b8864d..a08f6ac 100644
> --- a/src/amd/vulkan/radv_device.c
> +++ b/src/amd/vulkan/radv_device.c
> @@ -130,6 +130,7 @@ radv_physical_device_init(struct radv_physical_device 
> *device,
>
> fprintf(stderr, "WARNING: radv is not a conformant vulkan 
> implementation, testing use only.\n");
> device->name = device->rad_info.name;
> +   close(fd);
> return VK_SUCCESS;
>
>  fail:
> --
> 2.10.2
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] i915: Add XRGB8888 format to intel_screen_make_configs

2016-11-24 Thread Mark Janes
I don't see any regressions in the automated test suites (piglit, deqp,
gl cts) with this patch.

-Mark

Emil Velikov  writes:

> On 24 November 2016 at 06:22, Boyan Ding  wrote:
>> 2016-11-24 13:29 GMT+08:00 Derek Foreman :
>>> On 23/11/16 07:18 PM, Boyan Ding wrote:

 2016-11-24 7:01 GMT+08:00 Derek Foreman :
>
> This is a copy of commit 536003c11e4cb1172c540932ce3cce06f03bf44e
> except for i915.
>
> Original log for the i965 commit follows:
>
>  Some application, such as drm backend of weston, uses XRGB config as
>  default. i965 doesn't provide this format, but before commit 65c8965d,
>  the drm platform of EGL takes ARGB as XRGB. Now that commit
>  65c8965d makes EGL recognize format correctly so weston won't start
>  because it can't find XRGB. Add XRGB format to i965 just as
>  other drivers do.
>
> Signed-off-by: Derek Foreman 
> ---
>  src/mesa/drivers/dri/i915/intel_screen.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/drivers/dri/i915/intel_screen.c
> b/src/mesa/drivers/dri/i915/intel_screen.c
> index 1b80df0..5c7c06a 100644
> --- a/src/mesa/drivers/dri/i915/intel_screen.c
> +++ b/src/mesa/drivers/dri/i915/intel_screen.c
> @@ -1044,7 +1044,8 @@ intel_screen_make_configs(__DRIscreen *dri_screen)
>  {
> static const mesa_format formats[] = {
>MESA_FORMAT_B5G6R5_UNORM,
> -  MESA_FORMAT_B8G8R8A8_UNORM
> +  MESA_FORMAT_B8G8R8A8_UNORM,
> +  MESA_FORMAT_B8G8R8X8_UNORM
> };
>
> /* GLX_SWAP_COPY_OML is not supported due to page flipping. */
> --
> 2.10.2
>

 Hi Derek,

 I sent exactly the same patch one and half years ago at [1], but
 withdrew it because it seems no one got interested in that and I don't
 have the hardware to test. If you're sure it is correct, this gets my

 Acked-by: Boyan Ding 
>>>
>>>
>>> I'm sorry, I didn't see your patch.  It makes more sense to me that I give
>>> you my RB on that patch in place of your Ack on mine.  I don't want to take
>>> credit for a problem you solved over a year ago. :)
>>>
>>> I don't have appropriate hardware but this has been tested for me by an
>>> Enlightenment user who was unable to use our GL backend because it's trying
>>> to use XRGB.
>>>
>>> Weston ran for him but logged a warning about falling back to an ARGB
>>> visual, which led me to the discovery that this had only been changed for
>>> i965.
>>>
>>> I'll try to get him to reply with a "Tested-by" tomorrow.
>>>
>>>
>>
>> Thanks for the kind reply, but I wonder if a more thorough testing
>> should be done before applying this. I remember its i965 counterpart
>> (commit 28090b30d) did cause some problem (Bug 90791) although it seems
>> not the fault on its own.
>>
>> We're facing the same problem I faced last year when posting this
>> patch -- I didn't have the authority to say that it was okay, and I
>> didn't have the hardware to test on as Emil once suggested[1].
>>
> Precisely - the patch on it's own was perfectly reasonable but it will
> likely cause issues like i965 one.
>
> Derek, skimming through the i965 history a very lengthy list of
> regressions/fixes comes up[1] as the format was advertised as
> supported.
>
> Considering we don't get much testing, it would be great to avoid
> breaking the world by fixing EGL/drm users (Wayland compositors,
> other).
>
> Ian, Mark Janes,
> Gents, do you have the hardware/chance to test this patch ?
>
> Thanks
> Emil
>
> [1]
> 28090b30dd6b5977de085f48c620574214b6b4ba i965: Add XRGB format to
> intel_screen_make_configs
> * Adds the format since things broke as EGL/drm was fixed to correctly
> honour the formats commit 65c8965d033 (egl: Take alpha bits into
> account when selecting GBM formats)
>
> 8da79b8378ae87474d8c47ad955e4833edf98359 i965: Fix HW blitter pitch limits
> c2d0606827412b710dcaed80268fc665de8c9c5d i915: Blit RGBX<->RGBA
> drawpixels // should read i965
> 922c0c9fd526ce19b87bc74a3159dec7705c1de1 i965: Export format
> comparison for blitting between miptrees
> * Fixes serious performance issue due to the extra format.
>
> bd38f91f8d80897ca91979962d80d4bc0acef586 i965: do_blit_drawpixels:
> decode array formats
> * Fixes the last commit above
>
> 2cebaac479d49cd6df4e97b466ba14bab3f30db1 i965: Don't use tiled_memcpy
> to download from RGBX or BGRX surfaces
> * Disable those since it causes regressions
>
> 3f10774cbab1e803f8aa3d6d24f8f6f98b8128c3 i965: Check base format to
> determine whether to use tiled memcpy
> * Aims to rework/fix the above.
>
> c769efda939e06338d41e1046a5f954c690951d5 i965: Add
> MESA_FORMAT_B8G8R8X8_SRGB to brw_format_for_mesa_format
> 43f4be5f06b7a96b96a3a7b43f5112139a1f423a i965: Add B8G8R8X8_SRGB 

Re: [Mesa-dev] [PATCH] anv/state: if enabled, use anisotropic filtering also with VK_FILTER_NEAREST

2016-11-24 Thread Lionel Landwerlin
Thanks for the explanation, feel free to wait for Jason's rb otherwise
:

Reviewed-by: Lionel Landwerlin 

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


[Mesa-dev] [Bug 98166] [vulkan, radv] make install regenerates radv_timestamp.h and rebuilds radv_device.lo

2016-11-24 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=98166

Emil Velikov  changed:

   What|Removed |Added

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

--- Comment #2 from Emil Velikov  ---
Should not longer be the case with

commit d94383970f2cad9f474760b18fd277efeda4c612
Author: Bas Nieuwenhuizen 
Date:   Tue Nov 22 00:19:30 2016 +0100

radv: Use library mtime for cache UUID.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 96993] new gallium swr driver can not be built on Windows

2016-11-24 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=96993

Ilia Mirkin  changed:

   What|Removed |Added

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

--- Comment #1 from Ilia Mirkin  ---
Support for this has recently been pushed. I believe you now can do

scons swr=1 libgl-gdi

to get the relevant libraries. You still have to use GALLIUM_DRIVER=swr in the
environment for it to pick swr over llvmpipe.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/8] anv: Use library mtime for cache UUID.

2016-11-24 Thread Jason Ekstrand
I'm not sure what I think of this... It has some interesting implications.
I'll think about it and write something more detailed on Monday.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/8] anv: Store UUID in physical device.

2016-11-24 Thread Jason Ekstrand
On Nov 24, 2016 12:42 PM, "Emil Velikov"  wrote:
>
> From: Emil Velikov 
>
> Port of an equivalent commit for radv.
>
> Signed-off-by: Emil Velikov 
> ---
>  src/intel/vulkan/anv_device.c | 18 ++
>  src/intel/vulkan/anv_pipeline_cache.c |  8 
>  src/intel/vulkan/anv_private.h|  4 ++--
>  3 files changed, 16 insertions(+), 14 deletions(-)
>
> diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
> index 2c8ac49..58c6b3f 100644
> --- a/src/intel/vulkan/anv_device.c
> +++ b/src/intel/vulkan/anv_device.c
> @@ -53,6 +53,13 @@ compiler_perf_log(void *data, const char *fmt, ...)
> va_end(args);
>  }
>
> +static void
> +anv_device_get_cache_uuid(void *uuid)
> +{
> +   memset(uuid, 0, VK_UUID_SIZE);
> +   snprintf(uuid, VK_UUID_SIZE, "anv-%s", ANV_TIMESTAMP);

This is just two lines.  Let's inline it.  Also, it occurs to new that we
should also be including the PCI ID in the UUID so that you don't end up
using cached shaders on the wrong hardware when using distro builds.  If
you want that to be a separate patch that's fine.  I can also do it.  In
any case, this seems reasonable.  With this guy inlined,

Reviewed-by: Jason Ekstrand 

> +}
> +
>  static VkResult
>  anv_physical_device_init(struct anv_physical_device *device,
>   struct anv_instance *instance,
> @@ -179,6 +186,8 @@ anv_physical_device_init(struct anv_physical_device
*device,
> if (result != VK_SUCCESS)
> goto fail;
>
> +   anv_device_get_cache_uuid(device->uuid);
> +
> /* XXX: Actually detect bit6 swizzling */
> isl_device_init(>isl_dev, >info, swizzled);
>
> @@ -455,13 +464,6 @@ void anv_GetPhysicalDeviceFeatures(
>pdevice->compiler->scalar_stage[MESA_SHADER_GEOMETRY];
>  }
>
> -void
> -anv_device_get_cache_uuid(void *uuid)
> -{
> -   memset(uuid, 0, VK_UUID_SIZE);
> -   snprintf(uuid, VK_UUID_SIZE, "anv-%s", ANV_TIMESTAMP);
> -}
> -
>  void anv_GetPhysicalDeviceProperties(
>  VkPhysicalDevicephysicalDevice,
>  VkPhysicalDeviceProperties* pProperties)
> @@ -602,7 +604,7 @@ void anv_GetPhysicalDeviceProperties(
> };
>
> strcpy(pProperties->deviceName, pdevice->name);
> -   anv_device_get_cache_uuid(pProperties->pipelineCacheUUID);
> +   memcpy(pProperties->pipelineCacheUUID, pdevice->uuid, VK_UUID_SIZE);
>  }
>
>  void anv_GetPhysicalDeviceQueueFamilyProperties(
> diff --git a/src/intel/vulkan/anv_pipeline_cache.c
b/src/intel/vulkan/anv_pipeline_cache.c
> index ddd51db..a8ea80f 100644
> --- a/src/intel/vulkan/anv_pipeline_cache.c
> +++ b/src/intel/vulkan/anv_pipeline_cache.c
> @@ -333,8 +333,8 @@ anv_pipeline_cache_load(struct anv_pipeline_cache
*cache,
>  const void *data, size_t size)
>  {
> struct anv_device *device = cache->device;
> +   struct anv_physical_device *pdevice =
>instance->physicalDevice;
> struct cache_header header;
> -   uint8_t uuid[VK_UUID_SIZE];
>
> if (cache->cache == NULL)
>return;
> @@ -350,8 +350,7 @@ anv_pipeline_cache_load(struct anv_pipeline_cache
*cache,
>return;
> if (header.device_id != device->chipset_id)
>return;
> -   anv_device_get_cache_uuid(uuid);
> -   if (memcmp(header.uuid, uuid, VK_UUID_SIZE) != 0)
> +   if (memcmp(header.uuid, pdevice->uuid, VK_UUID_SIZE) != 0)
>return;
>
> const void *end = data + size;
> @@ -470,6 +469,7 @@ VkResult anv_GetPipelineCacheData(
>  {
> ANV_FROM_HANDLE(anv_device, device, _device);
> ANV_FROM_HANDLE(anv_pipeline_cache, cache, _cache);
> +   struct anv_physical_device *pdevice =
>instance->physicalDevice;
> struct cache_header *header;
>
> if (pData == NULL) {
> @@ -497,7 +497,7 @@ VkResult anv_GetPipelineCacheData(
> header->header_version = VK_PIPELINE_CACHE_HEADER_VERSION_ONE;
> header->vendor_id = 0x8086;
> header->device_id = device->chipset_id;
> -   anv_device_get_cache_uuid(header->uuid);
> +   memcpy(header->uuid, pdevice->uuid, VK_UUID_SIZE);
> p += align_u32(header->header_size, 8);
>
> uint32_t *count = p;
> diff --git a/src/intel/vulkan/anv_private.h
b/src/intel/vulkan/anv_private.h
> index 2fc543d..d3f98e8 100644
> --- a/src/intel/vulkan/anv_private.h
> +++ b/src/intel/vulkan/anv_private.h
> @@ -505,6 +505,8 @@ struct anv_physical_device {
>  uint32_teu_total;
>  uint32_tsubslice_total;
>
> +uint8_t uuid[VK_UUID_SIZE];
> +
>  struct wsi_device   wsi_device;
>  };
>
> @@ -596,8 +598,6 @@ struct anv_device {
>  pthread_cond_t  queue_submit;
>  };
>
> -void anv_device_get_cache_uuid(void *uuid);
> -
>  void anv_device_init_blorp(struct anv_device *device);
>  void anv_device_finish_blorp(struct anv_device 

Re: [Mesa-dev] Mesa 13.0.2 release candidate

2016-11-24 Thread Jason Ekstrand
On Nov 24, 2016 9:26 AM, "Emil Velikov"  wrote:
>
> Hello list,
>
> The candidate for the Mesa 13.0.2 is now available. Currently we have:
>  - 49 queued
>  - 4 nominated (outstanding)
>  - and 1 rejected patch(es)
>
>
> With this series we have - fixes for vc4, i965 and radeon drivers. In
addition
> to that PCI IDs for Geminilake have been added to the i965 driver,
>
> The respective Vulkan drivers have seen multiple improvements some of
which
> include improved smoketesting and addressed memory leaks.
>
> Races during _mesa_HashWalk() (while using glDeleteFramebuffers alongside
> glTexImage2D) and "#version 0" in GLSL programs have been addressed.
>
> BSD and Hurd users should be above to build the latest code as we no
longer
> use PATH_MAX.
>
>
> Take a look at section "Mesa stable queue" for more information.
>
>
> Testing reports/general approval
> 
> Any testing reports (or general approval of the state of the branch) will
be
> greatly appreciated.
>
> The plan is to have 13.0.2 this Saturday (25th of November), around or
> shortly after 17:00 GMT.
>
> If you have any questions or suggestions - be that about the current patch
> queue or otherwise, please go ahead.
>
>
> Trivial merge conflicts
> ---
> commit 9d5c3fc12b05d944508ef4e3b1f2ddc4f23c0a82
> Author: Jason Ekstrand 
>
> i965/gs: Allow primitive id to be a system value
>
> (cherry picked from commit a5e88e66e633aaeb587b274d80e21cd46c8ee2cb)
>
>
> commit 8dbdbc21910a6d37c381535186f9e728fff8690d
> Author: Jason Ekstrand 
>
> anv: Handle null in all destructors
>
> (cherry picked from commit 49f08ad77f51cc344e4bfe60ba9f8d9fccfbd753)
>
>
> commit 1809f17bda56d4f9d6385f63a9c4a5df890e3cad
> Author: Kenneth Graunke 
>
> mesa: Drop PATH_MAX usage.
>
> (cherry picked from commit 9bfee7047b70cb0aa026ca9536465762f96cb2b1)
>
> Cheers,
> Emil
>
>
> Mesa stable queue
> -
>
> Nominated (4)
> =
>
> Dave Airlie (1):
>   2de85eb radv: fix texturesamples to handle single sample case
>
> Jason Ekstrand (2):
>   e73d136 vulkan/wsi/x11: Implement FIFO mode.
>
> Note: temporary on hold.
> Commit seems to be a feature and provides no clear indication about the
bugs
> it addresses. Jason, is this really applicable for stable ?

Yes. I wouldn't have Cc'd otherwise. :-)  The spec requires FIFO mode so
the fact that we didn't have it is a bug.

>   054e48e anv/cmd_buffer: Re-emit MEDIA_CURBE_LOAD when CS push
> constants are dirty
>
> Note: temporary on hold.
> Depends on the refactoring d33e2ad67c3 (anv: Move
INTERFACE_DESCRIPTOR_DATA
> setup to the pipeline) which in itself depends on another refactoring
(cleanup)
> commit 623e1e06d8c and likely others. Jason, any input ?
>
> Kevin Strasser (1):
>   932bb3f vulkan/wsi: Add a thread-safe queue implementation
> Requirement for "Implement FIFO mode above" above.
>
>
> Queued (49)
> ===
>
> Ben Widawsky (3):
>   i965: Add some APL and KBL SKU strings
>   i965: Reorder PCI ID list to match release order
>   i965/glk: Add basic Geminilake support
>
> Dave Airlie (7):
>   radv: fix texturesamples to handle single sample case
>   wsi: fix VK_INCOMPLETE for vkGetSwapchainImagesKHR
>   radv: don't crash on null swapchain destroy.
>   ac/nir/llvm: fix channel in texture gather lowering code.
>   radv: make sure to flush input attachments correctly.
>   radv: fix image view creation for depth and stencil only
>   radv: spir-v allows texture size query with and without lod.
>
> Eduardo Lima Mitev (2):
>   vulkan/wsi/x11: Fix behavior of vkGetPhysicalDeviceSurfaceFormatsKHR
>   vulkan/wsi/x11: Fix behavior of
vkGetPhysicalDeviceSurfacePresentModesKHR
>
> Eduardo, I've picked these two since they are perfectly reasonable
> stable material.
> Let me know if you think that we should keep or drop them.
>
> Emil Velikov (3):
>   docs: add sha256 checksums for 13.0.1
>   cherry-ignore: add reverted LLVM_LIBDIR patch
>   anv: fix enumeration of properties
>
> Eric Anholt (3):
>   vc4: Don't abort when a shader compile fails.
>   vc4: Clamp the shadow comparison value.
>   vc4: Fix register class handling of DDX/DDY arguments.
>
> Gwan-gyeong Mun (2):
>   util/disk_cache: close a previously opened handle in disk_cache_put
(v2)
>   anv: Fix unintentional integer overflow in
anv_CreateDmaBufImageINTEL
>
> Iago Toral Quiroga (1):
>   anv/format: handle unsupported formats properly
>
> Ian Romanick (2):
>   glcpp: Handle '#version 0' and other invalid values
>   glsl: Parse 0 as a preprocessor INTCONSTANT
>
> Jason Ekstrand (14):
>   anv/gen8: Stall when needed in Cmd(Set|Reset)Event
>   anv/wsi: Set the fence to signaled in AcquireNextImageKHR
>   anv: Rework fences
>   vulkan/wsi/wayland: Include pthread.h
>

[Mesa-dev] [PATCH 2/8] anv: Use library mtime for cache UUID.

2016-11-24 Thread Emil Velikov
From: Emil Velikov 

Inspired by a similar commit for radv.

Rather than recomputing the timestamp on each make invocation, just
fetch it at runtime.

Thus we no longer get the constant rebuild of anv_device.c and the
follow-up libvulkan_intel.so link, when nothing has changed.

I.e. using make && make install is a little bit faster.

Signed-off-by: Emil Velikov 
---
 src/intel/vulkan/anv_device.c | 37 +
 1 file changed, 33 insertions(+), 4 deletions(-)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 58c6b3f..4711501 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -21,15 +21,16 @@
  * IN THE SOFTWARE.
  */
 
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
 #include "anv_private.h"
-#include "anv_timestamp.h"
 #include "util/strtod.h"
 #include "util/debug.h"
 
@@ -53,11 +54,32 @@ compiler_perf_log(void *data, const char *fmt, ...)
va_end(args);
 }
 
-static void
+static int
+anv_get_function_timestamp(void *ptr, uint32_t* timestamp)
+{
+   Dl_info info;
+   struct stat st;
+   if (!dladdr(ptr, ) || !info.dli_fname)
+  return -1;
+
+   if (stat(info.dli_fname, ))
+  return -1;
+
+   *timestamp = st.st_mtim.tv_sec;
+   return 0;
+}
+
+static int
 anv_device_get_cache_uuid(void *uuid)
 {
+   uint32_t timestamp;
+
memset(uuid, 0, VK_UUID_SIZE);
-   snprintf(uuid, VK_UUID_SIZE, "anv-%s", ANV_TIMESTAMP);
+   if (anv_get_function_timestamp(anv_device_get_cache_uuid, ))
+ return -1;
+
+   snprintf(uuid, VK_UUID_SIZE, "anv-%d", timestamp);
+   return 0;
 }
 
 static VkResult
@@ -186,7 +208,14 @@ anv_physical_device_init(struct anv_physical_device 
*device,
if (result != VK_SUCCESS)
goto fail;
 
-   anv_device_get_cache_uuid(device->uuid);
+   if (anv_device_get_cache_uuid(device->uuid)) {
+  anv_finish_wsi(device);
+  ralloc_free(device->compiler);
+  result = vk_errorf(VK_ERROR_INITIALIZATION_FAILED,
+ "cannot generate UUID");
+  goto fail;
+   }
+
 
/* XXX: Actually detect bit6 swizzling */
isl_device_init(>isl_dev, >info, swizzled);
-- 
2.10.2

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


[Mesa-dev] [PATCH 5/8] anv: don't double-close the same fd

2016-11-24 Thread Emil Velikov
From: Emil Velikov 

Cc: "13.0" 
Signed-off-by: Emil Velikov 
---
 src/intel/vulkan/anv_device.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 4711501..0e01e28 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -192,8 +192,6 @@ anv_physical_device_init(struct anv_physical_device *device,
  device->info.max_cs_threads = max_cs_threads;
}
 
-   close(fd);
-
brw_process_intel_debug_variable();
 
device->compiler = brw_compiler_create(NULL, >info);
@@ -220,6 +218,7 @@ anv_physical_device_init(struct anv_physical_device *device,
/* XXX: Actually detect bit6 swizzling */
isl_device_init(>isl_dev, >info, swizzled);
 
+   close(fd);
return VK_SUCCESS;
 
 fail:
-- 
2.10.2

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


[Mesa-dev] [PATCH 7/8] radv: don't leak the fd if radv_physical_device_init() succeeds

2016-11-24 Thread Emil Velikov
From: Emil Velikov 

radv_amdgpu_winsys_create() does not take ownership of the fd, thus we
end up leaking it as we return with VK_SUCCESS.

Cc: Dave Airlie 
Cc: "13.0" 
Signed-off-by: Emil Velikov 
---
Not 100% sure on this one.
---
 src/amd/vulkan/radv_device.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 1b8864d..a08f6ac 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -130,6 +130,7 @@ radv_physical_device_init(struct radv_physical_device 
*device,
 
fprintf(stderr, "WARNING: radv is not a conformant vulkan 
implementation, testing use only.\n");
device->name = device->rad_info.name;
+   close(fd);
return VK_SUCCESS;
 
 fail:
-- 
2.10.2

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


[Mesa-dev] [PATCH 3/8] anv: automake: don't generate anv_timestamp.h

2016-11-24 Thread Emil Velikov
From: Emil Velikov 

No longer used as of last commit.

Signed-off-by: Emil Velikov 
---
 src/intel/vulkan/Makefile.am  | 6 --
 src/intel/vulkan/Makefile.sources | 3 +--
 2 files changed, 1 insertion(+), 8 deletions(-)

diff --git a/src/intel/vulkan/Makefile.am b/src/intel/vulkan/Makefile.am
index 4a7bb18..e803a49 100644
--- a/src/intel/vulkan/Makefile.am
+++ b/src/intel/vulkan/Makefile.am
@@ -140,12 +140,6 @@ anv_entrypoints.c : anv_entrypoints_gen.py 
$(vulkan_include_HEADERS)
$(AM_V_GEN) cat $(vulkan_include_HEADERS) |\
$(PYTHON2) $(srcdir)/anv_entrypoints_gen.py code > $@
 
-.PHONY: anv_timestamp.h
-
-anv_timestamp.h:
-   @echo "Updating anv_timestamp.h"
-   $(AM_V_GEN) echo "#define ANV_TIMESTAMP \"$(TIMESTAMP_CMD)\"" > $@
-
 BUILT_SOURCES = $(VULKAN_GENERATED_FILES)
 CLEANFILES = $(BUILT_SOURCES) dev_icd.json intel_icd.@host_cpu@.json
 EXTRA_DIST = \
diff --git a/src/intel/vulkan/Makefile.sources 
b/src/intel/vulkan/Makefile.sources
index e66df87..bd78805 100644
--- a/src/intel/vulkan/Makefile.sources
+++ b/src/intel/vulkan/Makefile.sources
@@ -59,8 +59,7 @@ VULKAN_GEM_STUB_FILES := \
 
 VULKAN_GENERATED_FILES := \
anv_entrypoints.c \
-   anv_entrypoints.h \
-   anv_timestamp.h
+   anv_entrypoints.h
 
 
 GEN7_FILES := \
-- 
2.10.2

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


[Mesa-dev] [PATCH 4/8] configure.ac: remove no longer used TIMESTAMP_CMD

2016-11-24 Thread Emil Velikov
From: Emil Velikov 

Good bye, you shall not be missed.

Signed-off-by: Emil Velikov 
---
 configure.ac | 2 --
 1 file changed, 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5f30ae8..e7e5628 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2644,8 +2644,6 @@ AC_SUBST([XA_MINOR], $XA_MINOR)
 AC_SUBST([XA_TINY], $XA_TINY)
 AC_SUBST([XA_VERSION], "$XA_MAJOR.$XA_MINOR.$XA_TINY")
 
-AC_SUBST([TIMESTAMP_CMD], '`test $(SOURCE_DATE_EPOCH) && echo 
$(SOURCE_DATE_EPOCH) || date +%s`')
-
 AC_ARG_ENABLE(valgrind,
   [AS_HELP_STRING([--enable-valgrind],
  [Build mesa with valgrind support (default: 
auto)])],
-- 
2.10.2

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


[Mesa-dev] [PATCH 8/8] radv: don't return VK_SUCCESS if radv_device_get_cache_uuid() fails

2016-11-24 Thread Emil Velikov
From: Emil Velikov 

If radv_device_get_cache_uuid() fails result will be VK_SUCCESS as set
by the radv_init_wsi() call above.

Fixes: d943839 (radv: Use library mtime for cache UUID.)
Cc: Bas Nieuwenhuizen 
Signed-off-by: Emil Velikov 
---
 src/amd/vulkan/radv_device.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index a08f6ac..41e8a1c 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -125,6 +125,8 @@ radv_physical_device_init(struct radv_physical_device 
*device,
if (radv_device_get_cache_uuid(device->rad_info.family, device->uuid)) {
radv_finish_wsi(device);
device->ws->destroy(device->ws);
+   result = vk_errorf(VK_ERROR_INITIALIZATION_FAILED,
+  "cannot generate UUID");
goto fail;
}
 
-- 
2.10.2

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


[Mesa-dev] [PATCH 6/8] anv: don't leak memory if anv_init_wsi() fails

2016-11-24 Thread Emil Velikov
From: Emil Velikov 

brw_compiler_create() rzalloc-ates memory which we forgot to free.

Cc: "13.0" 
Signed-off-by: Emil Velikov 
---
 src/intel/vulkan/anv_device.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 0e01e28..b4c2e4b 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -203,8 +203,10 @@ anv_physical_device_init(struct anv_physical_device 
*device,
device->compiler->shader_perf_log = compiler_perf_log;
 
result = anv_init_wsi(device);
-   if (result != VK_SUCCESS)
-   goto fail;
+   if (result != VK_SUCCESS) {
+  ralloc_free(device->compiler);
+  goto fail;
+   }
 
if (anv_device_get_cache_uuid(device->uuid)) {
   anv_finish_wsi(device);
-- 
2.10.2

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


[Mesa-dev] [PATCH 1/8] anv: Store UUID in physical device.

2016-11-24 Thread Emil Velikov
From: Emil Velikov 

Port of an equivalent commit for radv.

Signed-off-by: Emil Velikov 
---
 src/intel/vulkan/anv_device.c | 18 ++
 src/intel/vulkan/anv_pipeline_cache.c |  8 
 src/intel/vulkan/anv_private.h|  4 ++--
 3 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 2c8ac49..58c6b3f 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -53,6 +53,13 @@ compiler_perf_log(void *data, const char *fmt, ...)
va_end(args);
 }
 
+static void
+anv_device_get_cache_uuid(void *uuid)
+{
+   memset(uuid, 0, VK_UUID_SIZE);
+   snprintf(uuid, VK_UUID_SIZE, "anv-%s", ANV_TIMESTAMP);
+}
+
 static VkResult
 anv_physical_device_init(struct anv_physical_device *device,
  struct anv_instance *instance,
@@ -179,6 +186,8 @@ anv_physical_device_init(struct anv_physical_device *device,
if (result != VK_SUCCESS)
goto fail;
 
+   anv_device_get_cache_uuid(device->uuid);
+
/* XXX: Actually detect bit6 swizzling */
isl_device_init(>isl_dev, >info, swizzled);
 
@@ -455,13 +464,6 @@ void anv_GetPhysicalDeviceFeatures(
   pdevice->compiler->scalar_stage[MESA_SHADER_GEOMETRY];
 }
 
-void
-anv_device_get_cache_uuid(void *uuid)
-{
-   memset(uuid, 0, VK_UUID_SIZE);
-   snprintf(uuid, VK_UUID_SIZE, "anv-%s", ANV_TIMESTAMP);
-}
-
 void anv_GetPhysicalDeviceProperties(
 VkPhysicalDevicephysicalDevice,
 VkPhysicalDeviceProperties* pProperties)
@@ -602,7 +604,7 @@ void anv_GetPhysicalDeviceProperties(
};
 
strcpy(pProperties->deviceName, pdevice->name);
-   anv_device_get_cache_uuid(pProperties->pipelineCacheUUID);
+   memcpy(pProperties->pipelineCacheUUID, pdevice->uuid, VK_UUID_SIZE);
 }
 
 void anv_GetPhysicalDeviceQueueFamilyProperties(
diff --git a/src/intel/vulkan/anv_pipeline_cache.c 
b/src/intel/vulkan/anv_pipeline_cache.c
index ddd51db..a8ea80f 100644
--- a/src/intel/vulkan/anv_pipeline_cache.c
+++ b/src/intel/vulkan/anv_pipeline_cache.c
@@ -333,8 +333,8 @@ anv_pipeline_cache_load(struct anv_pipeline_cache *cache,
 const void *data, size_t size)
 {
struct anv_device *device = cache->device;
+   struct anv_physical_device *pdevice = >instance->physicalDevice;
struct cache_header header;
-   uint8_t uuid[VK_UUID_SIZE];
 
if (cache->cache == NULL)
   return;
@@ -350,8 +350,7 @@ anv_pipeline_cache_load(struct anv_pipeline_cache *cache,
   return;
if (header.device_id != device->chipset_id)
   return;
-   anv_device_get_cache_uuid(uuid);
-   if (memcmp(header.uuid, uuid, VK_UUID_SIZE) != 0)
+   if (memcmp(header.uuid, pdevice->uuid, VK_UUID_SIZE) != 0)
   return;
 
const void *end = data + size;
@@ -470,6 +469,7 @@ VkResult anv_GetPipelineCacheData(
 {
ANV_FROM_HANDLE(anv_device, device, _device);
ANV_FROM_HANDLE(anv_pipeline_cache, cache, _cache);
+   struct anv_physical_device *pdevice = >instance->physicalDevice;
struct cache_header *header;
 
if (pData == NULL) {
@@ -497,7 +497,7 @@ VkResult anv_GetPipelineCacheData(
header->header_version = VK_PIPELINE_CACHE_HEADER_VERSION_ONE;
header->vendor_id = 0x8086;
header->device_id = device->chipset_id;
-   anv_device_get_cache_uuid(header->uuid);
+   memcpy(header->uuid, pdevice->uuid, VK_UUID_SIZE);
p += align_u32(header->header_size, 8);
 
uint32_t *count = p;
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index 2fc543d..d3f98e8 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -505,6 +505,8 @@ struct anv_physical_device {
 uint32_teu_total;
 uint32_tsubslice_total;
 
+uint8_t uuid[VK_UUID_SIZE];
+
 struct wsi_device   wsi_device;
 };
 
@@ -596,8 +598,6 @@ struct anv_device {
 pthread_cond_t  queue_submit;
 };
 
-void anv_device_get_cache_uuid(void *uuid);
-
 void anv_device_init_blorp(struct anv_device *device);
 void anv_device_finish_blorp(struct anv_device *device);
 
-- 
2.10.2

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


[Mesa-dev] [PATCH] swr: perform perspective division on clip distances

2016-11-24 Thread Ilia Mirkin
Clip distances need to be perspective-divided. This fixes all the
interpolation-*-{distance,vertex} piglits.

Also take this opportunity to fix clip distances for points rasterized
as triangles - the clip distance is not subject to sprite coord
replacement, so there's no interpolation of it. We just take its value
and put it in the "z" component of the barycentric-ready plane equation.
(We could also just cull it at an earlier point in time, but that would
require larger changes.)

Signed-off-by: Ilia Mirkin 
---
 src/gallium/drivers/swr/rasterizer/core/binner.cpp | 22 +++---
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/swr/rasterizer/core/binner.cpp 
b/src/gallium/drivers/swr/rasterizer/core/binner.cpp
index 6f9259f..d5f2e97 100644
--- a/src/gallium/drivers/swr/rasterizer/core/binner.cpp
+++ b/src/gallium/drivers/swr/rasterizer/core/binner.cpp
@@ -383,7 +383,7 @@ PFN_PROCESS_ATTRIBUTES GetProcessAttributesFunc(uint32_t 
NumVerts, bool IsSwizzl
 /// @param clipDistMask - mask of enabled clip distances
 /// @param pUserClipBuffer - buffer to store results
 template
-void ProcessUserClipDist(PA_STATE& pa, uint32_t primIndex, uint8_t 
clipDistMask, float* pUserClipBuffer)
+void ProcessUserClipDist(PA_STATE& pa, uint32_t primIndex, uint8_t 
clipDistMask, float *pRecipW, float* pUserClipBuffer)
 {
 DWORD clipDist;
 while (_BitScanForward(, clipDistMask))
@@ -407,11 +407,12 @@ void ProcessUserClipDist(PA_STATE& pa, uint32_t 
primIndex, uint8_t clipDistMask,
 
 // setup plane equations for barycentric interpolation in the backend
 float baryCoeff[NumVerts];
+float last = vertClipDist[NumVerts - 1] * pRecipW[NumVerts - 1];
 for (uint32_t e = 0; e < NumVerts - 1; ++e)
 {
-baryCoeff[e] = vertClipDist[e] - vertClipDist[NumVerts - 1];
+baryCoeff[e] = vertClipDist[e] * pRecipW[e] - last;
 }
-baryCoeff[NumVerts - 1] = vertClipDist[NumVerts - 1];
+baryCoeff[NumVerts - 1] = last;
 
 for (uint32_t e = 0; e < NumVerts; ++e)
 {
@@ -834,7 +835,7 @@ endBinTriangles:
 {
 uint32_t numClipDist = _mm_popcnt_u32(rastState.clipDistanceMask);
 desc.pUserClipBuffer = (float*)pArena->Alloc(numClipDist * 3 * 
sizeof(float));
-ProcessUserClipDist<3>(pa, triIndex, rastState.clipDistanceMask, 
desc.pUserClipBuffer);
+ProcessUserClipDist<3>(pa, triIndex, rastState.clipDistanceMask, 
[12], desc.pUserClipBuffer);
 }
 
 for (uint32_t y = aMTTop[triIndex]; y <= aMTBottom[triIndex]; ++y)
@@ -1184,8 +1185,15 @@ void BinPoints(
 if (rastState.clipDistanceMask)
 {
 uint32_t numClipDist = 
_mm_popcnt_u32(rastState.clipDistanceMask);
-desc.pUserClipBuffer = (float*)pArena->Alloc(numClipDist * 2 * 
sizeof(float));
-ProcessUserClipDist<2>(pa, primIndex, 
rastState.clipDistanceMask, desc.pUserClipBuffer);
+desc.pUserClipBuffer = (float*)pArena->Alloc(numClipDist * 3 * 
sizeof(float));
+float dists[8];
+float one = 1.0f;
+ProcessUserClipDist<1>(pa, primIndex, 
rastState.clipDistanceMask, , dists);
+for (uint32_t i = 0; i < numClipDist; i++) {
+desc.pUserClipBuffer[3*i + 0] = 0.0f;
+desc.pUserClipBuffer[3*i + 1] = 0.0f;
+desc.pUserClipBuffer[3*i + 2] = dists[i];
+}
 }
 
 MacroTileMgr *pTileMgr = pDC->pTileMgr;
@@ -1396,7 +1404,7 @@ void BinPostSetupLines(
 {
 uint32_t numClipDist = _mm_popcnt_u32(rastState.clipDistanceMask);
 desc.pUserClipBuffer = (float*)pArena->Alloc(numClipDist * 2 * 
sizeof(float));
-ProcessUserClipDist<2>(pa, primIndex, rastState.clipDistanceMask, 
desc.pUserClipBuffer);
+ProcessUserClipDist<2>(pa, primIndex, rastState.clipDistanceMask, 
[12], desc.pUserClipBuffer);
 }
 
 MacroTileMgr *pTileMgr = pDC->pTileMgr;
-- 
2.7.3

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


[Mesa-dev] [PATCH 1/2] st/va: force to submit two consecutive single jobs

2016-11-24 Thread boyuan.zhang
From: Boyuan Zhang 

The gop_size in rate control is the budget window for internal rate
control calculation, and shouldn't always equal to idr period. Define
a coefficient to let budget window contains a number of idr period for
proper rate control calculation. Adjust the number of i/p frame remaining
accordingly.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=98005

Signed-off-by: Boyuan Zhang 
---
 src/gallium/state_trackers/va/picture.c| 24 +++-
 src/gallium/state_trackers/va/surface.c| 10 --
 src/gallium/state_trackers/va/va_private.h |  2 ++
 3 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/src/gallium/state_trackers/va/picture.c 
b/src/gallium/state_trackers/va/picture.c
index a8102a4..592cdef 100644
--- a/src/gallium/state_trackers/va/picture.c
+++ b/src/gallium/state_trackers/va/picture.c
@@ -413,7 +413,6 @@ handleVAEncPictureParameterBufferType(vlVaDriver *drv, 
vlVaContext *context, vlV
context->desc.h264enc.quant_i_frames = h264->pic_init_qp;
context->desc.h264enc.quant_b_frames = h264->pic_init_qp;
context->desc.h264enc.quant_p_frames = h264->pic_init_qp;
-   context->desc.h264enc.frame_num_cnt++;
context->desc.h264enc.gop_cnt++;
if (context->desc.h264enc.gop_cnt == context->desc.h264enc.gop_size)
   context->desc.h264enc.gop_cnt = 0;
@@ -569,18 +568,33 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID 
context_id)
if (context->decoder->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE) {
   coded_buf = context->coded_buf;
   getEncParamPreset(context);
+  context->desc.h264enc.frame_num_cnt++;
   context->decoder->begin_frame(context->decoder, context->target, 
>desc.base);
   context->decoder->encode_bitstream(context->decoder, context->target,
  coded_buf->derived_surface.resource, 
);
-  surf->frame_num_cnt = context->desc.h264enc.frame_num_cnt;
   surf->feedback = feedback;
   surf->coded_buf = coded_buf;
}
 
context->decoder->end_frame(context->decoder, context->target, 
>desc.base);
-   if (context->decoder->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE &&
-   context->desc.h264enc.p_remain == 1)
-  context->decoder->flush(context->decoder);
+   if (context->decoder->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE) {
+  surf->frame_num_cnt = context->desc.h264enc.frame_num_cnt;
+  surf->force_flushed = false;
+  if (context->first_single_submitted) {
+ context->decoder->flush(context->decoder);
+ context->first_single_submitted = false;
+ surf->force_flushed = true;
+  }
+  if (context->desc.h264enc.p_remain == 1) {
+ if ((context->desc.h264enc.frame_num_cnt % 2) != 0) {
+context->decoder->flush(context->decoder);
+context->first_single_submitted = true;
+ }
+ else
+context->first_single_submitted = false;
+ surf->force_flushed = true;
+  }
+   }
pipe_mutex_unlock(drv->mutex);
return VA_STATUS_SUCCESS;
 }
diff --git a/src/gallium/state_trackers/va/surface.c 
b/src/gallium/state_trackers/va/surface.c
index f8513d9..a7f3c35 100644
--- a/src/gallium/state_trackers/va/surface.c
+++ b/src/gallium/state_trackers/va/surface.c
@@ -125,12 +125,18 @@ vlVaSyncSurface(VADriverContextP ctx, VASurfaceID 
render_target)
 
if (context->decoder->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE) {
   int frame_diff;
-  if (context->desc.h264enc.frame_num_cnt > surf->frame_num_cnt)
+  if (context->desc.h264enc.frame_num_cnt >= surf->frame_num_cnt)
  frame_diff = context->desc.h264enc.frame_num_cnt - 
surf->frame_num_cnt;
   else
  frame_diff = 0x - surf->frame_num_cnt + 1 + 
context->desc.h264enc.frame_num_cnt;
-  if (frame_diff < 2)
+  if ((frame_diff == 0) &&
+  (surf->force_flushed == false) &&
+  (context->desc.h264enc.frame_num_cnt % 2 != 0)) {
  context->decoder->flush(context->decoder);
+ if (context->desc.h264enc.rate_ctrl.rate_ctrl_method !=
+PIPE_H264_ENC_RATE_CONTROL_METHOD_DISABLE)
+context->first_single_submitted = true;
+  }
   context->decoder->get_feedback(context->decoder, surf->feedback, 
&(surf->coded_buf->coded_size));
   surf->feedback = NULL;
}
diff --git a/src/gallium/state_trackers/va/va_private.h 
b/src/gallium/state_trackers/va/va_private.h
index c9a6a41..9e3ba03 100644
--- a/src/gallium/state_trackers/va/va_private.h
+++ b/src/gallium/state_trackers/va/va_private.h
@@ -244,6 +244,7 @@ typedef struct {
struct vl_deint_filter *deint;
struct vlVaBuffer *coded_buf;
int target_id;
+   bool first_single_submitted;
 } vlVaContext;
 
 typedef struct {
@@ -274,6 +275,7 @@ typedef struct {
vlVaBuffer *coded_buf;
void *feedback;
unsigned int frame_num_cnt;
+   bool force_flushed;
 } vlVaSurface;
 
 // Public functions:
-- 

[Mesa-dev] [Bug 98846] triangle clipping causes wrong vertex's attribute to be broadcasted for flat interpolation

2016-11-24 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=98846

Bug ID: 98846
   Summary: triangle clipping causes wrong vertex's attribute to
be broadcasted for flat interpolation
   Product: Mesa
   Version: git
  Hardware: Other
OS: All
Status: NEW
  Severity: normal
  Priority: medium
 Component: Drivers/Gallium/swr
  Assignee: mesa-dev@lists.freedesktop.org
  Reporter: imir...@alum.mit.edu
QA Contact: mesa-dev@lists.freedesktop.org

See example at
generated_tests/spec/glsl-1.10/execution/interpolation/interpolation-none-gl_FrontColor-flat-fixed.shader_test

This sets a position s.t. the clipping at +/-1 takes effect. And it works just
fine - the clipped result is correct. However the color output is green instead
of blue - the first vertex's color is broadcast to the new triangles rather
than the last vertex's color.

I traced through the code a bit, and it seems to *want* to do the right thing,
but for some reason doesn't. Smooth shading works fine in this clipping
scenario.

With user-provided clip planes (or distances), i.e. in where the clipping stage
does nothing, the color is picked correctly.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are the QA Contact for the bug.___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/2] st/va: fix gop size for rate control

2016-11-24 Thread boyuan.zhang
From: Boyuan Zhang 

The gop_size in rate control is the budget window for internal rate
control calculation, and shouldn't always equal to idr period. Define
a coefficient to let budget window contains a number of idr period for
proper rate control calculation. Adjust the number of i/p frame remaining
accordingly.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=98005

Signed-off-by: Boyuan Zhang 
---
 src/gallium/state_trackers/va/picture.c| 18 --
 src/gallium/state_trackers/va/va_private.h |  2 ++
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/src/gallium/state_trackers/va/picture.c 
b/src/gallium/state_trackers/va/picture.c
index 592cdef..b5b9a83 100644
--- a/src/gallium/state_trackers/va/picture.c
+++ b/src/gallium/state_trackers/va/picture.c
@@ -351,7 +351,11 @@ handleVAEncSequenceParameterBufferType(vlVaDriver *drv, 
vlVaContext *context, vl
   if (!context->decoder)
  return VA_STATUS_ERROR_ALLOCATION_FAILED;
}
-   context->desc.h264enc.gop_size = h264->intra_idr_period;
+
+   context->gop_coeff = ((1024 + h264->intra_idr_period - 1) / 
h264->intra_idr_period + 1) / 2 * 2;
+   if (context->gop_coeff > VL_VA_ENC_GOP_COEFF)
+  context->gop_coeff = VL_VA_ENC_GOP_COEFF;
+   context->desc.h264enc.gop_size = h264->intra_idr_period * 
context->gop_coeff;
context->desc.h264enc.rate_ctrl.frame_rate_num = h264->time_scale / 2;
context->desc.h264enc.rate_ctrl.frame_rate_den = 1;
return VA_STATUS_SUCCESS;
@@ -391,10 +395,10 @@ handleVAEncPictureParameterBufferType(vlVaDriver *drv, 
vlVaContext *context, vlV
context->desc.h264enc.not_referenced = false;
context->desc.h264enc.is_idr = (h264->pic_fields.bits.idr_pic_flag == 1);
context->desc.h264enc.pic_order_cnt = h264->CurrPic.TopFieldOrderCnt;
-   if (context->desc.h264enc.is_idr)
-  context->desc.h264enc.i_remain = 1;
-   else
-  context->desc.h264enc.i_remain = 0;
+   if (context->desc.h264enc.gop_cnt == 0)
+  context->desc.h264enc.i_remain = context->gop_coeff;
+   else if (context->desc.h264enc.frame_num == 1)
+  context->desc.h264enc.i_remain--;
 
context->desc.h264enc.p_remain = context->desc.h264enc.gop_size - 
context->desc.h264enc.gop_cnt - context->desc.h264enc.i_remain;
 
@@ -578,6 +582,8 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id)
 
context->decoder->end_frame(context->decoder, context->target, 
>desc.base);
if (context->decoder->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE) {
+  int idr_period = context->desc.h264enc.gop_size / context->gop_coeff;
+  int p_remain_in_idr = idr_period - context->desc.h264enc.frame_num;
   surf->frame_num_cnt = context->desc.h264enc.frame_num_cnt;
   surf->force_flushed = false;
   if (context->first_single_submitted) {
@@ -585,7 +591,7 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id)
  context->first_single_submitted = false;
  surf->force_flushed = true;
   }
-  if (context->desc.h264enc.p_remain == 1) {
+  if (p_remain_in_idr == 1) {
  if ((context->desc.h264enc.frame_num_cnt % 2) != 0) {
 context->decoder->flush(context->decoder);
 context->first_single_submitted = true;
diff --git a/src/gallium/state_trackers/va/va_private.h 
b/src/gallium/state_trackers/va/va_private.h
index 9e3ba03..900abbc 100644
--- a/src/gallium/state_trackers/va/va_private.h
+++ b/src/gallium/state_trackers/va/va_private.h
@@ -50,6 +50,7 @@
 #define VL_VA_PSCREEN(ctx) (VL_VA_DRIVER(ctx)->vscreen->pscreen)
 
 #define VL_VA_MAX_IMAGE_FORMATS 9
+#define VL_VA_ENC_GOP_COEFF 16
 
 static inline enum pipe_video_chroma_format
 ChromaToPipe(int format)
@@ -245,6 +246,7 @@ typedef struct {
struct vlVaBuffer *coded_buf;
int target_id;
bool first_single_submitted;
+   int gop_coeff;
 } vlVaContext;
 
 typedef struct {
-- 
2.7.4

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


Re: [Mesa-dev] [PATCH] gdi: Add GALLIUM_TRACE and GALLIUM_RBUG to gdi

2016-11-24 Thread Jose Fonseca

On 23/11/16 17:37, Emil Velikov wrote:

On 23 November 2016 at 16:14, George Kyriazis  wrote:

---
 src/gallium/targets/libgl-gdi/SConscript  | 1 +
 src/gallium/targets/libgl-gdi/libgl_gdi.c | 4 
 2 files changed, 5 insertions(+)

diff --git a/src/gallium/targets/libgl-gdi/SConscript 
b/src/gallium/targets/libgl-gdi/SConscript
index d3251ca..adb3581 100644
--- a/src/gallium/targets/libgl-gdi/SConscript
+++ b/src/gallium/targets/libgl-gdi/SConscript
@@ -41,6 +41,7 @@ if env['gcc'] and env['machine'] != 'x86_64':
 else:
 sources += ['#src/gallium/state_trackers/wgl/opengl32.def']

+env.Append(CPPDEFINES = ['GALLIUM_TRACE', 'GALLIUM_RBUG'])
 drivers += [trace, rbug]

 env['no_import_lib'] = 1
diff --git a/src/gallium/targets/libgl-gdi/libgl_gdi.c 
b/src/gallium/targets/libgl-gdi/libgl_gdi.c
index 12576db..4b0819f 100644
--- a/src/gallium/targets/libgl-gdi/libgl_gdi.c
+++ b/src/gallium/targets/libgl-gdi/libgl_gdi.c
@@ -55,6 +55,8 @@
 #include "swr/swr_public.h"
 #endif

+#include "target-helpers/inline_debug_helper.h"
+
 static boolean use_llvmpipe = FALSE;
 static boolean use_swr = FALSE;

@@ -100,6 +102,8 @@ gdi_screen_create(void)
   screen = softpipe_create_screen( winsys );
}

+   screen = debug_screen_wrap(screen);
+

Heh, nice one. Considering the nice comment in gdi_sw_display() did
you test this on llvmpipe/softpipe ?

At the same time, we can simplify a lot of stuff here:
 - replace the explicit driver specific winsys retrieval +
gdi_sw_display() calls with pipe_screen::flush_frontbuffer() as
mentioned in the gdi_sw_display() comment.
The pipe_screen callback does effectively the same thing for softpipe/llvmpipe.
 - drop the use_* variables and use inline_sw_helper.h
sw_screen_create() instead of open-coding it.

Jose, does this sounds about right ? Did you guys intentionally
(considering the comment?) _not_ use the trace/rbug drivers, despite
that one links against them ?


Right.  We'd need some way to traverse the layers (doable but brittle). 
Or move all needed functionality to gallium interfaces, and kill the 
off-the-side communication channel (doable and realible, but complex.)


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


Re: [Mesa-dev] [PATCH 2/3] radv: Make radv_finishme only warn once per call-site

2016-11-24 Thread Bas Nieuwenhuizen
Making this thread safe is probably overkill I guess?

Reviewed-by: Bas Nieuwenhuizen 

On Thu, Nov 24, 2016 at 7:18 PM, Emil Velikov  wrote:
> From: Emil Velikov 
>
> Signed-off-by: Emil Velikov 
> ---
>  src/amd/vulkan/radv_private.h | 8 +++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
> index a5d13a9..def0af2 100644
> --- a/src/amd/vulkan/radv_private.h
> +++ b/src/amd/vulkan/radv_private.h
> @@ -211,7 +211,13 @@ void radv_loge_v(const char *format, va_list va);
>   * Print a FINISHME message, including its source location.
>   */
>  #define radv_finishme(format, ...) \
> -   __radv_finishme(__FILE__, __LINE__, format, ##__VA_ARGS__);
> +   do { \
> +   static bool reported = false; \
> +   if (!reported) { \
> +   __radv_finishme(__FILE__, __LINE__, format, 
> ##__VA_ARGS__); \
> +   reported = true; \
> +   } \
> +   } while (0)
>
>  /* A non-fatal assert.  Useful for debugging. */
>  #ifdef DEBUG
> --
> 2.10.2
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Mesa 13.0.2 release candidate

2016-11-24 Thread Eduardo Lima Mitev
On 11/24/2016 06:25 PM, Emil Velikov wrote:
> Hello list,
> 
> The candidate for the Mesa 13.0.2 is now available. Currently we have:
>  - 49 queued
>  - 4 nominated (outstanding)
>  - and 1 rejected patch(es)
> 
> 
> With this series we have - fixes for vc4, i965 and radeon drivers. In addition
> to that PCI IDs for Geminilake have been added to the i965 driver,
> 
> The respective Vulkan drivers have seen multiple improvements some of which
> include improved smoketesting and addressed memory leaks.
> 
> Races during _mesa_HashWalk() (while using glDeleteFramebuffers alongside
> glTexImage2D) and "#version 0" in GLSL programs have been addressed.
> 
> BSD and Hurd users should be above to build the latest code as we no longer
> use PATH_MAX.
> 
> 
> Take a look at section "Mesa stable queue" for more information.
> 
> 
> Testing reports/general approval
> 
> Any testing reports (or general approval of the state of the branch) will be
> greatly appreciated.
> 
> The plan is to have 13.0.2 this Saturday (25th of November), around or
> shortly after 17:00 GMT.
> 
> If you have any questions or suggestions - be that about the current patch
> queue or otherwise, please go ahead.
> 
> 
> Trivial merge conflicts
> ---
> commit 9d5c3fc12b05d944508ef4e3b1f2ddc4f23c0a82
> Author: Jason Ekstrand 
> 
> i965/gs: Allow primitive id to be a system value
> 
> (cherry picked from commit a5e88e66e633aaeb587b274d80e21cd46c8ee2cb)
> 
> 
> commit 8dbdbc21910a6d37c381535186f9e728fff8690d
> Author: Jason Ekstrand 
> 
> anv: Handle null in all destructors
> 
> (cherry picked from commit 49f08ad77f51cc344e4bfe60ba9f8d9fccfbd753)
> 
> 
> commit 1809f17bda56d4f9d6385f63a9c4a5df890e3cad
> Author: Kenneth Graunke 
> 
> mesa: Drop PATH_MAX usage.
> 
> (cherry picked from commit 9bfee7047b70cb0aa026ca9536465762f96cb2b1)
> 
> Cheers,
> Emil
> 
> 
> Mesa stable queue
> -
> 
> Nominated (4)
> =
> 
> Dave Airlie (1):
>   2de85eb radv: fix texturesamples to handle single sample case
> 
> Jason Ekstrand (2):
>   e73d136 vulkan/wsi/x11: Implement FIFO mode.
> 
> Note: temporary on hold.
> Commit seems to be a feature and provides no clear indication about the bugs
> it addresses. Jason, is this really applicable for stable ?
> 
>   054e48e anv/cmd_buffer: Re-emit MEDIA_CURBE_LOAD when CS push
> constants are dirty
> 
> Note: temporary on hold.
> Depends on the refactoring d33e2ad67c3 (anv: Move INTERFACE_DESCRIPTOR_DATA
> setup to the pipeline) which in itself depends on another refactoring 
> (cleanup)
> commit 623e1e06d8c and likely others. Jason, any input ?
> 
> Kevin Strasser (1):
>   932bb3f vulkan/wsi: Add a thread-safe queue implementation
> Requirement for "Implement FIFO mode above" above.
> 
> 
> Queued (49)
> ===
> 
> Ben Widawsky (3):
>   i965: Add some APL and KBL SKU strings
>   i965: Reorder PCI ID list to match release order
>   i965/glk: Add basic Geminilake support
> 
> Dave Airlie (7):
>   radv: fix texturesamples to handle single sample case
>   wsi: fix VK_INCOMPLETE for vkGetSwapchainImagesKHR
>   radv: don't crash on null swapchain destroy.
>   ac/nir/llvm: fix channel in texture gather lowering code.
>   radv: make sure to flush input attachments correctly.
>   radv: fix image view creation for depth and stencil only
>   radv: spir-v allows texture size query with and without lod.
> 
> Eduardo Lima Mitev (2):
>   vulkan/wsi/x11: Fix behavior of vkGetPhysicalDeviceSurfaceFormatsKHR
>   vulkan/wsi/x11: Fix behavior of 
> vkGetPhysicalDeviceSurfacePresentModesKHR
> 
> Eduardo, I've picked these two since they are perfectly reasonable
> stable material.
> Let me know if you think that we should keep or drop them.
> 

Hi Emil,

I also think these are good candidates for stable.

Thanks a lot for managing this!

cheers,
Eduardo

> Emil Velikov (3):
>   docs: add sha256 checksums for 13.0.1
>   cherry-ignore: add reverted LLVM_LIBDIR patch
>   anv: fix enumeration of properties
> 
> Eric Anholt (3):
>   vc4: Don't abort when a shader compile fails.
>   vc4: Clamp the shadow comparison value.
>   vc4: Fix register class handling of DDX/DDY arguments.
> 
> Gwan-gyeong Mun (2):
>   util/disk_cache: close a previously opened handle in disk_cache_put (v2)
>   anv: Fix unintentional integer overflow in anv_CreateDmaBufImageINTEL
> 
> Iago Toral Quiroga (1):
>   anv/format: handle unsupported formats properly
> 
> Ian Romanick (2):
>   glcpp: Handle '#version 0' and other invalid values
>   glsl: Parse 0 as a preprocessor INTCONSTANT
> 
> Jason Ekstrand (14):
>   anv/gen8: Stall when needed in Cmd(Set|Reset)Event
>   anv/wsi: Set the fence to signaled in AcquireNextImageKHR
>   anv: Rework fences
>   vulkan/wsi/wayland: 

Re: [Mesa-dev] [PATCH 3/3] isl: Make radv_finishme only warn once per call-site

2016-11-24 Thread Bas Nieuwenhuizen
You might want to rename the title of this patch.

- Bas

On Thu, Nov 24, 2016 at 7:18 PM, Emil Velikov  wrote:
> From: Emil Velikov 
>
> Signed-off-by: Emil Velikov 
> ---
>  src/intel/isl/isl_priv.h | 8 +++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/src/intel/isl/isl_priv.h b/src/intel/isl/isl_priv.h
> index dc3975d..1867d25 100644
> --- a/src/intel/isl/isl_priv.h
> +++ b/src/intel/isl/isl_priv.h
> @@ -33,7 +33,13 @@
>  #include "isl.h"
>
>  #define isl_finishme(format, ...) \
> -   __isl_finishme(__FILE__, __LINE__, format, ##__VA_ARGS__)
> +   do { \
> +  static bool reported = false; \
> +  if (!reported) { \
> + __isl_finishme(__FILE__, __LINE__, format, ##__VA_ARGS__); \
> + reported = true; \
> +  } \
> +   } while (0)
>
>  void PRINTFLIKE(3, 4) UNUSED
>  __isl_finishme(const char *file, int line, const char *fmt, ...);
> --
> 2.10.2
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] radv: honour the number of properties available

2016-11-24 Thread Bas Nieuwenhuizen
Reviewed-by: Bas Nieuwenhuizen 

On Thu, Nov 24, 2016 at 7:14 PM, Emil Velikov  wrote:
> From: Emil Velikov 
>
> Cap up-to the number of properties available while copying the data.
> Otherwise we might crash and/or leak data.
>
> Cc: Dave Airlie 
> Cc: "13.0" 
> Signed-off-by: Emil Velikov 
> ---
>  src/amd/vulkan/radv_device.c | 18 +++---
>  1 file changed, 7 insertions(+), 11 deletions(-)
>
> diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
> index 390fde0..e6e5c37 100644
> --- a/src/amd/vulkan/radv_device.c
> +++ b/src/amd/vulkan/radv_device.c
> @@ -669,17 +669,15 @@ VkResult radv_EnumerateInstanceExtensionProperties(
> uint32_t*   pPropertyCount,
> VkExtensionProperties*  pProperties)
>  {
> -   unsigned i;
> if (pProperties == NULL) {
> *pPropertyCount = ARRAY_SIZE(global_extensions);
> return VK_SUCCESS;
> }
>
> -   for (i = 0; i < *pPropertyCount; i++)
> -   memcpy([i], _extensions[i], 
> sizeof(VkExtensionProperties));
> +   *pPropertyCount = MIN2(*pPropertyCount, 
> ARRAY_SIZE(global_extensions));
> +   typed_memcpy(pProperties, global_extensions, *pPropertyCount);
>
> -   *pPropertyCount = i;
> -   if (i < ARRAY_SIZE(global_extensions))
> +   if (*pPropertyCount < ARRAY_SIZE(global_extensions))
> return VK_INCOMPLETE;
>
> return VK_SUCCESS;
> @@ -691,19 +689,17 @@ VkResult radv_EnumerateDeviceExtensionProperties(
> uint32_t*   pPropertyCount,
> VkExtensionProperties*  pProperties)
>  {
> -   unsigned i;
> -
> if (pProperties == NULL) {
> *pPropertyCount = ARRAY_SIZE(device_extensions);
> return VK_SUCCESS;
> }
>
> -   for (i = 0; i < *pPropertyCount; i++)
> -   memcpy([i], _extensions[i], 
> sizeof(VkExtensionProperties));
> +   *pPropertyCount = MIN2(*pPropertyCount, 
> ARRAY_SIZE(device_extensions));
> +   typed_memcpy(pProperties, device_extensions, *pPropertyCount);
>
> -   *pPropertyCount = i;
> -   if (i < ARRAY_SIZE(device_extensions))
> +   if (*pPropertyCount < ARRAY_SIZE(device_extensions))
> return VK_INCOMPLETE;
> +
> return VK_SUCCESS;
>  }
>
> --
> 2.10.2
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [v3 11/17] i965: Track fast color clear state in level/layer granularity

2016-11-24 Thread Pohjolainen, Topi
On Thu, Nov 24, 2016 at 10:01:51AM -0800, Jason Ekstrand wrote:
>On Nov 24, 2016 6:06 AM, "Topi Pohjolainen"
><[1]topi.pohjolai...@gmail.com> wrote:
>>
>> Note that RESOLVED is not tracked in the map explicitly. Absence
>> of item implicitly means RESOLVED state.
>>
>> v2: Added intel_resolve_map_clear() into intel_miptree_release()
>> v3 (Jason): Properly handle the assumption of resolve map not
>> containing any items with state RESOLVED. Removed
>> unnecessary intel_miptree_set_fast_clear_state() call
>> in brw_blorp_resolve_color() preventing
>> intel_miptree_set_fast_clear_state() from asserting
>> against RESOLVED.
>>
>> Signed-off-by: Topi Pohjolainen <[2]topi.pohjolai...@intel.com>
>> Reviewed-by: Jason Ekstrand <[3]ja...@jlekstrand.net> (v1)
>> ---
>>  src/mesa/drivers/dri/i965/brw_blorp.c |  3 -
>>  src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 79
>---
>>  src/mesa/drivers/dri/i965/intel_mipmap_tree.h | 16 +++---
>>  3 files changed, 68 insertions(+), 30 deletions(-)
>>
>> diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c
>b/src/mesa/drivers/dri/i965/brw_blorp.c
>> index 67f4cce..d900e15 100644
>> --- a/src/mesa/drivers/dri/i965/brw_blorp.c
>> +++ b/src/mesa/drivers/dri/i965/brw_blorp.c
>> @@ -969,9 +969,6 @@ brw_blorp_resolve_color(struct brw_context *brw,
>struct intel_mipmap_tree *mt,
>>   brw_blorp_to_isl_format(brw, format, true),
>>   resolve_op);
>> blorp_batch_finish();
>> -
>> -   intel_miptree_set_fast_clear_state(mt, level, layer, 1,
>> -
>INTEL_FAST_CLEAR_STATE_RESOLVED);
>>  }
>>
>>  static void
>> diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
>b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
>> index a5913bc..d629901 100644
>> --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
>> +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
>> @@ -397,11 +397,11 @@ intel_miptree_create_layout(struct brw_context
>*brw,
>> mt->logical_width0 = width0;
>> mt->logical_height0 = height0;
>> mt->logical_depth0 = depth0;
>> -   mt->fast_clear_state = INTEL_FAST_CLEAR_STATE_RESOLVED;
>> mt->disable_aux_buffers = (layout_flags &
>MIPTREE_LAYOUT_DISABLE_AUX) != 0;
>> mt->no_ccs = true;
>> mt->is_scanout = (layout_flags & MIPTREE_LAYOUT_FOR_SCANOUT) !=
>0;
>> exec_list_make_empty(>hiz_map);
>> +   exec_list_make_empty(>color_resolve_map);
>> mt->cpp = _mesa_get_format_bytes(format);
>> mt->num_samples = num_samples;
>> mt->compressed = _mesa_is_format_compressed(format);
>> @@ -933,7 +933,7 @@ intel_update_winsys_renderbuffer_miptree(struct
>brw_context *intel,
>>  */
>> if (intel_tiling_supports_non_msrt_mcs(intel,
>singlesample_mt->tiling) &&
>> intel_miptree_supports_non_msrt_fast_clear(intel,
>singlesample_mt)) {
>> -  singlesample_mt->fast_clear_state =
>INTEL_FAST_CLEAR_STATE_RESOLVED;
>> +  singlesample_mt->no_ccs = false;
>> }
>>
>> if (num_samples == 0) {
>> @@ -1048,6 +1048,7 @@ intel_miptree_release(struct intel_mipmap_tree
>**mt)
>>   free((*mt)->mcs_buf);
>>}
>>intel_resolve_map_clear(&(*mt)->hiz_map);
>> +  intel_resolve_map_clear(&(*mt)->color_resolve_map);
>>
>>intel_miptree_release(&(*mt)->plane[0]);
>>intel_miptree_release(&(*mt)->plane[1]);
>> @@ -1633,7 +1634,12 @@ intel_miptree_alloc_mcs(struct brw_context
>*brw,
>>return false;
>>
>> intel_miptree_init_mcs(brw, mt, 0xFF);
>> -   mt->fast_clear_state = INTEL_FAST_CLEAR_STATE_CLEAR;
>> +
>> +   /* Multisampled miptrees are only supported for single level. */
>> +   assert(mt->first_level == 0);
>> +   intel_miptree_set_fast_clear_state(mt, mt->first_level, 0,
>> +  mt->logical_depth0,
>> +  INTEL_FAST_CLEAR_STATE_CLEAR);
>>
>> return true;
>>  }
>> @@ -1713,7 +1719,6 @@ intel_miptree_alloc_non_msrt_mcs(struct
>brw_context *brw,
>> *Software needs to initialize MCS with zeros."
>> */
>>intel_miptree_init_mcs(brw, mt, 0);
>> -  mt->fast_clear_state = INTEL_FAST_CLEAR_STATE_RESOLVED;
>>mt->msaa_layout = INTEL_MSAA_LAYOUT_CMS;
>> }
>>
>> @@ -2209,7 +2214,15 @@ enum intel_fast_clear_state
>>  intel_miptree_get_fast_clear_state(const struct intel_mipmap_tree
>*mt,
>> unsigned level, unsigned layer)
>>  {
>> -   return mt->fast_clear_state;
>> +   

[Mesa-dev] [PATCH 2/3] radv: Make radv_finishme only warn once per call-site

2016-11-24 Thread Emil Velikov
From: Emil Velikov 

Signed-off-by: Emil Velikov 
---
 src/amd/vulkan/radv_private.h | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
index a5d13a9..def0af2 100644
--- a/src/amd/vulkan/radv_private.h
+++ b/src/amd/vulkan/radv_private.h
@@ -211,7 +211,13 @@ void radv_loge_v(const char *format, va_list va);
  * Print a FINISHME message, including its source location.
  */
 #define radv_finishme(format, ...) \
-   __radv_finishme(__FILE__, __LINE__, format, ##__VA_ARGS__);
+   do { \
+   static bool reported = false; \
+   if (!reported) { \
+   __radv_finishme(__FILE__, __LINE__, format, 
##__VA_ARGS__); \
+   reported = true; \
+   } \
+   } while (0)
 
 /* A non-fatal assert.  Useful for debugging. */
 #ifdef DEBUG
-- 
2.10.2

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


[Mesa-dev] [PATCH 1/3] anv: use do { } while (0) in the anv_finishme macro

2016-11-24 Thread Emil Velikov
From: Emil Velikov 

Use the generic construct instead of the currect GCC specific one.

Cc: Kenneth Graunke 
Suggested-by: Kenneth Graunke 
Signed-off-by: Emil Velikov 
---
 src/intel/vulkan/anv_private.h | 15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index 2fc543d..edc008d 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -207,13 +207,14 @@ void anv_loge_v(const char *format, va_list va);
 /**
  * Print a FINISHME message, including its source location.
  */
-#define anv_finishme(format, ...) ({ \
-   static bool reported = false; \
-   if (!reported) { \
-  __anv_finishme(__FILE__, __LINE__, format, ##__VA_ARGS__); \
-  reported = true; \
-   } \
-})
+#define anv_finishme(format, ...) \
+   do { \
+  static bool reported = false; \
+  if (!reported) { \
+ __anv_finishme(__FILE__, __LINE__, format, ##__VA_ARGS__); \
+ reported = true; \
+  } \
+   } while (0)
 
 /* A non-fatal assert.  Useful for debugging. */
 #ifdef DEBUG
-- 
2.10.2

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


[Mesa-dev] [PATCH 3/3] isl: Make radv_finishme only warn once per call-site

2016-11-24 Thread Emil Velikov
From: Emil Velikov 

Signed-off-by: Emil Velikov 
---
 src/intel/isl/isl_priv.h | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/intel/isl/isl_priv.h b/src/intel/isl/isl_priv.h
index dc3975d..1867d25 100644
--- a/src/intel/isl/isl_priv.h
+++ b/src/intel/isl/isl_priv.h
@@ -33,7 +33,13 @@
 #include "isl.h"
 
 #define isl_finishme(format, ...) \
-   __isl_finishme(__FILE__, __LINE__, format, ##__VA_ARGS__)
+   do { \
+  static bool reported = false; \
+  if (!reported) { \
+ __isl_finishme(__FILE__, __LINE__, format, ##__VA_ARGS__); \
+ reported = true; \
+  } \
+   } while (0)
 
 void PRINTFLIKE(3, 4) UNUSED
 __isl_finishme(const char *file, int line, const char *fmt, ...);
-- 
2.10.2

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


[Mesa-dev] [PATCH] radv: honour the number of properties available

2016-11-24 Thread Emil Velikov
From: Emil Velikov 

Cap up-to the number of properties available while copying the data.
Otherwise we might crash and/or leak data.

Cc: Dave Airlie 
Cc: "13.0" 
Signed-off-by: Emil Velikov 
---
 src/amd/vulkan/radv_device.c | 18 +++---
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 390fde0..e6e5c37 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -669,17 +669,15 @@ VkResult radv_EnumerateInstanceExtensionProperties(
uint32_t*   pPropertyCount,
VkExtensionProperties*  pProperties)
 {
-   unsigned i;
if (pProperties == NULL) {
*pPropertyCount = ARRAY_SIZE(global_extensions);
return VK_SUCCESS;
}
 
-   for (i = 0; i < *pPropertyCount; i++)
-   memcpy([i], _extensions[i], 
sizeof(VkExtensionProperties));
+   *pPropertyCount = MIN2(*pPropertyCount, ARRAY_SIZE(global_extensions));
+   typed_memcpy(pProperties, global_extensions, *pPropertyCount);
 
-   *pPropertyCount = i;
-   if (i < ARRAY_SIZE(global_extensions))
+   if (*pPropertyCount < ARRAY_SIZE(global_extensions))
return VK_INCOMPLETE;
 
return VK_SUCCESS;
@@ -691,19 +689,17 @@ VkResult radv_EnumerateDeviceExtensionProperties(
uint32_t*   pPropertyCount,
VkExtensionProperties*  pProperties)
 {
-   unsigned i;
-
if (pProperties == NULL) {
*pPropertyCount = ARRAY_SIZE(device_extensions);
return VK_SUCCESS;
}
 
-   for (i = 0; i < *pPropertyCount; i++)
-   memcpy([i], _extensions[i], 
sizeof(VkExtensionProperties));
+   *pPropertyCount = MIN2(*pPropertyCount, ARRAY_SIZE(device_extensions));
+   typed_memcpy(pProperties, device_extensions, *pPropertyCount);
 
-   *pPropertyCount = i;
-   if (i < ARRAY_SIZE(device_extensions))
+   if (*pPropertyCount < ARRAY_SIZE(device_extensions))
return VK_INCOMPLETE;
+
return VK_SUCCESS;
 }
 
-- 
2.10.2

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


Re: [Mesa-dev] Mesa 13.0.2 release candidate

2016-11-24 Thread Emil Velikov
On 24 November 2016 at 18:09, Gustaw Smolarczyk  wrote:
> 2016-11-24 18:25 GMT+01:00 Emil Velikov :

>> The plan is to have 13.0.2 this Saturday (25th of November), around or
>
> Saturday is 26th of November.
>

That's correct. Thank you.
Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Mesa 13.0.2 release candidate

2016-11-24 Thread Gustaw Smolarczyk
2016-11-24 18:25 GMT+01:00 Emil Velikov :

> Hello list,
>
> The candidate for the Mesa 13.0.2 is now available. Currently we have:
>  - 49 queued
>  - 4 nominated (outstanding)
>  - and 1 rejected patch(es)
>
>
> With this series we have - fixes for vc4, i965 and radeon drivers. In
> addition
> to that PCI IDs for Geminilake have been added to the i965 driver,
>
> The respective Vulkan drivers have seen multiple improvements some of which
> include improved smoketesting and addressed memory leaks.
>
> Races during _mesa_HashWalk() (while using glDeleteFramebuffers alongside
> glTexImage2D) and "#version 0" in GLSL programs have been addressed.
>
> BSD and Hurd users should be above to build the latest code as we no longer
> use PATH_MAX.
>
>
> Take a look at section "Mesa stable queue" for more information.
>
>
> Testing reports/general approval
> 
> Any testing reports (or general approval of the state of the branch) will
> be
> greatly appreciated.
>
> The plan is to have 13.0.2 this Saturday (25th of November), around or
>

Saturday is 26th of November.

Regards,
Gustaw


> shortly after 17:00 GMT.
>
> If you have any questions or suggestions - be that about the current patch
> queue or otherwise, please go ahead.
>
>
> Trivial merge conflicts
> ---
> commit 9d5c3fc12b05d944508ef4e3b1f2ddc4f23c0a82
> Author: Jason Ekstrand 
>
> i965/gs: Allow primitive id to be a system value
>
> (cherry picked from commit a5e88e66e633aaeb587b274d80e21cd46c8ee2cb)
>
>
> commit 8dbdbc21910a6d37c381535186f9e728fff8690d
> Author: Jason Ekstrand 
>
> anv: Handle null in all destructors
>
> (cherry picked from commit 49f08ad77f51cc344e4bfe60ba9f8d9fccfbd753)
>
>
> commit 1809f17bda56d4f9d6385f63a9c4a5df890e3cad
> Author: Kenneth Graunke 
>
> mesa: Drop PATH_MAX usage.
>
> (cherry picked from commit 9bfee7047b70cb0aa026ca9536465762f96cb2b1)
>
> Cheers,
> Emil
>
>
> Mesa stable queue
> -
>
> Nominated (4)
> =
>
> Dave Airlie (1):
>   2de85eb radv: fix texturesamples to handle single sample case
>
> Jason Ekstrand (2):
>   e73d136 vulkan/wsi/x11: Implement FIFO mode.
>
> Note: temporary on hold.
> Commit seems to be a feature and provides no clear indication about the
> bugs
> it addresses. Jason, is this really applicable for stable ?
>
>   054e48e anv/cmd_buffer: Re-emit MEDIA_CURBE_LOAD when CS push
> constants are dirty
>
> Note: temporary on hold.
> Depends on the refactoring d33e2ad67c3 (anv: Move INTERFACE_DESCRIPTOR_DATA
> setup to the pipeline) which in itself depends on another refactoring
> (cleanup)
> commit 623e1e06d8c and likely others. Jason, any input ?
>
> Kevin Strasser (1):
>   932bb3f vulkan/wsi: Add a thread-safe queue implementation
> Requirement for "Implement FIFO mode above" above.
>
>
> Queued (49)
> ===
>
> Ben Widawsky (3):
>   i965: Add some APL and KBL SKU strings
>   i965: Reorder PCI ID list to match release order
>   i965/glk: Add basic Geminilake support
>
> Dave Airlie (7):
>   radv: fix texturesamples to handle single sample case
>   wsi: fix VK_INCOMPLETE for vkGetSwapchainImagesKHR
>   radv: don't crash on null swapchain destroy.
>   ac/nir/llvm: fix channel in texture gather lowering code.
>   radv: make sure to flush input attachments correctly.
>   radv: fix image view creation for depth and stencil only
>   radv: spir-v allows texture size query with and without lod.
>
> Eduardo Lima Mitev (2):
>   vulkan/wsi/x11: Fix behavior of vkGetPhysicalDeviceSurfaceFormatsKHR
>   vulkan/wsi/x11: Fix behavior of vkGetPhysicalDeviceSurfacePres
> entModesKHR
>
> Eduardo, I've picked these two since they are perfectly reasonable
> stable material.
> Let me know if you think that we should keep or drop them.
>
> Emil Velikov (3):
>   docs: add sha256 checksums for 13.0.1
>   cherry-ignore: add reverted LLVM_LIBDIR patch
>   anv: fix enumeration of properties
>
> Eric Anholt (3):
>   vc4: Don't abort when a shader compile fails.
>   vc4: Clamp the shadow comparison value.
>   vc4: Fix register class handling of DDX/DDY arguments.
>
> Gwan-gyeong Mun (2):
>   util/disk_cache: close a previously opened handle in disk_cache_put
> (v2)
>   anv: Fix unintentional integer overflow in anv_CreateDmaBufImageINTEL
>
> Iago Toral Quiroga (1):
>   anv/format: handle unsupported formats properly
>
> Ian Romanick (2):
>   glcpp: Handle '#version 0' and other invalid values
>   glsl: Parse 0 as a preprocessor INTCONSTANT
>
> Jason Ekstrand (14):
>   anv/gen8: Stall when needed in Cmd(Set|Reset)Event
>   anv/wsi: Set the fence to signaled in AcquireNextImageKHR
>   anv: Rework fences
>   vulkan/wsi/wayland: Include pthread.h
>   vulkan/wsi/wayland: Clean up some error handling 

Re: [Mesa-dev] [v3 11/17] i965: Track fast color clear state in level/layer granularity

2016-11-24 Thread Jason Ekstrand
On Nov 24, 2016 6:06 AM, "Topi Pohjolainen" 
wrote:
>
> Note that RESOLVED is not tracked in the map explicitly. Absence
> of item implicitly means RESOLVED state.
>
> v2: Added intel_resolve_map_clear() into intel_miptree_release()
> v3 (Jason): Properly handle the assumption of resolve map not
> containing any items with state RESOLVED. Removed
> unnecessary intel_miptree_set_fast_clear_state() call
> in brw_blorp_resolve_color() preventing
> intel_miptree_set_fast_clear_state() from asserting
> against RESOLVED.
>
> Signed-off-by: Topi Pohjolainen 
> Reviewed-by: Jason Ekstrand  (v1)
> ---
>  src/mesa/drivers/dri/i965/brw_blorp.c |  3 -
>  src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 79
---
>  src/mesa/drivers/dri/i965/intel_mipmap_tree.h | 16 +++---
>  3 files changed, 68 insertions(+), 30 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c
b/src/mesa/drivers/dri/i965/brw_blorp.c
> index 67f4cce..d900e15 100644
> --- a/src/mesa/drivers/dri/i965/brw_blorp.c
> +++ b/src/mesa/drivers/dri/i965/brw_blorp.c
> @@ -969,9 +969,6 @@ brw_blorp_resolve_color(struct brw_context *brw,
struct intel_mipmap_tree *mt,
>   brw_blorp_to_isl_format(brw, format, true),
>   resolve_op);
> blorp_batch_finish();
> -
> -   intel_miptree_set_fast_clear_state(mt, level, layer, 1,
> -  INTEL_FAST_CLEAR_STATE_RESOLVED);
>  }
>
>  static void
> diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> index a5913bc..d629901 100644
> --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> @@ -397,11 +397,11 @@ intel_miptree_create_layout(struct brw_context *brw,
> mt->logical_width0 = width0;
> mt->logical_height0 = height0;
> mt->logical_depth0 = depth0;
> -   mt->fast_clear_state = INTEL_FAST_CLEAR_STATE_RESOLVED;
> mt->disable_aux_buffers = (layout_flags & MIPTREE_LAYOUT_DISABLE_AUX)
!= 0;
> mt->no_ccs = true;
> mt->is_scanout = (layout_flags & MIPTREE_LAYOUT_FOR_SCANOUT) != 0;
> exec_list_make_empty(>hiz_map);
> +   exec_list_make_empty(>color_resolve_map);
> mt->cpp = _mesa_get_format_bytes(format);
> mt->num_samples = num_samples;
> mt->compressed = _mesa_is_format_compressed(format);
> @@ -933,7 +933,7 @@ intel_update_winsys_renderbuffer_miptree(struct
brw_context *intel,
>  */
> if (intel_tiling_supports_non_msrt_mcs(intel,
singlesample_mt->tiling) &&
> intel_miptree_supports_non_msrt_fast_clear(intel,
singlesample_mt)) {
> -  singlesample_mt->fast_clear_state =
INTEL_FAST_CLEAR_STATE_RESOLVED;
> +  singlesample_mt->no_ccs = false;
> }
>
> if (num_samples == 0) {
> @@ -1048,6 +1048,7 @@ intel_miptree_release(struct intel_mipmap_tree **mt)
>   free((*mt)->mcs_buf);
>}
>intel_resolve_map_clear(&(*mt)->hiz_map);
> +  intel_resolve_map_clear(&(*mt)->color_resolve_map);
>
>intel_miptree_release(&(*mt)->plane[0]);
>intel_miptree_release(&(*mt)->plane[1]);
> @@ -1633,7 +1634,12 @@ intel_miptree_alloc_mcs(struct brw_context *brw,
>return false;
>
> intel_miptree_init_mcs(brw, mt, 0xFF);
> -   mt->fast_clear_state = INTEL_FAST_CLEAR_STATE_CLEAR;
> +
> +   /* Multisampled miptrees are only supported for single level. */
> +   assert(mt->first_level == 0);
> +   intel_miptree_set_fast_clear_state(mt, mt->first_level, 0,
> +  mt->logical_depth0,
> +  INTEL_FAST_CLEAR_STATE_CLEAR);
>
> return true;
>  }
> @@ -1713,7 +1719,6 @@ intel_miptree_alloc_non_msrt_mcs(struct brw_context
*brw,
> *Software needs to initialize MCS with zeros."
> */
>intel_miptree_init_mcs(brw, mt, 0);
> -  mt->fast_clear_state = INTEL_FAST_CLEAR_STATE_RESOLVED;
>mt->msaa_layout = INTEL_MSAA_LAYOUT_CMS;
> }
>
> @@ -2209,7 +2214,15 @@ enum intel_fast_clear_state
>  intel_miptree_get_fast_clear_state(const struct intel_mipmap_tree *mt,
> unsigned level, unsigned layer)
>  {
> -   return mt->fast_clear_state;
> +   intel_miptree_check_level_layer(mt, level, layer);
> +
> +   const struct intel_resolve_map *item =
> +  intel_resolve_map_const_get(>color_resolve_map, level, layer);
> +
> +   if (!item)
> +  return INTEL_FAST_CLEAR_STATE_RESOLVED;
> +
> +   return item->fast_clear_state;
>  }
>
>  static void
> @@ -2240,11 +2253,18 @@ intel_miptree_set_fast_clear_state(struct
intel_mipmap_tree *mt,
> unsigned num_layers,
> enum intel_fast_clear_state new_state)
>  {
> +   /* Setting the state to resolved means removing the item from the list
> +* 

[Mesa-dev] Mesa 13.0.2 release candidate

2016-11-24 Thread Emil Velikov
Hello list,

The candidate for the Mesa 13.0.2 is now available. Currently we have:
 - 49 queued
 - 4 nominated (outstanding)
 - and 1 rejected patch(es)


With this series we have - fixes for vc4, i965 and radeon drivers. In addition
to that PCI IDs for Geminilake have been added to the i965 driver,

The respective Vulkan drivers have seen multiple improvements some of which
include improved smoketesting and addressed memory leaks.

Races during _mesa_HashWalk() (while using glDeleteFramebuffers alongside
glTexImage2D) and "#version 0" in GLSL programs have been addressed.

BSD and Hurd users should be above to build the latest code as we no longer
use PATH_MAX.


Take a look at section "Mesa stable queue" for more information.


Testing reports/general approval

Any testing reports (or general approval of the state of the branch) will be
greatly appreciated.

The plan is to have 13.0.2 this Saturday (25th of November), around or
shortly after 17:00 GMT.

If you have any questions or suggestions - be that about the current patch
queue or otherwise, please go ahead.


Trivial merge conflicts
---
commit 9d5c3fc12b05d944508ef4e3b1f2ddc4f23c0a82
Author: Jason Ekstrand 

i965/gs: Allow primitive id to be a system value

(cherry picked from commit a5e88e66e633aaeb587b274d80e21cd46c8ee2cb)


commit 8dbdbc21910a6d37c381535186f9e728fff8690d
Author: Jason Ekstrand 

anv: Handle null in all destructors

(cherry picked from commit 49f08ad77f51cc344e4bfe60ba9f8d9fccfbd753)


commit 1809f17bda56d4f9d6385f63a9c4a5df890e3cad
Author: Kenneth Graunke 

mesa: Drop PATH_MAX usage.

(cherry picked from commit 9bfee7047b70cb0aa026ca9536465762f96cb2b1)

Cheers,
Emil


Mesa stable queue
-

Nominated (4)
=

Dave Airlie (1):
  2de85eb radv: fix texturesamples to handle single sample case

Jason Ekstrand (2):
  e73d136 vulkan/wsi/x11: Implement FIFO mode.

Note: temporary on hold.
Commit seems to be a feature and provides no clear indication about the bugs
it addresses. Jason, is this really applicable for stable ?

  054e48e anv/cmd_buffer: Re-emit MEDIA_CURBE_LOAD when CS push
constants are dirty

Note: temporary on hold.
Depends on the refactoring d33e2ad67c3 (anv: Move INTERFACE_DESCRIPTOR_DATA
setup to the pipeline) which in itself depends on another refactoring (cleanup)
commit 623e1e06d8c and likely others. Jason, any input ?

Kevin Strasser (1):
  932bb3f vulkan/wsi: Add a thread-safe queue implementation
Requirement for "Implement FIFO mode above" above.


Queued (49)
===

Ben Widawsky (3):
  i965: Add some APL and KBL SKU strings
  i965: Reorder PCI ID list to match release order
  i965/glk: Add basic Geminilake support

Dave Airlie (7):
  radv: fix texturesamples to handle single sample case
  wsi: fix VK_INCOMPLETE for vkGetSwapchainImagesKHR
  radv: don't crash on null swapchain destroy.
  ac/nir/llvm: fix channel in texture gather lowering code.
  radv: make sure to flush input attachments correctly.
  radv: fix image view creation for depth and stencil only
  radv: spir-v allows texture size query with and without lod.

Eduardo Lima Mitev (2):
  vulkan/wsi/x11: Fix behavior of vkGetPhysicalDeviceSurfaceFormatsKHR
  vulkan/wsi/x11: Fix behavior of vkGetPhysicalDeviceSurfacePresentModesKHR

Eduardo, I've picked these two since they are perfectly reasonable
stable material.
Let me know if you think that we should keep or drop them.

Emil Velikov (3):
  docs: add sha256 checksums for 13.0.1
  cherry-ignore: add reverted LLVM_LIBDIR patch
  anv: fix enumeration of properties

Eric Anholt (3):
  vc4: Don't abort when a shader compile fails.
  vc4: Clamp the shadow comparison value.
  vc4: Fix register class handling of DDX/DDY arguments.

Gwan-gyeong Mun (2):
  util/disk_cache: close a previously opened handle in disk_cache_put (v2)
  anv: Fix unintentional integer overflow in anv_CreateDmaBufImageINTEL

Iago Toral Quiroga (1):
  anv/format: handle unsupported formats properly

Ian Romanick (2):
  glcpp: Handle '#version 0' and other invalid values
  glsl: Parse 0 as a preprocessor INTCONSTANT

Jason Ekstrand (14):
  anv/gen8: Stall when needed in Cmd(Set|Reset)Event
  anv/wsi: Set the fence to signaled in AcquireNextImageKHR
  anv: Rework fences
  vulkan/wsi/wayland: Include pthread.h
  vulkan/wsi/wayland: Clean up some error handling paths
  vulkan/wsi: Report the correct min/maxImageCount
  i965/gs: Allow primitive id to be a system value
  anv: Handle null in all destructors
  anv/fence: Handle ANV_FENCE_CREATE_SIGNALED_BIT
  nir/spirv: Fix handling of gl_PrimitiveId
  anv/blorp: Ignore clears for attachments first used as resolve
destinations
  anv: Implement a depth stall 

Re: [Mesa-dev] [v2 02/17] i965/blorp: Skip redundant re-fast clear for non-compressed

2016-11-24 Thread Jason Ekstrand
On Nov 24, 2016 8:42 AM, "Ben Widawsky"  wrote:
>
> On 16-11-23 12:04:02, Jason Ekstrand wrote:
>>
>> On Wed, Nov 23, 2016 at 10:16 AM, Pohjolainen, Topi <
>> topi.pohjolai...@gmail.com> wrote:
>>
>>> On Wed, Nov 23, 2016 at 09:05:39AM -0800, Jason Ekstrand wrote:
>>> >On Wed, Nov 23, 2016 at 1:16 AM, Topi Pohjolainen
>>> ><[1]topi.pohjolai...@gmail.com> wrote:
>>> >
>>> >  Originally re-clears where skipped but when lossless compression
>>> >  was introduced the re-clears where errorneously enabled also for
>>> >  non-compressed fast clears.
>>> >  Signed-off-by: Topi Pohjolainen <[2]topi.pohjolai...@intel.com>
>>> >  CC: Ben Widawsky <[3]benjamin.widaw...@intel.com>
>>> >  CC: Kenneth Graunke <[4]kenn...@whitecape.org>
>>> >  CC: Harri Syrja <[5]harri.sy...@intel.com>
>>> >  Cc: Chad Versace <[6]c...@kiwitree.net>
>>> >  ---
>>> >   src/mesa/drivers/dri/i965/brw_blorp.c | 19 ---
>>> >   1 file changed, 16 insertions(+), 3 deletions(-)
>>> >  diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c
>>> >  b/src/mesa/drivers/dri/i965/brw_blorp.c
>>> >  index 556f2c0..9a849f5 100644
>>> >  --- a/src/mesa/drivers/dri/i965/brw_blorp.c
>>> >  +++ b/src/mesa/drivers/dri/i965/brw_blorp.c
>>> >  @@ -825,10 +825,23 @@ do_single_blorp_clear(struct brw_context
*brw,
>>> >  struct gl_framebuffer *fb,
>>> >   brw,
>mt->gen9_fast_clear_
>>> >  color,
>>> >   _color);
>>> >  -  /* If the buffer is already in
INTEL_FAST_CLEAR_STATE_CLEAR,
>>> >  the clear
>>> >  -   * is redundant and can be skipped.
>>> >  +  /* If the buffer is already in
INTEL_FAST_CLEAR_STATE_CLEAR,
>>> >  and the
>>> >  +   * buffer isn't compressed, the clear is redundant and
can be
>>> >  skipped.
>>> >  +   *
>>> >  +   * Without compression fast clear only operates on the mcs
>>> >  buffer
>>> >  +   * recording if color values are cleared. The hardware,
>>> >  however,
>>> >  +   * doesn't write the actual color value into the mcs or
color
>>> >  +   * buffer. Only by the time of render (inclucing color
>>> >  resolve) does the
>>> >  +   * hardware read the _current_ color value in the surface
>>> >  state and
>>> >  +   * write the actual pixel values in the color buffer
>>> >  accordingly.
>>> >  +   *
>>> >  +   * This seems to be the reason why sampler engine cannot
>>> >  handle
>>> >  +   * non-compressed fast clear - it doesn't know how to read
>>> >  the color
>>> >  +   * value from the surface state. With compression the
color
>>> >  value is
>>> >  +   * recorded in the color buffer (only not for every pixel)
>>> >  and therefore
>>> >  +   * it is available without consulting the surface state.
>>> >
>>> >This doesn't jive with my understanding of fast clears on gen9.
>>> >Everything I've seen so far indicates that the clear color in the
>>> >surface state *does* matter.  Otherwise, why would it be there?  In
>>> >particular, my understanding of the 2-bit CCS values is that 0
means
>>> >resolved, 1 means compressed and 3 means clear where "clear" means
"go
>>> >look at the clear color".  Have you done experiments that lead you
to
>>> >some other conclusion?
>>>
>>> Right, you are correct. This is actually a patch from really early days
>>> when I
>>> didn't know any better. We might want to drop this for now, there is the
>>> 0/1
>>> color thing for sampler engine that we probably need to fix first
anyway.
>>>
>>
>> Let's drop it if we can.
>>
>> We should already have code for Broadwell and earlier that prevents
>> fast-clears with non-0/1 clear colors.  We could just also do that on Sky
>> Lake and deal with partial resolves later.  I doubt non-0/1 fast-clear
is a
>> big enough deal over color compression to slow down getting this landed.
>>
>
> Numbers

What do you mean?  Of i recall correctly, we noticed zero speedups in any
apps when we enabled non-0/1 fast clears in the first place.  Also, I
wasn't trying to say we shouldn't enable them or shouldn't get them
working;  my understanding is that they're enabled and broken today.  I was
saying that we shouldn't block landing this on coming up with a partial
resolve story to fix non-0/1 clears with compression because that's really
an unrelated task.  We do need better resolves and hopefully we'll get that
done soon but poor Topi has been sitting on this 3‰ perf improvement and
trying to land it fitter months now.

Sorry of that got a bit ranty. I hope it makes more sense.

>>
>>> What do you think?
>>>
>>> >
>>> >  */
>>> >  -  if (!color_updated &&
>>> >  +  if ((!color_updated || !is_lossless_compressed) &&
>>> > 

[Mesa-dev] [Bug 98833] [REGRESSION, bisected] Wayland revert commit breaks fullscreen frame updates

2016-11-24 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=98833

--- Comment #5 from Eero Tamminen  ---
Happens both on BDW & SKL, both with Ubuntu 16.04 kernel & latest kernel from
drm nightly git.

Not sure whether I have time to write test program, but at least I can provide
EGL/GL API calls from apitrace dump.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [v2 02/17] i965/blorp: Skip redundant re-fast clear for non-compressed

2016-11-24 Thread Ben Widawsky

On 16-11-23 12:04:02, Jason Ekstrand wrote:

On Wed, Nov 23, 2016 at 10:16 AM, Pohjolainen, Topi <
topi.pohjolai...@gmail.com> wrote:


On Wed, Nov 23, 2016 at 09:05:39AM -0800, Jason Ekstrand wrote:
>On Wed, Nov 23, 2016 at 1:16 AM, Topi Pohjolainen
><[1]topi.pohjolai...@gmail.com> wrote:
>
>  Originally re-clears where skipped but when lossless compression
>  was introduced the re-clears where errorneously enabled also for
>  non-compressed fast clears.
>  Signed-off-by: Topi Pohjolainen <[2]topi.pohjolai...@intel.com>
>  CC: Ben Widawsky <[3]benjamin.widaw...@intel.com>
>  CC: Kenneth Graunke <[4]kenn...@whitecape.org>
>  CC: Harri Syrja <[5]harri.sy...@intel.com>
>  Cc: Chad Versace <[6]c...@kiwitree.net>
>  ---
>   src/mesa/drivers/dri/i965/brw_blorp.c | 19 ---
>   1 file changed, 16 insertions(+), 3 deletions(-)
>  diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c
>  b/src/mesa/drivers/dri/i965/brw_blorp.c
>  index 556f2c0..9a849f5 100644
>  --- a/src/mesa/drivers/dri/i965/brw_blorp.c
>  +++ b/src/mesa/drivers/dri/i965/brw_blorp.c
>  @@ -825,10 +825,23 @@ do_single_blorp_clear(struct brw_context *brw,
>  struct gl_framebuffer *fb,
>   brw, >mt->gen9_fast_clear_
>  color,
>   _color);
>  -  /* If the buffer is already in INTEL_FAST_CLEAR_STATE_CLEAR,
>  the clear
>  -   * is redundant and can be skipped.
>  +  /* If the buffer is already in INTEL_FAST_CLEAR_STATE_CLEAR,
>  and the
>  +   * buffer isn't compressed, the clear is redundant and can be
>  skipped.
>  +   *
>  +   * Without compression fast clear only operates on the mcs
>  buffer
>  +   * recording if color values are cleared. The hardware,
>  however,
>  +   * doesn't write the actual color value into the mcs or color
>  +   * buffer. Only by the time of render (inclucing color
>  resolve) does the
>  +   * hardware read the _current_ color value in the surface
>  state and
>  +   * write the actual pixel values in the color buffer
>  accordingly.
>  +   *
>  +   * This seems to be the reason why sampler engine cannot
>  handle
>  +   * non-compressed fast clear - it doesn't know how to read
>  the color
>  +   * value from the surface state. With compression the color
>  value is
>  +   * recorded in the color buffer (only not for every pixel)
>  and therefore
>  +   * it is available without consulting the surface state.
>
>This doesn't jive with my understanding of fast clears on gen9.
>Everything I've seen so far indicates that the clear color in the
>surface state *does* matter.  Otherwise, why would it be there?  In
>particular, my understanding of the 2-bit CCS values is that 0 means
>resolved, 1 means compressed and 3 means clear where "clear" means "go
>look at the clear color".  Have you done experiments that lead you to
>some other conclusion?

Right, you are correct. This is actually a patch from really early days
when I
didn't know any better. We might want to drop this for now, there is the
0/1
color thing for sampler engine that we probably need to fix first anyway.



Let's drop it if we can.

We should already have code for Broadwell and earlier that prevents
fast-clears with non-0/1 clear colors.  We could just also do that on Sky
Lake and deal with partial resolves later.  I doubt non-0/1 fast-clear is a
big enough deal over color compression to slow down getting this landed.



Numbers




What do you think?

>
>  */
>  -  if (!color_updated &&
>  +  if ((!color_updated || !is_lossless_compressed) &&
> irb->mt->fast_clear_state ==
>  INTEL_FAST_CLEAR_STATE_CLEAR)
>return true;
>  --
>  2.5.5
>  ___
>  mesa-dev mailing list
>  [7]mesa-dev@lists.freedesktop.org
>  [8]https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
> References
>
>1. mailto:topi.pohjolai...@gmail.com
>2. mailto:topi.pohjolai...@intel.com
>3. mailto:benjamin.widaw...@intel.com
>4. mailto:kenn...@whitecape.org
>5. mailto:harri.sy...@intel.com
>6. mailto:c...@kiwitree.net
>7. mailto:mesa-dev@lists.freedesktop.org
>8. https://lists.freedesktop.org/mailman/listinfo/mesa-dev



--
Ben Widawsky, Intel Open Source Technology Center
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 98842] mesa 13.0.1 build broken under debian8

2016-11-24 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=98842

--- Comment #1 from Emil Velikov  ---
Can you search through your system for the following files libdrm.so and
libdrm.pc.
For both, provide the exact location. And the contents in for the latter.

Thanks

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] i915: Add XRGB8888 format to intel_screen_make_configs

2016-11-24 Thread Derek Foreman

On 24/11/16 08:53 AM, Emil Velikov wrote:

On 24 November 2016 at 06:22, Boyan Ding  wrote:

2016-11-24 13:29 GMT+08:00 Derek Foreman :

On 23/11/16 07:18 PM, Boyan Ding wrote:


2016-11-24 7:01 GMT+08:00 Derek Foreman :


This is a copy of commit 536003c11e4cb1172c540932ce3cce06f03bf44e
except for i915.

Original log for the i965 commit follows:

 Some application, such as drm backend of weston, uses XRGB config as
 default. i965 doesn't provide this format, but before commit 65c8965d,
 the drm platform of EGL takes ARGB as XRGB. Now that commit
 65c8965d makes EGL recognize format correctly so weston won't start
 because it can't find XRGB. Add XRGB format to i965 just as
 other drivers do.

Signed-off-by: Derek Foreman 
---
 src/mesa/drivers/dri/i915/intel_screen.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i915/intel_screen.c
b/src/mesa/drivers/dri/i915/intel_screen.c
index 1b80df0..5c7c06a 100644
--- a/src/mesa/drivers/dri/i915/intel_screen.c
+++ b/src/mesa/drivers/dri/i915/intel_screen.c
@@ -1044,7 +1044,8 @@ intel_screen_make_configs(__DRIscreen *dri_screen)
 {
static const mesa_format formats[] = {
   MESA_FORMAT_B5G6R5_UNORM,
-  MESA_FORMAT_B8G8R8A8_UNORM
+  MESA_FORMAT_B8G8R8A8_UNORM,
+  MESA_FORMAT_B8G8R8X8_UNORM
};

/* GLX_SWAP_COPY_OML is not supported due to page flipping. */
--
2.10.2



Hi Derek,

I sent exactly the same patch one and half years ago at [1], but
withdrew it because it seems no one got interested in that and I don't
have the hardware to test. If you're sure it is correct, this gets my

Acked-by: Boyan Ding 



I'm sorry, I didn't see your patch.  It makes more sense to me that I give
you my RB on that patch in place of your Ack on mine.  I don't want to take
credit for a problem you solved over a year ago. :)

I don't have appropriate hardware but this has been tested for me by an
Enlightenment user who was unable to use our GL backend because it's trying
to use XRGB.

Weston ran for him but logged a warning about falling back to an ARGB
visual, which led me to the discovery that this had only been changed for
i965.

I'll try to get him to reply with a "Tested-by" tomorrow.




Thanks for the kind reply, but I wonder if a more thorough testing
should be done before applying this. I remember its i965 counterpart
(commit 28090b30d) did cause some problem (Bug 90791) although it seems
not the fault on its own.

We're facing the same problem I faced last year when posting this
patch -- I didn't have the authority to say that it was okay, and I
didn't have the hardware to test on as Emil once suggested[1].


Precisely - the patch on it's own was perfectly reasonable but it will
likely cause issues like i965 one.


Yikes, that's a long list of side effects.  This is something I can work 
around in enlightenment anyway, by doing the same manner of fallback 
weston does (fall back to an ARGB visual if an XRGB is unavailable).


Please let me know if it's preferred that I just do it there instead.

Thanks for taking to time to compile that list.
Derek


Derek, skimming through the i965 history a very lengthy list of
regressions/fixes comes up[1] as the format was advertised as
supported.

Considering we don't get much testing, it would be great to avoid
breaking the world by fixing EGL/drm users (Wayland compositors,
other).

Ian, Mark Janes,
Gents, do you have the hardware/chance to test this patch ?

Thanks
Emil

[1]
28090b30dd6b5977de085f48c620574214b6b4ba i965: Add XRGB format to
intel_screen_make_configs
* Adds the format since things broke as EGL/drm was fixed to correctly
honour the formats commit 65c8965d033 (egl: Take alpha bits into
account when selecting GBM formats)

8da79b8378ae87474d8c47ad955e4833edf98359 i965: Fix HW blitter pitch limits
c2d0606827412b710dcaed80268fc665de8c9c5d i915: Blit RGBX<->RGBA
drawpixels // should read i965
922c0c9fd526ce19b87bc74a3159dec7705c1de1 i965: Export format
comparison for blitting between miptrees
* Fixes serious performance issue due to the extra format.

bd38f91f8d80897ca91979962d80d4bc0acef586 i965: do_blit_drawpixels:
decode array formats
* Fixes the last commit above

2cebaac479d49cd6df4e97b466ba14bab3f30db1 i965: Don't use tiled_memcpy
to download from RGBX or BGRX surfaces
* Disable those since it causes regressions

3f10774cbab1e803f8aa3d6d24f8f6f98b8128c3 i965: Check base format to
determine whether to use tiled memcpy
* Aims to rework/fix the above.

c769efda939e06338d41e1046a5f954c690951d5 i965: Add
MESA_FORMAT_B8G8R8X8_SRGB to brw_format_for_mesa_format
43f4be5f06b7a96b96a3a7b43f5112139a1f423a i965: Add B8G8R8X8_SRGB to
the alpha format override
839793680f99b8387bee9489733d5071c10f3ace i965: Use
MESA_FORMAT_B8G8R8X8_SRGB for RGB visuals
* Aim to rework/fix the mesa <> hardware format mappings as a side

[Mesa-dev] [PATCH v2 11/14] egl: implement eglQueryDmaBufFormatsEXT

2016-11-24 Thread Varad Gautam
From: Varad Gautam 

allow egl clients to query the dmabuf formats supported on this platform.

Signed-off-by: Louis-Francis Ratté-Boulianne 
Signed-off-by: Varad Gautam 
---
 src/egl/drivers/dri2/egl_dri2.c | 17 +
 src/egl/main/eglapi.c   | 19 +++
 src/egl/main/eglapi.h   |  4 
 3 files changed, 40 insertions(+)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 4589d9f..bae7da8 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -2081,6 +2081,22 @@ dri2_check_dma_buf_format(const _EGLImageAttribs *attrs)
return plane_n;
 }
 
+static EGLBoolean
+dri2_query_dma_buf_formats(_EGLDriver *drv, _EGLDisplay *disp,
+EGLint max, EGLint *formats, EGLint *count)
+{
+   struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
+   if (max < 0 || (max > 0 && formats == NULL)) {
+  _eglError(EGL_BAD_PARAMETER, "invalid value for max count of formats");
+  return EGL_FALSE;
+   }
+
+   dri2_dpy->image->queryDmaBufFormats(dri2_dpy->dri_screen, max, formats,
+   count);
+
+   return EGL_TRUE;
+}
+
 /**
  * The spec says:
  *
@@ -2964,6 +2980,7 @@ _eglBuiltInDriverDRI2(const char *args)
dri2_drv->base.API.ExportDRMImageMESA = dri2_export_drm_image_mesa;
dri2_drv->base.API.ExportDMABUFImageQueryMESA = 
dri2_export_dma_buf_image_query_mesa;
dri2_drv->base.API.ExportDMABUFImageMESA = dri2_export_dma_buf_image_mesa;
+   dri2_drv->base.API.QueryDmaBufFormatsEXT = dri2_query_dma_buf_formats;
 #endif
 #ifdef HAVE_WAYLAND_PLATFORM
dri2_drv->base.API.BindWaylandDisplayWL = dri2_bind_wayland_display_wl;
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 53340bf..53d34d8 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -2257,6 +2257,24 @@ eglQueryDebugKHR(EGLint attribute, EGLAttrib *value)
return EGL_TRUE;
 }
 
+static EGLBoolean EGLAPIENTRY
+eglQueryDmaBufFormatsEXT(EGLDisplay dpy, EGLint max_formats,
+ EGLint *formats, EGLint *num_formats)
+{
+   _EGLDisplay *disp = _eglLockDisplay(dpy);
+   _EGLDriver *drv;
+   EGLBoolean ret;
+
+   _EGL_FUNC_START(NULL, EGL_NONE, NULL, EGL_FALSE);
+
+   _EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv);
+
+   ret = drv->API.QueryDmaBufFormatsEXT(drv, disp, max_formats, formats,
+num_formats);
+
+   RETURN_EGL_EVAL(disp, ret);
+}
+
 __eglMustCastToProperFunctionPointerType EGLAPIENTRY
 eglGetProcAddress(const char *procname)
 {
@@ -2340,6 +2358,7 @@ eglGetProcAddress(const char *procname)
   { "eglLabelObjectKHR", (_EGLProc) eglLabelObjectKHR },
   { "eglDebugMessageControlKHR", (_EGLProc) eglDebugMessageControlKHR },
   { "eglQueryDebugKHR", (_EGLProc) eglQueryDebugKHR },
+  { "eglQueryDmaBufFormatsEXT", (_EGLProc) eglQueryDmaBufFormatsEXT },
   { NULL, NULL }
};
EGLint i;
diff --git a/src/egl/main/eglapi.h b/src/egl/main/eglapi.h
index b9bcc8e..13388b1 100644
--- a/src/egl/main/eglapi.h
+++ b/src/egl/main/eglapi.h
@@ -196,6 +196,10 @@ struct _egl_api
int (*GLInteropExportObject)(_EGLDisplay *dpy, _EGLContext *ctx,
 struct mesa_glinterop_export_in *in,
 struct mesa_glinterop_export_out *out);
+
+   EGLBoolean (*QueryDmaBufFormatsEXT)(_EGLDriver *drv, _EGLDisplay *dpy,
+   EGLint max_formats, EGLint *formats,
+   EGLint *num_formats);
 };
 
 EGLint _eglConvertIntsToAttribs(const EGLint *int_list,
-- 
2.6.2

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


[Mesa-dev] [PATCH v2 13/14] egl: implement eglQueryDmaBufModifiersEXT

2016-11-24 Thread Varad Gautam
From: Varad Gautam 

query and return supported dmabuf format modifiers for
EGL_EXT_image_dma_buf_import_modifiers.

Signed-off-by: Varad Gautam 
---
 src/egl/drivers/dri2/egl_dri2.c | 47 +
 src/egl/main/eglapi.c   | 21 ++
 src/egl/main/eglapi.h   |  5 +
 3 files changed, 73 insertions(+)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index bae7da8..d387e28 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -2097,6 +2097,52 @@ dri2_query_dma_buf_formats(_EGLDriver *drv, _EGLDisplay 
*disp,
return EGL_TRUE;
 }
 
+static EGLBoolean
+dri2_query_dma_buf_modifiers(_EGLDriver *drv, _EGLDisplay *disp, EGLint format,
+ EGLint max, EGLuint64KHR *modifiers,
+ EGLBoolean *external_only, EGLint *count)
+{
+   struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
+   EGLint* formats;
+   EGLint num_formats;
+   EGLint i;
+
+   if (max < 0) {
+  _eglError(EGL_BAD_PARAMETER, "invalid value for max count of formats");
+  return EGL_FALSE;
+   }
+
+   if (max > 0 && modifiers == NULL) {
+  _eglError(EGL_BAD_PARAMETER, "invalid modifiers array");
+  return EGL_FALSE;
+   }
+
+   /* query and check if the received format is supported */
+   dri2_dpy->image->queryDmaBufFormats(dri2_dpy->dri_screen, 0, NULL,
+   _formats);
+   formats = calloc(num_formats, sizeof(EGLint));
+   dri2_dpy->image->queryDmaBufFormats(dri2_dpy->dri_screen, num_formats,
+   formats, _formats);
+   for (i = 0; i < num_formats; i++) {
+  if (format == formats[i])
+ break;
+   }
+   if (i == num_formats) {
+  _eglError(EGL_BAD_PARAMETER, "invalid format");
+  return EGL_FALSE;
+   }
+
+   dri2_dpy->image->queryDmaBufModifiers(dri2_dpy->dri_screen, format, max,
+ modifiers, count);
+
+   if (external_only != NULL) {
+  for (i = 0; i < *count && i < max; i++)
+ external_only[i] = EGL_TRUE;
+   }
+
+   return EGL_TRUE;
+}
+
 /**
  * The spec says:
  *
@@ -2981,6 +3027,7 @@ _eglBuiltInDriverDRI2(const char *args)
dri2_drv->base.API.ExportDMABUFImageQueryMESA = 
dri2_export_dma_buf_image_query_mesa;
dri2_drv->base.API.ExportDMABUFImageMESA = dri2_export_dma_buf_image_mesa;
dri2_drv->base.API.QueryDmaBufFormatsEXT = dri2_query_dma_buf_formats;
+   dri2_drv->base.API.QueryDmaBufModifiersEXT = dri2_query_dma_buf_modifiers;
 #endif
 #ifdef HAVE_WAYLAND_PLATFORM
dri2_drv->base.API.BindWaylandDisplayWL = dri2_bind_wayland_display_wl;
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 53d34d8..cd65115 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -2275,6 +2275,26 @@ eglQueryDmaBufFormatsEXT(EGLDisplay dpy, EGLint 
max_formats,
RETURN_EGL_EVAL(disp, ret);
 }
 
+static EGLBoolean EGLAPIENTRY
+eglQueryDmaBufModifiersEXT(EGLDisplay dpy, EGLint format, EGLint max_modifiers,
+   EGLuint64KHR *modifiers, EGLBoolean *external_only,
+   EGLint *num_modifiers)
+{
+   _EGLDisplay *disp = _eglLockDisplay(dpy);
+   _EGLDriver *drv;
+   EGLBoolean ret;
+
+   _EGL_FUNC_START(NULL, EGL_NONE, NULL, EGL_FALSE);
+
+   _EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv);
+
+   ret = drv->API.QueryDmaBufModifiersEXT(drv, disp, format, max_modifiers,
+  modifiers, external_only,
+  num_modifiers);
+
+   RETURN_EGL_EVAL(disp, ret);
+}
+
 __eglMustCastToProperFunctionPointerType EGLAPIENTRY
 eglGetProcAddress(const char *procname)
 {
@@ -2359,6 +2379,7 @@ eglGetProcAddress(const char *procname)
   { "eglDebugMessageControlKHR", (_EGLProc) eglDebugMessageControlKHR },
   { "eglQueryDebugKHR", (_EGLProc) eglQueryDebugKHR },
   { "eglQueryDmaBufFormatsEXT", (_EGLProc) eglQueryDmaBufFormatsEXT },
+  { "eglQueryDmaBufModifiersEXT", (_EGLProc) eglQueryDmaBufModifiersEXT },
   { NULL, NULL }
};
EGLint i;
diff --git a/src/egl/main/eglapi.h b/src/egl/main/eglapi.h
index 13388b1..3428195 100644
--- a/src/egl/main/eglapi.h
+++ b/src/egl/main/eglapi.h
@@ -200,6 +200,11 @@ struct _egl_api
EGLBoolean (*QueryDmaBufFormatsEXT)(_EGLDriver *drv, _EGLDisplay *dpy,
EGLint max_formats, EGLint *formats,
EGLint *num_formats);
+   EGLBoolean (*QueryDmaBufModifiersEXT) (_EGLDriver *drv, _EGLDisplay *dpy,
+  EGLint format, EGLint max_modifiers,
+  EGLuint64KHR *modifiers,
+  EGLBoolean *external_only,
+  EGLint *num_modifiers);
 };
 
 EGLint 

[Mesa-dev] [PATCH v2 14/14] egl: advertise EGL_EXT_image_dma_buf_import_modifiers

2016-11-24 Thread Varad Gautam
From: Varad Gautam 

Signed-off-by: Varad Gautam 
---
 src/egl/drivers/dri2/egl_dri2.c | 5 +
 src/egl/main/eglapi.c   | 1 +
 2 files changed, 6 insertions(+)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index d387e28..e155801 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -692,6 +692,11 @@ dri2_setup_screen(_EGLDisplay *disp)
   dri2_dpy->image->createImageFromDmaBufs) {
  disp->Extensions.EXT_image_dma_buf_import = EGL_TRUE;
   }
+  if (dri2_dpy->image->base.version >= 15 &&
+  dri2_dpy->image->createImageFromDmaBufs2 &&
+  dri2_dpy->image->queryDmaBufModifiers) {
+ disp->Extensions.EXT_image_dma_buf_import_modifiers = EGL_TRUE;
+  }
 #endif
}
 }
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index cd65115..44d7935 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -481,6 +481,7 @@ _eglCreateExtensionsString(_EGLDisplay *dpy)
_EGL_CHECK_EXTENSION(EXT_buffer_age);
_EGL_CHECK_EXTENSION(EXT_create_context_robustness);
_EGL_CHECK_EXTENSION(EXT_image_dma_buf_import);
+   _EGL_CHECK_EXTENSION(EXT_image_dma_buf_import_modifiers);
_EGL_CHECK_EXTENSION(EXT_swap_buffers_with_damage);
 
_EGL_CHECK_EXTENSION(KHR_cl_event2);
-- 
2.6.2

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


[Mesa-dev] [PATCH v2 06/14] st/dri: implement DRIimage creation from dmabufs with modifiers

2016-11-24 Thread Varad Gautam
From: Varad Gautam 

support importing dmabufs into DRIimage taking format modifiers in
account, as per DRIimage extension version 14.

Signed-off-by: Varad Gautam 
---
 src/gallium/include/state_tracker/drm_driver.h |  2 ++
 src/gallium/state_trackers/dri/dri2.c  | 45 +++---
 2 files changed, 43 insertions(+), 4 deletions(-)

diff --git a/src/gallium/include/state_tracker/drm_driver.h 
b/src/gallium/include/state_tracker/drm_driver.h
index c80fb09..8b9d6bc 100644
--- a/src/gallium/include/state_tracker/drm_driver.h
+++ b/src/gallium/include/state_tracker/drm_driver.h
@@ -45,6 +45,8 @@ struct winsys_handle
 * Output for texture_get_handle.
 */
unsigned offset;
+
+   uint64_t modifier;
 };
 
 
diff --git a/src/gallium/state_trackers/dri/dri2.c 
b/src/gallium/state_trackers/dri/dri2.c
index 9ec069b..a2b87a7 100644
--- a/src/gallium/state_trackers/dri/dri2.c
+++ b/src/gallium/state_trackers/dri/dri2.c
@@ -884,7 +884,7 @@ static __DRIimage *
 dri2_create_image_from_fd(__DRIscreen *_screen,
   int width, int height, int fourcc,
   int *fds, int num_fds, int *strides,
-  int *offsets, unsigned *error,
+  int *offsets, uint64_t *modifiers, unsigned *error,
   int *dri_components, void *loaderPrivate)
 {
struct winsys_handle whandles[3];
@@ -929,6 +929,8 @@ dri2_create_image_from_fd(__DRIscreen *_screen,
   whandles[i].handle = (unsigned)fds[i];
   whandles[i].stride = (unsigned)strides[i];
   whandles[i].offset = (unsigned)offsets[i];
+  if (modifiers)
+ whandles[i].modifier = modifiers[i];
}
 
if (fourcc == __DRI_IMAGE_FOURCC_YVU420) {
@@ -1248,7 +1250,7 @@ dri2_from_fds(__DRIscreen *screen, int width, int height, 
int fourcc,
int dri_components;
 
img = dri2_create_image_from_fd(screen, width, height, fourcc,
-   fds, num_fds, strides, offsets, NULL,
+   fds, num_fds, strides, offsets, NULL, NULL,
_components, loaderPrivate);
if (img == NULL)
   return NULL;
@@ -1273,7 +1275,7 @@ dri2_from_dma_bufs(__DRIscreen *screen,
int dri_components;
 
img = dri2_create_image_from_fd(screen, width, height, fourcc,
-   fds, num_fds, strides, offsets, error,
+   fds, num_fds, strides, offsets, NULL, error,
_components, loaderPrivate);
if (img == NULL)
   return NULL;
@@ -1288,6 +1290,38 @@ dri2_from_dma_bufs(__DRIscreen *screen,
return img;
 }
 
+static __DRIimage *
+dri2_from_dma_bufs2(__DRIscreen *screen,
+int width, int height, int fourcc,
+int *fds, int num_fds,
+int *strides, int *offsets,
+uint64_t *modifiers,
+enum __DRIYUVColorSpace yuv_color_space,
+enum __DRISampleRange sample_range,
+enum __DRIChromaSiting horizontal_siting,
+enum __DRIChromaSiting vertical_siting,
+unsigned *error,
+void *loaderPrivate)
+{
+   __DRIimage *img;
+   int dri_components;
+
+   img = dri2_create_image_from_fd(screen, width, height, fourcc,
+   fds, num_fds, strides, offsets, modifiers,
+   error, _components, loaderPrivate);
+   if (img == NULL)
+  return NULL;
+
+   img->yuv_color_space = yuv_color_space;
+   img->sample_range = sample_range;
+   img->horizontal_siting = horizontal_siting;
+   img->vertical_siting = vertical_siting;
+   img->dri_components = dri_components;
+
+   *error = __DRI_IMAGE_ERROR_SUCCESS;
+   return img;
+}
+
 static void
 dri2_blit_image(__DRIcontext *context, __DRIimage *dst, __DRIimage *src,
 int dstx0, int dsty0, int dstwidth, int dstheight,
@@ -1391,7 +1425,7 @@ dri2_get_capabilities(__DRIscreen *_screen)
 
 /* The extension is modified during runtime if DRI_PRIME is detected */
 static __DRIimageExtension dri2ImageExtension = {
-.base = { __DRI_IMAGE, 12 },
+.base = { __DRI_IMAGE, 14 },
 
 .createImageFromName  = dri2_create_image_from_name,
 .createImageFromRenderbuffer  = dri2_create_image_from_renderbuffer,
@@ -1409,6 +1443,7 @@ static __DRIimageExtension dri2ImageExtension = {
 .getCapabilities  = dri2_get_capabilities,
 .mapImage = dri2_map_image,
 .unmapImage   = dri2_unmap_image,
+.createImageFromDmaBufs2  = NULL,
 };
 
 
@@ -1902,6 +1937,7 @@ dri2_init_screen(__DRIscreen * sPriv)
   (cap & DRM_PRIME_CAP_IMPORT)) {
  dri2ImageExtension.createImageFromFds = dri2_from_fds;
  dri2ImageExtension.createImageFromDmaBufs = 

[Mesa-dev] [PATCH v2 10/14] st/dri: support format queries

2016-11-24 Thread Varad Gautam
From: Varad Gautam 

ask the driver for supported dmabuf formats

Signed-off-by: Varad Gautam 
---
 src/gallium/state_trackers/dri/dri2.c | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/src/gallium/state_trackers/dri/dri2.c 
b/src/gallium/state_trackers/dri/dri2.c
index a2b87a7..e12a064 100644
--- a/src/gallium/state_trackers/dri/dri2.c
+++ b/src/gallium/state_trackers/dri/dri2.c
@@ -1259,6 +1259,17 @@ dri2_from_fds(__DRIscreen *screen, int width, int 
height, int fourcc,
return img;
 }
 
+static void
+dri2_query_dma_buf_formats(__DRIscreen *_screen, int max, int *formats,
+   int *count)
+{
+   struct dri_screen *screen = dri_screen(_screen);
+   struct pipe_screen *pscreen = screen->base.screen;
+
+   if (pscreen->get_param(pscreen, PIPE_CAP_QUERY_DMABUF_ATTRIBS))
+  pscreen->query_dmabuf_formats(pscreen, max, formats, count);
+}
+
 static __DRIimage *
 dri2_from_dma_bufs(__DRIscreen *screen,
int width, int height, int fourcc,
@@ -1444,6 +1455,7 @@ static __DRIimageExtension dri2ImageExtension = {
 .mapImage = dri2_map_image,
 .unmapImage   = dri2_unmap_image,
 .createImageFromDmaBufs2  = NULL,
+.queryDmaBufFormats   = NULL,
 };
 
 
@@ -1938,6 +1950,7 @@ dri2_init_screen(__DRIscreen * sPriv)
  dri2ImageExtension.createImageFromFds = dri2_from_fds;
  dri2ImageExtension.createImageFromDmaBufs = dri2_from_dma_bufs;
  dri2ImageExtension.createImageFromDmaBufs2 = dri2_from_dma_bufs2;
+ dri2ImageExtension.queryDmaBufFormats = dri2_query_dma_buf_formats;
   }
}
 
@@ -2011,6 +2024,7 @@ dri_kms_init_screen(__DRIscreen * sPriv)
   dri2ImageExtension.createImageFromFds = dri2_from_fds;
   dri2ImageExtension.createImageFromDmaBufs = dri2_from_dma_bufs;
   dri2ImageExtension.createImageFromDmaBufs2 = dri2_from_dma_bufs2;
+  dri2ImageExtension.queryDmaBufFormats = dri2_query_dma_buf_formats;
}
 
sPriv->extensions = dri_screen_extensions;
-- 
2.6.2

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


[Mesa-dev] [PATCH v2 12/14] st/dri: support format modifier queries

2016-11-24 Thread Varad Gautam
From: Varad Gautam 

ask the driver for supported modifiers for a given format.

bump __DRI_IMAGE implementation version to 15.

Signed-off-by: Varad Gautam 
---
 src/gallium/state_trackers/dri/dri2.c | 21 -
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/dri/dri2.c 
b/src/gallium/state_trackers/dri/dri2.c
index e12a064..540b2dd 100644
--- a/src/gallium/state_trackers/dri/dri2.c
+++ b/src/gallium/state_trackers/dri/dri2.c
@@ -1270,6 +1270,21 @@ dri2_query_dma_buf_formats(__DRIscreen *_screen, int 
max, int *formats,
   pscreen->query_dmabuf_formats(pscreen, max, formats, count);
 }
 
+static void
+dri2_query_dma_buf_modifiers(__DRIscreen *_screen, int fourcc, int max,
+ uint64_t *modifiers, int *count)
+{
+   struct dri_screen *screen = dri_screen(_screen);
+   struct pipe_screen *pscreen = screen->base.screen;
+   int dri_components;
+   enum pipe_format format = dri2_format_to_pipe_format(
+ convert_fourcc(fourcc,_components));
+
+   if (pscreen->get_param(pscreen, PIPE_CAP_QUERY_DMABUF_ATTRIBS))
+  pscreen->query_dmabuf_modifiers(pscreen, format, max, modifiers,
+count);
+}
+
 static __DRIimage *
 dri2_from_dma_bufs(__DRIscreen *screen,
int width, int height, int fourcc,
@@ -1436,7 +1451,7 @@ dri2_get_capabilities(__DRIscreen *_screen)
 
 /* The extension is modified during runtime if DRI_PRIME is detected */
 static __DRIimageExtension dri2ImageExtension = {
-.base = { __DRI_IMAGE, 14 },
+.base = { __DRI_IMAGE, 15 },
 
 .createImageFromName  = dri2_create_image_from_name,
 .createImageFromRenderbuffer  = dri2_create_image_from_renderbuffer,
@@ -1456,6 +1471,7 @@ static __DRIimageExtension dri2ImageExtension = {
 .unmapImage   = dri2_unmap_image,
 .createImageFromDmaBufs2  = NULL,
 .queryDmaBufFormats   = NULL,
+.queryDmaBufModifiers = NULL,
 };
 
 
@@ -1951,6 +1967,8 @@ dri2_init_screen(__DRIscreen * sPriv)
  dri2ImageExtension.createImageFromDmaBufs = dri2_from_dma_bufs;
  dri2ImageExtension.createImageFromDmaBufs2 = dri2_from_dma_bufs2;
  dri2ImageExtension.queryDmaBufFormats = dri2_query_dma_buf_formats;
+ dri2ImageExtension.queryDmaBufModifiers =
+dri2_query_dma_buf_modifiers;
   }
}
 
@@ -2025,6 +2043,7 @@ dri_kms_init_screen(__DRIscreen * sPriv)
   dri2ImageExtension.createImageFromDmaBufs = dri2_from_dma_bufs;
   dri2ImageExtension.createImageFromDmaBufs2 = dri2_from_dma_bufs2;
   dri2ImageExtension.queryDmaBufFormats = dri2_query_dma_buf_formats;
+  dri2ImageExtension.queryDmaBufModifiers = dri2_query_dma_buf_modifiers;
}
 
sPriv->extensions = dri_screen_extensions;
-- 
2.6.2

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


[Mesa-dev] [PATCH v3 07/14] egl_dri2: add support for using modifier attributes in eglCreateImageKHR

2016-11-24 Thread Varad Gautam
From: Varad Gautam 

allow creating EGLImages with dmabuf format modifiers when target is
EGL_LINUX_DMA_BUF_EXT for EGL_EXT_image_dma_buf_import_modifiers.

v2:
 - clear modifier assembling and error label name (Eric Engestrom)
v3:
 - remove goto jumps within switch-case (Emil Velikov)
 - treat zero as valid modifier (Daniel Stone)
 - ensure same modifier across all dmabuf planes (Emil Velikov)

Signed-off-by: Pekka Paalanen 
Signed-off-by: Varad Gautam 
Reviewed-by: Eric Engestrom 
---
 src/egl/drivers/dri2/egl_dri2.c | 79 +++--
 src/egl/main/eglimage.c | 48 +
 src/egl/main/eglimage.h |  2 ++
 3 files changed, 118 insertions(+), 11 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 58d16e1..4589d9f 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1937,6 +1937,33 @@ dri2_check_dma_buf_attribs(const _EGLImageAttribs *attrs)
   }
}
 
+   /**
+* If  is EGL_LINUX_DMA_BUF_EXT, both or neither of the following
+* attribute values may be given.
+*
+* This is referring to EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT and
+* EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT, and the same for other planes.
+*/
+   for (i = 0; i < DMA_BUF_MAX_PLANES; ++i) {
+  if (attrs->DMABufPlaneModifiersLo[i].IsPresent !=
+  attrs->DMABufPlaneModifiersHi[i].IsPresent) {
+ _eglError(EGL_BAD_PARAMETER, "modifier attribute lo or hi missing");
+ return EGL_FALSE;
+  }
+   }
+
+   for (i = 0; i < DMA_BUF_MAX_PLANES; ++i) {
+  if (attrs->DMABufPlaneModifiersLo[i].IsPresent) {
+ if ((attrs->DMABufPlaneModifiersLo[0].Value !=
+ attrs->DMABufPlaneModifiersLo[i].Value) ||
+ (attrs->DMABufPlaneModifiersHi[0].Value !=
+ attrs->DMABufPlaneModifiersHi[i].Value)) {
+_eglError(EGL_BAD_PARAMETER, "modifier attributes not equal");
+return EGL_FALSE;
+ }
+  }
+   }
+
return EGL_TRUE;
 }
 
@@ -2043,7 +2070,9 @@ dri2_check_dma_buf_format(const _EGLImageAttribs *attrs)
for (i = plane_n; i < DMA_BUF_MAX_PLANES; ++i) {
   if (attrs->DMABufPlaneFds[i].IsPresent ||
   attrs->DMABufPlaneOffsets[i].IsPresent ||
-  attrs->DMABufPlanePitches[i].IsPresent) {
+  attrs->DMABufPlanePitches[i].IsPresent ||
+  attrs->DMABufPlaneModifiersLo[i].IsPresent ||
+  attrs->DMABufPlaneModifiersHi[i].IsPresent) {
  _eglError(EGL_BAD_ATTRIBUTE, "too many plane attributes");
  return 0;
   }
@@ -2076,6 +2105,8 @@ dri2_create_image_dma_buf(_EGLDisplay *disp, _EGLContext 
*ctx,
int fds[DMA_BUF_MAX_PLANES];
int pitches[DMA_BUF_MAX_PLANES];
int offsets[DMA_BUF_MAX_PLANES];
+   uint64_t modifiers[DMA_BUF_MAX_PLANES];
+   bool has_modifier = false;
unsigned error;
 
/**
@@ -2106,18 +2137,44 @@ dri2_create_image_dma_buf(_EGLDisplay *disp, 
_EGLContext *ctx,
   fds[i] = attrs.DMABufPlaneFds[i].Value;
   pitches[i] = attrs.DMABufPlanePitches[i].Value;
   offsets[i] = attrs.DMABufPlaneOffsets[i].Value;
+  if (attrs.DMABufPlaneModifiersLo[i].IsPresent) {
+ modifiers[i] =
+((uint64_t) attrs.DMABufPlaneModifiersHi[i].Value << 32) |
+attrs.DMABufPlaneModifiersLo[i].Value;
+ has_modifier = true;
+  } else {
+ modifiers[i] = 0;
+  }
}
 
-   dri_image =
-  dri2_dpy->image->createImageFromDmaBufs(dri2_dpy->dri_screen,
- attrs.Width, attrs.Height, attrs.DMABufFourCC.Value,
- fds, num_fds, pitches, offsets,
- attrs.DMABufYuvColorSpaceHint.Value,
- attrs.DMABufSampleRangeHint.Value,
- attrs.DMABufChromaHorizontalSiting.Value,
- attrs.DMABufChromaVerticalSiting.Value,
- ,
- NULL);
+   if (has_modifier && dri2_dpy->image->createImageFromDmaBufs2) {
+  dri_image =
+ dri2_dpy->image->createImageFromDmaBufs2(dri2_dpy->dri_screen,
+attrs.Width, attrs.Height, attrs.DMABufFourCC.Value,
+fds, num_fds, pitches, offsets, modifiers,
+attrs.DMABufYuvColorSpaceHint.Value,
+attrs.DMABufSampleRangeHint.Value,
+attrs.DMABufChromaHorizontalSiting.Value,
+attrs.DMABufChromaVerticalSiting.Value,
+,
+NULL);
+   } else {
+  if (has_modifier) {
+ _eglError(EGL_BAD_MATCH, "unsupported dma_buf format modifier");
+ return EGL_NO_IMAGE_KHR;
+  }
+
+  dri_image =
+ dri2_dpy->image->createImageFromDmaBufs(dri2_dpy->dri_screen,
+attrs.Width, attrs.Height, attrs.DMABufFourCC.Value,
+fds, num_fds, pitches, offsets,
+attrs.DMABufYuvColorSpaceHint.Value,
+attrs.DMABufSampleRangeHint.Value,
+

[Mesa-dev] [PATCH v2 08/14] dri: add queryDmaBufFormats and queryDmaBufModifiers to DRIimage

2016-11-24 Thread Varad Gautam
From: Varad Gautam 

these allow querying the driver for supported dmabuf formats and
modifiers.

Signed-off-by: Varad Gautam 
---
 include/GL/internal/dri_interface.h | 22 +-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/include/GL/internal/dri_interface.h 
b/include/GL/internal/dri_interface.h
index 4874e59..f4026a6 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -1094,7 +1094,7 @@ struct __DRIdri2ExtensionRec {
  * extensions.
  */
 #define __DRI_IMAGE "DRI_IMAGE"
-#define __DRI_IMAGE_VERSION 14
+#define __DRI_IMAGE_VERSION 15
 
 
 /**
@@ -1439,6 +1439,26 @@ struct __DRIimageExtensionRec {
   enum __DRIChromaSiting vert_siting,
   unsigned *error,
   void *loaderPrivate);
+
+   /*
+* Returns the dmabuf formats supported by the driver
+*
+* For EGL_EXT_image_dma_buf_import_modifiers.
+*
+* \since 15
+*/
+   void (*queryDmaBufFormats)(__DRIscreen *screen, int max, int *formats,
+  int *count);
+
+   /*
+* Returns modifiers supported by the driver for a given format.
+*
+* For EGL_EXT_image_dma_buf_import_modifiers.
+*
+* \since 15
+*/
+   void (*queryDmaBufModifiers)(__DRIscreen *screen, int fourcc, int max,
+uint64_t *modifiers, int *count);
 };
 
 
-- 
2.6.2

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


[Mesa-dev] [PATCH v2 09/14] gallium: introduce dmabuf format and modifier querying

2016-11-24 Thread Varad Gautam
From: Varad Gautam 

this allows drivers to be queried for supported formats and format
modifiers. drivers that implement these queries must expose these under
PIPE_CAP_QUERY_DMABUF_ATTRIBS.

Signed-off-by: Varad Gautam 
---
 src/gallium/docs/source/screen.rst   |  2 ++
 src/gallium/drivers/freedreno/freedreno_screen.c |  1 +
 src/gallium/drivers/i915/i915_screen.c   |  1 +
 src/gallium/drivers/ilo/ilo_screen.c |  1 +
 src/gallium/drivers/llvmpipe/lp_screen.c |  1 +
 src/gallium/drivers/nouveau/nv30/nv30_screen.c   |  1 +
 src/gallium/drivers/nouveau/nv50/nv50_screen.c   |  1 +
 src/gallium/drivers/nouveau/nvc0/nvc0_screen.c   |  1 +
 src/gallium/drivers/r300/r300_screen.c   |  1 +
 src/gallium/drivers/r600/r600_pipe.c |  1 +
 src/gallium/drivers/radeonsi/si_pipe.c   |  1 +
 src/gallium/drivers/softpipe/sp_screen.c |  1 +
 src/gallium/drivers/svga/svga_screen.c   |  1 +
 src/gallium/drivers/swr/swr_screen.cpp   |  1 +
 src/gallium/drivers/vc4/vc4_screen.c |  1 +
 src/gallium/drivers/virgl/virgl_screen.c |  1 +
 src/gallium/include/pipe/p_defines.h |  1 +
 src/gallium/include/pipe/p_screen.h  | 20 
 18 files changed, 38 insertions(+)

diff --git a/src/gallium/docs/source/screen.rst 
b/src/gallium/docs/source/screen.rst
index 6ad2bec..af78493 100644
--- a/src/gallium/docs/source/screen.rst
+++ b/src/gallium/docs/source/screen.rst
@@ -364,6 +364,8 @@ The integer capabilities:
 * ``PIPE_CAP_STREAM_OUTPUT_INTERLEAVE_BUFFERS``: Whether interleaved stream
   output mode is able to interleave across buffers. This is required for
   ARB_transform_feedback3.
+* ``PIPE_CAP_QUERY_DMABUF_ATTRIBS``: Whether the driver supports querying for
+  supported dmabuf formats and format modifiers.
 
 
 .. _pipe_capf:
diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c 
b/src/gallium/drivers/freedreno/freedreno_screen.c
index 97da0d7..da2348f 100644
--- a/src/gallium/drivers/freedreno/freedreno_screen.c
+++ b/src/gallium/drivers/freedreno/freedreno_screen.c
@@ -288,6 +288,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum 
pipe_cap param)
case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
+   case PIPE_CAP_QUERY_DMABUF_ATTRIBS:
return 0;
 
case PIPE_CAP_MAX_VIEWPORTS:
diff --git a/src/gallium/drivers/i915/i915_screen.c 
b/src/gallium/drivers/i915/i915_screen.c
index bfadca3..c918092 100644
--- a/src/gallium/drivers/i915/i915_screen.c
+++ b/src/gallium/drivers/i915/i915_screen.c
@@ -278,6 +278,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap 
cap)
case PIPE_CAP_MAX_WINDOW_RECTANGLES:
case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
+   case PIPE_CAP_QUERY_DMABUF_ATTRIBS:
   return 0;
 
case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS:
diff --git a/src/gallium/drivers/ilo/ilo_screen.c 
b/src/gallium/drivers/ilo/ilo_screen.c
index f3f182c..4b59bb9 100644
--- a/src/gallium/drivers/ilo/ilo_screen.c
+++ b/src/gallium/drivers/ilo/ilo_screen.c
@@ -517,6 +517,7 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap 
param)
case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
+   case PIPE_CAP_QUERY_DMABUF_ATTRIBS:
   return 0;
 
case PIPE_CAP_VENDOR_ID:
diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c 
b/src/gallium/drivers/llvmpipe/lp_screen.c
index 4b502f0..12b8a60 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -338,6 +338,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum 
pipe_cap param)
case PIPE_CAP_MAX_WINDOW_RECTANGLES:
case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
+   case PIPE_CAP_QUERY_DMABUF_ATTRIBS:
   return 0;
}
/* should only get here on unhandled cases */
diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c 
b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
index 96708c0..b871537 100644
--- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
+++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
@@ -203,6 +203,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum 
pipe_cap param)
case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
case PIPE_CAP_MIXED_COLOR_DEPTH_BITS:
case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
+   case PIPE_CAP_QUERY_DMABUF_ATTRIBS:
   return 0;
 
case PIPE_CAP_VENDOR_ID:
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c 
b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
index 50cdeda..f154ae5 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
@@ -255,6 +255,7 @@ nv50_screen_get_param(struct pipe_screen 

[Mesa-dev] [PATCH v2 05/14] dri: support DRIimage creation from dmabufs with modifiers

2016-11-24 Thread Varad Gautam
From: Pekka Paalanen 

add createImageFromDmaBufs2 function which accepts per-plane dmabuf
format modifiers.

Signed-off-by: Pekka Paalanen 
Signed-off-by: Varad Gautam 
---
 include/GL/internal/dri_interface.h | 21 -
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/include/GL/internal/dri_interface.h 
b/include/GL/internal/dri_interface.h
index d0b1bc6..4874e59 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -1094,7 +1094,8 @@ struct __DRIdri2ExtensionRec {
  * extensions.
  */
 #define __DRI_IMAGE "DRI_IMAGE"
-#define __DRI_IMAGE_VERSION 13
+#define __DRI_IMAGE_VERSION 14
+
 
 /**
  * These formats correspond to the similarly named MESA_FORMAT_*
@@ -1420,6 +1421,24 @@ struct __DRIimageExtensionRec {
 */
void (*unmapImage)(__DRIcontext *context, __DRIimage *image, void *data);
 
+   /*
+* Like createImageFromDmaBufs, but takes also format modifiers.
+*
+* For EGL_EXT_image_dma_buf_import_modifiers.
+*
+* \since 14
+*/
+   __DRIimage *(*createImageFromDmaBufs2)(__DRIscreen *screen,
+  int width, int height, int fourcc,
+  int *fds, int num_fds,
+  int *strides, int *offsets,
+  uint64_t *modifiers,
+  enum __DRIYUVColorSpace color_space,
+  enum __DRISampleRange sample_range,
+  enum __DRIChromaSiting horiz_siting,
+  enum __DRIChromaSiting vert_siting,
+  unsigned *error,
+  void *loaderPrivate);
 };
 
 
-- 
2.6.2

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


[Mesa-dev] [PATCH v2 03/14] egl: update eglext.h

2016-11-24 Thread Varad Gautam
From: Varad Gautam 

update eglext.h to revision 33288 from Khronos

Signed-off-by: Varad Gautam 
Reviewed-by: Eric Engestrom 
---
 include/EGL/eglext.h | 60 ++--
 1 file changed, 58 insertions(+), 2 deletions(-)

diff --git a/include/EGL/eglext.h b/include/EGL/eglext.h
index 4ccbab8..762b5a6 100644
--- a/include/EGL/eglext.h
+++ b/include/EGL/eglext.h
@@ -33,12 +33,12 @@ extern "C" {
 ** used to make the header, and the header can be found at
 **   http://www.opengl.org/registry/
 **
-** Khronos $Revision$ on $Date$
+** Khronos $Revision: 33288 $ on $Date: 2016-11-09 17:46:01 -0800 (Wed, 09 Nov 
2016) $
 */
 
 #include 
 
-#define EGL_EGLEXT_VERSION 20160809
+#define EGL_EGLEXT_VERSION 20161109
 
 /* Generated C header for:
  * API: egl
@@ -77,6 +77,13 @@ EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSync64KHR (EGLDisplay 
dpy, EGLenum type,
 #define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR   0x0040
 #endif /* EGL_KHR_config_attribs */
 
+#ifndef EGL_KHR_context_flush_control
+#define EGL_KHR_context_flush_control 1
+#define EGL_CONTEXT_RELEASE_BEHAVIOR_NONE_KHR 0
+#define EGL_CONTEXT_RELEASE_BEHAVIOR_KHR  0x2097
+#define EGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR 0x2098
+#endif /* EGL_KHR_context_flush_control */
+
 #ifndef EGL_KHR_create_context
 #define EGL_KHR_create_context 1
 #define EGL_CONTEXT_MAJOR_VERSION_KHR 0x3098
@@ -343,6 +350,24 @@ EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamu64KHR 
(EGLDisplay dpy, EGLStreamKHR
 #endif /* KHRONOS_SUPPORT_INT64 */
 #endif /* EGL_KHR_stream */
 
+#ifndef EGL_KHR_stream_attrib
+#define EGL_KHR_stream_attrib 1
+#ifdef KHRONOS_SUPPORT_INT64
+typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMATTRIBKHRPROC) 
(EGLDisplay dpy, const EGLAttrib *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETSTREAMATTRIBKHRPROC) (EGLDisplay 
dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMATTRIBKHRPROC) (EGLDisplay 
dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib *value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREATTRIBKHRPROC) 
(EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEATTRIBKHRPROC) 
(EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamAttribKHR (EGLDisplay dpy, 
const EGLAttrib *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglSetStreamAttribKHR (EGLDisplay dpy, 
EGLStreamKHR stream, EGLenum attribute, EGLAttrib value);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamAttribKHR (EGLDisplay dpy, 
EGLStreamKHR stream, EGLenum attribute, EGLAttrib *value);
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireAttribKHR (EGLDisplay 
dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseAttribKHR (EGLDisplay 
dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
+#endif
+#endif /* KHRONOS_SUPPORT_INT64 */
+#endif /* EGL_KHR_stream_attrib */
+
 #ifndef EGL_KHR_stream_consumer_gltexture
 #define EGL_KHR_stream_consumer_gltexture 1
 #ifdef EGL_KHR_stream
@@ -520,6 +545,11 @@ EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurfacePointerANGLE 
(EGLDisplay dpy, EGLSu
 #define EGL_FIXED_SIZE_ANGLE  0x3201
 #endif /* EGL_ANGLE_window_fixed_size */
 
+#ifndef EGL_ARM_implicit_external_sync
+#define EGL_ARM_implicit_external_sync 1
+#define EGL_SYNC_PRIOR_COMMANDS_IMPLICIT_EXTERNAL_ARM 0x328A
+#endif /* EGL_ARM_implicit_external_sync */
+
 #ifndef EGL_ARM_pixmap_multisample_discard
 #define EGL_ARM_pixmap_multisample_discard 1
 #define EGL_DISCARD_SAMPLES_ARM   0x3286
@@ -604,6 +634,27 @@ EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribEXT 
(EGLDisplay dpy, EGLint a
 #define EGL_YUV_CHROMA_SITING_0_5_EXT 0x3285
 #endif /* EGL_EXT_image_dma_buf_import */
 
+#ifndef EGL_EXT_image_dma_buf_import_modifiers
+#define EGL_EXT_image_dma_buf_import_modifiers 1
+#define EGL_DMA_BUF_PLANE3_FD_EXT 0x3440
+#define EGL_DMA_BUF_PLANE3_OFFSET_EXT 0x3441
+#define EGL_DMA_BUF_PLANE3_PITCH_EXT  0x3442
+#define EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT 0x3443
+#define EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT 0x3444
+#define EGL_DMA_BUF_PLANE1_MODIFIER_LO_EXT 0x3445
+#define EGL_DMA_BUF_PLANE1_MODIFIER_HI_EXT 0x3446
+#define EGL_DMA_BUF_PLANE2_MODIFIER_LO_EXT 0x3447
+#define EGL_DMA_BUF_PLANE2_MODIFIER_HI_EXT 0x3448
+#define EGL_DMA_BUF_PLANE3_MODIFIER_LO_EXT 0x3449
+#define EGL_DMA_BUF_PLANE3_MODIFIER_HI_EXT 0x344A
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDMABUFFORMATSEXTPROC) (EGLDisplay 
dpy, EGLint max_formats, EGLint *formats, EGLint *num_formats);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDMABUFMODIFIERSEXTPROC) 
(EGLDisplay dpy, EGLint format, EGLint max_modifiers, EGLuint64KHR *modifiers, 
EGLBoolean *external_only, EGLint 

[Mesa-dev] [PATCH v2 04/14] egl/main: add support for fourth plane tokens

2016-11-24 Thread Varad Gautam
From: Pekka Paalanen 

The EGL_EXT_dma_buf_import_modifiers extension adds support for a
fourth plane, just like DRM KMS API does.

Bump maximum dma_buf plane count to four.

v2: prevent attribute tokens from being parsed if
EXT_image_dma_buf_import_modifiers is not suported. (Emil Velikov)

Signed-off-by: Pekka Paalanen 
Signed-off-by: Varad Gautam 
Reviewed-by: Eric Engestrom 
---
 src/egl/drivers/dri2/egl_dri2.c |  2 +-
 src/egl/main/egldisplay.h   |  1 +
 src/egl/main/eglimage.c | 18 ++
 src/egl/main/eglimage.h |  5 +++--
 4 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 9a41ad0..58d16e1 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -2038,7 +2038,7 @@ dri2_check_dma_buf_format(const _EGLImageAttribs *attrs)
 * "If  is EGL_LINUX_DMA_BUF_EXT, and the EGL_LINUX_DRM_FOURCC_EXT
 *  attribute indicates a single-plane format, EGL_BAD_ATTRIBUTE is
 *  generated if any of the EGL_DMA_BUF_PLANE1_* or EGL_DMA_BUF_PLANE2_*
-*  attributes are specified."
+*  or EGL_DMA_BUF_PLANE3_* attributes are specified."
 */
for (i = plane_n; i < DMA_BUF_MAX_PLANES; ++i) {
   if (attrs->DMABufPlaneFds[i].IsPresent ||
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index 62d9a11..7a59dc5 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -101,6 +101,7 @@ struct _egl_extensions
EGLBoolean EXT_buffer_age;
EGLBoolean EXT_create_context_robustness;
EGLBoolean EXT_image_dma_buf_import;
+   EGLBoolean EXT_image_dma_buf_import_modifiers;
EGLBoolean EXT_swap_buffers_with_damage;
 
EGLBoolean KHR_cl_event2;
diff --git a/src/egl/main/eglimage.c b/src/egl/main/eglimage.c
index 411d1ca..e339b3b 100644
--- a/src/egl/main/eglimage.c
+++ b/src/egl/main/eglimage.c
@@ -133,6 +133,24 @@ _eglParseImageAttribList(_EGLImageAttribs *attrs, 
_EGLDisplay *dpy,
  attrs->DMABufPlanePitches[2].Value = val;
  attrs->DMABufPlanePitches[2].IsPresent = EGL_TRUE;
  break;
+  case EGL_DMA_BUF_PLANE3_FD_EXT:
+ if (!dpy->Extensions.EXT_image_dma_buf_import_modifiers)
+err = EGL_BAD_PARAMETER;
+ attrs->DMABufPlaneFds[3].Value = val;
+ attrs->DMABufPlaneFds[3].IsPresent = EGL_TRUE;
+ break;
+  case EGL_DMA_BUF_PLANE3_OFFSET_EXT:
+ if (!dpy->Extensions.EXT_image_dma_buf_import_modifiers)
+err = EGL_BAD_PARAMETER;
+ attrs->DMABufPlaneOffsets[3].Value = val;
+ attrs->DMABufPlaneOffsets[3].IsPresent = EGL_TRUE;
+ break;
+  case EGL_DMA_BUF_PLANE3_PITCH_EXT:
+ if (!dpy->Extensions.EXT_image_dma_buf_import_modifiers)
+err = EGL_BAD_PARAMETER;
+ attrs->DMABufPlanePitches[3].Value = val;
+ attrs->DMABufPlanePitches[3].IsPresent = EGL_TRUE;
+ break;
   case EGL_YUV_COLOR_SPACE_HINT_EXT:
  if (val != EGL_ITU_REC601_EXT && val != EGL_ITU_REC709_EXT &&
  val != EGL_ITU_REC2020_EXT) {
diff --git a/src/egl/main/eglimage.h b/src/egl/main/eglimage.h
index 9a75d0c..a909d9b 100644
--- a/src/egl/main/eglimage.h
+++ b/src/egl/main/eglimage.h
@@ -46,7 +46,7 @@ struct _egl_image_attrib_int
EGLBoolean IsPresent;
 };
 
-#define DMA_BUF_MAX_PLANES 3
+#define DMA_BUF_MAX_PLANES 4
 
 struct _egl_image_attribs
 {
@@ -67,7 +67,8 @@ struct _egl_image_attribs
/* EGL_WL_bind_wayland_display */
EGLint PlaneWL;
 
-   /* EGL_EXT_image_dma_buf_import */
+   /* EGL_EXT_image_dma_buf_import and
+* EGL_EXT_image_dma_buf_import_modifiers */
struct _egl_image_attrib_int DMABufFourCC;
struct _egl_image_attrib_int DMABufPlaneFds[DMA_BUF_MAX_PLANES];
struct _egl_image_attrib_int DMABufPlaneOffsets[DMA_BUF_MAX_PLANES];
-- 
2.6.2

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


[Mesa-dev] [PATCH v2 01/14] egl: return error for unknown EGLImage attributes

2016-11-24 Thread Varad Gautam
From: Pekka Paalanen 

Commit 0135e5d6c83add5e539492a4899504e33f3f2434 "egl: Add support for
more EGLImage extensions to EGL core." removed an error code for unknown
EGLImage attributes without explaining why.

EGL_KHR_image_base says:

   * If an attribute specified in  is not one of the
 attributes listed in Table bbb, the error EGL_BAD_PARAMETER is
 generated.

Implement this.

Signed-off-by: Pekka Paalanen 
Signed-off-by: Varad Gautam 
Reviewed-by: Eric Engestrom 
CC: 
---
 src/egl/main/eglimage.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/egl/main/eglimage.c b/src/egl/main/eglimage.c
index 818b597..411d1ca 100644
--- a/src/egl/main/eglimage.c
+++ b/src/egl/main/eglimage.c
@@ -170,7 +170,7 @@ _eglParseImageAttribList(_EGLImageAttribs *attrs, 
_EGLDisplay *dpy,
  break;
 
   default:
- /* unknown attrs are ignored */
+ err = EGL_BAD_PARAMETER;
  break;
   }
 
-- 
2.6.2

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


[Mesa-dev] [PATCH v2 00/14] implement EGL_EXT_image_dma_buf_import_modifiers v2

2016-11-24 Thread Varad Gautam
This is the second revision to the EGL_EXT_image_dma_buf_import_modifiers [1]
series at [2], addressing the comments received. This diverges from v1 due to
some reordered/squashed changes, hence the resend.

Major modifications include:
* Both format and modifier queries are now handled in the driver, instead of
advertising all formats as supported by all drivers, and exposed under a
common PIPE_CAP_QUERY_DMABUF_ATTRIBS flag.
* The implementation makes sure that the same modifier is passed for all planes
used for EGLImage creation.

[1] 
https://www.khronos.org/registry/egl/extensions/EXT/EGL_EXT_image_dma_buf_import_modifiers.txt
[2] https://patchwork.freedesktop.org/series/15348/

Pekka Paalanen (4):
  egl: return error for unknown EGLImage attributes
  egl: introduce DMA_BUF_MAX_PLANES
  egl/main: add support for fourth plane tokens
  dri: support DRIimage creation from dmabufs with modifiers

Varad Gautam (10):
  egl: update eglext.h
  st/dri: implement DRIimage creation from dmabufs with modifiers
  egl_dri2: add support for using modifier attributes in
eglCreateImageKHR
  dri: add queryDmaBufFormats and queryDmaBufModifiers to DRIimage
  gallium: introduce dmabuf format and modifier querying
  st/dri: support format queries
  egl: implement eglQueryDmaBufFormatsEXT
  st/dri: support format modifier queries
  egl: implement eglQueryDmaBufModifiersEXT
  egl: advertise EGL_EXT_image_dma_buf_import_modifiers

 include/EGL/eglext.h |  60 -
 include/GL/internal/dri_interface.h  |  41 +-
 src/egl/drivers/dri2/egl_dri2.c  | 158 ---
 src/egl/main/eglapi.c|  41 ++
 src/egl/main/eglapi.h|   9 ++
 src/egl/main/egldisplay.h|   1 +
 src/egl/main/eglimage.c  |  68 +-
 src/egl/main/eglimage.h  |  13 +-
 src/gallium/docs/source/screen.rst   |   2 +
 src/gallium/drivers/freedreno/freedreno_screen.c |   1 +
 src/gallium/drivers/i915/i915_screen.c   |   1 +
 src/gallium/drivers/ilo/ilo_screen.c |   1 +
 src/gallium/drivers/llvmpipe/lp_screen.c |   1 +
 src/gallium/drivers/nouveau/nv30/nv30_screen.c   |   1 +
 src/gallium/drivers/nouveau/nv50/nv50_screen.c   |   1 +
 src/gallium/drivers/nouveau/nvc0/nvc0_screen.c   |   1 +
 src/gallium/drivers/r300/r300_screen.c   |   1 +
 src/gallium/drivers/r600/r600_pipe.c |   1 +
 src/gallium/drivers/radeonsi/si_pipe.c   |   1 +
 src/gallium/drivers/softpipe/sp_screen.c |   1 +
 src/gallium/drivers/svga/svga_screen.c   |   1 +
 src/gallium/drivers/swr/swr_screen.cpp   |   1 +
 src/gallium/drivers/vc4/vc4_screen.c |   1 +
 src/gallium/drivers/virgl/virgl_screen.c |   1 +
 src/gallium/include/pipe/p_defines.h |   1 +
 src/gallium/include/pipe/p_screen.h  |  20 +++
 src/gallium/include/state_tracker/drm_driver.h   |   2 +
 src/gallium/state_trackers/dri/dri2.c|  78 ++-
 28 files changed, 481 insertions(+), 28 deletions(-)

-- 
2.6.2

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


Re: [Mesa-dev] [PATCH] anv/state: if enabled, use anisotropic filtering also with VK_FILTER_NEAREST

2016-11-24 Thread Iago Toral
On Thu, 2016-11-24 at 14:33 +0100, Iago Toral wrote:
> Hi Lionel,
> 
> On Thu, 2016-11-24 at 13:08 +, Lionel Landwerlin wrote:
> > 
> > Hi Iago,
> > 
> > Looking at the history, before
> > ed4fe3e9ba9018e68afe6fdd4f267218a537fdaa 
> > we seem to set min/mag filter to MAPFILTER_ANISOTROPIC if
> > maxAnisotropy 
> >  > 1. It seems your patch makes sense in using
> > MAPFILTER_ANISOTROPIC
> > in 
> > the NEAREST case, but I wonder whether we should also check for 
> > maxAnisotropy > 1.
> Right, good catch, although I think that if we do that it should be a
> separate change since we are not currently checking that for the
> linear
> filter either.
> 
> It seems that we do check for this in OpenGL so I think we probably
> should do that here as well unless Jason dropped it for Vulkan on
> purpose for some reason in that commit.
> 
> I'll send a separate patch for this after I confirm that it does not
> alter the results for the tests in CTS if we add that check.

Actually, thinking about this a bit more, I don't think we need  That
commit is about honoring SamplerCreateInfo.anisotropyEnable to decide
whether to activate anisotropic filtering, so if that is true we want
to use that. Notice that since that commit we clamp the anisotropy
ratio to ensure it is in a valid range. If we pass a maxAnisotropy
value < 1, it will clamp it to the minimum value we can work with, so I
think Jason did that change on purpose.

Sounds reasonable?

> Iago
> 
> > 
> > On 24/11/16 11:30, Iago Toral Quiroga wrote:
> > > 
> > > 
> > > Fixes multiple Vulkan CTS tests that combine anisotropy and
> > > VK_FILTER_NEAREST
> > > in dEQP-VK.texture.filtering_anisotropy.*
> > > ---
> > >   src/intel/vulkan/genX_state.c | 2 +-
> > >   1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/src/intel/vulkan/genX_state.c
> > > b/src/intel/vulkan/genX_state.c
> > > index 4122395..0f621f9 100644
> > > --- a/src/intel/vulkan/genX_state.c
> > > +++ b/src/intel/vulkan/genX_state.c
> > > @@ -101,7 +101,7 @@ vk_to_gen_tex_filter(VkFilter filter, bool
> > > anisotropyEnable)
> > >  default:
> > > assert(!"Invalid filter");
> > >  case VK_FILTER_NEAREST:
> > > -  return MAPFILTER_NEAREST;
> > > +  return anisotropyEnable ? MAPFILTER_ANISOTROPIC :
> > > MAPFILTER_NEAREST;
> > >  case VK_FILTER_LINEAR:
> > > return anisotropyEnable ? MAPFILTER_ANISOTROPIC :
> > > MAPFILTER_LINEAR;
> > >  }
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] i915: Add XRGB8888 format to intel_screen_make_configs

2016-11-24 Thread Emil Velikov
On 24 November 2016 at 06:22, Boyan Ding  wrote:
> 2016-11-24 13:29 GMT+08:00 Derek Foreman :
>> On 23/11/16 07:18 PM, Boyan Ding wrote:
>>>
>>> 2016-11-24 7:01 GMT+08:00 Derek Foreman :

 This is a copy of commit 536003c11e4cb1172c540932ce3cce06f03bf44e
 except for i915.

 Original log for the i965 commit follows:

  Some application, such as drm backend of weston, uses XRGB config as
  default. i965 doesn't provide this format, but before commit 65c8965d,
  the drm platform of EGL takes ARGB as XRGB. Now that commit
  65c8965d makes EGL recognize format correctly so weston won't start
  because it can't find XRGB. Add XRGB format to i965 just as
  other drivers do.

 Signed-off-by: Derek Foreman 
 ---
  src/mesa/drivers/dri/i915/intel_screen.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

 diff --git a/src/mesa/drivers/dri/i915/intel_screen.c
 b/src/mesa/drivers/dri/i915/intel_screen.c
 index 1b80df0..5c7c06a 100644
 --- a/src/mesa/drivers/dri/i915/intel_screen.c
 +++ b/src/mesa/drivers/dri/i915/intel_screen.c
 @@ -1044,7 +1044,8 @@ intel_screen_make_configs(__DRIscreen *dri_screen)
  {
 static const mesa_format formats[] = {
MESA_FORMAT_B5G6R5_UNORM,
 -  MESA_FORMAT_B8G8R8A8_UNORM
 +  MESA_FORMAT_B8G8R8A8_UNORM,
 +  MESA_FORMAT_B8G8R8X8_UNORM
 };

 /* GLX_SWAP_COPY_OML is not supported due to page flipping. */
 --
 2.10.2

>>>
>>> Hi Derek,
>>>
>>> I sent exactly the same patch one and half years ago at [1], but
>>> withdrew it because it seems no one got interested in that and I don't
>>> have the hardware to test. If you're sure it is correct, this gets my
>>>
>>> Acked-by: Boyan Ding 
>>
>>
>> I'm sorry, I didn't see your patch.  It makes more sense to me that I give
>> you my RB on that patch in place of your Ack on mine.  I don't want to take
>> credit for a problem you solved over a year ago. :)
>>
>> I don't have appropriate hardware but this has been tested for me by an
>> Enlightenment user who was unable to use our GL backend because it's trying
>> to use XRGB.
>>
>> Weston ran for him but logged a warning about falling back to an ARGB
>> visual, which led me to the discovery that this had only been changed for
>> i965.
>>
>> I'll try to get him to reply with a "Tested-by" tomorrow.
>>
>>
>
> Thanks for the kind reply, but I wonder if a more thorough testing
> should be done before applying this. I remember its i965 counterpart
> (commit 28090b30d) did cause some problem (Bug 90791) although it seems
> not the fault on its own.
>
> We're facing the same problem I faced last year when posting this
> patch -- I didn't have the authority to say that it was okay, and I
> didn't have the hardware to test on as Emil once suggested[1].
>
Precisely - the patch on it's own was perfectly reasonable but it will
likely cause issues like i965 one.

Derek, skimming through the i965 history a very lengthy list of
regressions/fixes comes up[1] as the format was advertised as
supported.

Considering we don't get much testing, it would be great to avoid
breaking the world by fixing EGL/drm users (Wayland compositors,
other).

Ian, Mark Janes,
Gents, do you have the hardware/chance to test this patch ?

Thanks
Emil

[1]
28090b30dd6b5977de085f48c620574214b6b4ba i965: Add XRGB format to
intel_screen_make_configs
* Adds the format since things broke as EGL/drm was fixed to correctly
honour the formats commit 65c8965d033 (egl: Take alpha bits into
account when selecting GBM formats)

8da79b8378ae87474d8c47ad955e4833edf98359 i965: Fix HW blitter pitch limits
c2d0606827412b710dcaed80268fc665de8c9c5d i915: Blit RGBX<->RGBA
drawpixels // should read i965
922c0c9fd526ce19b87bc74a3159dec7705c1de1 i965: Export format
comparison for blitting between miptrees
* Fixes serious performance issue due to the extra format.

bd38f91f8d80897ca91979962d80d4bc0acef586 i965: do_blit_drawpixels:
decode array formats
* Fixes the last commit above

2cebaac479d49cd6df4e97b466ba14bab3f30db1 i965: Don't use tiled_memcpy
to download from RGBX or BGRX surfaces
* Disable those since it causes regressions

3f10774cbab1e803f8aa3d6d24f8f6f98b8128c3 i965: Check base format to
determine whether to use tiled memcpy
* Aims to rework/fix the above.

c769efda939e06338d41e1046a5f954c690951d5 i965: Add
MESA_FORMAT_B8G8R8X8_SRGB to brw_format_for_mesa_format
43f4be5f06b7a96b96a3a7b43f5112139a1f423a i965: Add B8G8R8X8_SRGB to
the alpha format override
839793680f99b8387bee9489733d5071c10f3ace i965: Use
MESA_FORMAT_B8G8R8X8_SRGB for RGB visuals
* Aim to rework/fix the mesa <> hardware format mappings as a side
effect of the new XRGB advertised

61cdb7665f7bd147533cdc5977750d990c2eafd5 Revert "i965: Use
MESA_FORMAT_B8G8R8X8_SRGB 

Re: [Mesa-dev] [v2] i965: Fast color clear for mipmapped and arrayed

2016-11-24 Thread Pohjolainen, Topi
On Wed, Nov 23, 2016 at 11:15:59AM +0200, Topi Pohjolainen wrote:
> This is a rebase on top recent changes by Jason and Lionel. While
> things have changed quite a bit in some of the patches they have
> mostly become clearer.
> 2.5.5

I handpicked and sent v3 for patches that went thru significant changes. The
entire rebased series can be found in:

git://people.freedesktop.org/~tpohjola/mesa:fast_lod_isl
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [v3 08/17] i965: Add plumbing for fast clear layer/level details

2016-11-24 Thread Topi Pohjolainen
Until now fast clear has been supported only for non-layered and
non-mipmapped buffers. However, from gen8 onwards there is hardware
support also for layered/mipmapped. Once this is enabled, fast clear
operations target specific layer/level and call for the state to be
tracked in the same granularity. This is the first step providing
the details from callers to the state tracking.

Patch introduces new interface for reading and writing the state
hiding the upcoming bookkeeping changes in the call sites. There is
bunch of sanity checks added that will be relaxed per hardware
generation later on when the actual functionality is enabled.

v2: Rebased on top current master setting the state in
blorp_surf_for_miptree().
v3: Replace open-coded resolved check in surface state emission
with intel_miptree_has_color_unresolved().

Signed-off-by: Topi Pohjolainen 
Reviewed-by: Jason Ekstrand  (v1)
---
 src/mesa/drivers/dri/i965/brw_blorp.c| 18 
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 35 +++-
 2 files changed, 34 insertions(+), 19 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c 
b/src/mesa/drivers/dri/i965/brw_blorp.c
index bdc36fa..67f4cce 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.c
+++ b/src/mesa/drivers/dri/i965/brw_blorp.c
@@ -216,7 +216,8 @@ blorp_surf_for_miptree(struct brw_context *brw,
  intel_miptree_resolve_color(brw, mt,
  *level, start_layer, num_layers, flags);
 
- assert(mt->fast_clear_state == INTEL_FAST_CLEAR_STATE_RESOLVED);
+ assert(!intel_miptree_has_color_unresolved(mt, *level, 1,
+start_layer, num_layers));
  surf->aux_usage = ISL_AUX_USAGE_NONE;
   }
}
@@ -811,8 +812,12 @@ do_single_blorp_clear(struct brw_context *brw, struct 
gl_framebuffer *fb,
!brw_is_color_fast_clear_compatible(brw, irb->mt, 
>Color.ClearColor))
   can_fast_clear = false;
 
+   const unsigned logical_layer = irb_logical_mt_layer(irb);
const bool is_lossless_compressed = intel_miptree_is_lossless_compressed(
   brw, irb->mt);
+   const enum intel_fast_clear_state fast_clear_state =
+  intel_miptree_get_fast_clear_state(irb->mt, irb->mt_level,
+ logical_layer);
 
if (can_fast_clear) {
   union gl_color_union override_color =
@@ -830,8 +835,7 @@ do_single_blorp_clear(struct brw_context *brw, struct 
gl_framebuffer *fb,
   /* If the buffer is already in INTEL_FAST_CLEAR_STATE_CLEAR, the clear
* is redundant and can be skipped.
*/
-  if (!color_updated &&
-  irb->mt->fast_clear_state == INTEL_FAST_CLEAR_STATE_CLEAR)
+  if (!color_updated && fast_clear_state == INTEL_FAST_CLEAR_STATE_CLEAR)
  return true;
 
   /* If the MCS buffer hasn't been allocated yet, we need to allocate
@@ -849,7 +853,6 @@ do_single_blorp_clear(struct brw_context *brw, struct 
gl_framebuffer *fb,
   }
}
 
-   const unsigned logical_layer = irb_logical_mt_layer(irb);
const unsigned num_layers = fb->MaxNumLayers ? irb->layer_count : 1;
 
/* We can't setup the blorp_surf until we've allocated the MCS above */
@@ -878,7 +881,9 @@ do_single_blorp_clear(struct brw_context *brw, struct 
gl_framebuffer *fb,
* INTEL_FAST_CLEAR_STATE_CLEAR so that we won't waste time doing
* redundant clears.
*/
-  irb->mt->fast_clear_state = INTEL_FAST_CLEAR_STATE_CLEAR;
+  intel_miptree_set_fast_clear_state(irb->mt, irb->mt_level,
+ logical_layer, num_layers,
+ INTEL_FAST_CLEAR_STATE_CLEAR);
} else {
   DBG("%s (slow) to mt %p level %d layer %d+%d\n", __FUNCTION__,
   irb->mt, irb->mt_level, irb->mt_layer, num_layers);
@@ -965,7 +970,8 @@ brw_blorp_resolve_color(struct brw_context *brw, struct 
intel_mipmap_tree *mt,
  resolve_op);
blorp_batch_finish();
 
-   mt->fast_clear_state = INTEL_FAST_CLEAR_STATE_RESOLVED;
+   intel_miptree_set_fast_clear_state(mt, level, layer, 1,
+  INTEL_FAST_CLEAR_STATE_RESOLVED);
 }
 
 static void
diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c 
b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index ec434c7..6c44381 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -441,20 +441,23 @@ brw_find_matching_rb(const struct gl_framebuffer *fb,
 
 static inline bool
 brw_texture_view_sane(const struct brw_context *brw,
-  const struct intel_mipmap_tree *mt, unsigned format)
+  const struct intel_mipmap_tree *mt,
+  const struct isl_view *view)
 {
/* There are special cases only for lossless 

[Mesa-dev] [v3 11/17] i965: Track fast color clear state in level/layer granularity

2016-11-24 Thread Topi Pohjolainen
Note that RESOLVED is not tracked in the map explicitly. Absence
of item implicitly means RESOLVED state.

v2: Added intel_resolve_map_clear() into intel_miptree_release()
v3 (Jason): Properly handle the assumption of resolve map not
containing any items with state RESOLVED. Removed
unnecessary intel_miptree_set_fast_clear_state() call
in brw_blorp_resolve_color() preventing
intel_miptree_set_fast_clear_state() from asserting
against RESOLVED.

Signed-off-by: Topi Pohjolainen 
Reviewed-by: Jason Ekstrand  (v1)
---
 src/mesa/drivers/dri/i965/brw_blorp.c |  3 -
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 79 ---
 src/mesa/drivers/dri/i965/intel_mipmap_tree.h | 16 +++---
 3 files changed, 68 insertions(+), 30 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c 
b/src/mesa/drivers/dri/i965/brw_blorp.c
index 67f4cce..d900e15 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.c
+++ b/src/mesa/drivers/dri/i965/brw_blorp.c
@@ -969,9 +969,6 @@ brw_blorp_resolve_color(struct brw_context *brw, struct 
intel_mipmap_tree *mt,
  brw_blorp_to_isl_format(brw, format, true),
  resolve_op);
blorp_batch_finish();
-
-   intel_miptree_set_fast_clear_state(mt, level, layer, 1,
-  INTEL_FAST_CLEAR_STATE_RESOLVED);
 }
 
 static void
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c 
b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index a5913bc..d629901 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -397,11 +397,11 @@ intel_miptree_create_layout(struct brw_context *brw,
mt->logical_width0 = width0;
mt->logical_height0 = height0;
mt->logical_depth0 = depth0;
-   mt->fast_clear_state = INTEL_FAST_CLEAR_STATE_RESOLVED;
mt->disable_aux_buffers = (layout_flags & MIPTREE_LAYOUT_DISABLE_AUX) != 0;
mt->no_ccs = true;
mt->is_scanout = (layout_flags & MIPTREE_LAYOUT_FOR_SCANOUT) != 0;
exec_list_make_empty(>hiz_map);
+   exec_list_make_empty(>color_resolve_map);
mt->cpp = _mesa_get_format_bytes(format);
mt->num_samples = num_samples;
mt->compressed = _mesa_is_format_compressed(format);
@@ -933,7 +933,7 @@ intel_update_winsys_renderbuffer_miptree(struct brw_context 
*intel,
 */
if (intel_tiling_supports_non_msrt_mcs(intel, singlesample_mt->tiling) &&
intel_miptree_supports_non_msrt_fast_clear(intel, singlesample_mt)) {
-  singlesample_mt->fast_clear_state = INTEL_FAST_CLEAR_STATE_RESOLVED;
+  singlesample_mt->no_ccs = false;
}
 
if (num_samples == 0) {
@@ -1048,6 +1048,7 @@ intel_miptree_release(struct intel_mipmap_tree **mt)
  free((*mt)->mcs_buf);
   }
   intel_resolve_map_clear(&(*mt)->hiz_map);
+  intel_resolve_map_clear(&(*mt)->color_resolve_map);
 
   intel_miptree_release(&(*mt)->plane[0]);
   intel_miptree_release(&(*mt)->plane[1]);
@@ -1633,7 +1634,12 @@ intel_miptree_alloc_mcs(struct brw_context *brw,
   return false;
 
intel_miptree_init_mcs(brw, mt, 0xFF);
-   mt->fast_clear_state = INTEL_FAST_CLEAR_STATE_CLEAR;
+
+   /* Multisampled miptrees are only supported for single level. */
+   assert(mt->first_level == 0);
+   intel_miptree_set_fast_clear_state(mt, mt->first_level, 0,
+  mt->logical_depth0,
+  INTEL_FAST_CLEAR_STATE_CLEAR);
 
return true;
 }
@@ -1713,7 +1719,6 @@ intel_miptree_alloc_non_msrt_mcs(struct brw_context *brw,
*Software needs to initialize MCS with zeros."
*/
   intel_miptree_init_mcs(brw, mt, 0);
-  mt->fast_clear_state = INTEL_FAST_CLEAR_STATE_RESOLVED;
   mt->msaa_layout = INTEL_MSAA_LAYOUT_CMS;
}
 
@@ -2209,7 +2214,15 @@ enum intel_fast_clear_state
 intel_miptree_get_fast_clear_state(const struct intel_mipmap_tree *mt,
unsigned level, unsigned layer)
 {
-   return mt->fast_clear_state;
+   intel_miptree_check_level_layer(mt, level, layer);
+
+   const struct intel_resolve_map *item =
+  intel_resolve_map_const_get(>color_resolve_map, level, layer);
+
+   if (!item)
+  return INTEL_FAST_CLEAR_STATE_RESOLVED;
+
+   return item->fast_clear_state;
 }
 
 static void
@@ -2240,11 +2253,18 @@ intel_miptree_set_fast_clear_state(struct 
intel_mipmap_tree *mt,
unsigned num_layers,
enum intel_fast_clear_state new_state)
 {
+   /* Setting the state to resolved means removing the item from the list
+* altogether.
+*/
+   assert(new_state != INTEL_FAST_CLEAR_STATE_RESOLVED);
+
intel_miptree_check_color_resolve(mt, level, first_layer);
 
assert(first_layer + num_layers <= mt->physical_depth0);
 
-   mt->fast_clear_state = new_state;
+   for (unsigned i = 0; i < 

[Mesa-dev] [v3 14/17] i965: Use ISL for CCS layouts

2016-11-24 Thread Topi Pohjolainen
One can now also delete intel_get_non_msrt_mcs_alignment().

v2 (Jason): Do not leak aux buf but allocate only after getting
ISL surfaces.

Signed-off-by: Topi Pohjolainen 
---
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 138 +++---
 src/mesa/drivers/dri/i965/intel_mipmap_tree.h |   4 -
 2 files changed, 38 insertions(+), 104 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c 
b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index d629901..d061cd4 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -101,66 +101,6 @@ compute_msaa_layout(struct brw_context *brw, mesa_format 
format,
}
 }
 
-
-/**
- * For single-sampled render targets ("non-MSRT"), the MCS buffer is a
- * scaled-down bitfield representation of the color buffer which is capable of
- * recording when blocks of the color buffer are equal to the clear value.
- * This function returns the block size that will be used by the MCS buffer
- * corresponding to a certain color miptree.
- *
- * From the Ivy Bridge PRM, Vol2 Part1 11.7 "MCS Buffer for Render Target(s)",
- * beneath the "Fast Color Clear" bullet (p327):
- *
- * The following table describes the RT alignment
- *
- *   Pixels  Lines
- * TiledY RT CL
- * bpp
- *  32  8  4
- *  64  4  4
- * 128  2  4
- * TiledX RT CL
- * bpp
- *  32 16  2
- *  64  8  2
- * 128  4  2
- *
- * This alignment has the following uses:
- *
- * - For figuring out the size of the MCS buffer.  Each 4k tile in the MCS
- *   buffer contains 128 blocks horizontally and 256 blocks vertically.
- *
- * - For figuring out alignment restrictions for a fast clear operation.  Fast
- *   clear operations must always clear aligned multiples of 16 blocks
- *   horizontally and 32 blocks vertically.
- *
- * - For scaling down the coordinates sent through the render pipeline during
- *   a fast clear.  X coordinates must be scaled down by 8 times the block
- *   width, and Y coordinates by 16 times the block height.
- *
- * - For scaling down the coordinates sent through the render pipeline during
- *   a "Render Target Resolve" operation.  X coordinates must be scaled down
- *   by half the block width, and Y coordinates by half the block height.
- */
-void
-intel_get_non_msrt_mcs_alignment(const struct intel_mipmap_tree *mt,
- unsigned *width_px, unsigned *height)
-{
-   switch (mt->tiling) {
-   default:
-  unreachable("Non-MSRT MCS requires X or Y tiling");
-  /* In release builds, fall through */
-   case I915_TILING_Y:
-  *width_px = 32 / mt->cpp;
-  *height = 4;
-  break;
-   case I915_TILING_X:
-  *width_px = 64 / mt->cpp;
-  *height = 2;
-   }
-}
-
 bool
 intel_tiling_supports_non_msrt_mcs(const struct brw_context *brw,
unsigned tiling)
@@ -1654,55 +1594,53 @@ intel_miptree_alloc_non_msrt_mcs(struct brw_context 
*brw,
assert(!mt->disable_aux_buffers);
assert(!mt->no_ccs);
 
-   /* The format of the MCS buffer is opaque to the driver; all that matters
-* is that we get its size and pitch right.  We'll pretend that the format
-* is R32.  Since an MCS tile covers 128 blocks horizontally, and a Y-tiled
-* R32 buffer is 32 pixels across, we'll need to scale the width down by
-* the block width and then a further factor of 4.  Since an MCS tile
-* covers 256 blocks vertically, and a Y-tiled R32 buffer is 32 rows high,
-* we'll need to scale the height down by the block height and then a
-* further factor of 8.
-*/
-   const mesa_format format = MESA_FORMAT_R_UINT32;
-   unsigned block_width_px;
-   unsigned block_height;
-   intel_get_non_msrt_mcs_alignment(mt, _width_px, _height);
-   unsigned width_divisor = block_width_px * 4;
-   unsigned height_divisor = block_height * 8;
-
-   /* The Skylake MCS is twice as tall as the Broadwell MCS.
-*
-* In pre-Skylake, each bit in the MCS contained the state of 2 cachelines
-* in the main surface. In Skylake, it's two bits.  The extra bit
-* doubles the MCS height, not width, because in Skylake the MCS is always
-* Y-tiled.
+   struct isl_surf temp_main_surf;
+   struct isl_surf temp_ccs_surf;
+
+   /* Create first an ISL presentation for the main color surface and let ISL
+* calculate equivalent CCS surface against it.
 */
-   if (brw->gen >= 9)
-  height_divisor /= 2;
+   intel_miptree_get_isl_surf(brw, mt, _main_surf);
+   if (!isl_surf_get_ccs_surf(>isl_dev, _main_surf, _ccs_surf))
+  return false;
+
+   assert(temp_ccs_surf.size &&
+  (temp_ccs_surf.size % temp_ccs_surf.row_pitch == 0));
+
+   struct intel_miptree_aux_buffer *buf = calloc(sizeof(*buf), 

[Mesa-dev] [v3 04/17] i965: Provide slice details to color resolver

2016-11-24 Thread Topi Pohjolainen
v2: Make intel_miptree_resolve_color() take start layer and
layer count.

Signed-off-by: Topi Pohjolainen 
---
 src/mesa/drivers/dri/i965/brw_blorp.c | 13 ++-
 src/mesa/drivers/dri/i965/brw_blorp.h |  3 ++-
 src/mesa/drivers/dri/i965/brw_context.c   | 14 +++-
 src/mesa/drivers/dri/i965/intel_blit.c|  4 ++--
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 32 ---
 src/mesa/drivers/dri/i965/intel_mipmap_tree.h |  3 ++-
 6 files changed, 51 insertions(+), 18 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c 
b/src/mesa/drivers/dri/i965/brw_blorp.c
index 556f2c0..8020a95 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.c
+++ b/src/mesa/drivers/dri/i965/brw_blorp.c
@@ -213,7 +213,8 @@ blorp_surf_for_miptree(struct brw_context *brw,
  if (safe_aux_usage & (1 << ISL_AUX_USAGE_CCS_E))
 flags |= INTEL_MIPTREE_IGNORE_CCS_E;
 
- intel_miptree_resolve_color(brw, mt, flags);
+ intel_miptree_resolve_color(brw, mt,
+ *level, start_layer, num_layers, flags);
 
  assert(mt->fast_clear_state == INTEL_FAST_CLEAR_STATE_RESOLVED);
  surf->aux_usage = ISL_AUX_USAGE_NONE;
@@ -929,19 +930,19 @@ brw_blorp_clear_color(struct brw_context *brw, struct 
gl_framebuffer *fb,
 }
 
 void
-brw_blorp_resolve_color(struct brw_context *brw, struct intel_mipmap_tree *mt)
+brw_blorp_resolve_color(struct brw_context *brw, struct intel_mipmap_tree *mt,
+unsigned level, unsigned layer)
 {
-   DBG("%s to mt %p\n", __FUNCTION__, mt);
+   DBG("%s to mt %p level %u layer %u\n", __FUNCTION__, mt, level, layer);
 
const mesa_format format = _mesa_get_srgb_format_linear(mt->format);
 
struct isl_surf isl_tmp[2];
struct blorp_surf surf;
-   unsigned level = 0;
blorp_surf_for_miptree(brw, , mt, true,
   (1 << ISL_AUX_USAGE_CCS_E) |
   (1 << ISL_AUX_USAGE_CCS_D),
-  , 0 /* start_layer */, 1 /* num_layers */,
+  , layer, 1 /* num_layers */,
   isl_tmp);
 
enum blorp_fast_clear_op resolve_op;
@@ -958,7 +959,7 @@ brw_blorp_resolve_color(struct brw_context *brw, struct 
intel_mipmap_tree *mt)
 
struct blorp_batch batch;
blorp_batch_init(>blorp, , brw, 0);
-   blorp_ccs_resolve(, , 0 /* level */, 0 /* layer */,
+   blorp_ccs_resolve(, , level, layer,
  brw_blorp_to_isl_format(brw, format, true),
  resolve_op);
blorp_batch_finish();
diff --git a/src/mesa/drivers/dri/i965/brw_blorp.h 
b/src/mesa/drivers/dri/i965/brw_blorp.h
index abf3956..277b00e 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.h
+++ b/src/mesa/drivers/dri/i965/brw_blorp.h
@@ -64,7 +64,8 @@ brw_blorp_clear_color(struct brw_context *brw, struct 
gl_framebuffer *fb,
 
 void
 brw_blorp_resolve_color(struct brw_context *brw,
-struct intel_mipmap_tree *mt);
+struct intel_mipmap_tree *mt,
+unsigned level, unsigned layer);
 
 void
 intel_hiz_exec(struct brw_context *brw, struct intel_mipmap_tree *mt,
diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
b/src/mesa/drivers/dri/i965/brw_context.c
index 3f88f7f..6aeb12d 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -316,8 +316,9 @@ intel_update_state(struct gl_context * ctx, GLuint 
new_state)
 intel_renderbuffer(fb->_ColorDrawBuffers[i]);
 
  if (irb &&
- intel_miptree_resolve_color(brw, irb->mt,
- INTEL_MIPTREE_IGNORE_CCS_E))
+ intel_miptree_resolve_color(
+brw, irb->mt, irb->mt_level, irb->mt_layer, irb->layer_count,
+INTEL_MIPTREE_IGNORE_CCS_E))
 brw_render_cache_set_check_flush(brw, irb->mt->bo);
   }
}
@@ -1349,10 +1350,13 @@ intel_resolve_for_dri2_flush(struct brw_context *brw,
   rb = intel_get_renderbuffer(fb, buffers[i]);
   if (rb == NULL || rb->mt == NULL)
  continue;
-  if (rb->mt->num_samples <= 1)
- intel_miptree_resolve_color(brw, rb->mt, 0);
-  else
+  if (rb->mt->num_samples <= 1) {
+ assert(rb->mt_layer == 0 && rb->mt_level == 0 &&
+rb->layer_count == 1);
+ intel_miptree_resolve_color(brw, rb->mt, 0, 0, 1, 0);
+  } else {
  intel_renderbuffer_downsample(brw, rb);
+  }
}
 }
 
diff --git a/src/mesa/drivers/dri/i965/intel_blit.c 
b/src/mesa/drivers/dri/i965/intel_blit.c
index 7e97fbc..4944b8c 100644
--- a/src/mesa/drivers/dri/i965/intel_blit.c
+++ b/src/mesa/drivers/dri/i965/intel_blit.c
@@ -294,8 +294,8 @@ intel_miptree_blit(struct brw_context *brw,
 */
intel_miptree_slice_resolve_depth(brw, src_mt, src_level, src_slice);
intel_miptree_slice_resolve_depth(brw, dst_mt, 

[Mesa-dev] [Bug 91724] GL/gl_mangle.h misses symbols from GLES/gl.h

2016-11-24 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=91724

--- Comment #5 from Emil Velikov  ---
Hi Frederic, sorry for dropping the ball on this one.

Can you please attach (as plain text) the instructions and demo program that
you've mentioned - the gist seems to have been removed.

If you already have a patch please send it to the mailing list.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are the QA Contact for the bug.___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 95035] Gallium OSMesa driver is far from being thread-safe

2016-11-24 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=95035

--- Comment #12 from Emil Velikov  ---
Hi Frederic, please send your patches to the ML for review[1].

[1] http://mesa3d.org/devinfo.html#submitting

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are the QA Contact for the bug.___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 97145] include/GL/*.h not installed when GLX is disabled (eg for OSMesa)

2016-11-24 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=97145

--- Comment #1 from Emil Velikov  ---
Most/all of that should be resolved with commit
a89faa2022fd995af2019c886b152b49a01f9392.

Please give it a try and let me know the exact configure line (and the
summary?) if things are still odd.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are the QA Contact for the bug.___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] anv/state: if enabled, use anisotropic filtering also with VK_FILTER_NEAREST

2016-11-24 Thread Iago Toral
Hi Lionel,

On Thu, 2016-11-24 at 13:08 +, Lionel Landwerlin wrote:
> Hi Iago,
> 
> Looking at the history, before
> ed4fe3e9ba9018e68afe6fdd4f267218a537fdaa 
> we seem to set min/mag filter to MAPFILTER_ANISOTROPIC if
> maxAnisotropy 
>  > 1. It seems your patch makes sense in using MAPFILTER_ANISOTROPIC
> in 
> the NEAREST case, but I wonder whether we should also check for 
> maxAnisotropy > 1.

Right, good catch, although I think that if we do that it should be a
separate change since we are not currently checking that for the linear
filter either.

It seems that we do check for this in OpenGL so I think we probably
should do that here as well unless Jason dropped it for Vulkan on
purpose for some reason in that commit.

I'll send a separate patch for this after I confirm that it does not
alter the results for the tests in CTS if we add that check.

Iago

> On 24/11/16 11:30, Iago Toral Quiroga wrote:
> > 
> > Fixes multiple Vulkan CTS tests that combine anisotropy and
> > VK_FILTER_NEAREST
> > in dEQP-VK.texture.filtering_anisotropy.*
> > ---
> >   src/intel/vulkan/genX_state.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/src/intel/vulkan/genX_state.c
> > b/src/intel/vulkan/genX_state.c
> > index 4122395..0f621f9 100644
> > --- a/src/intel/vulkan/genX_state.c
> > +++ b/src/intel/vulkan/genX_state.c
> > @@ -101,7 +101,7 @@ vk_to_gen_tex_filter(VkFilter filter, bool
> > anisotropyEnable)
> >  default:
> > assert(!"Invalid filter");
> >  case VK_FILTER_NEAREST:
> > -  return MAPFILTER_NEAREST;
> > +  return anisotropyEnable ? MAPFILTER_ANISOTROPIC :
> > MAPFILTER_NEAREST;
> >  case VK_FILTER_LINEAR:
> > return anisotropyEnable ? MAPFILTER_ANISOTROPIC :
> > MAPFILTER_LINEAR;
> >  }
> 
> 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] radv: Don't generate radv_timestamp.h

2016-11-24 Thread Emil Velikov
On 23 November 2016 at 19:07, Bas Nieuwenhuizen  
wrote:
> Not needed anymore.
>
> Signed-off-by: Bas Nieuwenhuizen 
> ---
>  src/amd/vulkan/Makefile.am  | 6 +-
>  src/amd/vulkan/Makefile.sources | 3 +--
>  2 files changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/src/amd/vulkan/Makefile.am b/src/amd/vulkan/Makefile.am
> index c559a95..3f9b53e 100644
> --- a/src/amd/vulkan/Makefile.am
> +++ b/src/amd/vulkan/Makefile.am
> @@ -119,11 +119,7 @@ radv_entrypoints.c : radv_entrypoints_gen.py 
> $(vulkan_include_HEADERS)
> $(AM_V_GEN) cat $(vulkan_include_HEADERS) |\
> $(PYTHON2) $(srcdir)/radv_entrypoints_gen.py code > $@
>
> -.PHONY: radv_timestamp.h
> -
> -radv_timestamp.h:
> -   @echo "Updating radv_timestamp.h"
> -   $(AM_V_GEN) echo "#define RADV_TIMESTAMP \"$(TIMESTAMP_CMD)\"" > $@
> +.PHONY:
>
Please drop this line all together. With that
Reviewed-by: Emil Velikov 

Thanks again for killing it off !
Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/5] anv/pipeline: define is_dual_src_blend_factor() for gen <= 8

2016-11-24 Thread Lionel Landwerlin

Reviewed-by: Lionel Landwerlin 

On 24/11/16 12:36, Juan A. Suarez Romero wrote:

Fixes defined but not used warning.
---
  src/intel/vulkan/genX_pipeline.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c
index ada7985..991fbf6 100644
--- a/src/intel/vulkan/genX_pipeline.c
+++ b/src/intel/vulkan/genX_pipeline.c
@@ -1100,6 +1100,7 @@ emit_3dstate_wm(struct anv_pipeline *pipeline, struct 
anv_subpass *subpass,
 }
  }
  
+#if GEN_GEN < 8

  static bool
  is_dual_src_blend_factor(VkBlendFactor factor)
  {
@@ -1108,6 +1109,7 @@ is_dual_src_blend_factor(VkBlendFactor factor)
factor == VK_BLEND_FACTOR_SRC1_ALPHA ||
factor == VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA;
  }
+#endif
  
  static void

  emit_3dstate_ps(struct anv_pipeline *pipeline,



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


Re: [Mesa-dev] [PATCH 1/5] anv/pipeline: do not discard 'const' modifier

2016-11-24 Thread Lionel Landwerlin

Reviewed-by: Lionel Landwerlin 

On 24/11/16 12:36, Juan A. Suarez Romero wrote:

Fixes warning.
---
  src/intel/vulkan/genX_pipeline.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c
index cb164ad..ada7985 100644
--- a/src/intel/vulkan/genX_pipeline.c
+++ b/src/intel/vulkan/genX_pipeline.c
@@ -1138,7 +1138,7 @@ emit_3dstate_ps(struct anv_pipeline *pipeline,
 bool dual_src_blend = false;
 if (wm_prog_data->dual_src_blend) {
for (uint32_t i = 0; i < blend->attachmentCount; i++) {
- VkPipelineColorBlendAttachmentState *bstate = >pAttachments[i];
+ const VkPipelineColorBlendAttachmentState *bstate = 
>pAttachments[i];
   if (bstate->blendEnable &&
   (is_dual_src_blend_factor(bstate->srcColorBlendFactor) ||
is_dual_src_blend_factor(bstate->dstColorBlendFactor) ||



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


Re: [Mesa-dev] [PATCH] anv/state: if enabled, use anisotropic filtering also with VK_FILTER_NEAREST

2016-11-24 Thread Lionel Landwerlin

Hi Iago,

Looking at the history, before ed4fe3e9ba9018e68afe6fdd4f267218a537fdaa 
we seem to set min/mag filter to MAPFILTER_ANISOTROPIC if maxAnisotropy 
> 1. It seems your patch makes sense in using MAPFILTER_ANISOTROPIC in 
the NEAREST case, but I wonder whether we should also check for 
maxAnisotropy > 1.


On 24/11/16 11:30, Iago Toral Quiroga wrote:

Fixes multiple Vulkan CTS tests that combine anisotropy and VK_FILTER_NEAREST
in dEQP-VK.texture.filtering_anisotropy.*
---
  src/intel/vulkan/genX_state.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/intel/vulkan/genX_state.c b/src/intel/vulkan/genX_state.c
index 4122395..0f621f9 100644
--- a/src/intel/vulkan/genX_state.c
+++ b/src/intel/vulkan/genX_state.c
@@ -101,7 +101,7 @@ vk_to_gen_tex_filter(VkFilter filter, bool anisotropyEnable)
 default:
assert(!"Invalid filter");
 case VK_FILTER_NEAREST:
-  return MAPFILTER_NEAREST;
+  return anisotropyEnable ? MAPFILTER_ANISOTROPIC : MAPFILTER_NEAREST;
 case VK_FILTER_LINEAR:
return anisotropyEnable ? MAPFILTER_ANISOTROPIC : MAPFILTER_LINEAR;
 }



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


[Mesa-dev] [PATCH 5/5] st/va: declare vlVaBuffer before vlVaContext

2016-11-24 Thread Juan A. Suarez Romero
And declare coded_buf in vlVaContext as "vlVaBuffer *" instead of
"struct vlVaBuffer *".

This fixes several warnings later about assignment from incompatible
pointer type.
---
 src/gallium/state_trackers/va/va_private.h | 30 +++---
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/gallium/state_trackers/va/va_private.h 
b/src/gallium/state_trackers/va/va_private.h
index c9a6a41..054cfb3 100644
--- a/src/gallium/state_trackers/va/va_private.h
+++ b/src/gallium/state_trackers/va/va_private.h
@@ -220,6 +220,20 @@ typedef struct {
 } vlVaSubpicture;
 
 typedef struct {
+   VABufferType type;
+   unsigned int size;
+   unsigned int num_elements;
+   void *data;
+   struct {
+  struct pipe_resource *resource;
+  struct pipe_transfer *transfer;
+   } derived_surface;
+   unsigned int export_refcount;
+   VABufferInfo export_state;
+   unsigned int coded_size;
+} vlVaBuffer;
+
+typedef struct {
struct pipe_video_codec templat, *decoder;
struct pipe_video_buffer *target;
union {
@@ -242,7 +256,7 @@ typedef struct {
} mpeg4;
 
struct vl_deint_filter *deint;
-   struct vlVaBuffer *coded_buf;
+   vlVaBuffer *coded_buf;
int target_id;
 } vlVaContext;
 
@@ -254,20 +268,6 @@ typedef struct {
 } vlVaConfig;
 
 typedef struct {
-   VABufferType type;
-   unsigned int size;
-   unsigned int num_elements;
-   void *data;
-   struct {
-  struct pipe_resource *resource;
-  struct pipe_transfer *transfer;
-   } derived_surface;
-   unsigned int export_refcount;
-   VABufferInfo export_state;
-   unsigned int coded_size;
-} vlVaBuffer;
-
-typedef struct {
struct pipe_video_buffer templat, *buffer;
struct util_dynarray subpics; /* vlVaSubpicture */
VAContextID ctx;
-- 
2.7.4

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


[Mesa-dev] [PATCH 3/5] st/va: remove unsed variable

2016-11-24 Thread Juan A. Suarez Romero
pbuff is defined but not used.
---
 src/gallium/state_trackers/va/surface.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/gallium/state_trackers/va/surface.c 
b/src/gallium/state_trackers/va/surface.c
index f8513d9..357e85e 100644
--- a/src/gallium/state_trackers/va/surface.c
+++ b/src/gallium/state_trackers/va/surface.c
@@ -94,7 +94,6 @@ vlVaSyncSurface(VADriverContextP ctx, VASurfaceID 
render_target)
vlVaDriver *drv;
vlVaContext *context;
vlVaSurface *surf;
-   void *pbuff;
 
if (!ctx)
   return VA_STATUS_ERROR_INVALID_CONTEXT;
-- 
2.7.4

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


[Mesa-dev] [PATCH 4/5] ttn: handle GLSL_SAMPLER_DIM_SUBPASS_MS case

2016-11-24 Thread Juan A. Suarez Romero
Fixes a warning.
---
 src/gallium/auxiliary/nir/tgsi_to_nir.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gallium/auxiliary/nir/tgsi_to_nir.c 
b/src/gallium/auxiliary/nir/tgsi_to_nir.c
index 3f05acd..e90684f 100644
--- a/src/gallium/auxiliary/nir/tgsi_to_nir.c
+++ b/src/gallium/auxiliary/nir/tgsi_to_nir.c
@@ -1341,6 +1341,7 @@ ttn_tex(struct ttn_compile *c, nir_alu_dest dest, 
nir_ssa_def **src)
   instr->coord_components = 3;
   break;
case GLSL_SAMPLER_DIM_SUBPASS:
+   case GLSL_SAMPLER_DIM_SUBPASS_MS:
   unreachable("invalid sampler_dim");
}
 
-- 
2.7.4

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


[Mesa-dev] [PATCH 0/5] Several fixes for different warnings

2016-11-24 Thread Juan A. Suarez Romero
I'm sending several unrelated patches that fix different warnings when building
Mesa.

Juan A. Suarez Romero (5):
  anv/pipeline: do not discard 'const' modifier
  anv/pipeline: define is_dual_src_blend_factor() for gen <= 8
  st/va: remove unsed variable
  ttn: handle GLSL_SAMPLER_DIM_SUBPASS_MS case
  st/va: declare vlVaBuffer before vlVaContext

 src/gallium/auxiliary/nir/tgsi_to_nir.c|  1 +
 src/gallium/state_trackers/va/surface.c|  1 -
 src/gallium/state_trackers/va/va_private.h | 30 +++---
 src/intel/vulkan/genX_pipeline.c   |  4 +++-
 4 files changed, 19 insertions(+), 17 deletions(-)

-- 
2.7.4

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


[Mesa-dev] [PATCH 2/5] anv/pipeline: define is_dual_src_blend_factor() for gen <= 8

2016-11-24 Thread Juan A. Suarez Romero
Fixes defined but not used warning.
---
 src/intel/vulkan/genX_pipeline.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c
index ada7985..991fbf6 100644
--- a/src/intel/vulkan/genX_pipeline.c
+++ b/src/intel/vulkan/genX_pipeline.c
@@ -1100,6 +1100,7 @@ emit_3dstate_wm(struct anv_pipeline *pipeline, struct 
anv_subpass *subpass,
}
 }
 
+#if GEN_GEN < 8
 static bool
 is_dual_src_blend_factor(VkBlendFactor factor)
 {
@@ -1108,6 +1109,7 @@ is_dual_src_blend_factor(VkBlendFactor factor)
   factor == VK_BLEND_FACTOR_SRC1_ALPHA ||
   factor == VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA;
 }
+#endif
 
 static void
 emit_3dstate_ps(struct anv_pipeline *pipeline,
-- 
2.7.4

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


[Mesa-dev] [PATCH 1/5] anv/pipeline: do not discard 'const' modifier

2016-11-24 Thread Juan A. Suarez Romero
Fixes warning.
---
 src/intel/vulkan/genX_pipeline.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c
index cb164ad..ada7985 100644
--- a/src/intel/vulkan/genX_pipeline.c
+++ b/src/intel/vulkan/genX_pipeline.c
@@ -1138,7 +1138,7 @@ emit_3dstate_ps(struct anv_pipeline *pipeline,
bool dual_src_blend = false;
if (wm_prog_data->dual_src_blend) {
   for (uint32_t i = 0; i < blend->attachmentCount; i++) {
- VkPipelineColorBlendAttachmentState *bstate = >pAttachments[i];
+ const VkPipelineColorBlendAttachmentState *bstate = 
>pAttachments[i];
  if (bstate->blendEnable &&
  (is_dual_src_blend_factor(bstate->srcColorBlendFactor) ||
   is_dual_src_blend_factor(bstate->dstColorBlendFactor) ||
-- 
2.7.4

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


  1   2   >