Commit Graph

93860 Commits

Author SHA1 Message Date
Emil Velikov 432f8bff5a 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>
2017-07-12 15:45:30 +01:00
Emil Velikov 4506a74cc6 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>
2017-07-12 15:45:27 +01:00
Emil Velikov 962110fa57 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>
2017-07-12 15:44:26 +01:00
Emil Velikov a2ae8e6076 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>
2017-07-12 15:43:15 +01:00
Emil Velikov 4d8191fd00 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>
2017-07-12 15:43:12 +01:00
Emil Velikov cd859452e9 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>
2017-07-12 15:43:09 +01:00
Emil Velikov d13dcca2c2 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>
2017-07-12 15:43:05 +01:00
Emil Velikov 448f70e366 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>
2017-07-12 15:42:59 +01:00
Emil Velikov 3ee2be4113 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>
2017-07-12 15:42:54 +01:00
Emil Velikov 81e95924ea 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>
2017-07-12 15:42:51 +01:00
Emil Velikov 9365ff4b88 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>
2017-07-12 15:42:03 +01:00
Brian Paul f7e78abdf4 svga: fix texture swizzle writemasking
Commit bfe1e7737a 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>
2017-07-11 15:43:36 -06:00
Chris Wilson cead51a0c6 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>
2017-07-11 14:07:47 -07:00
Kenneth Graunke 314879f7fe 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
71651b3139.

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>
2017-07-11 13:26:53 -07:00
Kenneth Graunke 20104f1926 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>
2017-07-11 13:26:46 -07:00
Tim Rowley f50aa21456 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>
2017-07-11 13:38:20 -05:00
Tim Rowley 50cd222116 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>
2017-07-11 13:38:20 -05:00
George Kyriazis 27c5568de3 swr/rast: make SWR_VISIBLE attribute work for windows
Needed to expose SwrGetInterface

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
2017-07-11 13:37:57 -05:00
Lionel Landwerlin 9d681a7a18 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>
2017-07-11 16:14:57 +01:00
Lionel Landwerlin 384aaa4d3f 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>
2017-07-11 16:14:57 +01:00
Ben Widawsky 25c1a7cc7a 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>
2017-07-11 16:14:57 +01:00
Chris Wilson 618be8cc1a 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: c636284ee8 ("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>
2017-07-11 15:46:58 +01:00
Brian Paul bf7a4f4441 svga: s/unsigned/enum tgsi_texture_type/
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: Neha Bhende <bhenden@vmware.com>
2017-07-11 08:09:14 -06:00
Brian Paul 1d82674969 svga: s/unsigned/enum tgsi_swizzle
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: Neha Bhende <bhenden@vmware.com>
2017-07-11 08:09:14 -06:00
Brian Paul 3effacf172 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>
2017-07-11 08:09:14 -06:00
Brian Paul 9330112b35 svga: s/unsigned/enum tgsi_file_type/
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: Neha Bhende <bhenden@vmware.com>
2017-07-11 08:09:14 -06:00
Brian Paul 1b5e88becd 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>
2017-07-11 08:09:14 -06:00
Kenneth Graunke 7250cbafb9 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>
2017-07-10 15:55:34 -07:00
Chris Wilson de4c2eaa62 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>
2017-07-10 15:55:31 -07:00
Chris Wilson b532e3b4a2 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>
2017-07-10 15:55:30 -07:00
Kenneth Graunke c2c37f5185 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>
2017-07-10 15:55:26 -07:00
Kenneth Graunke 3e50607a40 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>
2017-07-10 15:55:19 -07:00
James Legg b117f59710 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>
2017-07-10 14:13:37 -07:00
Marek Olšák aaee0d1bbf 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>
2017-07-10 22:44:48 +02:00
Chris Wilson 833108ac14 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>
2017-07-10 11:18:08 -07:00
Brian Paul 3b28eaabf6 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>
2017-07-10 11:11:26 -06:00
Brian Paul f8f71cb6f3 svga: fix breakage in create_backed_surface_view()
This fixes a regression in some piglit tests since commit 5e5d5f1a2e.
I think I mis-resolved the merge conflict when cherry-picking that
commit to master.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
2017-07-10 11:11:26 -06:00
Jason Ekstrand 781263486f 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>
2017-07-10 08:55:47 -07:00
Ilia Mirkin 6c7b7aa3d8 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>
2017-07-09 18:36:13 -04:00
Dave Airlie 7b5f2e0070 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>
2017-07-09 22:21:43 +01:00
Dave Airlie edf2acbeb1 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>
2017-07-09 22:17:59 +01:00
Ilia Mirkin f3958f1644 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>
2017-07-08 21:27:44 -04:00
Ilia Mirkin ce3e2ec3b7 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>
2017-07-08 21:14:58 -04:00
Ilia Mirkin 4ad4009473 a5xx: fix border color for depth formats
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
2017-07-08 21:14:58 -04:00
Ilia Mirkin cf173b5dcd a5xx: add border color clamping, add packed border color formats
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
2017-07-08 21:14:58 -04:00
Ilia Mirkin a9b58a00bb a5xx: fix border colors for swizzled texture formats
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
2017-07-08 21:14:58 -04:00
Ilia Mirkin a4eeb0c403 a5xx: fix integer texture border colors
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
2017-07-08 21:14:58 -04:00
Ilia Mirkin 1acc101b3f a5xx: fix primitive restart
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
2017-07-08 21:14:58 -04:00
Andres Gomez e6b189351f 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>
2017-07-08 21:14:19 +03:00
Bas Nieuwenhuizen 1aba0e7f58 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>
2017-07-08 16:11:29 +02:00