mesa.git
7 years agoa5xx: update headers
Ilia Mirkin [Tue, 4 Jul 2017 04:24:05 +0000 (00:24 -0400)]
a5xx: update headers

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Acked-by: Rob Clark <robdclark@gmail.com>
7 years agogallium/radeon: attempt to fix a compiler failure in radeon_winsys.h
Marek Olšák [Tue, 4 Jul 2017 20:40:09 +0000 (22:40 +0200)]
gallium/radeon: attempt to fix a compiler failure in radeon_winsys.h

trivial.

7 years agowinsys/amdgpu: use 128KB BOs for suballocations of up to 64KB BOs
Marek Olšák [Tue, 27 Jun 2017 19:54:20 +0000 (21:54 +0200)]
winsys/amdgpu: use 128KB BOs for suballocations of up to 64KB BOs

This decreases the number of BOs, but might also increase memory usage.
It's better for small textures.

The gameplay is on the far right:
https://people.freedesktop.org/~mareko/suballoc.svg

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/radeon: allow suballocating textures
Marek Olšák [Tue, 27 Jun 2017 18:32:37 +0000 (20:32 +0200)]
gallium/radeon: allow suballocating textures

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/radeon: generalize the function for in-place texture reallocation
Marek Olšák [Tue, 27 Jun 2017 18:12:25 +0000 (20:12 +0200)]
gallium/radeon: generalize the function for in-place texture reallocation

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/radeon: add radeon_winsys::buffer_is_suballocated
Marek Olšák [Tue, 27 Jun 2017 18:27:29 +0000 (20:27 +0200)]
gallium/radeon: add radeon_winsys::buffer_is_suballocated

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/radeon: clean up pb_cache bucket/usage determination
Marek Olšák [Thu, 29 Jun 2017 16:49:48 +0000 (18:49 +0200)]
gallium/radeon: clean up pb_cache bucket/usage determination

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/radeon: enable suballocations for VRAM with no CPU access
Marek Olšák [Thu, 29 Jun 2017 16:33:05 +0000 (18:33 +0200)]
gallium/radeon: enable suballocations for VRAM with no CPU access

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/radeon: clean up (domain, flags) <-> (slab heap) translations
Marek Olšák [Thu, 29 Jun 2017 16:01:16 +0000 (18:01 +0200)]
gallium/radeon: clean up (domain, flags) <-> (slab heap) translations

This is cleaner, and we are down to 4 slabs.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/radeon: remove RADEON_FLAG_CPU_ACCESS
Marek Olšák [Thu, 29 Jun 2017 15:09:04 +0000 (17:09 +0200)]
gallium/radeon: remove RADEON_FLAG_CPU_ACCESS

https://lists.freedesktop.org/archives/amd-gfx/2017-June/010591.html

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/radeon: disallow exports of sparse and suballocated BOs
Marek Olšák [Tue, 27 Jun 2017 17:32:48 +0000 (19:32 +0200)]
gallium/radeon: disallow exports of sparse and suballocated BOs

I think it's unsafe, because the slabs can reuse exported storage.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/radeon: clean up r600_texture_get_handle
Marek Olšák [Tue, 27 Jun 2017 17:40:09 +0000 (19:40 +0200)]
gallium/radeon: clean up r600_texture_get_handle

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/radeon: rename RADEON_FLAG_HANDLE -> RADEON_FLAG_NO_SUBALLOC
Marek Olšák [Tue, 27 Jun 2017 17:37:43 +0000 (19:37 +0200)]
gallium/radeon: rename RADEON_FLAG_HANDLE -> RADEON_FLAG_NO_SUBALLOC

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/radeon: fix a possible crash for buffer exports
Marek Olšák [Tue, 27 Jun 2017 17:24:20 +0000 (19:24 +0200)]
gallium/radeon: fix a possible crash for buffer exports

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/radeon: ignore PIPE_BIND_SHARED for buffers
Marek Olšák [Tue, 27 Jun 2017 17:21:29 +0000 (19:21 +0200)]
gallium/radeon: ignore PIPE_BIND_SHARED for buffers

BO exports can't be predicted this way.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: add a HUD query for getting an average GFX BO list size
Marek Olšák [Thu, 29 Jun 2017 17:20:06 +0000 (19:20 +0200)]
radeonsi: add a HUD query for getting an average GFX BO list size

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: release EGLImage on EGLImageTarget* error
Philipp Zabel [Fri, 30 Jun 2017 08:39:53 +0000 (10:39 +0200)]
st/mesa: release EGLImage on EGLImageTarget* error

The smapi->get_egl_image() call in st_egl_image_get_surface() stores a
reference to the EGLImage's texture in stimg.texture. That reference is
released via pipe_resource_reference(&stimg.texture, NULL) before stimg
goes out of scope at the end of the function, but not in the error path
if !is_format_supported().

Fixes: 83e9de25f325 ("st/mesa: EGLImageTarget* error handling")
Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agovc4: automake: include vc4_cl_dump.h in
Juan A. Suarez Romero [Mon, 3 Jul 2017 11:04:30 +0000 (11:04 +0000)]
vc4: automake: include vc4_cl_dump.h in

