mesa.git
6 years agosvga: whitespace, formatting fixes in svga_swtnl_state.c
Brian Paul [Wed, 12 Jul 2017 16:24:11 +0000 (10:24 -0600)]
svga: whitespace, formatting fixes in svga_swtnl_state.c

6 years agosvga: move comment, declaration in svga_init_shader_key_common()
Brian Paul [Tue, 11 Jul 2017 18:57:46 +0000 (12:57 -0600)]
svga: move comment, declaration in svga_init_shader_key_common()

put the comment before the relevant code.  Move declaration of
swizzle_tab var to where it's used.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
6 years agodraw: whitespace, formatting fixes in draw_vs_exec.c
Brian Paul [Tue, 11 Jul 2017 14:15:57 +0000 (08:15 -0600)]
draw: whitespace, formatting fixes in draw_vs_exec.c

Trivial.

6 years agodraw: s/unsigned/enum tgsi_semantic/
Brian Paul [Tue, 11 Jul 2017 14:12:49 +0000 (08:12 -0600)]
draw: s/unsigned/enum tgsi_semantic/

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
6 years agotravis: lower SWR requirement to GCC 4.8, aka std=c++11
Emil Velikov [Tue, 4 Jul 2017 15:53:40 +0000 (16:53 +0100)]
travis: lower SWR requirement to GCC 4.8, aka std=c++11

With ealier commit we relaxed the requirement from C++14 to C++11.
Update the build script so that it

Cc: Tim Rowley <timothy.o.rowley@intel.com
Fixes: 0b80b025021 ("swr: relax c++ requirement from c++14 to c++11")
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
6 years agodocs: update HTTP -> HTTPS reference to reflect reality
Emil Velikov [Fri, 30 Jun 2017 11:09:32 +0000 (12:09 +0100)]
docs: update HTTP -> HTTPS reference to reflect reality

The link recently got updated to https.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agoegl: set KHR_gl_texture_3D_image only when the requirements are met.
Emil Velikov [Wed, 28 Jun 2017 15:41:30 +0000 (16:41 +0100)]
egl: set KHR_gl_texture_3D_image only when the requirements are met.

DRI_IMAGE's createImageFromTexture is used to implement the extension,
so we should check for it prior to advertising.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agoegl: enhance KHR_gl_image extensions checks
Emil Velikov [Wed, 28 Jun 2017 23:35:56 +0000 (00:35 +0100)]
egl: enhance KHR_gl_image extensions checks

Drop the (duplicate) top-level check in dri2_create_image_khr() and add
the respective checks in dri2_create_image_khr_{texture,renderbuffer}

v2: use unreachable instead of assert in dri2_create_image_khr_texture

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agoegl: don't set modifier if no modifiers are available
Emil Velikov [Wed, 28 Jun 2017 23:24:27 +0000 (00:24 +0100)]
egl: don't set modifier if no modifiers are available

If no modifiers are available, the variable will never be used. Thus
there's no point in initialising it.

Cc: Varad Gautam <varad.gautam@collabora.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agoegl: check for extensions' presence during attr parsing
Emil Velikov [Wed, 28 Jun 2017 23:12:15 +0000 (00:12 +0100)]
egl: check for extensions' presence during attr parsing

If the respective extension is not supported, one should return
EGL_BAD_PARAMETER as mentioned in earlier commits.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agoegl: add width/height as EXT_image_dma_buf_import attrs
Emil Velikov [Wed, 28 Jun 2017 23:19:16 +0000 (00:19 +0100)]
egl: add width/height as EXT_image_dma_buf_import attrs

Although not listed amongst the initial EGL_LINUX_DRM_FOURCC_EXT and
friends list, the spec reads

   ... Required attributes and their values are as
   follows:

    * EGL_WIDTH & EGL_HEIGHT: The logical dimensions of the buffer in pixels

    * EGL_LINUX_DRM_FOURCC_EXT: The pixel format of the buffer, as specified
      by drm_fourcc.h and used as the pixel_format parameter of the
      drm_mode_fb_cmd2 ioctl.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agoegl: polish EXT_image_dma_buf_import attr parsing
Emil Velikov [Wed, 28 Jun 2017 23:09:15 +0000 (00:09 +0100)]
egl: polish EXT_image_dma_buf_import attr parsing

Simplify the existing if/else + temporary variable into if (foo) return
X.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agoegl: simplify EXT_image_dma_buf_import_modifiers attr parsing
Emil Velikov [Wed, 28 Jun 2017 22:46:11 +0000 (23:46 +0100)]
egl: simplify EXT_image_dma_buf_import_modifiers attr parsing

Move the common extension check at the top.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agoegl: split _eglParseImageAttribList into per extension functions
Emil Velikov [Wed, 28 Jun 2017 21:39:51 +0000 (22:39 +0100)]
egl: split _eglParseImageAttribList into per extension functions

Will allow us to simplify existing code and make further improvements
short and simple.

No functional change intended.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agoegl: call _eglError within _eglParseImageAttribList
Emil Velikov [Wed, 28 Jun 2017 19:31:18 +0000 (20:31 +0100)]
egl: call _eglError within _eglParseImageAttribList

As per EGL_KHR_image_base:

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

We should set the error as opposed to simply log it.

Currently we have a partial solution, whereby only some of the callers
call _eglError().

