mesa.git
5 years agomesa/util: add missing va_end() after va_copy()
Andrii Simiklit [Thu, 6 Sep 2018 14:43:54 +0000 (17:43 +0300)]
mesa/util: add missing va_end() after va_copy()

MSDN:
"va_end must be called on each argument list that's initialized
 with va_start or va_copy before the function returns."

Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107810
Fixes: c6267ebd6c8a "gallium/util: Stop bundling our snprintf implementation."
Signed-off-by: Andrii Simiklit <andrii.simiklit@globallogic.com>
5 years agomesa/util: don't ignore NULL returned from 'malloc'
Andrii Simiklit [Thu, 6 Sep 2018 14:43:53 +0000 (17:43 +0300)]
mesa/util: don't ignore NULL returned from 'malloc'

We should exit from the function 'util_vasprintf'
with error code -1 for case where 'malloc'
returns NULL

Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Fixes: 864148d69e1e "util: add util_vasprintf() for Windows (v2)"
Signed-off-by: Andrii Simiklit <andrii.simiklit@globallogic.com>
5 years agomesa/util: don't use the same 'va_list' instance twice
Andrii Simiklit [Thu, 6 Sep 2018 14:43:52 +0000 (17:43 +0300)]
mesa/util: don't use the same 'va_list' instance twice

The first usage of the 'va_list' instance could change it.

Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Fixes: 864148d69e1e "util: add util_vasprintf() for Windows (v2)"
Signed-off-by: Andrii Simiklit <andrii.simiklit@globallogic.com>
5 years agoapple/glx/log: added missing va_end() after va_copy()
Andrii Simiklit [Thu, 6 Sep 2018 14:43:51 +0000 (17:43 +0300)]
apple/glx/log: added missing va_end() after va_copy()

Each invocation of va_copy() must be matched by a
corresponding invocation of va_end()

Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Fixes: 51691f0767f6 "darwin: Use ASL for logging"
Signed-off-by: Andrii Simiklit <andrii.simiklit@globallogic.com>
5 years agomeson: drop unnecessary llvm version hacks
Eric Engestrom [Thu, 6 Sep 2018 14:39:07 +0000 (15:39 +0100)]
meson: drop unnecessary llvm version hacks

The current minimum meson version supported is 0.44.1, so we have met
both the 0.43 and 0.44 requirement to not need these hacks anymore :)

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
5 years agomesa: add missing return statement for GL_RG_SNORM case
Danylo Piliaiev [Thu, 6 Sep 2018 14:01:07 +0000 (17:01 +0300)]
mesa: add missing return statement for GL_RG_SNORM case

Fixes: 0d356cf4781bece0dc9a7 "mesa: enable EXT_render_snorm extension"
Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
5 years agomeson: consolidate langs lists
Eric Engestrom [Tue, 28 Aug 2018 16:16:48 +0000 (17:16 +0100)]
meson: consolidate langs lists

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
5 years agointel/compiler: remove unused get_image_base_type()
Eric Engestrom [Mon, 3 Sep 2018 17:07:45 +0000 (18:07 +0100)]
intel/compiler: remove unused get_image_base_type()

Unused since 09f1de97a76a4990fd7c "anv,i965: Lower away image derefs in
the driver".

Cc: Jason Ekstrand <jason.ekstrand@intel.com>
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agotnl: Fix green gun regression in xonotic.
Mathias Fröhlich [Fri, 10 Aug 2018 09:37:43 +0000 (11:37 +0200)]
tnl: Fix green gun regression in xonotic.

Fix an other regression of
mesa: Make gl_vertex_array contain pointers to first order VAO members.
The regression showed up with drivers using the tnl module and
was reproducible using xonotic-glx -benchmark demos/the-big-keybench.dem.

Fixes: 64d2a204805
    mesa: Make gl_vertex_array contain pointers to first order VAO members.
Tested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
5 years agoRevert "i965/tools: 32bit compilation with meson"
Lionel Landwerlin [Thu, 6 Sep 2018 11:25:07 +0000 (12:25 +0100)]
Revert "i965/tools: 32bit compilation with meson"

This reverts commit 4aec44c0d9c4c0649c362199fac97efe0a3b38a4.

Unfortunately this patch needed a another one to be committed first.

5 years agoi965/tools: 32bit compilation with meson
Sergii Romantsov [Thu, 6 Sep 2018 09:59:47 +0000 (12:59 +0300)]
i965/tools: 32bit compilation with meson

Building of 32bit mesa with meson causes issue:
"implicit declaration of function ‘__builtin_ia32_clflush’".
Fixed by adding msse2 compilation flag.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107843
Fixes: 314879f7fec0 (i965: Fix asynchronous mappings on !LLC platforms.)
Signed-off-by: Sergii Romantsov <sergii.romantsov@globallogic.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agoglsl: fixer lexer for unreachable defines
Timothy Arceri [Sat, 1 Sep 2018 13:57:38 +0000 (23:57 +1000)]
glsl: fixer lexer for unreachable defines

If we have something like:

   #ifdef NOT_DEFINED
   #define A_MACRO(x) \
if (x)
   #endif

The # on the #define is not skipped but the define itself is so
this then gets recognised as #if.

Until 28a3731e3f this didn't happen because we ended up in
<HASH>{NONSPACE} where BEGIN INITIAL was called stopping the
problem from happening.

This change makes sure we never call RETURN_TOKEN_NEVER_SKIP for
if/else/endif when processing a define.

Cc: Ian Romanick <idr@freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107772
Tested-By: Eero Tamminen <eero.t.tamminen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
5 years agofreedreno/ir3: insert mov if same instruction in the outputs.
Hyunjun Ko [Thu, 30 Aug 2018 02:58:54 +0000 (11:58 +0900)]
freedreno/ir3: insert mov if same instruction in the outputs.

For example,

    result0 = texture(sampler[indexBase + 5], coords);
    result1 = texture(sampler[indexBase + 0], coords);
    result2 = texture(sampler[indexBase + 0], coords);
    out_result0 = result0;
    out_result1 = result1;
    out_result2 = result2;

