Commit Graph

31 Commits

Author SHA1 Message Date
Pierre-Eric Pelloux-Prayer
cd0ef9b3f4 gallium/u_threaded: late alloc cpu_storage
Instead of allocating cpu_storage in threaded_resource_init, defer the
allocation to first use (in tc_buffer_map).
This avoids needless memory allocation if tc_buffer_disable_cpu_storage is
called before tc_buffer_map.

map_buffer_alignment is stored and serves as a "can cpu_storage be used" flag.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15074>
2022-03-07 14:51:15 +01:00
Dave Airlie
f1c1fcfdce crocus: don't create staging resources > half aperture
The theory here is that a staging resource will need to be transferred
into or out of a non-staging resource. If the staging resource is too
big for 1/2 aperture threshold, then it the corresponding non-stage
resource will be similiarly sized. This means there's no hope of fitting
both of them in.

This will cause the st blit transfer path to fall back and allow
max-texture-size to pass.

Fixes piglit max-texture-size

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14347>
2021-12-30 14:00:45 +10:00
Dave Airlie
d8a38edc48 crocus: fail resource allocation properly.
Older gens have a limit of 2GB on surfaces, this results in
isl_surf_init_s failing if the surface exceeds that, in this
case this should fail all the way back up the stack.

This fixes some cases of max-texture-size on crocus

Fixes: f3630548f1 ("crocus: initial gallium driver for Intel gfx 4-7")

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14347>
2021-12-30 14:00:41 +10:00
Dave Airlie
55b396e743 mesa/crocus/iris/blorp: drop minify macro in favour of u_minify
This macro is duplicated, clean it up.

Reviewed-by: Dylan Baker <dylan.c.baker@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14103>
2021-12-07 19:04:01 +00:00
Jason Ekstrand
953a4ca6fe intel: Add has_bit6_swizzle to devinfo
There's no good reason to have this rather complex check in three
drivers.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13636>
2021-11-04 18:51:04 +00:00
Marek Olšák
3df9d8ed80 gallium/u_threaded: implement pipelined partial buffer uploads using CPU storage
This removes resource_copy_region for BufferSubData. Drivers have to opt in
to use this.

See the comment in the header file.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13399>
2021-10-19 13:12:37 +00:00
Marcin Ślusarz
d05f7b4a2c intel: fix INTEL_DEBUG environment variable on 32-bit systems
INTEL_DEBUG is defined (since 4015e1876a) as:

 #define INTEL_DEBUG __builtin_expect(intel_debug, 0)

which unfortunately chops off upper 32 bits from intel_debug
on platforms where sizeof(long) != sizeof(uint64_t) because
__builtin_expect is defined only for the long type.

Fix this by changing the definition of INTEL_DEBUG to be function-like
macro with "flags" argument. New definition returns 0 or 1 when
any of the flags match.

Most of the changes in this commit were generated using:
for c in `git grep INTEL_DEBUG | grep "&" | grep -v i915 | awk -F: '{print $1}' | sort | uniq`; do
    perl -pi -e "s/INTEL_DEBUG & ([A-Z0-9a-z_]+)/INTEL_DBG(\1)/" $c
    perl -pi -e "s/INTEL_DEBUG & (\([A-Z0-9_ |]+\))/INTEL_DBG\1/" $c
done
but it didn't handle all cases and required minor cleanups (like removal
of round brackets which were not needed anymore).

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13334>
2021-10-15 19:55:14 +00:00
Dave Airlie
40fdb35c65 crocus: Honor scanout requirement from DRI
Translate PIPE_BIND_SCANOUT as ISL_SURF_USAGE_DISPLAY_BIT,
instead of PIPE_BIND_DISPLAY_TARGET.

