Commit Graph

866 Commits

Author SHA1 Message Date
Nicolai Hähnle 42d5465b9b mesa: move glMultiDrawArrays to vbo and fix error handling
When any count[i] is negative, we must skip all draws.

Moving to vbo makes the subsequent change easier.

v2:
- provide the function in all contexts, including GLES
- adjust validation accordingly to include the xfb check
v3:
- fix mix-up of pre- and post-xfb prim count (Nils Wallménius)

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-04-19 08:10:19 +02:00
Bartosz Tomczyk ca41ecf838 mesa/glthread: add async support to ARB_viewport_array functions
v2: fix attribute name, it is count_scale not scale_count

Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2017-04-18 12:19:12 +02:00
Nicolai Hähnle 4fdb691f10 mesa: add GL_ARB_shader_ballot boilerplate
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-04-05 15:25:40 +02:00
Nicolai Hähnle d085c7ce7c mesa: Add GL_ARB_sparse_buffer boilerplate
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-04-05 10:31:01 +02:00
Timothy Arceri dbdd7231c2 mesa: disable glthread when DEBUG_OUTPUT_SYNCHRONOUS is enabled
We could re-enable it also but I haven't tested that yet, and I'm
not sure we care much anyway.

V2: don't disable it from with the call itself. We need a custom
    marshalling function or we get stuck waiting for thread to
    finish.

V3: tidy up redundant code copied from generated version.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2017-04-03 09:31:11 +10:00
Lyude a7cb2b40ed glapi: Add GL_NV_fill_rectangle
Signed-off-by: Lyude <lyude@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
2017-03-31 21:41:08 -04:00
Timothy Arceri 3ef1ff6270 mesa/glthread: add async support to ARB_gpu_shader_int64 uniform functions
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2017-03-31 11:54:36 +11:00
Timothy Arceri eb3df0e838 mesa/glthread: add async support to ARB_gpu_shader_fp64 uniform functions
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2017-03-31 11:54:35 +11:00
Timothy Arceri 16debc652a mesa/glthread: fallback to sync if count validation fails
The old code would sync and then throw a cryptic error message.
There is no need for a custom error, we can just fallback to
the real function and have it do proper validation.

Fixes piglit test:
glsl-uniform-out-of-bounds

Which was returning the wrong error code.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2017-03-30 08:23:00 +11:00
Timothy Arceri 18f4c93b02 mesa/glthread: add async support to glProgramUniform*() functions
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2017-03-30 08:22:51 +11:00
Timothy Arceri 1ea73b9c61 mesa/glthread: print out syncs when MARSHAL_MAX_CMD_SIZE is exceeded
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2017-03-30 08:19:07 +11:00
Timothy Arceri 425671f616 mesa/glthread: add custom marshalling for ClearBufferfv()
This is one of the main causes of syncs in Civ6.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2017-03-25 13:39:12 +11:00
Timothy Arceri adced4a2f9 mesa/marshal: add custom BufferData/BufferSubData marshalling
GL_AMD_pinned_memory requires memory to be aligned correctly, so
we skip marshalling in this case. Also copying the data defeats
the purpose of EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD.

Fixes GL_AMD_pinned_memory piglit tests when glthread is enabled.

Acked-by: Edward O'Callaghan <funfunctor@folklore1984.net>
2017-03-24 11:23:06 +11:00
Timothy Arceri 72fa447d45 mesa: disable glthread when glNewList() is called
glNewList() swaps dispatch tables, and we don't have anything in
place to handle that in glthread.

Tested-by: Michel Dänzer <michel.daenzer@amd.com>
2017-03-20 10:22:20 +11:00
Emil Velikov d9a41ce8aa mapi: automake: add all python scripts to EXTRA_DIST
Otherwise it'll be missing in the tarball and make distcheck will fail.

Fixes: 05dd4a1104 ("glapi: Generate GL API marshalling code from the XML.")
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2017-03-17 13:10:09 +00:00
Jonathan Gray 9e8d6ba1d6 glapi: avoid using $< in non-suffix make rules
Using $< in non-suffix make rules is a GNU extension.  Explicitly use
the name of the python script to fix the build on OpenBSD.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Emil Velikov <emil.velikov@collabore.com>
2017-03-17 13:06:26 +00:00
Emil Velikov c81c563fbb mapi: remove Xlib/xcb include in gl_marshal.py
The only use of the header is to provide the _X_INLINE macro. We already
require (and provide where needed) 'inline', plus it's used in the file
already.