Ensure vc4_cl_dump.h and $(BROADCOM_FILES) are distributed in the
dist-file.

This fixes `make distcheck`

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agost/mesa: fix tessellation shaders with no support for shareable shaders
Marek Olšák [Sat, 1 Jul 2017 14:05:48 +0000 (16:05 +0200)]
st/mesa: fix tessellation shaders with no support for shareable shaders

Broken by: b43c887a9bf1e3fb99b0dc22bfea5db81375a06e

Reported by Gert Wollny.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradv: enable Int64 capability (v2)
Dave Airlie [Wed, 15 Feb 2017 04:58:48 +0000 (04:58 +0000)]
radv: enable Int64 capability (v2)

I'm not 100% sure this is all wired up but it looks like it is.

v2: actually enable extension.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
7 years agoac/nir: fix 64-bit shifts
Connor Abbott [Sat, 1 Jul 2017 02:10:43 +0000 (19:10 -0700)]
ac/nir: fix 64-bit shifts

NIR always makes the shift amount 32 bits, but LLVM asserts if the two
sources aren't the same type. Zero-extend the shift amount to make LLVM
happy.

Signed-off-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
7 years agoac/nir: implement 64-bit packing and unpacking
Connor Abbott [Wed, 7 Jun 2017 21:16:31 +0000 (14:16 -0700)]
ac/nir: implement 64-bit packing and unpacking

We implement the split opcodes, and tell NIR to lower the original ones.
The lowering to LLVM is a little more complicated, but NIR can optimize
the split ones a little better, and some NIR lowering passes that we
might want to use (particularly for doubles) emit the split ones.

This should fix pack/unpackDouble2x32, which seems like a bug since when
we enabled the Float64 capability. It will also fix pack/unpackInt2x32
when we enable the Int64 capability.

Fixes: 798ae37c ("radv: Enable Float64 support.")
Signed-off-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
7 years agospirv: fix OpBitcast when the src and dst bitsize are different (v3)
Connor Abbott [Wed, 7 Jun 2017 21:12:05 +0000 (14:12 -0700)]
spirv: fix OpBitcast when the src and dst bitsize are different (v3)

Before, we were just implementing it with a move, which is incorrect
when the source and destination have different bitsizes. To implement
it properly, we need to use the 64-bit pack/unpack opcodes. Since
glslang uses OpBitcast to implement packInt2x32 and unpackInt2x32, this
should fix them on anv (and radv once we enable the int64 capability).

v2: make supporting non-32/64 bit easier (Jason)
v3: add another assert (Jason)

Fixes: b3135c3c ("anv: Advertise shaderInt64 on Broadwell and above")
Signed-off-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agosvga: don't call svga_texture_device_format_has_alpha() for PIPE_BUFFER
Brian Paul [Fri, 30 Jun 2017 21:11:01 +0000 (14:11 -0700)]
svga: don't call svga_texture_device_format_has_alpha() for PIPE_BUFFER

svga_texture_device_format_has_alpha() is only intended to work for
texture resources, not buffer resources.  This fixes a failed assertion
in the svga_texture() cast function when running texture buffer tests.

Also, add an assertion in svga_texture_device_format_has_alpha() to
catch the issue sooner.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agosvga: fix texture buffer object regression
Brian Paul [Fri, 30 Jun 2017 21:08:49 +0000 (14:08 -0700)]
svga: fix texture buffer object regression

With change 8aba778fa2cd98a0b5a7429d3c5057778a0c808c we stopped binding
sampler objects for texture buffers.  That broke our texture sample /
sampler view setup code.

Now, we loop over the max(num samplers, num sampler views) and handle
the sampler and view information separately.  For texture buffers,
the sampler will be NULL but the sampler view non-null.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agosvga: move assertion in draw_vgpu10()
Brian Paul [Fri, 30 Jun 2017 21:07:08 +0000 (14:07 -0700)]
svga: move assertion in draw_vgpu10()

The buffer binding flags aren't ensured until after the
svga_buffer_handle() call, so move the assertion after it.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agosvga: fix buffer binding flags initialization
Brian Paul [Fri, 30 Jun 2017 21:02:20 +0000 (14:02 -0700)]
svga: fix buffer binding flags initialization

If a buffer is created/initialized with glNamedBufferData we will
have no target (GL_ARRAY_BUFFER, GL_UNIFORM_BUFFER, etc) so the
svga_buffer::bind_flags will be zero until we try to get the buffer
handle.

This patch initializes the svga_buffer::bind_flags field when it's
zero.

This fixes the Piglit arb_uniform_buffer_object-rendering-dsa test.

Note that there's still issues in this area that'll have to be
addressed in the future.  For example, creating a buffer object
as GL_UNIFORM_BUFFER and later using it as a vertex buffer will
fail.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agodocs: update bug reporting guidelines
Brian Paul [Sun, 2 Jul 2017 14:48:26 +0000 (08:48 -0600)]
docs: update bug reporting guidelines

Suggest attaching output of glxinfo/wglinfo.  Suggest providing
an apitrace.

