mesa.git
7 years agost/nine: Back viewport to nine_context
Axel Davy [Wed, 19 Oct 2016 19:57:52 +0000 (21:57 +0200)]
st/nine: Back viewport to nine_context

Part of the refactor to move all gallium calls to
nine_state.c, and have all internal states required
for those calls in nine_context.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Back scissor to nine_context
Axel Davy [Wed, 19 Oct 2016 19:47:02 +0000 (21:47 +0200)]
st/nine: Back scissor to nine_context

Part of the refactor to move all gallium calls to
nine_state.c, and have all internal states required
for those calls in nine_context.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Back RT to nine_context
Axel Davy [Wed, 19 Oct 2016 19:38:47 +0000 (21:38 +0200)]
st/nine: Back RT to nine_context

Part of the refactor to move all gallium calls to
nine_state.c, and have all internal states required
for those calls in nine_context.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Back current index buffer to nine_context
Axel Davy [Wed, 19 Oct 2016 18:41:40 +0000 (20:41 +0200)]
st/nine: Back current index buffer to nine_context

Part of the refactor to move all gallium calls to
nine_state.c, and have all internal states required
for those calls in nine_context.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Back all shader constants to nine_context
Axel Davy [Tue, 18 Oct 2016 20:43:53 +0000 (22:43 +0200)]
st/nine: Back all shader constants to nine_context

For device vs shader float constants and may_swvp,
the same tips than for the other constant types is
used.

Also memset the constants properly.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Back sampler states to nine_context
Axel Davy [Tue, 18 Oct 2016 18:48:54 +0000 (20:48 +0200)]
st/nine: Back sampler states to nine_context

Part of the refactor to move all gallium calls to
nine_state.c, and have all internal states required
for those calls in nine_context.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Back vs to nine_context
Axel Davy [Mon, 17 Oct 2016 19:43:11 +0000 (21:43 +0200)]
st/nine: Back vs to nine_context

And move programmable_vs storage and computation.
Part of the refactor to move all gallium calls to
nine_state.c, and have all internal states required
for those calls in nine_context.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Back vdecl to nine_context
Axel Davy [Mon, 17 Oct 2016 19:18:42 +0000 (21:18 +0200)]
st/nine: Back vdecl to nine_context

Part of the refactor to move all gallium calls to
nine_state.c, and have all internal states required
for those calls in nine_context.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Move stream freq data to nine_context
Axel Davy [Sun, 16 Oct 2016 17:16:31 +0000 (19:16 +0200)]
st/nine: Move stream freq data to nine_context

Part of the refactor to move all gallium calls to
nine_state.c, and have all internal states required
for those calls in nine_context.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Move vtxbuf to nine_context
Axel Davy [Sun, 16 Oct 2016 16:17:27 +0000 (18:17 +0200)]
st/nine: Move vtxbuf to nine_context

Part of the refactor to move all gallium calls to
nine_state.c, and have all internal states required
for those calls in nine_context.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Move stream_usage_mask to nine_context
Axel Davy [Sun, 16 Oct 2016 15:49:09 +0000 (17:49 +0200)]
st/nine: Move stream_usage_mask to nine_context

Part of the refactor to move all gallium calls to
nine_state.c, and have all internal states required
for those calls in nine_context.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Back textures into nine_context
Axel Davy [Sun, 16 Oct 2016 14:09:51 +0000 (16:09 +0200)]
st/nine: Back textures into nine_context

Part of the refactor to move all gallium calls to
nine_state.c, and have all internal states required
for those calls in nine_context.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Move texture setting to nine_context_*
Axel Davy [Sun, 16 Oct 2016 13:56:14 +0000 (15:56 +0200)]
st/nine: Move texture setting to nine_context_*

And move samplers_shadow to nine_context.
Part of the refactor to move all gallium calls to
nine_state.c, and have all internal states required
for those calls in nine_context.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Track changed.texture only for stateblocks
Axel Davy [Sun, 16 Oct 2016 13:29:46 +0000 (15:29 +0200)]
st/nine: Track changed.texture only for stateblocks

Part of the refactor to move all gallium calls to
nine_state.c, and have all internal states required
for those calls in nine_context.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Move draw calls to nine_state
Axel Davy [Sun, 16 Oct 2016 09:34:35 +0000 (11:34 +0200)]
st/nine: Move draw calls to nine_state

Part of the refactor to move all gallium calls to
nine_state.c, and have all internal states required
for those calls in nine_context.

v2: Release buffers for Draw*Up functions in device9.c,
instead of nine_context. This prevents a leak with csmt
where the wrong pointers were released.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Move core of device clear to nine_state
Axel Davy [Sat, 15 Oct 2016 11:52:04 +0000 (13:52 +0200)]
st/nine: Move core of device clear to nine_state

Part of the refactor to move all gallium calls to
nine_state.c, and have all internal states required
for those calls in nine_context.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Introduce nine_context
Axel Davy [Sat, 15 Oct 2016 11:17:52 +0000 (13:17 +0200)]
st/nine: Introduce nine_context

nine_context is a new structure which goal will be
to contain all internal states. It will be the states
of the second thread in the to-be-introduced CSMT mode.

This patch moves several internal states to nine_context,
while the next patches add the other fields.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Implement WFOG properly
Axel Davy [Tue, 29 Nov 2016 23:00:25 +0000 (00:00 +0100)]
st/nine: Implement WFOG properly

We were advertising support for WFOG (like all win drivers),
but we weren't implementing it.
This patch implements the behaviour. See comments.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Fix ff texture coordinate selection
Axel Davy [Sun, 27 Nov 2016 15:23:37 +0000 (16:23 +0100)]
st/nine: Fix ff texture coordinate selection