Since that has proven to be less robust, simply set the error by the
function itself and change the return type to EGLBoolean, updating the
callers.

So now the code is slightly simpler. Plus the follow-up fixes will be
easier to manage.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agoegl: move eglCreateDRMImageMESA's malloc later
Emil Velikov [Wed, 28 Jun 2017 20:23:00 +0000 (21:23 +0100)]
egl: move eglCreateDRMImageMESA's malloc later

Don't bother allocating any memory until we're finished parsing and
sanitising all the attributes.

As a nice side effect we now consistently set eglError when any of
the attrib/values are not correct.

Strangely enough the spec does not mention _anything_ about what error
should be set where, even if the implementation already sets the odd
one.

Cc: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agosvga: fix texture swizzle writemasking
Brian Paul [Tue, 11 Jul 2017 20:56:00 +0000 (14:56 -0600)]
svga: fix texture swizzle writemasking

Commit bfe1e7737a76e3b046 changed how texture swizzles are set up.
This exposed a latent bug in the VMware driver: we were ignoring
the texture instruction's writemask when applying the 0 and 1
swizzle terms.

This wasn't caught by the Piglit texture swizzle test because it
only exercises fixed function (no write masking).

Fixes issues seen with ETQW apitrace.

CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
6 years agoi965: Use VALGRIND_MAKE_MEM_x in place of MALLOCLIKE/FREELIKE
Chris Wilson [Tue, 11 Jul 2017 15:54:25 +0000 (16:54 +0100)]
i965: Use VALGRIND_MAKE_MEM_x in place of MALLOCLIKE/FREELIKE

Valgrind doesn't actually implement VALGRIND_FREELIKE_BLOCK as the
exact inverse of VALGRIND_MALLOCLIKE_BLOCK. It makes the block
inaccessible, but still leaves it defined in its allocation tracker i.e.
it will report the mmap as lost despite the call to FREELIKE!

Instead of treating the mmap as an allocation, treat it as changing the
access bits upon the memory, i.e. that it becomes defined (because of
the buffer objects always contain valid content from the user's
perspective) upon mmap and inaccessible upon munmap. This makes memcheck
happy without leaving it thinking there is a very large leak.

Finally for consistency, we treat all the mmap/munmap paths the same
even though valgrind can intercept the regular mmap used for GTT. We
could move this in the drm_mmap/drm_munmap macros, but that quickly
looks ugly given the desire for those to support different OSes, but I
didn't try that hard!

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoi965: Fix asynchronous mappings on !LLC platforms.
Kenneth Graunke [Sat, 1 Jul 2017 08:55:55 +0000 (01:55 -0700)]
i965: Fix asynchronous mappings on !LLC platforms.

When using a read-only CPU mapping, we may encounter stale buffer
contents.  For example, the Piglit primitive-restart test offers the
following scenario:

   1. Read data via a CPU map.
   2. Destroy that buffer.
   3. Create a new buffer - obtaining the same one via the BO cache.
   4. Call BufferSubData, which does a GTT map with MAP_WRITE | MAP_ASYNC.
      (We avoid set_domain for async mappings, so no flushing occurs.)
   5. Read data via a CPU map.
      (Without explicit clflushing, this will contain data from step 1!)

Otherwise, everything ought to work, keeping in mind that we never use
CPU maps for writing - just read-only CPU maps.

This restores the performance gains after Matt's revert in commit
71651b3139c501f50e6547c21a1cdb816b0a9dde.

v2: Do the invalidate later, and even when asking for a brand new map.
v3: Add more comments from Chris.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
6 years agoi965: Don't use PREAD for glGetBufferSubData().
Kenneth Graunke [Sat, 1 Jul 2017 18:33:35 +0000 (11:33 -0700)]
i965: Don't use PREAD for glGetBufferSubData().

Just map the buffer and memcpy.  This will do a CPU mmap, which should
be reasonably efficient, and doing this gives us full control over the
domains and caching instead of leaving it to the kernel.

This prevents regressions on Braswell in the next commit.  Specifically
GL45-CTS.shader_atomic_counters.basic-buffer-operations.  Because async
maps start skipping set-domain, the pread thought everything was nicely
still in the CPU domain, and returned stale data.

v2: Use _mesa_error_no_memory() if the map fails instead of crashing.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
6 years agoswr: build driver proper separate from rasterizer
Tim Rowley [Thu, 29 Jun 2017 19:37:07 +0000 (14:37 -0500)]
swr: build driver proper separate from rasterizer

swr used to build and link the rasterizer to the driver, and to support
multiple architectures we needed to have multiple versions of the
driver/rasterizer combination, which needed to link in much of mesa.

Changing to having one instance of the driver and just building
architecture specific versions of the rasterizer gives a large reduction
in disk space.

libGL.so        6464 Kb ->  7000 Kb
libswrAVX.so   10068 Kb ->  5432 Kb
libswrAVX2.so   9828 Kb ->  5200 Kb

Total          26360 Kb -> 17632 Kb

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoswr: switch to using SwrGetInterface api table
Tim Rowley [Thu, 29 Jun 2017 19:03:43 +0000 (14:03 -0500)]
swr: switch to using SwrGetInterface api table

