mesa.git
8 years agoisl: Add func isl_surf_get_depth_format()
Chad Versace [Tue, 9 Feb 2016 02:48:41 +0000 (18:48 -0800)]
isl: Add func isl_surf_get_depth_format()

For depth surfaces, it gets the value for
3DSTATE_DEPTH_BUFFER.SurfaceFormat.

8 years agoanv: Rename anv_format::surface_format -> isl_format
Chad Versace [Tue, 9 Feb 2016 02:51:52 +0000 (18:51 -0800)]
anv: Rename anv_format::surface_format -> isl_format

Because that's what it is, an isl format.

8 years agovtn: Clean up acos implementation.
Francisco Jerez [Fri, 29 Jan 2016 02:59:00 +0000 (18:59 -0800)]
vtn: Clean up acos implementation.

Parameterize build_asin() on the fit coefficients so the
implementation can be shared while still using different polynomials
for asin and acos.  Also switch back to implementing acos in terms of
asin -- The improvement obtained from cancelling out the pi/2 terms
was negligible compared to the approximation error.

8 years agonir/spirv: Create integer types of correct signedness.
Francisco Jerez [Mon, 1 Feb 2016 22:59:01 +0000 (14:59 -0800)]
nir/spirv: Create integer types of correct signedness.

vtn_handle_type() creates a signed type regardless of the value of the
signedness flag, which usually doesn't make much of a difference
except when the type is used as base sampled type of an image type,
what will cause the base type of the NIR image variable to be
inconsistent with its format and cause an assertion failure in the
back-end (most likely only reproducible on Gen7), and may change the
semantics of the image intrinsic subtly (e.g. UMIN may become IMIN).

8 years agoanv: Deduplicate dispatch calls
Kristian Høgsberg Kristensen [Sat, 6 Feb 2016 06:36:53 +0000 (22:36 -0800)]
anv: Deduplicate dispatch calls

This can all be shared between gen8+ and pre-gen8.

8 years agoanv: Deduplicate anv_CmdDraw calls
Kristian Høgsberg Kristensen [Sat, 6 Feb 2016 00:41:56 +0000 (16:41 -0800)]
anv: Deduplicate anv_CmdDraw calls

These were all duplicated between gen7_cmd_buffer.c and
gen8_cmd_buffer.c. This commit consolidates both copies in
genX_cmd_buffer.c.

8 years agoanv: Move invariant state to small initial batch
Kristian Høgsberg Kristensen [Sat, 6 Feb 2016 00:11:12 +0000 (16:11 -0800)]
anv: Move invariant state to small initial batch

We use the simple batch helper to submit a batch at driver startup time
which holds all the state that never changes.  We don't have a whole lot
and once we enable tesselation there'll be even less. Even so, it's a
simple mechanism and reduces our steady state batch sizes a bit.

8 years agoanv: Split out batch submit helper from anv_DeviceWaitIdle
Kristian Høgsberg Kristensen [Fri, 5 Feb 2016 23:23:38 +0000 (15:23 -0800)]
anv: Split out batch submit helper from anv_DeviceWaitIdle

We'll reuse this mechanism in the next commit.

8 years agoanv: Share scratch_space helper between gen7 and gen8+
Kristian Høgsberg Kristensen [Fri, 5 Feb 2016 20:47:02 +0000 (12:47 -0800)]
anv: Share scratch_space helper between gen7 and gen8+

The gen7 pipeline has a useful helper function for this, let's use it in
gen8_pipeline.c too.  The gen7 function has an off-by-one bug though: we
have to compute log2(size / 1024) - 1, but we divide by 2048 instead so
as to avoid the case where size is less than 1024 and we'd return -1.

8 years agoanv: Share URB setup between gen7 and gen8+
Kristian Høgsberg Kristensen [Fri, 5 Feb 2016 20:41:51 +0000 (12:41 -0800)]
anv: Share URB setup between gen7 and gen8+

8 years agoMerge remote-tracking branch 'mesa-public/master' into vulkan
Jason Ekstrand [Fri, 5 Feb 2016 23:21:11 +0000 (15:21 -0800)]
Merge remote-tracking branch 'mesa-public/master' into vulkan

8 years agoMerge commit mesa-public/master into vulkan
Jason Ekstrand [Fri, 5 Feb 2016 23:03:04 +0000 (15:03 -0800)]
Merge commit mesa-public/master into vulkan

This pulls in the patches that move all of the compiler stuff around

