mesa.git
7 years agoanv/formats: Add an anv_get_format helper
Jason Ekstrand [Mon, 16 May 2016 04:15:59 +0000 (21:15 -0700)]
anv/formats: Add an anv_get_format helper

This commit removes anv_format_for_vk_format and adds an anv_get_format
helper.  The anv_get_format helper returns the anv_format by-value.  Unlike
anv_format_for_vk_format the format returned by anv_get_format is 100%
accurate and includes any tweaks needed for tiled vs. linear.
anv_get_isl_format is now just a wrapper around anv_get_format that picks
off just the isl_format.

7 years agoanv/format: Simplify anv_format
Jason Ekstrand [Sat, 14 May 2016 00:24:39 +0000 (17:24 -0700)]
anv/format: Simplify anv_format

Now that we have VkFormat introspection and we've removed everything that
tried to use anv_format for introspection, we no longer need most of what
was in anv_format.

7 years agoanv/formats: Delete validate_GetPhysicalDeviceFormatProperties
Jason Ekstrand [Sat, 14 May 2016 00:08:16 +0000 (17:08 -0700)]
anv/formats: Delete validate_GetPhysicalDeviceFormatProperties

All it ever did was some extra logging that was useful when initially
bringing up Dota2.  We don't need it anymore.

7 years agoanv/image: Use aspects for computing full usage
Jason Ekstrand [Sat, 14 May 2016 00:00:58 +0000 (17:00 -0700)]
anv/image: Use aspects for computing full usage

7 years agoanv: Remove the anv_format member from anv_image
Jason Ekstrand [Fri, 13 May 2016 23:52:15 +0000 (16:52 -0700)]
anv: Remove the anv_format member from anv_image

7 years agoanv/wsi: Use vk_format_info for asserts rather than anv_format
Jason Ekstrand [Fri, 13 May 2016 23:55:08 +0000 (16:55 -0700)]
anv/wsi: Use vk_format_info for asserts rather than anv_format

7 years agoanv/copy: Use the linear format from the image for the buffer block size
Jason Ekstrand [Fri, 13 May 2016 23:54:00 +0000 (16:54 -0700)]
anv/copy: Use the linear format from the image for the buffer block size

Because the buffer is exposed to the user, the block size is defined to
always exactly be the size of the actual vulkan format.  This is the same
size (it had better be) as the linaer image format.

7 years agoanv/image: Stop using anv_format for image create validation
Jason Ekstrand [Fri, 13 May 2016 23:52:41 +0000 (16:52 -0700)]
anv/image: Stop using anv_format for image create validation

7 years agoanv/image: Make heavier use of aspects
Jason Ekstrand [Fri, 13 May 2016 23:47:39 +0000 (16:47 -0700)]
anv/image: Make heavier use of aspects

7 years agoanv/copy: Use the color_surf from the image to get the block size
Jason Ekstrand [Fri, 13 May 2016 21:39:40 +0000 (14:39 -0700)]
anv/copy: Use the color_surf from the image to get the block size

7 years agoanv: Change render_pass_attachment.format to a VkFormat
Jason Ekstrand [Fri, 13 May 2016 21:07:21 +0000 (14:07 -0700)]
anv: Change render_pass_attachment.format to a VkFormat

7 years agoanv: Add helpers to provide simple VkFormat introspection
Jason Ekstrand [Fri, 13 May 2016 21:05:00 +0000 (14:05 -0700)]
anv: Add helpers to provide simple VkFormat introspection

As much as I hate adding yet more format introspection, there are times
when the VkFormat is sufficient and we don't want to round-trip through
isl_format.  For these times, the new vk_format_info.c/h files provide some
simple driver-agnostic VkFormat introspection.  This intended to be
specific to Vulkan but not to any driver whatsoever.

7 years agoanv/image: Use get_isl_format when creating buffer views
Jason Ekstrand [Fri, 13 May 2016 20:39:20 +0000 (13:39 -0700)]
anv/image: Use get_isl_format when creating buffer views

7 years agoanv/image: Add an aspects field
Jason Ekstrand [Fri, 13 May 2016 19:50:11 +0000 (12:50 -0700)]
anv/image: Add an aspects field

This makes several checks easier and allows us to avoid calling
anv_format_for_vk_format in a number of cases.

7 years agoanv: Make format_for_descriptor return an isl_format
Jason Ekstrand [Fri, 13 May 2016 19:38:12 +0000 (12:38 -0700)]
anv: Make format_for_descriptor return an isl_format

