Re: [Mesa-dev] [PATCH] mesa: fix memory leak in arb_fragment_program

2017-04-11 Thread Bartosz Tomczyk
Could you push it for me?

On Mon, Apr 10, 2017 at 4:06 AM, Timothy Arceri 
wrote:

> Thanks.
>
> Reviewed-by: Timothy Arceri 
>
>
> On 10/04/17 02:37, Bartosz Tomczyk wrote:
>
>> ---
>>  src/mesa/program/arbprogparse.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/src/mesa/program/arbprogparse.c
>> b/src/mesa/program/arbprogparse.c
>> index 07bdf1603e..83a501eea6 100644
>> --- a/src/mesa/program/arbprogparse.c
>> +++ b/src/mesa/program/arbprogparse.c
>> @@ -78,6 +78,7 @@ _mesa_parse_arb_fragment_program(struct gl_context*
>> ctx, GLenum target,
>> memset(&prog, 0, sizeof(prog));
>> memset(&state, 0, sizeof(state));
>> state.prog = &prog;
>> +   state.mem_ctx = program;
>>
>> if (!_mesa_parse_arb_program(ctx, target, (const GLubyte*) str, len,
>> &state)) {
>>
>> ___
> 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 13/15] radeon: remove duplicate 'const' specifier

2017-04-11 Thread Nils Wallménius
Den 11 apr. 2017 20:00 skrev "Samuel Pitoiset" :

Fixes the following Clang warning.

In file included from radeon_debug.c:32:
./radeon_common_context.h:500:19: warning: duplicate 'const' declaration
specifier [-Wduplicate-decl-specifier]
extern const char const *radeonVendorString;

Signed-off-by: Samuel Pitoiset 
---
 src/mesa/drivers/dri/radeon/radeon_common_context.c | 2 +-
 src/mesa/drivers/dri/radeon/radeon_common_context.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c
b/src/mesa/drivers/dri/radeon/radeon_common_context.c
index d981ca24e5..2c12b62d82 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common_context.c
+++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c
@@ -70,7 +70,7 @@ static const char* get_chip_family_name(int chip_family)
}
 }

-const char const *radeonVendorString = "Mesa Project";
+const char *radeonVendorString = "Mesa Project";

 /* Return complete renderer string.
  */
diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.h
b/src/mesa/drivers/dri/radeon/radeon_common_context.h
index d142a871b4..a85bedf31f 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common_context.h
+++ b/src/mesa/drivers/dri/radeon/radeon_common_context.h
@@ -497,7 +497,7 @@ static inline __DRIdrawable*
radeon_get_readable(radeonContextPtr
radeon)
return radeon->driContext->driReadablePriv;
 }

-extern const char const *radeonVendorString;
+extern const char *radeonVendorString;

 const char *radeonGetRendererString(radeonScreenPtr radeonScreen);

--
2.12.2

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


Hi Samuel,

Maybe the intention here was to have "const char * const" as in constant
pointer to constant data?

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


Re: [Mesa-dev] [PATCH v4] glsl/blob: avoid NULL ptr in prog parameter name

2017-04-11 Thread Timothy Arceri

I've pushed this. Thanks for getting to the bottom of the problem :)
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [RFC PATCH 1/3] gallium: decrease the size of pipe_vertex_buffer - 24 -> 16 bytes

2017-04-11 Thread Brian Paul

On 04/11/2017 02:15 PM, Marek Olšák wrote:

From: Marek Olšák 

New interface:

union pipe_buffer_binding {
struct pipe_resource *buffer;  /**< the actual buffer */
const void *user_buffer;  /**< pointer to a user buffer */
};

struct pipe_vertex_buffer
{
uint16_t stride;/**< stride to same attrib in next vertex, in bytes */
bool is_user_buffer;
unsigned buffer_offset;  /**< offset to start of data in buffer, in bytes */
union pipe_buffer_binding u;
};
---
  src/gallium/include/pipe/p_state.h | 11 ---
  1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/gallium/include/pipe/p_state.h 
b/src/gallium/include/pipe/p_state.h
index ce9ca34..9576f18 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -534,6 +534,11 @@ struct pipe_transfer
  };


+union pipe_buffer_binding {
+   struct pipe_resource *buffer;  /**< the actual buffer */
+   const void *user_buffer;  /**< pointer to a user buffer */
+};
+

  /**
   * A vertex buffer.  Typically, all the vertex data/attributes for
@@ -542,10 +547,10 @@ struct pipe_transfer
   */
  struct pipe_vertex_buffer
  {
-   unsigned stride;/**< stride to same attrib in next vertex, in bytes */
+   uint16_t stride;/**< stride to same attrib in next vertex, in bytes */
+   bool is_user_buffer;
 unsigned buffer_offset;  /**< offset to start of data in buffer, in bytes 
*/
-   struct pipe_resource *buffer;  /**< the actual buffer */
-   const void *user_buffer;  /**< pointer to a user buffer if buffer == NULL */
+   union pipe_buffer_binding u;
  };


Why have the separate pipe_buffer_binding union at all?  Do you 
anticipate it being needed elsewhere in Gallium?


How about something like this:

struct pipe_vertex_buffer
{
   uint16_t stride;
   bool is_user_buffer;
   ...
   union {
  struct pipe_resource *resource;
  const void *user;
   } buffer;
};

Similarly in patch 3:

struct pipe_draw_info
{
   ...
   union {
  struct pipe_resource *resource;
  const void *user;
   } index;
};

If you really want the separate union type, can I suggest calling it 
"pipe_buffer_union" instead?  I don't know what "binding" has to do with it.


-Brian

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


Re: [Mesa-dev] [RFC PATCH 26/26] glsl: fix up an assertion in glsl_type::sampler_index()

2017-04-11 Thread Timothy Arceri



On 12/04/17 02:48, Samuel Pitoiset wrote:

Used by glsl_to_tgsi.

Signed-off-by: Samuel Pitoiset 
---
 src/compiler/glsl_types.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/compiler/glsl_types.cpp b/src/compiler/glsl_types.cpp