Use the SWR rasterizer API through the table returned from
SwrGetInterface rather than referencing the functions directly.
This will allow us to move to a model of having the driver dynamically
load the appropriate swr architecture library.

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
6 years agoswr/rast: make SWR_VISIBLE attribute work for windows
George Kyriazis [Tue, 11 Jul 2017 14:13:49 +0000 (08:13 -0600)]
swr/rast: make SWR_VISIBLE attribute work for windows

Needed to expose SwrGetInterface

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
6 years agoi965: perf: use new subslices numbers from device info
Lionel Landwerlin [Wed, 21 Jun 2017 16:48:14 +0000 (17:48 +0100)]
i965: perf: use new subslices numbers from device info

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
6 years agointel: add number of subslices to device info
Lionel Landwerlin [Wed, 21 Jun 2017 16:44:17 +0000 (17:44 +0100)]
intel: add number of subslices to device info

We could have used a single integer to store that value, but
Cannonlake has different number of subslices per slice depending on
the GT.

v2: Add CFL subslice numbers (Lionel)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
6 years agoi965: Use already existing eu_total
Ben Widawsky [Thu, 6 Jul 2017 00:04:16 +0000 (17:04 -0700)]
i965: Use already existing eu_total

Reduces IOCTL calls by 1, and provides a centralized place to override
such configurations if we have a need to do so.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
6 years agoi965: Resolve framebuffers before signaling the fence
Chris Wilson [Mon, 12 Jun 2017 14:17:20 +0000 (15:17 +0100)]
i965: Resolve framebuffers before signaling the fence

From KHR_fence_sync:

  When the condition of the sync object is satisfied by the fence
  command, the sync is signaled by the associated client API context,
  causing any eglClientWaitSyncKHR commands (see below) blocking on
  <sync> to unblock. The only condition currently supported is
  EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR, which is satisfied by
  completion of the fence command corresponding to the sync object,
  and all preceding commands in the associated client API context's
  command stream. The sync object will not be signaled until all
  effects from these commands on the client API's internal and
  framebuffer state are fully realized. No other state is affected by
  execution of the fence command.

If clients are passing the fence fd (from EGL_ANDROID_native_fence_sync)
to a compositor, that fence must only be signaled once the framebuffer
is resolved and not before as is currently the case.

v2: fixup assert to use GL_SYNC_GPU_COMMANDS_COMPLETE (Chad)

Reported-by: Sergi Granell <xerpi.g.12@gmail.com>
Fixes: c636284ee8ee ("i965/sync: Implement DRI2_Fence extension")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Sergi Granell <xerpi.g.12@gmail.com>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Chad Versace <chadversary@chromium.org>
Cc: Daniel Stone <daniels@collabora.com>
Cc: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chadversary@chromium.org>
6 years agosvga: s/unsigned/enum tgsi_texture_type/
Brian Paul [Mon, 10 Jul 2017 20:14:17 +0000 (14:14 -0600)]
svga: s/unsigned/enum tgsi_texture_type/

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: Neha Bhende <bhenden@vmware.com>
6 years agosvga: s/unsigned/enum tgsi_swizzle
Brian Paul [Mon, 10 Jul 2017 20:12:27 +0000 (14:12 -0600)]
svga: s/unsigned/enum tgsi_swizzle

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: Neha Bhende <bhenden@vmware.com>
6 years agosvga: s/unsigned/enum tgsi_interpolate_mode/
Brian Paul [Mon, 10 Jul 2017 20:09:25 +0000 (14:09 -0600)]
svga: s/unsigned/enum tgsi_interpolate_mode/

And s/unsigned/enum tgsi_interpolate_loc/

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: Neha Bhende <bhenden@vmware.com>
6 years agosvga: s/unsigned/enum tgsi_file_type/
Brian Paul [Mon, 10 Jul 2017 20:08:36 +0000 (14:08 -0600)]
svga: s/unsigned/enum tgsi_file_type/

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: Neha Bhende <bhenden@vmware.com>
6 years agosvga: s/unsigned/enum tgsi_semantic/
Brian Paul [Mon, 10 Jul 2017 20:03:48 +0000 (14:03 -0600)]
svga: s/unsigned/enum tgsi_semantic/

Makes gdb debugging a little nicer.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: Neha Bhende <bhenden@vmware.com>
6 years agoi965: Assert that we don't use CPU write maps to non-coherent buffers.
Kenneth Graunke [Sat, 1 Jul 2017 08:55:52 +0000 (01:55 -0700)]
i965: Assert that we don't use CPU write maps to non-coherent buffers.

Using CPU maps of non-coherent buffers can get us in a lot of trouble,
and WC maps are a reasonable alternative anyway.  Guard against shooting
ourselves in the foot by adding an assert, and comment.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Matt Turner <mattst88@gmail.com>
6 years agoi965: Disable access to CPU mmap for async access on non-LLC machines
Chris Wilson [Tue, 20 Jun 2017 10:39:22 +0000 (11:39 +0100)]
i965: Disable access to CPU mmap for async access on non-LLC machines

If the user triggers an implicit batch flush while holding access to a
CPU mapped buffer, that mmapping will be invalidated by the kernel for
non-LLC devices. (The kernel when executing a batch will change the
cache domain of the buffers in that batch, which for non-LLC CPU access
will cause that buffer to be clflushed and any further CPU access to be
discarded.) To prevent this, simply disallow any CPU async mmap access.
The cases where async CPU access to a non-LLC buffer should continue to
be allowed via their preferred snooping path.