7 years agoanv/wayland: Don't allow non-renderable formats
Jason Ekstrand [Mon, 16 May 2016 17:19:20 +0000 (10:19 -0700)]
anv/wayland: Don't allow non-renderable formats

7 years agoanv/wsi: Make WSI per-physical-device rather than per-instance
Jason Ekstrand [Mon, 16 May 2016 05:21:24 +0000 (22:21 -0700)]
anv/wsi: Make WSI per-physical-device rather than per-instance

This better maps to the Vulkan object model and also allows WSI to at least
know the hardware generation which is useful for format checks.

7 years agoglapi/gen: Copy some GL 1.0 enum details into ARB_viewport_array
Adam Jackson [Wed, 4 May 2016 18:32:38 +0000 (14:32 -0400)]
glapi/gen: Copy some GL 1.0 enum details into ARB_viewport_array

Otherwise the instances in the extension XML override the core
definitions, and we stop knowing their sizes in indirect_size_get.c

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
7 years agoglapi: Define PURE for Sun Studio as well
Adam Jackson [Wed, 4 May 2016 18:14:56 +0000 (14:14 -0400)]
glapi: Define PURE for Sun Studio as well

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
7 years agoglapi/glx: Mark byteswap functions as _X_UNUSED (v2)
Adam Jackson [Thu, 24 Mar 2016 17:57:58 +0000 (13:57 -0400)]
glapi/glx: Mark byteswap functions as _X_UNUSED (v2)

Squashes the one remaining warning in the xserver build.

v2: Also clean up some non-standard whitespace (Ian Romanick)

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
7 years agoglapi: Harden GLX request size processing (v2)
Adam Jackson [Thu, 24 Mar 2016 17:57:58 +0000 (13:57 -0400)]
glapi: Harden GLX request size processing (v2)

v2: Use == not is for equality testing (Dylan Baker)

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
7 years agoglapi: Add the safe_{add,mul,pad} functions from xserver
Adam Jackson [Thu, 24 Mar 2016 17:57:58 +0000 (13:57 -0400)]
glapi: Add the safe_{add,mul,pad} functions from xserver

We're about to update the generator scripts to use these, easier not to
vary between client and server.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
7 years agoglapi: Fix whitespace droppings when printing the license header
Adam Jackson [Thu, 24 Mar 2016 17:57:58 +0000 (13:57 -0400)]
glapi: Fix whitespace droppings when printing the license header

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
7 years agomesa/st: add support for NIR as possible driver IR
Rob Clark [Tue, 22 Dec 2015 02:34:11 +0000 (21:34 -0500)]
mesa/st: add support for NIR as possible driver IR

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Acked-by: Eric Anholt <eric@anholt.net>
7 years agomesa/st: move things around a bit in st_create_fp_variant()
Rob Clark [Mon, 28 Mar 2016 14:55:59 +0000 (10:55 -0400)]
mesa/st: move things around a bit in st_create_fp_variant()

Prep work for next patch.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agomesa/st: add nir pass for lowering builtin uniforms
Rob Clark [Fri, 29 Jan 2016 17:16:23 +0000 (12:16 -0500)]
mesa/st: add nir pass for lowering builtin uniforms

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agoscons: gallium: link against nir as needed
Emil Velikov [Mon, 16 May 2016 17:55:08 +0000 (18:55 +0100)]
scons: gallium: link against nir as needed

... otherwise we'll produce uncomplete binaries with introduction of NIR
as alternative IR with next commits.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Acked-by: Jose Fonseca <jfonseca@vmware.com>
7 years agoi965/fs: Add an allow_spilling flag to brw_compile_fs
Jason Ekstrand [Mon, 16 May 2016 21:30:25 +0000 (14:30 -0700)]
i965/fs: Add an allow_spilling flag to brw_compile_fs

This allows us to disable spilling for blorp shaders since blorp state
setup doesn't handle spilling.  Without this, blorp fails hard if you run
with INTEL_DEBUG=spill.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Tested-by: Francisco Jerez <currojerez@riseup.net>
7 years agonvc0/ir: fix shared atomic lowering to preserve shared memory location
Ilia Mirkin [Tue, 17 May 2016 07:27:02 +0000 (03:27 -0400)]
nvc0/ir: fix shared atomic lowering to preserve shared memory location

We were always doing atomics on shared memory location 0 instead of the
originally supplied location. Make sure to pass through the original
symbol and any indirection.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Cc: mesa-stable@lists.freedesktop.org # note: expect minor conflict
7 years agofreedreno/ir3: fix compiler warning
Rob Clark [Mon, 16 May 2016 17:37:24 +0000 (13:37 -0400)]
freedreno/ir3: fix compiler warning

