mesa.git
6 years agoglapi: Fix -Wduplicate-decl-specifier due to double-const
Chad Versace [Thu, 22 Jun 2017 22:12:29 +0000 (15:12 -0700)]
glapi: Fix -Wduplicate-decl-specifier due to double-const

Fix all lines in src/mesa/main/marshal_generated.c that declare
double-const variables. Below is all such lines, with duplicates
removed:

   $ grep 'const const' marshal_generated.c | sort -u
   const const GLboolean * pointer = cmd->pointer;
   const const GLvoid * indices = cmd->indices;
   const const GLvoid * pointer = cmd->pointer;

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoanv: use Mesa's u_atomic.h header
Eric Engestrom [Mon, 26 Jun 2017 11:14:49 +0000 (12:14 +0100)]
anv: use Mesa's u_atomic.h header

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoradv: use Mesa's u_atomic.h header
Eric Engestrom [Mon, 26 Jun 2017 11:14:37 +0000 (12:14 +0100)]
radv: use Mesa's u_atomic.h header

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoswr: set an explicit clear_rect if scissor is not enabled.
Bruce Cherniak [Mon, 26 Jun 2017 15:26:26 +0000 (10:26 -0500)]
swr: set an explicit clear_rect if scissor is not enabled.

Fix regression of "no rendering" on simple apps like glxgears by
setting an explicit full surface clear_rect when scissor is not
enabled.

This regressed with commit 00173d91 "st/mesa: don't set 16
scissors and 16 viewports if they're unused" due to an assumption
that a default scissor rect is always set, which was the case prior
to this optimization.

Reviewed-by: Tim Rowley <timothy.o.rowley@intel.com>
6 years agoswr/rast: adjust std::string usage to fix build
Tim Rowley [Mon, 26 Jun 2017 13:57:38 +0000 (08:57 -0500)]
swr/rast: adjust std::string usage to fix build

Some combinations of c++ compilers and standard libraries had problems
with the string::replace code we were using previously.

This should fix the travis-ci system.

Tested-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
6 years agotravis: add missing libs: xdamage + xfixes
Eric Engestrom [Thu, 22 Jun 2017 18:14:20 +0000 (19:14 +0100)]
travis: add missing libs: xdamage + xfixes

> configure: error: Package requirements (x11 xext xdamage >= 1.1 xfixes
> x11-xcb xcb xcb-glx >= 1.8.1 xcb-dri2 >= 1.8) were not met:
> No package 'xdamage' found
> No package 'xfixes' found

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoradeonsi: support indirect indexing in INTERP_* opcodes
Nicolai Hähnle [Fri, 16 Jun 2017 18:50:56 +0000 (20:50 +0200)]
radeonsi: support indirect indexing in INTERP_* opcodes

The hardware doesn't support it, so we just interpolate all array elements
and then use indirect indexing on the resulting vector.

Clearly, this is not very efficient. There is an argument to be had for
adding if/else, or perhaps even pulling the data out of LDS directly.
Both don't really seem worth the effort, considering that it seems nobody
actually uses this feature.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agoegl_dri2: swrastGetDrawableInfo: set *x, *y [v2]
Ben Crocker [Thu, 22 Jun 2017 19:14:51 +0000 (15:14 -0400)]
egl_dri2: swrastGetDrawableInfo: set *x, *y [v2]

In swrastGetDrawableInfo, set *x and *y, not just *w and *h;
this fixes a crash later in drisw_update_tex_buffer when the
(formerly) uninitialized x and y values are used to construct
an address in a call to llvmpipe_transfer_map.

Fixes crash in Piglit test
"spec@egl 1.4@eglcreatepbuffersurface and then glclear"
(<piglit dir>/bin/egl-create-pbuffer-surface -auto)
that occurred intermittently, e.g. when the uninitialized x and y in
drisw_update_tex_buffer just happened to contain absurd non-zero values.