PIPE_BIND_DISPLAY_TARGET isn't used for dri images and seem to
be set only for fake winsys buffers (which aren't displayed).
The trouble is that a fake buffer could be multisampled and we
cannot have multisampled surface with display bit.

Ported from iris 82b4666783

Fixes: f3630548f1 ("crocus: initial gallium driver for Intel gfx 4-7")
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Emma Anholt <emma@anholt.net>
Tested-by: Jason Ekstrand <jason@jlekstrand.net>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5464
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13260>
2021-10-08 01:03:57 +00:00
Dave Airlie
593ad9294b crocus: align staging resource pitch on gen4/5 to allow BLT usage.
Aligning the pitch to 4 bytes allows the BLT engine to be used for
transfers to/from these surfaces.

Fixes: f3630548f1 ("crocus: initial gallium driver for Intel gfx 4-7")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12329>
2021-08-11 19:21:01 +00:00
Tapani Pälli
5f7df5df0d crocus: disable depth and d+s formats with memory objects
This is similar to i965 commit ba11f673a2, we set depth and
d+s formats unsupported for now.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10609>
2021-08-09 05:38:50 +03:00
Tapani Pälli
e47b72e931 crocus: take a reference to memobj bo in crocus_resource_from_memobj
This is the same fix as commit 2d87ea3166 for iris driver.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10609>
2021-08-09 05:38:50 +03:00
Dave Airlie
c12444ab88 crocus/gen45: fix mapping compressed textures
I don't think iris ever hits this path, but probably has the same bug if
it did.

Fixes texsubimage on gfx4 + gfx4.5

Fixes: 5bf6ec31cc ("crocus/gen4: restrict memcpy mapping to gen5")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12164>
2021-08-03 05:37:52 +10:00
Dave Airlie
5bf6ec31cc crocus/gen4: restrict memcpy mapping to gen5
This is due to gen4 + 4.5 having some rather strange swizzling
that we can't actually detect properly in userspace

Fixes: f3630548f1 ("crocus: initial gallium driver for Intel gfx 4-7")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12058>
2021-07-26 20:28:37 +00:00
Dave Airlie
b7302ecf11 crocus: enable threaded context support
Reviewed-by: Zoltán Böszörményi <zboszor@pr.hu>
Tested-by: Matti Hämäläinen <ccr@tnsp.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11710>
2021-07-06 13:56:48 +10:00
Dave Airlie
86368a5fa2 crocus: add unsync transfer pool
Reviewed-by: Zoltán Böszörményi <zboszor@pr.hu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11710>
2021-07-06 13:56:48 +10:00
Dave Airlie
902eaa9382 crocus/tc: init/deinit threaded resource
Reviewed-by: Zoltán Böszörményi <zboszor@pr.hu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11710>
2021-07-06 13:56:48 +10:00
Dave Airlie
a9df8f7b64 crocus: use threaded context base classes
should be a pretty non-functional change

Reviewed-by: Zoltán Böszörményi <zboszor@pr.hu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11710>
2021-07-06 13:56:48 +10:00
Dave Airlie
db6042ea14 crocus: support rebinding streamout target buffers
Reviewed-by: Zoltán Böszörményi <zboszor@pr.hu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11710>
2021-07-06 13:56:44 +10:00
Dave Airlie
1d438c11c8 crocus: inline the d/s resource handling functions
These are pretty simple, so inlining is fine and helps drawoverhead

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11707>
2021-07-05 14:47:30 +10:00
Jason Ekstrand
94a52bc85c isl,iris: Move the extra_aux_surf logic into iris
This gets rid of the awkward interface for isl_surf_get_ccs_surf where
we passed it two aux surfaces and it was supposed to fill out the second
one based on whether or not the first one already had stuff in it.
Instead, we now pass it three well-labled surfaces: surf,
hiz_or_mcs_surf, and ccs_surf which have obvious meanings.  This does
mean that iris has to carry a bit of logic and we have to flip
parameters around in all the callers.  But the resulting interface is
much cleaner.

Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11479>
2021-06-24 13:57:40 +00:00
Dave Airlie
7399d6028f crocus: Avoid replacing backing storage for buffers with no contents
Ported 97e9de1795 from iris

    We might get asked to pitch the storage on a buffer that already has
    no meaningful contents.  In this case, the existing buffer is as good
    as a new one.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11567>
2021-06-24 06:50:49 +00:00
Dave Airlie
a9c1c75e9c crocus: convert a bunch of is_haswell into verx10 checks.
This just make things easier when gen8 support is added

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11507>
2021-06-22 18:56:20 +00:00
Jason Ekstrand
7b8199e4a2 crocus: Drop extra_aux support
This exists for combined MCS+CCS or HiZ+CCS which was introduced on
Tigerlake.  Crocus will never support hardware that has these features
so there's no point carrying the dead copied+pasted code from iris.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11483>
2021-06-19 14:57:25 +00:00
Dave Airlie
cebbdf5de3 crocus: fix scanout tiling so glamor/modesetting can work.
This fixes the scanout tiling to be like iris, with this X/glamor
can run.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11354>
2021-06-15 10:58:09 +10:00
Dave Airlie
bc9af971d2 crocus: hook up resource creation from memory object
Port 772dc50d16 from iris

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11352>
2021-06-15 00:02:06 +00:00
Dave Airlie
8bf662df52 crocus: hook up memory object creation from handle
Port cdb5a72764 from iris

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11352>
2021-06-15 00:02:06 +00:00
Dave Airlie
9be4eb1688 crocus: Drop buffer support in resource_from_handle
Port 9d503b36ca from iris

   The callers don't seem to pass targets of PIPE_BUFFER. Stop nesting an
   if-else block by dropping support for this target.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11352>
2021-06-15 00:02:06 +00:00
Dave Airlie
32728dc66e crocus: introduce main resource configuration helper.
Along the lines of what iris does.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11352>
2021-06-15 00:02:06 +00:00
Dave Airlie
1e6e87a3c9 crocus: Make iris_bo_import_dmabuf take a modifier
Port 493298528a from iris

    Replace the tiling parameter with a modifier parameter. I find it more
    straightforward to have this function figure out the tiling from the
    modifier than to have its caller do it.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11352>
2021-06-15 00:02:06 +00:00
Dave Airlie
4cd0f8535c crocus: Don't call SET_TILING for dmabuf imports
This is a port of c111e9099c from iris to
crocus.

    Calling SET_TILING on a DMA buffer with the gen12 CCS modifier can fail
    unnecessarily. The main surface in the BO is Y-tiled, but the CCS portion is
    linear and can have a stride that's not a multiple of 128B. Because SET_TILING
    is called on the CCS plane with I915_TILING_Y, the ioctl will sometimes reject
    the stride.

    SET_TILING was originally used in b6d45e7f74 to
    fix an assertion failure in iris_resource_from_handle. Assigning the BO's
    tiling_mode field is sufficient to avoid the failure.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11352>
2021-06-15 00:02:06 +00:00
Dave Airlie
f3630548f1 crocus: initial gallium driver for Intel gfx 4-7
This is a gallium driver for the Intel gfx 4-7 GPUs.

It was initially cloned from the iris driver by Ilia Mirkin,
then I ported over large reams of code from i965 until it worked.

Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11146>
2021-06-14 06:34:05 +10:00