So replace the macro and drop the include. This fixes the build on
platforms which lack the header - from X-less Linuxes to Androids.

Fixes: 05dd4a1104 ("glapi: Generate GL API marshalling code from the XML.")
Reported-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100223
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2017-03-16 13:12:26 +00:00
Timothy Arceri 04a9ca2700 mapi: don't include X11/Xlib-xcb.h on non PTHREAD platforms
Should fix the last of the glthread build issues on windows.
2017-03-16 15:45:40 +11:00
Timothy Arceri 4a32d473fd mesa: fix glthread marshal build issues on platforms without PTHREAD 2017-03-16 15:33:08 +11:00
Gregory Hainaut 93bdad3253 mesa/glthread: restore the dispatch table when incompatible gl calls are detected
While a context only has a single glthread, the context itself can be
attached to several threads. Therefore the dispatch table must be
updated in all threads before the destruction of glthread. In others
words, glthread can only be destroyed safely when the context is deleted.

Fixes remaining crashes in the glx-multithread-makecurrent* tests.

V2: (Timothy Arceri) updated gl_API.dtd marshal_fail description.

Signed-off-by: Gregory Hainaut <gregory.hainaut@gmail.com>
Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
Acked-by: Marek Olšák <maraeo@gmail.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Tested-by: Mike Lothian <mike@fireburn.co.uk>
2017-03-16 14:14:19 +11:00
Eric Anholt 012bfebc07 mesa: Track the current vertex/element array buffers for glthread.
We want to support glthread on GLES contexts with reasonable apps, and on
desktop for apps that use VBOs but haven't completely moved to core GL.
To do so, we have to deal with the "the user may or may not pass user
pointers to draw calls" problem.

Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
Acked-by: Marek Olšák <maraeo@gmail.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Tested-by: Mike Lothian <mike@fireburn.co.uk>
2017-03-16 14:14:19 +11:00
Eric Anholt 238d027ed6 mesa: Disable glthread when glBegin() is called.
glBegin() swaps dispatch tables, and we don't have any code in place for
handling that in glthread (which also messes with dispatch tables), and I
don't particularly care to at this point.

Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
Acked-by: Marek Olšák <maraeo@gmail.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Tested-by: Mike Lothian <mike@fireburn.co.uk>
2017-03-16 14:14:19 +11:00
Eric Anholt cd1c003b18 mesa: Add an attribute for conditions to turn off threading.
The threading for GL core is in place, but there are so few applications
actually using a core GL context that it would be nice to extend support
back.  However, some of the features of compat GL (particularly user
vertex arrays) would be so expensive to track state for that we want to be
able to disable threading when we discover that the app is using them.

Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
Acked-by: Marek Olšák <maraeo@gmail.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Tested-by: Mike Lothian <mike@fireburn.co.uk>
2017-03-16 14:14:19 +11:00
Eric Anholt 43d4f7a227 mesa: Add support for asynchronous glDraw* on GL core.
Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
Acked-by: Marek Olšák <maraeo@gmail.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Tested-by: Mike Lothian <mike@fireburn.co.uk>
2017-03-16 14:14:19 +11:00
Eric Anholt b18755a457 mesa: Add support for NULL arguments like in glBufferData() in marshalling.
This will let us support things like glBufferData() that should be
asynchronous.

Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
Acked-by: Marek Olšák <maraeo@gmail.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Tested-by: Mike Lothian <mike@fireburn.co.uk>
2017-03-16 14:14:19 +11:00
Eric Anholt 1d6b71c5c6 glapi: Mark vertex attrib pointer functions as async.
These don't actually read data out of the pointers, they set the
pointers (or offsets in a VBO) to be used in a later draw call.

v2: Don't forget glVertexAttribIPointer, and don't bother with annotations
    on aliases.
