mesa.git
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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."
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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.

7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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.

7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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)
7 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>
7 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>
7 years agoegl/android: Declare EGLConfig attrib array inside loop (v2)
Chad Versace [Thu, 22 Jun 2017 18:00:41 +0000 (11:00 -0700)]
egl/android: Declare EGLConfig attrib array inside loop (v2)

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.

v2: Rebase.

Reviewed-by: Eric Engestrom <eric@engestrom.ch> (v1)
7 years agoegl/dri2: Declare loop vars inside the loop
Chad Versace [Thu, 22 Jun 2017 18:00:40 +0000 (11:00 -0700)]
egl/dri2: Declare loop vars inside the loop

That is, consistently do this:

    for (int i = 0; ...)

No behavioral change.
This patch touches only egl_dri2.c.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
7 years agoegl/wayland: Declare loop vars inside the loop
Chad Versace [Thu, 22 Jun 2017 18:00:40 +0000 (11:00 -0700)]
egl/wayland: Declare loop vars inside the loop

That is, consistently do this:

    for (int i = 0; ...)

No behavioral change.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
7 years agoegl/surfaceless: Move loop vars inside the loop
Chad Versace [Thu, 22 Jun 2017 18:00:40 +0000 (11:00 -0700)]
egl/surfaceless: Move loop vars inside the loop

That is, consistently do this:

    for (int i = 0; ...)

No behavioral change.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
7 years agoegl/x11: Declare loop vars inside the loop
Chad Versace [Thu, 22 Jun 2017 18:00:40 +0000 (11:00 -0700)]
egl/x11: Declare loop vars inside the loop

That is, consistently do this:

    for (int i = 0; ...)

No behavioral change.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
7 years agoegl/drm: Move loop vars inside the loop
Chad Versace [Thu, 22 Jun 2017 18:00:40 +0000 (11:00 -0700)]
egl/drm: Move loop vars inside the loop

That is, consistently do this:

    for (int i = 0; ...)

No behavioral change.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
7 years agoegl/android: Declare loop vars inside their loops (v2)
Chad Versace [Thu, 22 Jun 2017 18:00:40 +0000 (11:00 -0700)]
egl/android: Declare loop vars inside their loops (v2)

That is, consistently do this:

    for (int i = 0; ...)

No behavioral change.

v2: Rebase.

Reviewed-by: Eric Engestrom <eric@engestrom.ch> (v1)
7 years agosvga: minor whitespace fixes in svga_pipe_vertex.c
Brian Paul [Thu, 22 Jun 2017 19:32:50 +0000 (13:32 -0600)]
svga: minor whitespace fixes in svga_pipe_vertex.c

7 years agosvga: check return value from svga_set_shader( SVGA3D_SHADERTYPE_GS, NULL)
Brian Paul [Thu, 22 Jun 2017 18:58:39 +0000 (12:58 -0600)]
svga: check return value from svga_set_shader( SVGA3D_SHADERTYPE_GS, NULL)

If the call fails we need to flush the command buffer and retry.  In this
case, we were failing to unbind the GS which led to subsequent errors.

This fixes a bug replaying a Cinebench R15 apitrace in a Linux guest.
VMware bug 1894451

cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agosvga: fix pre-mature flushing of the command buffer
Charmaine Lee [Wed, 21 Jun 2017 22:35:38 +0000 (15:35 -0700)]
svga: fix pre-mature flushing of the command buffer

When surface_invalidate is called to invalidate a newly created surface
in svga_validate_surface_view(), it is possible that the command
buffer is already full, and in this case, currently, the associated wddm
winsys function will flush the command buffer and resend the invalidate
surface command. However, this can pre-maturely flush the command buffer
if there is still pending image updates to be patched.

To fix the problem, this patch will add a return status to the
surface_invalidate interface and if it returns FALSE, the caller will
call svga_context_flush() to do the proper context flush.
Note, we don't call svga_context_flush() if surface_invalidate()
fails when flushing the screen surface cache though, because it is
already in the process of context flush, all the image updates are already
patched, calling svga_context_flush() can trigger a deadlock.
So in this case, we call the winsys context flush interface directly
to flush the command buffer.

Fixes driver errors and graphics corruption running Tropics. VMware bug 1891975.