7 years agost/mesa: remove an obsolete comment
Nicolai Hähnle [Sun, 25 Jun 2017 16:10:32 +0000 (18:10 +0200)]
st/mesa: remove an obsolete comment

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: remove unused parameter/member of add_uniform_to_shader
Nicolai Hähnle [Sat, 24 Jun 2017 10:26:46 +0000 (12:26 +0200)]
mesa: remove unused parameter/member of add_uniform_to_shader

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
7 years agoutil/disk_cache: fix a comment
Nicolai Hähnle [Sun, 14 May 2017 22:47:36 +0000 (00:47 +0200)]
util/disk_cache: fix a comment

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoglsl: simplify disable_varying_optimizations_for_sso
Nicolai Hähnle [Sun, 11 Jun 2017 10:48:52 +0000 (12:48 +0200)]
glsl: simplify disable_varying_optimizations_for_sso

We always have stage == first and stage == last when first == last, so
drop the special case. Also rephrase the comment to make the logic
clearer.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
7 years agoglsl: always print non-zero var->data.location_frac
Nicolai Hähnle [Wed, 14 Jun 2017 10:42:28 +0000 (12:42 +0200)]
glsl: always print non-zero var->data.location_frac

This is helpful in debugging varying assignments.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
7 years agowinsys/radeon: only call pb_slabs_reclaim when slabs are actually used
Nicolai Hähnle [Tue, 27 Jun 2017 07:50:32 +0000 (09:50 +0200)]
winsys/radeon: only call pb_slabs_reclaim when slabs are actually used

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100242
Fixes: fb827c055cb1 ("winsys/radeon: enable buffer allocation from slabs")
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoanv: check support for enabled features in vkCreateDevice()
Samuel Iglesias Gonsálvez [Wed, 28 Jun 2017 13:52:34 +0000 (15:52 +0200)]
anv: check support for enabled features in vkCreateDevice()

From Vulkan spec, 4.2.1. "Device Creation":

  "vkCreateDevice verifies that extensions and features requested in
   the ppEnabledExtensionNames and pEnabledFeatures members of
   pCreateInfo, respectively, are supported by the implementation."

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@gmail.com>
7 years agoanv: merge tessellation's primitive mode in merge_tess_info()
Samuel Iglesias Gonsálvez [Wed, 28 Jun 2017 07:39:55 +0000 (09:39 +0200)]
anv: merge tessellation's primitive mode in merge_tess_info()

SPIR-V tessellation shaders that were created from HLSL will have
the primitive generation domain set in tessellation control shader
(hull shader in HLSL) instead of the tessellation evaluation shader.

v2:
- Add assert (Kenneth)

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoswr: Limit memory held by defer deleted resources.
Bruce Cherniak [Sat, 1 Jul 2017 03:24:46 +0000 (22:24 -0500)]
swr: Limit memory held by defer deleted resources.

This patch limits the number of items on the fence work queue (the
deferred deletion list) by submitting a sync fence when the queue size
exceeds a threshold.  This initiates deferred deletion of all resources
on the list and decreases the total amount of memory held waiting for
"deferred deletion".

This resolves  bug 101467 filed against swr for the piglit
streaming-texture-leak test.  For those running on smaller memory
(16GB?) systems, this will prevent oom-killer.

Thus far, we have not seen any real world applications that exhibit
behavior like the streaming-texture-leak test; as any form of pipeline
flush will trigger the defer queue and properly free any retained
allocations.  But, this addresses those as well.

Cc: "17.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
7 years agoanv: fix reported timestampPeriod value
Lionel Landwerlin [Sat, 1 Jul 2017 23:23:29 +0000 (00:23 +0100)]
anv: fix reported timestampPeriod value

We lost some precision on a previous change due to switching to
integers. Since we report a float in timestampPeriod, we want the
division to happen in floats.

CID: 1413021
Fixes: c77d98ef32 ("intel: common: express timestamps units in frequency")
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agointel: genxml: make a couple of enums show up in aubinator
Lionel Landwerlin [Fri, 30 Jun 2017 16:25:43 +0000 (17:25 +0100)]
intel: genxml: make a couple of enums show up in aubinator

In particular Shader Channel Select & Texture Address Control Mode.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
7 years agoi965: Print access flags in INTEL_DEBUG=buf output.
Kenneth Graunke [Sat, 1 Jul 2017 04:16:00 +0000 (21:16 -0700)]
i965: Print access flags in INTEL_DEBUG=buf output.

Being able to see the access mode of various mappings is incredibly
useful for debugging.  With this patch, INTEL_DEBUG=buf now shows
data such as:

   bo_create: buf 7 (bufferobj) 640b
   bo_map_gtt: 7 (bufferobj) -> 0x7fca1fae5000, WRITE ASYNC
   brw_bo_map_cpu: 7 (bufferobj) -> 0x7fca1fae4000, READ
   bo_map_gtt: 5 (bufferobj) -> 0x7fca1fad4000, WRITE ASYNC
   brw_bo_map_cpu: 7 (bufferobj) -> 0x7fca1fae4000, READ