The code was wrongly detecting which texture coordinates
to generate when the coordinate index was different to
the stage index.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Convert redundant check to assert in ff ps
Axel Davy [Sun, 27 Nov 2016 12:14:21 +0000 (13:14 +0100)]
st/nine: Convert redundant check to assert in ff ps

We disable the alpha stage if the color stage is disabled.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Fix two special cases in ff ps
Axel Davy [Sun, 27 Nov 2016 12:13:13 +0000 (13:13 +0100)]
st/nine: Fix two special cases in ff ps

if first alpha stage is disabled and writes to temp,
diffuse alpha is written to temp.
Last stage always writes to current.

Behaviour was deduced by tests with a test app.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Remove useless code in ff ps
Axel Davy [Sun, 27 Nov 2016 12:10:52 +0000 (13:10 +0100)]
st/nine: Remove useless code in ff ps

Current is already initialized to Diffuse.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Fix ff cases when stages should be disabled
Axel Davy [Sat, 26 Nov 2016 20:58:29 +0000 (21:58 +0100)]
st/nine: Fix ff cases when stages should be disabled

When a texture is read by a stage for colorop, it should
be disabled, and disable following stages.

When a texture is read for alphaop, 1.0f is read for the input,
which is the behaviour for a dummy texture.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Always initialize current in ff ps
Axel Davy [Sun, 27 Nov 2016 11:55:46 +0000 (12:55 +0100)]
st/nine: Always initialize current in ff ps

The check was not catching all possible cases.
NVE4 should be fine.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Fix check for ff specular
Axel Davy [Sat, 26 Nov 2016 20:47:44 +0000 (21:47 +0100)]
st/nine: Fix check for ff specular

Fix the check for computing ff specular.

This seems to match the opengl behavior,
and give the correct output on windows.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Do not saturate illumination coefficients in ff
Axel Davy [Sat, 26 Nov 2016 13:28:38 +0000 (14:28 +0100)]
st/nine: Do not saturate illumination coefficients in ff

Fixes bad rendering of a test app.
Wine has the same behaviour.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Fix ff COLOR0 w component computation
Axel Davy [Sat, 26 Nov 2016 13:25:44 +0000 (14:25 +0100)]
st/nine: Fix ff COLOR0 w component computation

The computation was wrong. COLOR0's last component
should be equal to the material diffuse w component.

The behaviour was checked with a test app on Windows.
Wine has the same behaviour.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Fix specular enable for alpha
Axel Davy [Tue, 22 Nov 2016 20:53:03 +0000 (21:53 +0100)]
st/nine: Fix specular enable for alpha

Apparently specular enable doesn't affect
the alpha channel.

Fixes https://github.com/iXit/Mesa-3D/issues/253

Behaviour comfirmed looking in wine sources.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Ignore MULTISAMPLEMASK when RT is not multisampled
Axel Davy [Sun, 20 Nov 2016 09:55:54 +0000 (10:55 +0100)]
st/nine: Ignore MULTISAMPLEMASK when RT is not multisampled

We were ignoring MULTISAMPLEMASK for non-maskable multisample
modes, but we were missing the non-multisampled case.

Fixes a crash in Halo.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agodriconf: Fix missing gettext
Axel Davy [Tue, 6 Dec 2016 20:58:25 +0000 (21:58 +0100)]
driconf: Fix missing gettext

DRI_CONF_NINE_OVERRIDEVENDOR was missing gettext for the
description.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Add new driconf options to control DISCARD behaviour
Axel Davy [Sat, 19 Nov 2016 12:11:15 +0000 (13:11 +0100)]
st/nine: Add new driconf options to control DISCARD behaviour

See the patch for the new controls added.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Rework buffer presentation path
Axel Davy [Sat, 19 Nov 2016 11:39:31 +0000 (12:39 +0100)]
st/nine: Rework buffer presentation path

Use the new API for DISCARD.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Fix a leak in Swapchain dtor
Axel Davy [Fri, 18 Nov 2016 18:11:29 +0000 (19:11 +0100)]
st/nine: Fix a leak in Swapchain dtor

Count properly the number of backbuffers,
and use the new info to release the correct
number of buffers

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agod3dadapter/present: Add precision for WaitBufferReleased
Axel Davy [Fri, 18 Nov 2016 22:07:08 +0000 (23:07 +0100)]
d3dadapter/present: Add precision for WaitBufferReleased

Add precision on the behaviour of WaitBufferReleased.
All implementers and users of the API were expecting
that behaviour.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agod3dadapter/present: Add new API to ID3DPresent
Axel Davy [Fri, 18 Nov 2016 18:26:54 +0000 (19:26 +0100)]
d3dadapter/present: Add new API to ID3DPresent

The API will enable better support for the commonly
used DISCARD swapchain parameter.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Silent warnings with guid_str
Axel Davy [Tue, 6 Dec 2016 21:24:53 +0000 (22:24 +0100)]
st/nine: Silent warnings with guid_str

In non-debug build, the variables are unused,
and thus trigger a compilation warning.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Do not generate gallium NOP on d3d NOP
Axel Davy [Fri, 18 Nov 2016 17:44:43 +0000 (18:44 +0100)]
st/nine: Do not generate gallium NOP on d3d NOP

Some drivers crash if NOP is generated.
Besides there is no point to generate NOP.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Fix leak in user constant upload path
Axel Davy [Wed, 2 Nov 2016 21:06:29 +0000 (22:06 +0100)]
st/nine: Fix leak in user constant upload path

The new code properly releases the previous buffers
allocated.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Correctly release sw cursor image
Axel Davy [Mon, 24 Oct 2016 19:50:26 +0000 (21:50 +0200)]
st/nine: Correctly release sw cursor image

cursor.image is used for software cursor
emulation. It wasn't released.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Handle when cursor stride is not what is expected
Axel Davy [Mon, 24 Oct 2016 19:48:13 +0000 (21:48 +0200)]
st/nine: Handle when cursor stride is not what is expected

