Commit Graph

87456 Commits

Author SHA1 Message Date
Axel Davy 848ffc81e4 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>
2016-12-20 23:44:21 +01:00
Axel Davy aea7a019ef 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>
2016-12-20 23:44:21 +01:00
Axel Davy eed47b748f 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>
2016-12-20 23:44:21 +01:00
Axel Davy 6bbb7b9fc5 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>
2016-12-20 23:44:21 +01:00
Axel Davy c1871e829a 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>
2016-12-20 23:44:21 +01:00
Axel Davy 64e232bd60 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>
2016-12-20 23:44:21 +01:00
Axel Davy f72d8719eb 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>
2016-12-20 23:44:21 +01:00
Axel Davy 1b24d5e1f5 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>
2016-12-20 23:44:21 +01:00
Axel Davy e3c59fbd25 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>
2016-12-20 23:44:21 +01:00
Axel Davy b40f12ebf0 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>
2016-12-20 23:44:21 +01:00
Axel Davy c75415224f 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>
2016-12-20 23:44:21 +01:00
Axel Davy 32f6f91617 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>
2016-12-20 23:44:21 +01:00
Axel Davy 1efdc8f594 st/nine: Remove useless code in ff ps
Current is already initialized to Diffuse.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
2016-12-20 23:44:21 +01:00
Axel Davy 7afea63d4f 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>
2016-12-20 23:44:21 +01:00
Axel Davy 191b90a35c 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>
2016-12-20 23:44:21 +01:00
Axel Davy 1ee978fa50 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>
2016-12-20 23:44:21 +01:00
Axel Davy 89716b0b38 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>
2016-12-20 23:44:21 +01:00
Axel Davy 877dc0308f 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>
2016-12-20 23:44:21 +01:00
Axel Davy e94ac230a2 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>
2016-12-20 23:44:21 +01:00
Axel Davy 85811d0e87 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>
2016-12-20 23:44:21 +01:00
Axel Davy bce9fe8db2 driconf: Fix missing gettext
DRI_CONF_NINE_OVERRIDEVENDOR was missing gettext for the
description.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
2016-12-20 23:44:21 +01:00
Axel Davy 59048e7548 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>
2016-12-20 23:44:21 +01:00
Axel Davy 06657fa203 st/nine: Rework buffer presentation path
Use the new API for DISCARD.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
2016-12-20 23:44:21 +01:00
Axel Davy 35ea402a24 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>
2016-12-20 23:44:21 +01:00
Axel Davy f78cbbdfaa 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>
2016-12-20 23:44:21 +01:00
Axel Davy 0eef5491d3 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>
2016-12-20 23:44:21 +01:00
Axel Davy b2f17e5f62 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>
2016-12-20 23:44:21 +01:00
Axel Davy 2cd8622fb3 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>
2016-12-20 23:44:21 +01:00
Axel Davy 461e03167e 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>
2016-12-20 23:44:21 +01:00
Axel Davy c3e5140142 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>
2016-12-20 23:44:21 +01:00
Axel Davy 9c0f65e08a 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>
2016-12-20 23:44:21 +01:00
Axel Davy e7a0f580a6 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>
2016-12-20 23:44:20 +01:00
Axel Davy ada0c2ceaa st/nine: Capture texturestage states in pixel stateblocks
pixels stateblocks need to capture these.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
2016-12-20 23:44:20 +01:00
Axel Davy 8b021be769 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>
2016-12-20 23:44:20 +01:00
Axel Davy b3b593b83b 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>
2016-12-20 23:44:20 +01:00
Axel Davy fad0f147fb 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>
2016-12-20 23:44:20 +01:00
Axel Davy 503d729029 st/nine: Fix bad light initialization in stateblocks
src was initialized instead of dst.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
2016-12-20 23:44:20 +01:00
Axel Davy 9be94d5c1a st/nine: Remove unused ff.changed.group
It was unused.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
2016-12-20 23:44:20 +01:00
Axel Davy 638b70985d 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>
2016-12-20 23:44:20 +01:00
Axel Davy d38215fb17 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>
2016-12-20 23:44:20 +01:00
Axel Davy 409ad78777 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>
2016-12-20 23:44:20 +01:00
Axel Davy 0630d3600b st/nine: Remove useless call to nine_update_state
The call was not needed.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
2016-12-20 23:44:20 +01:00
Axel Davy 494ace4b85 st/nine: Add validation to SetSamplerState
Check value validity and mimick Win behaviour.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
2016-12-20 23:44:20 +01:00
Axel Davy f4d5bc2555 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>
2016-12-20 23:44:20 +01:00
Axel Davy c4268fd175 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>
2016-12-20 23:44:20 +01:00
Axel Davy 1736ef6570 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>
2016-12-20 23:44:20 +01:00
Chad Versace fbb4af96c6 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>
2016-12-20 11:53:31 -08:00
Kenneth Graunke 62b8bcda1c 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>
2016-12-20 11:41:29 -08:00
Kenneth Graunke 8fc5443a2b 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>
2016-12-20 11:41:28 -08:00
Jonathan Gray d74c3e55b3 mesa: don't attempt to unlock an unlocked debug state mutex
Commit 929fcee47e 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>
2016-12-20 11:41:04 -08:00