which makes it easy to see that there are async GTT writes with
intervening CPU reads.

Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoi965: Remove clearing of bo->map_gtt after failure
Chris Wilson [Sat, 1 Jul 2017 10:14:00 +0000 (11:14 +0100)]
i965: Remove clearing of bo->map_gtt after failure

With the conversion to storing the result of drm_mmap to a local and not
directly to bo->map_gtt itself, we no longer should clear bo->map_gtt.
In the best the operation is redundant as we know bo->map_gtt to already
be NULL, but in the worst case we overwrite a concurrent thread that
successfully mmaped the GTT.

Fixes: 314647c4c206 ("i965: Drop global bufmgr lock from brw_bo_map_* functions.")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Add inline to brw_bo_unmap
Kenneth Graunke [Sat, 1 Jul 2017 03:33:57 +0000 (20:33 -0700)]
i965: Add inline to brw_bo_unmap

I meant to do this in "i965: Make brw_bo_unmap a static inline."
but botched the commit fixup.

7 years agoi965: Drop global bufmgr lock from brw_bo_map_* functions.
Chris Wilson [Fri, 30 Jun 2017 21:21:54 +0000 (14:21 -0700)]
i965: Drop global bufmgr lock from brw_bo_map_* functions.

After removing the unusuable debugging code in the previous commit, we
can also entirely remove the global mutex around mapping the buffer for
the first time and replace it with a single atomic operation to update
the cache once we retrieve the mmap.

v2 (Ken): Split out from Chris's original commit.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoi965: Make brw_bo_unmap a static inline.
Kenneth Graunke [Fri, 30 Jun 2017 21:05:21 +0000 (14:05 -0700)]
i965: Make brw_bo_unmap a static inline.

With the broken debugging code gone, it doesn't do anything anymore.
We could technically eliminate it, but I'd like to keep it around in
case we want to add something there again someday.  Otherwise we'd
have to go all over the codebase adding unmap calls back again.

Based on a patch by Chris Wilson.

Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoi965: Discard bo->map_count
Chris Wilson [Tue, 20 Jun 2017 10:57:34 +0000 (11:57 +0100)]
i965: Discard bo->map_count

Supposedly we were keeping a reference count for the number of users of
a mapping so that we could use valgrind to detect access to the map
outside of the valid section. However, we were incrementing the counter
only when first creating the cached mapping but decrementing on every
unmap. The bo->map_count tracking was wrong and so the debugging code
was completely useless.

v2 (Ken): Separate out atomic compare and swap optimization.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoi965: Add a comment about not needing VALGRIND_MALLOCLIKE_BLOCK.
Kenneth Graunke [Fri, 30 Jun 2017 21:00:01 +0000 (14:00 -0700)]
i965: Add a comment about not needing VALGRIND_MALLOCLIKE_BLOCK.

At first glance this seems missing, since we handle it manually for CPU
and WC maps.  Although a bit inconsistent, it's actually not necessary.

Thanks to Chris Wilson for explaining this to me.

Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoradv: Use v4i32 variant of llvm.SI.load.const.
Bas Nieuwenhuizen [Fri, 30 Jun 2017 19:03:40 +0000 (21:03 +0200)]
radv: Use v4i32 variant of llvm.SI.load.const.

We apparently still used v16i8 ....

As radeonsi doesn't use it with LLVM version checks I don't think
we need them either.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agosvga: add texture size/levels sanity check code in svga_texture_create()
Brian Paul [Tue, 27 Jun 2017 15:51:25 +0000 (09:51 -0600)]
svga: add texture size/levels sanity check code in svga_texture_create()

The state tracker should never ask us to create a texture with invalid
dimensions / mipmap levels.  Do some assertions to check that.

No Piglit regressions.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agost/mesa: fix texture image resource selection in st_render_texture()
Brian Paul [Tue, 27 Jun 2017 15:36:19 +0000 (09:36 -0600)]
st/mesa: fix texture image resource selection in st_render_texture()

If we're rendering to an incomplete/inconsistent (cube) texture, the
different faces/levels of the texture may be stored in different
resources.  Before, we always used the texture object resource.  Now,
we use the texture image resource.  In normal circumstances, that's
the same resource.  But in some cases, such as the Piglit
fbo-incomplete-texture-03 test, the cube faces are in different
resources and we need to render to the texture image resource.

Fixes fbo-incomplete-texture-03 with VMware driver.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
7 years agost/mesa: check for incomplete texture in st_finalize_texture()
Brian Paul [Tue, 27 Jun 2017 15:29:18 +0000 (09:29 -0600)]
st/mesa: check for incomplete texture in st_finalize_texture()

Return early from st_finalize_texture() if we have an incomplete
texture.  This avoids trying to create a texture resource with invalid
parameters (too many mipmap levels given the base dimension).

Specifically, the Piglit fbo-incomplete-texture-03 test winds up
calling pipe_screen::resource_create() with width0=32, height0=32 and
last_level=6 because the first five cube faces are 32x32 but the sixth
face is 64x64.  Some drivers handle this, but others (like VMware svga)
do not (generates device errors).