SetCursor assumes for now a 32x32 argb cursor with pitch 128.
32x32 argb doesn't have pitch 128 on all hw, thus use a
temporary surface with the correct pitch when needed.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Avoid crash on empty Draw*Up
Axel Davy [Sun, 23 Oct 2016 20:27:30 +0000 (22:27 +0200)]
st/nine: Avoid crash on empty Draw*Up

Ignore empty draw calls.
Avoid assertion fault when such draw calls happen
in u_upload_mgr.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Capture texturestage states in pixel stateblocks
Axel Davy [Sun, 23 Oct 2016 20:26:23 +0000 (22:26 +0200)]
st/nine: Capture texturestage states in pixel stateblocks

pixels stateblocks need to capture these.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Add missing changed states to pixel stateblocks
Axel Davy [Sun, 23 Oct 2016 10:16:38 +0000 (12:16 +0200)]
st/nine: Add missing changed states to pixel stateblocks

Some states were not properly recorded in pixel stateblocks.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Add some debug info in stateblocks
Axel Davy [Sun, 23 Oct 2016 10:16:06 +0000 (12:16 +0200)]
st/nine: Add some debug info in stateblocks

This is useful to check what is exactly recorded.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Remove useless check in surface9 ctor
Axel Davy [Fri, 21 Oct 2016 15:14:14 +0000 (17:14 +0200)]
st/nine: Remove useless check in surface9 ctor

Textures already have the check in BaseTexture9.
Non-Textures cannot be in the MANAGED Pool.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Fix bad light initialization in stateblocks
Axel Davy [Wed, 19 Oct 2016 22:00:57 +0000 (00:00 +0200)]
st/nine: Fix bad light initialization in stateblocks

src was initialized instead of dst.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Remove unused ff.changed.group
Axel Davy [Wed, 19 Oct 2016 20:18:56 +0000 (22:18 +0200)]
st/nine: Remove unused ff.changed.group

It was unused.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Fix ps multisample check
Axel Davy [Wed, 19 Oct 2016 19:08:57 +0000 (21:08 +0200)]
st/nine: Fix ps multisample check

We want to use centroid for nonmaskable
multisampling as well.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Fix useless swapchain init checks
Axel Davy [Wed, 19 Oct 2016 18:57:48 +0000 (20:57 +0200)]
st/nine: Fix useless swapchain init checks

In NineDevice9_SetDefaultState we can assume the
implicit swapchain is properly initialized.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Don't update stream_usage_mask in sw path
Axel Davy [Sun, 16 Oct 2016 15:47:56 +0000 (17:47 +0200)]
st/nine: Don't update stream_usage_mask in sw path

The variable is used only in the hw path.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Remove useless call to nine_update_state
Axel Davy [Sun, 16 Oct 2016 08:54:41 +0000 (10:54 +0200)]
st/nine: Remove useless call to nine_update_state

The call was not needed.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Add validation to SetSamplerState
Axel Davy [Sat, 16 May 2015 14:46:51 +0000 (16:46 +0200)]
st/nine: Add validation to SetSamplerState

Check value validity and mimick Win behaviour.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agost/nine: Improve doc of D3DPMISCCAPS_POSTBLENDSRGBCONVERT
Axel Davy [Sat, 9 Jan 2016 12:07:27 +0000 (13:07 +0100)]
st/nine: Improve doc of D3DPMISCCAPS_POSTBLENDSRGBCONVERT

The cap should be advertised for d3d10 able cards,
but only for Ex contexts.

Unfortunately at this point Mesa has no way to know if
Ex is used or not (the info is got later).

Signed-off-by: Axel Davy <axel.davy@ens.fr>
7 years agogallium-docs: Add documentation for when using several contexts
Axel Davy [Mon, 19 Dec 2016 19:06:51 +0000 (20:06 +0100)]
gallium-docs: Add documentation for when using several contexts

Add documentation to explicit what can be expected and what is allowed
when using several contexts.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agogallium-docs: Add documentation for threading requirements
Axel Davy [Mon, 19 Dec 2016 18:51:13 +0000 (19:51 +0100)]
gallium-docs: Add documentation for threading requirements

Add documentation for the requirements related to threading
for screens and contexts.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoegl: Check config's surface types in eglCreate*Surface()
Chad Versace [Fri, 16 Dec 2016 19:00:13 +0000 (11:00 -0800)]
egl: Check config's surface types in eglCreate*Surface()

If the provided EGLConfig does not support the requested surface type,
then emit EGL_BAD_MATCH.

Fixes dEQP-EGL.functional.negative_api.create_pbuffer_surface
on GBM.

Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
7 years agoglsl: Use ir_var_temporary when generating inline functions.
Kenneth Graunke [Mon, 19 Dec 2016 22:32:57 +0000 (14:32 -0800)]
glsl: Use ir_var_temporary when generating inline functions.

We were using ir_var_auto for the inlined function parameter variables,
which is wrong, as it suggests that those are real variables declared
by the program.

Normally this doesn't matter.  However, if you called built-ins at
global scope, it would pollute the global variable namespace with
these new parameter temporaries.  If the shader already had variables
with those names, the linker might see contradictory global variable
declarations and raise an error.

Making them temporaries indicates that these are just things generated
by the compiler internally.  This avoids confusing the linker.

Fixes a new Piglit test: glsl-fs-multiple-builtins.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99154
Reported-by: Niels Ole Salscheider <niels_ole@salscheider-online.de>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
7 years agoi965: Don't bail on vertex element processing if we need draw params.
Kenneth Graunke [Mon, 19 Dec 2016 19:21:27 +0000 (11:21 -0800)]
i965: Don't bail on vertex element processing if we need draw params.

BaseVertex, BaseInstance, DrawID, and some edge flag conditions need
vertex buffer and elements structs.  We can't bail early in this case.