v2 (Ken): Reword the comment slightly.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
6 years agoi965: Track when a bo is shared with an external client
Chris Wilson [Mon, 19 Jun 2017 10:55:00 +0000 (11:55 +0100)]
i965: Track when a bo is shared with an external client

If the buffer is being shared with an external client, our own state
tracking may be stale and in some cases we may wish to double check with
the kernel/hw state. At the moment, this is synonymous with not being
reusable, but the semantics between reusable and external are quite
different and we will have more examples of non-reusable buffers in the
near future.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
6 years agointel: Fix clflushing on modern (Baytrail+) Atom CPUs.
Kenneth Graunke [Sat, 1 Jul 2017 09:04:50 +0000 (02:04 -0700)]
intel: Fix clflushing on modern (Baytrail+) Atom CPUs.

Thanks to Chris Wilson for pointing this out.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
6 years agointel: Move clflush helpers from anv to common/gen_clflush.h.
Kenneth Graunke [Sat, 1 Jul 2017 08:59:40 +0000 (01:59 -0700)]
intel: Move clflush helpers from anv to common/gen_clflush.h.

I want to use these in the OpenGL driver as well.

v2: Add to COMMON_FILES in Makefile.sources (caught by Emil)

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Matt Turner <mattst88@gmail.com>
6 years agospirv: Fix reaching unreachable for compare exchange on images
James Legg [Mon, 26 Jun 2017 09:46:23 +0000 (10:46 +0100)]
spirv: Fix reaching unreachable for compare exchange on images

We were hitting the
unreachable("Invalid image opcode")
near the end of vtn_handle_image when parsing the
SpvOpAtomicCompareExchange opcode.

v2: Add stable CC.
v3: Ignore SpvOpAtomicCompareExchangeWeak. It requires the Kernel
capability which is not exposed in Vulkan, and spirv_to_nir is not used
for OpenCL which does support it.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
CC: <mesa-stable@lists.freedesktop.org>
6 years agogallium: use "ull" number suffix to keep the QtCreator parser happy
Marek Olšák [Thu, 6 Jul 2017 00:23:46 +0000 (02:23 +0200)]
gallium: use "ull" number suffix to keep the QtCreator parser happy

It can't parse "llu".

Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agoi965: Use brw_bo_wait() for brw_bo_wait_rendering()
Chris Wilson [Fri, 7 Jul 2017 12:12:54 +0000 (13:12 +0100)]
i965: Use brw_bo_wait() for brw_bo_wait_rendering()

Currently, we use set_domain() to cause a stall on rendering. But the
set-domain ioctl has the side-effect of changing the kernel's cache
domain underneath the struct_mutex, which may perturb state if there was
no rendering to wait upon and in general is much heavier than the
lockless wait-ioctl. Historically libdrm used set-domain as we did not
have an explicit wait-ioctl (and the patches to teach it to use wait if
available were lost in the mists). Since mesa already depends upon a
kernel support the wait-ioctl, we do not need to supply a fallback.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agosvga: fix PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE value
Brian Paul [Mon, 10 Jul 2017 14:36:15 +0000 (08:36 -0600)]
svga: fix PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE value

This query is supposed to return the max texture buffer size/width in
texels, not size in bytes.  Divide by 16 (the largest format size) to
return texels.

Fixes Piglit arb_texture_buffer_object-max-size test.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by :Charmaine Lee <charmainel@vmware.com>

6 years agosvga: fix breakage in create_backed_surface_view()
Brian Paul [Sun, 9 Jul 2017 19:45:28 +0000 (12:45 -0700)]
svga: fix breakage in create_backed_surface_view()

This fixes a regression in some piglit tests since commit 5e5d5f1a2eb.
I think I mis-resolved the merge conflict when cherry-picking that
commit to master.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
6 years agoanv: Stop setting domains to RENDER on EXEC_OBJECT_WRITE
Jason Ekstrand [Fri, 7 Jul 2017 17:57:09 +0000 (10:57 -0700)]
anv: Stop setting domains to RENDER on EXEC_OBJECT_WRITE

The reason we were doing this was to ensure that the kernel did the
appropriate cross-ring synchronization and flushing.  However, the
kernel only looks at EXEC_OBJECT_WRITE to determine whether or not to
insert a fence.  It only cares about the domain for determining whether
or not it needs to clflush the BO before using it for scanout but the
domain automatically gets set to RENDER internally by the kernel if
EXEC_OBJECT_WRITE is set.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
6 years agoa5xx: fix condition for updating *_FS_OUTPUT_CNTL
Ilia Mirkin [Sun, 9 Jul 2017 22:06:25 +0000 (18:06 -0400)]
a5xx: fix condition for updating *_FS_OUTPUT_CNTL

The register values depend on the currently set program, so make sure to
revalidate when the program changes.

Fixes glsl-1.10-fragdepth as well as
dEQP-GLES3.functional.shaders.fragdepth.compare.*

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Rob Clark <robdclark@gmail.com>
6 years agoradv/ac: drop setting xnack
Dave Airlie [Thu, 6 Jul 2017 22:09:07 +0000 (23:09 +0100)]
radv/ac: drop setting xnack