8 years agoMerge branch mesa-public/master into vulkan
Jason Ekstrand [Fri, 5 Feb 2016 22:21:13 +0000 (14:21 -0800)]
Merge branch mesa-public/master into vulkan

8 years agor600g: Ignore format for PIPE_BUFFER targets
Jan Vesely [Fri, 5 Feb 2016 17:01:13 +0000 (12:01 -0500)]
r600g: Ignore format for PIPE_BUFFER targets

Fixes compute since 7dd31b81fee7fe40bd09cf3fbc324fcc32782479
gallium/radeon: support PIPE_CAP_SURFACE_REINTERPRET_BLOCKS

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
8 years agomesa/get: fix a breakage after rebase
Marek Olšák [Fri, 5 Feb 2016 18:38:40 +0000 (19:38 +0100)]
mesa/get: fix a breakage after rebase

trivial.

8 years agoi965/vec4: don't copy ATTR into 3src instructions with complex swizzles
Matt Turner [Mon, 18 Jan 2016 01:30:14 +0000 (20:30 -0500)]
i965/vec4: don't copy ATTR into 3src instructions with complex swizzles

The vec4 backend, at the end, does this:

    if (inst->is_3src()) {
       for (int i = 0; i < 3; i++) {
          if (inst->src[i].vstride == BRW_VERTICAL_STRIDE_0)
             assert(brw_is_single_value_swizzle(inst->src[i].swizzle));

So make sure that we use the same conditions when trying to
copy-propagate. UNIFORMs will be converted to vstride 0 in
convert_to_hw_regs, but so will ATTRs when interleaved (as will happen
in a GS with multiple attributes). Since the vstride is not set at
copy-prop time, infer it by inspecting dispatch_mode and reject ATTRs if
they have non-scalar swizzles and are interleaved.

Fixes assertion errors in dolphin-generated geometry shaders (or
misrendering on opt builds) on Sandybridge or on IVB/HSW with
INTEL_DEBUG=nodualobj.

Co-authored-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93418
Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org>
8 years agodocs/relnotes: document memory info extensions
Marek Olšák [Fri, 5 Feb 2016 16:47:13 +0000 (17:47 +0100)]
docs/relnotes: document memory info extensions

8 years agogallium/radeon: implement query_memory_info (v2)
Marek Olšák [Tue, 2 Feb 2016 01:09:36 +0000 (02:09 +0100)]
gallium/radeon: implement query_memory_info (v2)

v2: don't use DIV_ROUND_UP (no so useful)
    also return eviction stats

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agost/mesa: implement and enable memory info extensions (v2)
Marek Olšák [Tue, 2 Feb 2016 00:27:55 +0000 (01:27 +0100)]
st/mesa: implement and enable memory info extensions (v2)

v2: assert and return if query_memory_info is not set
    rebase

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agomesa: implement GL_ATI_meminfo (v2)
Marek Olšák [Tue, 2 Feb 2016 00:26:59 +0000 (01:26 +0100)]
mesa: implement GL_ATI_meminfo (v2)

v2: rebase

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agomesa: implement GL_NVX_gpu_memory_info (v2)
Marek Olšák [Tue, 2 Feb 2016 00:22:52 +0000 (01:22 +0100)]
mesa: implement GL_NVX_gpu_memory_info (v2)

v2: implement eviction queries properly
    add gl_memory_info structure

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agogallium: add interface for querying memory usage and sizes (v2)
Marek Olšák [Mon, 1 Feb 2016 20:56:50 +0000 (21:56 +0100)]
gallium: add interface for querying memory usage and sizes (v2)

If you're worried about the duplication of some CAPs, we can remove them
later.

v2: add fields for memory eviction stats

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agogallium/radeon: remove radeon_info::r600_tiling_config
Marek Olšák [Sat, 30 Jan 2016 01:54:47 +0000 (02:54 +0100)]
gallium/radeon: remove radeon_info::r600_tiling_config

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agogallium/radeon: get pipe_interleave_bytes AKA group_bytes from the winsys
Marek Olšák [Sat, 30 Jan 2016 01:50:34 +0000 (02:50 +0100)]
gallium/radeon: get pipe_interleave_bytes AKA group_bytes from the winsys

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agogallium/radeon: set num_banks in the winsys
Marek Olšák [Sat, 30 Jan 2016 01:29:32 +0000 (02:29 +0100)]
gallium/radeon: set num_banks in the winsys

amdgpu doesn't have to set this, because radeonsi gets it from tile mode
arrays by default.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agogallium/radeon: just get num_tile_pipes from the winsys
Marek Olšák [Sat, 30 Jan 2016 00:52:58 +0000 (01:52 +0100)]
gallium/radeon: just get num_tile_pipes from the winsys

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agowinsys/amdgpu: add an assertion to cik_get_num_tile_pipes (v2)
Marek Olšák [Sat, 30 Jan 2016 00:44:26 +0000 (01:44 +0100)]
winsys/amdgpu: add an assertion to cik_get_num_tile_pipes (v2)

v2: print an error to stderr

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agowinsys/amdgpu: remove an r600-only setting
Marek Olšák [Sat, 30 Jan 2016 00:37:17 +0000 (01:37 +0100)]
winsys/amdgpu: remove an r600-only setting

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agogallium/radeon: rename & reorder members of radeon_info
Marek Olšák [Sat, 30 Jan 2016 00:27:46 +0000 (01:27 +0100)]
gallium/radeon: rename & reorder members of radeon_info

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agomesa: Fix locking of GLsync objects.
Steinar H. Gunderson [Tue, 2 Feb 2016 00:16:51 +0000 (01:16 +0100)]
mesa: Fix locking of GLsync objects.

GLsync objects had a race condition when used from multiple threads
(which is the main point of the extension, really); it could be
validated as a sync object at the beginning of the function, and then
deleted by another thread before use, causing crashes. Fix this by
changing all casts from GLsync to struct gl_sync_object to a new
function _mesa_get_and_ref_sync() that validates and increases
the refcount.

In a similar vein, validation itself uses _mesa_set_search(), which
requires synchronization -- it was called without a mutex held, causing
spurious error returns and other issues. Since _mesa_get_and_ref_sync()
now takes the shared context mutex, this problem is also resolved.

Fixes bug #92757, found while developing Nageru, my live video mixer
(due for release at FOSDEM 2016).

v2: Marek: silence warnings, fix declaration after code

Signed-off-by: Steinar H. Gunderson <sesse@google.com>
Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: add placeholder MC and SRBM performance counter groups
Nicolai Hähnle [Fri, 11 Dec 2015 21:03:56 +0000 (16:03 -0500)]
radeonsi: add placeholder MC and SRBM performance counter groups

Yet another change motivated by AMD GPUPerfStudio compatibility. These groups
are not directly accessible from userspace, and AMD GPUPerfStudio does not
actually query them - it just requires them to be there. Hence, adding
a placeholder for now.

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: re-order the SQ_xx performance counter blocks
Nicolai Hähnle [Fri, 11 Dec 2015 20:58:11 +0000 (15:58 -0500)]
radeonsi: re-order the SQ_xx performance counter blocks

This is yet another change motivated by appeasing AMD GPUPerfStudio's
hardcoding of performance counter group numbers.

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: re-order the perfcounter hardware blocks
Nicolai Hähnle [Fri, 11 Dec 2015 20:42:44 +0000 (15:42 -0500)]
radeonsi: re-order the perfcounter hardware blocks

As documented in the comment, AMD GPUPerfStudio unfortunately hardcodes the
order of performance counter groups. Let's do the pragmatic thing and present
the same order as Catalyst/Crimson.

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium/radeon: add GPIN driver query group
Nicolai Hähnle [Fri, 11 Dec 2015 20:39:23 +0000 (15:39 -0500)]
gallium/radeon: add GPIN driver query group

This group was used by older versions of AMD GPUPerfStudio (via
AMD_performance_monitor) to identify the GPU family, and GPUPerfStudio
still complains when it isn't available.

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: Allow dumping LLVM IR before optimization passes
Nicolai Hähnle [Thu, 4 Feb 2016 07:59:39 +0000 (08:59 +0100)]
radeonsi: Allow dumping LLVM IR before optimization passes

Set R600_DEBUG=preoptir to dump the LLVM IR before optimization passes,
to allow diagnosing problems caused by optimization passes.

Note that in order to compile the resulting IR with llc, you will first
have to run at least the mem2reg pass, e.g.

opt -mem2reg -S < shader.ll | llc -march=amdgcn -mcpu=bonaire

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com> (original patch)
Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com> (w/ debug flag)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium/radeon: emit LLVM `ret void` before radeon_llvm_finalize_module
Nicolai Hähnle [Thu, 4 Feb 2016 07:51:52 +0000 (08:51 +0100)]
gallium/radeon: emit LLVM `ret void` before radeon_llvm_finalize_module

This allows dumping a consumable LLVM module before the initial optimization
passes are run.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agost/mesa: bail out of try_pbo_upload_common when constant upload fails
Nicolai Hähnle [Wed, 3 Feb 2016 17:02:55 +0000 (18:02 +0100)]
st/mesa: bail out of try_pbo_upload_common when constant upload fails

Also fixes a resource leak when an upload_mgr is used for constants.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agost/mesa: bail out of try_pbo_upload_common when vertex upload fails
Nicolai Hähnle [Wed, 3 Feb 2016 17:00:47 +0000 (18:00 +0100)]
st/mesa: bail out of try_pbo_upload_common when vertex upload fails

At the same time, fix a memory leak noticed by Ilia Mirkin.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agost/mesa: reduce the scope of sampler_view in try_pbo_upload_common
Nicolai Hähnle [Wed, 3 Feb 2016 16:58:40 +0000 (17:58 +0100)]
st/mesa: reduce the scope of sampler_view in try_pbo_upload_common

We can get rid of our reference immediately, since the driver will hold
onto it for us.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agost/mesa: do uploads earlier in try_pbo_upload_common
Nicolai Hähnle [Wed, 3 Feb 2016 16:54:33 +0000 (17:54 +0100)]
st/mesa: do uploads earlier in try_pbo_upload_common

While rather unlikely, uploads _can_ fail. Doing them earlier means
we'll have to restore less state when they do fail, and it's slightly
easier to check the restore code.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agomain: Use a derived value for the default sample count
Neil Roberts [Thu, 4 Feb 2016 16:12:07 +0000 (16:12 +0000)]
main: Use a derived value for the default sample count

Previously the framebuffer default sample count was taken directly
from the value given by the application. On the i965 driver on HSW if
the value wasn't one that is supported by the hardware it would hit an
assert when it tried to program the state for it. This patch fixes it
by adding a derived sample count to the state for the default
framebuffer. The driver can then quantize this to one of the valid
values in its UpdateState handler when the _NEW_BUFFERS state changes.
_mesa_geometric_samples is changed to use the new derived value.

Fixes the piglit test arb_framebuffer_no_attachments-query

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93957
Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agoprogram: Use _mesa_geometric_samples to calculate gl_NumSamples
Neil Roberts [Thu, 4 Feb 2016 16:12:06 +0000 (16:12 +0000)]
program: Use _mesa_geometric_samples to calculate gl_NumSamples

Otherwise it won't take into account the default samples for
framebuffers with no attachments.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agomain: Use _mesa_geometric_samples to calculate GL_SAMPLE_BUFFERS
Neil Roberts [Thu, 4 Feb 2016 16:12:05 +0000 (16:12 +0000)]
main: Use _mesa_geometric_samples to calculate GL_SAMPLE_BUFFERS

Otherwise it won't take into account the default samples for
framebuffers with no attachments.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agomain: Use _mesa_geometric_samples to calculate the value of GL_SAMPLES
Neil Roberts [Thu, 4 Feb 2016 16:12:04 +0000 (16:12 +0000)]
main: Use _mesa_geometric_samples to calculate the value of GL_SAMPLES

Otherwise it won't take into account the default samples for
framebuffers with no attachments.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonvc0: avoid negatives in PUSH_SPACE argument
Ilia Mirkin [Fri, 5 Feb 2016 05:47:03 +0000 (00:47 -0500)]
nvc0: avoid negatives in PUSH_SPACE argument

Fixup to commit 03b3eb90d - the number of buffers could be larger than
the number of elements, in which case we'd pass a negative argument to
PUSH_SPACE, which would be bad. While we're at it, merge it with the
other PUSH_SPACE at the top of the function.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: mesa-stable@lists.freedesktop.org
8 years agonvc0: add some missing PUSH_SPACE's
Ilia Mirkin [Fri, 5 Feb 2016 05:36:03 +0000 (00:36 -0500)]
nvc0: add some missing PUSH_SPACE's

nvc0_vbo has explicit push space checking enabled, so we must run
PUSH_SPACE by hand. A few spots missed that.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: mesa-stable@lists.freedesktop.org
8 years agonvc0/ir: fix converting between predicate and gpr
Ilia Mirkin [Fri, 5 Feb 2016 03:58:48 +0000 (22:58 -0500)]
nvc0/ir: fix converting between predicate and gpr

The spill logic will insert convert ops when moving between files. It
seems like the emission logic wasn't quite ready for these converts.

Tested on fermi, and visually looked at nvdisasm output for maxwell.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: mesa-stable@lists.freedesktop.org
8 years agonvc0: add support for ARB_query_buffer_object
Ilia Mirkin [Sun, 31 Jan 2016 20:18:23 +0000 (15:18 -0500)]
nvc0: add support for ARB_query_buffer_object

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agost/mesa: add query buffer support
Ilia Mirkin [Sat, 9 May 2015 16:31:48 +0000 (12:31 -0400)]
st/mesa: add query buffer support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium: add PIPE_CAP_QUERY_BUFFER_OBJECT
Ilia Mirkin [Sun, 10 Jan 2016 04:30:16 +0000 (23:30 -0500)]
gallium: add PIPE_CAP_QUERY_BUFFER_OBJECT

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium: add a way to store query result into buffer
Ilia Mirkin [Sun, 3 May 2015 00:28:11 +0000 (20:28 -0400)]
gallium: add a way to store query result into buffer

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agomesa: add core implementation of ARB_query_buffer_object
Ilia Mirkin [Wed, 6 May 2015 02:58:12 +0000 (22:58 -0400)]
mesa: add core implementation of ARB_query_buffer_object

Forwards query result writes to drivers.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agomesa: add driver interface for writing query results to buffers
Ilia Mirkin [Wed, 6 May 2015 02:57:41 +0000 (22:57 -0400)]
mesa: add driver interface for writing query results to buffers

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agomesa: Handle QUERY_BUFFER_BINDING in GetIntegerv
Rafal Mielniczuk [Thu, 27 Mar 2014 20:59:05 +0000 (21:59 +0100)]
mesa: Handle QUERY_BUFFER_BINDING in GetIntegerv

Signed-off-by: Rafal Mielniczuk <rafal.mielniczuk2@gmail.com>
[imirkin: move to GL/GL_CORE section]
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agomesa: Add QueryBuffer to context
Rafal Mielniczuk [Thu, 27 Mar 2014 20:59:04 +0000 (21:59 +0100)]
mesa: Add QueryBuffer to context

Add QueryBuffer and initialise it to NullBufferObj on start

Signed-off-by: Rafal Mielniczuk <rafal.mielniczuk2@gmail.com>
[imirkin: also release QueryBuffer on free]
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agomesa: Add ARB_query_buffer_object extension flag
Rafal Mielniczuk [Thu, 27 Mar 2014 20:59:03 +0000 (21:59 +0100)]
mesa: Add ARB_query_buffer_object extension flag

Signed-off-by: Rafal Mielniczuk <rafal.mielniczuk2@gmail.com>
[imirkin: add string to extensions.c]
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoglapi: Add xml infrastructure for ARB_query_buffer_object
Rafal Mielniczuk [Thu, 27 Mar 2014 20:59:02 +0000 (21:59 +0100)]
glapi: Add xml infrastructure for ARB_query_buffer_object

Signed-off-by: Rafal Mielniczuk <rafal.mielniczuk2@gmail.com>
[imirkin: move definition to gl_API.xml as it is very short]
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoglsl: simplify setting of image access qualifiers
Timothy Arceri [Thu, 4 Feb 2016 00:08:43 +0000 (11:08 +1100)]
glsl: simplify setting of image access qualifiers

Cc: Francisco Jerez <currojerez@riseup.net>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agomesa: remove dead program parameter functions
Timothy Arceri [Thu, 4 Feb 2016 10:50:39 +0000 (21:50 +1100)]
mesa: remove dead program parameter functions

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agost/nine: Use align_free when needed
Axel Davy [Thu, 28 Jan 2016 21:32:43 +0000 (22:32 +0100)]
st/nine: Use align_free when needed

Use align_free to free memory allocated
with align_malloc.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
8 years agost/nine: Disallow non-argb8888 cursors
Axel Davy [Tue, 26 Jan 2016 15:40:30 +0000 (16:40 +0100)]
st/nine: Disallow non-argb8888 cursors

Only argb8888 cursors are allowed.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
8 years agost/nine: Enforce centroid for color input when multisampling is on
Axel Davy [Sat, 9 Jan 2016 13:16:15 +0000 (14:16 +0100)]
st/nine: Enforce centroid for color input when multisampling is on

The color inputs must automatically use centroid whether
multisampling is used or not.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
8 years agost/nine: Fix centroid flag
Axel Davy [Thu, 28 Jan 2016 21:44:42 +0000 (22:44 +0100)]
st/nine: Fix centroid flag

sem.reg.mod & NINED3DSPDM_CENTROID is worth 4 when
centroid is requested, whereas
TGSI_INTERPOLATE_LOC_CENTROID is worth 1.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Use fast clears more often for MRTs
Axel Davy [Mon, 4 Jan 2016 15:15:18 +0000 (16:15 +0100)]
st/nine: Use fast clears more often for MRTs

This enables to use fast clears in the following
case:

pixel shader renders to 1 RT
4 RT bound
clear
new pixel shader bound that renders to 4 RTs

Previously the fast clear path wouldn't be hit,
because when trying the fast clear path,
the framebuffer state would be configured for 1 RT,
instead of 4.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
8 years agost/nine: Use linear filtering for shadow mapping
Axel Davy [Mon, 4 Jan 2016 15:13:07 +0000 (16:13 +0100)]
st/nine: Use linear filtering for shadow mapping

Some docs say linear filtering is always used when
app does shadow mapping.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
8 years agost/nine: Respect block alignment on surface lock
Patrick Rudolph [Thu, 22 Oct 2015 13:46:16 +0000 (15:46 +0200)]
st/nine: Respect block alignment on surface lock

Respect block alignment for ATI1/ATI2 format when trying to lock a
surface using LockRect().
Fixes failing WINE tests device.c test_surface_blocks() tests.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Add Render state validation layer
Axel Davy [Sat, 16 May 2015 12:28:41 +0000 (14:28 +0200)]
st/nine: Add Render state validation layer

Testing Win behaviour seems to show wrong states
are accepted, but then depending on the states
some specific 'good' behaviours happen.

This adds some validation to catch invalid
states and have these 'good' behaviours
when it happens.

Also reorders SetRenderState to match the expected
optimisation:
(Value == previous Value) => return immediately,
which affects D3D9 hacks too.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Signed-off-by: Patrick Rudolph <siro@das-labor.org>
8 years agoDRI_CONFIG: Add option to override vendor id
Patrick Rudolph [Mon, 25 May 2015 11:06:58 +0000 (13:06 +0200)]
DRI_CONFIG: Add option to override vendor id

Add config option override_vendorid to report a fake card in d3dadapter9 drm.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Implement NineDevice9_GetAvailableTextureMem
Patrick Rudolph [Wed, 30 Sep 2015 14:42:10 +0000 (16:42 +0200)]
st/nine: Implement NineDevice9_GetAvailableTextureMem

Implement a device private memory counter similar to Win 7.

Only textures and surfaces increment vidmem and may return
ERR_OUTOFVIDEOMEMORY. Vertexbuffers and indexbuffers creation always
succeedes, even when out of video memory.

Fixes "Vampire: The Masquerade - Bloodlines" allocating resources until crash.
Fixes "Age of Conan" allocating resources until crash.
Fixes failing WINE test device.c test_vidmem_accounting().

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Handle Window Occlusion
Patrick Rudolph [Sat, 20 Jun 2015 18:06:11 +0000 (20:06 +0200)]
st/nine: Handle Window Occlusion

Apps can know if the window is occluded by checking for
specific error messages. The behaviour is different
for Device9 and Device9Ex.

This allow games to release the mouse and stop rendering
until the focus is restored.

In case of multiple swapchain we do care only of the device one.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Store minor version num
Patrick Rudolph [Sun, 23 Aug 2015 06:42:34 +0000 (08:42 +0200)]
st/nine: Store minor version num

To keep compatible with older ID3DPresent interfaces (used to talk
with Wine), store the minor version num accessible to all
statetracker functions (in the NineDevice9 structure).

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Call flush_resource before flush
Axel Davy [Thu, 8 Oct 2015 22:08:43 +0000 (00:08 +0200)]
st/nine: Call flush_resource before flush

flush_resource needs to be called before flush (for
fast clear resolve, etc).

Removes useless computation of resource (it is
already set correctly).

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
8 years agost/nine: Fix remaining swapchain tests
Patrick Rudolph [Thu, 22 Oct 2015 15:00:35 +0000 (17:00 +0200)]
st/nine: Fix remaining swapchain tests

Return D3DERR_INVALIDCALL instead of E_POINTER.
On error set ppBackBuffer to NULL.

Multiple swapchains can only be created in windowed mode as
windowed swapchain.

Set backbuffer to NULL in NineDevice9_GetBackBuffer, but not
in NineSwapChain9_GetBackBuffer.

This fixes all WINE's device.c test_swapchain() tests.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Fix crash NineDevice9_CreateAdditionalSwapChain
Axel Davy [Wed, 11 Nov 2015 09:13:58 +0000 (10:13 +0100)]
st/nine: Fix crash NineDevice9_CreateAdditionalSwapChain

When no window is specified, we should revert to the focus window.

This deserves more tests however (what if the device swapchain is
already using the focus window ?)

Fixes crash for FFXIV

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
8 years agost/nine: Fix possible crash on error
Patrick Rudolph [Thu, 22 Oct 2015 15:02:16 +0000 (17:02 +0200)]
st/nine: Fix possible crash on error

In case swapchain creation fails This->swapchains[i] might be NULL and
causes a crash.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Test more presentation params
Patrick Rudolph [Thu, 22 Oct 2015 14:02:14 +0000 (16:02 +0200)]
st/nine: Test more presentation params

Return errors in case of invalid presentation parameters.
Fixes failing WINE tests device.c test_swapchain_parameters().

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Fix resource9 private data
Patrick Rudolph [Sat, 14 Nov 2015 12:02:43 +0000 (13:02 +0100)]
st/nine: Fix resource9 private data

Store a copy of GUID in the header that is under our control and use it
as key for the hashtable instead of using the application provided pointer.
The application might change the memory after leaving the function.

Fixes a crash for issue https://github.com/iXit/Mesa-3D/issues/130

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Print GUID instead of pointer
Patrick Rudolph [Sat, 14 Nov 2015 11:59:46 +0000 (12:59 +0100)]
st/nine: Print GUID instead of pointer

To ease debugging print the GUID instead of the pointer to it.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Fix use of uninitialized memory
Patrick Rudolph [Thu, 24 Sep 2015 17:57:51 +0000 (19:57 +0200)]
st/nine: Fix use of uninitialized memory

The values of box.z and box.depth weren't set and lead to a crash.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Fix clear for multisample mismatch depth-stencil
Patrick Rudolph [Wed, 23 Sep 2015 14:30:37 +0000 (16:30 +0200)]
st/nine: Fix clear for multisample mismatch depth-stencil

Tests show in case of multisample mismatch between the depth-stencil
buffer and the render target, then it is not cleared.

Fixes failing WINE test visual.c test_multisample_mismatch().

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Fix Volumetexture9_LockBox
Patrick Rudolph [Mon, 31 Aug 2015 17:17:13 +0000 (19:17 +0200)]
st/nine: Fix Volumetexture9_LockBox

Check for valid locked box dimensions.

Fixes failing wine tests device.c test_lockbox_invalid.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Fix ATI2 pitch for non-square
Axel Davy [Sat, 22 Aug 2015 23:09:44 +0000 (01:09 +0200)]
st/nine: Fix ATI2 pitch for non-square

Fixes crash for non-square textures.
We were using the height instead of the
width for some calculations.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
8 years agost/nine: Support D3DFMT_R8G8B8
Patrick Rudolph [Mon, 9 Nov 2015 18:30:13 +0000 (19:30 +0100)]
st/nine: Support D3DFMT_R8G8B8

Add support for D3DFMT_R8G8B8. It allows format conversion for
surfaces of pool scratch.

Usually gallium formats equivalents for d3d9 formats
have their names reversed.

The gallium format PIPE_FORMAT_R8G8B8_UNORM is the right
equivalent here, and its name is likely wrong (reversed).

Fixes a crash in TmNationsForever.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Use cso for viewport
Patrick Rudolph [Sat, 19 Dec 2015 06:43:08 +0000 (07:43 +0100)]
st/nine: Use cso for viewport

Use CSO to catch redundant viewport changes.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Fix shade mode flat
Patrick Rudolph [Sat, 12 Dec 2015 09:22:12 +0000 (10:22 +0100)]
st/nine: Fix shade mode flat

Shade mode flat is only working if pixelshaders have interpolate
set to TGSI_INTERPOLATE_COLOR on color inputs.

Fixes failing WINE tests visual.c test_shademode().

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Clear rendertarget on creation
Patrick Rudolph [Thu, 10 Dec 2015 19:08:03 +0000 (20:08 +0100)]
st/nine: Clear rendertarget on creation

Clear every rendertarget on creation.
Fixes https://github.com/iXit/Mesa-3D/issues/139

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Allow ColorFill on D3DFMT_NULL surfaces
Patrick Rudolph [Sat, 5 Dec 2015 13:14:38 +0000 (14:14 +0100)]
st/nine: Allow ColorFill on D3DFMT_NULL surfaces

Report success instead of failing as there's no resource for those surfaces.
Fixes a crash in Crysis: Warhead.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Introduce STREAMFREQ state
Axel Davy [Sat, 12 Dec 2015 18:20:28 +0000 (19:20 +0100)]
st/nine: Introduce STREAMFREQ state

Previous vertex elements code update
was protected by
'if ((group & (NINE_STATE_VDECL | NINE_STATE_VS)) ||
state->changed.stream_freq & ~1)'
itself protected by
'if (group & (NINE_STATE_COMMON | NINE_STATE_VS))'

If no state is changed except the stream frequency,
no update would happen.

This patch solves the problem by adding a new
NINE_STATE_STREAMFREQ state.
Another way would be to add state->changed.stream_freq & ~1
check to the main test.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
8 years agost/nine: Catch redundant SetStreamSourceFreq calls
Axel Davy [Sat, 12 Dec 2015 18:11:10 +0000 (19:11 +0100)]
st/nine: Catch redundant SetStreamSourceFreq calls

Some apps do redundant SetStreamSourceFreq calls.
Catch them to improve performance.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
8 years agost/nine: Squash indexbuffer9 and vertexbuffer9
Patrick Rudolph [Sun, 15 Nov 2015 10:26:25 +0000 (11:26 +0100)]
st/nine: Squash indexbuffer9 and vertexbuffer9

The indexbuffer9 codebase was lagging behind the one of vertexbuffer9.

Add buffer9 as common code base for indexbuffer9 and vertexbuffer9.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Unset vtxbuf on reset
Axel Davy [Sun, 15 Nov 2015 16:10:40 +0000 (17:10 +0100)]
st/nine: Unset vtxbuf on reset

We forgot to reset vtxbuf.
This fixes some crashes.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
8 years agost/nine: Use pipe_resource_reference for vtxbuf
Axel Davy [Sat, 30 Jan 2016 10:39:21 +0000 (11:39 +0100)]
st/nine: Use pipe_resource_reference for vtxbuf

This seems cleaner to actually reference the resources for vtxbuf,
rather than relying on the fact the bound d3d streams do.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Use ff vertex shader when position_t is used
Axel Davy [Sat, 7 Nov 2015 16:47:06 +0000 (17:47 +0100)]
st/nine: Use ff vertex shader when position_t is used

When an application sets a vertex shader, we are supposed
to use it, and when no vertex shader are set, we are supposed
to revert to fixed function vertex shader.

It seems there is an exception: when the vertex declaration
has a position_t index, we should revert to fixed function
vertex shader.

Up to know we were checking if device->state.vs is set
to know whether to use programmable shader or not.

With this commit we determine whether we use programmable shader
or not when vertex shader/declaration are set, but
stateblocks do complicate things a bit.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
8 years agost/nine: Don't increment refcount on VertexDeclaration creation failure
Patrick Rudolph [Thu, 28 May 2015 18:45:01 +0000 (20:45 +0200)]
st/nine: Don't increment refcount on VertexDeclaration creation failure

NineUnknown_ctor increments the refcount even in case of an error.
Restructure the code to prevent refcount increments.
Fixes a couple of wine tests.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Change StretchRect check order
Axel Davy [Mon, 24 Aug 2015 17:36:55 +0000 (19:36 +0200)]
st/nine: Change StretchRect check order

Textures in SYSTEMMEM don't have resources attached.
Instead of returning an error for them, StretchRect
was crashing.
This changes the check order to fix that case.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
8 years agost/nine: Initialize lights in stateblocks
Axel Davy [Sun, 16 Aug 2015 19:39:42 +0000 (21:39 +0200)]
st/nine: Initialize lights in stateblocks

This fixes a crash.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
8 years agost/nine: Fix fixed-function blendweights
Patrick Rudolph [Tue, 22 Sep 2015 14:10:40 +0000 (16:10 +0200)]
st/nine: Fix fixed-function blendweights

The last weighted element is one minus the sum of all previous weights.
Fixes WINE test visual.c test_vertex_blending.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Always normalize hitDir
Patrick Rudolph [Tue, 22 Sep 2015 12:30:35 +0000 (14:30 +0200)]
st/nine: Always normalize hitDir

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Replace r[0] with tmp
Patrick Rudolph [Tue, 22 Sep 2015 11:24:08 +0000 (13:24 +0200)]
st/nine: Replace r[0] with tmp

Replace r[0] with tmp to ease code reading.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Fix ff calculation of midVec
Patrick Rudolph [Mon, 28 Sep 2015 17:44:26 +0000 (19:44 +0200)]
st/nine: Fix ff calculation of midVec

In case of non local viewer the value has to be subtracted.
Fixes failing WINE tests in test_specular_lighting() (visual.c)

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>