Note that this code is on the path that's usually not taken (we normally
build consistent textures).

No Piglit regressions.

v2: only need to check for base-level completeness since that's what has to
be consistent in order to specify the dimensions for a new gallium texture.
Per Roland.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
7 years agogallium/docs: document that TXF is used with PIPE_BUFFER resources
Brian Paul [Fri, 30 Jun 2017 15:23:43 +0000 (09:23 -0600)]
gallium/docs: document that TXF is used with PIPE_BUFFER resources

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
7 years agogallium/docs: clarify that samplers are not used with PIPE_BUFFER resources
Brian Paul [Fri, 30 Jun 2017 15:23:17 +0000 (09:23 -0600)]
gallium/docs: clarify that samplers are not used with PIPE_BUFFER resources

Commit 8aba778fa2cd98a0b5a7429d3c5057778a0c808c "st/mesa: don't set
sampler states for TBOs" changed how texture buffer objects are handled.
Document the new convention.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
7 years agovc4: Start using XML unpack functions in CL dump.
Eric Anholt [Fri, 16 Dec 2016 19:00:46 +0000 (11:00 -0800)]
vc4: Start using XML unpack functions in CL dump.

For now this is a no-op on the output, but it makes it clear that we've
had weird things going on with things like
V3D21_CLIPPER_Z_SCALE_AND_OFFSET.

7 years agovc4: Replace a couple of magic numbers with #define usage.
Eric Anholt [Mon, 6 Feb 2017 22:29:30 +0000 (14:29 -0800)]
vc4: Replace a couple of magic numbers with #define usage.

7 years agovc4: Move rasterizer state packing to CSO creation time.
Eric Anholt [Mon, 6 Feb 2017 22:06:12 +0000 (14:06 -0800)]
vc4: Move rasterizer state packing to CSO creation time.

This gets our vc4_emit.c size back down a bit:

before:
   1020       0       0    1020     3fc src/gallium/drivers/vc4/.libs/vc4_emit.o

after:
    968       0       0     968     3c8 src/gallium/drivers/vc4/.libs/vc4_emit.o

7 years agovc4: Convert the driver to emitting the shader record using pack macros.
Eric Anholt [Sat, 10 Dec 2016 23:47:26 +0000 (15:47 -0800)]
vc4: Convert the driver to emitting the shader record using pack macros.

7 years agovc4: Simplify pack header usage
Eric Anholt [Sun, 11 Dec 2016 22:59:17 +0000 (14:59 -0800)]
vc4: Simplify pack header usage

Take the CL pointer in, which will be useful for enabling relocs.
However, our code expands a bit more:

before:
   4449       0       0    4449    1161 src/gallium/drivers/vc4/.libs/vc4_draw.o
    988       0       0     988     3dc src/gallium/drivers/vc4/.libs/vc4_emit.o

after:
   4481       0       0    4481    1181 src/gallium/drivers/vc4/.libs/vc4_draw.o
   1020       0       0    1020     3fc src/gallium/drivers/vc4/.libs/vc4_emit.o

7 years agovc4: Start using the pack header.
Eric Anholt [Wed, 26 Oct 2016 19:46:58 +0000 (12:46 -0700)]
vc4: Start using the pack header.

This slightly inflates the size of the generated code, in exchange for
getting us some convenient tools.

before:
   4389       0       0    4389    1125 src/gallium/drivers/vc4/.libs/vc4_draw.o
    808       0       0     808     328 src/gallium/drivers/vc4/.libs/vc4_emit.o

after:
   4449       0       0    4449    1161 src/gallium/drivers/vc4/.libs/vc4_draw.o
    988       0       0     988     3dc src/gallium/drivers/vc4/.libs/vc4_emit.o

7 years agovc4: Introduce XML-based packet header generation like Intel's.
Eric Anholt [Wed, 26 Oct 2016 17:14:37 +0000 (10:14 -0700)]
vc4: Introduce XML-based packet header generation like Intel's.

I really liked this idea, as it should help with management of packet
parsing tools like the CL dump.  The python script is forked off of theirs
because our packets are byte-based instead of dwords, and the changes to
do so while avoiding performance regressions due to unaligned accesses
were quite invasive.

v2: Fix Android.mk paths, drop shebang for python script, fix overlap
    detection.

Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Rob Herring <robh@kernel.org>
7 years agoswr: Minor cleanup of variable usage, no functional change.
Bruce Cherniak [Thu, 29 Jun 2017 19:41:31 +0000 (14:41 -0500)]
swr: Minor cleanup of variable usage, no functional change.

In swr_update_derived, for consistency, index buffer validation should
be using the p_draw_info copy "info" rather than referencing
p_draw_info.

No functional change.

Reviewed-by: Tim Rowley <timothy.o.rowley@intel.com>
7 years agoswr: use swr_query_result type instead of void
Tim Rowley [Fri, 30 Jun 2017 16:50:22 +0000 (11:50 -0500)]
swr: use swr_query_result type instead of void

Tag pStat field in swr_draw_context structure so gen_llvm_types.py
can deal with the actual structure type instead of using void.