Gen4-7 already do this properly.  Gen8+ did not.

Thanks to Ilia Mirkin for helping track this down.

Cc: mesa-stable@lists.freedesktop.org
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99144
Reported-by: Pierre-Eric Pelloux-Prayer <pelloux@gmail.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agomesa: don't attempt to unlock an unlocked debug state mutex
Jonathan Gray [Sun, 11 Dec 2016 15:42:16 +0000 (02:42 +1100)]
mesa: don't attempt to unlock an unlocked debug state mutex

Commit 929fcee47e46781c57f2a354ce0a013915c033d1 introduced code that
attempts to unlock an unlocked mutex which is undefined behaviour.

On OpenBSD this leads to an abort:

0  0x0000124dadfa96ba in thrkill () at <stdin>:2
1  0x0000124dadf3da39 in *_libc_abort () at /usr/src/lib/libc/stdlib/abort.c:52
2  0x0000124d2c1165b5 in *_libpthread_pthread_mutex_unlock (mutexp=<optimized out>)
    at /usr/src/lib/librthread/rthread_sync.c:221
3  0x0000124d279c02e4 in init_attrib_groups (ctx=0x124df0fda000) at main/context.c:825
4  _mesa_initialize_context (ctx=ctx@entry=0x124df0fda000, api=api@entry=API_OPENGL_CORE,
    visual=visual@entry=0x7f7ffffbdfd0, share_list=share_list@entry=0x0,
    driverFunctions=driverFunctions@entry=0x7f7ffffbda60) at main/context.c:1204
5  0x0000124d27b507ec in st_create_context (api=api@entry=API_OPENGL_CORE,
    pipe=pipe@entry=0x124dc4910000, visual=visual@entry=0x7f7ffffbdfd0,
    share=share@entry=0x0, options=options@entry=0x7f7ffffbe128)
    at state_tracker/st_context.c:545
6  0x0000124d27b8639f in st_api_create_context (stapi=<optimized out>,
    smapi=0x124d1b608800, attribs=0x7f7ffffbe100, error=0x7f7ffffbe0fc, shared_stctxi=0x0)
    at state_tracker/st_manager.c:669
7  0x0000124d27cc5b9c in dri_create_context (api=<optimized out>, visual=0x124d8a0f8a00,
    cPriv=0x124de473f240, major_version=<optimized out>, minor_version=<optimized out>,
    flags=<optimized out>, notify_reset=false, error=0x7f7ffffbe2b4,
    sharedContextPrivate=0x0) at dri_context.c:123
8  0x0000124d27cc5029 in driCreateContextAttribs (screen=0x124d8a0f8400,
    api=<optimized out>, config=0x124d8a0f8a00, shared=<optimized out>,
    num_attribs=<optimized out>, attribs=<optimized out>, error=0x7f7ffffbe2b4,
    data=0x124d77814a00) at dri_util.c:448
9  0x0000124d8e109b00 in drisw_create_context_attribs (base=0x124df3e08700,
    config_base=0x124d7a0e7300, shareList=<optimized out>, num_attribs=<optimized out>,
    attribs=<optimized out>, error=0x7f7ffffbe2b4) at drisw_glx.c:476
10 0x0000124d8e104b4a in glXCreateContextAttribsARB (dpy=0x124d533f0000,
    config=0x124d7a0e7300, share_context=0x0, direct=1, attrib_list=0x7f7ffffbe300)
    at create_context.c:78

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
7 years agoglsl: allow invariant on fragment shader outputs.
Dave Airlie [Mon, 23 May 2016 04:18:03 +0000 (14:18 +1000)]
glsl: allow invariant on fragment shader outputs.

From page 27 (page 33 of the PDF) of the GLSL 1.20 spec:

    " Only variables output from a vertex shader can be candidates for
      invariance."

But this later changes to:

From page 37 (page 43 of the PDF) of the GLSL 1.30 spec:

    " Only variables output from a shader can be candidates for
      invariance."

We can also find:

From page 37 (page 43 of the PDF) of the GLSL 1.30 spec:

    " Initially, by default, all output variables are allowed to be
      variant. To force all output variables to be invariant, use the
      pragma

        #pragma STDGL invariant(all)

      before all declarations in a shader. If this pragma is used after
      the declaration of any variables or functions, then the set of
      outputs that behave as invariant is undefined. It is an error to
      use this pragma in a fragment shader."

But this needs to be corrected and it is being addressed at:
https://cvs.khronos.org/bugzilla/show_bug.cgi?id=16140

Fixes GL45-CTS.shading_language_420pack.qualifier_order.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Andres Gomez <agomez@igalia.com>
7 years agoi965: keep gl_program shader info in sync after gather info
Timothy Arceri [Thu, 1 Dec 2016 02:37:38 +0000 (13:37 +1100)]
i965: keep gl_program shader info in sync after gather info

It's possible that nir_shader was cloned and it no longer contains
a pointer to the shader_info in gl_program. So we need to copy
shader_info back to gl_program if that is the case.

Fixes a regression with NIR_TEST_CLONE=true

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

7 years agonir: Trivial clean ups in the generated nir_constant_expressions.c
Ian Romanick [Tue, 25 Aug 2015 17:11:17 +0000 (18:11 +0100)]
nir: Trivial clean ups in the generated nir_constant_expressions.c

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agonir: Silence unused parameter warnings in nir_constant_expression.c
Ian Romanick [Tue, 25 Aug 2015 16:44:00 +0000 (17:44 +0100)]
nir: Silence unused parameter warnings in nir_constant_expression.c

nir/nir_constant_expressions.c:290:25: warning: unused parameter 'num_components' [-Wunused-parameter]
 evaluate_ball3(unsigned num_components, nir_const_value *_src)
                         ^