Since radv uses compute rings and we can't know when we are setting
up the shaders what ring they are to be used on, we should just use
the default xnack setting. This may be suboptimal in some places,
but if we hit a problem, we likely should try and address this
between llvm and mesa.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoradv: add support for using addrlib max alignment.
Dave Airlie [Sun, 9 Jul 2017 19:34:04 +0000 (20:34 +0100)]
radv: add support for using addrlib max alignment.

Rather than using 64k, use what addrlib returns as the base
alignment for vulkan allocations.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agonir: copy front interpolation when creating fake back color input
Ilia Mirkin [Sat, 8 Jul 2017 00:32:24 +0000 (20:32 -0400)]
nir: copy front interpolation when creating fake back color input

Fixes a bunch of gl_BackColor interpolation tests that had explicit
interpolation specified on the fragment shader gl_Color.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Rob Clark <robdclark@gmail.com>
6 years agoa5xx: remove no-longer-accurate border color layout comment
Ilia Mirkin [Sat, 8 Jul 2017 15:13:35 +0000 (11:13 -0400)]
a5xx: remove no-longer-accurate border color layout comment

Better to just point at the bcolor_entry struct which has our current
understanding encoded into it. Also add an assert to ensure that the
struct remains the expected size.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
6 years agoa5xx: fix border color for depth formats
Ilia Mirkin [Sat, 8 Jul 2017 14:51:19 +0000 (10:51 -0400)]
a5xx: fix border color for depth formats

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
6 years agoa5xx: add border color clamping, add packed border color formats
Ilia Mirkin [Sat, 8 Jul 2017 14:16:56 +0000 (10:16 -0400)]
a5xx: add border color clamping, add packed border color formats

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
6 years agoa5xx: fix border colors for swizzled texture formats
Ilia Mirkin [Sat, 8 Jul 2017 12:46:02 +0000 (08:46 -0400)]
a5xx: fix border colors for swizzled texture formats

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
6 years agoa5xx: fix integer texture border colors
Ilia Mirkin [Sat, 8 Jul 2017 12:32:32 +0000 (08:32 -0400)]
a5xx: fix integer texture border colors

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
6 years agoa5xx: fix primitive restart
Ilia Mirkin [Sat, 8 Jul 2017 01:10:05 +0000 (21:10 -0400)]
a5xx: fix primitive restart

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
6 years agonir/spirv: Remove unnecessary comment.
Andres Gomez [Sat, 8 Jul 2017 12:21:20 +0000 (15:21 +0300)]
nir/spirv: Remove unnecessary comment.

It should have been removed after 00c47e111c.

Cc: Jason Ekstrand <jason@jlekstrand.net>
Cc: Connor Abbott <cwabbott0@gmail.com>
Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agoradv: Add compute htile clear for combined depth+stencil surfaces.
Bas Nieuwenhuizen [Fri, 7 Jul 2017 13:56:57 +0000 (15:56 +0200)]
radv: Add compute htile clear for combined depth+stencil surfaces.

Figured out the clear value when we have a combined depth stencil
surface.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agodraw: handle more TGSI_SEMANTIC_COLOR indices
Roland Scheidegger [Fri, 7 Jul 2017 22:14:35 +0000 (00:14 +0200)]
draw: handle more TGSI_SEMANTIC_COLOR indices

It could only handle indices 0/1, otherwise what happened was bad (accessing
array out of bounds, no crash but kind of random). This is enough for the gl
state tracker (primary/secondary color) but not enough for some other state
trackers (d3d9 has no limits on the number of color interpolants).
The complexity with color semantics are all due to the front/back mapping (2
outputs in the vs map to one input in the fs) so this isn't extended to
indices > 1 - d3d9 has no use for back colors, therefore this isn't needed and
still only 2 back colors can be handled correctly.

Reviewed-by: Brian Paul <brianp@vmware.com>
6 years agost/mesa: Fix grabbing the wrong variant if glDrawPixels is called
Matias N. Goldberg [Wed, 5 Jul 2017 17:02:50 +0000 (14:02 -0300)]
st/mesa: Fix grabbing the wrong variant if glDrawPixels is called

By design pixel shaders can have up to 3 variants:
* The standard one.
* glDrawPixels variant.
* glBitmap variant.
However "shader_has_one_variant" ignores this fact, and therefore
st_update_fp would select the wrong variant if glDrawPixels or glBitmap
was ever called.

This patch fixes the problem. If the standard variant has been created,
calling glDrawPixels or glBitmap will append the variant to the second
entry of the linked list, so that st_update_fp still selects the right
one if shader_has_one_variant is set.

If the standard variant hasn't been created yet and glDrawPixel/Bitmap
has been called, st_update_fp will will see this and take the slow path
instead. The standard variant will then be added at the front of the
linked list, so that the next time the fast path is taken.

Blender in particular is hit by this bug.

v2: Marek - cosmetic changes

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

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
6 years agoRevert "intel/isl: Only create a CCS buffer if the image supports rendering"
Nanley Chery [Wed, 5 Jul 2017 18:42:00 +0000 (11:42 -0700)]
Revert "intel/isl: Only create a CCS buffer if the image supports rendering"

This reverts commit 8aaa13467dc289d35dc7900ab9fab9a7689c4178, which was
based on an incorrect assumption. Unlike the restriction placed on image
views in the Vulkan API, OpenGL allows you to render to texture views
whose formats differ from the originals.