Code cleanup, no functional change.

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
7 years agoswr/rast: increase number of possible draws in flight
Tim Rowley [Wed, 21 Jun 2017 19:57:10 +0000 (14:57 -0500)]
swr/rast: increase number of possible draws in flight

Increases performance of some large workloads on KNL by ~30%.

Reviewed-by: Bruce Cherniak <bruce.cherniak at intel.com>
7 years agoswr/rast: move default split size from driver to rasterizer
Tim Rowley [Wed, 21 Jun 2017 19:56:24 +0000 (14:56 -0500)]
swr/rast: move default split size from driver to rasterizer

Reviewed-by: Bruce Cherniak <bruce.cherniak at intel.com>
7 years agoswr/rast: Fix missing setup of psContext.pColorBuffer
Tim Rowley [Mon, 19 Jun 2017 17:14:15 +0000 (12:14 -0500)]
swr/rast: Fix missing setup of psContext.pColorBuffer

Fixes render target read access from pixel shaders.

Reviewed-by: Bruce Cherniak <bruce.cherniak at intel.com>
7 years agoswr/rast: Switch intrinsic usage to SIMDLib
Tim Rowley [Thu, 15 Jun 2017 20:24:07 +0000 (15:24 -0500)]
swr/rast: Switch intrinsic usage to SIMDLib

Switch from a macro-based simd intrinsics layer to a more C++
implementation, which also adds AVX512 optimizations to 128-bit
and 256-bit SIMD.

Reviewed-by: Bruce Cherniak <bruce.cherniak at intel.com>
7 years agoscons: allow .inl file extension
Tim Rowley [Tue, 27 Jun 2017 15:47:28 +0000 (10:47 -0500)]
scons: allow .inl file extension

Intended for header files which are not meant to be included directly.

Reviewed-by: Bruce Cherniak <bruce.cherniak at intel.com>
7 years agoswr/rast: Fix unused variable warnings
Tim Rowley [Wed, 14 Jun 2017 19:40:28 +0000 (14:40 -0500)]
swr/rast: Fix unused variable warnings

Reviewed-by: Bruce Cherniak <bruce.cherniak at intel.com>
7 years agoswr/rast: Split rasterizer.cpp to improve compile time
Tim Rowley [Mon, 26 Jun 2017 17:41:38 +0000 (12:41 -0500)]
swr/rast: Split rasterizer.cpp to improve compile time

Hardcode split to four files currently.  Decreases swr build
time on KNL by over 50%.

Reviewed-by: Bruce Cherniak <bruce.cherniak at intel.com>
7 years agoswr/rast: gen_backends.py remove extraneous semicolon
Tim Rowley [Mon, 26 Jun 2017 17:40:45 +0000 (12:40 -0500)]
swr/rast: gen_backends.py remove extraneous semicolon

Reviewed-by: Bruce Cherniak <bruce.cherniak at intel.com>
7 years agoswr/rast: Support dynamically sized vertex layout
Tim Rowley [Mon, 12 Jun 2017 23:43:49 +0000 (18:43 -0500)]
swr/rast: Support dynamically sized vertex layout

Each shader stage state (VS, TS, GS, SO, BE/CLIP) now has a
vertexAttribOffset to specify the offset to the start of the
general attribute section of the incoming verts for that stage.
It is up to the driver to set this up correctly based on the
active stages. All the shader stages use this value instead of
VERTEX_ATTRIB_START_SLOT to offset to the incoming attributes.

Only the vertex shader stage supports dynamic layout output
currently. The other stages continue to expect the output to be
the fixed layout slots as before. Will be enabling GS next.

Reviewed-by: Bruce Cherniak <bruce.cherniak at intel.com>
7 years agoswr/rast: Split backend.cpp to improve compile time
Tim Rowley [Mon, 26 Jun 2017 18:00:27 +0000 (13:00 -0500)]
swr/rast: Split backend.cpp to improve compile time

Hardcode split to four files currently.  Decreases swr build
time on a quad-core by ~10%.

Reviewed-by: Bruce Cherniak <bruce.cherniak at intel.com>
7 years agoswr/rast: gen_backends.py removal of commented debug prints
Tim Rowley [Mon, 26 Jun 2017 17:59:28 +0000 (12:59 -0500)]
swr/rast: gen_backends.py removal of commented debug prints

Reviewed-by: Bruce Cherniak <bruce.cherniak at intel.com>
7 years agoswr/rast: gen_backends.py quote cleanup
Tim Rowley [Mon, 26 Jun 2017 17:43:49 +0000 (12:43 -0500)]
swr/rast: gen_backends.py quote cleanup

Reviewed-by: Bruce Cherniak <bruce.cherniak at intel.com>
7 years agoswr/rast: generators will create target directories
Tim Rowley [Mon, 26 Jun 2017 17:34:24 +0000 (12:34 -0500)]
swr/rast: generators will create target directories

Reviewed-by: Bruce Cherniak <bruce.cherniak at intel.com>
7 years agodocs: update calendar, add news item and link release notes for 17.1.4
Andres Gomez [Fri, 30 Jun 2017 17:37:52 +0000 (20:37 +0300)]
docs: update calendar, add news item and link release notes for 17.1.4