In this kind of case we need to insert an extra mov to the outputs
so that the result could be assigned to each register respectively.

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agofreedreno/ir3: make immediates array dynamic
Hyunjun Ko [Thu, 30 Aug 2018 02:58:53 +0000 (11:58 +0900)]
freedreno/ir3: make immediates array dynamic

Since most shaders wouldn't need that large array of immediates, making
the array dynamic could save unnecessary spaces.

In addition, sometimes we can potentially have a much larger array
of immediates to be lowered, which might be more than 64.

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agofreedreno: allocate ctx's batch on demand
Rob Clark [Mon, 3 Sep 2018 20:33:59 +0000 (16:33 -0400)]
freedreno: allocate ctx's batch on demand

Don't fall over when app wants more than 32 contexts.  Instead allocate
contexts on demand.

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agofreedreno: add fd_context_batch() accessor
Rob Clark [Mon, 3 Sep 2018 20:07:17 +0000 (16:07 -0400)]
freedreno: add fd_context_batch() accessor

For cases in which (after the following commit) ctx->batch may be null.
Prep work for following commit.

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agofreedreno/a6xx: fix mem2gmem for zsbuf
Rob Clark [Sun, 2 Sep 2018 17:24:12 +0000 (13:24 -0400)]
freedreno/a6xx: fix mem2gmem for zsbuf

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agofreedreno/batch: fix crash in !reorder case
Rob Clark [Wed, 29 Aug 2018 20:04:22 +0000 (16:04 -0400)]
freedreno/batch: fix crash in !reorder case

We aren't using the batch-cache if reorder==false.

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agofreedreno/ir3: better compile_error() printing
Rob Clark [Wed, 29 Aug 2018 19:31:13 +0000 (15:31 -0400)]
freedreno/ir3: better compile_error() printing

Try to show the error at the appropriate line of nir

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agofreedreno/a6xx: bordercolor fixes
Rob Clark [Wed, 22 Aug 2018 13:33:06 +0000 (09:33 -0400)]
freedreno/a6xx: bordercolor fixes

Port fixes from a5xx (f0715442)

TODO maybe this should move to shared code, since it seems to be the
same.

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agofreedreno: fix context teardown harder
Rob Clark [Wed, 22 Aug 2018 13:07:37 +0000 (09:07 -0400)]
freedreno: fix context teardown harder

The border_color_uploaders need to be torn down before the transfer_pool
is destroyed.

Fixes: e11e9d63943 freedreno: fix context teardown race
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agofreedreno/ir3: ignore unused inputs
Rob Clark [Tue, 21 Aug 2018 12:33:39 +0000 (08:33 -0400)]
freedreno/ir3: ignore unused inputs

We could end up w/ inputs larger than vec4, simply because unused inputs
are not split.

Fixes things like dEQP-GLES31.functional.separate_shader.random.77 (and
probably a handful of others)

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agofreedreno/a6xx: fix debug build crash
Rob Clark [Mon, 20 Aug 2018 14:55:37 +0000 (10:55 -0400)]
freedreno/a6xx: fix debug build crash

Porting 0c8d9e923aa9239e20f9bc969faf9caa0b85237f to a6xx.

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agomeson: Print a message about why a libdrm version was selected
Dylan Baker [Tue, 4 Sep 2018 21:42:07 +0000 (14:42 -0700)]
meson: Print a message about why a libdrm version was selected

We require a single version of libdrm for all of our libdrm
dependencies (core and driver), but the way this is structured can make
the error message less than helpful, as one driver might be the one
setting the libdrm requirement, while another might be the one that
generates the version failure.

This adds a simple message to the output announcing which libdrm module
set the version, which might be more helpful.

v2: - Use message suggested by Eric Engstrom

Fixes: c445b1d56f47922206de55e557444aadb62e11f6
       ("meson: Use the same version for all libdrm checks")
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
5 years agosvga: rename face to layer_face
Charmaine Lee [Fri, 5 May 2017 19:16:33 +0000 (12:16 -0700)]
svga: rename face to layer_face

Reviewed-by: Neha Bhende <bhenden@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
5 years agosvga: encode sample count in resource declarations
Brian Paul [Mon, 31 Jul 2017 12:40:12 +0000 (06:40 -0600)]
svga: encode sample count in resource declarations

No regressions before the corresponding host-side change.

Reviewed-by: Neha Bhende <bhenden@vmware.com>
5 years agosvga: sync with upstream changes to surface flags
Charmaine Lee [Thu, 1 Jun 2017 22:12:14 +0000 (15:12 -0700)]
svga: sync with upstream changes to surface flags

SVGA device now supports 64 bits surface flags. This patch
updates the winsys interface to allow 64 bits surface flags.
The linux winsys layer will for now only honor the lower 32 bits of
the surface flags.

Reviewed-by: Brian Paul <brianp@vmware.com>
5 years agosvga: avoid try_blit() for some depth formats on non vgpu10.
Neha Bhende [Wed, 10 May 2017 19:17:44 +0000 (12:17 -0700)]
svga: avoid try_blit() for some depth formats on non vgpu10.

On non vgpu10, driver doesn't support util_blitter_blit for SVGA3D_Z_D16,
SVGA3D_Z_D24x8, SVGA3D_Z_D24S8. Patch fixes following piglit tests regression on hwv8 caused
by commit 27bf35caea5e:
spec@arb_depth_texture@fbo-depth-gl-depth-component16-blit
spec@arb_depth_texture@fbo-depth-gl-depth-component24-blit
spec@arb_depth_texture@fbo-depth-gl-depth-component32-blit

Tested with mtt-piglit on hw 8,9,10,11,13 and mtt-glretrace on windows and linux.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
5 years agosvga: convert dst format to linear when blending is enabled.
Neha Bhende [Thu, 4 May 2017 18:25:04 +0000 (11:25 -0700)]
svga: convert dst format to linear when blending is enabled.

When blending is enabled, framebuffer colorspace has to be linear.
Previously, we never hit this case because we were not supporting sRGB
drawable. Previous patch added that support.

Tested with mtt glretrace, viewperf, piglit, conform.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
5 years agowinsys/svga: Avoid cap2 code path for now
Neha Bhende [Wed, 29 Mar 2017 17:35:12 +0000 (10:35 -0700)]
winsys/svga: Avoid cap2 code path for now