Signed-off-by: Rob Clark <robclark@freedesktop.org>
7 years agonir/validate: dump annotated shader with error msgs
Rob Clark [Sat, 14 May 2016 19:40:54 +0000 (15:40 -0400)]
nir/validate: dump annotated shader with error msgs

Log all the errors, and at the end dump the shader w/ error annotations
to make it easier to see where the problems are.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
7 years agonir/validate: assert() -> validate_assert()
Rob Clark [Mon, 16 May 2016 16:44:59 +0000 (12:44 -0400)]
nir/validate: assert() -> validate_assert()

Prep work for next patch.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
7 years agonir/print: add support for print annotations
Rob Clark [Sat, 14 May 2016 19:37:32 +0000 (15:37 -0400)]
nir/print: add support for print annotations

Caller can pass a hashtable mapping NIR object (currently instr or var,
but I guess others could be added as needed) to annotation msg to print
inline with the shader dump.  As the annotation msg is printed, it is
removed from the hashtable to give the caller a way to know about any
unassociated msgs.

This is used in the next patch, for nir_validate to try to associate
error msgs to nir_print dump.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
7 years agoi965: Expose OpenGL 4.2 for gen8+
Alejandro Piñeiro [Tue, 26 Apr 2016 12:35:24 +0000 (14:35 +0200)]
i965: Expose OpenGL 4.2 for gen8+

ARB_vertex_attrib_64bit was the only feature missing.

v2: we can expose 4.2 instead of 4.1 (Ian Romanick)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agodocs: Mark ARB_vertex_attrib_64bit as done for i965/gen8+
Alejandro Piñeiro [Tue, 26 Apr 2016 12:37:38 +0000 (14:37 +0200)]
docs: Mark ARB_vertex_attrib_64bit as done for i965/gen8+

v2: label as done for i965/gen8+ instead of i965 (Kenneth Graunke)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Enable ARB_vertex_attrib_64bit for gen8+
Alejandro Piñeiro [Sat, 12 Mar 2016 11:34:06 +0000 (12:34 +0100)]
i965: Enable ARB_vertex_attrib_64bit for gen8+

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: take care of doubles when lowering VS inputs
Juan A. Suarez Romero [Fri, 15 Apr 2016 10:51:05 +0000 (12:51 +0200)]
i965: take care of doubles when lowering VS inputs

Input attributes can require 2 vec4 or 1 vec4 depending on whether they
are double-precision or not.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965/fs: calculate first non-payload GRF using attrib slots
Juan A. Suarez Romero [Mon, 4 Apr 2016 10:47:57 +0000 (12:47 +0200)]
i965/fs: calculate first non-payload GRF using attrib slots

When computing where the first non-payload GRF starts, we can't rely on
the number of attributes, as each attribute can be using 1 or 2 slots
depending on whether they are a dvec3/4 or other.

Instead, we need to use the number of slots used by the attributes.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965/vec4: use attribute slots to calculate URB read length
Juan A. Suarez Romero [Mon, 4 Apr 2016 10:47:57 +0000 (12:47 +0200)]
i965/vec4: use attribute slots to calculate URB read length

Do not use total attributes because a dvec3/dvec4 attribute requires two
slots. So rather use total attribute slots.

v2: do not use loop to calculate required attribute slots (Kenneth
Graunke)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: take care of doubles when remapping VS attributes
Juan A. Suarez Romero [Fri, 1 Apr 2016 15:25:03 +0000 (17:25 +0200)]
i965: take care of doubles when remapping VS attributes

Double-precision types require 1 slot in VUE for double and dvec2, and 2 slots for
anything else.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agonir: add double input bitmap
Juan A. Suarez Romero [Fri, 15 Apr 2016 10:30:54 +0000 (12:30 +0200)]
nir: add double input bitmap

This bitmap tracks which input attributes are double-precision.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965/fs: shuffle 32bits into 64bits for doubles
Juan A. Suarez Romero [Thu, 31 Mar 2016 10:49:53 +0000 (11:49 +0100)]
i965/fs: shuffle 32bits into 64bits for doubles

VS Thread Payload handles attributes in URB as vec4, no matter if they
are actually single or double precision.

So with double-precision types, value ends up in the registers split in
32bits chunks, in different positions.

We need to shuffle the chunks to get the doubles correctly.

