Commit Graph

44266 Commits

Author SHA1 Message Date
Eric Anholt b4a087ce1b driconf: Use nesting macros for defining options.
Manually balancing the BEGIN/ENDs is a recipe for xml validation failures,
just make the macros do the balancing.  The only ugly bit I think is that
enums take a list of DRI_CONF_ENUM() without ','s in between them.

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6753>
2020-09-25 19:36:23 +00:00
Eric Anholt e5d2481bfe virgl: Clean up the driconf definition of GLES_SAMPLES_PASSED_VALUE.
The right values ended up being passed to DRI_CONF_OPT_BEGIN_V, they were just
named wrong.

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6753>
2020-09-25 19:36:23 +00:00
Samuel Iglesias Gonsálvez b54a0bb528 freedreno/layout: add tile_all flag to the layout
Added a new tile_all flag which is used to set the TILE_ALL flag of
the texture. Enabled tile_all to depth/stencil images are they are
non-linear.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6848>
2020-09-25 15:38:47 +00:00
Andreas Baierl b8c31ac06d lima: fix glCopyTexSubImage2D
The reload texture descriptor needs to take care of the mipmap level
and the layer in case of GL_TEXTURE_CUBE_MAP.

glCopyTexSubImage2D triggers the lima_blit function which ends in a draw.
A reload is necessary. The reload texture descriptor is always built with
just one mipmap level, but this needs to be the level we want to reload,
not just 0. We also have to take care of the cubemap face.

This fixes the following dEQP tests:

dEQP-GLES2.functional.texture.specification.basic_copytexsubimage2d.2d_rgb
dEQP-GLES2.functional.texture.specification.basic_copytexsubimage2d.2d_rgba
dEQP-GLES2.functional.texture.specification.basic_copytexsubimage2d.cube_rgb
dEQP-GLES2.functional.texture.specification.basic_copytexsubimage2d.cube_rgba

Reviewed-by: Erico Nunes <nunes.erico@gmail.com>
Signed-off-by: Andreas Baierl <ichgeh@imkreisrum.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6816>
2020-09-25 10:11:36 +00:00
Guido Günther 7b9cf779f2 kmsro: Extend to include imx-dcss
This allows using the dcss display controllers (with the dcss drm
modesetting driver) along with the Etnaviv render-only drivers. DCSS is
found on i.MX SoCs.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3449>
2020-09-25 09:55:15 +00:00
Erik Faye-Lund cbef2dc7d3 zink: only set stencil-ref for back if two-sided
Otherwise, we want to set both front and back to the same state.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6853>
2020-09-25 09:16:27 +00:00
Erik Faye-Lund 4b2525b68d zink: store base-object of DSA-state
This is useful in the next commit, where we need to inspect the
base-state.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6853>
2020-09-25 09:16:27 +00:00
Erik Faye-Lund 9e94dcca67 zink: correct typo in stencil-setup
Without this, we end up using two-sided stencil when one-sided stencil
should be used. Whoops.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6853>
2020-09-25 09:16:27 +00:00
Marek Olšák d1d27e9db4 radeonsi: remove redundant info.uses_fbfetch
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6782>
2020-09-25 04:37:23 -04:00
Marek Olšák 7b1e01fec7 radeonsi: remove redundant variables from struct si_compute
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6782>
2020-09-25 04:37:23 -04:00
Marek Olšák 16afaf0355 radeonsi: assume that constant load_local_group_size has been optimized out
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6782>
2020-09-25 04:37:23 -04:00
Marek Olšák 0492adaca7 radeonsi: run NIR optimizations that glsl_to_nir runs but other places might not
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6782>
2020-09-25 04:37:23 -04:00
Marek Olšák 8a1d556c5a radeonsi: get input/output usage flags from shader_info directly
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6782>
2020-09-25 04:37:23 -04:00
Marek Olšák 0280cc75ba radeonsi: get information about FS color outputs from shader_info directly
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6782>
2020-09-25 04:37:23 -04:00
Marek Olšák 343e5caa75 radeonsi: use info.system_values_read
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6782>
2020-09-25 04:37:23 -04:00
Marek Olšák cce3556abd radeonsi: call nir_shader_gather_info after lowering and optimizing NIR
to get more accurate info

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6782>
2020-09-25 04:37:23 -04:00
Marek Olšák 8be46d6558 radeonsi: fix indirect dispatches with variable block sizes
The block size input was uninitialized.

Fixes: 77c81164bc "radeonsi: support ARB_compute_variable_group_size"

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6782>
2020-09-25 04:37:23 -04:00
Christian Gmeiner a7e3cc7a0e etnaviv: simplify linear stride implementation
As documented in the galcore kernel driver "only LOD0 is valid
for this register". This makes sense, as NTE's LINEAR_STRIDE is
only capable to store one linear stride value per sampler.
This fixes linear textures in sampler slot != 0.