Also tested with MTT glretrace, piglit and various OpenGL apps such as
Heaven, CinebenchR15, NobelClinicianViewer, Lightsmark, GoogleEarth.

cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Brian Paul <brianp@vmware.com>
7 years agoswr: invalidate attachment on transition change
George Kyriazis [Thu, 15 Jun 2017 19:39:36 +0000 (14:39 -0500)]
swr: invalidate attachment on transition change

Consider the following RT attachment order:
1. Attach surfaces attachments 0 & 1, and render with them
2. Detach 0 & 1
3. Re-attach 0 & 1 to different surfaces
4. Render with the new attachment

The definition of a tile being resolved is that local changes have been
flushed out to the surface, hence there is no need to reload the tile before
it's written to.  For an invalid tile, the tile has to be reloaded from
the surface before rendering.

Stage (2) was marking hot tiles for attachements 0 & 1 as RESOLVED,
which means that the hot tiles can be written out to memory with no
need to read them back in (they are "clean").  They need to be marked as
resolved here, because a surface may be destroyed after a detach, and we
don't want to have un-resolved tiles that may force a readback from a
NULL (destroyed) surface.  (Part of a destroy is detach all attachments first)

Stage (3), during the no att -> att transition, we  need to realize that the
"new" surface tiles need to be fetched fresh from the new surface, instead
of using the resolved tiles, that belong to a stale attachment.

This is done by marking the hot tiles as invalid in stage (3), when we realize
that a new attachment is being made, so that they are re-fetched during
rendering in stage (4).

Also note that hot tiles are indexed by attachment.

- Fixes VTK dual depth-peeling tests.
- No piglit changes

Reviewed-by: Tim Rowley <timothy.o.rowley@intel.com>
7 years agoRevert "getteximage: Return correct error value when texure object is not found"
Juan A. Suarez Romero [Thu, 22 Jun 2017 16:16:16 +0000 (18:16 +0200)]
Revert "getteximage: Return correct error value when texure object is not found"

From OpenGL 4.5 spec PDF, section '8.11. Texture Queries', page 236:
  "An INVALID_VALUE error is generated if texture is not the name of
   an existing texture object."

Same wording applies to the compressed version.

But turns out this is a spec bug, and Khronos is fixing it for the next
revisions.

The proposal is to return INVALID_OPERATION in these cases.

This reverts commit 633c959faeae5099fd095f27da7b954e4a36254b.

v2:
- Use _mesa_lookup_texture_err (Samuel Pitoiset)

v3:
- _mesa_lookup_texture_err() already handles texture > 0 (Samuel
Pitoiset)
- Just revert 633c959fae (Juan A. Suarez)

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
7 years agoegl: properly count configs
Eric Engestrom [Wed, 21 Jun 2017 20:55:56 +0000 (21:55 +0100)]
egl: properly count configs

dri2_conf represents another config (which shouldn't be counted)
if it doesn't have the requested ID.

Reported-by: Liu Zhiquan <zhiquan.liu@intel.com>
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoegl/android: Change order of EGLConfig generation (v2)
Chad Versace [Sat, 17 Jun 2017 02:11:21 +0000 (19:11 -0700)]
egl/android: Change order of EGLConfig generation (v2)

Many Android apps (such as Google's official NDK GLES2 example app), and
even portions the core framework code (such as SystemServiceManager in
Nougat), incorrectly choose their EGLConfig.  They neglect to match the
EGLConfig's EGL_NATIVE_VISUAL_ID against the window's native format, and
instead choose the first EGLConfig whose channel sizes match those of
the native window format while ignoring the channel *ordering*.

We can detect such buggy clients in logcat when they call
eglCreateSurface, by detecting the mismatch between the EGLConfig's
format and the window's format.

As a workaround, this patch changes the order of EGLConfig generation
such that all EGLConfigs for HAL pixel format i precede those for HAL
pixel format i+1. In my (chadversary) testing on Android Nougat, this
was good enough to pacify the buggy clients.

v2: Rebase to make patch cherry-pickable to stable.

Cc: mesa-stable@lists.freedesktop.org
Cc: Tomasz Figa <tfiga@chromium.org>
Cc: Rob Herring <robh@kernel.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>