v2:
 * Extra blank line. Add { } on if body (Ian Romanick)
 * Use dest directly (Kenneth Graunke)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965/fs: half exec_size when dealing with 64 bits attributes
Alejandro Piñeiro [Wed, 23 Mar 2016 11:20:05 +0000 (12:20 +0100)]
i965/fs: half exec_size when dealing with 64 bits attributes

The HW has a restriction that only vertical stride may cross register
boundaries. Until now this was only handled on VGRFs at
rw_reg_from_fs_reg, but it is also needed for attributes.

v2:
 * Remove reference to commit id on commit message (Juan Suarez)
 * Simplify code that compute final exec_size (Ian Romanick)
 * Use REG_SIZE on that same code (Kenneth Graunke)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: passthru formats cannot be used width edge flag enabled
Alejandro Piñeiro [Thu, 24 Mar 2016 10:49:53 +0000 (11:49 +0100)]
i965: passthru formats cannot be used width edge flag enabled

Add an assertion to detect this case.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Configure how to store *64*PASSTHRU vertex components
Antia Puentes [Fri, 15 Apr 2016 09:32:46 +0000 (11:32 +0200)]
i965: Configure how to store *64*PASSTHRU vertex components

From the Broadwell specification, structure VERTEX_ELEMENT_STATE
description:

   "When SourceElementFormat is set to one of the *64*_PASSTHRU
    formats,  64-bit components are stored in the URB without any
    conversion. In this case, vertex elements must be written as 128
    or 256 bits, with VFCOMP_STORE_0 being used to pad the output
    as required. E.g., if R64_PASSTHRU is used to copy a 64-bit Red component into
    the URB, Component 1 must be specified as VFCOMP_STORE_0 (with
    Components 2,3 set to VFCOMP_NOSTORE) in order to output a 128-bit
    vertex element, or Components 1-3 must be specified as VFCOMP_STORE_0
    in order to output a 256-bit vertex element. Likewise, use of
    R64G64B64_PASSTHRU requires Component 3 to be specified as VFCOMP_STORE_0
    in order to output a 256-bit vertex element."

Uses 128-bits to write double and dvec2 vertex elements, and 256-bits for
dvec3 and dvec4 vertex elements.

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Signed-off-by: Antia Puentes <apuentes@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: get the proper vertex surface type for doubles on gen8+
Alejandro Piñeiro [Tue, 15 Mar 2016 11:53:07 +0000 (12:53 +0100)]
i965: get the proper vertex surface type for doubles on gen8+

This commit adds support for PASSTHRU format when pushing
double-precision attributes.

Check glarray->Doubles in order to know if we should choose a format
that does a conversion to float, or just passthru the 64-bit double.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agonvc0/ir: make sure out-of-bounds buffer loads/atomics get a 0 result
Ilia Mirkin [Sun, 15 May 2016 19:35:04 +0000 (15:35 -0400)]
nvc0/ir: make sure out-of-bounds buffer loads/atomics get a 0 result

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agoglsl: make reserved_varying_slot() static
Timothy Arceri [Tue, 17 May 2016 01:18:50 +0000 (11:18 +1000)]
glsl: make reserved_varying_slot() static

Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agoglsl: include per-patch varyings when generating reserved slot bitfield
Timothy Arceri [Sat, 27 Feb 2016 01:16:34 +0000 (12:16 +1100)]
glsl: include per-patch varyings when generating reserved slot bitfield

Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agoglsl: don't incorrectly eliminate patches with explicit locations
Timothy Arceri [Tue, 17 May 2016 01:34:38 +0000 (11:34 +1000)]
glsl: don't incorrectly eliminate patches with explicit locations

These varying have a separate location domain from per-vertex varyings
and need to be handled separately.

Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agoglsl: remove remainings tabs in link_varyings.cpp
Timothy Arceri [Tue, 17 May 2016 01:31:00 +0000 (11:31 +1000)]
glsl: remove remainings tabs in link_varyings.cpp

Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agoglsl: fix location and component packing validation on patches
Timothy Arceri [Tue, 17 May 2016 01:29:40 +0000 (11:29 +1000)]
glsl: fix location and component packing validation on patches

These varyings have a separate location domain from per-vertex varyings
and need to be handled separately.

Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agoi965: Enable ARB_shader_precision on Gen8+.
Kenneth Graunke [Tue, 17 May 2016 00:49:21 +0000 (17:49 -0700)]
i965: Enable ARB_shader_precision on Gen8+.

I recently fixed a bug in the Piglit tests:
https://lists.freedesktop.org/archives/piglit/2016-May/019802.html