v3: Mark CompressedTexSubImage1D as sync also.

Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
Acked-by: Marek Olšák <maraeo@gmail.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Tested-by: Mike Lothian <mike@fireburn.co.uk>
2017-03-16 14:14:19 +11:00
Paul Berry a4a5de6f18 mesa: Custom thread marshalling for Flush.
Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
Acked-by: Marek Olšák <maraeo@gmail.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Tested-by: Mike Lothian <mike@fireburn.co.uk>
2017-03-16 14:14:18 +11:00
Paul Berry 154a4f2679 mesa: Custom thread marshalling for ShaderSource.
Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
Acked-by: Marek Olšák <maraeo@gmail.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Tested-by: Mike Lothian <mike@fireburn.co.uk>
2017-03-16 14:14:18 +11:00
Paul Berry ef30ce97a6 mesa: Create pointers for multithread marshalling dispatch table.
This patch splits the context's CurrentDispatch pointer into two
pointers, CurrentClientDispatch, and CurrentServerDispatch, so that
when doing multithread marshalling, we can distinguish between the
dispatch table that's being used by the client (to serialize GL calls
into the marshal buffer) and the dispatch table that's being used by
the server (to execute the GL calls).

Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
Acked-by: Marek Olšák <maraeo@gmail.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Tested-by: Mike Lothian <mike@fireburn.co.uk>
2017-03-16 14:14:18 +11:00
Eric Anholt a76a3cf664 mesa: Validate count parameters when marshalling.
Otherwise, for example, glDeleteBuffers(-1, &bo) gets you a segfault
instead of GL_INVALID_VALUE.

Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
Acked-by: Marek Olšák <maraeo@gmail.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Tested-by: Mike Lothian <mike@fireburn.co.uk>
2017-03-16 14:14:18 +11:00
Paul Berry 05dd4a1104 glapi: Generate GL API marshalling code from the XML.
This is not yet used in the build, just generated.

v2: Add missing build dependencies.
v3: Avoid mixing declarations and code, remove logic for avoiding emitting
    code that the compiler's optimizer can deal with anyway.
v4: (Timothy Arceri) move safe_mul() genereation here from a later patch.

Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
Acked-by: Marek Olšák <maraeo@gmail.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Tested-by: Mike Lothian <mike@fireburn.co.uk>
2017-03-16 14:14:18 +11:00
Eric Anholt f05524ffaa glapi: Mark compressed teximage functions as sync.
Without doing some additional tracking, we won't know whether the data
will be immediate user data, or will be loaded from a PBO.  The normal
teximage functions will be sync by default because they don't know up
front what the size of their image data is.  But for compressed teximage,
we have the count information, so they would end up async by default.

Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
Acked-by: Marek Olšák <maraeo@gmail.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Tested-by: Mike Lothian <mike@fireburn.co.uk>
2017-03-16 14:14:18 +11:00
Paul Berry f5052f45a2 glapi: Annotate functions with "marshal" attribute.
Several API functions require special treatment in order to be marshalled
to a background thread.  Others can't be safely executed in a background
thread and need to be executed synchronously (e.g. since they return data
through a pointer argument).

This annotation will be used when code generating thread marshalling code,
to ensure that each function is marshalled in the correct way.

Note that PixelMap functions are marked as synchronous for now since
their pointer may be relative to buffer on the GPU, so we'll need
special logic to marshal them properly.

v2: Move description of attribute types to a comment in the dtd file.

Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
Acked-by: Marek Olšák <maraeo@gmail.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Tested-by: Mike Lothian <mike@fireburn.co.uk>
2017-03-16 14:14:18 +11:00
Emil Velikov e4c7911150 nir: remove shebang from python scripts
Analogous to earlier commit(s).

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-03-10 14:12:47 +00:00
Emil Velikov 68c38b2431 mapi/gen: remove shebang from python scripts
All of those should be executed $PYTHON2/python2 [or equivalent] hence
why they are missing the execute bit.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-03-10 14:12:47 +00:00
Emil Velikov 9a502f5c47 mapi: do not mandate bash for es*api/ABI-check
Seemingly there is nothing bash specific in these. The Debian
checkbashisms does not spot neither run in zsh.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-03-10 14:12:47 +00:00
Emil Velikov 32d153c428 mesa: drop the execute bit from gl.xml
This is a spec file which is parsed by scripts.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Andreas Boll <andreas.boll.dev@gmail.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-03-10 14:12:45 +00:00
Emil Velikov 45a37c98e7 mapi/glapi: remove unused next_available_offset.sh
Afaict there was no [documented] users since it was introduced.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-03-10 14:12:45 +00:00
Gregory Hainaut 2ab5eccf5d glapi: fix typo in count_scale
2*4=8