CAP2 functionality is not yet part of vmwgfx. This is causing unnecessary
dmesg error messages.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
5 years agosvga: start using SVGA3dCmdIntraSurfaceCopy command for svga_blit.
Neha Bhende [Mon, 6 Mar 2017 23:55:04 +0000 (15:55 -0800)]
svga: start using SVGA3dCmdIntraSurfaceCopy command for svga_blit.

Basically, SVGA3dCmdIntraSurfaceCopy command allow copying when
source and destination are same.

Tested with MTT piglit, glretrace, viewperf, conform

v2: changes as per Charmaine's comment
v3: changes as per Charmaine's comment

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
5 years agosvga/winsys: Add cap2 support in winsys
Neha Bhende [Mon, 6 Mar 2017 23:50:20 +0000 (15:50 -0800)]
svga/winsys: Add cap2 support in winsys

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
5 years agosvga: Add SVGA3dCmdIntraSurfaceCopy command support in OpenGL driver
Neha Bhende [Mon, 6 Mar 2017 23:53:58 +0000 (15:53 -0800)]
svga: Add SVGA3dCmdIntraSurfaceCopy command support in OpenGL driver

v2: changes as per Charmaine's comment

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
5 years agosvga: update device header files from upstream
Brian Paul [Wed, 5 Sep 2018 16:28:25 +0000 (10:28 -0600)]
svga: update device header files from upstream

This is a squash commit of several earlier patches.

Signed-off-by: Brian Paul <brianp@vmware.com>
5 years agowinsys/drm: Fix assert when try to accumulate an invalid fd
Charmaine Lee [Thu, 9 Aug 2018 23:22:52 +0000 (16:22 -0700)]
winsys/drm: Fix assert when try to accumulate an invalid fd

This patch makes sure there is a valid fd before merging it
to the context's fd in vmw_svga_winsys_fence_server_sync().

This fixes the assert running webot.
No regression running kmscube.

Reviewed-by: Sinclair Yeh <syeh@vmware.com>
5 years agoloader: Drop unused argument from dri3_update_drawable().
Eric Anholt [Thu, 30 Aug 2018 17:24:51 +0000 (10:24 -0700)]
loader: Drop unused argument from dri3_update_drawable().

The argument has never been used since the function was added.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
5 years agoi965/fs: include multisamplers on image_intrinsic_coord_components
Alejandro Piñeiro [Tue, 4 Sep 2018 11:02:57 +0000 (13:02 +0200)]
i965/fs: include multisamplers on image_intrinsic_coord_components

This is the second patch needed to fix the following piglit tests:

   tests/spec/arb_gl_spirv/linker/uniform/multisampler.shader_test
   tests/spec/arb_gl_spirv/linker/uniform/multisampler-array.shader_test

Although in this case it doesn't affect so many borrowed tests, as
there aren't too many tests using multisamplers on Intel.

It is worth to note that this patch is also needed when those tests
are run on GLSL mode (using the --glsl option). Although most Intel
drivers would not be able to run/execute tests using multisamplers, as
GL_MAX_IMAGE_SAMPLES is zero, technically those tests are expected to
link correctly, so linking tests should pass.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoi965: move brw_nir_lower_gl_images call
Alejandro Piñeiro [Wed, 5 Sep 2018 10:39:35 +0000 (12:39 +0200)]
i965: move brw_nir_lower_gl_images call

At this moment that lowering is using info coming from the
UniformStorage, so for the ARB_gl_spirv codepath, it needs to be done
after calling gl_nir_link_uniforms. As for the GLSL codepath it can
also be called later, we just move the call on both cases, to avoid
adding several shader->spirv_data checks, and keep the patch as small
as possible.

This is the first patch needed to fix the following piglit tests:

  tests/spec/arb_gl_spirv/linker/uniform/multisampler.shader_test
  tests/spec/arb_gl_spirv/linker/uniform/multisampler-array.shader_test

but fixes thousands of tests when borrowing the tests from other specs
(that needs to be done manually right now).

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agointel/compiler: rename brw_nir_lower_glsl_images
Alejandro Piñeiro [Wed, 5 Sep 2018 10:34:47 +0000 (12:34 +0200)]
intel/compiler: rename brw_nir_lower_glsl_images

To brw_nir_lower_gl_images, as it will be also used on the
ARB_gl_spirv codepath, that doesn't involves GLSL at all. So the
lowering is about images following the OpenGL semantics. In any case
"brw_nir_lower_opengl_images" seemed too long to me, so I just used
gl. That shortening is already used on other parts of the code.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agointel/compiler: remove unused variable num_images
Alejandro Piñeiro [Tue, 4 Sep 2018 10:43:07 +0000 (12:43 +0200)]
intel/compiler: remove unused variable num_images

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agowinsys/virgl/vtest: Correct off-by-one error in resource allocation
Gert Wollny [Tue, 4 Sep 2018 07:36:53 +0000 (09:36 +0200)]
winsys/virgl/vtest: Correct off-by-one error in resource allocation

The resource bo array must already extended when the target index is
equal to the current size of the array.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
5 years agowinsys/virgl: Initialize value to silence valgrind
Gert Wollny [Mon, 3 Sep 2018 08:14:07 +0000 (10:14 +0200)]
winsys/virgl: Initialize value to silence valgrind