index cf0fe71d1a..6854169646 100644
--- a/src/compiler/glsl_types.cpp
+++ b/src/compiler/glsl_types.cpp
@@ -315,7 +315,8 @@ glsl_type::sampler_index() const
 {
const glsl_type *const t = (this->is_array()) ? this->fields.array : this;

-   assert(t->is_sampler() || t->is_image());
+   assert(t->base_type >= GLSL_TYPE_BINDLESS_SAMPLER &&
+  t->base_type <= GLSL_TYPE_IMAGE);


I'd rather just see all 4 types explicitly listed here. Since it's an 
assert we don't care about efficiency, but we do care about correctness 
and it would be easy for this code to silently break.




switch (t->sampler_dimensionality) {
case GLSL_SAMPLER_DIM_1D:


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


Re: [Mesa-dev] [RFC PATCH 24/26] glsl: link bindless layout qualifiers

2017-04-11 Thread Timothy Arceri

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


Re: [Mesa-dev] [RFC PATCH 20/26] glsl: use fully_specified_type rule with ast_function_expression

2017-04-11 Thread Timothy Arceri

On 12/04/17 02:48, Samuel Pitoiset wrote:

Only ast_fully_specified_type is able to know if the underlying
type is bindless or not. Because type_specifier is a subrule of
fully_specified_type this shouldn't break anything.

This will help for handling explicit conversions like
'sampler2D tex = sampler2D(pair);' where sampler2D is a constructor.

Signed-off-by: Samuel Pitoiset 
---
 src/compiler/glsl/ast.h| 2 +-
 src/compiler/glsl/ast_function.cpp | 6 +++---
 src/compiler/glsl/glsl_parser.yy   | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/compiler/glsl/ast.h b/src/compiler/glsl/ast.h
index 2a2dd4bcd9..4fb8b87286 100644
--- a/src/compiler/glsl/ast.h
+++ b/src/compiler/glsl/ast.h
@@ -305,7 +305,7 @@ public:
   /* empty */
}

-   ast_function_expression(class ast_type_specifier *type)
+   ast_function_expression(class ast_fully_specified_type *type)
   : ast_expression(ast_function_call, (ast_expression *) type,
   NULL, NULL),
cons(true)
diff --git a/src/compiler/glsl/ast_function.cpp 
b/src/compiler/glsl/ast_function.cpp
index 0665e0c393..95ec2db173 100644
--- a/src/compiler/glsl/ast_function.cpp
+++ b/src/compiler/glsl/ast_function.cpp
@@ -1942,8 +1942,8 @@ ast_function_expression::hir(exec_list *instructions,
 *
 */
if (is_constructor()) {
-  const ast_type_specifier *type =
- (ast_type_specifier *) subexpressions[0];
+  const ast_fully_specified_type *type =
+ (ast_fully_specified_type *) subexpressions[0];
   YYLTYPE loc = type->get_location();
   const char *name;

@@ -1955,7 +1955,7 @@ ast_function_expression::hir(exec_list *instructions,
   if (constructor_type == NULL) {
  _mesa_glsl_error(& loc, state, "unknown type `%s' (structure name "
   "may be shadowed by a variable with the same name)",
-  type->type_name);
+  type->specifier->type_name);
  return ir_rvalue::error_value(ctx);
   }

diff --git a/src/compiler/glsl/glsl_parser.yy b/src/compiler/glsl/glsl_parser.yy
index 05171e53a3..a35a649879 100644
--- a/src/compiler/glsl/glsl_parser.yy
+++ b/src/compiler/glsl/glsl_parser.yy
@@ -573,7 +573,7 @@ function_call_header:
;

 function_identifier:
-   type_specifier
+   fully_specified_type


I'm not so sure about this. Wouldn't this allow you to do things like:

sampler2D tex = precise sampler2D(pair)

Without triggering an error in the parser?



{
   void *ctx = state->linalloc;
   $$ = new(ctx) ast_function_expression($1);


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


Re: [Mesa-dev] [RFC PATCH 19/26] glsl: reject bindless samplers/images frag inputs without 'flat'

2017-04-11 Thread Timothy Arceri

On 12/04/17 02:48, Samuel Pitoiset wrote:

The ARB_bindless_texture spec says:

   "Modify Section 4.3.4, Inputs, p. 34"

   "(modify last paragraph, p. 35, allowing samplers and images as
fragment shader inputs) ... Fragment inputs can only be signed
and unsigned integers and integer vectors, floating point scalars,
floating-point vectors, matrices, sampler and image types, or
arrays or structures of these.  Fragment shader inputs that are
signed or unsigned integers, integer vectors, or any
double-precision floating- point type, or any sampler or image
type must be qualified with the interpolation qualifier "flat"."

Signed-off-by: Samuel Pitoiset 
---
 src/compiler/glsl/ast_to_hir.cpp | 26 ++
 1 file changed, 26 insertions(+)

diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index 9b8dfbcf47..d2ffa2ec69 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -3168,6 +3168,32 @@ validate_interpolation_qualifier(struct 
_mesa_glsl_parse_state *state,
   _mesa_glsl_error(loc, state, "if a fragment input is (or contains) "
"a double, then it must be qualified with 'flat'");
}
+
+   /* Bindless sampler/image fragment inputs must be qualified with 'flat'.
+*
+* The ARB_bindless_texture spec says:
+*
+*"Modify Section 4.3.4, Inputs, p. 34"
+*
+*"(modify last paragraph, p. 35, allowing samplers and images as
+* fragment shader inputs) ... Fragment inputs can only be signed and
+* unsigned integers and integer vectors, floating point scalars,
+* floating-point vectors, matrices, sampler and image types, or arrays
+* or structures of these.  Fragment shader inputs that are signed or
+* unsigned integers, integer vectors, or any double-precision floating-
+* point type, or any sampler or image type must be qualified with the
+* interpolation qualifier "flat"."
+*/
+   if (state->has_bindless()
+   && (var_type->contains_bindless_sampler() ||
+   var_type->contains_bindless_image())
+   && interpolation != INTERP_MODE_FLAT
+   && state->stage == MESA_SHADER_FRAGMENT
+   && mode == ir_var_shader_in) {
+  _mesa_glsl_error(loc, state, "if a fragment input is (or contains) "
+   "a bindless sampler (or image), then it must be "
+   "qualified with 'flat'");
+   }
 }

 static glsl_interp_mode




I think I'd like to see a patch that breaks this and the two checks 
above into a helper functions the looks something like this:



static void
validate_fragment_flat_interpolation_input()
{
   if (state->stage != MESA_SHADER_FRAGMENT ||
   interpolation == INTERP_MODE_FLAT ||
   mode != ir_var_shader_in)
  return;

   ... the other two checks here ...

   /* Bindless sampler/image fragment inputs must be qualified with 'flat'.
*
* The ARB_bindless_texture spec says:
*
*"Modify Section 4.3.4, Inputs, p. 34"
*
*"(modify last paragraph, p. 35, allowing samplers and images as
* fragment shader inputs) ... Fragment inputs can only be 
signed and

* unsigned integers and integer vectors, floating point scalars,
* floating-point vectors, matrices, sampler and image types, or 
arrays
* or structures of these.  Fragment shader inputs that are 
signed or
* unsigned integers, integer vectors, or any double-precision 
floating-
* point type, or any sampler or image type must be qualified 
with the

* interpolation qualifier "flat"."
*/
   if (state->has_bindless()
   && (var_type->contains_bindless_sampler() ||
   var_type->contains_bindless_image())) {
  _mesa_glsl_error(loc, state, "if a fragment input is (or contains) "
   "a bindless sampler (or image), then it must be "
   "qualified with 'flat'");


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


[Mesa-dev] [PATCH 1/2] egl_dri2: Add support for Tizen

2017-04-11 Thread Mun Gwan-gyeong
From: "Mun, Gwan-gyeong" 

Add platform_tizen.c that supports _EGL_PLATFORM_TIZEN. It works with libtpl-egl
(Tizen Porting Layer for egl), libtbm(Tizen Buffer Manager) where back buffers
of windows are backed by GEM objects.

In Tizen a native window has a queue (tbm_surface_queue) of back buffers
allocated by the WL_TBM(wayland client case, WL_TBM is abbreviation of
wayland-tbm protocol) or gbm ( tizen has implements gbm with tbm) or tbm
through tbm_backend.

For each frame, EGL needs to

dequeue the next back buffer
render to the buffer
enqueue the buffer

After enqueuing, the buffer is no longer valid to EGL.

It supports DRI image loader extension, DRI dri2 loader extension and DRI swrast
loader extension.

It supports EGL_NATIVE_SURFACE_TIZEN  target type for eglCreateImageKHR.
(https://www.khronos.org/registry/EGL/extensions/TIZEN/EGL_TIZEN_image_native_surface.txt)

BindWaylandDisplayWL / UnbindWaylandDisplayWL / QueryWaylandBufferWL are
overloaded because tizen platform has its own instead of WL_DRM.

Referenced documents:
https://www.x.org/wiki/Events/XDC2016/Program/XDC2016_Tizen_Window_System_EGL_Vulkan.pdf
https://wiki.tizen.org/wiki/3.0_Porting_Guide/Graphics_and_UI/libtpl-egl
https://wiki.tizen.org/wiki/TBM

Signed-off-by: Mun Gwan-gyeong 
---
 src/egl/Makefile.am   |7 +
 src/egl/drivers/dri2/egl_dri2.c   |   11 +
 src/egl/drivers/dri2/egl_dri2.h   |   36 +
 src/egl/drivers/dri2/platform_tizen.c | 1543 +
 src/egl/main/eglapi.c |   16 +
 src/egl/main/egldisplay.c |   27 +-
 src/egl/main/egldisplay.h |   11 +
 7 files changed, 1650 insertions(+), 1 deletion(-)
 create mode 100644 src/egl/drivers/dri2/platform_tizen.c

diff --git a/src/egl/Makefile.am b/src/egl/Makefile.am
index 3477f797d7..1f7b15cce4 100644
--- a/src/egl/Makefile.am
+++ b/src/egl/Makefile.am
@@ -91,6 +91,13 @@ libEGL_la_LIBADD += $(ANDROID_LIBS)
 dri2_backend_FILES += drivers/dri2/platform_android.c
 endif
 
+if HAVE_EGL_PLATFORM_TIZEN
+AM_CFLAGS += -DHAVE_TIZEN_PLATFORM
+AM_CFLAGS += $(TIZEN_CFLAGS)
+libEGL_la_LIBADD += $(TIZEN_LIBS)
+dri2_backend_FILES += drivers/dri2/platform_tizen.c
+endif
+
 AM_CFLAGS += \
-I$(top_srcdir)/src/loader \
-I$(top_srcdir)/src/egl/drivers/dri2 \
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 2cab7d00c1..676f3a62c1 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -862,6 +862,11 @@ dri2_initialize(_EGLDriver *drv, _EGLDisplay *disp)
   ret = dri2_initialize_android(drv, disp);
   break;
 #endif
+#ifdef HAVE_TIZEN_PLATFORM
+   case _EGL_PLATFORM_TIZEN:
+  ret = dri2_initialize_tizen(drv, disp);
+  break;
+#endif
default:
   _eglLog(_EGL_WARNING, "No EGL platform enabled.");
   return EGL_FALSE;
@@ -943,6 +948,12 @@ dri2_display_release(_EGLDisplay *disp)
   }
   break;
 #endif
+#ifdef HAVE_TIZEN_PLATFORM
+   case _EGL_PLATFORM_TIZEN:
+  if (dri2_dpy->tpl_display)
+  tpl_object_unreference((tpl_object_t *)(dri2_dpy->tpl_display));
+  break;
+#endif
default:
   break;
}
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index f16663712d..e81691a4a0 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -63,6 +63,14 @@
 
 #endif /* HAVE_ANDROID_PLATFORM */
 
+#ifdef HAVE_TIZEN_PLATFORM
+#include 
+#include 
+#include 
+#include 
+#include 
+#endif /* HAVE_TIZEN_PLATFORM */
+
 #include "eglconfig.h"
 #include "eglcontext.h"
 #include "egldisplay.h"
@@ -217,6 +225,10 @@ struct dri2_egl_display
const gralloc_module_t *gralloc;
 #endif
 
+#ifdef HAVE_TIZEN_PLATFORM
+   tpl_display_t*tpl_display;
+#endif
+
int   is_render_node;
int   is_different_gpu;
 };
@@ -265,6 +277,27 @@ struct dri2_egl_surface
struct gbm_dri_surface *gbm_surf;
 #endif
 
+#ifdef HAVE_TIZEN_PLATFORM
+   void  *native_win;
+   tpl_surface_t *tpl_surface;
+   tbm_surface_h  tbm_surface;
+   tbm_format tbm_format;
+   __DRIimage*dri_image_back;
+   __DRIimage*dri_image_front;
+
+   /* EGL-owned buffers */
+   __DRIbuffer   *local_buffers[__DRI_BUFFER_COUNT];
+
+   /* Used to record all the tbm_surface created by tpl_surface and their ages.
+* Usually Tizen uses at most triple buffers in tpl_surface 
(tbm_surface_queue)
+* so hardcode the number of color_buffers to 3.
+*/
+   struct {
+  tbm_surface_h tbm_surface;
+  int age;
+   } color_buffers[3], *back;
+#endif
+
 #if defined(HAVE_WAYLAND_PLATFORM) || defined(HAVE_DRM_PLATFORM)
__DRIbuffer   *dri_buffers[__DRI_BUFFER_COUNT];
struct {
@@ -397,6 +430,9 @@ dri2_initialize_android(_EGLDriver *drv, _EGLDisplay *disp);
 EGLBoolean
 dri2_initialize_surfaceless(_EGLDriver *drv, _EGLDisplay *disp);
 
+EGLBoolean
+dri2_initialize_tizen(_EGLDriver 

[Mesa-dev] [PATCH 2/2] configure.ac: Add tizen to supported egl platforms

2017-04-11 Thread Mun Gwan-gyeong
From: "Mun, Gwan-gyeong" 

It checks tpl-egl/libtbm/libtdm packages and defines HAVE_EGL_PLATFORM_TIZEN.
This feature is enabled by the config option '--with-egl-platforms=tizen'

Signed-off-by: Mun Gwan-gyeong 
---
 configure.ac | 5 +
 1 file changed, 5 insertions(+)

diff --git a/configure.ac b/configure.ac
index 7246c6017a..e8c3151809 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2175,6 +2175,10 @@ for plat in $egl_platforms; do
PKG_CHECK_MODULES([ANDROID], [cutils hardware sync])
;;
 
+   tizen)
+   PKG_CHECK_MODULES([TIZEN], [tpl-egl libtbm libtdm])
+   ;;
+
*)
AC_MSG_ERROR([EGL platform '$plat' does not exist])
;;
@@ -2201,6 +2205,7 @@ AM_CONDITIONAL(HAVE_PLATFORM_WAYLAND, echo 
"$egl_platforms" | grep -q 'wayland')
 AM_CONDITIONAL(HAVE_EGL_PLATFORM_DRM, echo "$egl_platforms" | grep -q 'drm')
 AM_CONDITIONAL(HAVE_EGL_PLATFORM_SURFACELESS, echo "$egl_platforms" | grep -q 
'surfaceless')
 AM_CONDITIONAL(HAVE_EGL_PLATFORM_ANDROID, echo "$egl_platforms" | grep -q 
'android')
+AM_CONDITIONAL(HAVE_EGL_PLATFORM_TIZEN, echo "$egl_platforms" | grep -q 
'tizen')
 
 AC_SUBST([EGL_NATIVE_PLATFORM])
 AC_SUBST([EGL_CFLAGS])
-- 
2.12.2

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


[Mesa-dev] [PATCH 0/2] Introduce supporting of Tizen to mesa's egl platform

2017-04-11 Thread Mun Gwan-gyeong
Hello,

these commit series introduce supporting of Tizen to mesa's egl platform.

It is tested on rpi3 with Tizen Platform.

Below repository includes packaging info for tizen.
 https://github.com/elongbug/mesa/tree/tizen_work
 (this file includes build option for vc4 - 
https://github.com/elongbug/mesa/blob/tizen_work/packaging/mesa.spec )

Following docs describe howto seting up build environment for tizen and geting 
build dependancy packages and
how to building RPI3 kernel for tizen and downloading to tizen platform 
binaries to rpi3.

https://github.com/elongbug/mesa/blob/tizen_work/Readme_RPI3_Setup_for_Tizen
https://github.com/elongbug/mesa/blob/tizen_work/Readme_for_Tizen
https://github.com/elongbug/mesa/blob/tizen_work/Tizen_Binary_Download_Instructions_for_RPI3

Mun, Gwan-gyeong (2):
  egl_dri2: Add support for Tizen
  configure.ac: Add tizen to supported egl platforms

 configure.ac  |5 +
 src/egl/Makefile.am   |7 +
 src/egl/drivers/dri2/egl_dri2.c   |   11 +
 src/egl/drivers/dri2/egl_dri2.h   |   36 +
 src/egl/drivers/dri2/platform_tizen.c | 1543 +
 src/egl/main/eglapi.c |   16 +
 src/egl/main/egldisplay.c |   27 +-
 src/egl/main/egldisplay.h |   11 +
 8 files changed, 1655 insertions(+), 1 deletion(-)
 create mode 100644 src/egl/drivers/dri2/platform_tizen.c

-- 
2.12.2

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


[Mesa-dev] [PATCH 0/2] Introduce supporting of Tizen to mesa's egl platform

2017-04-11 Thread Mun Gwan-gyeong
Hello,

these commit series introduce supporting of Tizen to mesa's egl platform.

It is tested on rpi3 with Tizen Platform.

Below repository includes packaging info for tizen.
 https://github.com/elongbug/mesa/tree/tizen_work
 (this file includes build option for vc4 - 
https://github.com/elongbug/mesa/blob/tizen_work/packaging/mesa.spec )

Following docs describe howto seting up build environment for tizen and geting 
build dependancy packages and
how to building RPI3 kernel for tizen and downloading to tizen platform 
binaries to rpi3.

https://github.com/elongbug/mesa/blob/tizen_work/Readme_RPI3_Setup_for_Tizen
https://github.com/elongbug/mesa/blob/tizen_work/Readme_for_Tizen
https://github.com/elongbug/mesa/blob/tizen_work/Tizen_Binary_Download_Instructions_for_RPI3

Mun, Gwan-gyeong (2):
  egl_dri2: Add support for Tizen
  configure.ac: Add tizen to supported egl platforms

 configure.ac  |5 +
 src/egl/Makefile.am   |7 +
 src/egl/drivers/dri2/egl_dri2.c   |   11 +
 src/egl/drivers/dri2/egl_dri2.h   |   36 +
 src/egl/drivers/dri2/platform_tizen.c | 1543 +
 src/egl/main/eglapi.c |   16 +
 src/egl/main/egldisplay.c |   27 +-
 src/egl/main/egldisplay.h |   11 +
 8 files changed, 1655 insertions(+), 1 deletion(-)
 create mode 100644 src/egl/drivers/dri2/platform_tizen.c

-- 
2.12.2

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


Re: [Mesa-dev] [RFC PATCH 18/26] glsl: allow bindless samplers/images as vertex shader inputs

2017-04-11 Thread Timothy Arceri

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


Re: [Mesa-dev] [RFC PATCH 17/26] glsl: allow bindless samplers/images as varying variables

2017-04-11 Thread Timothy Arceri

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


[Mesa-dev] [Bug 99618] AVX Intrinsics Run in GUI thread only

2017-04-11 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=99618

Bruce Cherniak  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #5 from Bruce Cherniak  ---
I'm glad that works for you.  We will continue to work on threading models that
don't require external intervention for optimal performance.  But, in the
meantime, I'm going to close this bug as resolved.

Please let us know of any other troubles you observe and thank you for your
interest in OpenSWR.

-- 
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] [RFC PATCH 16/26] glsl: allow image qualifiers inside structures

2017-04-11 Thread Timothy Arceri

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


Re: [Mesa-dev] [RFC PATCH 15/26] glsl: allow input memory qualifiers for images

2017-04-11 Thread Timothy Arceri



On 12/04/17 02:48, Samuel Pitoiset wrote:

The GL_ARB_bindless_texture spec allows images to be declared as
shader inputs.

Signed-off-by: Samuel Pitoiset 
---
 src/compiler/glsl/ast_type.cpp | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/src/compiler/glsl/ast_type.cpp b/src/compiler/glsl/ast_type.cpp
index cf84528775..b1929f7550 100644
--- a/src/compiler/glsl/ast_type.cpp
+++ b/src/compiler/glsl/ast_type.cpp
@@ -276,6 +276,17 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc,
input_layout_mask.flags.q.sample = 1;
input_layout_mask.flags.q.smooth = 1;

+   if (state->has_bindless()) {
+  /* Allow to use qualifiers for images declared as shader inputs/outputs
+   * as specified by GL_ARB_bindless_texture. */


Please put the */ on the following line.

Otherwise:

Reviewed-by: Timothy Arceri 


+  input_layout_mask.flags.q.coherent = 1;
+  input_layout_mask.flags.q._volatile = 1;
+  input_layout_mask.flags.q.restrict_flag = 1;
+  input_layout_mask.flags.q.read_only = 1;
+  input_layout_mask.flags.q.write_only = 1;
+  input_layout_mask.flags.q.explicit_image_format = 1;
+   }
+
/* Uniform block layout qualifiers get to overwrite each
 * other (rightmost having priority), while all other
 * qualifiers currently don't allow duplicates.


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


Re: [Mesa-dev] [RFC PATCH 14/26] glsl: do not make bindless image read-only variables

2017-04-11 Thread Timothy Arceri

On 12/04/17 02:48, Samuel Pitoiset wrote:

Bindless images can be explicitely converted to and from uvec2
using scalar constructors.

Signed-off-by: Samuel Pitoiset 
---
 src/compiler/glsl/ast_to_hir.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index f52ba8181a..bcdf212497 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -3411,7 +3411,7 @@ apply_image_qualifier_to_variable(const struct 
ast_type_qualifier *qual,
   var->data.image_coherent |= qual->flags.q.coherent;
   var->data.image_volatile |= qual->flags.q._volatile;
   var->data.image_restrict |= qual->flags.q.restrict_flag;
-  var->data.read_only = true;
+  var->data.read_only = base_type->is_image();

   if (qual->flags.q.explicit_image_format) {
  if (var->data.mode == ir_var_function_in) {



Just curious. If we remove this what stops values being directly 
assigned to images when not using the constructors?

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


Re: [Mesa-dev] [RFC PATCH 13/26] glsl: apply image qualifiers to bindless images

2017-04-11 Thread Timothy Arceri



On 12/04/17 02:48, Samuel Pitoiset wrote:

The ARB_bindless_texture spec says:

   "Replace Section 4.1.X, (Images)"

   "Images may be declared as shader inputs and outputs, as uniform
variables, as temporary variables, and as function parameters."

Signed-off-by: Samuel Pitoiset 
---
 src/compiler/glsl/ast_to_hir.cpp | 27 +--
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index 4a0f3fe315..f52ba8181a 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -3383,12 +3383,27 @@ apply_image_qualifier_to_variable(const struct 
ast_type_qualifier *qual,
 {
const glsl_type *base_type = var->type->without_array();

-   if (base_type->is_image()) {
-  if (var->data.mode != ir_var_uniform &&
-  var->data.mode != ir_var_function_in) {
- _mesa_glsl_error(loc, state, "image variables may only be declared as 
"
-  "function parameters or uniform-qualified "
-  "global variables");
+   if (base_type->is_image() || base_type->is_bindless_image()) {
+  if (base_type->is_bindless_image()) {
+ if (var->data.mode != ir_var_auto &&
+ var->data.mode != ir_var_uniform &&
+ var->data.mode != ir_var_shader_in &&
+ var->data.mode != ir_var_shader_out &&
+ var->data.mode != ir_var_function_in &&
+ var->data.mode != ir_var_function_out &&
+ var->data.mode != ir_var_function_inout) {
+_mesa_glsl_error(loc, state, "bindless image variables may only be 
"
+ "declared as shader inputs and outputs, as "
+ "uniform variables, as temporary variables and as 
"
+ "function parameters");
+ }
+  } else {
+ if (var->data.mode != ir_var_uniform &&
+ var->data.mode != ir_var_function_in) {
+_mesa_glsl_error(loc, state, "image variables may only be declared 
"
+ "as function parameters or uniform-qualified "
+ "global variables");
+ }
   }



There doesn't see to be any reason to combine these like this. Why not just:

   if (base_type->is_image()) {
  if (var->data.mode != ir_var_uniform &&
  var->data.mode != ir_var_function_in) {
 _mesa_glsl_error(loc, state, "image variables may only be 
declared as "

  "function parameters or uniform-qualified "
  "global variables");
   } else if (base_type->is_bindless_image()) {
  if (var->data.mode != ir_var_auto &&
  var->data.mode != ir_var_uniform &&
  var->data.mode != ir_var_shader_in &&
  var->data.mode != ir_var_shader_out &&
  var->data.mode != ir_var_function_in &&
  var->data.mode != ir_var_function_out &&
  var->data.mode != ir_var_function_inout) {
 _mesa_glsl_error(loc, state, "bindless image variables may 
only be "

  "declared as shader inputs and outputs, as "
  "uniform variables, as temporary variables 
and as "

  "function parameters");
  }
   }





   var->data.image_read_only |= qual->flags.q.read_only;


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


Re: [Mesa-dev] [RFC PATCH 11/26] glsl: fix up an assertion in ir_texture::set_sampler()

2017-04-11 Thread Timothy Arceri

Patches 10-11:

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 1/2] radv: Use an offset instead of pointers for immutable samplers.

2017-04-11 Thread Dave Airlie
On 12 April 2017 at 09:16, Bas Nieuwenhuizen  wrote:
> Makes more sense when we hash the layout for the pipeline cache.

For the series:

Reviewed-by: Dave Airlie 
>
> Signed-off-by: Bas Nieuwenhuizen 
> ---
>  src/amd/common/ac_nir_to_llvm.c  | 12 ++-
>  src/amd/vulkan/radv_descriptor_set.c | 42 
> 
>  src/amd/vulkan/radv_descriptor_set.h | 10 +++--
>  src/amd/vulkan/radv_private.h|  2 +-
>  4 files changed, 39 insertions(+), 27 deletions(-)
>
> diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
> index 6fd2a0c4f62..9bcd5f6db46 100644
> --- a/src/amd/common/ac_nir_to_llvm.c
> +++ b/src/amd/common/ac_nir_to_llvm.c
> @@ -3973,16 +3973,18 @@ static LLVMValueRef get_sampler_desc(struct 
> nir_to_llvm_context *ctx,
>
> constant_index = child->base_offset;
> }
> -   if (desc_type == DESC_SAMPLER && binding->immutable_samplers &&
> +   if (desc_type == DESC_SAMPLER && binding->immutable_samplers_offset &&
> (!index || binding->immutable_samplers_equal)) {
> if (binding->immutable_samplers_equal)
> constant_index = 0;
>
> +   const uint32_t *samplers = radv_immutable_samplers(layout, 
> binding);
> +
> LLVMValueRef constants[] = {
> -   LLVMConstInt(ctx->i32, 
> binding->immutable_samplers[constant_index * 4 + 0], 0),
> -   LLVMConstInt(ctx->i32, 
> binding->immutable_samplers[constant_index * 4 + 1], 0),
> -   LLVMConstInt(ctx->i32, 
> binding->immutable_samplers[constant_index * 4 + 2], 0),
> -   LLVMConstInt(ctx->i32, 
> binding->immutable_samplers[constant_index * 4 + 3], 0),
> +   LLVMConstInt(ctx->i32, samplers[constant_index * 4 + 
> 0], 0),
> +   LLVMConstInt(ctx->i32, samplers[constant_index * 4 + 
> 1], 0),
> +   LLVMConstInt(ctx->i32, samplers[constant_index * 4 + 
> 2], 0),
> +   LLVMConstInt(ctx->i32, samplers[constant_index * 4 + 
> 3], 0),
> };
> return ac_build_gather_values(&ctx->ac, constants, 4);
> }
> diff --git a/src/amd/vulkan/radv_descriptor_set.c 
> b/src/amd/vulkan/radv_descriptor_set.c
> index c2bf006f342..ba5d5eb75e5 100644
> --- a/src/amd/vulkan/radv_descriptor_set.c
> +++ b/src/amd/vulkan/radv_descriptor_set.c
> @@ -50,9 +50,9 @@ VkResult radv_CreateDescriptorSetLayout(
> immutable_sampler_count += 
> pCreateInfo->pBindings[j].descriptorCount;
> }
>
> -   size_t size = sizeof(struct radv_descriptor_set_layout) +
> -   (max_binding + 1) * sizeof(set_layout->binding[0]) +
> -   immutable_sampler_count * 4 * sizeof(uint32_t);
> +   uint32_t samplers_offset = sizeof(struct radv_descriptor_set_layout) +
> +   (max_binding + 1) * sizeof(set_layout->binding[0]);
> +   size_t size = samplers_offset + immutable_sampler_count * 4 * 
> sizeof(uint32_t);
>
> set_layout = vk_alloc2(&device->alloc, pAllocator, size, 8,
>  VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
> @@ -128,15 +128,14 @@ VkResult radv_CreateDescriptorSetLayout(
> set_layout->binding[b].dynamic_offset_offset = 
> dynamic_offset_count;
>
> if (binding->pImmutableSamplers) {
> -   set_layout->binding[b].immutable_samplers = samplers;
> +   set_layout->binding[b].immutable_samplers_offset = 
> samplers_offset;
> set_layout->binding[b].immutable_samplers_equal = 
> true;
> -   samplers += 4 * binding->descriptorCount;
> +
>
> for (uint32_t i = 0; i < binding->descriptorCount; 
> i++)
> -   
> memcpy(set_layout->binding[b].immutable_samplers + 4 * i, 
> &radv_sampler_from_handle(binding->pImmutableSamplers[i])->state, 16);
> +   memcpy(samplers + 4 * i, 
> &radv_sampler_from_handle(binding->pImmutableSamplers[i])->state, 16);
> for (uint32_t i = 1; i < binding->descriptorCount; 
> i++)
> -   if 
> (memcmp(set_layout->binding[b].immutable_samplers + 4 * i,
> -  
> set_layout->binding[b].immutable_samplers, 16) != 0)
> +   if (memcmp(samplers + 4 * i, samplers, 16) != 
> 0)
> 
> set_layout->binding[b].immutable_samplers_equal = false;
>
> /* Don't reserve space for the samplers if they're 
> not accessed. */
> @@ -146,6 +145,8 @@ VkResult radv_CreateDescriptorSetLayout(
> else if (binding->descriptorType == 
> VK_DESCRIPTOR_TYPE_SAMPLER)
> set_layout->binding[b].size -= 16;
>  

Re: [Mesa-dev] [PATCH] radv: Stop shadowing the result in radv_GetQueryPoolResults.

2017-04-11 Thread Dave Airlie
On 12 April 2017 at 08:48, Bas Nieuwenhuizen  wrote:
> The outer result was referred to, which meant bugs.
>
> Signed-off-by: Bas Nieuwenhuizen 

Oops,

Reviewed-by: Dave Airlie 

> ---
>  src/amd/vulkan/radv_query.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/src/amd/vulkan/radv_query.c b/src/amd/vulkan/radv_query.c
> index bd293b58e69..fa5a3b6df24 100644
> --- a/src/amd/vulkan/radv_query.c
> +++ b/src/amd/vulkan/radv_query.c
> @@ -876,7 +876,7 @@ VkResult radv_GetQueryPoolResults(
> }
> case VK_QUERY_TYPE_OCCLUSION: {
> volatile uint64_t const *src64 = (volatile uint64_t 
> const *)src;
> -   uint64_t result = 0;
> +   uint64_t sample_count = 0;
> int db_count = get_max_db(device);
> available = 1;
>
> @@ -890,7 +890,7 @@ VkResult radv_GetQueryPoolResults(
> if (!(start & (1ull << 63)) || !(end & (1ull 
> << 63)))
> available = 0;
> else {
> -   result += end - start;
> +   sample_count += end - start;
> }
> }
>
> @@ -901,10 +901,10 @@ VkResult radv_GetQueryPoolResults(
> }
>
> if (flags & VK_QUERY_RESULT_64_BIT) {
> -   *(uint64_t*)dest = result;
> +   *(uint64_t*)dest = sample_count;
> dest += 8;
> } else {
> -   *(uint32_t*)dest = result;
> +   *(uint32_t*)dest = sample_count;
> dest += 4;
> }
> break;
> --
> 2.12.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] [RFC PATCH 08/26] glsl: select bindless sampler/image types on the fly

2017-04-11 Thread Timothy Arceri



On 12/04/17 02:48, Samuel Pitoiset wrote:

At this point, there is enough information to take the decision
to replace a sampler/image type by the corresponding bindless one.

Signed-off-by: Samuel Pitoiset 
---
 src/compiler/glsl/ast.h  | 10 -
 src/compiler/glsl/ast_to_hir.cpp | 93 ++--
 2 files changed, 98 insertions(+), 5 deletions(-)

diff --git a/src/compiler/glsl/ast.h b/src/compiler/glsl/ast.h
index 9327e03979..2a2dd4bcd9 100644
--- a/src/compiler/glsl/ast.h
+++ b/src/compiler/glsl/ast.h
@@ -894,8 +894,14 @@ public:
}

const struct glsl_type *glsl_type(const char **name,
-struct _mesa_glsl_parse_state *state)
-  const;
+ struct _mesa_glsl_parse_state *state,
+ bool is_interface_block = false) const;
+
+   bool is_temporary_storage() const;
+
+   bool is_bindless_type(const struct glsl_type *type,
+ struct _mesa_glsl_parse_state *state,
+ bool is_interface_block) const;

ast_type_qualifier qualifier;
ast_type_specifier *specifier;
diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index 5043d6a574..4a0f3fe315 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -2646,9 +2646,96 @@ select_gles_precision(unsigned qual_precision,

 const glsl_type *
 ast_fully_specified_type::glsl_type(const char **name,
-struct _mesa_glsl_parse_state *state) const
+struct _mesa_glsl_parse_state *state,
+bool is_interface_block) const
 {
-   return this->specifier->glsl_type(name, state);
+   const struct glsl_type *type;
+
+   type = this->specifier->glsl_type(name, state);
+   if (!type)
+  return NULL;
+
+   /* Bindless sampler/image types are replaced on-the-fly if needed as
+* specified by ARB_bindless_texture. */
+   if (state->has_bindless()) {


Can we simplify this to:

if (state->has_bindless() &&
is_bindless_type(type, state, is_interface_block)) {

And drop the two calls below. By now we should have already thrown an 
error if the bindless qualifiers were not applied to an image/sampler right?



+  if (type->is_sampler()) {
+ if (is_bindless_type(type, state, is_interface_block)) {
+type = glsl_type::get_sampler_instance(
+ (glsl_sampler_dim)type->sampler_dimensionality,
+ type->sampler_shadow,
+ type->sampler_array,
+ (glsl_base_type)type->sampled_type,
+ true);
+ }
+  }
+  if (type->is_image()) {
+ if (is_bindless_type(type, state, is_interface_block)) {
+type = glsl_type::get_image_instance(
+ (glsl_sampler_dim)type->sampler_dimensionality,
+ type->sampler_array,
+ (glsl_base_type)type->sampled_type,
+ true);
+ }
+  }
+   }
+
+   return type;
+}
+
+bool
+ast_fully_specified_type::is_temporary_storage() const
+{
+   return (!qualifier.flags.q.in &&
+   !qualifier.flags.q.out &&
+   !qualifier.flags.q.attribute &&
+   !qualifier.flags.q.varying &&
+   !qualifier.flags.q.uniform &&
+   !qualifier.flags.q.buffer &&
+   !qualifier.flags.q.shared_storage);
+}
+
+bool
+ast_fully_specified_type::is_bindless_type(const struct glsl_type *type,
+   struct _mesa_glsl_parse_state 
*state,
+   bool is_interface_block) const
+{
+   /* The bindless_sampler (and respectively bindless_image) layout qualifiers
+* can be set as local scope, as well as at global scope. */
+   if (qualifier.flags.q.bindless_sampler ||
+   qualifier.flags.q.bindless_image ||
+   state->bindless_sampler_specified ||
+   state->bindless_image_specified)
+  return true;
+
+   /* The ARB_bindless_texture spec says:
+*
+* "Modify Section 4.3.7, Interface Blocks, p. 38"
+*
+* "(remove the following bullet from the last list on p. 39, thereby
+*  permitting sampler types in interface blocks; image types are also
+*  permitted in blocks by this extension)"
+*
+** sampler types are not allowed
+*/
+   if (is_interface_block)
+  return true;
+
+   /* The ARB_bindless_texture spec says:
+*
+* "Replace Section 4.1.7 (Samplers), p. 25"
+*
+* "Samplers may be declared as shader inputs and outputs, as uniform
+*  variables, as temporary variables, and as function parameters"
+*
+* "Replace Section 4.1.X, (Images)"
+*
+* "Images may be declared as shader inputs and outputs, as uniform
+*  variables, as temporary variables, and as function parameters."
+*/
+   if (qualifier.flag

Re: [Mesa-dev] [RFC PATCH 05/26] glsl: add new glsl_type helpers for bindless sampler/image types

2017-04-11 Thread Timothy Arceri

Patches 2-5:

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


Re: [Mesa-dev] [RFC PATCH 07/26] glsl: process bindless/bound layout qualifiers

2017-04-11 Thread Timothy Arceri



On 12/04/17 02:48, Samuel Pitoiset wrote:

This adds bindless_sampler and bound_sampler (and respectively
bindless_image and bound_image) to the parser.

Signed-off-by: Samuel Pitoiset 
---
 src/compiler/glsl/ast.h  |  8 +
 src/compiler/glsl/ast_to_hir.cpp | 55 
 src/compiler/glsl/ast_type.cpp   | 55 
 src/compiler/glsl/glsl_parser.yy | 21 
 src/compiler/glsl/glsl_parser_extras.cpp | 11 +++
 src/compiler/glsl/glsl_parser_extras.h   | 10 ++
 src/compiler/glsl/ir.cpp |  1 +
 src/compiler/glsl/ir.h   |  6 
 src/compiler/glsl/ir_print_visitor.cpp   |  5 +--
 src/mesa/main/mtypes.h   | 10 ++
 10 files changed, 180 insertions(+), 2 deletions(-)

diff --git a/src/compiler/glsl/ast.h b/src/compiler/glsl/ast.h
index 455cb8113c..9327e03979 100644
--- a/src/compiler/glsl/ast.h
+++ b/src/compiler/glsl/ast.h
@@ -622,6 +622,14 @@ struct ast_type_qualifier {
   * is used.
   */
  unsigned inner_coverage:1;
+
+ /** \name Layout qualifiers for GL_ARB_bindless_texture */
+ /** \{ */
+ unsigned bindless_sampler:1;
+ unsigned bindless_image:1;
+ unsigned bound_sampler:1;
+ unsigned bound_image:1;
+ /** \} */
   }
   /** \brief Set of flags, accessed by name. */
   q;
diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index 38c0f5c8d4..5043d6a574 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -3415,6 +3415,55 @@ validate_array_dimensions(const glsl_type *t,
 }

 static void
+apply_bindless_qualifier_to_variable(const struct ast_type_qualifier *qual,
+ ir_variable *var,
+ struct _mesa_glsl_parse_state *state,
+ YYLTYPE *loc)
+{
+   /* The ARB_bindless_texture spec says:
+*
+*  "Modify Section 4.4.6 Opaque-Uniform Layout Qualifiers of the GLSL 4.30
+*   spec"
+*
+*  "If these layout qualifiers are applied to other types of default block
+*   uniforms, or variables with non-uniform storage, a compile-time error
+*   will be generated."
+*/
+   if (!qual->flags.q.uniform) {
+  _mesa_glsl_error(loc, state, "ARB_bindless_texture layout qualifiers "
+   "can only be applied to default block uniforms or "
+   "variables with uniform storage");
+  return;
+   }
+
+   /* The ARB_bindless_texture spec doesn't state anything in this situation,
+* but it makes sense to only allow bindless_sampler/bound_sampler for
+* sampler types, and respectively bindless_image/bound_image for image
+* types.
+*/
+   if (qual->flags.q.bindless_sampler || qual->flags.q.bound_sampler) {
+  if (!var->type->contains_bindless_sampler() &&
+  !var->type->contains_sampler()) {
+ _mesa_glsl_error(loc, state, "bindless_sampler or bound_sampler can "
+  "only be applied to sampler types");
+ return;
+  }
+   }
+
+   if (qual->flags.q.bindless_image || qual->flags.q.bound_image) {
+  if (!var->type->contains_bindless_image() &&
+  !var->type->contains_image()) {
+ _mesa_glsl_error(loc, state, "bindless_image or bound_image can "
+  "only be applied to image types");
+ return;
+  }
+   }
+
+   var->data.bindless =
+  qual->flags.q.bindless_sampler || qual->flags.q.bindless_image;
+}
+
+static void
 apply_layout_qualifier_to_variable(const struct ast_type_qualifier *qual,
ir_variable *var,
struct _mesa_glsl_parse_state *state,
@@ -3711,6 +3760,12 @@ apply_layout_qualifier_to_variable(const struct 
ast_type_qualifier *qual,
   _mesa_glsl_error(loc, state, "post_depth_coverage layout qualifier only "
"valid in fragment shader input layout declaration.");
}
+
+   if (qual->flags.q.bindless_sampler
+   || qual->flags.q.bindless_image
+   || qual->flags.q.bound_sampler
+   || qual->flags.q.bound_image)
+  apply_bindless_qualifier_to_variable(qual, var, state, loc);
 }

 static void
diff --git a/src/compiler/glsl/ast_type.cpp b/src/compiler/glsl/ast_type.cpp
index d302fc45fd..cf84528775 100644
--- a/src/compiler/glsl/ast_type.cpp
+++ b/src/compiler/glsl/ast_type.cpp
@@ -69,6 +69,10 @@ ast_type_qualifier::has_layout() const
   || this->flags.q.column_major
   || this->flags.q.row_major
   || this->flags.q.packed
+  || this->flags.q.bindless_sampler
+  || this->flags.q.bindless_image
+  || this->flags.q.bound_sampler
+  || this->flags.q.bound_image
   || this->flags.q.explicit_align
   || this->flags.q.explicit_component

Re: [Mesa-dev] [PATCH] sync_file: get rid of internal reference count.

2017-04-11 Thread Dave Airlie
On 12 April 2017 at 09:27, Dave Airlie  wrote:
> From: Dave Airlie 
>
> sync_file uses the reference count of the file, the internal
> kref was never getting moved past 1.

oops typoed my send script, thanks Bas for pointing it out.

Wrong list.

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


Re: [Mesa-dev] [PATCH 15/15] i965: add missing ir_unop_*/ir_binop_* in visit_leave()

2017-04-11 Thread Timothy Arceri

Reviewed-by: Timothy Arceri 

On 12/04/17 03:58, Samuel Pitoiset wrote:

Fixes the following Clang warnings.

brw_fs_channel_expressions.cpp:219:12: warning: enumeration values 
'ir_unop_ballot', 'ir_unop_read_first_invocation', and 
'ir_binop_read_invocation' not handled in switch [-Wswitch]
   switch (expr->operation) {
   ^
1 warning generated.

Signed-off-by: Samuel Pitoiset 
---
 src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp 
b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
index 76dbc06535..58fa207880 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
@@ -470,6 +470,9 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment 
*ir)
case ir_unop_vote_eq:
case ir_unop_unpack_int_2x32:
case ir_unop_unpack_uint_2x32:
+   case ir_unop_ballot:
+   case ir_unop_read_first_invocation:
+   case ir_binop_read_invocation:
   unreachable("unsupported");
}



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


Re: [Mesa-dev] [PATCH 02/15] mesa: remove unused _mesa_unmarshal_BindBufferBase()

2017-04-11 Thread Timothy Arceri

Reviewed-by: Timothy Arceri 

On 12/04/17 03:58, Samuel Pitoiset wrote:

Fixes the following Clang warning.

main/marshal.c:209:1: warning: unused function '_mesa_unmarshal_BindBufferBase' 
[-Wunused-function]
_mesa_unmarshal_BindBufferBase(struct gl_context *ctx, const struct 
marshal_cmd_BindBufferBase *cmd)
^
1 warning generated.

Signed-off-by: Samuel Pitoiset 
---
 src/mesa/main/marshal.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/src/mesa/main/marshal.c b/src/mesa/main/marshal.c
index ae32d257e9..ae4efb5ecb 100644
--- a/src/mesa/main/marshal.c
+++ b/src/mesa/main/marshal.c
@@ -205,14 +205,6 @@ struct marshal_cmd_BindBufferBase
GLuint index;
GLuint buffer;
 };
-static inline void
-_mesa_unmarshal_BindBufferBase(struct gl_context *ctx, const struct 
marshal_cmd_BindBufferBase *cmd)
-{
-   const GLenum target = cmd->target;
-   const GLuint index = cmd->index;
-   const GLuint buffer = cmd->buffer;
-   CALL_BindBufferBase(ctx->CurrentServerDispatch, (target, index, buffer));
-}

 /** Tracks the current bindings for the vertex array and index array buffers.
  *


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


[Mesa-dev] [PATCH] sync_file: get rid of internal reference count.

2017-04-11 Thread Dave Airlie
From: Dave Airlie 

sync_file uses the reference count of the file, the internal
kref was never getting moved past 1.

We can reintroduce this if we decide we need it later.

Signed-off-by: Dave Airlie 
---
 drivers/dma-buf/sync_file.c | 13 ++---
 include/linux/sync_file.h   |  1 -
 2 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/drivers/dma-buf/sync_file.c b/drivers/dma-buf/sync_file.c
index 2321035..dc89b1d 100644
--- a/drivers/dma-buf/sync_file.c
+++ b/drivers/dma-buf/sync_file.c
@@ -41,8 +41,6 @@ static struct sync_file *sync_file_alloc(void)
if (IS_ERR(sync_file->file))
goto err;
 
-   kref_init(&sync_file->kref);
-
init_waitqueue_head(&sync_file->wq);
 
INIT_LIST_HEAD(&sync_file->cb.node);
@@ -277,22 +275,15 @@ static struct sync_file *sync_file_merge(const char 
*name, struct sync_file *a,
 
 }
 
-static void sync_file_free(struct kref *kref)
+static int sync_file_release(struct inode *inode, struct file *file)
 {
-   struct sync_file *sync_file = container_of(kref, struct sync_file,
-kref);
+   struct sync_file *sync_file = file->private_data;
 
if (test_bit(POLL_ENABLED, &sync_file->fence->flags))
dma_fence_remove_callback(sync_file->fence, &sync_file->cb);
dma_fence_put(sync_file->fence);
kfree(sync_file);
-}
-
-static int sync_file_release(struct inode *inode, struct file *file)
-{
-   struct sync_file *sync_file = file->private_data;
 
-   kref_put(&sync_file->kref, sync_file_free);
return 0;
 }
 
diff --git a/include/linux/sync_file.h b/include/linux/sync_file.h
index 3e3ab84..4fa06c1 100644
--- a/include/linux/sync_file.h
+++ b/include/linux/sync_file.h
@@ -33,7 +33,6 @@
  */
 struct sync_file {
struct file *file;
-   struct kref kref;
charname[32];
 #ifdef CONFIG_DEBUG_FS
struct list_headsync_file_list;
-- 
2.9.3

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


[Mesa-dev] [PATCH 2/2] radv: Hash the immutable samplers.

2017-04-11 Thread Bas Nieuwenhuizen
Since the shader code can include them.

Signed-off-by: Bas Nieuwenhuizen 
---
 src/amd/vulkan/radv_descriptor_set.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/amd/vulkan/radv_descriptor_set.c 
b/src/amd/vulkan/radv_descriptor_set.c
index ba5d5eb75e5..c048a4c7f53 100644
--- a/src/amd/vulkan/radv_descriptor_set.c
+++ b/src/amd/vulkan/radv_descriptor_set.c
@@ -214,6 +214,9 @@ VkResult radv_CreatePipelineLayout(
layout->set[set].dynamic_offset_start = dynamic_offset_count;
for (uint32_t b = 0; b < set_layout->binding_count; b++) {
dynamic_offset_count += 
set_layout->binding[b].array_size * set_layout->binding[b].dynamic_offset_count;
+   if (set_layout->binding[b].immutable_samplers_offset)
+   _mesa_sha1_update(&ctx, 
radv_immutable_samplers(set_layout, set_layout->binding + b),
+ 
set_layout->binding[b].array_size * 4 * sizeof(uint32_t));
}
_mesa_sha1_update(&ctx, set_layout->binding,
  sizeof(set_layout->binding[0]) * 
set_layout->binding_count);
-- 
2.12.2

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


[Mesa-dev] [PATCH 1/2] radv: Use an offset instead of pointers for immutable samplers.

2017-04-11 Thread Bas Nieuwenhuizen
Makes more sense when we hash the layout for the pipeline cache.

Signed-off-by: Bas Nieuwenhuizen 
---
 src/amd/common/ac_nir_to_llvm.c  | 12 ++-
 src/amd/vulkan/radv_descriptor_set.c | 42 
 src/amd/vulkan/radv_descriptor_set.h | 10 +++--
 src/amd/vulkan/radv_private.h|  2 +-
 4 files changed, 39 insertions(+), 27 deletions(-)

diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index 6fd2a0c4f62..9bcd5f6db46 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -3973,16 +3973,18 @@ static LLVMValueRef get_sampler_desc(struct 
nir_to_llvm_context *ctx,
 
constant_index = child->base_offset;
}
-   if (desc_type == DESC_SAMPLER && binding->immutable_samplers &&
+   if (desc_type == DESC_SAMPLER && binding->immutable_samplers_offset &&
(!index || binding->immutable_samplers_equal)) {
if (binding->immutable_samplers_equal)
constant_index = 0;
 
+   const uint32_t *samplers = radv_immutable_samplers(layout, 
binding);
+
LLVMValueRef constants[] = {
-   LLVMConstInt(ctx->i32, 
binding->immutable_samplers[constant_index * 4 + 0], 0),
-   LLVMConstInt(ctx->i32, 
binding->immutable_samplers[constant_index * 4 + 1], 0),
-   LLVMConstInt(ctx->i32, 
binding->immutable_samplers[constant_index * 4 + 2], 0),
-   LLVMConstInt(ctx->i32, 
binding->immutable_samplers[constant_index * 4 + 3], 0),
+   LLVMConstInt(ctx->i32, samplers[constant_index * 4 + 
0], 0),
+   LLVMConstInt(ctx->i32, samplers[constant_index * 4 + 
1], 0),
+   LLVMConstInt(ctx->i32, samplers[constant_index * 4 + 
2], 0),
+   LLVMConstInt(ctx->i32, samplers[constant_index * 4 + 
3], 0),
};
return ac_build_gather_values(&ctx->ac, constants, 4);
}
diff --git a/src/amd/vulkan/radv_descriptor_set.c 
b/src/amd/vulkan/radv_descriptor_set.c
index c2bf006f342..ba5d5eb75e5 100644
--- a/src/amd/vulkan/radv_descriptor_set.c
+++ b/src/amd/vulkan/radv_descriptor_set.c
@@ -50,9 +50,9 @@ VkResult radv_CreateDescriptorSetLayout(
immutable_sampler_count += 
pCreateInfo->pBindings[j].descriptorCount;
}
 
-   size_t size = sizeof(struct radv_descriptor_set_layout) +
-   (max_binding + 1) * sizeof(set_layout->binding[0]) +
-   immutable_sampler_count * 4 * sizeof(uint32_t);
+   uint32_t samplers_offset = sizeof(struct radv_descriptor_set_layout) +
+   (max_binding + 1) * sizeof(set_layout->binding[0]);
+   size_t size = samplers_offset + immutable_sampler_count * 4 * 
sizeof(uint32_t);
 
set_layout = vk_alloc2(&device->alloc, pAllocator, size, 8,
 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
@@ -128,15 +128,14 @@ VkResult radv_CreateDescriptorSetLayout(
set_layout->binding[b].dynamic_offset_offset = 
dynamic_offset_count;
 
if (binding->pImmutableSamplers) {
-   set_layout->binding[b].immutable_samplers = samplers;
+   set_layout->binding[b].immutable_samplers_offset = 
samplers_offset;
set_layout->binding[b].immutable_samplers_equal = true;
-   samplers += 4 * binding->descriptorCount;
+
 
for (uint32_t i = 0; i < binding->descriptorCount; i++)
-   
memcpy(set_layout->binding[b].immutable_samplers + 4 * i, 
&radv_sampler_from_handle(binding->pImmutableSamplers[i])->state, 16);
+   memcpy(samplers + 4 * i, 
&radv_sampler_from_handle(binding->pImmutableSamplers[i])->state, 16);
for (uint32_t i = 1; i < binding->descriptorCount; i++)
-   if 
(memcmp(set_layout->binding[b].immutable_samplers + 4 * i,
-  
set_layout->binding[b].immutable_samplers, 16) != 0)
+   if (memcmp(samplers + 4 * i, samplers, 16) != 0)

set_layout->binding[b].immutable_samplers_equal = false;
 
/* Don't reserve space for the samplers if they're not 
accessed. */
@@ -146,6 +145,8 @@ VkResult radv_CreateDescriptorSetLayout(
else if (binding->descriptorType == 
VK_DESCRIPTOR_TYPE_SAMPLER)
set_layout->binding[b].size -= 16;
}
+   samplers += 4 * binding->descriptorCount;
+   samplers_offset += 4 * sizeof(uint32_t) * 
binding->descriptorCount;
}
 
set_layout->size += binding->descriptorCount * 
set_layout->binding[b].size;
@@ -333,7 +334,7 @@

Re: [Mesa-dev] [PATCH 00/15] Clang compiler warning fixes

2017-04-11 Thread Mike Lothian
When trying to test these I notice that even without the patches clover
isn't compiling

/var/tmp/portage/media-libs/mesa-/work/mesa-/src/gallium/state_trackers/clover/llvm/codegen/common.cpp:132:54:
error: ‘Offset’ is not a member of ‘clang::LangAS’
   -
clang::LangAS::Offset]) {
 ^


On Tue, 11 Apr 2017 at 19:11 Brian Paul  wrote:

> On 04/11/2017 11:58 AM, Samuel Pitoiset wrote:
> > Noticed while building my whole ARB_bindless_texture work to avoid
> > missing switch cases, etc. This series doesn't fix all warnings, just
> > the easy ones.
> >
> > Please, review!
> > Thanks.
>
> For 1-14, Reviewed-by: Brian Paul 
>
> -Brian
>
>
> >
> > Samuel Pitoiset (15):
> >virgl: add missing PIPE_CAP_DOUBLES
> >mesa: remove unused _mesa_unmarshal_BindBufferBase()
> >mesa: remove unused clamp_float_to_uint() and clamp_half_to_uint()
> >mesa: remove some unused functions in the perf monitor area
> >draw: remove unused overflow()
> >draw: remove unused wideline_stage()
> >trace: remove some unused trace_dump_tag*() functions
> >softpipe: remove unused get_texel_quad_2d()
> >softpipe: remove unused quad_shade_stage()
> >softpipe: remove unused sp_exec_fragment_shader()
> >llvmpipe: remove unused subpixel_snap() and fixed_to_float()
> >svga: remove unused vmw_dri1_intersect_src_bbox()
> >radeon: remove duplicate 'const' specifier
> >st/mesa: fix wrong comparison in update_framebuffer_state()
> >i965: add missing ir_unop_*/ir_binop_* in visit_leave()
> >
> >   src/gallium/auxiliary/draw/draw_pipe_vbuf.c|  8 
> >   src/gallium/auxiliary/draw/draw_pipe_wide_line.c   |  8 
> >   src/gallium/drivers/llvmpipe/lp_setup_tri.c| 12 -
> >   src/gallium/drivers/softpipe/sp_fs_exec.c  |  8 
> >   src/gallium/drivers/softpipe/sp_quad_fs.c  |  8 
> >   src/gallium/drivers/softpipe/sp_tex_sample.c   | 17 ---
> >   src/gallium/drivers/trace/tr_dump.c| 52
> --
> >   src/gallium/drivers/virgl/virgl_screen.c   |  1 +
> >   src/gallium/winsys/svga/drm/vmw_screen_dri.c   | 32 -
> >   .../dri/i965/brw_fs_channel_expressions.cpp|  3 ++
> >   .../drivers/dri/radeon/radeon_common_context.c |  2 +-
> >   .../drivers/dri/radeon/radeon_common_context.h |  2 +-
> >   src/mesa/main/marshal.c|  8 
> >   src/mesa/main/pack.c   | 15 ---
> >   src/mesa/main/performance_monitor.c| 27 ---
> >   src/mesa/state_tracker/st_atom_framebuffer.c   |  8 ++--
> >   16 files changed, 10 insertions(+), 201 deletions(-)
> >
>
> ___
> 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 2/9] radv: simplify if statement

2017-04-11 Thread Bas Nieuwenhuizen
On Wed, Apr 12, 2017 at 12:48 AM, Dave Airlie  wrote:
> On 12 April 2017 at 08:19, Bas Nieuwenhuizen  wrote:
>> On Wed, Apr 12, 2017 at 12:04 AM, Thomas Hindoe Paaboel Andersen
>>  wrote:
>>> ---
>>>  src/amd/vulkan/radv_wsi.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/src/amd/vulkan/radv_wsi.c b/src/amd/vulkan/radv_wsi.c
>>> index b8999f4..37cb322 100644
>>> --- a/src/amd/vulkan/radv_wsi.c
>>> +++ b/src/amd/vulkan/radv_wsi.c
>>> @@ -210,7 +210,7 @@ radv_wsi_image_create(VkDevice device_h,
>>>  * return the fd for the image in the no copy mode,
>>>  * or the fd for the linear image if a copy is required.
>>>  */
>>> -   if (!needs_linear_copy || (needs_linear_copy && linear)) {
>>> +   if (!needs_linear_copy || linear) {
>>
>> Dave, shouldn't this be
>>
>> (!needs_linear_copy && !linear) || (needs_linear_copy && linear)
>
> The only valid options on the API are
>
> needs_linear_copy = FALSE, linear = FALSE
> needs_linear_copy = TRUE, linear = FALSE
> needs_linear_copy = TRUE. linear = TRUE.
>
> So I suspect the patch is right.

Yeah, I think so too, but I'm wondering if this just reduces clarity.

Either way no strong opinions on this.

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


[Mesa-dev] [PATCH] radv: Stop shadowing the result in radv_GetQueryPoolResults.

2017-04-11 Thread Bas Nieuwenhuizen
The outer result was referred to, which meant bugs.

Signed-off-by: Bas Nieuwenhuizen 
---
 src/amd/vulkan/radv_query.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/amd/vulkan/radv_query.c b/src/amd/vulkan/radv_query.c
index bd293b58e69..fa5a3b6df24 100644
--- a/src/amd/vulkan/radv_query.c
+++ b/src/amd/vulkan/radv_query.c
@@ -876,7 +876,7 @@ VkResult radv_GetQueryPoolResults(
}
case VK_QUERY_TYPE_OCCLUSION: {
volatile uint64_t const *src64 = (volatile uint64_t 
const *)src;
-   uint64_t result = 0;
+   uint64_t sample_count = 0;
int db_count = get_max_db(device);
available = 1;
 
@@ -890,7 +890,7 @@ VkResult radv_GetQueryPoolResults(
if (!(start & (1ull << 63)) || !(end & (1ull << 
63)))
available = 0;
else {
-   result += end - start;
+   sample_count += end - start;
}
}
 
@@ -901,10 +901,10 @@ VkResult radv_GetQueryPoolResults(
}
 
if (flags & VK_QUERY_RESULT_64_BIT) {
-   *(uint64_t*)dest = result;
+   *(uint64_t*)dest = sample_count;
dest += 8;
} else {
-   *(uint32_t*)dest = result;
+   *(uint32_t*)dest = sample_count;
dest += 4;
}
break;
-- 
2.12.2

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


Re: [Mesa-dev] [PATCH 2/9] radv: simplify if statement

2017-04-11 Thread Dave Airlie
On 12 April 2017 at 08:19, Bas Nieuwenhuizen  wrote:
> On Wed, Apr 12, 2017 at 12:04 AM, Thomas Hindoe Paaboel Andersen
>  wrote:
>> ---
>>  src/amd/vulkan/radv_wsi.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/amd/vulkan/radv_wsi.c b/src/amd/vulkan/radv_wsi.c
>> index b8999f4..37cb322 100644
>> --- a/src/amd/vulkan/radv_wsi.c
>> +++ b/src/amd/vulkan/radv_wsi.c
>> @@ -210,7 +210,7 @@ radv_wsi_image_create(VkDevice device_h,
>>  * return the fd for the image in the no copy mode,
>>  * or the fd for the linear image if a copy is required.
>>  */
>> -   if (!needs_linear_copy || (needs_linear_copy && linear)) {
>> +   if (!needs_linear_copy || linear) {
>
> Dave, shouldn't this be
>
> (!needs_linear_copy && !linear) || (needs_linear_copy && linear)

The only valid options on the API are

needs_linear_copy = FALSE, linear = FALSE
needs_linear_copy = TRUE, linear = FALSE
needs_linear_copy = TRUE. linear = TRUE.

So I suspect the patch is right.

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


Re: [Mesa-dev] [RFC PATCH 3/3] gallium: remove pipe_index_buffer and set_index_buffer

2017-04-11 Thread Marek Olšák
On Wed, Apr 12, 2017 at 12:27 AM, Roland Scheidegger  wrote:
> As mentioned before, I'm not exactly thrilled by this (as I just happen
> to like the old interface), but could live with it for GL's performance
> sake, if others like that. I suppose though you'd have quite some code
> to adapt...
> Are those performance numbers with just this patch or all 3?

Just this patch.

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


Re: [Mesa-dev] [RFC PATCH 3/3] gallium: remove pipe_index_buffer and set_index_buffer

2017-04-11 Thread Roland Scheidegger
As mentioned before, I'm not exactly thrilled by this (as I just happen
to like the old interface), but could live with it for GL's performance
sake, if others like that. I suppose though you'd have quite some code
to adapt...
Are those performance numbers with just this patch or all 3?

Roland


Am 11.04.2017 um 22:15 schrieb Marek Olšák:
> From: Marek Olšák 
> 
> pipe_draw_info::indexed is replaced with index_size. index_size == 0 means
> non-indexed.
> 
> Instead of pipe_index_buffer::offset, pipe_draw_info::start is used.
> For indexed indirect draws, pipe_draw_info::start is added to the indirect
> start. This is the only case when "start" affects indirect draws.
> 
> pipe_draw_info::index is a union. Use either index::buffer or
> index::user_buffer depending on the value of pipe_draw_info
> ::has_user_indices.
> 
> Performance numbers with the drawoverhead microbenchmark.
> 
> Before::
>DrawElements only: 4.5 million draws/second
>DrawElements w/ nop state change: 4.4 million draws/sec (overhead: 
> 0.07 ms/draw)
>DrawElements w/ state change: 1.9 million draws/sec (overhead: 0.000293 
> ms/draw)
> 
> After:
>DrawElements only: 5.0 million draws/second
>DrawElements w/ nop state change: 4.9 million draws/sec (overhead: 
> 0.07 ms/draw)
>DrawElements w/ state change: 2.2 million draws/sec (overhead: 0.000254 
> ms/draw)
> 
> The improvement will be much smaller with real apps.
> ---
>  src/gallium/include/pipe/p_context.h |  4 
>  src/gallium/include/pipe/p_state.h   | 35 ++-
>  2 files changed, 18 insertions(+), 21 deletions(-)
> 
> diff --git a/src/gallium/include/pipe/p_context.h 
> b/src/gallium/include/pipe/p_context.h
> index 4d5535b..4b75386 100644
> --- a/src/gallium/include/pipe/p_context.h
> +++ b/src/gallium/include/pipe/p_context.h
> @@ -53,7 +53,6 @@ struct pipe_grid_info;
>  struct pipe_fence_handle;
>  struct pipe_framebuffer_state;
>  struct pipe_image_view;
> -struct pipe_index_buffer;
>  struct pipe_query;
>  struct pipe_poly_stipple;
>  struct pipe_rasterizer_state;
> @@ -354,9 +353,6 @@ struct pipe_context {
> unsigned num_buffers,
> const struct pipe_vertex_buffer * );
>  
> -   void (*set_index_buffer)( struct pipe_context *pipe,
> - const struct pipe_index_buffer * );
> -
> /*@}*/
>  
> /**
> diff --git a/src/gallium/include/pipe/p_state.h 
> b/src/gallium/include/pipe/p_state.h
> index 69d2378..7f482d4 100644
> --- a/src/gallium/include/pipe/p_state.h
> +++ b/src/gallium/include/pipe/p_state.h
> @@ -630,19 +630,6 @@ struct pipe_vertex_element
>  };
>  
>  
> -/**
> - * An index buffer.  When an index buffer is bound, all indices to vertices
> - * will be looked up in the buffer.
> - */
> -struct pipe_index_buffer
> -{
> -   unsigned index_size;  /**< size of an index, in bytes */
> -   unsigned offset;  /**< offset to start of data in buffer, in bytes */
> -   struct pipe_resource *buffer; /**< the actual buffer */
> -   const void *user_buffer;  /**< pointer to a user buffer if buffer == NULL 
> */
> -};
> -
> -
>  struct pipe_draw_indirect_info
>  {
> unsigned offset; /**< must be 4 byte aligned */
> @@ -652,7 +639,7 @@ struct pipe_draw_indirect_info
>  
> /* Indirect draw parameters resource is laid out as follows:
>  *
> -* if indexed is TRUE:
> +* if using indexed drawing:
>  *  struct {
>  * uint32_t count;
>  * uint32_t instance_count;
> @@ -682,12 +669,18 @@ struct pipe_draw_indirect_info
>   */
>  struct pipe_draw_info
>  {
> -   boolean indexed;  /**< use index buffer */
> +   ubyte index_size;  /**< if 0, the draw is not indexed. */
> enum pipe_prim_type mode:8;  /**< the mode of the primitive */
> -   boolean primitive_restart;
> +   unsigned primitive_restart:1;
> +   unsigned has_user_indices:1; /**< if true, use index.user_buffer */
> ubyte vertices_per_patch; /**< the number of vertices per patch */
>  
> -   unsigned start;  /**< the index of the first vertex */
> +   /**
> +* Direct draws: start is the index of the first vertex
> +* Non-indexed indirect draws: not used
> +* Indexed indirect draws: start is added to the indirect start.
> +*/
> +   unsigned start;
> unsigned count;  /**< number of vertices */
>  
> unsigned start_instance; /**< first instance id */
> @@ -709,6 +702,14 @@ struct pipe_draw_info
>  
> /* Pointers must be at the end for an optimal structure layout on 64-bit. 
> */
>  
> +   /**
> +* An index buffer.  When an index buffer is bound, all indices to 
> vertices
> +* will be looked up from the buffer.
> +*
> +* If has_user_indices, use index.user_buffer, else use index.buffer.
> +*/
> +   union pipe_buffer_binding index;
> +
> struct pipe_draw_indirect_info *indirect; /**< Indirect draw. */
>  
> /**
> 

___
mesa-dev mailing li

Re: [Mesa-dev] [PATCH 1/9] radv: remove redundant returns

2017-04-11 Thread Bas Nieuwenhuizen
Patches 1 & 6 are

Reviewed-by: Bas Nieuwenhuizen 

On Wed, Apr 12, 2017 at 12:03 AM, Thomas Hindoe Paaboel Andersen
 wrote:
> From 1811ccf1
> ---
>  src/amd/vulkan/radv_device.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
> index 5f14394..9138a00 100644
> --- a/src/amd/vulkan/radv_device.c
> +++ b/src/amd/vulkan/radv_device.c
> @@ -749,7 +749,6 @@ void radv_GetPhysicalDeviceQueueFamilyProperties(
> RADV_FROM_HANDLE(radv_physical_device, pdevice, physicalDevice);
> if (!pQueueFamilyProperties) {
> return 
> radv_get_physical_device_queue_family_properties(pdevice, pCount, NULL);
> -   return;
> }
> VkQueueFamilyProperties *properties[] = {
> pQueueFamilyProperties + 0,
> @@ -768,7 +767,6 @@ void radv_GetPhysicalDeviceQueueFamilyProperties2KHR(
> RADV_FROM_HANDLE(radv_physical_device, pdevice, physicalDevice);
> if (!pQueueFamilyProperties) {
> return 
> radv_get_physical_device_queue_family_properties(pdevice, pCount, NULL);
> -   return;
> }
> VkQueueFamilyProperties *properties[] = {
> &pQueueFamilyProperties[0].queueFamilyProperties,
> --
> 2.9.3
>
> ___
> 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 2/9] radv: simplify if statement

2017-04-11 Thread Bas Nieuwenhuizen
On Wed, Apr 12, 2017 at 12:04 AM, Thomas Hindoe Paaboel Andersen
 wrote:
> ---
>  src/amd/vulkan/radv_wsi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/amd/vulkan/radv_wsi.c b/src/amd/vulkan/radv_wsi.c
> index b8999f4..37cb322 100644
> --- a/src/amd/vulkan/radv_wsi.c
> +++ b/src/amd/vulkan/radv_wsi.c
> @@ -210,7 +210,7 @@ radv_wsi_image_create(VkDevice device_h,
>  * return the fd for the image in the no copy mode,
>  * or the fd for the linear image if a copy is required.
>  */
> -   if (!needs_linear_copy || (needs_linear_copy && linear)) {
> +   if (!needs_linear_copy || linear) {

Dave, shouldn't this be

(!needs_linear_copy && !linear) || (needs_linear_copy && linear)

?
> RADV_FROM_HANDLE(radv_device, device, device_h);
> RADV_FROM_HANDLE(radv_device_memory, memory, memory_h);
> if (!radv_get_memory_fd(device, memory, &fd))
> --
> 2.9.3
>
> ___
> 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


[Mesa-dev] [PATCH 7/9] intel: remove null check before free

2017-04-11 Thread Thomas Hindoe Paaboel Andersen
---
 src/intel/tools/aubinator_error_decode.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/intel/tools/aubinator_error_decode.c 
b/src/intel/tools/aubinator_error_decode.c
index 2e62369..5df8aaf 100644
--- a/src/intel/tools/aubinator_error_decode.c
+++ b/src/intel/tools/aubinator_error_decode.c
@@ -727,8 +727,7 @@ main(int argc, char *argv[])
close(1);
wait(NULL);
 
-   if (xml_path)
-  free(xml_path);
+   free(xml_path);
 
return EXIT_SUCCESS;
 }
-- 
2.9.3

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


[Mesa-dev] [PATCH 5/9] i965: remove unused context

2017-04-11 Thread Thomas Hindoe Paaboel Andersen
---
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 2 --
 src/mesa/drivers/dri/i965/intel_pixel_draw.c  | 2 --
 2 files changed, 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c 
b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 81e2d6e..5d5c77f 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -2593,8 +2593,6 @@ intel_miptree_unmap_blit(struct brw_context *brw,
 unsigned int level,
 unsigned int slice)
 {
-   struct gl_context *ctx = &brw->ctx;
-
intel_miptree_unmap_raw(map->linear_mt);
 
if (map->mode & GL_MAP_WRITE_BIT) {
diff --git a/src/mesa/drivers/dri/i965/intel_pixel_draw.c 
b/src/mesa/drivers/dri/i965/intel_pixel_draw.c
index e84e473..a435800 100644
--- a/src/mesa/drivers/dri/i965/intel_pixel_draw.c
+++ b/src/mesa/drivers/dri/i965/intel_pixel_draw.c
@@ -151,8 +151,6 @@ intelDrawPixels(struct gl_context * ctx,
 const struct gl_pixelstore_attrib *unpack,
 const GLvoid * pixels)
 {
-   struct brw_context *brw = brw_context(ctx);
-
if (!_mesa_check_conditional_render(ctx))
   return;
 
-- 
2.9.3

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


[Mesa-dev] [PATCH 8/9] st/mesa: remove null check before free

2017-04-11 Thread Thomas Hindoe Paaboel Andersen
---
 src/mesa/state_tracker/st_cb_texture.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_texture.c 
b/src/mesa/state_tracker/st_cb_texture.c
index 99c59f7..73f784d 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -217,8 +217,7 @@ etc_fallback_allocate(struct st_context *st, struct 
st_texture_image *stImage)
if (!st_etc_fallback(st, texImage))
   return;
 
-   if (stImage->etc_data)
-  free(stImage->etc_data);
+   free(stImage->etc_data);
 
unsigned data_size = _mesa_format_image_size(texImage->TexFormat,
 texImage->Width2,
-- 
2.9.3

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


[Mesa-dev] [PATCH 4/9] mesa: fix misleading indentation

2017-04-11 Thread Thomas Hindoe Paaboel Andersen
---
 src/mesa/main/shaderapi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 187475f..9efb2e0 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -1110,7 +1110,7 @@ _mesa_link_program(struct gl_context *ctx, struct 
gl_shader_program *shProg)
  ctx->_Shader->CurrentProgram[stage]->Id == shProg->Name) {
 programs_in_use |= 1 << stage;
  }
-   }
+  }
 
FLUSH_VERTICES(ctx, 0);
_mesa_glsl_link_shader(ctx, shProg);
-- 
2.9.3

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


[Mesa-dev] [PATCH 9/9] util/disk_cache: remove null check before free

2017-04-11 Thread Thomas Hindoe Paaboel Andersen
---
 src/util/disk_cache.c | 15 +--
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
index d9de8ef..93fb1f5 100644
--- a/src/util/disk_cache.c
+++ b/src/util/disk_cache.c
@@ -891,10 +891,8 @@ cache_put(void *job, int thread_index)
 */
if (fd != -1)
   close(fd);
-   if (filename_tmp)
-  free(filename_tmp);
-   if (filename)
-  free(filename);
+   free(filename_tmp);
+   free(filename);
 }
 
 void
@@ -1036,12 +1034,9 @@ disk_cache_get(struct disk_cache *cache, const cache_key 
key, size_t *size)
return uncompressed_data;
 
  fail:
-   if (data)
-  free(data);
-   if (uncompressed_data)
-  free(uncompressed_data);
-   if (filename)
-  free(filename);
+   free(data);
+   free(uncompressed_data);
+   free(filename);
if (fd != -1)
   close(fd);
 
-- 
2.9.3

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


[Mesa-dev] [PATCH 3/9] anv/image: indentation fix

2017-04-11 Thread Thomas Hindoe Paaboel Andersen
---
 src/intel/vulkan/anv_image.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
index cf34dbe..9bf446a 100644
--- a/src/intel/vulkan/anv_image.c
+++ b/src/intel/vulkan/anv_image.c
@@ -183,7 +183,7 @@ make_surface(const struct anv_device *dev,
   /* We don't advertise that depth buffers could be used as storage
* images.
*/
-   assert(!(image->usage & VK_IMAGE_USAGE_STORAGE_BIT));
+  assert(!(image->usage & VK_IMAGE_USAGE_STORAGE_BIT));
 
   /* Allow the user to control HiZ enabling. Disable by default on gen7
* because resolves are not currently implemented pre-BDW.
-- 
2.9.3

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


[Mesa-dev] [PATCH 6/9] radv: remove null check before free

2017-04-11 Thread Thomas Hindoe Paaboel Andersen
---
 src/amd/vulkan/radv_pipeline.c | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index cf11362..e3eacf3 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -585,8 +585,7 @@ radv_pipeline_compile(struct radv_pipeline *pipeline,
variant = radv_pipeline_cache_insert_shader(cache, sha1, 
variant,
code, code_size);
 
-   if (code)
-   free(code);
+   free(code);
return variant;
 }
 
@@ -706,10 +705,8 @@ radv_tess_pipeline_compile(struct radv_pipeline *pipeline,
tcs_variant = radv_pipeline_cache_insert_shader(cache, 
tcs_sha1, tcs_variant,
tcs_code, 
tcs_code_size);
 
-   if (tes_code)
-   free(tes_code);
-   if (tcs_code)
-   free(tcs_code);
+   free(tes_code);
+   free(tcs_code);
pipeline->shaders[MESA_SHADER_TESS_CTRL] = tcs_variant;
pipeline->shaders[MESA_SHADER_TESS_EVAL] = tes_variant;
return;
-- 
2.9.3

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


[Mesa-dev] [PATCH 1/9] radv: remove redundant returns

2017-04-11 Thread Thomas Hindoe Paaboel Andersen
From 1811ccf1
---
 src/amd/vulkan/radv_device.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 5f14394..9138a00 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -749,7 +749,6 @@ void radv_GetPhysicalDeviceQueueFamilyProperties(
RADV_FROM_HANDLE(radv_physical_device, pdevice, physicalDevice);
if (!pQueueFamilyProperties) {
return 
radv_get_physical_device_queue_family_properties(pdevice, pCount, NULL);
-   return;
}
VkQueueFamilyProperties *properties[] = {
pQueueFamilyProperties + 0,
@@ -768,7 +767,6 @@ void radv_GetPhysicalDeviceQueueFamilyProperties2KHR(
RADV_FROM_HANDLE(radv_physical_device, pdevice, physicalDevice);
if (!pQueueFamilyProperties) {
return 
radv_get_physical_device_queue_family_properties(pdevice, pCount, NULL);
-   return;
}
VkQueueFamilyProperties *properties[] = {
&pQueueFamilyProperties[0].queueFamilyProperties,
-- 
2.9.3

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


[Mesa-dev] [PATCH 2/9] radv: simplify if statement

2017-04-11 Thread Thomas Hindoe Paaboel Andersen
---
 src/amd/vulkan/radv_wsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/amd/vulkan/radv_wsi.c b/src/amd/vulkan/radv_wsi.c
index b8999f4..37cb322 100644
--- a/src/amd/vulkan/radv_wsi.c
+++ b/src/amd/vulkan/radv_wsi.c
@@ -210,7 +210,7 @@ radv_wsi_image_create(VkDevice device_h,
 * return the fd for the image in the no copy mode,
 * or the fd for the linear image if a copy is required.
 */
-   if (!needs_linear_copy || (needs_linear_copy && linear)) {
+   if (!needs_linear_copy || linear) {
RADV_FROM_HANDLE(radv_device, device, device_h);
RADV_FROM_HANDLE(radv_device_memory, memory, memory_h);
if (!radv_get_memory_fd(device, memory, &fd))
-- 
2.9.3

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


[Mesa-dev] Trivial code cleanups

2017-04-11 Thread Thomas Hindoe Paaboel Andersen
A mix of fixes for static analysis warnings, recent indentation
mistakes, and unnecessary null checks before free.

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


[Mesa-dev] [PATCH 1/2] radv: Set query availability bit even if we don't wait.

2017-04-11 Thread Bas Nieuwenhuizen
Signed-off-by: Bas Nieuwenhuizen 
Fixes: 8475a14302e ("radv: Implement pipeline statistics queries.")
---
 src/amd/vulkan/radv_query.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/amd/vulkan/radv_query.c b/src/amd/vulkan/radv_query.c
index 07cb6404149..9f54287c363 100644
--- a/src/amd/vulkan/radv_query.c
+++ b/src/amd/vulkan/radv_query.c
@@ -850,9 +850,10 @@ VkResult radv_GetQueryPoolResults(
char *src = pool->ptr + query * pool->stride;
uint32_t available;
 
-   if ((flags & VK_QUERY_RESULT_WAIT_BIT) && pool->type != 
VK_QUERY_TYPE_OCCLUSION) {
-   while(!*(volatile uint32_t*)(pool->ptr + 
pool->availability_offset + 4 * query))
-   ;
+   if (pool->type != VK_QUERY_TYPE_OCCLUSION) {
+   if (flags & VK_QUERY_RESULT_WAIT_BIT)
+   while(!*(volatile uint32_t*)(pool->ptr + 
pool->availability_offset + 4 * query))
+   ;
available = *(uint32_t*)(pool->ptr + 
pool->availability_offset + 4 * query);
}
 
-- 
2.12.2

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


[Mesa-dev] [PATCH 2/2] radv: Return VK_NOT_READY if the query results are not available.

2017-04-11 Thread Bas Nieuwenhuizen
Signed-off-by: Bas Nieuwenhuizen 
Fixes: 8475a14302e ("radv: Implement pipeline statistics queries.")
---
 src/amd/vulkan/radv_query.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/src/amd/vulkan/radv_query.c b/src/amd/vulkan/radv_query.c
index 9f54287c363..bd293b58e69 100644
--- a/src/amd/vulkan/radv_query.c
+++ b/src/amd/vulkan/radv_query.c
@@ -910,6 +910,12 @@ VkResult radv_GetQueryPoolResults(
break;
}
case VK_QUERY_TYPE_PIPELINE_STATISTICS: {
+   if (!available && !(flags & 
VK_QUERY_RESULT_PARTIAL_BIT)) {
+   result = VK_NOT_READY;
+   break;
+
+   }
+
const uint64_t *start = (uint64_t*)src;
const uint64_t *stop = (uint64_t*)(src + 
pipelinestat_block_size);
if (flags & VK_QUERY_RESULT_64_BIT) {
-- 
2.12.2

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


Re: [Mesa-dev] [PATCH 8/8] i965/drm: Make brw_emit_reloc take a uint64_t target_offset.

2017-04-11 Thread Jason Ekstrand
On Tue, Apr 11, 2017 at 12:59 PM, Daniel Vetter  wrote:

> On Tue, Apr 11, 2017 at 07:59:18PM +0100, Chris Wilson wrote:
> > On Tue, Apr 11, 2017 at 09:02:51AM -0700, Kenneth Graunke wrote:
> > > If we have buffers larger than 4GB, then target_offset will need to
> > > become a 64-bit value.  Delta is only a __u32 though, so we downcast.
> > >
> > > Suggested by Chris Wilson.
> > > ---
> > >  src/mesa/drivers/dri/i965/intel_batchbuffer.c | 4 ++--
> > >  src/mesa/drivers/dri/i965/intel_batchbuffer.h | 2 +-
> > >  2 files changed, 3 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
> b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
> > > index 6e4b55cf9ec..abaeb6bcbfe 100644
> > > --- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
> > > +++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
> > > @@ -734,7 +734,7 @@ brw_batch_references(struct intel_batchbuffer
> *batch, struct brw_bo *bo)
> > >   */
> > >  uint64_t
> > >  brw_emit_reloc(struct intel_batchbuffer *batch, uint32_t batch_offset,
> >
> > It's batch_offset that's u64 (to match the u64 size). Just delta
> > (target_offset) is the oddity being s32 into a potential u64 object. :|
>
> I think originally (back when we had the userspace mm inspired tree of
> objects model) delta was meant for the various flags in the lower 12 bits,
> since we never did buffer suballocation. A shame we didn't fix this in
> execbuf2, but oh well.


Yeah, it's a bit unfortunate.  See also the Vulkan patch I sent out today.
I'm not sure if it's actually worth trying to fix or if we're better off
just doing the work in userspace to stop doing relocations all together.
I'm inclined towards that option. :-)
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 8/8] i965/drm: Make brw_emit_reloc take a uint64_t target_offset.

2017-04-11 Thread Kenneth Graunke
On Tuesday, April 11, 2017 11:59:18 AM PDT Chris Wilson wrote:
> On Tue, Apr 11, 2017 at 09:02:51AM -0700, Kenneth Graunke wrote:
> > If we have buffers larger than 4GB, then target_offset will need to
> > become a 64-bit value.  Delta is only a __u32 though, so we downcast.
> > 
> > Suggested by Chris Wilson.
> > ---
> >  src/mesa/drivers/dri/i965/intel_batchbuffer.c | 4 ++--
> >  src/mesa/drivers/dri/i965/intel_batchbuffer.h | 2 +-
> >  2 files changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c 
> > b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
> > index 6e4b55cf9ec..abaeb6bcbfe 100644
> > --- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
> > +++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
> > @@ -734,7 +734,7 @@ brw_batch_references(struct intel_batchbuffer *batch, 
> > struct brw_bo *bo)
> >   */
> >  uint64_t
> >  brw_emit_reloc(struct intel_batchbuffer *batch, uint32_t batch_offset,
> 
> It's batch_offset that's u64 (to match the u64 size). Just delta
> (target_offset) is the oddity being s32 into a potential u64 object. :|
> -Chris

Ah.  There's no point in expanding batch_offset, though, since
the batchbuffer is only 32K, and would certainly never be >= 4G :)

--Ken


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] [RFC PATCH 2/3] gallium: separate indirect stuff from pipe_draw_info - 80 -> 56 bytes

2017-04-11 Thread Roland Scheidegger
I suppose why not... Though if you're really concerned about a couple
bytes here for the simple case, you could probably make streamout part
of the indirect case too (or call it "extended" then) and save another 8
bytes even...

Roland

Am 11.04.2017 um 22:15 schrieb Marek Olšák:
> From: Marek Olšák 
> 
> For faster initialization of non-indirect draws.
> ---
>  src/gallium/include/pipe/p_state.h | 67 
> --
>  1 file changed, 35 insertions(+), 32 deletions(-)
> 
> diff --git a/src/gallium/include/pipe/p_state.h 
> b/src/gallium/include/pipe/p_state.h
> index 9576f18..69d2378 100644
> --- a/src/gallium/include/pipe/p_state.h
> +++ b/src/gallium/include/pipe/p_state.h
> @@ -643,6 +643,40 @@ struct pipe_index_buffer
>  };
>  
>  
> +struct pipe_draw_indirect_info
> +{
> +   unsigned offset; /**< must be 4 byte aligned */
> +   unsigned stride; /**< must be 4 byte aligned */
> +   unsigned draw_count; /**< number of indirect draws */
> +   unsigned indirect_draw_count_offset; /**< must be 4 byte aligned */
> +
> +   /* Indirect draw parameters resource is laid out as follows:
> +*
> +* if indexed is TRUE:
> +*  struct {
> +* uint32_t count;
> +* uint32_t instance_count;
> +* uint32_t start;
> +* int32_t index_bias;
> +* uint32_t start_instance;
> +*  };
> +* otherwise:
> +*  struct {
> +* uint32_t count;
> +* uint32_t instance_count;
> +* uint32_t start;
> +* uint32_t start_instance;
> +*  };
> +*/
> +   struct pipe_resource *buffer;
> +
> +   /* Indirect draw count resource: If not NULL, contains a 32-bit value 
> which
> +* is to be used as the real draw_count.
> +*/
> +   struct pipe_resource *indirect_draw_count;
> +};
> +
> +
>  /**
>   * Information to describe a draw_vbo call.
>   */
> @@ -673,40 +707,9 @@ struct pipe_draw_info
>  */
> unsigned restart_index;
>  
> -   unsigned indirect_offset; /**< must be 4 byte aligned */
> -   unsigned indirect_stride; /**< must be 4 byte aligned */
> -   unsigned indirect_count; /**< number of indirect draws */
> -
> -   unsigned indirect_params_offset; /**< must be 4 byte aligned */
> -
> /* Pointers must be at the end for an optimal structure layout on 64-bit. 
> */
>  
> -   /* Indirect draw parameters resource: If not NULL, most values are taken
> -* from this buffer instead, which is laid out as follows:
> -*
> -* if indexed is TRUE:
> -*  struct {
> -* uint32_t count;
> -* uint32_t instance_count;
> -* uint32_t start;
> -* int32_t index_bias;
> -* uint32_t start_instance;
> -*  };
> -* otherwise:
> -*  struct {
> -* uint32_t count;
> -* uint32_t instance_count;
> -* uint32_t start;
> -* uint32_t start_instance;
> -*  };
> -*/
> -   struct pipe_resource *indirect;
> -
> -   /* Indirect draw count resource: If not NULL, contains a 32-bit value 
> which
> -* is to be used as the real indirect_count. In that case indirect_count
> -* becomes the maximum possible value.
> -*/
> -   struct pipe_resource *indirect_params;
> +   struct pipe_draw_indirect_info *indirect; /**< Indirect draw. */
>  
> /**
>  * Stream output target. If not NULL, it's used to provide the 'count'
> 

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


Re: [Mesa-dev] [RFC PATCH 1/3] gallium: decrease the size of pipe_vertex_buffer - 24 -> 16 bytes

2017-04-11 Thread Roland Scheidegger
This looks ok to me (though I hope uint16_t for stride isn't a problem).
Although it doesn't save all that much...

Roland

Am 11.04.2017 um 22:15 schrieb Marek Olšák:
> From: Marek Olšák 
> 
> New interface:
> 
> union pipe_buffer_binding {
>struct pipe_resource *buffer;  /**< the actual buffer */
>const void *user_buffer;  /**< pointer to a user buffer */
> };
> 
> struct pipe_vertex_buffer
> {
>uint16_t stride;/**< stride to same attrib in next vertex, in bytes */
>bool is_user_buffer;
>unsigned buffer_offset;  /**< offset to start of data in buffer, in bytes 
> */
>union pipe_buffer_binding u;
> };
> ---
>  src/gallium/include/pipe/p_state.h | 11 ---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/src/gallium/include/pipe/p_state.h 
> b/src/gallium/include/pipe/p_state.h
> index ce9ca34..9576f18 100644
> --- a/src/gallium/include/pipe/p_state.h
> +++ b/src/gallium/include/pipe/p_state.h
> @@ -534,6 +534,11 @@ struct pipe_transfer
>  };
>  
>  
> +union pipe_buffer_binding {
> +   struct pipe_resource *buffer;  /**< the actual buffer */
> +   const void *user_buffer;  /**< pointer to a user buffer */
> +};
> +
>  
>  /**
>   * A vertex buffer.  Typically, all the vertex data/attributes for
> @@ -542,10 +547,10 @@ struct pipe_transfer
>   */
>  struct pipe_vertex_buffer
>  {
> -   unsigned stride;/**< stride to same attrib in next vertex, in bytes */
> +   uint16_t stride;/**< stride to same attrib in next vertex, in bytes */
> +   bool is_user_buffer;
> unsigned buffer_offset;  /**< offset to start of data in buffer, in bytes 
> */
> -   struct pipe_resource *buffer;  /**< the actual buffer */
> -   const void *user_buffer;  /**< pointer to a user buffer if buffer == NULL 
> */
> +   union pipe_buffer_binding u;
>  };
>  
>  
> 

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


Re: [Mesa-dev] [PATCH v2 06/15] draw: remove unused wideline_stage()

2017-04-11 Thread Roland Scheidegger
You could remove the half_line_width in the struct wideline_stage too
while you're at it - I think the whole reason why the wideline_stage()
function existed in the first place was to have easy access to that
variable.
But either way,
Reviewed-by: Roland Scheidegger 

Am 11.04.2017 um 21:58 schrieb Samuel Pitoiset:
> Fixes the following Clang warning.
> 
> draw/draw_pipe_wide_line.c:48:38: warning: unused function 'wideline_stage' 
> [-Wunused-function]
> static inline struct wideline_stage *wideline_stage( struct draw_stage *stage 
> )
>  ^
> 1 warning generated.
> 
> v2: - remove commented code (Roland Scheidegger)
> 
> Signed-off-by: Samuel Pitoiset 
> ---
>  src/gallium/auxiliary/draw/draw_pipe_wide_line.c | 9 -
>  1 file changed, 9 deletions(-)
> 
> diff --git a/src/gallium/auxiliary/draw/draw_pipe_wide_line.c 
> b/src/gallium/auxiliary/draw/draw_pipe_wide_line.c
> index ae4a00eb63..103f080491 100644
> --- a/src/gallium/auxiliary/draw/draw_pipe_wide_line.c
> +++ b/src/gallium/auxiliary/draw/draw_pipe_wide_line.c
> @@ -44,21 +44,12 @@ struct wideline_stage {
>  };
>  
>  
> -
> -static inline struct wideline_stage *wideline_stage( struct draw_stage 
> *stage )
> -{
> -   return (struct wideline_stage *)stage;
> -}
> -
> -
> -
>  /**
>   * Draw a wide line by drawing a quad (two triangles).
>   */
>  static void wideline_line( struct draw_stage *stage,
> struct prim_header *header )
>  {
> -   /*const struct wideline_stage *wide = wideline_stage(stage);*/
> const unsigned pos = draw_current_shader_position_output(stage->draw);
> const float half_width = 0.5f * stage->draw->rasterizer->line_width;
>  
> 

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


Re: [Mesa-dev] [PATCH v2 11/15] llvmpipe: remove unused subpixel_snap() and fixed_to_float()

2017-04-11 Thread Roland Scheidegger
Reviewed-by: Roland Scheidegger 

Am 11.04.2017 um 21:59 schrieb Samuel Pitoiset:
> Fixes the following Clang warnings.
> 
> lp_setup_tri.c:55:1: warning: unused function 'subpixel_snap' 
> [-Wunused-function]
> subpixel_snap(float a)
> ^
> lp_setup_tri.c:61:1: warning: unused function 'fixed_to_float' 
> [-Wunused-function]
> fixed_to_float(int a)
> ^
> 
> v2: - do not remove subpixel_snap() (use !PIPE_ARCH_SSE instead)
> 
> Signed-off-by: Samuel Pitoiset 
> ---
>  src/gallium/drivers/llvmpipe/lp_setup_tri.c | 9 +++--
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c 
> b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
> index 98243a12de..a7a5d05c32 100644
> --- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c
> +++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
> @@ -51,18 +51,15 @@
>  #include "util/u_pwr8.h"
>  #endif
>  
> +#if !defined(PIPE_ARCH_SSE)
> +
>  static inline int
>  subpixel_snap(float a)
>  {
> return util_iround(FIXED_ONE * a);
>  }
>  
> -static inline float
> -fixed_to_float(int a)
> -{
> -   return a * (1.0f / FIXED_ONE);
> -}
> -
> +#endif
>  
>  /* Position and area in fixed point coordinates */
>  struct fixed_position {
> 

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


Re: [Mesa-dev] [PATCH] radv: Disable primitive restart for non-indexed draws

2017-04-11 Thread Bas Nieuwenhuizen
So I think we need to reset both command buffer states (the enable and
the index) when we call a secondary command buffer.

With that fixed, this patch is

Reviewed-by: Bas Nieuwenhuizen 

On Tue, Apr 11, 2017 at 3:30 PM, Alex Smith  wrote:
> According to the Vulkan spec, VkPipelineInputAssemblyStateCreateInfo's
> primitiveRestartEnable flag should only apply to indexed draws, however
> it was being enabled regardless of the type of draw. This could cause
> problems for non-indexed draws with >=65535 vertices if the previous
> indexed draw used 16-bit indices.
>
> Fixes corruption of the credits text in Mad Max.
>
> Signed-off-by: Alex Smith 
> ---
>  src/amd/vulkan/radv_cmd_buffer.c | 53 
> +++-
>  src/amd/vulkan/radv_private.h|  1 +
>  2 files changed, 32 insertions(+), 22 deletions(-)
>
> diff --git a/src/amd/vulkan/radv_cmd_buffer.c 
> b/src/amd/vulkan/radv_cmd_buffer.c
> index dbe8bf1..2a7501f 100644
> --- a/src/amd/vulkan/radv_cmd_buffer.c
> +++ b/src/amd/vulkan/radv_cmd_buffer.c
> @@ -855,9 +855,6 @@ radv_emit_graphics_pipeline(struct radv_cmd_buffer 
> *cmd_buffer,
> radv_emit_fragment_shader(cmd_buffer, pipeline);
> polaris_set_vgt_vertex_reuse(cmd_buffer, pipeline);
>
> -   radeon_set_context_reg(cmd_buffer->cs, 
> R_028A94_VGT_MULTI_PRIM_IB_RESET_EN,
> -  pipeline->graphics.prim_restart_enable);
> -
> cmd_buffer->scratch_size_needed =
>   MAX2(cmd_buffer->scratch_size_needed,
>pipeline->max_waves * 
> pipeline->scratch_bytes_per_wave);
> @@ -1394,9 +1391,32 @@ radv_flush_constants(struct radv_cmd_buffer 
> *cmd_buffer,
> cmd_buffer->push_constant_stages &= ~stages;
>  }
>
> +static void radv_emit_primitive_reset_state(struct radv_cmd_buffer 
> *cmd_buffer,
> +   bool indexed_draw)
> +{
> +   int32_t primitive_reset_en = indexed_draw && 
> cmd_buffer->state.pipeline->graphics.prim_restart_enable;
> +
> +   if (primitive_reset_en != cmd_buffer->state.last_primitive_reset_en) {
> +   cmd_buffer->state.last_primitive_reset_en = 
> primitive_reset_en;
> +   radeon_set_context_reg(cmd_buffer->cs, 
> R_028A94_VGT_MULTI_PRIM_IB_RESET_EN,
> +  primitive_reset_en);
> +   }
> +
> +   if (primitive_reset_en) {
> +   uint32_t primitive_reset_index = cmd_buffer->state.index_type 
> ? 0xu : 0xu;
> +
> +   if (primitive_reset_index != 
> cmd_buffer->state.last_primitive_reset_index) {
> +   cmd_buffer->state.last_primitive_reset_index = 
> primitive_reset_index;
> +   radeon_set_context_reg(cmd_buffer->cs, 
> R_02840C_VGT_MULTI_PRIM_IB_RESET_INDX,
> +  primitive_reset_index);
> +   }
> +   }
> +}
> +
>  static void
>  radv_cmd_buffer_flush_state(struct radv_cmd_buffer *cmd_buffer,
> -   bool instanced_draw, bool indirect_draw,
> +   bool indexed_draw, bool instanced_draw,
> +   bool indirect_draw,
> uint32_t draw_vertex_count)
>  {
> struct radv_pipeline *pipeline = cmd_buffer->state.pipeline;
> @@ -1482,6 +1502,8 @@ radv_cmd_buffer_flush_state(struct radv_cmd_buffer 
> *cmd_buffer,
>
> radv_cmd_buffer_flush_dynamic_state(cmd_buffer);
>
> +   radv_emit_primitive_reset_state(cmd_buffer, indexed_draw);
> +
> radv_flush_descriptors(cmd_buffer, cmd_buffer->state.pipeline,
>VK_SHADER_STAGE_ALL_GRAPHICS);
> radv_flush_constants(cmd_buffer, cmd_buffer->state.pipeline,
> @@ -1802,6 +1824,7 @@ VkResult radv_BeginCommandBuffer(
> radv_reset_cmd_buffer(cmd_buffer);
>
> memset(&cmd_buffer->state, 0, sizeof(cmd_buffer->state));
> +   cmd_buffer->state.last_primitive_reset_en = -1;
>
> /* setup initial configuration into command buffer */
> if (cmd_buffer->level == VK_COMMAND_BUFFER_LEVEL_PRIMARY) {
> @@ -2444,7 +2467,7 @@ void radv_CmdDraw(
>  {
> RADV_FROM_HANDLE(radv_cmd_buffer, cmd_buffer, commandBuffer);
>
> -   radv_cmd_buffer_flush_state(cmd_buffer, (instanceCount > 1), false, 
> vertexCount);
> +   radv_cmd_buffer_flush_state(cmd_buffer, false, (instanceCount > 1), 
> false, vertexCount);
>
> MAYBE_UNUSED unsigned cdw_max = 
> radeon_check_space(cmd_buffer->device->ws, cmd_buffer->cs, 10);
>
> @@ -2471,18 +2494,6 @@ void radv_CmdDraw(
> radv_cmd_buffer_trace_emit(cmd_buffer);
>  }
>
> -static void radv_emit_primitive_reset_index(struct radv_cmd_buffer 
> *cmd_buffer)
> -{
> -   uint32_t primitive_reset_index = cmd_buffer->state.index_type ? 
> 0xu : 0xu;
> -
> -   if (cmd_buffer->state.pipeline->graphics.prim_restart_enable &&
> -   primi

Re: [Mesa-dev] [RFC PATCH 06/26] glsl: add new 'bindless' parameter to get_{sampler, image}_instance()

2017-04-11 Thread Samuel Pitoiset



On 04/11/2017 07:28 PM, Ilia Mirkin wrote:

On Tue, Apr 11, 2017 at 12:48 PM, Samuel Pitoiset
 wrote:

For replacing sampler/image types to the corresponding bindless
type, it's convenient to re-use get_{sampler,image}_instance()
instead of doing a one-by-one comparison.

Signed-off-by: Samuel Pitoiset 
---
  src/compiler/glsl/shader_cache.cpp |   6 +-
  src/compiler/glsl_types.cpp| 221 +++--
  src/compiler/glsl_types.h  |   7 +-
  src/compiler/nir_types.cpp |   5 +-
  4 files changed, 176 insertions(+), 63 deletions(-)

diff --git a/src/compiler/glsl/shader_cache.cpp 
b/src/compiler/glsl/shader_cache.cpp
index f5e6a22bb9..06d772e2f4 100644
--- a/src/compiler/glsl/shader_cache.cpp
+++ b/src/compiler/glsl/shader_cache.cpp
@@ -164,13 +164,15 @@ decode_type_from_blob(struct blob_reader *blob)
return glsl_type::get_sampler_instance((enum glsl_sampler_dim) ((u >> 4) 
& 0x07),
   (u >> 3) & 0x01,
   (u >> 2) & 0x01,
- (glsl_base_type) ((u >> 0) & 
0x03));
+ (glsl_base_type) ((u >> 0) & 
0x03),
+ false);
 case GLSL_TYPE_SUBROUTINE:
return glsl_type::get_subroutine_instance(blob_read_string(blob));
 case GLSL_TYPE_IMAGE:
return glsl_type::get_image_instance((enum glsl_sampler_dim) ((u >> 3) 
& 0x07),
   (u >> 2) & 0x01,
- (glsl_base_type) ((u >> 0) & 
0x03));
+ (glsl_base_type) ((u >> 0) & 
0x03),
+ false);
 case GLSL_TYPE_ATOMIC_UINT:
return glsl_type::atomic_uint_type;
 case GLSL_TYPE_ARRAY: {
diff --git a/src/compiler/glsl_types.cpp b/src/compiler/glsl_types.cpp
index c7a41b785e..cf0fe71d1a 100644
--- a/src/compiler/glsl_types.cpp
+++ b/src/compiler/glsl_types.cpp
@@ -668,49 +668,82 @@ const glsl_type *
  glsl_type::get_sampler_instance(enum glsl_sampler_dim dim,
  bool shadow,
  bool array,
-glsl_base_type type)
+glsl_base_type type,
+bool bindless)
  {
 switch (type) {
 case GLSL_TYPE_FLOAT:
switch (dim) {
case GLSL_SAMPLER_DIM_1D:
- if (shadow)
-return (array ? sampler1DArrayShadow_type : sampler1DShadow_type);
- else
-return (array ? sampler1DArray_type : sampler1D_type);
+ if (bindless) {
+if (shadow)
+   return (array ? sampler1DArrayShadowBindless_type : 
sampler1DShadowBindless_type);
+else
+   return (array ? sampler1DArrayBindless_type : 
sampler1DBindless_type);
+
+ } else {
+if (shadow)
+   return (array ? sampler1DArrayShadow_type : 
sampler1DShadow_type);
+else
+   return (array ? sampler1DArray_type : sampler1D_type);
+ }



This function was already ridiculous. You've done nothing to help the
situation :) Here's what I propose:


Yeah. That looks crappy but it was easier. :)



Make a giant array in glsl_type to house all these things. So like

foo[enum glsl_sampler_dim][glsl_base_type][array][shadow][bindless]

And then this function just becomes

return foo[][][][];

Thoughts?


That's one possible solution. I will think more and let you know.



You'd obviously need to adjust the logic that generates
glsl_type::foo_type things.


case GLSL_SAMPLER_DIM_2D:
- if (shadow)
-return (array ? sampler2DArrayShadow_type : sampler2DShadow_type);
- else
-return (array ? sampler2DArray_type : sampler2D_type);
+ if (bindless) {
+if (shadow)
+   return (array ? sampler2DArrayShadowBindless_type : 
sampler2DShadowBindless_type);
+else
+   return (array ? sampler2DArrayBindless_type : 
sampler2DBindless_type);
+ } else {
+if (shadow)
+   return (array ? sampler2DArrayShadow_type : 
sampler2DShadow_type);
+else
+   return (array ? sampler2DArray_type : sampler2D_type);
+ }
case GLSL_SAMPLER_DIM_3D:
   if (shadow || array)
  return error_type;
   else
-return sampler3D_type;
+return bindless ? sampler3DBindless_type : sampler3D_type;
case GLSL_SAMPLER_DIM_CUBE:
- if (shadow)
-return (array ? samplerCubeArrayShadow_type : 
samplerCubeShadow_type);
- else
-return (array ? samplerCubeArray_type : samplerCube_type);
+ if (bindless) {
+ if (shadow)
+   return (array ? samplerCubeArr

[Mesa-dev] [PATCH v4] glsl/blob: avoid NULL ptr in prog parameter name

2017-04-11 Thread Gregory Hainaut
Context: _mesa_add_parameter is sometimes[0] called with a
NULL name as a mean of an unnamed parameter.

Allowing NULL pointer as a name means that it must be NULL checked
each access. So far it isn't always[1] true.

Parameter name is only used for debug purpose (printf) and
to lookup the index/location of the program by the application.

Conclusion, there is no valid reason to use a NULL pointer instead of
an empty string. So it was decided to use an empty string which avoid all
issues related to NULL pointer

[0]: texture gather offsets glsl opcode and st_init_atifs_prog
[1]: at least shader cache, st_nir_lookup_parameter_index and some printfs

Issue found by piglit 'texturegatheroffsets' tests on Nouveau

v4: new patch based on Nicolai/Timothy/ilia discussion
Signed-off-by: Gregory Hainaut 
---
 src/mesa/program/prog_parameter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/program/prog_parameter.c 
b/src/mesa/program/prog_parameter.c
index c294b00..6689c71 100644
--- a/src/mesa/program/prog_parameter.c
+++ b/src/mesa/program/prog_parameter.c
@@ -258,7 +258,7 @@ _mesa_add_parameter(struct gl_program_parameter_list 
*paramList,
 
for (i = 0; i < sz4; i++) {
   struct gl_program_parameter *p = paramList->Parameters + oldNum + i;
-  p->Name = name ? strdup(name) : NULL;
+  p->Name = strdup(name ? name : "");
   p->Type = type;
   p->Size = size;
   p->DataType = datatype;
-- 
2.1.4

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


[Mesa-dev] [RFC PATCH 3/3] gallium: remove pipe_index_buffer and set_index_buffer

2017-04-11 Thread Marek Olšák
From: Marek Olšák 

pipe_draw_info::indexed is replaced with index_size. index_size == 0 means
non-indexed.

Instead of pipe_index_buffer::offset, pipe_draw_info::start is used.
For indexed indirect draws, pipe_draw_info::start is added to the indirect
start. This is the only case when "start" affects indirect draws.

pipe_draw_info::index is a union. Use either index::buffer or
index::user_buffer depending on the value of pipe_draw_info
::has_user_indices.

Performance numbers with the drawoverhead microbenchmark.

Before::
   DrawElements only: 4.5 million draws/second
   DrawElements w/ nop state change: 4.4 million draws/sec (overhead: 0.07 
ms/draw)
   DrawElements w/ state change: 1.9 million draws/sec (overhead: 0.000293 
ms/draw)

After:
   DrawElements only: 5.0 million draws/second
   DrawElements w/ nop state change: 4.9 million draws/sec (overhead: 0.07 
ms/draw)
   DrawElements w/ state change: 2.2 million draws/sec (overhead: 0.000254 
ms/draw)

The improvement will be much smaller with real apps.
---
 src/gallium/include/pipe/p_context.h |  4 
 src/gallium/include/pipe/p_state.h   | 35 ++-
 2 files changed, 18 insertions(+), 21 deletions(-)

diff --git a/src/gallium/include/pipe/p_context.h 
b/src/gallium/include/pipe/p_context.h
index 4d5535b..4b75386 100644
--- a/src/gallium/include/pipe/p_context.h
+++ b/src/gallium/include/pipe/p_context.h
@@ -53,7 +53,6 @@ struct pipe_grid_info;
 struct pipe_fence_handle;
 struct pipe_framebuffer_state;
 struct pipe_image_view;
-struct pipe_index_buffer;
 struct pipe_query;
 struct pipe_poly_stipple;
 struct pipe_rasterizer_state;
@@ -354,9 +353,6 @@ struct pipe_context {
unsigned num_buffers,
const struct pipe_vertex_buffer * );
 
-   void (*set_index_buffer)( struct pipe_context *pipe,
- const struct pipe_index_buffer * );
-
/*@}*/
 
/**
diff --git a/src/gallium/include/pipe/p_state.h 
b/src/gallium/include/pipe/p_state.h
index 69d2378..7f482d4 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -630,19 +630,6 @@ struct pipe_vertex_element
 };
 
 
-/**
- * An index buffer.  When an index buffer is bound, all indices to vertices
- * will be looked up in the buffer.
- */
-struct pipe_index_buffer
-{
-   unsigned index_size;  /**< size of an index, in bytes */
-   unsigned offset;  /**< offset to start of data in buffer, in bytes */
-   struct pipe_resource *buffer; /**< the actual buffer */
-   const void *user_buffer;  /**< pointer to a user buffer if buffer == NULL */
-};
-
-
 struct pipe_draw_indirect_info
 {
unsigned offset; /**< must be 4 byte aligned */
@@ -652,7 +639,7 @@ struct pipe_draw_indirect_info
 
/* Indirect draw parameters resource is laid out as follows:
 *
-* if indexed is TRUE:
+* if using indexed drawing:
 *  struct {
 * uint32_t count;
 * uint32_t instance_count;
@@ -682,12 +669,18 @@ struct pipe_draw_indirect_info
  */
 struct pipe_draw_info
 {
-   boolean indexed;  /**< use index buffer */
+   ubyte index_size;  /**< if 0, the draw is not indexed. */
enum pipe_prim_type mode:8;  /**< the mode of the primitive */
-   boolean primitive_restart;
+   unsigned primitive_restart:1;
+   unsigned has_user_indices:1; /**< if true, use index.user_buffer */
ubyte vertices_per_patch; /**< the number of vertices per patch */
 
-   unsigned start;  /**< the index of the first vertex */
+   /**
+* Direct draws: start is the index of the first vertex
+* Non-indexed indirect draws: not used
+* Indexed indirect draws: start is added to the indirect start.
+*/
+   unsigned start;
unsigned count;  /**< number of vertices */
 
unsigned start_instance; /**< first instance id */
@@ -709,6 +702,14 @@ struct pipe_draw_info
 
/* Pointers must be at the end for an optimal structure layout on 64-bit. */
 
+   /**
+* An index buffer.  When an index buffer is bound, all indices to vertices
+* will be looked up from the buffer.
+*
+* If has_user_indices, use index.user_buffer, else use index.buffer.
+*/
+   union pipe_buffer_binding index;
+
struct pipe_draw_indirect_info *indirect; /**< Indirect draw. */
 
/**
-- 
2.7.4

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


[Mesa-dev] [RFC PATCH 2/3] gallium: separate indirect stuff from pipe_draw_info - 80 -> 56 bytes

2017-04-11 Thread Marek Olšák
From: Marek Olšák 

For faster initialization of non-indirect draws.
---
 src/gallium/include/pipe/p_state.h | 67 --
 1 file changed, 35 insertions(+), 32 deletions(-)

diff --git a/src/gallium/include/pipe/p_state.h 
b/src/gallium/include/pipe/p_state.h
index 9576f18..69d2378 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -643,6 +643,40 @@ struct pipe_index_buffer
 };
 
 
+struct pipe_draw_indirect_info
+{
+   unsigned offset; /**< must be 4 byte aligned */
+   unsigned stride; /**< must be 4 byte aligned */
+   unsigned draw_count; /**< number of indirect draws */
+   unsigned indirect_draw_count_offset; /**< must be 4 byte aligned */
+
+   /* Indirect draw parameters resource is laid out as follows:
+*
+* if indexed is TRUE:
+*  struct {
+* uint32_t count;
+* uint32_t instance_count;
+* uint32_t start;
+* int32_t index_bias;
+* uint32_t start_instance;
+*  };
+* otherwise:
+*  struct {
+* uint32_t count;
+* uint32_t instance_count;
+* uint32_t start;
+* uint32_t start_instance;
+*  };
+*/
+   struct pipe_resource *buffer;
+
+   /* Indirect draw count resource: If not NULL, contains a 32-bit value which
+* is to be used as the real draw_count.
+*/
+   struct pipe_resource *indirect_draw_count;
+};
+
+
 /**
  * Information to describe a draw_vbo call.
  */
@@ -673,40 +707,9 @@ struct pipe_draw_info
 */
unsigned restart_index;
 
-   unsigned indirect_offset; /**< must be 4 byte aligned */
-   unsigned indirect_stride; /**< must be 4 byte aligned */
-   unsigned indirect_count; /**< number of indirect draws */
-
-   unsigned indirect_params_offset; /**< must be 4 byte aligned */
-
/* Pointers must be at the end for an optimal structure layout on 64-bit. */
 
-   /* Indirect draw parameters resource: If not NULL, most values are taken
-* from this buffer instead, which is laid out as follows:
-*
-* if indexed is TRUE:
-*  struct {
-* uint32_t count;
-* uint32_t instance_count;
-* uint32_t start;
-* int32_t index_bias;
-* uint32_t start_instance;
-*  };
-* otherwise:
-*  struct {
-* uint32_t count;
-* uint32_t instance_count;
-* uint32_t start;
-* uint32_t start_instance;
-*  };
-*/
-   struct pipe_resource *indirect;
-
-   /* Indirect draw count resource: If not NULL, contains a 32-bit value which
-* is to be used as the real indirect_count. In that case indirect_count
-* becomes the maximum possible value.
-*/
-   struct pipe_resource *indirect_params;
+   struct pipe_draw_indirect_info *indirect; /**< Indirect draw. */
 
/**
 * Stream output target. If not NULL, it's used to provide the 'count'
-- 
2.7.4

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


[Mesa-dev] [RFC PATCH 1/3] gallium: decrease the size of pipe_vertex_buffer - 24 -> 16 bytes

2017-04-11 Thread Marek Olšák
From: Marek Olšák 

New interface:

union pipe_buffer_binding {
   struct pipe_resource *buffer;  /**< the actual buffer */
   const void *user_buffer;  /**< pointer to a user buffer */
};

struct pipe_vertex_buffer
{
   uint16_t stride;/**< stride to same attrib in next vertex, in bytes */
   bool is_user_buffer;
   unsigned buffer_offset;  /**< offset to start of data in buffer, in bytes */
   union pipe_buffer_binding u;
};
---
 src/gallium/include/pipe/p_state.h | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/gallium/include/pipe/p_state.h 
b/src/gallium/include/pipe/p_state.h
index ce9ca34..9576f18 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -534,6 +534,11 @@ struct pipe_transfer
 };
 
 
+union pipe_buffer_binding {
+   struct pipe_resource *buffer;  /**< the actual buffer */
+   const void *user_buffer;  /**< pointer to a user buffer */
+};
+
 
 /**
  * A vertex buffer.  Typically, all the vertex data/attributes for
@@ -542,10 +547,10 @@ struct pipe_transfer
  */
 struct pipe_vertex_buffer
 {
-   unsigned stride;/**< stride to same attrib in next vertex, in bytes */
+   uint16_t stride;/**< stride to same attrib in next vertex, in bytes */
+   bool is_user_buffer;
unsigned buffer_offset;  /**< offset to start of data in buffer, in bytes */
-   struct pipe_resource *buffer;  /**< the actual buffer */
-   const void *user_buffer;  /**< pointer to a user buffer if buffer == NULL */
+   union pipe_buffer_binding u;
 };
 
 
-- 
2.7.4

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


[Mesa-dev] [PATCH 1/2] st/mesa: minor optimization in st_DrawBuffers()

2017-04-11 Thread Brian Paul
We only do on-demand renderbuffer allocation for window-system FBOs,
not user-created FBOs.  So put the loop inside a conditional.

Plus, add some comments.  No piglit regressions.
---
 src/mesa/state_tracker/st_cb_fbo.c | 24 
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_fbo.c 
b/src/mesa/state_tracker/st_cb_fbo.c
index dce4239..21fc542 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -690,31 +690,39 @@ st_validate_framebuffer(struct gl_context *ctx, struct 
gl_framebuffer *fb)
 
 
 /**
- * Called via glDrawBuffer.
+ * Called via glDrawBuffer.  We only provide this driver function so that we
+ * can check if we need to allocate a new renderbuffer.  Specifically, we
+ * don't usually allocate a front color buffer when using a double-buffered
+ * visual.  But if the app calls glDrawBuffer(GL_FRONT) we need to allocate
+ * that buffer.  Note, this is only for window system buffers, not user-
+ * created FBOs.
  */
 static void
 st_DrawBuffers(struct gl_context *ctx, GLsizei count, const GLenum *buffers)
 {
struct st_context *st = st_context(ctx);
struct gl_framebuffer *fb = ctx->DrawBuffer;
-   GLuint i;
 
(void) count;
(void) buffers;
 
-   /* add the renderbuffers on demand */
-   for (i = 0; i < fb->_NumColorDrawBuffers; i++) {
-  GLint idx = fb->_ColorDrawBufferIndexes[i];
+   if (_mesa_is_winsys_fbo(fb)) {
+  GLuint i;
+  /* add the renderbuffers on demand */
+  for (i = 0; i < fb->_NumColorDrawBuffers; i++) {
+ GLint idx = fb->_ColorDrawBufferIndexes[i];
 
-  if (idx >= 0) {
- st_manager_add_color_renderbuffer(st, fb, idx);
+ if (idx >= 0) {
+st_manager_add_color_renderbuffer(st, fb, idx);
+ }
   }
}
 }
 
 
 /**
- * Called via glReadBuffer.
+ * Called via glReadBuffer.  As with st_DrawBuffers, we use this function
+ * to check if we need to allocate a renderbuffer on demand.
  */
 static void
 st_ReadBuffer(struct gl_context *ctx, GLenum buffer)
-- 
1.9.1

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


[Mesa-dev] [PATCH 2/2] st/mesa: add some _mesa_is_winsys_fbo() assertions

2017-04-11 Thread Brian Paul
A few functions related to FBOs/renderbuffers should only be used with
window-system buffers, not user-created FBOs.  Assert for that.
Add additional comments.  No piglit regressions.
---
 src/mesa/state_tracker/st_cb_fbo.c  |  1 +
 src/mesa/state_tracker/st_manager.c | 10 --
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_fbo.c 
b/src/mesa/state_tracker/st_cb_fbo.c
index 21fc542..7b9855f 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -739,6 +739,7 @@ st_ReadBuffer(struct gl_context *ctx, GLenum buffer)
if ((fb->_ColorReadBufferIndex == BUFFER_FRONT_LEFT ||
 fb->_ColorReadBufferIndex == BUFFER_FRONT_RIGHT) &&
fb->Attachment[fb->_ColorReadBufferIndex].Type == GL_NONE) {
+  assert(_mesa_is_winsys_fbo(fb));
   /* add the buffer */
   st_manager_add_color_renderbuffer(st, fb, fb->_ColorReadBufferIndex);
   _mesa_update_state(ctx);
diff --git a/src/mesa/state_tracker/st_manager.c 
b/src/mesa/state_tracker/st_manager.c
index a91dc76..b9e46fd 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -270,7 +270,8 @@ st_framebuffer_update_attachments(struct st_framebuffer 
*stfb)
 }
 
 /**
- * Add a renderbuffer to the framebuffer.
+ * Add a renderbuffer to the framebuffer.  The framebuffer is one that
+ * corresponds to a window and is not a user-created FBO.
  */
 static boolean
 st_framebuffer_add_renderbuffer(struct st_framebuffer *stfb,
@@ -283,6 +284,8 @@ st_framebuffer_add_renderbuffer(struct st_framebuffer *stfb,
if (!stfb->iface)
   return FALSE;
 
+   assert(_mesa_is_winsys_fbo(&stfb->Base));
+
/* do not distinguish depth/stencil buffers */
if (idx == BUFFER_STENCIL)
   idx = BUFFER_DEPTH;
@@ -869,7 +872,8 @@ st_manager_validate_framebuffers(struct st_context *st)
 }
 
 /**
- * Add a color renderbuffer on demand.
+ * Add a color renderbuffer on demand.  The FBO must correspond to a window,
+ * not a user-created FBO.
  */
 boolean
 st_manager_add_color_renderbuffer(struct st_context *st,
@@ -882,6 +886,8 @@ st_manager_add_color_renderbuffer(struct st_context *st,
if (!stfb)
   return FALSE;
 
+   assert(_mesa_is_winsys_fbo(fb));
+
if (stfb->Base.Attachment[idx].Renderbuffer)
   return TRUE;
 
-- 
1.9.1

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


Re: [Mesa-dev] [PATCH 11/15] llvmpipe: remove unused subpixel_snap() and fixed_to_float()

2017-04-11 Thread Samuel Pitoiset

You are right, my fault.

On 04/11/2017 08:31 PM, Roland Scheidegger wrote:

subpixel_snap is very much used (fixed_to_float, not so much), so you
can't get rid of it.
If you want you can place it into a #if !defined(PIPE_ARCH_SSE) clause
though...

Roland

Am 11.04.2017 um 19:58 schrieb Samuel Pitoiset:

Fixes the following Clang warnings.

lp_setup_tri.c:55:1: warning: unused function 'subpixel_snap' 
[-Wunused-function]
subpixel_snap(float a)
^
lp_setup_tri.c:61:1: warning: unused function 'fixed_to_float' 
[-Wunused-function]
fixed_to_float(int a)
^

Signed-off-by: Samuel Pitoiset 
---
  src/gallium/drivers/llvmpipe/lp_setup_tri.c | 12 
  1 file changed, 12 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c 
b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
index 98243a12de..cc1508ccc2 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
@@ -51,18 +51,6 @@
  #include "util/u_pwr8.h"
  #endif
  
-static inline int

-subpixel_snap(float a)
-{
-   return util_iround(FIXED_ONE * a);
-}
-
-static inline float
-fixed_to_float(int a)
-{
-   return a * (1.0f / FIXED_ONE);
-}
-
  
  /* Position and area in fixed point coordinates */

  struct fixed_position {




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


[Mesa-dev] [PATCH v2 11/15] llvmpipe: remove unused subpixel_snap() and fixed_to_float()

2017-04-11 Thread Samuel Pitoiset
Fixes the following Clang warnings.

lp_setup_tri.c:55:1: warning: unused function 'subpixel_snap' 
[-Wunused-function]
subpixel_snap(float a)
^
lp_setup_tri.c:61:1: warning: unused function 'fixed_to_float' 
[-Wunused-function]
fixed_to_float(int a)
^

v2: - do not remove subpixel_snap() (use !PIPE_ARCH_SSE instead)

Signed-off-by: Samuel Pitoiset 
---
 src/gallium/drivers/llvmpipe/lp_setup_tri.c | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c 
b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
index 98243a12de..a7a5d05c32 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
@@ -51,18 +51,15 @@
 #include "util/u_pwr8.h"
 #endif
 
+#if !defined(PIPE_ARCH_SSE)
+
 static inline int
 subpixel_snap(float a)
 {
return util_iround(FIXED_ONE * a);
 }
 
-static inline float
-fixed_to_float(int a)
-{
-   return a * (1.0f / FIXED_ONE);
-}
-
+#endif
 
 /* Position and area in fixed point coordinates */
 struct fixed_position {
-- 
2.12.2

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


Re: [Mesa-dev] [PATCH 8/8] i965/drm: Make brw_emit_reloc take a uint64_t target_offset.

2017-04-11 Thread Daniel Vetter
On Tue, Apr 11, 2017 at 07:59:18PM +0100, Chris Wilson wrote:
> On Tue, Apr 11, 2017 at 09:02:51AM -0700, Kenneth Graunke wrote:
> > If we have buffers larger than 4GB, then target_offset will need to
> > become a 64-bit value.  Delta is only a __u32 though, so we downcast.
> > 
> > Suggested by Chris Wilson.
> > ---
> >  src/mesa/drivers/dri/i965/intel_batchbuffer.c | 4 ++--
> >  src/mesa/drivers/dri/i965/intel_batchbuffer.h | 2 +-
> >  2 files changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c 
> > b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
> > index 6e4b55cf9ec..abaeb6bcbfe 100644
> > --- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
> > +++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
> > @@ -734,7 +734,7 @@ brw_batch_references(struct intel_batchbuffer *batch, 
> > struct brw_bo *bo)
> >   */
> >  uint64_t
> >  brw_emit_reloc(struct intel_batchbuffer *batch, uint32_t batch_offset,
> 
> It's batch_offset that's u64 (to match the u64 size). Just delta
> (target_offset) is the oddity being s32 into a potential u64 object. :|

I think originally (back when we had the userspace mm inspired tree of
objects model) delta was meant for the various flags in the lower 12 bits,
since we never did buffer suballocation. A shame we didn't fix this in
execbuf2, but oh well.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v2 06/15] draw: remove unused wideline_stage()

2017-04-11 Thread Samuel Pitoiset
Fixes the following Clang warning.

draw/draw_pipe_wide_line.c:48:38: warning: unused function 'wideline_stage' 
[-Wunused-function]
static inline struct wideline_stage *wideline_stage( struct draw_stage *stage )
 ^
1 warning generated.

v2: - remove commented code (Roland Scheidegger)

Signed-off-by: Samuel Pitoiset 
---
 src/gallium/auxiliary/draw/draw_pipe_wide_line.c | 9 -
 1 file changed, 9 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_pipe_wide_line.c 
b/src/gallium/auxiliary/draw/draw_pipe_wide_line.c
index ae4a00eb63..103f080491 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_wide_line.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_wide_line.c
@@ -44,21 +44,12 @@ struct wideline_stage {
 };
 
 
-
-static inline struct wideline_stage *wideline_stage( struct draw_stage *stage )
-{
-   return (struct wideline_stage *)stage;
-}
-
-
-
 /**
  * Draw a wide line by drawing a quad (two triangles).
  */
 static void wideline_line( struct draw_stage *stage,
struct prim_header *header )
 {
-   /*const struct wideline_stage *wide = wideline_stage(stage);*/
const unsigned pos = draw_current_shader_position_output(stage->draw);
const float half_width = 0.5f * stage->draw->rasterizer->line_width;
 
-- 
2.12.2

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


Re: [Mesa-dev] [PATCH 00/12] swr: update rasterizer

2017-04-11 Thread Cherniak, Bruce
Entire set Reviewed-by: Bruce Cherniak 

> On Apr 10, 2017, at 11:45 AM, Tim Rowley  wrote:
> 
> Highlights; compile time fix, simd16 work, code cleanup.
> 
> Tim Rowley (12):
>  swr: [rasterizer core] Reduce templates to speed compile
>  swr: [rasterizer core] Multisample sample position setup change
>  swr: [rasterizer core] SIMD16 Frontend WIP - Clipper
>  swr: [rasterizer core] SIMD16 Frontend WIP - PA
>  swr: [rasterizer core] Code formating change
>  swr: [rasterizer core] Fix unused variable warnings
>  swr: [rasterizer common/core] Fix 32-bit windows build
>  swr: [rasterizer jitter] Remove HAVE_LLVM tests supporting llvm < 3.8
>  swr: [rasterizer jitter] Remove unused function
>  swr: [rasterizer archrast] Fix archrast for MSVC 2017 compiler
>  swr: [rasterizer common] Add _simd_testz_si alias
>  swr: [rasterizer core] Disable 8x2 tile backend
> 
> .../drivers/swr/rasterizer/archrast/archrast.cpp   |2 +-
> .../drivers/swr/rasterizer/archrast/archrast.h |2 +-
> .../drivers/swr/rasterizer/archrast/eventmanager.h |2 +-
> .../drivers/swr/rasterizer/codegen/gen_backends.py |   25 +-
> .../rasterizer/codegen/templates/gen_ar_event.cpp  |2 +-
> .../rasterizer/codegen/templates/gen_ar_event.hpp  |4 +-
> .../drivers/swr/rasterizer/common/simd16intrin.h   |  237 ++---
> .../drivers/swr/rasterizer/common/simdintrin.h |1 +
> src/gallium/drivers/swr/rasterizer/core/api.cpp|2 +-
> .../drivers/swr/rasterizer/core/backend.cpp|1 -
> src/gallium/drivers/swr/rasterizer/core/binner.cpp |   33 +-
> src/gallium/drivers/swr/rasterizer/core/clip.cpp   |   91 +-
> src/gallium/drivers/swr/rasterizer/core/clip.h | 1033 ++--
> src/gallium/drivers/swr/rasterizer/core/context.h  |2 +-
> .../swr/rasterizer/core/format_conversion.h|8 +-
> .../drivers/swr/rasterizer/core/format_types.h |   22 +-
> src/gallium/drivers/swr/rasterizer/core/frontend.h |   33 +-
> src/gallium/drivers/swr/rasterizer/core/knobs.h|2 +-
> .../drivers/swr/rasterizer/core/multisample.cpp|   44 +-
> .../drivers/swr/rasterizer/core/multisample.h  |   98 +-
> src/gallium/drivers/swr/rasterizer/core/pa_avx.cpp |   44 +-
> .../drivers/swr/rasterizer/core/rasterizer.cpp |6 +-
> .../drivers/swr/rasterizer/core/rasterizer.h   |   67 +-
> src/gallium/drivers/swr/rasterizer/core/state.h|   20 +-
> .../drivers/swr/rasterizer/jitter/JitManager.cpp   |   44 -
> .../drivers/swr/rasterizer/jitter/JitManager.h |7 -
> .../drivers/swr/rasterizer/jitter/builder_misc.cpp |   31 -
> .../drivers/swr/rasterizer/jitter/builder_misc.h   |5 -
> 28 files changed, 1337 insertions(+), 531 deletions(-)
> 
> -- 
> 2.7.4
> 
> ___
> 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] anv: Limit VkDeviceMemory objects to 2GB

2017-04-11 Thread Jason Ekstrand
On Tue, Apr 11, 2017 at 11:27 AM, Chris Wilson 
wrote:

> On Tue, Apr 11, 2017 at 10:58:41AM -0700, Jason Ekstrand wrote:
> > Cc: "Juan A. Suárez" 
> > ---
> >  src/intel/vulkan/anv_device.c | 17 +
> >  1 file changed, 17 insertions(+)
> >
> > diff --git a/src/intel/vulkan/anv_device.c
> b/src/intel/vulkan/anv_device.c
> > index 35ef4c4..b24c739 100644
> > --- a/src/intel/vulkan/anv_device.c
> > +++ b/src/intel/vulkan/anv_device.c
> > @@ -1539,6 +1539,23 @@ VkResult anv_AllocateMemory(
> > assert(pAllocateInfo->memoryTypeIndex == 0 ||
> >(!device->info.has_llc && pAllocateInfo->memoryTypeIndex <
> 2));
> >
> > +   /* The kernel relocation API has a limitation of a 32-bit delta value
> > +* applied to the address before it is written which, in spite of it
> being
> > +* unsigned, is treated as signed .  Because of the way that this
> maps to
> > +* the Vulkan API, we cannot handle an offset into a buffer that
> does not
> > +* fit into a signed 31 bits.
>
> Correct. Other users take advantage of the negative deltas.
>
> > The only mechanism we have for dealing with
> > +* this at the moment is to limit all VkDeviceMemory objects to a
> maximum
> > +* of 2GB each.  The Vulkan spec allows us to do this:
> > +*
> > +*"Some platforms may have a limit on the maximum size of a
> single
> > +*allocation. For example, certain systems may fail to create
> > +*allocations with a size greater than or equal to 4GB. Such a
> limit is
> > +*implementation-dependent, and if such a failure occurs then
> the error
> > +*VK_ERROR_OUT_OF_DEVICE_MEMORY should be returned."
> > +*/
> > +   if (pAllocationInfo->allocationSize > (1ull << 31))
> > +  return VK_ERROR_OUT_OF_HOST_MEMORY;
>
> Hmm. So how do we lift this?


Good question.


> Is this a complete blocker to large object
> support, or is this only the slab allocator that is limited? The
> phrasing (all VkDeviceMemory) suggests that this is imposing an absolute
> limit to any object size.
>

That's correct.


> Otoh, there are good reasons why you probably want to stitch together
> smaller objects to emulate a huge object (e.g. sparse).
>

Yeah.  We don't support sparse yet but it would allow a user to create a
texture that large.


> If this is a blocker, there is enough space inside
> drm_i915_gem_relocation_entry to support a s65 (full u64 delta plus
> direction bit) by sacrificing read/write domain and reusing delta as a
> flag (with an exec flag to indicate the change in meaning). Or you may
> just declare this the final straw and all large objects will be
> softpinned and relocation-less.
>

That's my intended "final" solution.  On my medium-term todo list (probably
later this year) is to pull a foreign memory allocator into mesa and just
stop doing relocations altogether.  Once we can do that, this limitation is
lifted.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 4/4] radv: Implement pipeline statistics queries.

2017-04-11 Thread Michael Schellenberger Costa

Hi Bas,

it seems like this junk

+   nir_intrinsic_instr *store = nir_intrinsic_instr_create(b.shader, 
nir_intrinsic_store_ssbo);
+   store->src[0] = nir_src_for_ssa(available);
+   store->src[1] = nir_src_for_ssa(&dst_buf->dest.ssa);
+   store->src[2] = nir_src_for_ssa(nir_iadd(&b, output_base, nir_imul(&b, 
elem_count, elem_size)));
+   nir_intrinsic_set_write_mask(store, 0x1);
+   store->num_components = 1;
+   nir_builder_instr_insert(&b, &store->instr);


would make a great helper function, as it is repeated 5 times in the 
code and only the input for src[0] and src[2] changes.


Similarly you could simplify those longer sequences

+   /* Store the availability bit if requested. */
+   nir_if *availability_if = nir_if_create(b.shader);
+   availability_if->condition = nir_src_for_ssa(nir_iand(&b, flags, 
nir_imm_int(&b, VK_QUERY_RESULT_WITH_AVAILABILITY_BIT)));
+   nir_cf_node_insert(b.cursor, &availability_if->cf_node);
+
+   b.cursor = nir_after_cf_list(&availability_if->then_list);
+
+   nir_store_for_ssbo(store, available, )nir_intrinsic_instr *store = 
nir_intrinsic_instr_create(b.shader, nir_intrinsic_store_ssbo);
+   store->src[0] = nir_src_for_ssa(available);
+   store->src[1] = nir_src_for_ssa(&dst_buf->dest.ssa);
+   store->src[2] = nir_src_for_ssa(nir_iadd(&b, output_base, nir_imul(&b, 
elem_count, elem_size)));
+   nir_intrinsic_set_write_mask(store, 0x1);
+   store->num_components = 1;
+   nir_builder_instr_insert(&b, &store->instr);
+
+   b.cursor = nir_after_cf_node(&availability_if->cf_node);

which appear twice

All the best
Michael

Am 11.04.2017 um 02:04 schrieb Bas Nieuwenhuizen:

The devil is in the shader again, otherwise this is
fairly straightforward.

The CTS contains no pipeline statistics copy to buffer
testcases, so I did a basic smoketest.

Signed-off-by: Bas Nieuwenhuizen 
---
  src/amd/vulkan/radv_device.c  |   2 +-
  src/amd/vulkan/radv_private.h |   2 +
  src/amd/vulkan/radv_query.c   | 414 +++---
  3 files changed, 392 insertions(+), 26 deletions(-)

diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 9e8faa3da9a..5f14394196a 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -483,7 +483,7 @@ void radv_GetPhysicalDeviceFeatures(
.textureCompressionASTC_LDR   = false,
.textureCompressionBC = true,
.occlusionQueryPrecise= true,
-   .pipelineStatisticsQuery  = false,
+   .pipelineStatisticsQuery  = true,
.vertexPipelineStoresAndAtomics   = true,
.fragmentStoresAndAtomics = true,
.shaderTessellationAndGeometryPointSize   = true,
diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
index b54a2537c8a..2cb8cdd8d84 100644
--- a/src/amd/vulkan/radv_private.h
+++ b/src/amd/vulkan/radv_private.h
@@ -443,6 +443,7 @@ struct radv_meta_state {
VkDescriptorSetLayout ds_layout;
VkPipelineLayout p_layout;
VkPipeline occlusion_query_pipeline;
+   VkPipeline pipeline_statistics_query_pipeline;
} query;
  };
  
@@ -1379,6 +1380,7 @@ struct radv_query_pool {

uint32_t availability_offset;
char *ptr;
VkQueryType type;
+   uint32_t pipeline_stats_mask;
  };
  
  VkResult

diff --git a/src/amd/vulkan/radv_query.c b/src/amd/vulkan/radv_query.c
index dc1844adb51..2de484224bc 100644
--- a/src/amd/vulkan/radv_query.c
+++ b/src/amd/vulkan/radv_query.c
@@ -35,6 +35,9 @@
  #include "radv_cs.h"
  #include "sid.h"
  
+

+static const unsigned pipeline_statistics_indices[] = {7, 6, 3, 4, 5, 2, 1, 0, 
8, 9, 10};
+
  static unsigned get_max_db(struct radv_device *device)
  {
unsigned num_db = device->physical_device->rad_info.num_render_backends;
@@ -269,14 +272,259 @@ build_occlusion_query_shader(struct radv_device *device) 
{
return b.shader;
  }
  
+static nir_shader *

+build_pipeline_statistics_query_shader(struct radv_device *device) {
+   /* the shader this builds is roughly
+*
+* push constants {
+*  uint32_t flags;
+*  uint32_t dst_stride;
+*  uint32_t stats_mask;
+*  uint32_t avail_offset;
+* };
+*
+* uint32_t src_stride = 11 * 16;
+*
+* location(binding = 0) buffer dst_buf;
+* location(binding = 1) buffer src_buf;
+*
+* void main() {
+*  uint64_t src_offset = src_stride * global_id.x;
+*  uint64_t dst_base = dst_stride * global_id.x;
+*  uint64_t dst_offset = dst_base;
+*  uint32_t elem_size = flags & VK_QUERY_RESULT_64_BIT ? 8 : 4;
+*  uint32_t elem_count = stats_mask >> 16;
+ 

Re: [Mesa-dev] [PATCH 8/8] i965/drm: Make brw_emit_reloc take a uint64_t target_offset.

2017-04-11 Thread Chris Wilson
On Tue, Apr 11, 2017 at 09:02:51AM -0700, Kenneth Graunke wrote:
> If we have buffers larger than 4GB, then target_offset will need to
> become a 64-bit value.  Delta is only a __u32 though, so we downcast.
> 
> Suggested by Chris Wilson.
> ---
>  src/mesa/drivers/dri/i965/intel_batchbuffer.c | 4 ++--
>  src/mesa/drivers/dri/i965/intel_batchbuffer.h | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c 
> b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
> index 6e4b55cf9ec..abaeb6bcbfe 100644
> --- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
> +++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
> @@ -734,7 +734,7 @@ brw_batch_references(struct intel_batchbuffer *batch, 
> struct brw_bo *bo)
>   */
>  uint64_t
>  brw_emit_reloc(struct intel_batchbuffer *batch, uint32_t batch_offset,

It's batch_offset that's u64 (to match the u64 size). Just delta
(target_offset) is the oddity being s32 into a potential u64 object. :|
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 06/15] draw: remove unused wideline_stage()

2017-04-11 Thread Roland Scheidegger
Note there's commented out code which uses it. So either get rid of that
too, plus whatever was in that stage (half_line_width), or keep it,
otherwise it's just less obvious these things aren't used.

Roland

Am 11.04.2017 um 19:58 schrieb Samuel Pitoiset:
> Fixes the following Clang warning.
> 
> draw/draw_pipe_wide_line.c:48:38: warning: unused function 'wideline_stage' 
> [-Wunused-function]
> static inline struct wideline_stage *wideline_stage( struct draw_stage *stage 
> )
>  ^
> 1 warning generated.
> 
> Signed-off-by: Samuel Pitoiset 
> ---
>  src/gallium/auxiliary/draw/draw_pipe_wide_line.c | 8 
>  1 file changed, 8 deletions(-)
> 
> diff --git a/src/gallium/auxiliary/draw/draw_pipe_wide_line.c 
> b/src/gallium/auxiliary/draw/draw_pipe_wide_line.c
> index ae4a00eb63..4232a4a17c 100644
> --- a/src/gallium/auxiliary/draw/draw_pipe_wide_line.c
> +++ b/src/gallium/auxiliary/draw/draw_pipe_wide_line.c
> @@ -44,14 +44,6 @@ struct wideline_stage {
>  };
>  
>  
> -
> -static inline struct wideline_stage *wideline_stage( struct draw_stage 
> *stage )
> -{
> -   return (struct wideline_stage *)stage;
> -}
> -
> -
> -
>  /**
>   * Draw a wide line by drawing a quad (two triangles).
>   */
> 

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


Re: [Mesa-dev] [PATCH 11/15] llvmpipe: remove unused subpixel_snap() and fixed_to_float()

2017-04-11 Thread Roland Scheidegger
subpixel_snap is very much used (fixed_to_float, not so much), so you
can't get rid of it.
If you want you can place it into a #if !defined(PIPE_ARCH_SSE) clause
though...

Roland

Am 11.04.2017 um 19:58 schrieb Samuel Pitoiset:
> Fixes the following Clang warnings.
> 
> lp_setup_tri.c:55:1: warning: unused function 'subpixel_snap' 
> [-Wunused-function]
> subpixel_snap(float a)
> ^
> lp_setup_tri.c:61:1: warning: unused function 'fixed_to_float' 
> [-Wunused-function]
> fixed_to_float(int a)
> ^
> 
> Signed-off-by: Samuel Pitoiset 
> ---
>  src/gallium/drivers/llvmpipe/lp_setup_tri.c | 12 
>  1 file changed, 12 deletions(-)
> 
> diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c 
> b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
> index 98243a12de..cc1508ccc2 100644
> --- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c
> +++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
> @@ -51,18 +51,6 @@
>  #include "util/u_pwr8.h"
>  #endif
>  
> -static inline int
> -subpixel_snap(float a)
> -{
> -   return util_iround(FIXED_ONE * a);
> -}
> -
> -static inline float
> -fixed_to_float(int a)
> -{
> -   return a * (1.0f / FIXED_ONE);
> -}
> -
>  
>  /* Position and area in fixed point coordinates */
>  struct fixed_position {
> 

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


Re: [Mesa-dev] [PATCH 05/15] draw: remove unused overflow()

2017-04-11 Thread Roland Scheidegger
Reviewed-by: Roland Scheidegger 

Am 11.04.2017 um 19:58 schrieb Samuel Pitoiset:
> Fixes the following Clang warning.
> 
> draw/draw_pipe_vbuf.c:102:1: warning: unused function 'overflow' 
> [-Wunused-function]
> overflow( void *map, void *ptr, unsigned bytes, unsigned bufsz )
> ^
> 1 warning generated.
> 
> Signed-off-by: Samuel Pitoiset 
> ---
>  src/gallium/auxiliary/draw/draw_pipe_vbuf.c | 8 
>  1 file changed, 8 deletions(-)
> 
> diff --git a/src/gallium/auxiliary/draw/draw_pipe_vbuf.c 
> b/src/gallium/auxiliary/draw/draw_pipe_vbuf.c
> index 6df7149b53..f26063d1fe 100644
> --- a/src/gallium/auxiliary/draw/draw_pipe_vbuf.c
> +++ b/src/gallium/auxiliary/draw/draw_pipe_vbuf.c
> @@ -98,14 +98,6 @@ static void vbuf_flush_vertices( struct vbuf_stage *vbuf );
>  static void vbuf_alloc_vertices( struct vbuf_stage *vbuf );
>  
>  
> -static inline boolean 
> -overflow( void *map, void *ptr, unsigned bytes, unsigned bufsz )
> -{
> -   unsigned long used = (unsigned long) ((char *)ptr - (char *)map);
> -   return (used + bytes) > bufsz;
> -}
> -
> -
>  static inline void 
>  check_space( struct vbuf_stage *vbuf, unsigned nr )
>  {
> 

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


Re: [Mesa-dev] [PATCH] anv: Limit VkDeviceMemory objects to 2GB

2017-04-11 Thread Chris Wilson
On Tue, Apr 11, 2017 at 10:58:41AM -0700, Jason Ekstrand wrote:
> Cc: "Juan A. Suárez" 
> ---
>  src/intel/vulkan/anv_device.c | 17 +
>  1 file changed, 17 insertions(+)
> 
> diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
> index 35ef4c4..b24c739 100644
> --- a/src/intel/vulkan/anv_device.c
> +++ b/src/intel/vulkan/anv_device.c
> @@ -1539,6 +1539,23 @@ VkResult anv_AllocateMemory(
> assert(pAllocateInfo->memoryTypeIndex == 0 ||
>(!device->info.has_llc && pAllocateInfo->memoryTypeIndex < 2));
>  
> +   /* The kernel relocation API has a limitation of a 32-bit delta value
> +* applied to the address before it is written which, in spite of it being
> +* unsigned, is treated as signed .  Because of the way that this maps to
> +* the Vulkan API, we cannot handle an offset into a buffer that does not
> +* fit into a signed 31 bits.

Correct. Other users take advantage of the negative deltas.

> The only mechanism we have for dealing with
> +* this at the moment is to limit all VkDeviceMemory objects to a maximum
> +* of 2GB each.  The Vulkan spec allows us to do this:
> +*
> +*"Some platforms may have a limit on the maximum size of a single
> +*allocation. For example, certain systems may fail to create
> +*allocations with a size greater than or equal to 4GB. Such a limit 
> is
> +*implementation-dependent, and if such a failure occurs then the 
> error
> +*VK_ERROR_OUT_OF_DEVICE_MEMORY should be returned."
> +*/
> +   if (pAllocationInfo->allocationSize > (1ull << 31))
> +  return VK_ERROR_OUT_OF_HOST_MEMORY;

Hmm. So how do we lift this? Is this a complete blocker to large object
support, or is this only the slab allocator that is limited? The
phrasing (all VkDeviceMemory) suggests that this is imposing an absolute
limit to any object size.

Otoh, there are good reasons why you probably want to stitch together
smaller objects to emulate a huge object (e.g. sparse).

If this is a blocker, there is enough space inside
drm_i915_gem_relocation_entry to support a s65 (full u64 delta plus
direction bit) by sacrificing read/write domain and reusing delta as a
flag (with an exec flag to indicate the change in meaning). Or you may
just declare this the final straw and all large objects will be
softpinned and relocation-less.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v3] anv: Limit VkDeviceMemory objects to 2GB

2017-04-11 Thread Jason Ekstrand
v2 (Jason Ekstrand):
 - Limit to 2GB instead of 4GB

v3 (Jason Ekstrand):
 - Fix the build by using pAllocateInfo instead of pAllocationInfo (not
   sure how that happened).
 - Return vK_ERROR_OUT_OF_DEVICE_MEMORY (Thanks Ilia!)

Cc: "Juan A. Suárez" 
---
 src/intel/vulkan/anv_device.c | 20 
 1 file changed, 20 insertions(+)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 35ef4c4..ee9c48f 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -1539,6 +1539,26 @@ VkResult anv_AllocateMemory(
assert(pAllocateInfo->memoryTypeIndex == 0 ||
   (!device->info.has_llc && pAllocateInfo->memoryTypeIndex < 2));
 
+   /* The kernel relocation API has a limitation of a 32-bit delta value
+* applied to the address before it is written which, in spite of it being
+* unsigned, is treated as signed .  Because of the way that this maps to
+* the Vulkan API, we cannot handle an offset into a buffer that does not
+* fit into a signed 32 bits.  The only mechanism we have for dealing with
+* this at the moment is to limit all VkDeviceMemory objects to a maximum
+* of 2GB each.  The Vulkan spec allows us to do this:
+*
+*"Some platforms may have a limit on the maximum size of a single
+*allocation. For example, certain systems may fail to create
+*allocations with a size greater than or equal to 4GB. Such a limit is
+*implementation-dependent, and if such a failure occurs then the error
+*VK_ERROR_OUT_OF_DEVICE_MEMORY should be returned."
+*
+* We don't use vk_error here because it's not an error so much as an
+* indication to the application that the allocation is too large.
+*/
+   if (pAllocateInfo->allocationSize > (1ull << 31))
+  return VK_ERROR_OUT_OF_DEVICE_MEMORY;
+
/* FINISHME: Fail if allocation request exceeds heap size. */
 
mem = vk_alloc2(&device->alloc, pAllocator, sizeof(*mem), 8,
-- 
2.5.0.400.gff86faf

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


Re: [Mesa-dev] [PATCH 00/15] Clang compiler warning fixes

2017-04-11 Thread Brian Paul

On 04/11/2017 11:58 AM, Samuel Pitoiset wrote:

Noticed while building my whole ARB_bindless_texture work to avoid
missing switch cases, etc. This series doesn't fix all warnings, just
the easy ones.

Please, review!
Thanks.


For 1-14, Reviewed-by: Brian Paul 

-Brian




Samuel Pitoiset (15):
   virgl: add missing PIPE_CAP_DOUBLES
   mesa: remove unused _mesa_unmarshal_BindBufferBase()
   mesa: remove unused clamp_float_to_uint() and clamp_half_to_uint()
   mesa: remove some unused functions in the perf monitor area
   draw: remove unused overflow()
   draw: remove unused wideline_stage()
   trace: remove some unused trace_dump_tag*() functions
   softpipe: remove unused get_texel_quad_2d()
   softpipe: remove unused quad_shade_stage()
   softpipe: remove unused sp_exec_fragment_shader()
   llvmpipe: remove unused subpixel_snap() and fixed_to_float()
   svga: remove unused vmw_dri1_intersect_src_bbox()
   radeon: remove duplicate 'const' specifier
   st/mesa: fix wrong comparison in update_framebuffer_state()
   i965: add missing ir_unop_*/ir_binop_* in visit_leave()

  src/gallium/auxiliary/draw/draw_pipe_vbuf.c|  8 
  src/gallium/auxiliary/draw/draw_pipe_wide_line.c   |  8 
  src/gallium/drivers/llvmpipe/lp_setup_tri.c| 12 -
  src/gallium/drivers/softpipe/sp_fs_exec.c  |  8 
  src/gallium/drivers/softpipe/sp_quad_fs.c  |  8 
  src/gallium/drivers/softpipe/sp_tex_sample.c   | 17 ---
  src/gallium/drivers/trace/tr_dump.c| 52 --
  src/gallium/drivers/virgl/virgl_screen.c   |  1 +
  src/gallium/winsys/svga/drm/vmw_screen_dri.c   | 32 -
  .../dri/i965/brw_fs_channel_expressions.cpp|  3 ++
  .../drivers/dri/radeon/radeon_common_context.c |  2 +-
  .../drivers/dri/radeon/radeon_common_context.h |  2 +-
  src/mesa/main/marshal.c|  8 
  src/mesa/main/pack.c   | 15 ---
  src/mesa/main/performance_monitor.c| 27 ---
  src/mesa/state_tracker/st_atom_framebuffer.c   |  8 ++--
  16 files changed, 10 insertions(+), 201 deletions(-)



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


Re: [Mesa-dev] [PATCH] anv: Limit VkDeviceMemory objects to 2GB

2017-04-11 Thread Jason Ekstrand
On Tue, Apr 11, 2017 at 11:03 AM, Ilia Mirkin  wrote:

> On Tue, Apr 11, 2017 at 1:58 PM, Jason Ekstrand 
> wrote:
> > Cc: "Juan A. Suárez" 
> > ---
> >  src/intel/vulkan/anv_device.c | 17 +
> >  1 file changed, 17 insertions(+)
> >
> > diff --git a/src/intel/vulkan/anv_device.c
> b/src/intel/vulkan/anv_device.c
> > index 35ef4c4..b24c739 100644
> > --- a/src/intel/vulkan/anv_device.c
> > +++ b/src/intel/vulkan/anv_device.c
> > @@ -1539,6 +1539,23 @@ VkResult anv_AllocateMemory(
> > assert(pAllocateInfo->memoryTypeIndex == 0 ||
> >(!device->info.has_llc && pAllocateInfo->memoryTypeIndex <
> 2));
> >
> > +   /* The kernel relocation API has a limitation of a 32-bit delta value
> > +* applied to the address before it is written which, in spite of it
> being
> > +* unsigned, is treated as signed .  Because of the way that this
> maps to
> > +* the Vulkan API, we cannot handle an offset into a buffer that
> does not
> > +* fit into a signed 31 bits.  The only mechanism we have for
> dealing with
>
> 32 bits?
>

Yup.


> > +* this at the moment is to limit all VkDeviceMemory objects to a
> maximum
> > +* of 2GB each.  The Vulkan spec allows us to do this:
> > +*
> > +*"Some platforms may have a limit on the maximum size of a
> single
> > +*allocation. For example, certain systems may fail to create
> > +*allocations with a size greater than or equal to 4GB. Such a
> limit is
> > +*implementation-dependent, and if such a failure occurs then
> the error
> > +*VK_ERROR_OUT_OF_DEVICE_MEMORY should be returned."
> > +*/
> > +   if (pAllocationInfo->allocationSize > (1ull << 31))
>
> 1<<31 is not representable in a 32-bit signed int. did you mean >= ?
>

No.  You can't validly have a 2GB offset into a 2GB buffer because you nee
some space after it to put the thing you're binding.  Anything over 2GB, on
the other hand, has a potential problem.


> > +  return VK_ERROR_OUT_OF_HOST_MEMORY;
>
> The comment above would suggest OUT_OF_DEVICE_MEMORY...
>

Bah!  Thanks!  I'll send a v3.


> > +
> > /* FINISHME: Fail if allocation request exceeds heap size. */
> >
> > mem = vk_alloc2(&device->alloc, pAllocator, sizeof(*mem), 8,
> > --
> > 2.5.0.400.gff86faf
> >
> > ___
> > 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] anv: Limit VkDeviceMemory objects to 2GB

2017-04-11 Thread Ilia Mirkin
On Tue, Apr 11, 2017 at 1:58 PM, Jason Ekstrand  wrote:
> Cc: "Juan A. Suárez" 
> ---
>  src/intel/vulkan/anv_device.c | 17 +
>  1 file changed, 17 insertions(+)
>
> diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
> index 35ef4c4..b24c739 100644
> --- a/src/intel/vulkan/anv_device.c
> +++ b/src/intel/vulkan/anv_device.c
> @@ -1539,6 +1539,23 @@ VkResult anv_AllocateMemory(
> assert(pAllocateInfo->memoryTypeIndex == 0 ||
>(!device->info.has_llc && pAllocateInfo->memoryTypeIndex < 2));
>
> +   /* The kernel relocation API has a limitation of a 32-bit delta value
> +* applied to the address before it is written which, in spite of it being
> +* unsigned, is treated as signed .  Because of the way that this maps to
> +* the Vulkan API, we cannot handle an offset into a buffer that does not
> +* fit into a signed 31 bits.  The only mechanism we have for dealing with

32 bits?

> +* this at the moment is to limit all VkDeviceMemory objects to a maximum
> +* of 2GB each.  The Vulkan spec allows us to do this:
> +*
> +*"Some platforms may have a limit on the maximum size of a single
> +*allocation. For example, certain systems may fail to create
> +*allocations with a size greater than or equal to 4GB. Such a limit 
> is
> +*implementation-dependent, and if such a failure occurs then the 
> error
> +*VK_ERROR_OUT_OF_DEVICE_MEMORY should be returned."
> +*/
> +   if (pAllocationInfo->allocationSize > (1ull << 31))

1<<31 is not representable in a 32-bit signed int. did you mean >= ?

> +  return VK_ERROR_OUT_OF_HOST_MEMORY;

The comment above would suggest OUT_OF_DEVICE_MEMORY...

> +
> /* FINISHME: Fail if allocation request exceeds heap size. */
>
> mem = vk_alloc2(&device->alloc, pAllocator, sizeof(*mem), 8,
> --
> 2.5.0.400.gff86faf
>
> ___
> 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


[Mesa-dev] [PATCH] anv: Limit VkDeviceMemory objects to 2GB

2017-04-11 Thread Jason Ekstrand
Cc: "Juan A. Suárez" 
---
 src/intel/vulkan/anv_device.c | 17 +
 1 file changed, 17 insertions(+)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 35ef4c4..4aa0340 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -1539,6 +1539,23 @@ VkResult anv_AllocateMemory(
assert(pAllocateInfo->memoryTypeIndex == 0 ||
   (!device->info.has_llc && pAllocateInfo->memoryTypeIndex < 2));
 
+   /* The kernel relocation API has a limitation of a 32-bit delta value
+* applied to the address before it is written which, in spite of it being
+* unsigned, is treated as signed .  Because of the way that this maps to
+* the Vulkan API, we cannot handle an offset into a buffer that does not
+* fit into a signed 32 bits.  The only mechanism we have for dealing with
+* this at the moment is to limit all VkDeviceMemory objects to a maximum
+* of 2GB each.  The Vulkan spec allows us to do this:
+*
+*"Some platforms may have a limit on the maximum size of a single
+*allocation. For example, certain systems may fail to create
+*allocations with a size greater than or equal to 4GB. Such a limit is
+*implementation-dependent, and if such a failure occurs then the error
+*VK_ERROR_OUT_OF_DEVICE_MEMORY should be returned."
+*/
+   if (pAllocateInfo->allocationSize > (1ull << 31))
+  return VK_ERROR_OUT_OF_HOST_MEMORY;
+
/* FINISHME: Fail if allocation request exceeds heap size. */
 
mem = vk_alloc2(&device->alloc, pAllocator, sizeof(*mem), 8,
-- 
2.5.0.400.gff86faf

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


Re: [Mesa-dev] [PATCH v2 2/4] egl, dri: Propagate context priority hint to driver->CreateContext

2017-04-11 Thread Ben Widawsky

On 17-04-11 17:11:55, Chris Wilson wrote:

Jump through the layers of abstraction between egl and dri in order to
feed the context priority attribute through to the backend. This
requires us to read the value from the base _egl_context, convert it to
a DRI attribute, parse it again in the generic context creator before
passing it to the driver as a function parameter.

In order to not require us to pass back the actual value of the context
priority after creation, we impose that drivers should report the
available set of priorities during screen setup (and then they may chose
to fail if given an invalid value as that should have been checked at
the user boundary.)

Signed-off-by: Chris Wilson 
---
include/GL/internal/dri_interface.h|  6 
src/egl/drivers/dri2/egl_dri2.c| 38 +-
src/gallium/state_trackers/dri/dri_context.c   |  1 +
src/gallium/state_trackers/dri/dri_context.h   |  1 +
src/mesa/drivers/dri/common/dri_util.c |  7 -
src/mesa/drivers/dri/common/dri_util.h |  9 +++---
src/mesa/drivers/dri/i915/intel_screen.c   | 11 
src/mesa/drivers/dri/i965/brw_context.c|  7 +++--
src/mesa/drivers/dri/i965/brw_context.h| 17 ++--
src/mesa/drivers/dri/nouveau/nouveau_context.c |  1 +
src/mesa/drivers/dri/nouveau/nouveau_context.h |  4 +--
src/mesa/drivers/dri/r200/r200_context.c   |  1 +
src/mesa/drivers/dri/r200/r200_context.h   |  1 +
src/mesa/drivers/dri/radeon/radeon_context.c   |  1 +
src/mesa/drivers/dri/radeon/radeon_context.h   |  1 +
src/mesa/drivers/dri/swrast/swrast.c   |  1 +
16 files changed, 77 insertions(+), 30 deletions(-)

diff --git a/include/GL/internal/dri_interface.h 
b/include/GL/internal/dri_interface.h
index 9881ddcbb0..969d304a95 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -1056,6 +1056,12 @@ struct __DRIdri2LoaderExtensionRec {
#define __DRI_CTX_RESET_LOSE_CONTEXT1
/*@}*/

+#define __DRI_CTX_ATTRIB_PRIORITY  4
+
+#define __DRI_CTX_PRIORITY_LOW 0
+#define __DRI_CTX_PRIORITY_MEDIUM  1
+#define __DRI_CTX_PRIORITY_HIGH2
+


Kind of annoying to redefine these yet again. I suppose you could try to reuse
the HAS_CTR_PRIORITY bits?


/**
 * \name Reasons that __DRIdri2Extension::createContextAttribs might fail
 */
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 0c2fdc1cc2..7628a9d5b1 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -83,6 +83,8 @@
#define DRM_FORMAT_GR1616fourcc_code('G', 'R', '3', '2') /* [31:0] R:G 
16:16 little endian */
#endif

+#define NUM_ATTRIBS 10
+
static void
dri_set_background_context(void *loaderPrivate)
{
@@ -1054,7 +1056,7 @@ dri2_fill_context_attribs(struct dri2_egl_context 
*dri2_ctx,
{
   int pos = 0;

-   assert(*num_attribs >= 8);
+   assert(*num_attribs >= NUM_ATTRIBS);

   ctx_attribs[pos++] = __DRI_CTX_ATTRIB_MAJOR_VERSION;
   ctx_attribs[pos++] = dri2_ctx->base.ClientMajorVersion;
@@ -1090,6 +1092,28 @@ dri2_fill_context_attribs(struct dri2_egl_context 
*dri2_ctx,
  ctx_attribs[pos++] = __DRI_CTX_RESET_LOSE_CONTEXT;
   }

+   if (dri2_ctx->base.ContextPriority != EGL_CONTEXT_PRIORITY_MEDIUM_IMG) {
+  unsigned val;
+
+  switch (dri2_ctx->base.ContextPriority) {
+  case EGL_CONTEXT_PRIORITY_HIGH_IMG:
+ val = __DRI_CTX_PRIORITY_HIGH;
+ break;
+  case EGL_CONTEXT_PRIORITY_MEDIUM_IMG:
+ val = __DRI_CTX_PRIORITY_MEDIUM;
+ break;
+  case EGL_CONTEXT_PRIORITY_LOW_IMG:
+ val = __DRI_CTX_PRIORITY_LOW;
+ break;
+  default:
+ _eglError(EGL_BAD_CONFIG, "eglCreateContext");
+ return false;
+  }
+
+  ctx_attribs[pos++] = __DRI_CTX_ATTRIB_PRIORITY;
+  ctx_attribs[pos++] = val;
+   }
+
   *num_attribs = pos;

   return true;
@@ -1193,8 +1217,8 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, 
_EGLConfig *conf,

   if (dri2_dpy->image_driver) {
  unsigned error;
-  unsigned num_attribs = 8;
-  uint32_t ctx_attribs[8];
+  unsigned num_attribs = NUM_ATTRIBS;
+  uint32_t ctx_attribs[NUM_ATTRIBS];

  if (!dri2_fill_context_attribs(dri2_ctx, dri2_dpy, ctx_attribs,
&num_attribs))
@@ -1213,8 +1237,8 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, 
_EGLConfig *conf,
   } else if (dri2_dpy->dri2) {
  if (dri2_dpy->dri2->base.version >= 3) {
 unsigned error;
- unsigned num_attribs = 8;
- uint32_t ctx_attribs[8];
+ unsigned num_attribs = NUM_ATTRIBS;
+ uint32_t ctx_attribs[NUM_ATTRIBS];

 if (!dri2_fill_context_attribs(dri2_ctx, dri2_dpy, ctx_attribs,
&num_attribs))
@@ -1242,8 +1266,8 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, 
_EGLConfig *conf,
  assert(dri2_dp

[Mesa-dev] [PATCH 13/15] radeon: remove duplicate 'const' specifier

2017-04-11 Thread Samuel Pitoiset
Fixes the following Clang warning.

In file included from radeon_debug.c:32:
./radeon_common_context.h:500:19: warning: duplicate 'const' declaration 
specifier [-Wduplicate-decl-specifier]
extern const char const *radeonVendorString;

Signed-off-by: Samuel Pitoiset 
---
 src/mesa/drivers/dri/radeon/radeon_common_context.c | 2 +-
 src/mesa/drivers/dri/radeon/radeon_common_context.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c 
b/src/mesa/drivers/dri/radeon/radeon_common_context.c
index d981ca24e5..2c12b62d82 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common_context.c
+++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c
@@ -70,7 +70,7 @@ static const char* get_chip_family_name(int chip_family)
}
 }
 
-const char const *radeonVendorString = "Mesa Project";
+const char *radeonVendorString = "Mesa Project";
 
 /* Return complete renderer string.
  */
diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.h 
b/src/mesa/drivers/dri/radeon/radeon_common_context.h
index d142a871b4..a85bedf31f 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common_context.h
+++ b/src/mesa/drivers/dri/radeon/radeon_common_context.h
@@ -497,7 +497,7 @@ static inline __DRIdrawable* 
radeon_get_readable(radeonContextPtr radeon)
return radeon->driContext->driReadablePriv;
 }
 
-extern const char const *radeonVendorString;
+extern const char *radeonVendorString;
 
 const char *radeonGetRendererString(radeonScreenPtr radeonScreen);
 
-- 
2.12.2

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


[Mesa-dev] [PATCH 14/15] st/mesa: fix wrong comparison in update_framebuffer_state()

2017-04-11 Thread Samuel Pitoiset
state_tracker/st_atom_framebuffer.c:208:27: warning: comparison of constant 
4294967295 with expression of type 'uint16_t' (aka 'unsigned short') is always 
false [-Wtautological-constant-out-of-range-compare]
   if (framebuffer->width == UINT_MAX)
   ~~ ^  
state_tracker/st_atom_framebuffer.c:210:28: warning: comparison of constant 
4294967295 with expression of type 'uint16_t' (aka 'unsigned short') is always 
false [-Wtautological-constant-out-of-range-compare]
   if (framebuffer->height == UINT_MAX)
   ~~~ ^  
2 warnings generated.

Fixes: eb0fd0e5f86 ("gallium: decrease the size of pipe_framebuffer_state - 96 
-> 80 bytes")
Signed-off-by: Samuel Pitoiset 
---
 src/mesa/state_tracker/st_atom_framebuffer.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom_framebuffer.c 
b/src/mesa/state_tracker/st_atom_framebuffer.c
index ea41d9dcd7..7435c00a4f 100644
--- a/src/mesa/state_tracker/st_atom_framebuffer.c
+++ b/src/mesa/state_tracker/st_atom_framebuffer.c
@@ -59,8 +59,8 @@ update_framebuffer_size(struct pipe_framebuffer_state 
*framebuffer,
 struct pipe_surface *surface)
 {
assert(surface);
-   assert(surface->width  < UINT_MAX);
-   assert(surface->height < UINT_MAX);
+   assert(surface->width  < USHRT_MAX);
+   assert(surface->height < USHRT_MAX);
framebuffer->width  = MIN2(framebuffer->width,  surface->width);
framebuffer->height = MIN2(framebuffer->height, surface->height);
 }
@@ -205,9 +205,9 @@ update_framebuffer_state( struct st_context *st )
}
 #endif
 
-   if (framebuffer->width == UINT_MAX)
+   if (framebuffer->width == USHRT_MAX)
   framebuffer->width = 0;
-   if (framebuffer->height == UINT_MAX)
+   if (framebuffer->height == USHRT_MAX)
   framebuffer->height = 0;
 
cso_set_framebuffer(st->cso_context, framebuffer);
-- 
2.12.2

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


[Mesa-dev] [PATCH 11/15] llvmpipe: remove unused subpixel_snap() and fixed_to_float()

2017-04-11 Thread Samuel Pitoiset
Fixes the following Clang warnings.

lp_setup_tri.c:55:1: warning: unused function 'subpixel_snap' 
[-Wunused-function]
subpixel_snap(float a)
^
lp_setup_tri.c:61:1: warning: unused function 'fixed_to_float' 
[-Wunused-function]
fixed_to_float(int a)
^

Signed-off-by: Samuel Pitoiset 
---
 src/gallium/drivers/llvmpipe/lp_setup_tri.c | 12 
 1 file changed, 12 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c 
b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
index 98243a12de..cc1508ccc2 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
@@ -51,18 +51,6 @@
 #include "util/u_pwr8.h"
 #endif
 
-static inline int
-subpixel_snap(float a)
-{
-   return util_iround(FIXED_ONE * a);
-}
-
-static inline float
-fixed_to_float(int a)
-{
-   return a * (1.0f / FIXED_ONE);
-}
-
 
 /* Position and area in fixed point coordinates */
 struct fixed_position {
-- 
2.12.2

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


[Mesa-dev] [PATCH 05/15] draw: remove unused overflow()

2017-04-11 Thread Samuel Pitoiset
Fixes the following Clang warning.

draw/draw_pipe_vbuf.c:102:1: warning: unused function 'overflow' 
[-Wunused-function]
overflow( void *map, void *ptr, unsigned bytes, unsigned bufsz )
^
1 warning generated.

Signed-off-by: Samuel Pitoiset 
---
 src/gallium/auxiliary/draw/draw_pipe_vbuf.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_pipe_vbuf.c 
b/src/gallium/auxiliary/draw/draw_pipe_vbuf.c
index 6df7149b53..f26063d1fe 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_vbuf.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_vbuf.c
@@ -98,14 +98,6 @@ static void vbuf_flush_vertices( struct vbuf_stage *vbuf );
 static void vbuf_alloc_vertices( struct vbuf_stage *vbuf );
 
 
-static inline boolean 
-overflow( void *map, void *ptr, unsigned bytes, unsigned bufsz )
-{
-   unsigned long used = (unsigned long) ((char *)ptr - (char *)map);
-   return (used + bytes) > bufsz;
-}
-
-
 static inline void 
 check_space( struct vbuf_stage *vbuf, unsigned nr )
 {
-- 
2.12.2

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


[Mesa-dev] [PATCH 15/15] i965: add missing ir_unop_*/ir_binop_* in visit_leave()

2017-04-11 Thread Samuel Pitoiset
Fixes the following Clang warnings.

brw_fs_channel_expressions.cpp:219:12: warning: enumeration values 
'ir_unop_ballot', 'ir_unop_read_first_invocation', and 
'ir_binop_read_invocation' not handled in switch [-Wswitch]
   switch (expr->operation) {
   ^
1 warning generated.

Signed-off-by: Samuel Pitoiset 
---
 src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp 
b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
index 76dbc06535..58fa207880 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
@@ -470,6 +470,9 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment 
*ir)
case ir_unop_vote_eq:
case ir_unop_unpack_int_2x32:
case ir_unop_unpack_uint_2x32:
+   case ir_unop_ballot:
+   case ir_unop_read_first_invocation:
+   case ir_binop_read_invocation:
   unreachable("unsupported");
}
 
-- 
2.12.2

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


[Mesa-dev] [PATCH 12/15] svga: remove unused vmw_dri1_intersect_src_bbox()

2017-04-11 Thread Samuel Pitoiset
Fixes the following Clang warning.

vmw_screen_dri.c:130:1: warning: unused function 'vmw_dri1_intersect_src_bbox' 
[-Wunused-function]
vmw_dri1_intersect_src_bbox(struct drm_clip_rect *dst,
^
1 warning generated.

Signed-off-by: Samuel Pitoiset 
---
 src/gallium/winsys/svga/drm/vmw_screen_dri.c | 32 
 1 file changed, 32 deletions(-)

diff --git a/src/gallium/winsys/svga/drm/vmw_screen_dri.c 
b/src/gallium/winsys/svga/drm/vmw_screen_dri.c
index eae678a635..2a0ac7b333 100644
--- a/src/gallium/winsys/svga/drm/vmw_screen_dri.c
+++ b/src/gallium/winsys/svga/drm/vmw_screen_dri.c
@@ -126,38 +126,6 @@ out_no_vws:
return NULL;
 }
 
-static inline boolean
-vmw_dri1_intersect_src_bbox(struct drm_clip_rect *dst,
-   int dst_x,
-   int dst_y,
-   const struct drm_clip_rect *src,
-   const struct drm_clip_rect *bbox)
-{
-   int xy1;
-   int xy2;
-
-   xy1 = ((int)src->x1 > (int)bbox->x1 + dst_x) ? src->x1 :
-  (int)bbox->x1 + dst_x;
-   xy2 = ((int)src->x2 < (int)bbox->x2 + dst_x) ? src->x2 :
-  (int)bbox->x2 + dst_x;
-   if (xy1 >= xy2 || xy1 < 0)
-  return FALSE;
-
-   dst->x1 = xy1;
-   dst->x2 = xy2;
-
-   xy1 = ((int)src->y1 > (int)bbox->y1 + dst_y) ? src->y1 :
-  (int)bbox->y1 + dst_y;
-   xy2 = ((int)src->y2 < (int)bbox->y2 + dst_y) ? src->y2 :
-  (int)bbox->y2 + dst_y;
-   if (xy1 >= xy2 || xy1 < 0)
-  return FALSE;
-
-   dst->y1 = xy1;
-   dst->y2 = xy2;
-   return TRUE;
-}
-
 /**
  * vmw_drm_gb_surface_from_handle - Create a shared surface
  *
-- 
2.12.2

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


[Mesa-dev] [PATCH 10/15] softpipe: remove unused sp_exec_fragment_shader()

2017-04-11 Thread Samuel Pitoiset
Fixes the following Clang warning.

sp_fs_exec.c:56:1: warning: unused function 'sp_exec_fragment_shader' 
[-Wunused-function]
sp_exec_fragment_shader(const struct sp_fragment_shader_variant *var)
^
1 warning generated.

Signed-off-by: Samuel Pitoiset 
---
 src/gallium/drivers/softpipe/sp_fs_exec.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_fs_exec.c 
b/src/gallium/drivers/softpipe/sp_fs_exec.c
index f1662bffdb..cb22850496 100644
--- a/src/gallium/drivers/softpipe/sp_fs_exec.c
+++ b/src/gallium/drivers/softpipe/sp_fs_exec.c
@@ -51,14 +51,6 @@ struct sp_exec_fragment_shader
 };
 
 
-/** cast wrapper */
-static inline struct sp_exec_fragment_shader *
-sp_exec_fragment_shader(const struct sp_fragment_shader_variant *var)
-{
-   return (struct sp_exec_fragment_shader *) var;
-}
-
-
 static void
 exec_prepare( const struct sp_fragment_shader_variant *var,
   struct tgsi_exec_machine *machine,
-- 
2.12.2

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


[Mesa-dev] [PATCH 07/15] trace: remove some unused trace_dump_tag*() functions

2017-04-11 Thread Samuel Pitoiset
Fixes the following Clang warnings.

tr_dump.c:137:1: warning: unused function 'trace_dump_tag' [-Wunused-function]
trace_dump_tag(const char *name)
^
tr_dump.c:168:1: warning: unused function 'trace_dump_tag_begin2' 
[-Wunused-function]
trace_dump_tag_begin2(const char *name,
^
tr_dump.c:187:1: warning: unused function 'trace_dump_tag_begin3' 
[-Wunused-function]
trace_dump_tag_begin3(const char *name,
^
  CC   tr_texture.lo
3 warnings generated.

Signed-off-by: Samuel Pitoiset 
---
 src/gallium/drivers/trace/tr_dump.c | 52 -
 1 file changed, 52 deletions(-)

diff --git a/src/gallium/drivers/trace/tr_dump.c 
b/src/gallium/drivers/trace/tr_dump.c
index 9d03b16a34..78c72492dc 100644
--- a/src/gallium/drivers/trace/tr_dump.c
+++ b/src/gallium/drivers/trace/tr_dump.c
@@ -134,15 +134,6 @@ trace_dump_newline(void)
 
 
 static inline void
-trace_dump_tag(const char *name)
-{
-   trace_dump_writes("<");
-   trace_dump_writes(name);
-   trace_dump_writes("/>");
-}
-
-
-static inline void
 trace_dump_tag_begin(const char *name)
 {
trace_dump_writes("<");
@@ -165,49 +156,6 @@ trace_dump_tag_begin1(const char *name,
 
 
 static inline void
-trace_dump_tag_begin2(const char *name,
-  const char *attr1, const char *value1,
-  const char *attr2, const char *value2)
-{
-   trace_dump_writes("<");
-   trace_dump_writes(name);
-   trace_dump_writes(" ");
-   trace_dump_writes(attr1);
-   trace_dump_writes("=\'");
-   trace_dump_escape(value1);
-   trace_dump_writes("\' ");
-   trace_dump_writes(attr2);
-   trace_dump_writes("=\'");
-   trace_dump_escape(value2);
-   trace_dump_writes("\'>");
-}
-
-
-static inline void
-trace_dump_tag_begin3(const char *name,
-  const char *attr1, const char *value1,
-  const char *attr2, const char *value2,
-  const char *attr3, const char *value3)
-{
-   trace_dump_writes("<");
-   trace_dump_writes(name);
-   trace_dump_writes(" ");
-   trace_dump_writes(attr1);
-   trace_dump_writes("=\'");
-   trace_dump_escape(value1);
-   trace_dump_writes("\' ");
-   trace_dump_writes(attr2);
-   trace_dump_writes("=\'");
-   trace_dump_escape(value2);
-   trace_dump_writes("\' ");
-   trace_dump_writes(attr3);
-   trace_dump_writes("=\'");
-   trace_dump_escape(value3);
-   trace_dump_writes("\'>");
-}
-
-
-static inline void
 trace_dump_tag_end(const char *name)
 {
trace_dump_writes("https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 08/15] softpipe: remove unused get_texel_quad_2d()

2017-04-11 Thread Samuel Pitoiset
Fixes the following Clang warning.

sp_tex_sample.c:802:1: warning: unused function 'get_texel_quad_2d' 
[-Wunused-function]
get_texel_quad_2d(const struct sp_sampler_view *sp_sview,
^
  CC   sp_tile_cache.lo
1 warning generated.

Signed-off-by: Samuel Pitoiset 
---
 src/gallium/drivers/softpipe/sp_tex_sample.c | 17 -
 1 file changed, 17 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c 
b/src/gallium/drivers/softpipe/sp_tex_sample.c
index 3a8ad2eef4..92c78da86f 100644
--- a/src/gallium/drivers/softpipe/sp_tex_sample.c
+++ b/src/gallium/drivers/softpipe/sp_tex_sample.c
@@ -796,23 +796,6 @@ get_texel_quad_2d_no_border(const struct sp_sampler_view 
*sp_sview,
out[3] = get_texel_2d_no_border( sp_sview, addr, x1, y1 );
 }
 
-/* Can involve a lot of unnecessary checks for border color:
- */
-static inline void
-get_texel_quad_2d(const struct sp_sampler_view *sp_sview,
-  const struct sp_sampler *sp_samp,
-  union tex_tile_address addr,
-  int x0, int y0,
-  int x1, int y1,
-  const float *out[4])
-{
-   out[0] = get_texel_2d( sp_sview, sp_samp, addr, x0, y0 );
-   out[1] = get_texel_2d( sp_sview, sp_samp, addr, x1, y0 );
-   out[3] = get_texel_2d( sp_sview, sp_samp, addr, x1, y1 );
-   out[2] = get_texel_2d( sp_sview, sp_samp, addr, x0, y1 );
-}
-
-
 
 /* 3d variants:
  */
-- 
2.12.2

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


[Mesa-dev] [PATCH 09/15] softpipe: remove unused quad_shade_stage()

2017-04-11 Thread Samuel Pitoiset
Fixes the following Clang warning.

sp_quad_fs.c:60:1: warning: unused function 'quad_shade_stage' 
[-Wunused-function]
quad_shade_stage(struct quad_stage *qs)
^
1 warning generated.

Signed-off-by: Samuel Pitoiset 
---
 src/gallium/drivers/softpipe/sp_quad_fs.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_quad_fs.c 
b/src/gallium/drivers/softpipe/sp_quad_fs.c
index 8fb632d9dc..26e7434edc 100644
--- a/src/gallium/drivers/softpipe/sp_quad_fs.c
+++ b/src/gallium/drivers/softpipe/sp_quad_fs.c
@@ -55,14 +55,6 @@ struct quad_shade_stage
 };
 
 
-/** cast wrapper */
-static inline struct quad_shade_stage *
-quad_shade_stage(struct quad_stage *qs)
-{
-   return (struct quad_shade_stage *) qs;
-}
-
-
 /**
  * Execute fragment shader for the four fragments in the quad.
  * \return TRUE if quad is alive, FALSE if all four pixels are killed
-- 
2.12.2

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


[Mesa-dev] [PATCH 01/15] virgl: add missing PIPE_CAP_DOUBLES

2017-04-11 Thread Samuel Pitoiset
Fixes the following Clang warning.

virgl_screen.c:60:12: warning: enumeration value 'PIPE_CAP_DOUBLES' not handled 
in switch [-Wswitch]
   switch (param) {
   ^
1 warning generated.

Signed-off-by: Samuel Pitoiset 
---
 src/gallium/drivers/virgl/virgl_screen.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gallium/drivers/virgl/virgl_screen.c 
b/src/gallium/drivers/virgl/virgl_screen.c
index 8e0117c989..7cd61b3759 100644
--- a/src/gallium/drivers/virgl/virgl_screen.c
+++ b/src/gallium/drivers/virgl/virgl_screen.c
@@ -260,6 +260,7 @@ virgl_get_param(struct pipe_screen *screen, enum pipe_cap 
param)
case PIPE_CAP_POLYGON_MODE_FILL_RECTANGLE:
case PIPE_CAP_SPARSE_BUFFER_PAGE_SIZE:
case PIPE_CAP_TGSI_BALLOT:
+   case PIPE_CAP_DOUBLES:
   return 0;
case PIPE_CAP_VENDOR_ID:
   return 0x1af4;
-- 
2.12.2

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


[Mesa-dev] [PATCH 04/15] mesa: remove some unused functions in the perf monitor area

2017-04-11 Thread Samuel Pitoiset
Fixes the following Clang warnings.

main/performance_monitor.c:157:1: warning: unused function 'index_to_queryid' 
[-Wunused-function]
index_to_queryid(GLuint index)
^
main/performance_monitor.c:163:1: warning: unused function 'queryid_valid' 
[-Wunused-function]
queryid_valid(const struct gl_context *ctx, GLuint queryid)
^
main/performance_monitor.c:169:1: warning: unused function 'counterid_to_index' 
[-Wunused-function]
counterid_to_index(GLuint counterid)
^
3 warnings generated.

Signed-off-by: Samuel Pitoiset 
---
 src/mesa/main/performance_monitor.c | 27 ---
 1 file changed, 27 deletions(-)

diff --git a/src/mesa/main/performance_monitor.c 
b/src/mesa/main/performance_monitor.c
index a4a2f9e597..65ea8437fd 100644
--- a/src/mesa/main/performance_monitor.c
+++ b/src/mesa/main/performance_monitor.c
@@ -144,33 +144,6 @@ get_counter(const struct gl_perf_monitor_group *group_obj, 
GLuint id)
return &group_obj->Counters[id];
 }
 
-/* For INTEL_performance_query, query id 0 is reserved to be invalid. We use
- * index to Groups array + 1 as the query id. Same applies to counter id.
- */
-static inline GLuint
-queryid_to_index(GLuint queryid)
-{
-   return queryid - 1;
-}
-
-static inline GLuint
-index_to_queryid(GLuint index)
-{
-   return index + 1;
-}
-
-static inline bool
-queryid_valid(const struct gl_context *ctx, GLuint queryid)
-{
-   return get_group(ctx, queryid_to_index(queryid)) != NULL;
-}
-
-static inline GLuint
-counterid_to_index(GLuint counterid)
-{
-   return counterid - 1;
-}
-
 /*/
 
 void GLAPIENTRY
-- 
2.12.2

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


[Mesa-dev] [PATCH 06/15] draw: remove unused wideline_stage()

2017-04-11 Thread Samuel Pitoiset
Fixes the following Clang warning.

draw/draw_pipe_wide_line.c:48:38: warning: unused function 'wideline_stage' 
[-Wunused-function]
static inline struct wideline_stage *wideline_stage( struct draw_stage *stage )
 ^
1 warning generated.

Signed-off-by: Samuel Pitoiset 
---
 src/gallium/auxiliary/draw/draw_pipe_wide_line.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_pipe_wide_line.c 
b/src/gallium/auxiliary/draw/draw_pipe_wide_line.c
index ae4a00eb63..4232a4a17c 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_wide_line.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_wide_line.c
@@ -44,14 +44,6 @@ struct wideline_stage {
 };
 
 
-
-static inline struct wideline_stage *wideline_stage( struct draw_stage *stage )
-{
-   return (struct wideline_stage *)stage;
-}
-
-
-
 /**
  * Draw a wide line by drawing a quad (two triangles).
  */
-- 
2.12.2

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


[Mesa-dev] [PATCH 03/15] mesa: remove unused clamp_float_to_uint() and clamp_half_to_uint()

2017-04-11 Thread Samuel Pitoiset
Fixes the following Clang warnings.

main/pack.c:470:1: warning: unused function 'clamp_float_to_uint' 
[-Wunused-function]
clamp_float_to_uint(GLfloat f)
^
main/pack.c:477:1: warning: unused function 'clamp_half_to_uint' 
[-Wunused-function]
clamp_half_to_uint(GLhalfARB h)
^
2 warnings generated.

Signed-off-by: Samuel Pitoiset 
---
 src/mesa/main/pack.c | 15 ---
 1 file changed, 15 deletions(-)

diff --git a/src/mesa/main/pack.c b/src/mesa/main/pack.c
index 89faf51544..760c46afe7 100644
--- a/src/mesa/main/pack.c
+++ b/src/mesa/main/pack.c
@@ -466,21 +466,6 @@ extract_uint_indexes(GLuint n, GLuint indexes[],
 }
 
 
-static inline GLuint
-clamp_float_to_uint(GLfloat f)
-{
-   return f < 0.0F ? 0 : _mesa_lroundevenf(f);
-}
-
-
-static inline GLuint
-clamp_half_to_uint(GLhalfARB h)
-{
-   GLfloat f = _mesa_half_to_float(h);
-   return f < 0.0F ? 0 : _mesa_lroundevenf(f);
-}
-
-
 /*
  * Unpack a row of stencil data from a client buffer according to
  * the pixel unpacking parameters.
-- 
2.12.2

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


[Mesa-dev] [PATCH 02/15] mesa: remove unused _mesa_unmarshal_BindBufferBase()

2017-04-11 Thread Samuel Pitoiset
Fixes the following Clang warning.

main/marshal.c:209:1: warning: unused function '_mesa_unmarshal_BindBufferBase' 
[-Wunused-function]
_mesa_unmarshal_BindBufferBase(struct gl_context *ctx, const struct 
marshal_cmd_BindBufferBase *cmd)
^
1 warning generated.

Signed-off-by: Samuel Pitoiset 
---
 src/mesa/main/marshal.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/src/mesa/main/marshal.c b/src/mesa/main/marshal.c
index ae32d257e9..ae4efb5ecb 100644
--- a/src/mesa/main/marshal.c
+++ b/src/mesa/main/marshal.c
@@ -205,14 +205,6 @@ struct marshal_cmd_BindBufferBase
GLuint index;
GLuint buffer;
 };
-static inline void
-_mesa_unmarshal_BindBufferBase(struct gl_context *ctx, const struct 
marshal_cmd_BindBufferBase *cmd)
-{
-   const GLenum target = cmd->target;
-   const GLuint index = cmd->index;
-   const GLuint buffer = cmd->buffer;
-   CALL_BindBufferBase(ctx->CurrentServerDispatch, (target, index, buffer));
-}
 
 /** Tracks the current bindings for the vertex array and index array buffers.
  *
-- 
2.12.2

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


[Mesa-dev] [PATCH 00/15] Clang compiler warning fixes

2017-04-11 Thread Samuel Pitoiset
Noticed while building my whole ARB_bindless_texture work to avoid
missing switch cases, etc. This series doesn't fix all warnings, just
the easy ones.

Please, review!
Thanks.

Samuel Pitoiset (15):
  virgl: add missing PIPE_CAP_DOUBLES
  mesa: remove unused _mesa_unmarshal_BindBufferBase()
  mesa: remove unused clamp_float_to_uint() and clamp_half_to_uint()
  mesa: remove some unused functions in the perf monitor area
  draw: remove unused overflow()
  draw: remove unused wideline_stage()
  trace: remove some unused trace_dump_tag*() functions
  softpipe: remove unused get_texel_quad_2d()
  softpipe: remove unused quad_shade_stage()
  softpipe: remove unused sp_exec_fragment_shader()
  llvmpipe: remove unused subpixel_snap() and fixed_to_float()
  svga: remove unused vmw_dri1_intersect_src_bbox()
  radeon: remove duplicate 'const' specifier
  st/mesa: fix wrong comparison in update_framebuffer_state()
  i965: add missing ir_unop_*/ir_binop_* in visit_leave()

 src/gallium/auxiliary/draw/draw_pipe_vbuf.c|  8 
 src/gallium/auxiliary/draw/draw_pipe_wide_line.c   |  8 
 src/gallium/drivers/llvmpipe/lp_setup_tri.c| 12 -
 src/gallium/drivers/softpipe/sp_fs_exec.c  |  8 
 src/gallium/drivers/softpipe/sp_quad_fs.c  |  8 
 src/gallium/drivers/softpipe/sp_tex_sample.c   | 17 ---
 src/gallium/drivers/trace/tr_dump.c| 52 --
 src/gallium/drivers/virgl/virgl_screen.c   |  1 +
 src/gallium/winsys/svga/drm/vmw_screen_dri.c   | 32 -
 .../dri/i965/brw_fs_channel_expressions.cpp|  3 ++
 .../drivers/dri/radeon/radeon_common_context.c |  2 +-
 .../drivers/dri/radeon/radeon_common_context.h |  2 +-
 src/mesa/main/marshal.c|  8 
 src/mesa/main/pack.c   | 15 ---
 src/mesa/main/performance_monitor.c| 27 ---
 src/mesa/state_tracker/st_atom_framebuffer.c   |  8 ++--
 16 files changed, 10 insertions(+), 201 deletions(-)

-- 
2.12.2

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


[Mesa-dev] [PATCH] anv: Limit VkDeviceMemory objects to 2GB

2017-04-11 Thread Jason Ekstrand
Cc: "Juan A. Suárez" 
---
 src/intel/vulkan/anv_device.c | 17 +
 1 file changed, 17 insertions(+)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 35ef4c4..b24c739 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -1539,6 +1539,23 @@ VkResult anv_AllocateMemory(
assert(pAllocateInfo->memoryTypeIndex == 0 ||
   (!device->info.has_llc && pAllocateInfo->memoryTypeIndex < 2));
 
+   /* The kernel relocation API has a limitation of a 32-bit delta value
+* applied to the address before it is written which, in spite of it being
+* unsigned, is treated as signed .  Because of the way that this maps to
+* the Vulkan API, we cannot handle an offset into a buffer that does not
+* fit into a signed 31 bits.  The only mechanism we have for dealing with
+* this at the moment is to limit all VkDeviceMemory objects to a maximum
+* of 2GB each.  The Vulkan spec allows us to do this:
+*
+*"Some platforms may have a limit on the maximum size of a single
+*allocation. For example, certain systems may fail to create
+*allocations with a size greater than or equal to 4GB. Such a limit is
+*implementation-dependent, and if such a failure occurs then the error
+*VK_ERROR_OUT_OF_DEVICE_MEMORY should be returned."
+*/
+   if (pAllocationInfo->allocationSize > (1ull << 31))
+  return VK_ERROR_OUT_OF_HOST_MEMORY;
+
/* FINISHME: Fail if allocation request exceeds heap size. */
 
mem = vk_alloc2(&device->alloc, pAllocator, sizeof(*mem), 8,
-- 
2.5.0.400.gff86faf

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


  1   2   >