Bugzilla: https://bugzilla.freedesktop.org/show_bug.cgi?id=101677

6 years agomesa: finish implementing glPrimitiveRestartNV() for display lists
Brian Paul [Thu, 6 Jul 2017 23:54:49 +0000 (17:54 -0600)]
mesa: finish implementing glPrimitiveRestartNV() for display lists

If we try to build a display list with just a glPrimitiveRestartNV()
call, we'd crash because of a null GLvertexformat::PrimitiveRestartNV
pointer.  This change fixes that case.

The previous patch fixed the case of calling glPrimitiveRestartNV()
inside a glBegin/End pair.

v2: minor clean-up in save_PrimitiveRestartNV(), per Charmaine.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
6 years agovbo: fix glPrimitiveRestartNV crash inside a display list
Olivier Lauffenburger [Thu, 6 Jul 2017 15:45:00 +0000 (09:45 -0600)]
vbo: fix glPrimitiveRestartNV crash inside a display list

glPrimitiveRestartNV crashes when it is called during the compilation
of a display list.

There are two reasons:
- ctx->Driver.CurrentSavePrimitive is not set to the current primitive
- save_PrimitiveRestartNV() calls _save_Begin() which only sets an
  OpenGL error, instead of calling vbo_save_NotifyBegin().

This patch correctly calls vbo_save_NotifyBegin() but it detects
the current primitive mode by looking at the latest saved primitive.

Additional work by Brian Paul

Signed-off-by: Olivier Lauffenburger <o.lauffenburger@topsolid.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101464
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
6 years agost/mesa: remove unused st_framebuffer::Private field
Brian Paul [Thu, 6 Jul 2017 22:31:43 +0000 (16:31 -0600)]
st/mesa: remove unused st_framebuffer::Private field

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
6 years agomesa: add some braces in _mesa_make_current()
Brian Paul [Thu, 6 Jul 2017 17:59:55 +0000 (11:59 -0600)]
mesa: add some braces in _mesa_make_current()

Slightly better readability.

6 years agovbo: rename target->index in loopback code
Brian Paul [Thu, 6 Jul 2017 17:09:10 +0000 (11:09 -0600)]
vbo: rename target->index in loopback code

Because it's a vertex attribute index.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
6 years agovbo: whitespace/formatting fixes in vbo_save_loopback.c
Brian Paul [Thu, 6 Jul 2017 17:04:10 +0000 (11:04 -0600)]
vbo: whitespace/formatting fixes in vbo_save_loopback.c

Trivial.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
6 years agovbo: simplify vbo_save_NotifyBegin()
Brian Paul [Thu, 6 Jul 2017 16:53:41 +0000 (10:53 -0600)]
vbo: simplify vbo_save_NotifyBegin()

This function always returned GL_TRUE.  Just make it a void function.
Remove unreachable code following the call to vbo_save_NotifyBegin()
in save_Begin() in dlist.c

There were some stale comments that no longer applied since an earlier
code refactoring.

No Piglit regressions.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
6 years agosvga: adjust line subpixel position for HWv8
Brian Paul [Thu, 6 Jul 2017 02:08:54 +0000 (20:08 -0600)]
svga: adjust line subpixel position for HWv8

This fixes two regressions on HWv8:
  Piglit gl-1.0-ortho-pos
  Piglit/glean fbo
This was caused by commit c2b92dada076a "svga: clamp device line width
to at least 1 to fix HWv8 line stippling"

This also fixes two conform tests: Vertex Order and Polygon Face

No Piglit/conform changes with HWv9 or later.

VMware bug 1905053

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
6 years agoetnaviv: fix refcnt initialization in etna_screen
Aleksander Morgado [Thu, 6 Jul 2017 21:18:57 +0000 (23:18 +0200)]
etnaviv: fix refcnt initialization in etna_screen

Despite being a member of the etna_screen struct, 'refcnt' is used by
the winsys-specific logic to track the reference count of the object
managed in a hash table. When the count reaches zero, the pipe screen
is removed from the table and destroyed.

Fix the logic by initializing the refcnt to 1 when screen created.
This initialization is done in etna_screen_create(), to follow the
same logic as in freedreno and virgl.

Fixes: c9e8b49b885 ("etnaviv: gallium driver for Vivante GPUs")
Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
6 years agoa5xx: add support for rendering to RGB10A2_UNORM formats
Ilia Mirkin [Fri, 7 Jul 2017 04:33:50 +0000 (00:33 -0400)]
a5xx: add support for rendering to RGB10A2_UNORM formats

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
6 years agoa5xx: set uint/sint bits for mrt output register
Ilia Mirkin [Fri, 7 Jul 2017 04:19:03 +0000 (00:19 -0400)]
a5xx: set uint/sint bits for mrt output register

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
6 years agoa5xx: add backface stencil emission
Ilia Mirkin [Fri, 7 Jul 2017 01:03:03 +0000 (21:03 -0400)]
a5xx: add backface stencil emission

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
6 years agoradeonsi: fix invalidating bindless buffer descriptors
Samuel Pitoiset [Fri, 30 Jun 2017 16:48:12 +0000 (18:48 +0200)]
radeonsi: fix invalidating bindless buffer descriptors

The VA is stored at [4:5], not [0:1]. This invalidated all
texture buffer descriptors when they were made resident in
the current context.