Silences:

  Conditional jump or move depends on uninitialised value(s)
  at 0xB72F2C0: virgl_drm_winsys_create (virgl_drm_winsys.c:854)
  by 0xB72F2C0: virgl_drm_screen_create (virgl_drm_winsys.c:926)
  by 0xB21C885: pipe_virgl_create_screen (drm_helper.h:275)
  by 0xB7201F0: pipe_loader_create_screen (pipe_loader.c:137)
  by 0xB639C91: dri2_init_screen (dri2.c:2112)
  by 0xB634F68: driCreateNewScreen2 (dri_util.c:153)
  by 0x63023E6: dri3_create_screen (dri3_glx.c:893)
  by 0x62D35BD: AllocAndFetchScreenConfigs (glxext.c:820)
  by 0x62D35BD: __glXInitialize (glxext.c:946)
  by 0x62CECB3: GetGLXPrivScreenConfig (glxcmds.c:174)
  by 0x62CF69C: glXQueryExtensionsString (glxcmds.c:1304)
  by 0x60AA7D9: ??? (in /usr/lib/x86_64-linux-gnu/libwaffle-1.so.0.5.2)
  by 0x4F81450: wfl_checked_display_connect (piglit-util-waffle.h:74)
  by 0x4F829E0: piglit_wfl_framework_init (piglit_wfl_framework.c:627)

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
5 years agowinsys/virgl: correct resource and handle allocation (v2)
Gert Wollny [Mon, 3 Sep 2018 08:05:44 +0000 (10:05 +0200)]
winsys/virgl: correct resource and handle allocation (v2)

Fixes crash with
  piglit/bin/map_buffer_range-invalidate CopyBufferSubData \
                               increment-offset -auto -fbo