With that patch in place, we pass all the tests.  So, turn it on.

We could probably expose this earlier than Gen8, but the extension
says that OpenGL 4.0 is required, and all of our tests are written
against GLSL 4.00 (which is only supported on Gen8+).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agovl/dri: Move the DRI3 check out of sources include into C.
Jose Fonseca [Mon, 16 May 2016 20:46:58 +0000 (21:46 +0100)]
vl/dri: Move the DRI3 check out of sources include into C.

Fixes SCons build.

Trivial.  Built locally with SCons and autotools.

7 years agost/vdpau: add dri3 support
Leo Liu [Tue, 26 Apr 2016 15:23:53 +0000 (11:23 -0400)]
st/vdpau: add dri3 support

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
7 years agovl/dri3: implement functions for get and set timestamp
Leo Liu [Mon, 9 May 2016 20:03:41 +0000 (16:03 -0400)]
vl/dri3: implement functions for get and set timestamp

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
7 years agovl/dri3: handle PresentCompleteNotify event
Leo Liu [Mon, 9 May 2016 19:53:48 +0000 (15:53 -0400)]
vl/dri3: handle PresentCompleteNotify event

and get timestamp calculated based on the event's reply

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
7 years agost/va: add dri3 support
Leo Liu [Mon, 25 Apr 2016 20:07:21 +0000 (16:07 -0400)]
st/va: add dri3 support

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
7 years agovl/dri3: implement DRI3 BufferFromPixmap
Leo Liu [Mon, 9 May 2016 19:27:49 +0000 (15:27 -0400)]
vl/dri3: implement DRI3 BufferFromPixmap

We also need render to the front buffer of temporary X pixmap,
this is the case of when we using opengl as video out for vaapi.
the basic implementation is to pass pixmap ID to X server, and
then X will return dma-buf fd, we will get the buffer object
through this dma-buf fd.

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
7 years agovl/dri3: add support for resizing
Leo Liu [Mon, 25 Apr 2016 19:49:28 +0000 (15:49 -0400)]
vl/dri3: add support for resizing

When drawable size changed, PresentConfigureNotify event will be
emitted, by handling the event to re-allocate resized buffer.

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
7 years agovl/dri3: implement funciton for get dirty area
Leo Liu [Mon, 9 May 2016 19:09:45 +0000 (15:09 -0400)]
vl/dri3: implement funciton for get dirty area

This will clear presentation area not covered by video content

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
7 years agovl/dri3: implement function for flush frontbuffer
Leo Liu [Mon, 25 Apr 2016 18:37:57 +0000 (14:37 -0400)]
vl/dri3: implement function for flush frontbuffer

Request drawable content in pixmap by calling DRI3 PresentPixmap,
and handle PresentIdleNotify event.

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
7 years agovl/dri3: add back buffers support
Leo Liu [Tue, 10 May 2016 19:11:18 +0000 (15:11 -0400)]
vl/dri3: add back buffers support

This implements DRI3 PixmapFromBuffer. Create buffer objects, and
associate it to a dma-buf fd, and then pass this fd with a pixmap
ID to X server for creating pixmap object; also add a function
for wait events.

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
7 years agovl/dri3: implement flushing for queued events
Leo Liu [Mon, 25 Apr 2016 17:46:36 +0000 (13:46 -0400)]
vl/dri3: implement flushing for queued events

also place holder for present events handling

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
7 years agovl/dri3: register present events
Leo Liu [Tue, 10 May 2016 18:56:51 +0000 (14:56 -0400)]
vl/dri3: register present events

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
7 years agovl/dri3: set drawable geometry
Leo Liu [Mon, 25 Apr 2016 17:06:20 +0000 (13:06 -0400)]
vl/dri3: set drawable geometry

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
7 years agovl/dri3: add DRI3 support and implement create and destroy
Leo Liu [Mon, 7 Mar 2016 19:51:32 +0000 (14:51 -0500)]
vl/dri3: add DRI3 support and implement create and destroy

Required functions into place for implementation, create screen
with device fd returned from X server, also bail out to DRI2
with certain conditions.

v2: -organize the error out path (Axel)
    -squash previous patch 1 and 2 into one (Emil)

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
7 years agomesa/version.c: enable cull distance in version check.
Dave Airlie [Mon, 16 May 2016 20:06:01 +0000 (06:06 +1000)]
mesa/version.c: enable cull distance in version check.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoglsl/linker: Include the interface name for input and output blocks
Ian Romanick [Sat, 14 May 2016 00:45:49 +0000 (17:45 -0700)]
glsl/linker: Include the interface name for input and output blocks