nir/nir_constant_expressions.c: In function 'evaluate_fddx':
nir/nir_constant_expressions.c:1282:57: warning: unused parameter '_src' [-Wunused-parameter]
 evaluate_fddx(unsigned num_components, nir_const_value *_src)
                                                         ^

v2: Unconditionally mark the parameters as MAYBE_UNUSED instead of
conditionally adding (void) casts to keep the generator simple.
Suggested by Jason.

Number of total warnings in my build reduced from 1575 to 1485
(reduction of 89).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agonir: Silence missing field initializer warnings for vectors in nir_constant_expressions
Ian Romanick [Tue, 25 Aug 2015 16:21:47 +0000 (17:21 +0100)]
nir: Silence missing field initializer warnings for vectors in nir_constant_expressions

nir/nir_constant_expressions.c: In function 'evaluate_ball2':
nir/nir_constant_expressions.c:279:7: warning: missing initializer for field 'z' of 'struct bool_vec' [-Wmissing-field-initializers]
       };
       ^
nir/nir_constant_expressions.c:234:10: note: 'z' declared here
    bool z;
          ^

Number of total warnings in my build reduced from 2532 to 2304
(reduction of 228).

v2: Initialize bool vectors with 0 instead of false to keep the
generator simpler.  Suggested by Ken.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoglsl: Silence "unused parameter" warnings in ast_type.cpp
Ian Romanick [Mon, 12 Dec 2016 21:35:37 +0000 (13:35 -0800)]
glsl: Silence "unused parameter" warnings in ast_type.cpp