* Resize the resource storage already when the count is equal to the
  allocated size, fixes:

  Invalid write of size 8
  at 0xB72E4CF: virgl_drm_add_res (virgl_drm_winsys.c:629)
  by 0xB72E4CF: virgl_drm_emit_res (virgl_drm_winsys.c:663)
  by 0xB72A44A: virgl_encode_resource_copy_region (virgl_encode.c:776)
  by 0xB40CD12: st_copy_buffer_subdata (st_cb_bufferobjects.c:585)
  by 0xB244A3B: _mesa_CopyBufferSubData (bufferobj.c:2940)
  by 0x109A1E: upload (invalidate.c:169)
  by 0x109C2F: piglit_display (invalidate.c:215)
  by 0x4F80FBE: run_test (piglit_fbo_framework.c:52)
  by 0x4F66E5F: piglit_gl_test_run (piglit-framework-gl.c:229)
  by 0x10949D: main (invalidate.c:47)
  Address 0xbe07d30 is 0 bytes after a block of size 4,096 alloc'd
  at 0x4C31B25: calloc (in
       /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
  by 0xB72DAAF: virgl_drm_cmd_buf_create (virgl_drm_winsys.c:567)

* Also resize the space allocated for the handles, fixes:

  Invalid write of size 4
  at 0xB72E4F0: virgl_drm_add_res (virgl_drm_winsys.c:631)
  by 0xB72E4F0: virgl_drm_emit_res (virgl_drm_winsys.c:663)
  by 0xB72A44A: virgl_encode_resource_copy_region (virgl_encode.c:776)
  by 0xB40CD12: st_copy_buffer_subdata (st_cb_bufferobjects.c:585)
  by 0xB244A3B: _mesa_CopyBufferSubData (bufferobj.c:2940)
  by 0x109A1E: upload (invalidate.c:169)
  by 0x109C2F: piglit_display (invalidate.c:215)
  by 0x4F80FBE: run_test (piglit_fbo_framework.c:52)
  by 0x4F66E5F: piglit_gl_test_run (piglit-framework-gl.c:229)
  by 0x10949D: main (invalidate.c:47)
  Address 0xbe08570 is 0 bytes after a block of size 2,048 alloc'd
  at 0x4C2FB0F: malloc (
    in /usr/lib/valgrind/vgpreload_memcheck-amd64- linux.so)
  by 0xB72DAC8: virgl_drm_cmd_buf_create (virgl_drm_winsys.c:572)

Fixes: 4b15b5e803e ("virgl: resize resource bo allocation if we need to.")
v2: - Use REALLOC macro and avoid memory leak when re-allocation fails
    - add Fixes tag (both Emil Velikov)
    - reorder commit message

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
5 years agovirgl: use hw-atomics instead of in-ssbo ones
Tomeu Vizoso [Tue, 17 Jul 2018 11:13:21 +0000 (13:13 +0200)]
virgl: use hw-atomics instead of in-ssbo ones

Emulating atomics on top of ssbos can lead to too small max SSBO count,
so let's use the hw-atomics mechanism to expose atomic buffers instead.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
5 years agovirgl: update minor differences to upstream header
Erik Faye-Lund [Wed, 29 Aug 2018 07:07:26 +0000 (09:07 +0200)]
virgl: update minor differences to upstream header

virgl_protocol.h is considered to have it's upstream in the
virglrenderer repository, and somehow these minor differences has
crept in.

Let's sync with the upstream to avoid this.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
5 years agogallium: add PIPE_CAP_MAX_COMBINED_HW_ATOMIC_COUNTER{S,_BUFFERS}
Erik Faye-Lund [Wed, 29 Aug 2018 14:11:14 +0000 (16:11 +0200)]
gallium: add PIPE_CAP_MAX_COMBINED_HW_ATOMIC_COUNTER{S,_BUFFERS}

This moves the evergreen-specific max-sizes out as a driver-cap, so
other drivers with less strict requirements also can use hw-atomics.

Remove ssbo_atomic as it's no longer needed.

We should now be able to use hw-atomics for some stages and not for
other, if needed.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
5 years agogallium: add PIPE_CAP_MAX_COMBINED_SHADER_BUFFERS
Erik Faye-Lund [Thu, 30 Aug 2018 09:04:17 +0000 (11:04 +0200)]
gallium: add PIPE_CAP_MAX_COMBINED_SHADER_BUFFERS

This gets rid of a r600 specific hack in the state-tracker, and prepares
for other drivers to be able to use hw-atomics.

While we're at it, clean up some indentation in the various drivers.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
5 years agost/mesa: simplify MaxAtomicBufferSize-logic
Erik Faye-Lund [Wed, 29 Aug 2018 13:48:29 +0000 (15:48 +0200)]
st/mesa: simplify MaxAtomicBufferSize-logic

MaxAtomicCounters has already been assigned in the loop above in the
ssbo_atomic = true case, so this will calculate the same value as the
default.

While we're at it, fixup indentation on the MaxAtomicBufferBindings
assign.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
5 years agost/mesa: clean up atomic vs ssbo code
Erik Faye-Lund [Wed, 29 Aug 2018 13:35:11 +0000 (15:35 +0200)]
st/mesa: clean up atomic vs ssbo code

This makes the code a bit easier to follow; we first set up
MaxShaderStorageBlocks, then we either set up a dedicated
MaxAtomicBuffers, or we split MaxShaderStorageBlocks in two.

While we're at it, also make the SSBO-splitting code tolerate the
hypothetical case of having an odd number of SSBOs without incorrectly
dropping the last SSBO.

This has the nice result that the SSBOs and atomic buffers are dealt
with almost completely orthogonally, easing some upcoming patches.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
5 years agost/mesa: use real bool for can_ubo
Erik Faye-Lund [Wed, 29 Aug 2018 13:24:26 +0000 (15:24 +0200)]
st/mesa: use real bool for can_ubo

We're doing full c99 now, so there's no point in using the old boolean
type.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
5 years agogallium/u_threaded: increase batch size to increase performance
Marek Olšák [Sat, 1 Sep 2018 07:10:27 +0000 (03:10 -0400)]
gallium/u_threaded: increase batch size to increase performance

This reduces mutex overhead.

radeonsi: +4.4% performance with piglit/drawoverhead, DrawElements, Ryzen X1700
iris_dri.so: +14% with piglit/drawoverhead, DrawArrays, i7 7700HQ.

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agost/vdpau: silence an unitialized-variable warning
Marek Olšák [Mon, 20 Aug 2018 18:52:52 +0000 (14:52 -0400)]
st/vdpau: silence an unitialized-variable warning

5 years agost/mesa: help fix stencil border color for GL_DEPTH_STENCIL textures
Marek Olšák [Tue, 21 Aug 2018 01:33:24 +0000 (21:33 -0400)]
st/mesa: help fix stencil border color for GL_DEPTH_STENCIL textures

GL_STENCIL_INDEX uses GL_INTENSITY for the border color, which is nicer
to hardware that doesn't read the stencil border value from the X channel.

This fixes a bunch of dEQP tests on Vega & Raven.

Cc: 18.1 18.2 <mesa-stable@lists.freedesktop.org>
5 years agoglsl_to_tgsi: Fix potential leak
Ernestas Kulik [Thu, 30 Aug 2018 16:02:44 +0000 (19:02 +0300)]
glsl_to_tgsi: Fix potential leak

Reported by Coverity: arr_live_ranges is freed in a different branch
than the one in which it was allocated.

Signed-off-by: Ernestas Kulik <ernestas.kulik@gmail.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
5 years agou_vbuf: Fix leak
Ernestas Kulik [Thu, 30 Aug 2018 16:02:45 +0000 (19:02 +0300)]
u_vbuf: Fix leak

Reported by Coverity: data is heap-allocated, but only freed in the
info->index_size != 0 branch.

Signed-off-by: Ernestas Kulik <ernestas.kulik@gmail.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
Cc: 18.2 <mesa-stable@lists.freedesktop.org>
5 years agofreedreno: Drop a bunch of duplicated gallium PIPE_CAP default code.
Eric Anholt [Sat, 11 Aug 2018 01:15:45 +0000 (18:15 -0700)]
freedreno: Drop a bunch of duplicated gallium PIPE_CAP default code.

Now that we have the util function for the default values, we can get rid
of the boilerplate.

v2: Rebase on new gallium caps

Reviewed-by: Rob Clark <robdclark@gmail.com> (v1)
5 years agov3d: Drop a bunch of duplicated gallium PIPE_CAP default code.
Eric Anholt [Sat, 11 Aug 2018 01:04:40 +0000 (18:04 -0700)]
v3d: Drop a bunch of duplicated gallium PIPE_CAP default code.

Now that we have the util function for the default values, we can get rid
of the boilerplate.

v2: Rebase on new gallium caps

5 years agovc4: Drop a bunch of duplicated gallium PIPE_CAP default code.
Eric Anholt [Sat, 11 Aug 2018 01:02:02 +0000 (18:02 -0700)]
vc4: Drop a bunch of duplicated gallium PIPE_CAP default code.

Now that we have the util function for the default values, we can get rid
of the boilerplate.

v2: drop GLSL level in favor of defaults.
v3: Rebase on new gallium caps

5 years agogallium: Add a helper for implementing PIPE_CAP_* default values.
Eric Anholt [Fri, 10 Aug 2018 23:57:31 +0000 (16:57 -0700)]
gallium: Add a helper for implementing PIPE_CAP_* default values.

One of the pains of implementing a gallium driver is filling in a million
pipe caps you don't know about yet when you're just starting out.  One of
the pains of working on gallium is copy-and-pasting your new PIPE_CAP into
each driver.  We can fix both of these by having each driver call into the
default helper from their default case, so that both sides can ignore each
other until they need to.

v2: fix i915g build, revert swr change to avoid breaking scons build
    (https://travis-ci.org/anholt/mesa/jobs/419739857)
v3: Rebase on 3 new gallium caps.

Reviewed-by: Marek Olšák <marek.olsak@amd.com> (v1)
Cc: Bruce Cherniak <bruce.cherniak@intel.com>
Cc: George Kyriazis <george.kyriazis@intel.com>
Cc: Kenneth Graunke <kenneth@whitecape.org>
5 years agointel/compiler: Remove redundant nir_remove_dead_variables call
Jason Ekstrand [Mon, 3 Sep 2018 18:20:54 +0000 (13:20 -0500)]
intel/compiler: Remove redundant nir_remove_dead_variables call

As of 07a2098a708a2, brw_nir_optimize calls nir_remove_dead_variables as
the last optimization.  Doing it again is just pointless.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
5 years agointel: compiler: remove dead local variables at optimization pass
Lionel Landwerlin [Thu, 23 Aug 2018 13:34:19 +0000 (14:34 +0100)]
intel: compiler: remove dead local variables at optimization pass

We're hitting an assert in gfxbench because one of the local variable
is a sampler (according to Jason this isn't valid) :

testfw_app: ../src/compiler/nir_types.cpp:551: void glsl_get_natural_size_align_bytes(const glsl_type*, unsigned int*, unsigned int*): Assertion `!"type does not have a natural size"' failed.

Since this particular variable isn't used, it can be eliminated by
removing unused local variables at the end of the optimization loop.
This makes sense also for valid local variables.

v2: Move additional local variable removal out of optimization loop,
    but before large constant removal (Jason/Lionel)

v3: Move the removal at the end of brw_nir_optimize()

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107806
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agointel/decoder: fix the possible out of bounds group_iter
Andrii Simiklit [Mon, 20 Aug 2018 16:20:59 +0000 (19:20 +0300)]
intel/decoder: fix the possible out of bounds group_iter

The "gen_group_get_length" function can return a negative value
and it can lead to the out of bounds group_iter.

v2: printing of "unknown command type" was added
v3: just the asserts are added

Signed-off-by: Andrii Simiklit <andrii.simiklit@globallogic.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agoradv: Fix CMASK dimensions.
Bas Nieuwenhuizen [Mon, 3 Sep 2018 00:34:04 +0000 (02:34 +0200)]
radv: Fix CMASK dimensions.

Mirrors

1e40f694831 "ac/surface: fix CMASK fast clear for NPOT textures with mipmapping on SI/CI/VI"

CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
5 years agoradv: Use a lower max offchip buffer count.
Bas Nieuwenhuizen [Mon, 3 Sep 2018 00:30:48 +0000 (02:30 +0200)]
radv: Use a lower max offchip buffer count.

No clue what gets fixed by this but both radeonsi and amdvlk do it.

CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
5 years agoradv: Add VEGA20 support.
Bas Nieuwenhuizen [Mon, 3 Sep 2018 00:19:25 +0000 (02:19 +0200)]
radv: Add VEGA20 support.

Just mirror the radeonsi bits. Since this is just adding the extra
switch entries for new HW I think this should be fine for stable.

CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
5 years agoradv: don't expose linear depth surfaces on SI/CIK/VI either.
Dave Airlie [Fri, 31 Aug 2018 05:55:15 +0000 (15:55 +1000)]
radv: don't expose linear depth surfaces on SI/CIK/VI either.

ac_surface.c: gfx6_compute_surface says
/* DB doesn't support linear layouts. */

Now if we expose linear depth and create a linear depth image
and use CmdCopyImage to copy into it, we can't map the underlying
memory and read it linearly which I think should work.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoegl/android: do not indent HAVE_DRM_GRALLOC preprocessor directive
Mauro Rossi [Wed, 15 Aug 2018 12:46:25 +0000 (14:46 +0200)]
egl/android: do not indent HAVE_DRM_GRALLOC preprocessor directive

Fixes: 3f7bca44d9 ("egl/android: #ifdef out flink name support")
Fixes: c7bb82136b ("egl/android: Add DRM node probing and filtering")
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
5 years agoanv/blorp: Fix a comment as per Nanley's review feedback
Jason Ekstrand [Sat, 1 Sep 2018 14:11:17 +0000 (09:11 -0500)]
anv/blorp: Fix a comment as per Nanley's review feedback

This accidentally didn't make it into 62378c5e9e5

5 years agoanv/blorp: Do more flushing around HiZ clears
Jason Ekstrand [Thu, 30 Aug 2018 17:05:06 +0000 (12:05 -0500)]
anv/blorp: Do more flushing around HiZ clears

We make the flush after a HiZ clear unconditional and add a flush/stall
before the clear as well.

Cc: mesa-stable@lists.freedesktop.org
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107760
Reviewed-by: Chad Versace <chadversary@chromium.org>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
5 years agoi965/vec4: Clamp indirect tes input array reads with 0x0fffffff
Ian Romanick [Tue, 19 Jun 2018 00:02:58 +0000 (17:02 -0700)]
i965/vec4: Clamp indirect tes input array reads with 0x0fffffff

Page 190 of "Volume 7: 3D Media GPGPU Engine (Haswell)" says the valid
range of the offset is [0, 0FFFFFFFh].

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: mesa-stable@lists.freedesktop.org
5 years agoi965/vec4: Correctly handle uniform sources in generate_tes_add_indirect_urb_offset
Ian Romanick [Sat, 16 Jun 2018 02:39:56 +0000 (19:39 -0700)]
i965/vec4: Correctly handle uniform sources in generate_tes_add_indirect_urb_offset

Fixes failure in the new piglit test
tes-patch-input-array-vec2-index-invalid-rd.shader_test.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: mesa-stable@lists.freedesktop.org
5 years agodocs: update calendar to extended the 18.1 cycle by one more release
Andres Gomez [Thu, 30 Aug 2018 15:03:04 +0000 (18:03 +0300)]
docs: update calendar to extended the 18.1 cycle by one more release

Due to having 2 additional RCs for 18.2.

Cc: Dylan Baker <dylan.c.baker@intel.com>
Cc: Juan A. Suarez <jasuarez@igalia.com>
Cc: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Andres Gomez <agomez@igalia.com>
Acked-by: Dylan Baker <dylan@pnwbakers.com>
Acked-by: Juan A. Suarez <jasuarez@igalia.com>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
5 years agointel: Introducing Amber Lake platform
Rodrigo Vivi [Thu, 30 Aug 2018 21:39:27 +0000 (14:39 -0700)]
intel: Introducing Amber Lake platform

Amber Lake uses the same gen graphics as Kaby Lake, including a id
that were previously marked as reserved on Kaby Lake, but that
now is moved to AML page.

This follows the ids and approach used on kernel's commit
e364672477a1 ("drm/i915/aml: Introducing Amber Lake platform")

Reported-by: Timo Aaltonen <timo.aaltonen@canonical.com>
Cc: José Roberto de Souza <jose.souza@intel.com>
Cc: Anuj Phogat <anuj.phogat@gmail.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agointel: aubinator: Adding missed platforms to the error message.
Rodrigo Vivi [Thu, 30 Aug 2018 21:32:57 +0000 (14:32 -0700)]
intel: aubinator: Adding missed platforms to the error message.

Many new platforms got added to gen_device_name_to_pci_device_id()
but the error message inside aubinator didn't reflected those
changes. So syncing on the same order to be sure that we are not
missing any now.

Cc: Anuj Phogat <anuj.phogat@gmail.com>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agoi965/gen7_urb: Re-emit PUSH_CONSTANT_ALLOC on some gen9
Nanley Chery [Wed, 22 Aug 2018 17:43:32 +0000 (10:43 -0700)]
i965/gen7_urb: Re-emit PUSH_CONSTANT_ALLOC on some gen9

According to internal docs, some gen9 platforms have a pixel shader push
constant synchronization issue. Although not listed among said
platforms, this issue seems to be present on the GeminiLake 2x6's we've
tested.

We consider the available workarounds to be too detrimental on
performance. Instead, we mitigate the issue by applying part of one of
the workarounds. Re-emit PUSH_CONSTANT_ALLOC at the top of every batch
(as suggested by Ken).

Fixes ext_framebuffer_multisample-accuracy piglit test failures with the
following options:
* 6 depth_draw small depthstencil
* 8 stencil_draw small depthstencil
* 6 stencil_draw small depthstencil
* 8 depth_resolve small
* 6 stencil_resolve small depthstencil
* 4 stencil_draw small depthstencil
* 16 stencil_draw small depthstencil
* 16 depth_draw small depthstencil
* 2 stencil_resolve small depthstencil
* 6 stencil_draw small
* all_samples stencil_draw small
* 2 depth_draw small depthstencil
* all_samples depth_draw small depthstencil
* all_samples stencil_resolve small
* 4 depth_draw small depthstencil
* all_samples depth_draw small
* all_samples stencil_draw small depthstencil
* 4 stencil_resolve small depthstencil
* 4 depth_resolve small depthstencil
* all_samples stencil_resolve small depthstencil

v2: Include more platforms in WA (Ken).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106865
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93355
Cc: <mesa-stable@lists.freedesktop.org>
Tested-by: Mark Janes <mark.a.janes@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agoimx: make use of loader_open_render_node(..) helper
Christian Gmeiner [Thu, 9 Aug 2018 05:12:24 +0000 (07:12 +0200)]
imx: make use of loader_open_render_node(..) helper

Gets rid of hard-coded gpu device path.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
5 years agotegra: make use loader_open_render_node(..) helper
Christian Gmeiner [Thu, 2 Aug 2018 18:04:45 +0000 (20:04 +0200)]
tegra: make use loader_open_render_node(..) helper

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
5 years agoloader: add loader_open_render_node(..)
Christian Gmeiner [Thu, 9 Aug 2018 05:12:22 +0000 (07:12 +0200)]
loader: add loader_open_render_node(..)

This helper is almost a 1:1 copy of tegra_open_render_node().

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
5 years agotegra: fix memory leak
Christian Gmeiner [Fri, 10 Aug 2018 09:51:25 +0000 (11:51 +0200)]
tegra: fix memory leak

Fixes: 1755f608f52 ("tegra: Initial support")
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
5 years agost/dri: Don't expose sRGB formats to clients
Daniel Stone [Fri, 31 Aug 2018 16:34:03 +0000 (17:34 +0100)]
st/dri: Don't expose sRGB formats to clients

Though the SARGB8888 format is used internally through its FourCC value,
it is not a real format as defined by drm_fourcc.h; it cannot be used
with KMS or other interfaces expecting drm_fourcc.h format codes.

Ensure we don't advertise it through the dmabuf format/modifier query
interfaces, preventing us from tripping over an assert.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reported-by: Michel Dänzer <michel.daenzer@amd.com>
Fixes: 8c1b9882b2e0 ("egl/dri2: Guard against invalid fourcc formats")
Acked-by: Jason Ekstrand <jason.ekstrand@intel.com>
5 years agoradv: add missing support for protected memory properties
Samuel Pitoiset [Thu, 30 Aug 2018 09:43:47 +0000 (11:43 +0200)]
radv: add missing support for protected memory properties

Fixes Vulkan CTS CL#2849. Similar to the ANV driver.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoradv: remove dead code in scan_shader_output_decl()
Samuel Pitoiset [Thu, 30 Aug 2018 08:33:37 +0000 (10:33 +0200)]
radv: remove dead code in scan_shader_output_decl()

Never used.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
5 years agoradv: remove radv_shader_context::num_output_{clips,culls}
Samuel Pitoiset [Thu, 30 Aug 2018 08:33:00 +0000 (10:33 +0200)]
radv: remove radv_shader_context::num_output_{clips,culls}

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
5 years agoradv: adjust the cull dist mask in scan_shader_output_decl()
Samuel Pitoiset [Thu, 30 Aug 2018 08:30:54 +0000 (10:30 +0200)]
radv: adjust the cull dist mask in scan_shader_output_decl()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
5 years agoradv: get length of the clip/cull distances array from usage mask
Samuel Pitoiset [Thu, 30 Aug 2018 08:12:03 +0000 (10:12 +0200)]
radv: get length of the clip/cull distances array from usage mask

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
5 years agoradv: do not recompute the output usage mask for clipdist twice
Samuel Pitoiset [Thu, 30 Aug 2018 08:01:26 +0000 (10:01 +0200)]
radv: do not recompute the output usage mask for clipdist twice

The shader info pass takes care of this now.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
5 years agoradv: gather the output usage mask for clip/cull distances correctly
Samuel Pitoiset [Thu, 30 Aug 2018 07:43:29 +0000 (09:43 +0200)]
radv: gather the output usage mask for clip/cull distances correctly

It's a special case because both are combined into a single array.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
5 years agoradv: add set_output_usage_mask() helper
Samuel Pitoiset [Thu, 30 Aug 2018 07:35:41 +0000 (09:35 +0200)]
radv: add set_output_usage_mask() helper

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
5 years agoradv: fix passing clip/cull distances from VS to PS
Samuel Pitoiset [Wed, 29 Aug 2018 20:13:52 +0000 (22:13 +0200)]
radv: fix passing clip/cull distances from VS to PS

CTS doesn't test input clip/cull distances for the fragment
shader stage, which explains why this was totally broken. I
wrote a simple test locally that works now.

This fixes a crash with GTA V and DXVK.

Note that we are exporting unused parameters from the vertex
shader now, but this can't be optimized easily because we don't
keep the fragment shader info...

Cc: mesa-stable@lists.freedesktop.org
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107477
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoegl/wayland: do not leak wl_buffer when it is locked
Juan A. Suarez Romero [Thu, 30 Aug 2018 08:14:49 +0000 (10:14 +0200)]
egl/wayland: do not leak wl_buffer when it is locked

If color buffer is locked, do not set its wayland buffer to NULL;
otherwise it can not be freed later.

Rather, flag it in order to destroy it later on the release event.

v2: instruct release event to unlock only or free wl_buffer too (Daniel)

This also fixes dEQP-EGL.functional.swap_buffers_with_damage.* tests.

CC: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Daniel Stone <daniels@collabora.com>
5 years agoac/radeonsi: fix CIK copy max size
Dave Airlie [Wed, 29 Aug 2018 03:52:15 +0000 (13:52 +1000)]
ac/radeonsi: fix CIK copy max size

While adding transfer queues to radv, I started writing some tests,
the first test I wrote fell over copying a buffer larger than this
limit.

Checked AMDVLK and found the correct limit.

Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
5 years agoradeonsi: fix regression in indirect input swizzles.
Dave Airlie [Fri, 31 Aug 2018 00:12:06 +0000 (01:12 +0100)]
radeonsi: fix regression in indirect input swizzles.

This fixes:
tests/spec/arb_enhanced_layouts/execution/component-layout/vs-fs-array-dvec3.shader_test
since I reworked the 64-bit swizzles.

Fixes: bb17ae49ee2 (gallivm: allow to pass two swizzles into fetches.)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
5 years agoradeonsi: fix tess/gs fetchs for new swizzle.
Dave Airlie [Thu, 30 Aug 2018 23:27:44 +0000 (00:27 +0100)]
radeonsi: fix tess/gs fetchs for new swizzle.

I have piglit results from my machine, but I must have messed up,
and not built mesa in between properly.

Fixes: bb17ae49ee2 (gallivm: allow to pass two swizzles into fetches.)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
5 years agomesa: ignore VAO IDs equal to 0 in glDeleteVertexArrays
Marek Olšák [Thu, 30 Aug 2018 19:14:46 +0000 (15:14 -0400)]
mesa: ignore VAO IDs equal to 0 in glDeleteVertexArrays

This fixes a firefox crash.

Fixes: 781a78914c798dc64005b37c6ca1224ce06803fc
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
5 years agoRevert "intel/tools/aubwrite: Always use physical addresses for traces."
Kenneth Graunke [Thu, 30 Aug 2018 18:19:51 +0000 (11:19 -0700)]
Revert "intel/tools/aubwrite: Always use physical addresses for traces."

This reverts commit f8cfc7766016d0ff7d52953e7a992b1e77c521d0.

This appears to break intel_dump_gpu for Gen9 systems - I can load them
in the simulator, but nothing happens.  Reverting the patch makes the
simulator properly execute our commands and shaders again.

5 years agointel/nir: Lowering image loads and stores trashes all metadata
Jason Ekstrand [Thu, 30 Aug 2018 17:50:31 +0000 (12:50 -0500)]
intel/nir: Lowering image loads and stores trashes all metadata

This fixes the GL_ARB_fragment_shader_interlock piglit test on gen8
platforms where the lack of metadata dirtying was causing another pass
to accidentally delete a much needed loop.

https://bugs.freedesktop.org/show_bug.cgi?id=107745
Fixes: 37f7983bcca1 "intel/compiler: Do image load/store lowering..."
Jason Ekstrand <jason@jlekstrand.net> writes:
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agoi965/screen: Allow modifiers on sRGB formats
Jason Ekstrand [Tue, 28 Aug 2018 20:25:23 +0000 (15:25 -0500)]
i965/screen: Allow modifiers on sRGB formats

This effectively reverts a26693493570a9d0f0fba1be617e01ee7bfff4db which
was a misguided attempt at protecting intel_query_dma_buf_modifiers from
invalid formats.  Unfortunately, in some internal EGL cases, we can get
an SRGB format validly in this function.  Rejecting such formats caused
us to not allow CCS in some cases where we should have been allowing it.
This regressed the performance of some SynMark tests as well as GfxBench
ALU2, Tessellation and Manhattan 3.0 tests

There's some question of whether or not we really should be using SRGB
"fourcc" formats that aren't actually in drm_foucc.h but there's not
much harm in allowing them through here.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107223
Fixes: a26693493570 "i965/screen: Return false for unsupported..."
Tested-By: Eero Tamminen <eero.t.tamminen@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
5 years agoegl/dri2: Guard against invalid fourcc formats
Jason Ekstrand [Tue, 28 Aug 2018 21:43:57 +0000 (16:43 -0500)]
egl/dri2: Guard against invalid fourcc formats

We already reject attempts to import images with invalid fourcc formats
but don't really guard the queries all that well.  This makes us error
out in any calls to eglQueryDmaBufModifiersEXT if the given format is
not a valid fourcc format.  We also add an assert to ensure that drivers
don't advertise any non-fourcc formats.

Cc: mesa-stable@lists.freedesktop.org
Tested-By: Eero Tamminen <eero.t.tamminen@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
5 years agoegl/dri2: Add a helper for the number of planes for a FOURCC format
Jason Ekstrand [Tue, 28 Aug 2018 21:31:22 +0000 (16:31 -0500)]
egl/dri2: Add a helper for the number of planes for a FOURCC format

This also serves as a convenient "is this a fourcc format" check as well
which we'll take advantage of in the next commit.

Cc: mesa-stable@lists.freedesktop.org
Tested-By: Eero Tamminen <eero.t.tamminen@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
5 years agoradv/meta: Set num_components on image_store intrinsics
Jason Ekstrand [Thu, 30 Aug 2018 00:47:19 +0000 (19:47 -0500)]
radv/meta: Set num_components on image_store intrinsics

Now that image load/store intrinsics are variable-width, we need to set
num_components accordingly.  In 15d39f474b890, both glsl_to_nir and
spirv_to_nir were updated to properly set num_components but radv meta
was left behind.

Fixes: 15d39f474b890 "nir: Make image load/store intrinsics..."
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Tested-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>