On my oes_shader_io_blocks branch, this fixes 71
dEQP-GLES31.functional.program_interface_query.* tests.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: mesa-stable@lists.freedesktop.org
7 years agoglsl/linker: Use canonical format for ARB_program_interface_query spec quotes
Ian Romanick [Sat, 14 May 2016 00:44:58 +0000 (17:44 -0700)]
glsl/linker: Use canonical format for ARB_program_interface_query spec quotes

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: check tcs for NULL dereference
Mark Janes [Fri, 13 May 2016 20:04:56 +0000 (13:04 -0700)]
i965: check tcs for NULL dereference

Coverity issue 1361544 found an instance where the tcs variable is
checked for NULL, but unconditionally dereferenced later in the same
function.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Mark is_lossless_compressed_aux UNUSED to silence warning.
Matt Turner [Mon, 16 May 2016 18:08:55 +0000 (11:08 -0700)]
i965: Mark is_lossless_compressed_aux UNUSED to silence warning.

Used only in assert().

7 years agogenxml: Use llroundf() and store to appropriate type.
Matt Turner [Fri, 13 May 2016 20:25:41 +0000 (13:25 -0700)]
genxml: Use llroundf() and store to appropriate type.

Both functions return uint64_t, so I expect the masking/shifting should
be done on 64-bit types.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
7 years agonir: Mark nir_start_block()/nir_impl_last_block() with returns_nonnull.
Matt Turner [Fri, 13 May 2016 20:17:34 +0000 (13:17 -0700)]
nir: Mark nir_start_block()/nir_impl_last_block() with returns_nonnull.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoutil: Add ATTRIBUTE_RETURNS_NONNULL.
Matt Turner [Fri, 13 May 2016 20:17:02 +0000 (13:17 -0700)]
util: Add ATTRIBUTE_RETURNS_NONNULL.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoclover: grid_offset should be padded with 0 not 1
Jan Vesely [Mon, 16 May 2016 00:08:09 +0000 (20:08 -0400)]
clover: grid_offset should be padded with 0 not 1

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agoi965: Expose OpenGL 4.0 for gen8+
Iago Toral Quiroga [Tue, 23 Feb 2016 11:15:36 +0000 (12:15 +0100)]
i965: Expose OpenGL 4.0 for gen8+

ARB_gpu_shader_fp64 was the only feature missing.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agodocs: Mark ARB_gpu_shader_fp64 as done for i965/gen8+
Iago Toral Quiroga [Tue, 23 Feb 2016 11:14:11 +0000 (12:14 +0100)]
docs: Mark ARB_gpu_shader_fp64 as done for i965/gen8+

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: Enable ARB_gpu_shader_fp64 for gen8+
Iago Toral Quiroga [Tue, 23 Feb 2016 11:14:52 +0000 (12:14 +0100)]
i965: Enable ARB_gpu_shader_fp64 for gen8+

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965/tes/scalar: Fix load input for doubles
Iago Toral Quiroga [Mon, 9 May 2016 07:43:56 +0000 (09:43 +0200)]
i965/tes/scalar: Fix load input for doubles

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agoi965/tcs/scalar: fix store output for doubles
Iago Toral Quiroga [Mon, 9 May 2016 13:23:34 +0000 (15:23 +0200)]
i965/tcs/scalar: fix store output for doubles

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965/tcs/scalar: fix load input for doubles
Iago Toral Quiroga [Mon, 9 May 2016 08:31:50 +0000 (10:31 +0200)]
i965/tcs/scalar: fix load input for doubles

v2: do not write to the original indirect_offset since that is
    an expression that could be used somewhere else (Ken)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965/fs: fix nir_intrinsic_store_output for doubles
Iago Toral Quiroga [Mon, 9 May 2016 08:14:48 +0000 (10:14 +0200)]
i965/fs: fix nir_intrinsic_store_output for doubles

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965/fs: fix number of output components for doubles
Iago Toral Quiroga [Mon, 9 May 2016 08:14:18 +0000 (10:14 +0200)]
i965/fs: fix number of output components for doubles

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965/vec4: handle doubles in type_size_vec4()
Iago Toral Quiroga [Mon, 9 May 2016 13:21:25 +0000 (15:21 +0200)]
i965/vec4: handle doubles in type_size_vec4()

The scalar backend uses this to check URB input sizes.