v2: Initialize in case if function succeeds or fails, just like *w/*h.

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Ben Crocker <bcrocker@redhat.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoegl: fold _eglError() + return EGL_FALSE
Emil Velikov [Tue, 20 Jun 2017 14:40:28 +0000 (15:40 +0100)]
egl: fold _eglError() + return EGL_FALSE

The function _eglError() already explicitly returns EGL_FALSE,
explicitly to simplify the callers. Make use of it.

While EGL_FALSE is numerically identical to false, NULL, EGL_NO_FOO,
storage is not the same so we cannot use it for "everything".

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agoegl: drop _eglInitImage() return type
Emil Velikov [Tue, 20 Jun 2017 14:22:39 +0000 (15:22 +0100)]
egl: drop _eglInitImage() return type

Function cannot fail and always returns true.

v2: Inline the one line function in the header

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agoglsl: do not call link_xfb_stride_layout_qualifiers() for fragment shaders
Juan A. Suarez Romero [Thu, 22 Jun 2017 10:47:57 +0000 (12:47 +0200)]
glsl: do not call link_xfb_stride_layout_qualifiers() for fragment shaders

xfb only applies to the latest stage before the fragment shader, so
there is no need to invoke it in the fragment shader.

Fixes:
KHR-GL45.enhanced_layouts.xfb_stride_of_empty_list
KHR-GL45.enhanced_layouts.xfb_stride_of_empty_list_and_api

v2: do reset only if shaders provide an explicit stride

v3: do not call link_xfb_stride_layout_qualifiers() for fragment shaders
(Timothy)

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
6 years agor600g: fix crash when file in R600_TRACE doesn't exist
Constantine Charlamov [Sat, 24 Jun 2017 12:52:05 +0000 (15:52 +0300)]
r600g: fix crash when file in R600_TRACE doesn't exist

…and print error in such case. Which probably is not a rare event btw
because fopen doesn't expand ~ to $HOME.

Also get rid of unused "bool ret" variable.

Signed-off-by: Constantine Kharlamov <Hi-Angel@yandex.ru>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600g: take into account offset to system inputs at tgsi_interp_egcm()
Constantine Charlamov [Sat, 24 Jun 2017 14:06:48 +0000 (17:06 +0300)]
r600g: take into account offset to system inputs at tgsi_interp_egcm()

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=100785
v2: I was too much twiddling whether to initialize nsys_inputs at the beginning of shader initialization or for allocation of system values, and by the time I decided to go with the first one, I forgot to change it back.

Signed-off-by: Constantine Kharlamov <Hi-Angel@yandex.ru>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600g: get rid of trailing whitespace
Constantine Charlamov [Sat, 24 Jun 2017 12:52:03 +0000 (15:52 +0300)]
r600g: get rid of trailing whitespace

Signed-off-by: Constantine Kharlamov <Hi-Angel@yandex.ru>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600/asm: add support for other GDS operations.
Dave Airlie [Wed, 6 Apr 2016 23:36:26 +0000 (00:36 +0100)]
r600/asm: add support for other GDS operations.

This adds support for the GDS operations needed to do atomic
counters.

Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600: don't merge GDS into VTX
Dave Airlie [Thu, 7 Apr 2016 03:47:32 +0000 (04:47 +0100)]
r600: don't merge GDS into VTX

We don't want vtx/tex instructions ending up in GDS sections.

Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600: for memory instructions dump index gpr for read indirects also.
Dave Airlie [Thu, 31 Mar 2016 06:13:35 +0000 (16:13 +1000)]
r600: for memory instructions dump index gpr for read indirects also.

This just makes sure we can see the index gpr in the asm dumps.

Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600: add support for vertex fetches via texture cache
Dave Airlie [Thu, 31 Mar 2016 05:49:55 +0000 (15:49 +1000)]
r600: add support for vertex fetches via texture cache

On evergreen we can route vertex fetches via the texture cache,
and this is required for some images support. So add support
to the asm builder for it.

Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600: route indirect address register correctly for vtx fetches.
Dave Airlie [Thu, 31 Mar 2016 05:46:30 +0000 (15:46 +1000)]
r600: route indirect address register correctly for vtx fetches.

This was found during writing the images code, we need to
make sure we route the correct index register.

Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoradv/meta: don't need vertex info for resolve shader.
Dave Airlie [Wed, 14 Jun 2017 22:46:44 +0000 (23:46 +0100)]
radv/meta: don't need vertex info for resolve shader.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agodrirc: whitelist glthread for a few games
Marek Olšák [Wed, 21 Jun 2017 23:26:54 +0000 (01:26 +0200)]
drirc: whitelist glthread for a few games

Performance deltas:
    Alien Isolation: +17% (it varies depending on the location)
    Borderlands 2: +50% (it varies depending on the location)
    BioShock Infinite: +76% (benchmark)
    Civilization 6: +20% (benchmark)

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agomesa/glthread: decrease the batch size for better perf scaling
Marek Olšák [Wed, 21 Jun 2017 20:32:20 +0000 (22:32 +0200)]
mesa/glthread: decrease the batch size for better perf scaling

This is the key to better performance.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agogallium/hud: add glthread counters
Marek Olšák [Wed, 21 Jun 2017 19:32:35 +0000 (21:32 +0200)]
gallium/hud: add glthread counters

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agogallium/hud: add API-thread-busy for monitoring the thread load
Marek Olšák [Wed, 21 Jun 2017 19:12:26 +0000 (21:12 +0200)]
gallium/hud: add API-thread-busy for monitoring the thread load

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agogallium/hud: add hud_pane::hud pointer
Marek Olšák [Wed, 21 Jun 2017 19:10:27 +0000 (21:10 +0200)]
gallium/hud: add hud_pane::hud pointer

for later use

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agomesa/glthread: add glthread "perf" counters and pass them to gallium HUD
Marek Olšák [Wed, 21 Jun 2017 18:45:38 +0000 (20:45 +0200)]
mesa/glthread: add glthread "perf" counters and pass them to gallium HUD

for HUD integration in following commits. This valuable profiling data
will allow us to see on the HUD how well glthread is able to utilize
parallelism. This is better than benchmarking, because you can see
exactly what's happening and you don't have to be CPU-bound.

u_threaded_context has the same counters.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agogallium/hud: move struct hud_context to hud_private.h
Marek Olšák [Wed, 21 Jun 2017 18:34:30 +0000 (20:34 +0200)]
gallium/hud: move struct hud_context to hud_private.h

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agogallium/hud: rename API-thread-busy to main-thread-busy
Marek Olšák [Wed, 21 Jun 2017 17:54:45 +0000 (19:54 +0200)]
gallium/hud: rename API-thread-busy to main-thread-busy

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agomesa/glthread: switch to u_queue and redesign the batch management
Marek Olšák [Wed, 21 Jun 2017 11:53:23 +0000 (13:53 +0200)]
mesa/glthread: switch to u_queue and redesign the batch management

This mirrors exactly how u_threaded_context works.
If you understand this, you also understand u_threaded_context.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agomesa/glthread: remove HAVE_PTHREAD guards
Marek Olšák [Wed, 21 Jun 2017 10:24:33 +0000 (12:24 +0200)]
mesa/glthread: remove HAVE_PTHREAD guards

we are switching to util_queue.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agoutil: move pipe_thread_is_self from gallium to src/util
Marek Olšák [Wed, 21 Jun 2017 12:11:13 +0000 (14:11 +0200)]
util: move pipe_thread_is_self from gallium to src/util

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agoradv: Remove unused args of radv_image_view_init.
Bas Nieuwenhuizen [Sun, 25 Jun 2017 20:25:47 +0000 (22:25 +0200)]
radv: Remove unused args of radv_image_view_init.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agoradv: Use correct image layout for blit based copies.
Bas Nieuwenhuizen [Sat, 24 Jun 2017 18:23:44 +0000 (20:23 +0200)]
radv: Use correct image layout for blit based copies.

v2: Don't pass layout to image view usage mask.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Fixes: 0628580eff6 "radv: Specify semantics of HTILE layout helpers."
6 years agomesa/marshal: add custom marshalling for glNamedBuffer(Sub)Data
Grigori Goronzy [Sat, 24 Jun 2017 16:59:55 +0000 (18:59 +0200)]
mesa/marshal: add custom marshalling for glNamedBuffer(Sub)Data

These entry points are used by Alien Isolation and caused
synchronization with glthread. The async marshalling implementation
is similar to glBuffer(Sub)Data. However unlike Buffer(Sub)Data
we don't need to worry about EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD,
as this isn't applicable to these DSA variants.

Results in an approximately 6x drop in glthread synchronizations and a
~30% FPS jump in Alien Isolation (Medium preset, Athlon 860K, RX 480).

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agoradv: handle primitive id input into fragment shader with no geom shader
Dave Airlie [Tue, 20 Jun 2017 03:21:04 +0000 (13:21 +1000)]
radv: handle primitive id input into fragment shader with no geom shader

Fixes:
dEQP-VK.pipeline.framebuffer_attachment.no_attachments
dEQP-VK.pipeline.framebuffer_attachment.no_attachments_ms

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoradv: compile fragment shader first.
Dave Airlie [Tue, 20 Jun 2017 02:50:04 +0000 (12:50 +1000)]
radv: compile fragment shader first.

This reorders things as we need something from the fs for the vs key.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoradv: set prim_id for geometry shaders
Dave Airlie [Tue, 20 Jun 2017 04:03:10 +0000 (14:03 +1000)]
radv: set prim_id for geometry shaders

Noticed in passing.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoradv: set use_prim_id for tess shaders correctly.
Dave Airlie [Tue, 20 Jun 2017 03:59:33 +0000 (13:59 +1000)]
radv: set use_prim_id for tess shaders correctly.

Just noticed in passing.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agonv50/ir: Properly fold constants in SPLIT operation
Pierre Moreau [Mon, 12 Jun 2017 20:53:52 +0000 (22:53 +0200)]
nv50/ir: Properly fold constants in SPLIT operation

Fixes: b7d9677d ("nv50/ir: constant fold OP_SPLIT")
Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Pierre Moreau <pierre.morrow@free.fr>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
6 years agoradeonsi/gfx9: don't overallocate shader binaries
Marek Olšák [Tue, 20 Jun 2017 17:34:03 +0000 (19:34 +0200)]
radeonsi/gfx9: don't overallocate shader binaries

It's not needed. The hw doesn't fetch ahead over page boundaries.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agost/dri2: implement image offset query
Lucas Stach [Fri, 23 Jun 2017 15:36:37 +0000 (17:36 +0200)]
st/dri2: implement image offset query

This trivially adds support for the image offset query, which is needed
for the zwp_linux_dmabuf based EGL platform wayland implementation.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agomesa: only flush vertices when the viewport is different
Samuel Pitoiset [Thu, 22 Jun 2017 13:03:20 +0000 (15:03 +0200)]
mesa: only flush vertices when the viewport is different

This prevents glViewport() and friends to always flush and
trigger _NEW_VIEWPORT.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agomesa: remove useless comments in the viewport code path
Samuel Pitoiset [Thu, 22 Jun 2017 13:01:12 +0000 (15:01 +0200)]
mesa: remove useless comments in the viewport code path

No need to explain why calling a driver callback is needed.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agollvmpipe: initialize default fb correctly in setup
Roland Scheidegger [Fri, 23 Jun 2017 17:40:18 +0000 (19:40 +0200)]
llvmpipe: initialize default fb correctly in setup

If lp_setup_bind_framebuffer() is never called, then setup fb x1/y1 was not
correctly initialized. This can happen if there's never a fb set - both
cso and llvmpipe would consider setting this with no cbufs and no zsbuf a
redundant change and therefore it would never get set.
We rely on this setup fb rect being initialized correctly for the tri intersect
tests, throwing away tris which don't intersect. Not initializing it meant
we'd then say it intersected, and we'd try to bin that despite that we have
no actual tiles to bin it to, leading to assertion failures (pretty harmless
since tile 0/0 always exists nevertheless as tiles are statically allocated,
albeit that should change at some point).
(Note probably not an issue with gl state tracker)

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
6 years agoi965/miptree: Rework aux enabling
Jason Ekstrand [Fri, 16 Jun 2017 05:58:49 +0000 (22:58 -0700)]
i965/miptree: Rework aux enabling

This commit replaces the complex and confusing set of disable flags with
two fairly straightforward fields which describe the intended auxiliary
surface usage and whether or not the miptree supports fast clears.
Right now, supports_fast_clear can be entirely derived from aux_usage
but that will not always be the case.

This commit makes functional changes.  One of these changes is that it
re-enables multisampled fast-clears which were accidentally disabled in
cec30a666930ddb8476a9452a89364a24979ff62 around a year ago.  Fixing this
improves the SynMark v7 DeferredAA test by around ~3% on some gen9
hardware.  This commit also gets us closer to enabling CCS_E for
window-system buffers which are Y-tiled.

Reviewed-by: Chad Versace <chadversary@chromium.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoi965: Clamp clear colors to the representable range
Jason Ekstrand [Fri, 16 Jun 2017 07:13:45 +0000 (00:13 -0700)]
i965: Clamp clear colors to the representable range

Starting with Sky Lake, we can clear to arbitrary floats or integers.
Unfortunately, the hardware isn't particularly smart when it comes
sampling from that clear color.  If the clear color is out of range for
the surface format, it will happily return whatever we put in the
surface state packet unmodified.  In order to avoid returning bogus
values for surfaces with a limited range, we need to do some clamping.

Cc: "17.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Chad Versace <chadversary@chromium.org>
6 years agoi965: Don't bother with HiZ in renderbuffer_move_to_temp
Jason Ekstrand [Fri, 16 Jun 2017 04:18:31 +0000 (21:18 -0700)]
i965: Don't bother with HiZ in renderbuffer_move_to_temp

This function is only used on gen4-5 which don't support HiZ.

Reviewed-by: Chad Versace <chadversary@chromium.org>
6 years agoi965/miptree: Rename the non_msrt_mcs functions to _ccs
Jason Ekstrand [Fri, 16 Jun 2017 04:02:20 +0000 (21:02 -0700)]
i965/miptree: Rename the non_msrt_mcs functions to _ccs

While we're here, we also make the two support checks static since there
are no users outside intel_mipmap_tree.c.

Reviewed-by: Chad Versace <chadversary@chromium.org>
6 years agoi965/miptree: Delete the layered rendering resolve
Jason Ekstrand [Fri, 16 Jun 2017 05:17:13 +0000 (22:17 -0700)]
i965/miptree: Delete the layered rendering resolve

We never fast-clear more than the base slice (LOD 0, layer 0) anyway, so
layered rendering without a resolve is always perfectly safe.  Should
this ever change in the future, we'll have to put some sort of resolve
back in but we can cross that bridge when we come to it.

Reviewed-by: Chad Versace <chadversary@chromium.org>
6 years agoanv/cnl: Don't write to Cache Mode Register 1 on gen10+
Anuj Phogat [Wed, 14 Jun 2017 00:01:16 +0000 (17:01 -0700)]
anv/cnl: Don't write to Cache Mode Register 1 on gen10+

For PartialResolveDisableInVC field recommendation is to
always set this to 0 and that's the default value of the bit.
So, we have nothing left to write to CACHE_MODE_1.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoi965/cnl: Don't write to Cache Mode Register 1 on gen10+
Anuj Phogat [Tue, 13 Jun 2017 21:22:06 +0000 (14:22 -0700)]
i965/cnl: Don't write to Cache Mode Register 1 on gen10+

With below optimizations gone in gen10+ we have nothing left out to
write to CACHE_MODE_1:
Float Blend Optimization Enable: This bit have been removed in gen10+
Partial Resolve Disable in VC: Recommendation is to always set this
field to 0 in gen10+ and that's the default value of the bit.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoradeonsi: unreference vertex buffers when destroying the context
Marek Olšák [Wed, 21 Jun 2017 16:39:41 +0000 (18:39 +0200)]
radeonsi: unreference vertex buffers when destroying the context

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
6 years agodrirc: Add glsl_correct_derivatives_after_discard for The Witcher 2
Edmondo Tommasina [Wed, 21 Jun 2017 20:40:37 +0000 (22:40 +0200)]
drirc: Add glsl_correct_derivatives_after_discard for The Witcher 2

This fixes the long-standing problem with black transitions in The Wicher 2.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98238

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
6 years agoradeonsi: implement the workaround for Rocket League - postponed TGSI kill
Marek Olšák [Tue, 20 Jun 2017 20:55:56 +0000 (22:55 +0200)]
radeonsi: implement the workaround for Rocket League - postponed TGSI kill

Do KILL at the end of shaders so as not to break WQM.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100070

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agogallium/radeon: pass create_screen flags to r600_common_screen_init
Marek Olšák [Tue, 20 Jun 2017 22:38:06 +0000 (00:38 +0200)]
gallium/radeon: pass create_screen flags to r600_common_screen_init

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agost/dri: add a drirc workaround for Rocket League
Marek Olšák [Tue, 20 Jun 2017 20:44:53 +0000 (22:44 +0200)]
st/dri: add a drirc workaround for Rocket League

This needs to be passed to gallium drivers.

No game fix is planned at this time.

The addition of glsl_correct_derivatives_after_discard is
generally a good thing for mesa compatibility with the broader GL
driver ecosystem.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100070

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agost/dri: get drirc options before creating pipe_screen
Marek Olšák [Tue, 20 Jun 2017 22:34:12 +0000 (00:34 +0200)]
st/dri: get drirc options before creating pipe_screen

dri_init_options_get_screen_flags will return the flags for create_screen().

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agogallium: allow passing 'unsigned flags' to create_screen()
Marek Olšák [Tue, 20 Jun 2017 22:30:21 +0000 (00:30 +0200)]
gallium: allow passing 'unsigned flags' to create_screen()

for drirc options

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agomesa: don't flush vertices in glClientActiveTexture
Marek Olšák [Tue, 20 Jun 2017 00:23:56 +0000 (02:23 +0200)]
mesa: don't flush vertices in glClientActiveTexture

Reviewed-by: Brian Paul <brianp@vmware.com>
6 years agomesa: don't flag _NEW_ARRAY for GL_PRIMITIVE_RESTART_NV
Marek Olšák [Tue, 20 Jun 2017 00:20:52 +0000 (02:20 +0200)]
mesa: don't flag _NEW_ARRAY for GL_PRIMITIVE_RESTART_NV

Reviewed-by: Brian Paul <brianp@vmware.com>
6 years agollvmpipe:fix using 32bit rasterization mistakenly, causing overflows
Roland Scheidegger [Fri, 23 Jun 2017 17:35:50 +0000 (19:35 +0200)]
llvmpipe:fix using 32bit rasterization mistakenly, causing overflows

We use the bounding box (triangle extents) to figure out if 32bit rasterization
could potentially overflow. However, we used the bounding box which already got
rounded up to 0 for negative coords for this, which is incorrect, leading to
overflows and hence bogus rendering in some of our private use.

It might be possible to simplify this somehow (we're now using 3 different
boxes for binning) but I don't quite see how.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
6 years agollvmpipe: fill in debug vertex info for tri rasterization
Roland Scheidegger [Fri, 23 Jun 2017 02:57:57 +0000 (04:57 +0200)]
llvmpipe: fill in debug vertex info for tri rasterization

This is pretty useful for debugging rasterization issues, so turn it on
based on DEBUG (the actual existence of the fields is also conditionalized
on DEBUG, lines fill it out the same too).

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
6 years agoRevert "radeonsi: don't emit partial flushes at the end of IBs (v2)"
Marek Olšák [Fri, 23 Jun 2017 17:02:32 +0000 (19:02 +0200)]
Revert "radeonsi: don't emit partial flushes at the end of IBs (v2)"

This reverts commit c9040dc9e75c81024f88f3f1bab821ad2bc73db3.

People have reported it causes corruption on VI, and I see GPU hangs
on GFX9.

6 years agomesa: remove spurious flush in _mesa_Viewport()
Samuel Pitoiset [Thu, 22 Jun 2017 12:55:24 +0000 (14:55 +0200)]
mesa: remove spurious flush in _mesa_Viewport()

I don't think this is actually required, if the viewport
values are different from the ones stored in the context, we
already flush and trigger _NEW_VIEWPORT in
set_viewport_no_notify().

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
6 years agomesa: remove spurious flush in _mesa_DepthRange()
Samuel Pitoiset [Thu, 22 Jun 2017 11:55:05 +0000 (13:55 +0200)]
mesa: remove spurious flush in _mesa_DepthRange()

I don't think this is actually required, if the depth range
values are different from the ones stored in the context, we
already flush and trigger _NEW_VIEWPORT in
set_depth_range_no_notify().

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
6 years agomesa: do not trigger _NEW_TEXTURE_STATE in glActiveTexture()
Samuel Pitoiset [Wed, 21 Jun 2017 09:31:43 +0000 (11:31 +0200)]
mesa: do not trigger _NEW_TEXTURE_STATE in glActiveTexture()

This looks like useless because gl_context::Texture::CurrentUnit
is not used by _mesa_update_texture_state() and friends.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
6 years agomesa: add KHR_no_error support for glViewport()
Samuel Pitoiset [Thu, 22 Jun 2017 13:51:46 +0000 (15:51 +0200)]
mesa: add KHR_no_error support for glViewport()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agomesa: add viewport() helper
Samuel Pitoiset [Thu, 22 Jun 2017 13:26:32 +0000 (15:26 +0200)]
mesa: add viewport() helper

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agomesa: add KHR_no_error support for glViewportArrayv()
Samuel Pitoiset [Thu, 22 Jun 2017 13:24:04 +0000 (15:24 +0200)]
mesa: add KHR_no_error support for glViewportArrayv()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agomesa: add viewport_array() helper
Samuel Pitoiset [Thu, 22 Jun 2017 13:22:25 +0000 (15:22 +0200)]
mesa: add viewport_array() helper

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agomesa: add KHR_no_error support for glViewportIndexed*()
Samuel Pitoiset [Thu, 22 Jun 2017 13:19:34 +0000 (15:19 +0200)]
mesa: add KHR_no_error support for glViewportIndexed*()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agomesa: rename ViewportIndexedf() to viewport_indexed_err()
Samuel Pitoiset [Thu, 22 Jun 2017 13:14:02 +0000 (15:14 +0200)]
mesa: rename ViewportIndexedf() to viewport_indexed_err()

While are at it, add a 'context' parameter for consistency.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agomesa: add KHR_no_error support for glClipControl()
Samuel Pitoiset [Thu, 22 Jun 2017 10:01:21 +0000 (12:01 +0200)]
mesa: add KHR_no_error support for glClipControl()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agomesa: add clip_control() helper
Samuel Pitoiset [Thu, 22 Jun 2017 09:58:44 +0000 (11:58 +0200)]
mesa: add clip_control() helper

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agoi965: Convert upload_default_color to genxml.
Rafael Antognolli [Tue, 30 May 2017 22:08:18 +0000 (15:08 -0700)]
i965: Convert upload_default_color to genxml.

This function was moved to genX_state_upload.c but was still not using genxml.
By converting it to genxml, we make some things simpler, like setting
haswell's border color state, but others are more complex, since the structs
used by each gen are different.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
6 years agoi965: Remove unused code and delete file.
Rafael Antognolli [Tue, 30 May 2017 22:08:17 +0000 (15:08 -0700)]
i965: Remove unused code and delete file.

The sampler state code was all moved to genxml, so we can get rid of these
functions and delete the file.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
6 years agoi965: Convert vs, gs, tcs, tes and cs samplers to genxml.
Rafael Antognolli [Tue, 30 May 2017 22:08:16 +0000 (15:08 -0700)]
i965: Convert vs, gs, tcs, tes and cs samplers to genxml.

Since they just use the code that is already available in genX_state_upload.c,
convert them in one batch.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
6 years agoi965: Convert fs sampler state to use genxml.
Rafael Antognolli [Tue, 30 May 2017 22:08:15 +0000 (15:08 -0700)]
i965: Convert fs sampler state to use genxml.

Also convert some auxiliary functions used by it, and copy
upload_default_color to genX_state_upload.c.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
6 years agogenxml: fix gen5 sampler border color state.
Rafael Antognolli [Tue, 30 May 2017 22:08:14 +0000 (15:08 -0700)]
genxml: fix gen5 sampler border color state.

Based on the current code, gen5 and gen6 have the same sampler border color
state struct. So fix the gen5 one to match gen6.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
6 years agoaubinator: Dump sampler state pointers on gen6 too.
Rafael Antognolli [Tue, 30 May 2017 22:08:13 +0000 (15:08 -0700)]
aubinator: Dump sampler state pointers on gen6 too.

We already have a function to dump sampler states, so do that for gen6
too.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
6 years agoanv: Fix -Wswitch in anv_layout_to_aux_usage()
Chad Versace [Thu, 22 Jun 2017 21:39:12 +0000 (14:39 -0700)]
anv: Fix -Wswitch in anv_layout_to_aux_usage()

anv_layout_to_aux_usage() lacked a case for
VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR. Add an unreachable case, because we
don't support the extension.

Acked-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agoi965: Fix -Wunused-variable in gen8_write_pma_stall_bits()
Chad Versace [Thu, 22 Jun 2017 21:42:47 +0000 (14:42 -0700)]
i965: Fix -Wunused-variable in gen8_write_pma_stall_bits()

Trivial fix.  'ctx' was unused.

6 years agoi965/CFL: Add PCI Ids for Coffee Lake.
Anusha Srivatsa [Thu, 22 Jun 2017 17:42:32 +0000 (10:42 -0700)]
i965/CFL: Add PCI Ids for Coffee Lake.

Coffee Lake has a gen9 graphics following KBL.
From 3D perspective, CFL is a clone of KBL/SKL features.

v2: Change commit message, correct alignment <Anuj Phogat>
v3: Update IDs.
v4: Initialize l3_banks, correct nomenclature <Anuj>

Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
Acked-by: Benjamin Widawsky <benjamin.widawsky@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
6 years agointel: Enable vulkan build for gen10
Anuj Phogat [Fri, 26 May 2017 15:28:29 +0000 (08:28 -0700)]
intel: Enable vulkan build for gen10

This patch just enables building Vulkan libs for gen10. We
still don't have gen 10 support enabled on Vulkan.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agoanv/cnl: Generate and use gen10 functions
Anuj Phogat [Fri, 26 May 2017 16:11:20 +0000 (09:11 -0700)]
anv/cnl: Generate and use gen10 functions

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agoanv/cnl: Don't set FloatBlendOptimizationEnable{Mask}
Anuj Phogat [Tue, 13 Jun 2017 18:08:48 +0000 (11:08 -0700)]
anv/cnl: Don't set FloatBlendOptimizationEnable{Mask}

This field is remove from CACHE_MODE_1 register in gen10.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agoanv/cnl: Use GENX(xx) in place of GEN9_xx
Anuj Phogat [Fri, 26 May 2017 16:10:35 +0000 (09:10 -0700)]
anv/cnl: Use GENX(xx) in place of GEN9_xx

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agoanv/cnl: Add #defines for MOCS and genX(x)
Anuj Phogat [Fri, 26 May 2017 16:05:51 +0000 (09:05 -0700)]
anv/cnl: Add #defines for MOCS and genX(x)

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agointel/genxml: Add Gen10 CACHE_MODE_1 definitions
Anuj Phogat [Mon, 5 Jun 2017 15:31:01 +0000 (08:31 -0700)]
intel/genxml: Add Gen10 CACHE_MODE_1 definitions

Few of the fields in this register are changed as compared
to gen9.xml.

V2: Remove some fields which are not valid anymore.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
6 years agointel/genxml: Rename StartInstanceLocation to StartingInstanceLocation
Anuj Phogat [Thu, 25 May 2017 22:21:17 +0000 (15:21 -0700)]
intel/genxml: Rename StartInstanceLocation to StartingInstanceLocation

This is required because we already have a macro defined with
the name StartInstanceLocation.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
6 years agointel/genxml: Rename IndirectStatePointer to BorderColorPointer
Anuj Phogat [Thu, 25 May 2017 22:19:44 +0000 (15:19 -0700)]
intel/genxml: Rename IndirectStatePointer to BorderColorPointer

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
6 years agointel/genxml: Combine DataDWord{0, 1} fields in to ImmediateData field
Anuj Phogat [Thu, 25 May 2017 21:51:58 +0000 (14:51 -0700)]
intel/genxml: Combine DataDWord{0, 1} fields in to ImmediateData field

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
6 years agointel/genxml: Add INSTDONE registers in gen10
Anuj Phogat [Thu, 25 May 2017 21:47:54 +0000 (14:47 -0700)]
intel/genxml: Add INSTDONE registers in gen10

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
6 years agointel/genxml: Add better support for MI_MATH in gen10
Anuj Phogat [Thu, 25 May 2017 21:45:23 +0000 (14:45 -0700)]
intel/genxml: Add better support for MI_MATH in gen10

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
6 years agoi965/dri: Add intel_screen param to intel_create_winsys_renderbuffer
Chad Versace [Sat, 27 May 2017 00:10:37 +0000 (17:10 -0700)]
i965/dri: Add intel_screen param to intel_create_winsys_renderbuffer

The param is currently unused. It will later be used it to support
R8G8B8X8 EGLConfigs on Skylake.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoi965: Move brw_context format arrays to intel_screen
Chad Versace [Tue, 30 May 2017 22:57:15 +0000 (15:57 -0700)]
i965: Move brw_context format arrays to intel_screen

This allows us to query the driver's supported formats in i965's DRI code,
where often there is available a DRIscreen but no GL context.

To reduce diff noise, this patch does not completely remove
brw_context's format arrays. It just redeclares them as pointers which
point to the arrays in intel_screen.

Specifically, move these two arrays from brw_context to intel_screen:
    mesa_to_isl_render_format[]
    mesa_format_supports_render[]

And add a new array to intel_screen,
    mesa_format_supportex_texture[]
which brw_init_surface_formats() copies to ctx->TextureFormatSupported.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoi965: Rename some vague format members of brw_context
Chad Versace [Tue, 30 May 2017 22:39:26 +0000 (15:39 -0700)]
i965: Rename some vague format members of brw_context

I'm swimming in a vortex of formats. Mesa formats, isl formats, DRI
formats, GL formats, etc.

It's easy to misinterpret the following brw_context members unless
you've recently read their definition.  In upcoming patches, I change
them from embedded arrays to simple pointers; after that, even their
definition doesn't help, because the MESA_FORMAT_COUNT hint will no
longer be present.

Rename them to prevent further confusion. While we're renaming, choose
shorter names too.

    -format_supported_as_render_target
    +mesa_format_supports_render

    -render_target_format
    +mesa_to_isl_render_format

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoegl: Rename 'count' in ${platform}_add_configs_for_visuals (v2)
Chad Versace [Thu, 22 Jun 2017 18:00:41 +0000 (11:00 -0700)]
egl: Rename 'count' in ${platform}_add_configs_for_visuals (v2)

Rename 'count' to 'config_count'. I didn't understand what the variable
did until I untangled the for-loops. Now the next person won't have that
problem.

v2: Rebase. Fix typo. Apply to all platforms (for emil).

Reviewed-by: Eric Engestrom <eric@engestrom.ch> (v1)
6 years agoegl/x11: Declare EGLConfig attrib array inside loop
Chad Versace [Thu, 22 Jun 2017 18:00:41 +0000 (11:00 -0700)]
egl/x11: Declare EGLConfig attrib array inside loop

No behavioral change. Just a readability cleanup.

Instead of modifying this small array on each loop iteration, we now
initialize it in-place with the values it needs.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
6 years agoegl/drm: Declare EGLConfig attrib array inside loop
Chad Versace [Thu, 22 Jun 2017 18:00:41 +0000 (11:00 -0700)]
egl/drm: Declare EGLConfig attrib array inside loop

No behavioral change. Just a readability cleanup.

Instead of modifying this small array on each loop iteration, we now
initialize it in-place with the values it needs.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>