Commit Graph

4417 Commits

Author SHA1 Message Date
Daniel Stone 492ffbed63 st/dri2: Implement DRI2bufferDamageExtension
Add a pipe_screen->set_damage_region() hook to propagate
set-damage-region requests to the driver, it's then up to the driver to
decide what to do with this piece of information.

If the hook is left unassigned, the buffer-damage extension is
considered unsupported.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Qiang Yu <yuq825@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2019-08-13 14:40:45 +02:00
Jordan Justen 3198c5b7bf
gallium/dri2: Use pipe_screen::resource_get_param in image queries
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Eric Anholt <eric@anholt.net>
2019-08-13 01:12:29 -07:00
Jordan Justen 2decad495f
gallium/dri2: Support images with multiple planes for modifiers
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Eric Anholt <eric@anholt.net>
2019-08-13 01:12:29 -07:00
Jordan Justen 6e749a6b2b
gallium/dri2: Refactor image property queries
This refactor will let us more easily use
pipe_screen::resource_get_param as an alternative to
pipe_screen::resource_get_handle.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Eric Anholt <eric@anholt.net>
2019-08-13 01:12:29 -07:00
Jordan Justen 2066966c10
gallium/dri2: Support creating multi-planar modifier images
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Eric Anholt <eric@anholt.net>
2019-08-13 01:12:29 -07:00
Jordan Justen fe06655e86
gallium/dri2: Implement dri2ImageExtension.queryDmaBufFormatModifierAttribs
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Eric Anholt <eric@anholt.net>
2019-08-13 01:12:29 -07:00
Jan Vesely 6b8269d0bb clover: Fix build after clang r367864
v2: Drop special case of llvm-9
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Acked-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Reviewed-by: Aaron Watry <awatry@gmail.com>
2019-08-06 23:33:55 -04:00
Timothy Arceri dca119f12c mesa/gallium: add dric option to allow overriding GL vendor string
Will be used in the following patch.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93551
2019-08-07 10:12:49 +10:00
Jon Turney 84fae8e649 st/dri: Move dri2_format_mapping table and it's accessors from dri2.c to dri_helpers.c
8af1990a exposed dri2_get_mapping_by_fourcc() in dri_helpers.h, so it
could be used by dri_get_egl_image(), but didn't move it.  This breaks
the build in the with_dri=false case (e.g. when building for a target
which doesn't have libdrm, so swrast is only dri driver built)
2019-08-06 12:21:56 +00:00
Mike Blumenkrantz 8af1990ad7 st/dri: simplify dri_get_egl_image by reusing dri2_format_table
this makes dri2_get_mapping_by_fourcc accessible from dri_helpers.h
and does a direct lookup on the fourcc id to match the pipe format

v2 (Ken): Allow map to be NULL, use img->texture->format.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
2019-07-31 15:11:15 -07:00
Kenneth Graunke 3f9012839e Revert "st/dri: simplify dri_get_egl_image by reusing dri2_format_table"
This reverts commit c47af8b95f.  It causes
dEQP-EGL regressions.  (I think there is an easy fix, but we'll have it
go through review again.)
2019-07-31 11:06:32 -07:00
Mike Blumenkrantz c47af8b95f st/dri: simplify dri_get_egl_image by reusing dri2_format_table
this makes dri2_get_mapping_by_fourcc accessible from dri_helpers.h
and does a direct lookup on the fourcc id to match the pipe format

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2019-07-31 09:50:06 -07:00
Mike Blumenkrantz 7404833c2e gallium: add handling for YUV planar surfaces
st/dri:
this adds a table (similar to the one in i965) which provides
mappings for turning various planar formats into multiple sampler views.
whereas only NV12 and IYUV were supported, now many more formats are
supported here:
* P0XX
* YUV4XX
* YVU4XX
* AYUV
* XYUV
* YUYV
* UYVY

the table is used directly to handle image creation, simplifying
a lot of code and resolving related TODO/FIXME items where workarounds were
previously in place to manage NV12 and IYUV formats exclusively

st/mesa:
the changes here relate to setting up samplers for the planar formats.
this requires:
* checking for driver support for all the sampler formats
* creating the samplers with the corresponding formats and swizzling
* running nir_lower_tex with the appropriate options to trigger the lowering
  for each plane->sampler

fixes kwg/mesa#36

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2019-07-31 09:50:06 -07:00
Eric Engestrom abc226cf41 tree-wide: replace MAYBE_UNUSED with ASSERTED
Suggested-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2019-07-31 09:41:05 +01:00
Matt Turner 9cc4311d86 st/nine: Drop preprocessor guards for glibc-2.12
Same rationale as the previous patch, but additionally these checks just
seem entirely unnecessary. pthread_self() has been used in Mesa since at
least 1999.

Acked-by: Eric Engestrom <eric.engestrom@intel.com>
2019-07-30 11:49:09 -07:00
Marek Olšák 187cc07d05 gallium: create multimedia contexts as compute-only if graphics is unsupported
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
2019-07-29 17:52:41 -04:00
Ilia Mirkin affb2da0f8 gallium: remove boolean from state tracker APIs
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
2019-07-22 22:13:51 -04:00
Erik Faye-Lund 39e7fbf24a gallium: get rid of PIPE_CAP_SM3
PIPE_CAP_SM3 has always been an odd one out of all our caps. While most
other caps are fine-grained and single-purpose, this cap encode several
features in one. And since OpenGL cares more about single features, it'd
be nice to get rid of this one.

As it turns, this is now relatively simple. We only really care about
three features using this cap, and those already got their own caps. So
we can remove it, and make sure all current drivers just give the same
response to all of them.

The only place we *really* care about SM3 is in nine, and there we can
instead just re-construct the information based on the finer-grained
caps. This avoids DX9 semantics from needlessly leaking into all of the
drivers, most of who doesn't care a whole lot about DX9 specifically.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
2019-07-10 15:50:51 +02:00
Mike Blumenkrantz c8dcc308cc st/dri: fix typo in format table for GR1616 format
the dri image format here should match the fourcc format

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2019-07-01 15:17:10 -07:00
Mike Blumenkrantz 08fc14a979 st/dri: pass dri2_format_mapping directly to dri2_create_image_from_winsys
this makes the entire struct available for use here

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2019-07-01 15:16:56 -07:00
Dylan Baker 97c2c4546c Revert "meson: Add support for using cmake for finding LLVM"
This reverts commit 5157a42765.

There is a meson bug that causes llvm to always be statically linked,
which is obviously not what we want. I haven't had time to look into it
yet, but for now let's just revert it.
2019-06-28 16:36:38 -07:00
Dylan Baker 5157a42765 meson: Add support for using cmake for finding LLVM
Meson has support for using cmake as a finder for some dependencies,
including LLVM. Using cmake has a lot of advantages: it needs less meson
maintenance to keep working (even for llvm updates); it works more
sanely for cross compiles (as llvm-config is a compiled binary not a
shell script). Meson 0.51.0 also has a new generic variable getter that
can be used to get information from either cmake, pkg-config, or
config-tools dependencies, which is needed for cmake. We continue to
support using llvm-config if you don't have cmake installed, or if cmake
cannot find a suitable version.

Fixes: 0d59459432
       ("meson: Force the use of config-tool for llvm")
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
2019-06-27 22:12:02 +00:00
Gert Wollny ef4429d9c5 gallium/st: Add Gallium hud to swrast drivers
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2019-06-21 08:54:57 +02:00
Timur Kristóf c94b70a178 st/nine: Use tgsi_to_nir when preferred IR is NIR.
This patch allows nine to read the preferred IR from pipe caps and use
NIR when that is preferred by the driver, by calling tgsi_to_nir. Also
adds some debug options that allow overriding it.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Axel Davy <davyaxel0@gmail.com>
2019-06-05 23:32:13 +02:00
Tapani Pälli 397fe0cc50 st/dri: enable EGL_ANDROID_blob_cache on gallium drivers
Verified to work properly with Iris driver on Android Celadon. Cache
files get generated as 'com.android.opengl.shaders_cache' for each
application.

v2: check that cache was returned (Eric Engestrom)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
2019-05-24 09:17:04 +03:00
Kenneth Graunke d305409db5 st/dri: Minor style fixes
Trivial.
2019-05-15 14:49:14 -07:00
Eric Anholt 0c31fe9ee7 gallium: Redefine the max texture 2d cap from _LEVELS to _SIZE.
The _LEVELS assumes that the max is always power of two.  For V3D 4.2, we
can support up to 7680 non-power-of-two MSAA textures, which will let X11
support dual 4k displays on newer hardware.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2019-05-13 12:03:08 -07:00
Julien Isorce 98b852cd07 st/va: set the visible image dimensions in vlVaDeriveImage
This fixes video being rendered incorrectly.

User wants height of 360 but internally pipe_video_buffer 's height
is 368 in the test below.

Test:
  GST_GL_PLATFORM=egl gst-launch-1.0 videotestsrc ! video/x-raw, width=868, height=360, format=NV12 ! vaapipostproc ! glimagesink

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110443
Signed-off-by: Julien Isorce <jisorce@oblong.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
2019-05-10 17:13:31 +00:00
Julien Isorce 8cd71f399e st/va: check resource_get_info nullity in vlVaDeriveImage
This pipe_screen function is not implemented by all backends.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110443
Signed-off-by: Julien Isorce <jisorce@oblong.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
2019-05-03 16:11:55 -07:00
Chuck Atkins a381dbf253 meson: Fix missing glproto dependency for gallium-glx
Signed-off-by: Chuck Atkins <chuck.atkins@kitware.com>
Cc: mesa-stable <mesa-stable@lists.freedesktop.org>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
2019-05-03 13:36:25 -04:00
Marek Olšák 20909284f2 st/dri: decrease input lag by syncing sooner in SwapBuffers
It's done by:
- decrease the number of frames in flight by 1
- flush before throttling in SwapBuffers
  (instead of wait-then-flush, do flush-then-wait)

The improvement is apparent with Unigine Heaven.

Previously:
    draw frame 2
    wait frame 0
    flush frame 2
    present frame 2

    The input lag is 2 frames.

Now:
    draw frame 2
    flush frame 2
    wait frame 1
    present frame 2

    The input lag is 1 frame. Flushing is done before waiting, because
    otherwise the device would be idle after waiting.

Nine is affected because it also uses the pipe cap.
2019-05-02 16:09:24 -04:00
Julien Isorce 0e3a348bec st/va: properly set stride and offset in vlVaDeriveImage
Using the new resource_get_info function.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110443
Signed-off-by: Julien Isorce <jisorce@oblong.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
2019-04-30 17:53:12 +00:00
Axel Davy ce57f4f7c4 st/nine: Check discard_delayed_release is set before allocating more
When discard_delayed_release is set (default), we allocate more buffers
and use a different buffer wait path.
Check if it is set, and use the old paths if not
(the alternative buffer wait path could still be used, but there is no
advantage to using it in this case).

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:52 +02:00
Axel Davy b71c300c70 st/nine: Throttle rendering similarly for thread_submit
thread_submit's throttling depending on the number of internal
back buffers, and wasn't affected by the driver requested
throttling value.
Now it is.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:52 +02:00
Axel Davy 562f5a35c8 st/nine: Optimize a bit writeonly buffers
Optimize writeonly by passing PIPE_TRANSFER_WRITE
for these buffers instead of the safer
PIPE_TRANSFER_READ_WRITE.

This seems to improve the performance of d3d8 games
using d3d8to9.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:52 +02:00
Axel Davy 92117c989c st/nine: Use TGSI_SEMANTIC_GENERIC for fog
We used TGSI_SEMANTIC_FOG for fog,
however on vs/ps 3, fog is allowed to have
4 components (even on the ff pipeline according
to a wine test).
Since gallium's TGSI_SEMANTIC_FOG has only one
component, use TGSI_SEMANTIC_GENERIC instead.

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

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:52 +02:00
Axel Davy bade3bf615 st/nine: Enable computing const_ranges
All the pieces for constant compact are ready,
thus enable the path.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:52 +02:00
Axel Davy 5c67db6889 st/nine: Handle const_ranges in nine_state
Handle slot mapping if there is one.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:52 +02:00
Axel Davy 9942ba2ea3 st/nine: Cache constant buffer size
The shader constant buffer size with the
constant compaction code can vary depending
on the shader variant compiled (for example if
fog constants are required, etc).
Thus instead of using fixed size for the shader,
add in the variant cache the size required, pass it
to the context, and use this value.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:52 +02:00
Axel Davy a3cdc466e7 st/nine: Propagate const_range to context
As with the constant compaction we map the constant
slots to new slots, we need to pass that information
to the context which is in charge of uploading
the constants.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:52 +02:00
Axel Davy 7761cda686 st/nine: Prepare constant compaction in nine_shader
When indirect addressing is not used, we know exactly
which constants are accessed, and thus can
have them located in consecutive slots.
We thus parse again the shader with a slot map
for compaction.

The path contains the work inside nine_shader.c for this
path, but it needs some other commits to work, and thus
is not enabled yet by this commit.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:52 +02:00
Axel Davy db404507b4 st/nine: Refactor counting of constants
Track the number of slots used

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:51 +02:00
Axel Davy 737df40a63 st/nine: Track constant slots used
This tracking will be useful for constant compaction

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:51 +02:00
Axel Davy d2cab4562c st/nine: Refactor ct_ctor
The refactoring will make it easier to parse the shader
twice for the constant compaction path.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:51 +02:00
Axel Davy 6f3da226e6 st/nine: Make swvp_on imply IS_VS
swvp cannot happen with ps, thus it makes
sense to force it to false with ps.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:51 +02:00
Axel Davy d57d1436d3 st/nine: Refactor shader constants ureg_src computation
Put the shader constant code in one place to better change
that code in future commits.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:51 +02:00
Axel Davy 6d86292f8a st/nine: Manually upload vs and ps constants
In future commits we will introduce more fine-grained
uploads

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:51 +02:00
Axel Davy 1ddeb43537 st/nine: use helper ureg_DECL_sampler everywhere
Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:51 +02:00
Axel Davy 3717ec4157 st/nine: Compact pixel shader key
Compact the shader key to make room for new
elements.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:51 +02:00
Axel Davy 2acbd977d7 st/nine: Compact nine_ff_get_projected_key
Only the first four sampler slots can be used
by ff ps < 0x14, thus the size of the key
can be reduced.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:51 +02:00