Signed-off-by: Andres Gomez <agomez@igalia.com>
7 years agodocs: add sha256 checksums for 17.1.4
Andres Gomez [Fri, 30 Jun 2017 17:31:44 +0000 (20:31 +0300)]
docs: add sha256 checksums for 17.1.4

Signed-off-by: Andres Gomez <agomez@igalia.com>
(cherry picked from commit 5a24aa8c55c2b7893d50a4a203f14300d4ecab87)

7 years agodocs: add release notes for 17.1.4
Andres Gomez [Fri, 30 Jun 2017 17:11:50 +0000 (20:11 +0300)]
docs: add release notes for 17.1.4

Signed-off-by: Andres Gomez <agomez@igalia.com>
(cherry picked from commit e60d010ef41f049df84d683a6465d1e5bf0cbb3d)

7 years agoAndroid: fix typo in symlink for driver loading and 32 bit builds
Mauro Rossi [Fri, 30 Jun 2017 06:54:34 +0000 (08:54 +0200)]
Android: fix typo in symlink for driver loading and 32 bit builds

There is typo in the mkdir command path,
the correct one is $(TARGET_OUT)/$(l)/$(MESA_DRI_MODULE_REL_PATH)

The other issue is in 32bit builds, because lib64 does not exist there,
we can use TARGET_IS_64_BIT to refine the post install command.

Fixes: a3d98ca62f ("Android: use symlinks for driver loading")
Signed-off-by: Rob Herring <robh@kernel.org>
7 years agosvga: update a few surface format names
Brian Paul [Wed, 28 Jun 2017 22:43:52 +0000 (16:43 -0600)]
svga: update a few surface format names

To sync with in-house changes.

Reviewed-by: Neha Bhende <bhenden@vmware.com>
7 years agosvga: whitespace fixes in svga_resource_buffer_upload.c
Brian Paul [Tue, 27 Jun 2017 21:55:10 +0000 (15:55 -0600)]
svga: whitespace fixes in svga_resource_buffer_upload.c

Trivial.

7 years agosvga: add mksstats for surface view emulation
Charmaine Lee [Tue, 27 Jun 2017 16:59:55 +0000 (10:59 -0600)]
svga: add mksstats for surface view emulation

Add mksstats for surface view emulation and also tighten the stat
CreateBackedView for the actual creation of backed view.

Reviewed-by: Brian Paul <brianp@vmware.com>
7 years agosvga: change error handling convention for svga_set_stream_output()
Brian Paul [Thu, 22 Jun 2017 20:45:07 +0000 (14:45 -0600)]
svga: change error handling convention for svga_set_stream_output()

In general, the functions which emit commands to the command buffer check
for failure and return a PIPE_ERROR_x code.  It's up to the caller to
flush the buffer and retry the command.

But svga_set_stream_output() did its own flushing and the callers never
checked the return value (though, it would always be PIPE_OK) in practice.

This patch changes svga_set_stream_output() so that it does not call
svga_context_flush() when the buffer is full.  And we update the callers
to check the return value as we do for other functions, like
svga_set_shader().

No Piglit regressions.  Also tested w/ Nature demo.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agosvga: fixed surface size to include array size
Charmaine Lee [Tue, 6 Jun 2017 18:52:50 +0000 (11:52 -0700)]
svga: fixed surface size to include array size

This patch fixes the total surface size in surface cache
to include array size as well.

Tested with MTT glretrace.

Reviewed-by: Brian Paul <brianp@vmware.com>
7 years agosvga: loop over box.depth for ReadBack_image on each slice
Neha Bhende [Thu, 27 Oct 2016 19:35:03 +0000 (12:35 -0700)]
svga: loop over box.depth for ReadBack_image on each slice

piglit test ext_texture_array-gen-mipmap is fixed with this patch.

Tested with mtt piglit, glretrace, viewperf and conform. No regression.

Reviewed-by: Brian Paul <brianp@vmware.com>
7 years agosvga: add mksstats for context creation
Charmaine Lee [Tue, 8 Nov 2016 19:54:56 +0000 (11:54 -0800)]
svga: add mksstats for context creation

Reviewed-by: Brian Paul <brianp@vmware.com>
7 years agosvga: re-validate sampler view at draw time if needed
Charmaine Lee [Tue, 27 Jun 2017 16:47:01 +0000 (10:47 -0600)]
svga: re-validate sampler view at draw time if needed

This patch validates those sampler views with backing copy
of texture whose original copy has been updated since the
view is last validated.
This is done here at draw time because the texture binding might not
have modified, hence validation is not triggered at state update time,
and yet the texture might have been updated in another context, so
we need to re-validate the sampler view in order to update the backing
copy of the updated texture.

This fixes a rendering flickering issue with Photoshop running in
Linux VM with HWversion 11. The problem is Photoshop renders to texture A
in context X, and then bind texture A to context Y. The first time
when texture A is bound to context Y, cso calls pipe->set_sampler_views().
Validation of sampler views is done, rendering is fine.
But when texture A is rendered to again in context X, and rebound in
context Y, cso skips pipe->set_sampler_views() because texture A is already
bound in context Y. SVGA driver is not given a chance to re-validate
the texture binding, the backing copy of the texture is not updated,
and hence causes black image.