v2: Removed redundant break after return (Curro)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agoi965/fs: support doubles with shared variable stores
Iago Toral Quiroga [Tue, 26 Jan 2016 09:30:39 +0000 (10:30 +0100)]
i965/fs: support doubles with shared variable stores

This is pretty much the same we do with SSBOs.

v2: do not shuffle in-place, it is not safe since the original 64-bit data
    could be used after the write, instead use a temporary like we do
    for SSBO stores (Iago)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965/fs: support doubles with ssbo stores
Iago Toral Quiroga [Mon, 25 Jan 2016 12:42:19 +0000 (13:42 +0100)]
i965/fs: support doubles with ssbo stores

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965/fs: add shuffle_64bit_data_for_32bit_write helper
Iago Toral Quiroga [Mon, 25 Jan 2016 12:37:50 +0000 (13:37 +0100)]
i965/fs: add shuffle_64bit_data_for_32bit_write helper

This does the inverse operation of shuffle_32bit_load_result_to_64bit_data
and we will use it when we need to write 64-bit data in the layout expected
by untyped write messages.

v2 (curro):
- Use subscript() instead of stride()
- Assert on the input types rather than silently retyping.
- Use offset() instead of horiz_offset(), drop the multiplier definition.
- Drop the temporary vgrf and force_writemask_all.
- Make component_i const.
- Move to brw_fs_nir.cpp

v3 (curro):
- Pass dst and src by reference.
- Simplify allocation of tmp register.
- Move to brw_fs_nir.cpp.
- Get rid of the temporary.

v3 (Iago):
- Check that the src and dst regions do not overlap, since that would
  typically be a bug in the caller.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agoi965/fs: support doubles with SSBO loads
Iago Toral Quiroga [Mon, 25 Jan 2016 09:58:59 +0000 (10:58 +0100)]
i965/fs: support doubles with SSBO loads

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agoi965/fs: support doubles with shared variable loads
Iago Toral Quiroga [Thu, 5 May 2016 10:58:19 +0000 (12:58 +0200)]
i965/fs: support doubles with shared variable loads

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agoi965/fs: Add do_untyped_vector_read helper
Iago Toral Quiroga [Thu, 5 May 2016 10:55:44 +0000 (12:55 +0200)]
i965/fs: Add do_untyped_vector_read helper

We are going to need the same logic for anything that reads
doubles via untyped messages (CS shared variables and SSBOs). Add a
helper function with that logic so that we can reuse it.

v2:
- Make this a static function instead of a method of fs_visitor (Iago)
- We only support types with a size of 4 or 8 (Curro)
- Avoid retypes by using a separate vgrf for the packed result (Curro)
- Put dst parameter before source parameters (Curro)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agoi965/fs: support doubles with UBO loads
Iago Toral Quiroga [Wed, 13 Jan 2016 09:17:10 +0000 (10:17 +0100)]
i965/fs: support doubles with UBO loads

UBO loads with constant offset use the UNIFORM_PULL_CONSTANT_LOAD
instruction, which reads 16 bytes (a vec4) of data from memory. For dvec
types this only provides components x and y. Thus, if we are reading
more than 2 components we need to issue a second load at offset+16 to
read the next 16-byte chunk with components w and z.

UBO loads with non-constant offset emit a load for each component
in the vector (and rely in CSE to fix redundant loads), so we only
need to consider the size of the data type when computing the offset
of each element in a vector.

v2 (Sam):
- Adapt the code to use component() (Curro).

v3 (Sam):
- Use type_sz(dest.type) in VARYING_PULL_CONSTANT_LOAD() call (Curro).
- Add asserts to ensure std140 vector alignment rules are followed
  (Curro).

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agoi965/fs: fix pull constant load component selection for doubles
Iago Toral Quiroga [Mon, 18 Jan 2016 12:09:31 +0000 (13:09 +0100)]
i965/fs: fix pull constant load component selection for doubles

UNIFORM_PULL_CONSTANT_LOAD is used to load a contiguous vec4 starting at a
constant offset that is 16-byte aligned. If we need to access an unaligned
offset we emit a load with an aligned offset and use the remaining constant
offset to select the component into the vec4 result that we are interested
in. This component must be computed in units of the type size, since that
is what fs_reg::set_smear expects.

This patch does this change in the two places where we use this message:
In demote_pull_constants when we lower uniform access with constant offset
into the pull constant buffer and in UBO loads with constant offset.