Fixes: 34458c1cf6 ("etnaviv: add linear sampling support")
CC: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Michael Tretter <m.tretter@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3285>
2020-09-25 08:03:17 +00:00
Vinson Lee 03e7b75c22 gallium/dri2: Move image->texture assignment after image NULL check.
Fix defect reported by Coverity Scan.

Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking image suggests that it may be
null, but it has already been dereferenced on all paths leading to
the check.

Fixes: ad609bf55a ("frontend/dri: Implement mapping individual planes.")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6807>
2020-09-25 00:47:26 +00:00
Vinson Lee 4bd0df0e4a r600/sfn: Initialize GPRValue member m_pin_to_channel.
Fix defects reported by Coverity Scan.

Uninitialized scalar field (UNINIT_CTOR)
uninit_member: Non-static class member m_pin_to_channel is not
initialized in this constructor nor in any functions that it calls.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6830>
2020-09-24 17:29:04 -07:00
Eric Anholt 974981c4e6 gallium/drm: Make the pipe loader handle the driconf merging.
We can pretty easily handle merging the driver's driconf with the common
driverconf right there, rather than pushing that to each driver.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6751>
2020-09-24 16:35:17 -07:00
Eric Anholt 87392385b5 gallium/drm: Define the DRM entrypoints in drm_helper.h
This cuts even more code duplication.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6751>
2020-09-24 16:35:17 -07:00
Eric Anholt bc10b4968e gallium/drm: Refactor the stub screen create functions.
This gives me one place to document why it works this way.  This does make
the debug message a little less helpful ("etna" instead of "etnaviv" and
"vmwgfx" instead of "svga", but you should only be able to reach this when
doing something like trying the radeon/nouveau vdpau target on the wrong
DRM device for example.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6751>
2020-09-24 15:34:52 -07:00
Eric Anholt 9ec28b8d22 gallium/drm: Deduplicate screen creation for the dynamic (clover) pipe loader.
We can just reuse drm_helper.h, which has either the real code or the stub
for all pipe_screens based on the GALLIUM_* driver defines, and the
dynamic pipe loader's .c build will only define one GALLIUM_* driver
define.  The remaining stubs should get GCed by the linker.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6751>
2020-09-24 15:34:52 -07:00
Jason Ekstrand 472a20c5fc radeonsi: Only call nir_lower_var_copies at the end of the opt loop
In 283ad85944, radeonsi started using nir_find_var_copies.  However,
it was also calling nir_lower_var_copies in the optimization loop and
the two can end up fighting.  The simple solution is to wait to lower
copies until the end of the optimization loop.

Fixes: 283ad85944
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3550

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6841>
2020-09-24 21:01:30 +00:00
Mike Blumenkrantz 7971918924 zink: reorder create_stream_output_target to fix failure case leak
the previous version of this leaked a reference to the streamout buffer here

thanks to deltragon on my blog for pointing this out!

Fixes: 37778fcd9a ("zink: implement transform feedback support to finish off opengl 3.0")

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6457>
2020-09-24 20:55:02 +00:00
Mike Blumenkrantz bc5c0433be zink: apply viewport count when creating pipelines
without VK_EXT_extended_dynamic_state, we need to pass this directly or
else only the first viewport will work

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6349>
2020-09-24 20:48:51 +00:00
Mike Blumenkrantz cc939fe9b7 zink: correctly set up fb-sized scissors for each viewport
each viewport must have a corresponding scissor, so we need to generate
an array of these to ensure our states match up

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6349>
2020-09-24 20:48:51 +00:00
Mike Blumenkrantz 8a2ddcb4a9 zink: set multiviewport cap in ntv when gl_ViewportIndex is a written output
this cap varies based on the shader stage, but it must be enabled any time this
output is written

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6349>
2020-09-24 20:48:51 +00:00
Mike Blumenkrantz 09be30b9e4 zink: move viewport count to zink_gfx_pipeline_state
this is part of the pipeline state (there's an extension for setting it
dynamically but we don't supprot that atm

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6349>
2020-09-24 20:48:51 +00:00
Mike Blumenkrantz 818bd61099 zink: implement ARB_instanced_arrays
this is just a simple case of connecting up the vertex state to the pipeline
state

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6270>
2020-09-24 20:40:39 +00:00
Mike Blumenkrantz 0051551701 zink: verify that src and dst aspects are the same in resource_copy_region hook
this is required by spec

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6263>
2020-09-24 20:31:37 +00:00
Mike Blumenkrantz 6feec2d40e zink: clamp min created fb size to 1x1
this is required by spec

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6263>
2020-09-24 20:31:37 +00:00
Mike Blumenkrantz 9ce1e99913 zink: use correct layer count when creating framebuffer
pipe_framebuffer_state::layers doesn't necessarily reflect the value we
need to use here, so we can use the util function to verify

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6263>
2020-09-24 20:31:37 +00:00
Mike Blumenkrantz e30367a273 zink: use correct number of samples on framebuffer in set_framebuffer_state
state->samples doesn't necessarily reflect the correct value here, so we need
to use the util function

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6263>
2020-09-24 20:31:37 +00:00
Mike Blumenkrantz f6c87216d3 zink: use correct value for color buffer sample count when creating renderpass
nr_samples is valid on the texture pipe_resource, not the surface

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6263>
2020-09-24 20:31:37 +00:00
Kenneth Graunke 140f53e646 Revert "nir: replace lower_ffma and fuse_ffma with has_ffma"
This reverts commit 939ddf3f67.

Intel has a separate pass for fusing FFMAs selectively.  We split
these flags in commit 1b72c31e1f and
the reasoning still stands.  The patch being reverted was just a
cleanup, so there should be no issue with reverting it.

Acked-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6849>
2020-09-24 13:11:50 -07:00
Pierre-Eric Pelloux-Prayer 90b98c0649 amd/tmz: move uses_secure_bos to radeon_winsys
This allows to inline radeon_uses_secure_bos calls and reduce CPU overhead.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6049>
2020-09-24 14:51:16 +00:00
Pierre-Eric Pelloux-Prayer 2479689968 radeonsi/tmz: add workaround for mpv/vaapi subtitles
Subtitles are rendering with an upload through a staging texture.
So the sequence is:
  1. draw video (with a secure cs)
  2. copy staging texture to the real texture (via si_resource_copy_region) in
    a non-secure cs.
  3. draw video (with a secure cs)

Step 2 and 3 both generates a flush with RADEON_FLUSH_TOGGLE_SECURE_SUBMISSION.
These flushes are executed quite late: right before doing the draw/dispatch,
so maybe the issue here is the handling of dependencies.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6049>
2020-09-24 14:51:16 +00:00
Pierre-Eric Pelloux-Prayer 2c6643546a radeonsi/tmz: add a tmz variant for sctx::eop_bug_scratch
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6049>
2020-09-24 14:51:16 +00:00
Pierre-Eric Pelloux-Prayer 133895574c radeonsi: disable primitive discard if tmz is in use
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6049>
2020-09-24 14:51:16 +00:00
Pierre-Eric Pelloux-Prayer 8e2768bbfb radeonsi/tmz: add tmz variant for sctx::tess_rings
tess_rings must be encrypted when used in a secure job so this commit
introduces a tess_rings_tmz resource.

The cs_preamble_state doesn't contain the tess_rings address anymore since
it can change. The tess_rings related registers go in a separate preamble.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6049>
2020-09-24 14:51:16 +00:00
Pierre-Eric Pelloux-Prayer 2589888ce9 radeonsi/tmz: add tmz variant of sctx::wait_mem_scratch
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6049>
2020-09-24 14:51:16 +00:00
Pierre-Eric Pelloux-Prayer de088daccc radeonsi/tmz: fail si_texture_transfer_map if tex is encrypted
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6049>
2020-09-24 14:51:16 +00:00
Pierre-Eric Pelloux-Prayer 55b018b634 amd/winsys: add RADEON_FLUSH_TOGGLE_SECURE_SUBMISSION
Instead of exposing a cs_set_secure() callback that always needs a call
to si_flush_gfx_cs before a switch, this commit introduces a new
flag to switch between secure and non-secure on submissions.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6049>
2020-09-24 14:51:16 +00:00
Pierre-Eric Pelloux-Prayer 1b0d660cbc radeonsi/tmz: allow secure job if the app made a tmz allocation
This commit makes TMZ always allowed instead of being either off or forced-on
with AMD_DEBUG=tmz.

With this change:
- secure job can be used as soon as the application made a tmz allocation. Driver
  internal allocations are not enough to enable secure jobs (if tmz is supported
  and enabled by the kernel)
- AMD_DEBUG=tmz forces all scanout/depth/stencil buffers to be allocated as TMZ.
  This is useful to test app thats don't explicitely support protected content.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6049>
2020-09-24 14:51:16 +00:00
Pierre-Eric Pelloux-Prayer 5e4aecec93 radeonsi: introduce SI_RESOURCE_FLAG_INTERNAL / RADEON_FLAG_DRIVER_INTERNAL
Tag allocations as driver internal.
Some of these allocations will need to be doubled to handle TMZ (one secure bo,
one normal bo) but these allocations shouldn't switch the winsys in "the app
is using TMZ".

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6049>
2020-09-24 14:51:16 +00:00
Pierre-Eric Pelloux-Prayer 131412cc4d radeonsi/tmz: allocate depth/stencil buffers as encrypted
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6049>
2020-09-24 14:51:16 +00:00
Pierre-Eric Pelloux-Prayer 0a59d2a3e9 radeonsi/tmz: add safety assert when tmz is enabled
This commit adds asserts verifying the following conditions when
using a secure job:
- fb textures are encrypted (both colors and depth/stencil buffers)
- all writeable bo are encrypted

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6049>
2020-09-24 14:51:16 +00:00
Pierre-Eric Pelloux-Prayer 59b267dea4 radeonsi/tmz: use secure job if using an encrypted z/s buffer
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6049>
2020-09-24 14:51:16 +00:00