Tested with Photoshop, MTT glretrace, piglit.
Fixes VMware bug 1769103.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
7 years agoautomake: include git_sha1_gen.sh into EXTRA_DIST
Juan A. Suarez Romero [Fri, 30 Jun 2017 11:23:57 +0000 (11:23 +0000)]
automake: include git_sha1_gen.sh into EXTRA_DIST

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoUpdate Khronos-supplied headers
Nicolai Hähnle [Sat, 10 Jun 2017 18:46:27 +0000 (20:46 +0200)]
Update Khronos-supplied headers

Taken from commit 676834dd529d620ee25090e738d2607dfde003d8
of https://github.com/KhronosGroup/OpenGL-Registry.git

v2:
- keep the BUILDING_MESA bits (Matt)

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoi965/i915: Add UYVY as the supported format
Johnson Lin [Fri, 16 Jun 2017 05:51:34 +0000 (13:51 +0800)]
i965/i915: Add UYVY as the supported format

Trigger the correct sampler options for it. Similar with YUYV

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
7 years agonir: Add a lowering pass for UYVY textures
Johnson Lin [Fri, 16 Jun 2017 05:40:31 +0000 (13:40 +0800)]
nir: Add a lowering pass for UYVY textures

Similar with support for YUYV but with byte order difference in sampler

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
7 years agodri: Add UYVY as available format
Johnson Lin [Fri, 16 Jun 2017 05:34:02 +0000 (13:34 +0800)]
dri: Add UYVY as available format

UYVY is diffrent with YUYV in byte order.
YUYV is already declared in dri_interface.h,
this CL add the difinitions for UYVY.
Drivers can add UYVY as supported format

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
7 years agogbm: add XBGR8888 support for dumb buffers
Rob Herring [Wed, 28 Jun 2017 21:52:29 +0000 (17:52 -0400)]
gbm: add XBGR8888 support for dumb buffers

Add GBM_FORMAT_XBGR8888 format support which is needed for Android.

Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agogallium: os_process fixes for Android
Rob Herring [Wed, 28 Jun 2017 21:52:28 +0000 (17:52 -0400)]
gallium: os_process fixes for Android

The function getprogname() is available on Android, since it reuses
various BSD solutions C runtime.

Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoetnaviv: Add unreachable statement to etna_amode to fix compilation warnings
Tomeu Vizoso [Wed, 28 Jun 2017 21:52:27 +0000 (17:52 -0400)]
etnaviv: Add unreachable statement to etna_amode to fix compilation warnings

Signed-off-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoswr: Remove need to allocate vertex buffer scratch space all in one go
Bruce Cherniak [Wed, 28 Jun 2017 18:42:03 +0000 (13:42 -0500)]
swr: Remove need to allocate vertex buffer scratch space all in one go

Deferred deletion (via "fence_work") has obsoleted the need to allocate
all client vertex buffer scratch space in a single chunk.  Scratch
allocations are now valid until the referenced fence is complete.

Reviewed-by: Tim Rowley <timothy.o.rowley@intel.com>
7 years agoswr: conditionally validate vertex buffer state
Bruce Cherniak [Tue, 27 Jun 2017 22:49:06 +0000 (17:49 -0500)]
swr: conditionally validate vertex buffer state

Vertex buffer state doesn't need to be validated on every call,
only on dirty _NEW_VERTEX or indexed draws.

Unconditional validation was introduced as part of patch 330d0607ed6,
"remove pipe_index_buffer and set_index_buffer", with the expectation
we'd optimize later.

Reviewed-by: Tim Rowley <timothy.o.rowley@intel.com>
7 years agoswr: set dynamic vertex size
Tim Rowley [Wed, 28 Jun 2017 14:54:32 +0000 (09:54 -0500)]
swr: set dynamic vertex size

Reduces the memory footprint of the frontend processing by packing
vertices.

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
7 years agoscons: wait on subprocess' completion
Eric Engestrom [Thu, 29 Jun 2017 16:21:44 +0000 (17:21 +0100)]
scons: wait on subprocess' completion

Windows doesn't allow you to move a file that's opened, and Popen()
doesn't wait on its subprocess' completion before returning, which leads
to broken Windows build.

Fixes: 3fd425aed764fb771f2f "build systems: uniformize git_sha1.h generation"
Suggested-by: Scott D Phillips <scott.d.phillips@intel.com>
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agobuild systems: uniformize git_sha1.h generation
Eric Engestrom [Tue, 27 Jun 2017 11:08:41 +0000 (12:08 +0100)]
build systems: uniformize git_sha1.h generation

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoradeonsi: set COMPUTE_DISPATCH_INITIATOR.ORDER_MODE = 1
Marek Olšák [Tue, 27 Jun 2017 15:33:54 +0000 (17:33 +0200)]
radeonsi: set COMPUTE_DISPATCH_INITIATOR.ORDER_MODE = 1

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>