v2 (Sam):
- Fix set_smear() in fs_visitor::lower_constant_loads(), take into account
source type instead and remove MAX2 (Curro).
- Improve changes to nir_intrinsic_load_ubo case in nir_emit_intrinsic()
(Curro).

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agoi965/fs: Fix and document component().
Francisco Jerez [Wed, 11 May 2016 19:54:26 +0000 (12:54 -0700)]
i965/fs: Fix and document component().

This fixes a number of bugs of component() by reimplementing it in
terms of horiz_offset(): Handling of base registers starting at a
non-zero subreg_offset, handling of strided registers and overflow of
subreg_offset into reg_offset.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965/fs: Fix fs_visitor::VARYING_PULL_CONSTANT_LOAD for doubles
Iago Toral Quiroga [Thu, 14 Jan 2016 07:55:28 +0000 (08:55 +0100)]
i965/fs: Fix fs_visitor::VARYING_PULL_CONSTANT_LOAD for doubles

v2 (Curro):
   - Assert on scale == 1 when shuffling 64-bit data.
   - Remove type_slots, use type_sz(vec4_result.type) instead.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agoi965/fs: add shuffle_32bit_load_result_to_64bit_data helper
Iago Toral Quiroga [Fri, 22 Jan 2016 13:00:38 +0000 (14:00 +0100)]
i965/fs: add shuffle_32bit_load_result_to_64bit_data helper

There will be a few places where we need to shuffle the result of a 32-bit
load into valid 64-bit data, so extract this logic into a separate helper
that we can reuse.

v2 (Curro):
- Use subscript() instead of stride()
- Assert on the input types rather than retyping.
- Use offset() instead of horiz_offset(), drop the multiplier definition.
- Don't use  force_writemask_all.
- Mark component_i as const.
- Make the function name lower case.

v3 (Curro):
- Pass src and dst by reference.
- Move to brw_fs_nir.cpp

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agoi965/fs: Stop using the LOAD_PAYLOAD instruction in lower_simd_width.
Francisco Jerez [Wed, 4 May 2016 04:26:13 +0000 (21:26 -0700)]
i965/fs: Stop using the LOAD_PAYLOAD instruction in lower_simd_width.

Instead of using the LOAD_PAYLOAD instruction (emitted through the
emit_transpose() helper that is no longer useful and this commit
removes) which had to be marked force_writemask_all in some cases,
emit a series of moves to apply proper channel enable signals to the
destination.  Until now lower_simd_width() had mainly been used to
lower things that invariably had a basic block-local temporary as
destination so it didn't seem like a big deal, but I found it to be
the reason for several Piglit regressions in my SIMD32 branch and
Igalia discovered the same issue independently while working on FP64
support.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965/fs: fix copy/constant propagation regioning checks
Iago Toral Quiroga [Fri, 11 Mar 2016 07:46:36 +0000 (08:46 +0100)]
i965/fs: fix copy/constant propagation regioning checks

We were not accounting for subreg_offset in the check for the start
of the region.

Also, fs_reg::regs_read() already takes the stride into account, so we
should not multiply its result by the stride again. This was making
copy-propagation fail to copy-propagate cases that would otherwise be
safe to copy-propagate. Again, this was observed in fp64 code, since
there we use stride > 1 often.

v2 (Sam):
- Rename function and add comment (Jason, Curro).
- Assert that register files and number are the same (Jason).
- Fix code to take into account the assumption that src.subreg_offset
is strictly less than the reg_offset unit (Curro).
- Don't pass the registers by value to the function, use
'const fs_reg &' instead (Curro).
- Remove obsolete comment in the commit log (Curro).

v3 (Sam):
- Remove the assert and put the condition in the return (Curro).
- Fix function name (Curro).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agoi965/fs: fix copy propagation from load payload
Iago Toral Quiroga [Tue, 12 Apr 2016 11:53:24 +0000 (13:53 +0200)]
i965/fs: fix copy propagation from load payload

We were not considering the case where the load payload is writing to
a destination with a reg_offset > 0.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agoi965/fs: fix copy propagation of partially invalidated entries
Iago Toral Quiroga [Fri, 11 Mar 2016 13:35:07 +0000 (14:35 +0100)]
i965/fs: fix copy propagation of partially invalidated entries

We were not invalidating entries with a src that reads more than one register
when we find writes that overwrite any register read by entry->src after
the first. This leads to incorrect copy propagation because we re-use
entries from the ACP that have been partially invalidated. Same thing for
entries with a dst that writes to more than one register.

v2 (Sam):
- Improve code by defining regions_overlap() and using it instead of a
loop (Curro).

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>