Signed-off-by: Gregory Hainaut <gregory.hainaut@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2017-03-07 08:11:40 +11:00
Eric Anholt 3958c01762 glapi: Fix a comment typo
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
2017-03-03 20:29:12 +11:00
Emil Velikov 6854716f37 mapi: remove unused mapi.[ch]
The final user of it was st/vega.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Andreas Boll <andreas.boll.dev@gmail.com>
2017-02-24 17:37:02 +00:00
Robert Bragg d83a33a9de mesa: Separate INTEL_performance_query frontend
To allow the backend interfaces for AMD_performance_monitor and
INTEL_performance_query to evolve independently based on the more
specific requirements of each extension this starts by separating
the frontends of these extensions.

Even though there wasn't much tying these frontends together, this
separation intentionally copies what few helpers/utilities that were
shared between the two extensions, avoiding any re-factoring specific to
INTEL_performance_query so that the evolution will be easier to follow
later.

Signed-off-by: Robert Bragg <robert@sixbynine.org>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2017-02-22 12:12:27 +00:00
Emil Velikov ee5de93269 mapi: automake: include builddir prior to srcdir
Analogous to previous commit.

Cc: "12.0 13.0" <mesa-dev@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2017-01-27 17:56:56 +00:00
Dave Airlie 150f2fa789 mapi: Add support for ARB_gpu_shader_int64.
Just add the boilerplate xml code.

v2 (idr): Update dispatch_sanity.  Only add extension functions in core
profile.

v3 (idr): Remove comment line from gl_API.xml.  Suggested by Matt.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> [v1]
Reviewed-by: Matt Turner <mattst88@gmail.com>
2017-01-20 15:41:23 -08:00
Emil Velikov dfc84c2296 mesa: make use of HAVE_FUNC_ATTRIBUTE_ALIAS macro
We must make sure that xserver has an equivalent one-line
change to its configure.ac as the glx/glapi headers get copied over.

Then again, xserver does _not_ seem to set HAVE_ALIAS to begin with so
one might want to look into that first.

Cc: Adam Jackson <ajax@redhat.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2017-01-18 16:01:14 +00:00
Boyan Ding 0ee4c4a732 glX_proto_send.py: Unify the style of function pointer calls in structs
Signed-off-by: Boyan Ding <boyan.j.ding@gmail.com>
2017-01-13 16:24:32 +00:00
Grazvydas Ignotas 8945836658 mapi: update the asm code to support x32
Fixes crashes when both glx-tls and asm are enabled on x32.

Cc: mesa-stable@lists.freedesktop.org
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94512
Bugzilla: https://bugs.gentoo.org/show_bug.cgi?id=575458
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
2017-01-13 00:59:32 +01:00
Lionel Landwerlin d4b753a50b glapi: add missing INTEL_conservative_rasterization
v2: put enum directly in gl_API.xml (Ilia)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
2016-12-13 16:27:56 +00:00
Tapani Pälli ef16003320 mesa: add missing CONTEXT_ROBUST_ACCESS enum
commit 85008db1d5 missed this enum
for GL_KHR_robustness implementation

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2016-10-27 07:06:41 +03:00
Jonathan Gray 907ace5798 mapi: automake: set VISIBILITY_CFLAGS for shared glapi
shared glapi was previously built without setting CFLAGS for
AM_CFLAGS and VISIBILITY_CFLAGS.

This resulted in symbols being exported that shouldn't be.

The x86 and sparc assembly versions of the dispatch table partially
mitigated this by using .hidden.  Otherwise shared_dispatch_stub_*
were being exported.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Cc: "11.2 12.0 13.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2016-10-24 11:29:23 +01:00