glsl/ast_type.cpp: In function ‘bool validate_point_mode(YYLTYPE*, _mesa_glsl_parse_state*, const ast_type_qualifier&, const ast_type_qualifier&)’:
glsl/ast_type.cpp:173:30: warning: unused parameter ‘loc’ [-Wunused-parameter]
 validate_point_mode(YYLTYPE *loc,
                              ^~~
glsl/ast_type.cpp:174:45: warning: unused parameter ‘state’ [-Wunused-parameter]
                     _mesa_glsl_parse_state *state,
                                             ^~~~~

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoglsl: Trivial whitespace fixes in link_uniforms.cpp
Ian Romanick [Mon, 12 Dec 2016 20:13:13 +0000 (12:13 -0800)]
glsl: Trivial whitespace fixes in link_uniforms.cpp

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoglsl: Silence unused parameter warning in propagate_invariance.cpp
Ian Romanick [Mon, 12 Dec 2016 19:19:20 +0000 (11:19 -0800)]
glsl: Silence unused parameter warning in propagate_invariance.cpp

glsl/propagate_invariance.cpp: In member function ‘virtual ir_visitor_status {anonymous}::ir_invariance_propagation_visitor::visit_leave(ir_assignment*)’:
glsl/propagate_invariance.cpp:86:63: warning: unused parameter ‘ir’ [-Wunused-parameter]
 ir_invariance_propagation_visitor::visit_leave(ir_assignment *ir)
                                                               ^~

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoglsl: Minor formatting fixes in link_uniform_blocks.cpp
Ian Romanick [Mon, 12 Dec 2016 18:56:05 +0000 (10:56 -0800)]
glsl: Minor formatting fixes in link_uniform_blocks.cpp

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoglsl: Fix all the whitespace errors in link_uniform_block_active_visitor.cpp
Ian Romanick [Fri, 9 Dec 2016 23:38:24 +0000 (15:38 -0800)]
glsl: Fix all the whitespace errors in link_uniform_block_active_visitor.cpp

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agomesa: Silence numerous "unused parameter" warnings in dlist.c
Ian Romanick [Fri, 9 Dec 2016 21:44:09 +0000 (13:44 -0800)]
mesa: Silence numerous "unused parameter" warnings in dlist.c

main/dlist.c: In function ‘save_DrawArraysInstancedARB’:
main/dlist.c:1748:36: warning: unused parameter ‘mode’ [-Wunused-parameter]
 save_DrawArraysInstancedARB(GLenum mode,
                                    ^~~~
main/dlist.c:1749:35: warning: unused parameter ‘first’ [-Wunused-parameter]
                             GLint first,
                                   ^~~~~
main/dlist.c:1750:37: warning: unused parameter ‘count’ [-Wunused-parameter]
                             GLsizei count,
                                     ^~~~~
main/dlist.c:1751:37: warning: unused parameter ‘primcount’ [-Wunused-parameter]
                             GLsizei primcount)
                                     ^~~~~~~~~
main/dlist.c: In function ‘save_DrawElementsInstancedARB’:
main/dlist.c:1759:38: warning: unused parameter ‘mode’ [-Wunused-parameter]
 save_DrawElementsInstancedARB(GLenum mode,
                                      ^~~~
main/dlist.c:1760:39: warning: unused parameter ‘count’ [-Wunused-parameter]
                               GLsizei count,
                                       ^~~~~
main/dlist.c:1761:38: warning: unused parameter ‘type’ [-Wunused-parameter]
                               GLenum type,
                                      ^~~~
main/dlist.c:1762:45: warning: unused parameter ‘indices’ [-Wunused-parameter]
                               const GLvoid *indices,
                                             ^~~~~~~
main/dlist.c:1763:39: warning: unused parameter ‘primcount’ [-Wunused-parameter]
                               GLsizei primcount)
                                       ^~~~~~~~~
main/dlist.c: In function ‘save_DrawElementsInstancedBaseVertexARB’:
main/dlist.c:1771:48: warning: unused parameter ‘mode’ [-Wunused-parameter]
 save_DrawElementsInstancedBaseVertexARB(GLenum mode,
                                                ^~~~
main/dlist.c:1772:49: warning: unused parameter ‘count’ [-Wunused-parameter]
                                         GLsizei count,
                                                 ^~~~~
main/dlist.c:1773:48: warning: unused parameter ‘type’ [-Wunused-parameter]
                                         GLenum type,
                                                ^~~~
main/dlist.c:1774:55: warning: unused parameter ‘indices’ [-Wunused-parameter]
                                         const GLvoid *indices,
                                                       ^~~~~~~
main/dlist.c:1775:49: warning: unused parameter ‘primcount’ [-Wunused-parameter]
                                         GLsizei primcount,
                                                 ^~~~~~~~~
main/dlist.c:1776:47: warning: unused parameter ‘basevertex’ [-Wunused-parameter]
                                         GLint basevertex)
                                               ^~~~~~~~~~
main/dlist.c: In function ‘save_DrawArraysInstancedBaseInstance’:
main/dlist.c:1785:45: warning: unused parameter ‘mode’ [-Wunused-parameter]
 save_DrawArraysInstancedBaseInstance(GLenum mode,
                                             ^~~~
main/dlist.c:1786:44: warning: unused parameter ‘first’ [-Wunused-parameter]
                                      GLint first,
                                            ^~~~~
main/dlist.c:1787:46: warning: unused parameter ‘count’ [-Wunused-parameter]
                                      GLsizei count,
                                              ^~~~~
main/dlist.c:1788:46: warning: unused parameter ‘primcount’ [-Wunused-parameter]
                                      GLsizei primcount,
                                              ^~~~~~~~~
main/dlist.c:1789:45: warning: unused parameter ‘baseinstance’ [-Wunused-parameter]
                                      GLuint baseinstance)
                                             ^~~~~~~~~~~~
main/dlist.c: In function ‘save_DrawElementsInstancedBaseInstance’:
main/dlist.c:1797:47: warning: unused parameter ‘mode’ [-Wunused-parameter]
 save_DrawElementsInstancedBaseInstance(GLenum mode,
                                               ^~~~
main/dlist.c:1798:48: warning: unused parameter ‘count’ [-Wunused-parameter]
                                        GLsizei count,
                                                ^~~~~
main/dlist.c:1799:47: warning: unused parameter ‘type’ [-Wunused-parameter]
                                        GLenum type,
                                               ^~~~
main/dlist.c:1800:52: warning: unused parameter ‘indices’ [-Wunused-parameter]
                                        const void *indices,
                                                    ^~~~~~~
main/dlist.c:1801:48: warning: unused parameter ‘primcount’ [-Wunused-parameter]
                                        GLsizei primcount,
                                                ^~~~~~~~~
main/dlist.c:1802:47: warning: unused parameter ‘baseinstance’ [-Wunused-parameter]
                                        GLuint baseinstance)
                                               ^~~~~~~~~~~~
main/dlist.c: In function ‘save_DrawElementsInstancedBaseVertexBaseInstance’:
main/dlist.c:1810:57: warning: unused parameter ‘mode’ [-Wunused-parameter]
 save_DrawElementsInstancedBaseVertexBaseInstance(GLenum mode,
                                                         ^~~~
main/dlist.c:1811:58: warning: unused parameter ‘count’ [-Wunused-parameter]
                                                  GLsizei count,
                                                          ^~~~~
main/dlist.c:1812:57: warning: unused parameter ‘type’ [-Wunused-parameter]
                                                  GLenum type,
                                                         ^~~~
main/dlist.c:1813:62: warning: unused parameter ‘indices’ [-Wunused-parameter]
                                                  const void *indices,
                                                              ^~~~~~~
main/dlist.c:1814:58: warning: unused parameter ‘primcount’ [-Wunused-parameter]
                                                  GLsizei primcount,
                                                          ^~~~~~~~~
main/dlist.c:1815:56: warning: unused parameter ‘basevertex’ [-Wunused-parameter]
                                                  GLint basevertex,
                                                        ^~~~~~~~~~
main/dlist.c:1816:57: warning: unused parameter ‘baseinstance’ [-Wunused-parameter]
                                                  GLuint baseinstance)
                                                         ^~~~~~~~~~~~

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agomesa: Fix all the whitespace errors in dlist.c
Ian Romanick [Fri, 9 Dec 2016 21:38:44 +0000 (13:38 -0800)]
mesa: Fix all the whitespace errors in dlist.c

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agolinker: Accurately mark a uniform block instance array element as used in a stage
Ian Romanick [Wed, 14 Dec 2016 04:33:08 +0000 (20:33 -0800)]
linker: Accurately mark a uniform block instance array element as used in a stage

Now that information about which array-of-arrays elements are accessed
is tracked, use that information to only mark an instance array element
as used-by-stage if, in fact, it is.

Fixes GL45-CTS.program_interface_query.uniform-block-types.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoglsl: Walk a list of ir_dereference_array to mark array elements as accessed
Ian Romanick [Thu, 15 Dec 2016 22:26:24 +0000 (14:26 -0800)]
glsl: Walk a list of ir_dereference_array to mark array elements as accessed

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoglsl: Mark a set of array elements as accessed using a list of array_deref_range
Ian Romanick [Thu, 15 Dec 2016 22:01:28 +0000 (14:01 -0800)]
glsl: Mark a set of array elements as accessed using a list of array_deref_range

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoglsl: Add structures to track accessed elements of a single array
Ian Romanick [Wed, 14 Dec 2016 04:31:19 +0000 (20:31 -0800)]
glsl: Add structures to track accessed elements of a single array

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoglsl: Add tracking for elements of an array-of-arrays that have been accessed
Ian Romanick [Wed, 14 Dec 2016 04:29:23 +0000 (20:29 -0800)]
glsl: Add tracking for elements of an array-of-arrays that have been accessed

If there's a better way to provide access to ir_array_refcount_entry
private members to the test functions, I am very interested to know
about it.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: Francisco Jerez <currojerez@riseup.net>
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoglsl: Use simpler visitor to determine which UBO and SSBO blocks are used
Ian Romanick [Mon, 12 Dec 2016 21:37:46 +0000 (13:37 -0800)]
glsl: Use simpler visitor to determine which UBO and SSBO blocks are used

Very soon this visitor will get more complicated.  The users of the
existing ir_variable_refcount visitor won't need the coming
functionality, and this use doesn't need much of the functionality of
ir_variable_refcount.

v2: ir_array_refcount_visitor::get_variable_entry cannot return NULL, so
don't check it.  Suggested by Timothy.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoglsl: Track the linearized array index for each UBO instance array element
Ian Romanick [Mon, 12 Dec 2016 20:24:18 +0000 (12:24 -0800)]
glsl: Track the linearized array index for each UBO instance array element

v2: Set linearizer_array_index in process_block_array_leaf.  Suggested
by Timothy.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoglsl: Fix wonkey indentation left from previous commit
Ian Romanick [Mon, 12 Dec 2016 19:58:06 +0000 (11:58 -0800)]
glsl: Fix wonkey indentation left from previous commit

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoglsl: Split process_block_array into two functions
Ian Romanick [Mon, 12 Dec 2016 19:54:41 +0000 (11:54 -0800)]
glsl: Split process_block_array into two functions

One for the array parts and one for the leaf members.  This will
simplify later changes.

The indentation is wonkey after this patch.  This was done to make it
more obvious that the function is just getting split.  The next patch
will fix the indentation.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoglsl: Fix program interface queries relating to interface blocks.
Kenneth Graunke [Sat, 17 Dec 2016 01:03:15 +0000 (17:03 -0800)]
glsl: Fix program interface queries relating to interface blocks.

This fixes 555 dEQP tests (using the nougat-cts-dev branch), Piglit's
arb_program_interface_query/arb_program_interface_query-resource-query,
and GL45-CTS.program_interface_query.separate-programs-{tess-control,
tess-eval,geometry}.  Only one dEQP program interface failure remains.

I would have liked to split this up into several distinct changes, but
I wasn't sure how to do that given thet tangled nature of these issues.

So, the issues:

   * We need to treat interface blocks declared as an array of instances
     as a single block - removing the outer array.  The resource list
     entry's name should not include the array length.  Properties such
     as GL_ARRAY_SIZE should refer to the variable inside the block, not
     the interface block's array properties.

   * We need to do this prefixing even for structure variables.

   * We need to do this for built-ins (such as gl_PerVertex.gl_Position).

   * After interface array unwrapping, any variable which is an array
     should have [0] appended.  It doesn't matter if it's a TCS/TES/GS
     input or TCS output - that looked like an attempt to unwrap for
     per-vertex variables, but that didn't consider per-patch variables,
     and as far as I can tell there's nothing to justify this.

Several Mesa developers have suggested that Issue 16 contradicts the
main specification, but I believe that it doesn't - the main spec just
isn't terribly clear.  The main ARB_program_interface query spec says:

  "* For an active interface block not declared as an array of block
     instances, a single entry will be generated, using the block name from
     the shader source.

   * For an active interface block declared as an array of instances,
     separate entries will be generated for each active instance.  The name
     of the instance is formed by concatenating the block name, the "["
     character, an integer identifying the instance number, and the "]"
     character."

Issue 16 says that built-ins should be named "gl_PerVertex.gl_Position",
but several people suggested the second bullet above means that it
should be named "gl_PerVertex[array length].gl_Position".

There are two important things to note.  Those bullet points say
"an active interface block", while the others say "variable" or "active
shader storage block member".  They also don't mention applying the
rules recursively (unlike the other bullets).  Both suggest that
these rules apply to blocks themselves, not members of blocks.

In fact, for GL_UNIFORM_BLOCK queries, we do have "block[0]",
"block[1]", ... resource list entries - so those rules are real,
and actually used.  So if they don't apply to block members, then how
should members be named?  Unfortunately, I don't see any rules outside
of issue 16 - where the rationale is very unclear.  I hope to clarify
the spec in the future.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
7 years agoglsl: Drop bogus is_vertex_input from add_shader_variable().
Kenneth Graunke [Fri, 16 Dec 2016 12:54:59 +0000 (04:54 -0800)]
glsl: Drop bogus is_vertex_input from add_shader_variable().

stage_mask is a bitmask of shader stages, so the proper comparison would
be (1 << MESA_SHADER_VERTEX), not MESA_SHADER_VERTEX itself.

But we only care for structure types, and VS inputs cannot be structs.
So we can just drop this entirely.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
7 years agomesa/get: Convert stencil values to TYPE_UINT.
Kenneth Graunke [Sun, 18 Dec 2016 04:04:32 +0000 (20:04 -0800)]
mesa/get: Convert stencil values to TYPE_UINT.

These are listed as Z+ in the GL spec, and often have values of
0xFFFFFFFF.  For glGetFloat, we should return 4294967295.0 rather than
-1.0.  Similarly, for glGetInteger64v, we should return 0xFFFFFFFF, not
the sign extended 0xFFFFFFFFFFFFFFFF.

Fixes 6 dEQP tests matching the pattern
dEQP-GLES3.functional.state_query.integers.stencil*value*mask*getfloat
when run in a single process (with state reset code happening between
tests, which makes dEQP set the stencil value mask to 0xFFFFFFFF).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
7 years agomesa/get: Add TYPE_UINT for casting through a GLuint.
Kenneth Graunke [Sun, 18 Dec 2016 03:55:53 +0000 (19:55 -0800)]
mesa/get: Add TYPE_UINT for casting through a GLuint.

The "State Tables" section of the OpenGL specification lists many values
as belonging to Z+ (non-negative integers), not Z (all integers).

For ordinary glGetInteger queries, this doesn't matter.  However, when
accessing Z+ values via glGetFloat or glGetInteger64, we need to treat
the source value as an unsigned value.  Otherwise, we'll produce a
negative number when bit 31 is set.

This commit merely adds the plumbing.  It doesn't convert any values.

v2: Gotta catch 'em all (add missing cases caught by Ilia)

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
7 years agomesa/get: Make GetFloat/GetDouble of TYPE_INT_N not normalize things.
Kenneth Graunke [Sun, 18 Dec 2016 03:47:38 +0000 (19:47 -0800)]
mesa/get: Make GetFloat/GetDouble of TYPE_INT_N not normalize things.

GetFloat of integer valued things is supposed to perform a simple
int -> float conversion.  INT_TO_FLOAT is not that.  Instead, it
converts [-21474836482147483647] to a normalized [-1.0, 1.0] float.

This is only used for COMPRESSED_TEXTURE_FORMATS, which nobody in
their right mind would try and access via glGetFloat(), but we may
as well fix it.

Found by inspection.

v2: Gotta catch 'em all (fix another case of this caught by Ilia)

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
7 years agoRevert "cso: don't release sampler states that are bound"
Michel Dänzer [Fri, 16 Dec 2016 03:11:30 +0000 (12:11 +0900)]
Revert "cso: don't release sampler states that are bound"

This reverts commit 6dc96de303290e8d1fc294da478c4f370be98dea. No longer
necessary with the previous change.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agocso: Make sanitize_hash safe for samplers
Michel Dänzer [Fri, 16 Dec 2016 02:17:44 +0000 (11:17 +0900)]
cso: Make sanitize_hash safe for samplers

Remove currently bound sampler states from the hash table before pruning
entries from the hash table, so they cannot accidentally be deleted by
the pruning.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agocso: Store hash key in struct cso_sampler
Michel Dänzer [Fri, 16 Dec 2016 02:41:54 +0000 (11:41 +0900)]
cso: Store hash key in struct cso_sampler

Preparation for following changes, no functional change intended.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agocso: Optimize cso_save/restore_fragment_samplers
Michel Dänzer [Fri, 16 Dec 2016 09:00:33 +0000 (18:00 +0900)]
cso: Optimize cso_save/restore_fragment_samplers

Only copy/memset the pointers that actually need to be.

v2:
* Cast info->nr_samplers to int for calculating delta (Nicolai)

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agocso: Store pointers to struct cso_sampler in struct sampler_info
Michel Dänzer [Fri, 16 Dec 2016 02:13:26 +0000 (11:13 +0900)]
cso: Store pointers to struct cso_sampler in struct sampler_info

Preparation for following changes, no functional change intended.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agocso: Don't restore nr_samplers in cso_restore_fragment_samplers
Michel Dänzer [Fri, 16 Dec 2016 09:05:58 +0000 (18:05 +0900)]
cso: Don't restore nr_samplers in cso_restore_fragment_samplers

If info->nr_samplers > ctx->nr_fragment_samplers_saved, the assignment
would prevent cso_single_sampler_done from unbinding the no longer used
samplers from the driver, which could result in use-after-free. This is
probably unlikely to happen in practice though.

Cc: "12.0 13.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoEGL/android: Enhance pbuffer implementation
Liu Zhiquan [Fri, 9 Dec 2016 11:29:56 +0000 (19:29 +0800)]
EGL/android: Enhance pbuffer implementation

Some dri drivers will pass multiple bits in buffer_mask parameter
to droid_image_get_buffer(), more than the actual supported buffer
type combination. For such case, will go through all the bits, and
will not return error when unsupported buffer is requested, only
return error when the allocation for supported buffer failed.

v2: coding style and log changes
v3: coding style changes and update patch format

Signed-off-by: Liu Zhiquan <zhiquan.liu@intel.com>
Signed-off-by: Long, Zhifang <zhifang.long@intel.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
7 years agoradv: Use correct workgroup size limits.
Bas Nieuwenhuizen [Sun, 18 Dec 2016 20:09:28 +0000 (21:09 +0100)]
radv: Use correct workgroup size limits.

Not sure where the 16k comes from, but pretty sure 2k is the max.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: expose the compute queue
Dave Airlie [Wed, 30 Nov 2016 04:08:10 +0000 (04:08 +0000)]
radv: expose the compute queue

v2: Don't expose the SDMA queue and use the CIK check also in the
    second if. (Bas)

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
7 years agoradv: Only emit PFP ME syncs for DMA on the GFX queue.
Bas Nieuwenhuizen [Sun, 18 Dec 2016 13:05:19 +0000 (14:05 +0100)]
radv: Only emit PFP ME syncs for DMA on the GFX queue.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: Create an empty CS per ring type.
Bas Nieuwenhuizen [Sat, 17 Dec 2016 20:53:38 +0000 (21:53 +0100)]
radv: Create an empty CS per ring type.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: Don't enable CMASK on compute queues.
Bas Nieuwenhuizen [Sat, 17 Dec 2016 20:25:32 +0000 (21:25 +0100)]
radv: Don't enable CMASK on compute queues.

We can't fast clear on compute queues.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: Use RELEASE_MEM packet for MEC timestamp query.
Bas Nieuwenhuizen [Sat, 17 Dec 2016 12:27:37 +0000 (13:27 +0100)]
radv: Use RELEASE_MEM packet for MEC timestamp query.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: Implement indirect dispatch for the MEC.
Bas Nieuwenhuizen [Mon, 12 Dec 2016 07:45:21 +0000 (08:45 +0100)]
radv: Implement indirect dispatch for the MEC.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: update vkCmdUpdateBuffer for the MEC.
Bas Nieuwenhuizen [Mon, 12 Dec 2016 07:42:44 +0000 (08:42 +0100)]
radv: update vkCmdUpdateBuffer for the MEC.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>