Mesa (master): drirc: Allow extension midshader for Metro Redux

2018-08-09 Thread GitLab Mirror
Module: Mesa
Branch: master
Commit: e0de26eacc93f431962533f50d57e58335843d6b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e0de26eacc93f431962533f50d57e58335843d6b

Author: vadym.shovkoplias 
Date:   Mon Aug  6 15:52:13 2018 +0300

drirc: Allow extension midshader for Metro Redux

This fixes both Metro 2033 Redux and Metro Last Light Redux

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99730
Signed-off-by: Eero Tamminen 
Signed-off-by: Vadym Shovkoplias 
Reviewed-by: Tapani Pälli 

---

 src/util/drirc | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/util/drirc b/src/util/drirc
index 8ece875e34..c4f9e060f3 100644
--- a/src/util/drirc
+++ b/src/util/drirc
@@ -120,6 +120,10 @@ TODO: document the other workarounds.
 
 
 
+
+
+
+
 
 
 

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


Mesa (master): intel/tools: add missing variable initialisation

2018-08-09 Thread GitLab Mirror
Module: Mesa
Branch: master
Commit: aac80f75973b61a8a31f873a9de6bcf294ea493c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=aac80f75973b61a8a31f873a9de6bcf294ea493c

Author: Eric Engestrom 
Date:   Wed Aug  8 15:26:32 2018 +0100

intel/tools: add missing variable initialisation

Fixes: 6a60beba4089315685b8 "intel/tools: Add an error state to aub translator"
Signed-off-by: Eric Engestrom 
Reviewed-by: Lionel Landwerlin 

---

 src/intel/tools/error2aub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/intel/tools/error2aub.c b/src/intel/tools/error2aub.c
index 3407dcec0b..2030593691 100644
--- a/src/intel/tools/error2aub.c
+++ b/src/intel/tools/error2aub.c
@@ -205,7 +205,7 @@ main(int argc, char *argv[])
   BO_TYPE_UNKNOWN = 0,
   BO_TYPE_BATCH,
   BO_TYPE_USER,
-   } bo_type;
+   } bo_type = BO_TYPE_UNKNOWN;
uint64_t bo_addr;
 
char *line = NULL;

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


Mesa (master): anv: set error in all failure paths

2018-08-09 Thread GitLab Mirror
Module: Mesa
Branch: master
Commit: fcf259ef97fef9d52e7f82ef90fb2383438743b3
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=fcf259ef97fef9d52e7f82ef90fb2383438743b3

Author: Eric Engestrom 
Date:   Wed Aug  8 15:42:49 2018 +0100

anv: set error in all failure paths

Cc: Jason Ekstrand 
Fixes: 5b196f39bddc689742d3 "anv/pipeline: Compile to NIR in compile_graphics"
Signed-off-by: Eric Engestrom 
Reviewed-by: Tapani Pälli 
Reviewed-by: Lionel Landwerlin 

---

 src/intel/vulkan/anv_pipeline.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
index 23af0f1c92..4074c8fd36 100644
--- a/src/intel/vulkan/anv_pipeline.c
+++ b/src/intel/vulkan/anv_pipeline.c
@@ -979,8 +979,10 @@ anv_pipeline_compile_graphics(struct anv_pipeline 
*pipeline,
[s],
[s].prog_data.base,
[s].bind_map);
-  if (stages[s].nir == NULL)
+  if (stages[s].nir == NULL) {
+ result = vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
  goto fail;
+  }
}
 
/* Walk backwards to link */

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


Mesa (master): glsl: handle error case with ast_post_inc, ast_post_dec

2018-08-09 Thread GitLab Mirror
Module: Mesa
Branch: master
Commit: 03a5acec687454c7fe227b4bdd2db97d515f1af7
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=03a5acec687454c7fe227b4bdd2db97d515f1af7

Author: Tapani Pälli 
Date:   Tue Aug  7 08:20:29 2018 +0300

glsl: handle error case with ast_post_inc, ast_post_dec

Return ir_rvalue::error_value with ast_post_inc, ast_post_dec if
parser error was emitted previously. This way process_array_size
won't see bogus IR generated like with commit 9c676a64273.

Signed-off-by: Tapani Pälli 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98699
Reviewed-by: Iago Toral Quiroga 

---

 src/compiler/glsl/ast_to_hir.cpp | 5 +
 1 file changed, 5 insertions(+)

diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index 74160ec142..5d3f10b682 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -1928,6 +1928,11 @@ ast_expression::do_hir(exec_list *instructions,
 
   error_emitted = op[0]->type->is_error() || op[1]->type->is_error();
 
+  if (error_emitted) {
+ result = ir_rvalue::error_value(ctx);
+ break;
+  }
+
   type = arithmetic_result_type(op[0], op[1], false, state, & loc);
 
   ir_rvalue *temp_rhs;

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


Mesa (staging/18.1): wayland/egl: initialize window surface size to window size

2018-08-09 Thread GitLab Mirror
Module: Mesa
Branch: staging/18.1
Commit: 4395919bd95501a13ba2fffa0cd00de0f73e0d38
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4395919bd95501a13ba2fffa0cd00de0f73e0d38

Author: Juan A. Suarez Romero 
Date:   Mon Jun  4 10:22:49 2018 +

wayland/egl: initialize window surface size to window size

When creating a windows surface with eglCreateWindowSurface(), the
width and height returned by eglQuerySurface(EGL_{WIDTH,HEIGHT}) is
invalid until buffers are updated (like calling glClear()).

But according to EGL 1.5 spec, section 3.5.6 ("Surface Attributes"):

  "Querying EGL_WIDTH and EGL_HEIGHT returns respectively the width and
   height, in pixels, of the surface. For a window or pixmap surface,
   these values are initially equal to the width and height of the
   native window or pixmap with respect to which the surface was
   created"

This fixes dEQP-EGL.functional.color_clears.* CTS tests

v2:
- Do not modify attached_{width,height} (Daniel)
- Do not update size on resizing window (Brendan)

CC: Daniel Stone 
CC: Brendan King 
CC: mesa-sta...@lists.freedesktop.org
Tested-by: Eric Engestrom 
Tested-by: Chad Versace 
Reviewed-by: Chad Versace 
Reviewed-by: Daniel Stone 
(cherry picked from commit 1fe7cbdf05b90034577dac4e4aa6157031d80521)
Conflicts resolved by Dylan

Conflicts:
src/egl/drivers/dri2/platform_wayland.c

---

 src/egl/drivers/dri2/platform_wayland.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/egl/drivers/dri2/platform_wayland.c 
b/src/egl/drivers/dri2/platform_wayland.c
index cb5314f3db..8b6975f5fb 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -260,6 +260,10 @@ dri2_wl_create_window_surface(_EGLDriver *drv, _EGLDisplay 
*disp,
 
config = dri2_get_dri_config(dri2_conf, EGL_WINDOW_BIT,
 dri2_surf->base.GLColorspace);
+
+   dri2_surf->base.Width = window->width;
+   dri2_surf->base.Height = window->height;
+
visual_idx = dri2_wl_visual_idx_from_config(dri2_dpy, config);
assert(visual_idx != -1);
 

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


Mesa (staging/18.1): drirc: Allow extension midshader for Metro Redux

2018-08-09 Thread GitLab Mirror
Module: Mesa
Branch: staging/18.1
Commit: 894fdbf05820880d5b54729028db1a9fac9e4c6c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=894fdbf05820880d5b54729028db1a9fac9e4c6c

Author: vadym.shovkoplias 
Date:   Mon Aug  6 15:52:13 2018 +0300

drirc: Allow extension midshader for Metro Redux

This fixes both Metro 2033 Redux and Metro Last Light Redux

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99730
Signed-off-by: Eero Tamminen 
Signed-off-by: Vadym Shovkoplias 
Reviewed-by: Tapani Pälli 
(cherry picked from commit e0de26eacc93f431962533f50d57e58335843d6b)

---

 src/util/drirc | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/util/drirc b/src/util/drirc
index c76f1ca438..edf14396e1 100644
--- a/src/util/drirc
+++ b/src/util/drirc
@@ -120,6 +120,10 @@ TODO: document the other workarounds.
 
 
 
+
+
+
+
 
 
 

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


Mesa (master): glx: GLX_MESA_multithread_makecurrent is direct-only

2018-08-09 Thread GitLab Mirror
Module: Mesa
Branch: master
Commit: 63a6b719d98fb1ad58ae93c2de859e6d4bfa8b8b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=63a6b719d98fb1ad58ae93c2de859e6d4bfa8b8b

Author: Adam Jackson 
Date:   Tue Dec  5 11:10:09 2017 -0500

glx: GLX_MESA_multithread_makecurrent is direct-only

This extension is not defined for indirect contexts. Marking it as
"client only", as the old code did here, would make the extension
available in indirect contexts, even though the server would certainly
not have it in its extension list.

Cc: 
Signed-off-by: Adam Jackson 
Reviewed-by: Nicolai Hähnle 
Reviewed-by: Emil Velikov 

---

 src/glx/glxextensions.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/glx/glxextensions.c b/src/glx/glxextensions.c
index a575862670..e85a8c9284 100644
--- a/src/glx/glxextensions.c
+++ b/src/glx/glxextensions.c
@@ -152,7 +152,7 @@ static const struct extension_info known_glx_extensions[] = 
{
{ GLX(ATI_pixel_format_float),  VER(0,0), N, N, N, N },
{ GLX(INTEL_swap_event),VER(0,0), Y, N, N, N },
{ GLX(MESA_copy_sub_buffer),VER(0,0), Y, N, N, N },
-   { GLX(MESA_multithread_makecurrent),VER(0,0), Y, N, Y, N },
+   { GLX(MESA_multithread_makecurrent),VER(0,0), Y, N, N, Y },
{ GLX(MESA_query_renderer), VER(0,0), Y, N, N, Y },
{ GLX(MESA_swap_control),   VER(0,0), Y, N, N, Y },
{ GLX(NV_float_buffer), VER(0,0), N, N, N, N },

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


Mesa (staging/18.1): wayland/egl: update surface size on window resize

2018-08-09 Thread GitLab Mirror
Module: Mesa
Branch: staging/18.1
Commit: 6cffbd963f812d782faa8e81a750235430328415
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6cffbd963f812d782faa8e81a750235430328415

Author: Juan A. Suarez Romero 
Date:   Wed Jun  6 10:13:05 2018 +

wayland/egl: update surface size on window resize

According to EGL 1.5 spec, section 3.10.1.1 ("Native Window Resizing"):

  "If the native window corresponding to _surface_ has been resized
   prior to the swap, _surface_ must be resized to match. _surface_ will
   normally be resized by the EGL implementation at the time the native
   window is resized. If the implementation cannot do this transparently
   to the client, then *eglSwapBuffers* must detect the change and
   resize surface prior to copying its pixels to the native window."

So far, resizing a native window in Wayland/EGL was interpreted in Mesa
as a request to resize, which is not executed until the first draw call.
And hence, surface size is not updated until executing it. Thus,
querying the surface size with eglQuerySurface() after a window resize
still returns the old values.

This commit updates the surface size values as soon as the resize is
done, even when the real resize is done in the draw call. This makes the
semantics that any native window resize request take effect inmediately,
and if user calls eglQuerySurface() it will return the new resized
values.

v2: update surface size if there isn't a back surface (Daniel)

CC: Daniel Stone 
CC: mesa-sta...@lists.freedesktop.org
Reviewed-by: Daniel Stone 
(cherry picked from commit a9fb331ea7d1a78936ea8d8385e44cfd66f835c1)

---

 src/egl/drivers/dri2/platform_wayland.c | 19 +++
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_wayland.c 
b/src/egl/drivers/dri2/platform_wayland.c
index 80853ac00b..cb5314f3db 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -198,6 +198,17 @@ resize_callback(struct wl_egl_window *wl_win, void *data)
struct dri2_egl_display *dri2_dpy =
   dri2_egl_display(dri2_surf->base.Resource.Display);
 
+   /* Update the surface size as soon as native window is resized; from user
+* pov, this makes the effect that resize is done inmediately after native
+* window resize, without requiring to wait until the first draw.
+*
+* A more detailed and lengthy explanation can be found at
+* https://lists.freedesktop.org/archives/mesa-dev/2018-June/196474.html
+*/
+   if (!dri2_surf->back) {
+  dri2_surf->base.Width = wl_win->width;
+  dri2_surf->base.Height = wl_win->height;
+   }
dri2_dpy->flush->invalidate(dri2_surf->dri_drawable);
 }
 
@@ -568,8 +579,8 @@ update_buffers(struct dri2_egl_surface *dri2_surf)
struct dri2_egl_display *dri2_dpy =
   dri2_egl_display(dri2_surf->base.Resource.Display);
 
-   if (dri2_surf->base.Width != dri2_surf->wl_win->width ||
-   dri2_surf->base.Height != dri2_surf->wl_win->height) {
+   if (dri2_surf->base.Width != dri2_surf->wl_win->attached_width ||
+   dri2_surf->base.Height != dri2_surf->wl_win->attached_height) {
 
   dri2_wl_release_buffers(dri2_surf);
 
@@ -1623,8 +1634,8 @@ swrast_update_buffers(struct dri2_egl_surface *dri2_surf)
if (dri2_surf->back)
   return 0;
 
-   if (dri2_surf->base.Width != dri2_surf->wl_win->width ||
-   dri2_surf->base.Height != dri2_surf->wl_win->height) {
+   if (dri2_surf->base.Width != dri2_surf->wl_win->attached_width ||
+   dri2_surf->base.Height != dri2_surf->wl_win->attached_height) {
 
   dri2_wl_release_buffers(dri2_surf);
 

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


Mesa (master): python: Use key-functions when sorting containers

2018-08-09 Thread GitLab Mirror
Module: Mesa
Branch: master
Commit: 8d3ff6244c7cc5a8399afcf0d1d98d7fd8148452
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8d3ff6244c7cc5a8399afcf0d1d98d7fd8148452

Author: Mathieu Bridon 
Date:   Thu Aug  9 10:27:23 2018 +0200

python: Use key-functions when sorting containers

In Python 2, the traditional way to sort containers was to use a
comparison function (which returned either -1, 0 or 1 when passed two
objects) and pass that as the "cmp" argument to the container's sort()
method.

Python 2.4 introduced key-functions, which instead only operate on a
given item, and return a sorting key for this item.

In general, this runs faster, because the cmp-function has to get run
multiple times for each item of the container.

Python 3 removed the cmp-function, enforcing usage of key-functions
instead.

This change makes the script compatible with Python 2 and Python 3.

Signed-off-by: Mathieu Bridon 
Reviewed-by: Eric Engestrom 
Reviewed-by: Dylan Baker 

---

 src/mapi/mapi_abi.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/mapi/mapi_abi.py b/src/mapi/mapi_abi.py
index e4ce2b6caf..d4c48ec430 100644
--- a/src/mapi/mapi_abi.py
+++ b/src/mapi/mapi_abi.py
@@ -32,6 +32,7 @@ import os
 GLAPI = os.path.join(".", os.path.dirname(sys.argv[0]), "glapi/gen")
 sys.path.append(GLAPI)
 
+from operator import attrgetter
 import re
 from optparse import OptionParser
 import gl_XML
@@ -291,7 +292,7 @@ class ABIPrinter(object):
 
 # sort entries by their names
 self.entries_sorted_by_names = self.entries[:]
-self.entries_sorted_by_names.sort(lambda x, y: cmp(x.name, y.name))
+self.entries_sorted_by_names.sort(key=attrgetter('name'))
 
 self.indent = ' ' * 3
 self.noop_warn = 'noop_warn'
@@ -441,7 +442,7 @@ class ABIPrinter(object):
 """Return the string pool for use by stubs."""
 # sort entries by their names
 sorted_entries = self.entries[:]
-sorted_entries.sort(lambda x, y: cmp(x.name, y.name))
+sorted_entries.sort(key=attrgetter('name'))
 
 pool = []
 offsets = {}

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


Mesa (master): python: Explicitly use a list

2018-08-09 Thread GitLab Mirror
Module: Mesa
Branch: master
Commit: c644b2d7a7602e929b92dd2c52ed2765928e02b1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c644b2d7a7602e929b92dd2c52ed2765928e02b1

Author: Mathieu Bridon 
Date:   Thu Aug  9 10:27:20 2018 +0200

python: Explicitly use a list

On Python 2, the builtin functions filter() returns a list.

On Python 3, it returns an iterator.

Since we want to use those objects in contexts where we need lists, we
need to explicitly turn them into lists.

This makes the code compatible with both Python 2 and Python 3.

Signed-off-by: Mathieu Bridon 
Reviewed-by: Dylan Baker 

---

 src/mesa/main/get_hash_generator.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/get_hash_generator.py 
b/src/mesa/main/get_hash_generator.py
index facdccd8a5..37dae45e0b 100644
--- a/src/mesa/main/get_hash_generator.py
+++ b/src/mesa/main/get_hash_generator.py
@@ -117,8 +117,8 @@ def print_tables(tables):
 def merge_tables(tables):
merged_tables = []
for api, indices in sorted(tables.items()):
-  matching_table = filter(lambda mt:mt["indices"] == indices,
-  merged_tables)
+  matching_table = list(filter(lambda mt:mt["indices"] == indices,
+  merged_tables))
   if matching_table:
  matching_table[0]["apis"].append(api)
   else:

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


Mesa (master): python: Simplify list sorting

2018-08-09 Thread GitLab Mirror
Module: Mesa
Branch: master
Commit: 08fe9b3e3a5bd18db39daa56ecae3fc1a0708ff5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=08fe9b3e3a5bd18db39daa56ecae3fc1a0708ff5

Author: Mathieu Bridon 
Date:   Thu Aug  9 10:27:24 2018 +0200

python: Simplify list sorting

Instead of copying the list, then sorting the copy in-place, we can just
get a new sorted copy directly.

Signed-off-by: Mathieu Bridon 
Reviewed-by: Eric Engestrom 
Reviewed-by: Dylan Baker 

---

 src/mapi/mapi_abi.py | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/mapi/mapi_abi.py b/src/mapi/mapi_abi.py
index d4c48ec430..dc48fa5935 100644
--- a/src/mapi/mapi_abi.py
+++ b/src/mapi/mapi_abi.py
@@ -291,8 +291,7 @@ class ABIPrinter(object):
 self.entries = entries
 
 # sort entries by their names
-self.entries_sorted_by_names = self.entries[:]
-self.entries_sorted_by_names.sort(key=attrgetter('name'))
+self.entries_sorted_by_names = sorted(self.entries, 
key=attrgetter('name'))
 
 self.indent = ' ' * 3
 self.noop_warn = 'noop_warn'
@@ -441,8 +440,7 @@ class ABIPrinter(object):
 def c_stub_string_pool(self):
 """Return the string pool for use by stubs."""
 # sort entries by their names
-sorted_entries = self.entries[:]
-sorted_entries.sort(key=attrgetter('name'))
+sorted_entries = sorted(self.entries, key=attrgetter('name'))
 
 pool = []
 offsets = {}

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


Mesa (master): python: Better check for integer types

2018-08-09 Thread GitLab Mirror
Module: Mesa
Branch: master
Commit: 1e668ca111563b122b16be5506638983b31205b5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1e668ca111563b122b16be5506638983b31205b5

Author: Mathieu Bridon 
Date:   Thu Aug  9 10:27:22 2018 +0200

python: Better check for integer types

Python 3 lost the long type: now everything is an int, with the right
size.

This commit makes the script compatible with Python 2 (where we check
for both int and long) and Python 3 (where we only check for int).

Signed-off-by: Mathieu Bridon 
Reviewed-by: Eric Engestrom 
Reviewed-by: Dylan Baker 

---

 src/compiler/nir/nir_algebraic.py   |  8 +---
 src/gallium/auxiliary/util/u_format_pack.py | 13 +++--
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/src/compiler/nir/nir_algebraic.py 
b/src/compiler/nir/nir_algebraic.py
index 5baeea88af..3055937029 100644
--- a/src/compiler/nir/nir_algebraic.py
+++ b/src/compiler/nir/nir_algebraic.py
@@ -36,9 +36,11 @@ import traceback
 from nir_opcodes import opcodes
 
 if sys.version_info < (3, 0):
+integer_types = (int, long)
 string_type = unicode
 
 else:
+integer_types = (int, )
 string_type = str
 
 _type_re = re.compile(r"(?Pint|uint|bool|float)?(?P\d+)?")
@@ -81,7 +83,7 @@ class Value(object):
  return val
   elif isinstance(val, string_type):
  return Variable(val, name_base, varset)
-  elif isinstance(val, (bool, int, long, float)):
+  elif isinstance(val, (bool, float) + integer_types):
  return Constant(val, name_base)
 
__template = mako.template.Template("""
@@ -145,7 +147,7 @@ class Constant(Value):
def hex(self):
   if isinstance(self.value, (bool)):
  return 'NIR_TRUE' if self.value else 'NIR_FALSE'
-  if isinstance(self.value, (int, long)):
+  if isinstance(self.value, integer_types):
  return hex(self.value)
   elif isinstance(self.value, float):
  i = struct.unpack('Q', struct.pack('d', self.value))[0]
@@ -164,7 +166,7 @@ class Constant(Value):
def type(self):
   if isinstance(self.value, (bool)):
  return "nir_type_bool32"
-  elif isinstance(self.value, (int, long)):
+  elif isinstance(self.value, integer_types):
  return "nir_type_int"
   elif isinstance(self.value, float):
  return "nir_type_float"
diff --git a/src/gallium/auxiliary/util/u_format_pack.py 
b/src/gallium/auxiliary/util/u_format_pack.py
index ad2e49281f..c1307d30c2 100644
--- a/src/gallium/auxiliary/util/u_format_pack.py
+++ b/src/gallium/auxiliary/util/u_format_pack.py
@@ -38,9 +38,18 @@
 
 from __future__ import division, print_function
 
+import sys
+
 from u_format_parse import *
 
 
+if sys.version_info < (3, 0):
+integer_types = (int, long)
+
+else:
+integer_types = (int, )
+
+
 def inv_swizzles(swizzles):
 '''Return an array[4] of inverse swizzle terms'''
 '''Only pick the first matching value to avoid l8 getting blue and i8 
getting alpha'''
@@ -212,7 +221,7 @@ def truncate_mantissa(x, bits):
 '''Truncate an integer so it can be represented exactly with a floating
 point mantissa'''
 
-assert isinstance(x, (int, long))
+assert isinstance(x, integer_types)
 
 s = 1
 if x < 0:
@@ -236,7 +245,7 @@ def value_to_native(type, value):
 '''Get the value of unity for this type.'''
 if type.type == FLOAT:
 if type.size <= 32 \
-and isinstance(value, (int, long)):
+and isinstance(value, integer_types):
 return truncate_mantissa(value, 23)
 return value
 if type.type == FIXED:

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


Mesa (master): python: Use the right function for the job

2018-08-09 Thread GitLab Mirror
Module: Mesa
Branch: master
Commit: d9ca4a172e8e8a42217588ca1b83a7ceb5bf3f76
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d9ca4a172e8e8a42217588ca1b83a7ceb5bf3f76

Author: Mathieu Bridon 
Date:   Thu Aug  9 10:27:19 2018 +0200

python: Use the right function for the job

The code was just reimplementing itertools.combinations_with_replacement
in a less efficient way.

This does change the order of the results slightly, but it should be ok.

Signed-off-by: Mathieu Bridon 
Reviewed-by: Dylan Baker 

---

 src/compiler/nir/nir_opt_algebraic.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/compiler/nir/nir_opt_algebraic.py 
b/src/compiler/nir/nir_opt_algebraic.py
index ac53d77383..e770a61d9f 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -723,7 +723,7 @@ optimizations = [
 
 invert = OrderedDict([('feq', 'fne'), ('fne', 'feq'), ('fge', 'flt'), ('flt', 
'fge')])
 
-for left, right in list(itertools.combinations(invert.keys(), 2)) + 
zip(invert.keys(), invert.keys()):
+for left, right in itertools.combinations_with_replacement(invert.keys(), 2):
optimizations.append((('inot', ('ior(is_used_once)', (left, a, b), (right, 
c, d))),
  ('iand', (invert[left], a, b), (invert[right], c, 
d
optimizations.append((('inot', ('iand(is_used_once)', (left, a, b), (right, 
c, d))),

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


Mesa (master): python: Do not mix bytes and unicode strings

2018-08-09 Thread GitLab Mirror
Module: Mesa
Branch: master
Commit: 14f1ab998fcdcd8fec43c3da8ef03af4af2d3966
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=14f1ab998fcdcd8fec43c3da8ef03af4af2d3966

Author: Mathieu Bridon 
Date:   Thu Aug  9 10:27:21 2018 +0200

python: Do not mix bytes and unicode strings

Mixing the two is a long-standing recipe for errors in Python 2, so much
so that Python 3 now completely separates them.

This commit stops treating both as if they were the same, and in the
process makes the script compatible with both Python 2 and 3.

Signed-off-by: Mathieu Bridon 
Reviewed-by: Eric Engestrom 
Reviewed-by: Dylan Baker 

---

 src/compiler/nir/nir_algebraic.py | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/compiler/nir/nir_algebraic.py 
b/src/compiler/nir/nir_algebraic.py
index a84c41a78f..5baeea88af 100644
--- a/src/compiler/nir/nir_algebraic.py
+++ b/src/compiler/nir/nir_algebraic.py
@@ -35,6 +35,12 @@ import traceback
 
 from nir_opcodes import opcodes
 
+if sys.version_info < (3, 0):
+string_type = unicode
+
+else:
+string_type = str
+
 _type_re = re.compile(r"(?Pint|uint|bool|float)?(?P\d+)?")
 
 def type_bits(type_str):
@@ -66,11 +72,14 @@ class VarSet(object):
 class Value(object):
@staticmethod
def create(val, name_base, varset):
+  if isinstance(val, bytes):
+ val = val.decode('utf-8')
+
   if isinstance(val, tuple):
  return Expression(val, name_base, varset)
   elif isinstance(val, Expression):
  return val
-  elif isinstance(val, (str, unicode)):
+  elif isinstance(val, string_type):
  return Variable(val, name_base, varset)
   elif isinstance(val, (bool, int, long, float)):
  return Constant(val, name_base)

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


Mesa (master): i965: Only enable depth IZ signals if there's an actual depthbuffer.

2018-08-09 Thread GitLab Mirror
Module: Mesa
Branch: master
Commit: 11b9f63a7403225c75de07a658a71063bde99ac9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=11b9f63a7403225c75de07a658a71063bde99ac9

Author: Kenneth Graunke 
Date:   Thu Aug  2 11:31:27 2018 -0700

i965: Only enable depth IZ signals if there's an actual depthbuffer.

According to the G45 PRM Volume 2 Page 265 we're supposed to only set
these signals when there is an actual depth buffer.  Note that we
already do this for the stencil buffer by virtue of brw->stencil_enabled
invoking _mesa_is_stencil_enabled(ctx) which checks whether the current
drawbuffer's visual has stencil bits (which is updated based on what
buffers are bound).  We just need to do it for depth as well.

Not observed to fix anything.

Reviewed-by: Jason Ekstrand 

---

 src/mesa/drivers/dri/i965/brw_wm.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_wm.c 
b/src/mesa/drivers/dri/i965/brw_wm.c
index 70fe38..db632ed15e 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.c
+++ b/src/mesa/drivers/dri/i965/brw_wm.c
@@ -35,6 +35,7 @@
 #include "program/program.h"
 #include "intel_mipmap_tree.h"
 #include "intel_image.h"
+#include "intel_fbo.h"
 #include "compiler/brw_nir.h"
 #include "brw_program.h"
 
@@ -456,6 +457,9 @@ brw_wm_populate_key(struct brw_context *brw, struct 
brw_wm_prog_key *key)
/* Build the index for table lookup
 */
if (devinfo->gen < 6) {
+  struct intel_renderbuffer *depth_irb =
+ intel_get_renderbuffer(ctx->DrawBuffer, BUFFER_DEPTH);
+
   /* _NEW_COLOR */
   if (prog->info.fs.uses_discard || ctx->Color.AlphaEnabled) {
  lookup |= BRW_WM_IZ_PS_KILL_ALPHATEST_BIT;
@@ -466,11 +470,12 @@ brw_wm_populate_key(struct brw_context *brw, struct 
brw_wm_prog_key *key)
   }
 
   /* _NEW_DEPTH */
-  if (ctx->Depth.Test)
+  if (depth_irb && ctx->Depth.Test) {
  lookup |= BRW_WM_IZ_DEPTH_TEST_ENABLE_BIT;
 
-  if (brw_depth_writes_enabled(brw))
- lookup |= BRW_WM_IZ_DEPTH_WRITE_ENABLE_BIT;
+ if (brw_depth_writes_enabled(brw))
+lookup |= BRW_WM_IZ_DEPTH_WRITE_ENABLE_BIT;
+  }
 
   /* _NEW_STENCIL | _NEW_BUFFERS */
   if (brw->stencil_enabled) {

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


Mesa (master): intel: Fix SIMD16 unaligned payload GRF reads on Gen4-5.

2018-08-09 Thread GitLab Mirror
Module: Mesa
Branch: master
Commit: 08a5c395abdafd0d7556060596f78c238b4a989f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=08a5c395abdafd0d7556060596f78c238b4a989f

Author: Kenneth Graunke 
Date:   Thu Aug  2 15:02:18 2018 -0700

intel: Fix SIMD16 unaligned payload GRF reads on Gen4-5.

When the SIMD16 Gen4-5 fragment shader payload contains source depth
(g2-3), destination stencil (g4), and destination depth (g5-6), the
single register of stencil makes the destination depth unaligned.

We were generating this instruction in the RT write payload setup:

   mov(16)   m14<1>F   g5<8,8,1>F   { align1 compr };

which is illegal, instructions with a source region spanning more than
one register need to be aligned to even registers.  This is because the
hardware implicitly does (nr | 1) instead of (nr + 1) when splitting the
compressed instruction into two mov(8)'s.

I believe this would cause the hardware to load g5 twice, replicating
subspan 0-1's destination depth to subspan 2-3.  This showed up as 2x2
artifact blocks in both TIS-100 and Reicast.

Normally, we rely on the register allocator to even-align our virtual
GRFs.  But we don't control the payload, so we need to lower SIMD widths
to make it work.  To fix this, we teach lower_simd_width about the
restriction, and then call it again after lower_load_payload (which is
what generates the offending MOV).

Fixes: 8aee87fe4cce0a883867df3546db0e0a36908086 (i965: Use SIMD16 instead of 
SIMD8 on Gen4 when possible.)
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107212
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=13728
Reviewed-by: Jason Ekstrand 
Tested-by: Diego Viola 

---

 src/intel/compiler/brw_fs.cpp | 20 
 1 file changed, 20 insertions(+)

diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp
index 20b89035e1..5b87991652 100644
--- a/src/intel/compiler/brw_fs.cpp
+++ b/src/intel/compiler/brw_fs.cpp
@@ -5115,6 +5115,25 @@ get_fpu_lowered_simd_width(const struct gen_device_info 
*devinfo,
   }
}
 
+   if (devinfo->gen < 6) {
+  /* From the G45 PRM, Volume 4 Page 361:
+   *
+   *"Operand Alignment Rule: With the exceptions listed below, a
+   * source/destination operand in general should be aligned to even
+   * 256-bit physical register with a region size equal to two 256-bit
+   * physical registers."
+   *
+   * Normally we enforce this by allocating virtual registers to the
+   * even-aligned class.  But we need to handle payload registers.
+   */
+  for (unsigned i = 0; i < inst->sources; i++) {
+ if (inst->src[i].file == FIXED_GRF && (inst->src[i].nr & 1) &&
+ inst->size_read(i) > REG_SIZE) {
+max_width = MIN2(max_width, 8);
+ }
+  }
+   }
+
/* From the IVB PRMs:
 *  "When an instruction is SIMD32, the low 16 bits of the execution mask
 *   are applied for both halves of the SIMD32 instruction. If different
@@ -6321,6 +6340,7 @@ fs_visitor::optimize()
if (OPT(lower_load_payload)) {
   split_virtual_grfs();
   OPT(register_coalesce);
+  OPT(lower_simd_width);
   OPT(compute_to_mrf);
   OPT(dead_code_eliminate);
}

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


Mesa (master): egl: Fix leak of X11 pixmaps backing pbuffers in DRI3.

2018-08-09 Thread GitLab Mirror
Module: Mesa
Branch: master
Commit: b618d7ea59a4d7da9823e02ac5608a67fd99b332
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b618d7ea59a4d7da9823e02ac5608a67fd99b332

Author: Eric Anholt 
Date:   Tue Aug  7 11:37:28 2018 -0700

egl: Fix leak of X11 pixmaps backing pbuffers in DRI3.

This is basically copied from the DRI2 destroy path.  Without this,
Raspberry Pi would quickly run out of CMA during the EGL tests in the CTS
due to all the pixmaps laying around.

Fixes: f35198badeb9 ("egl/x11: Implement dri3 support with loader's dri3 
helper")
Reviewed-by: Emil Velikov 
Reviewed-by: Eric Engestrom 

---

 src/egl/drivers/dri2/platform_x11_dri3.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/src/egl/drivers/dri2/platform_x11_dri3.c 
b/src/egl/drivers/dri2/platform_x11_dri3.c
index c3c9c2dd45..e1967422f0 100644
--- a/src/egl/drivers/dri2/platform_x11_dri3.c
+++ b/src/egl/drivers/dri2/platform_x11_dri3.c
@@ -107,12 +107,17 @@ static const struct loader_dri3_vtable egl_dri3_vtable = {
 static EGLBoolean
 dri3_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
 {
+   struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri3_egl_surface *dri3_surf = dri3_egl_surface(surf);
+   xcb_drawable_t drawable = dri3_surf->loader_drawable.drawable;
 
(void) drv;
 
loader_dri3_drawable_fini(_surf->loader_drawable);
 
+   if (surf->Type == EGL_PBUFFER_BIT)
+  xcb_free_pixmap (dri2_dpy->conn, drawable);
+
dri2_fini_surface(surf);
free(surf);
 

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