This removes few partial flushes and cache invalidations which
are needed when updating a bindless descriptor on the fly with
a WRITE_DATA packet.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agost/wgl: Implement wglUseFontBitmaps.
Olivier Lauffenburger [Thu, 6 Jul 2017 15:27:00 +0000 (09:27 -0600)]
st/wgl: Implement wglUseFontBitmaps.

wglUseFontBitmaps is currently a noop.
This patch implements this function for Windows.
Misc code clean-ups by Brian.

Signed-off-by: Olivier Lauffenburger <o.lauffenburger@topsolid.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
6 years agost/wgl: improve selection of pixel format
Olivier Lauffenburger [Thu, 6 Jul 2017 15:08:00 +0000 (09:08 -0600)]
st/wgl: improve selection of pixel format

Current selection of pixel format does not enforce the request of
stencil or depth buffer if the color depth is not the same as
requested.

For instance, GLUT requests a 32-bit color buffer with an 8-bit
stencil buffer, but because color buffers are only 24-bit, no
priority is given to creating a stencil buffer.

This patch gives more priority to the creation of requested buffers
and less priority to the difference in bit depth.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101703
Signed-off-by: Olivier Lauffenburger <o.lauffenburger@topsolid.com>
Tested-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
6 years agoac/nir: Fix ordering of parameters for image atomic cmpswap intrinsics
Alex Smith [Fri, 30 Jun 2017 10:15:42 +0000 (11:15 +0100)]
ac/nir: Fix ordering of parameters for image atomic cmpswap intrinsics

The NIR parameters are ordered "compare, data", matching GLSL, but both
the image and buffer LLVM intrinsics take them the other way around.
This is already handled correctly for SSBO atomics.

Signed-off-by: Alex Smith <asmith@feralinteractive.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Fixes: f4e499ec791 "radv: add initial non-conformant radv vulkan driver"
6 years agomesa: simplify get_tex_images_for_clear()
Brian Paul [Wed, 5 Jul 2017 20:48:33 +0000 (14:48 -0600)]
mesa: simplify get_tex_images_for_clear()

Get rid of redundant code.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
6 years agomesa: new comments, assertion related to glClearTexSubImage
Brian Paul [Wed, 5 Jul 2017 20:44:08 +0000 (14:44 -0600)]
mesa: new comments, assertion related to glClearTexSubImage

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
6 years agost/mesa: find proper mipmap level in st_ClearTexSubImage()
Brian Paul [Wed, 5 Jul 2017 20:31:26 +0000 (14:31 -0600)]
st/mesa: find proper mipmap level in st_ClearTexSubImage()

The Piglit arb_clear_texture-error test creates a texture with only
a 1x1 image at level=1, then tries to clear level 0 (nonexistent)
and level 1 (exists).  The test only checks that the former generates
an error but the later doesn't.  The test passes, but when we try
to clear the level=1 image we're passing an invalid level to
pipe_context::clear_texture().  level=1, but since there's only one
mipmap level in the texture, it should be zero.

This fixes the code to search the gallium texture resource for the
correct mipmap level.  Also, add an assertion to make sure we're not
passing an invalid level to pipe_context::clear_texture().

Fixes device errors with VMware driver.  No Piglit regressions.

v2: don't do the level search when using immutable textures.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
6 years agost/mesa: whitespace fixes in st_cb_fbo.c
Brian Paul [Mon, 3 Jul 2017 17:52:41 +0000 (11:52 -0600)]
st/mesa: whitespace fixes in st_cb_fbo.c

Trivial.

6 years agost/mesa: whitespace fixes in st_texture.c
Brian Paul [Mon, 3 Jul 2017 17:48:30 +0000 (11:48 -0600)]
st/mesa: whitespace fixes in st_texture.c

Trivial.

6 years agoradv: don't overallocate depth/stencil formats
Dave Airlie [Thu, 6 Jul 2017 06:23:25 +0000 (07:23 +0100)]
radv: don't overallocate depth/stencil formats

For depth/stencil formats the surface layer allocates the
stencil separately, so we don't need to include it in the
bpe.

This reduces the side of d32s8 allocates to something closer to pro.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoradv: enable sisched toggle in perftest flags.
Dave Airlie [Thu, 6 Jul 2017 02:06:01 +0000 (03:06 +0100)]
radv: enable sisched toggle in perftest flags.

RADV_PERFTEST=sisched

to enable it.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoac/llvm: set xnack like radeonsi does.
Dave Airlie [Thu, 6 Jul 2017 02:01:56 +0000 (03:01 +0100)]
ac/llvm: set xnack like radeonsi does.

Use family, but only set xnack+ for gfx9.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoac/llvm: create features list using snprintf.
Dave Airlie [Thu, 6 Jul 2017 02:00:02 +0000 (03:00 +0100)]
ac/llvm: create features list using snprintf.

Just more moving code around before adding things to it.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoac/radv: change api to create target machine
Dave Airlie [Thu, 6 Jul 2017 01:56:21 +0000 (02:56 +0100)]
ac/radv: change api to create target machine

This just modifies the API to make it easier to add other flags
to target machine creation.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agobuild systems: move git_sha1_gen.sh to bin/
Eric Engestrom [Thu, 6 Jul 2017 19:25:28 +0000 (20:25 +0100)]
build systems: move git_sha1_gen.sh to bin/

There was no reason for this script to live outside the scripts
directory.

Suggested-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Brian Paul <brianp@vmware.com>
6 years agoswr/rast: Correctly allocate SWR_STATS memory as cacheline aligned
Tim Rowley [Thu, 6 Jul 2017 18:16:18 +0000 (13:16 -0500)]
swr/rast: Correctly allocate SWR_STATS memory as cacheline aligned

Cacheline alignment of SWR_STATS to prevent sharing of cachelines
between threads (performance).

Gets rid of gcc-7.1 warning about using c++17's over-aligned new
feature.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
6 years agoswr/rast: remove unused variables
Tim Rowley [Thu, 6 Jul 2017 15:41:58 +0000 (10:41 -0500)]
swr/rast: remove unused variables

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
6 years agoswr/rast: don't use _mm256_fmsub_ps in AVX code
Tim Rowley [Thu, 6 Jul 2017 15:29:38 +0000 (10:29 -0500)]
swr/rast: don't use _mm256_fmsub_ps in AVX code

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
6 years agoswr/rast: _mm*_undefined_* implementations for gcc<4.9
Tim Rowley [Thu, 6 Jul 2017 15:28:53 +0000 (10:28 -0500)]
swr/rast: _mm*_undefined_* implementations for gcc<4.9

Define these in terms of setzero for ancient gcc versions which don't
have the undefined intrinsics.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
6 years agoetnaviv: don't dereference etna_resource pointer if allocation fails
Aleksander Morgado [Thu, 6 Jul 2017 09:35:37 +0000 (11:35 +0200)]
etnaviv: don't dereference etna_resource pointer if allocation fails

The check for the pointer being non-NULL was being done too late.

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
6 years agoscons: Check for xlocale.h before defining HAVE_XLOCALE_H.
Vinson Lee [Wed, 5 Jul 2017 21:16:11 +0000 (14:16 -0700)]
scons: Check for xlocale.h before defining HAVE_XLOCALE_H.

Don't assume the header is present on some platforms - use the more
robust CheckHeader() instead.

glibc 2.26 removed xlocale.h.
https://sourceware.org/glibc/wiki/Release/2.26#Removal_of_.27xlocale.h.27

Fix this build error with glibc 2.26.

  Compiling src/util/strtod.c ...
src/util/strtod.c:32:10: fatal error: xlocale.h: No such file or directory
 #include <xlocale.h>
          ^~~~~~~~~~~

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101657
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Tested-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agoradv: add support for cmd predication.
Dave Airlie [Mon, 26 Jun 2017 01:13:24 +0000 (02:13 +0100)]
radv: add support for cmd predication.

This doesn't get used yet, it just adds support to various PKT3
emissions to enable it later.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoglsl: check if any of the named builtins are available first
Ilia Mirkin [Mon, 3 Jul 2017 21:08:12 +0000 (17:08 -0400)]
glsl: check if any of the named builtins are available first

_mesa_glsl_has_builtin_function is used to determine whether any variant
of a builtin are available, for the purpose of enforcing the GLSL ES
3.00+ rule that overloads or overrides of builtins are disallowed.

However the builtin_builder contains information on all builtins,
irrespective of parse state, or versions, or extension enablement. As a
result we would say that a builtin existed even if it was not actually
available.

To resolve this, first check if at least one signature is available for
a builtin before returning true.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101666
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir/spirv: Rework function argument setup
Jason Ekstrand [Thu, 29 Jun 2017 17:33:40 +0000 (10:33 -0700)]
nir/spirv: Rework function argument setup

Now that we have proper pointer types, we can be more sensible about the
way we set up function arguments and deal with the two cases of pointer
vs. SSA parameters distinctly.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
6 years agonir/spirv: Stop trying to convert pointers to SSA in glsl450
Jason Ekstrand [Sat, 1 Jul 2017 00:59:06 +0000 (17:59 -0700)]
nir/spirv: Stop trying to convert pointers to SSA in glsl450

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
6 years agonir/spirv: Use real pointer types
Jason Ekstrand [Thu, 29 Jun 2017 17:33:39 +0000 (10:33 -0700)]
nir/spirv: Use real pointer types

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
6 years agonir/spirv: Stop using glsl_type for function types
Jason Ekstrand [Thu, 29 Jun 2017 17:33:38 +0000 (10:33 -0700)]
nir/spirv: Stop using glsl_type for function types

We're going to want the full vtn_type available to us anyway at which
point glsl_type isn't really buying us anything.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
6 years agonir/spirv: Beef up the type system a bit
Jason Ekstrand [Thu, 29 Jun 2017 17:33:37 +0000 (10:33 -0700)]
nir/spirv: Beef up the type system a bit

This adds a vtn concept of base_type as well as a couple of other
fields.  This lets us be a tiny bit more efficient in some cases but,
more importantly, it will eventually let us express things the GLSL type
system can't.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
6 years agonir/spirv: Compact vtn_type
Jason Ekstrand [Thu, 29 Jun 2017 17:33:36 +0000 (10:33 -0700)]
nir/spirv: Compact vtn_type

Use an anonymous union of structs to help keep the structure small and
better organized.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
6 years agonir/spirv: Simplify type copying
Jason Ekstrand [Thu, 29 Jun 2017 17:33:35 +0000 (10:33 -0700)]
nir/spirv: Simplify type copying

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>