mesa.git
5 years agoradv: remove an extra memcpy when exporting clip/cull distances
Samuel Pitoiset [Wed, 10 Jul 2019 13:18:53 +0000 (15:18 +0200)]
radv: remove an extra memcpy when exporting clip/cull distances

Cleanup.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agointel/compiler: Add a "base class" for program keys
Jason Ekstrand [Thu, 21 Feb 2019 23:20:39 +0000 (17:20 -0600)]
intel/compiler: Add a "base class" for program keys

Right now, all keys have two things in common: a program string ID and a
sampler_prog_key_data.  I'd like to add another thing or two and need a
place to put it.  This commit adds a new brw_base_prog_key struct which
contains those two common bits.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agoi965/program_cache: Cast the key to char * before adding key_size
Jason Ekstrand [Sat, 23 Feb 2019 17:53:43 +0000 (11:53 -0600)]
i965/program_cache: Cast the key to char * before adding key_size

We're about to change the type of key to be brw_base_prog_key and that
will mean blindly adding the key size without a cast will lead to the
wrong calculation.  It's safer to cast to char * first anyway.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agoanv: Make the workaround BO a whole page
Jason Ekstrand [Sun, 23 Jun 2019 14:26:59 +0000 (09:26 -0500)]
anv: Make the workaround BO a whole page

I'm not 100% sure how this ever worked because gem_create usually shoots
you if the BO size isn't page-aligned.

Reviewed-by: Chad Versace <chadversary@chromium.org>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agoanv: Set Stateless Data Port Access MOCS
Jason Ekstrand [Sat, 22 Jun 2019 15:57:39 +0000 (10:57 -0500)]
anv: Set Stateless Data Port Access MOCS

This is the MOCS setting used for the A64 stateless messages which we
sometimes use for SSBO operations.

Fixes: 48ed2a7bb009 "anv: Implement VK_EXT_buffer_device_address"
Fixes: 79fb0d27f3ab "anv: Implement SSBOs bindings with GPU addr..."
Reviewed-by: Chad Versace <chadversary@chromium.org>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agopanfrost: Clamp point size
Alyssa Rosenzweig [Wed, 10 Jul 2019 18:30:00 +0000 (11:30 -0700)]
panfrost: Clamp point size

It's not clear the hardware really has a maximum which confuses dEQP;
clamp to whatever we report as our maximum.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopan/decode: Auto style
Alyssa Rosenzweig [Wed, 10 Jul 2019 17:36:16 +0000 (10:36 -0700)]
pan/decode: Auto style

   $ astyle *.c *.h --style=linux -s8

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost: Move non-Gallium files outside of Gallium
Alyssa Rosenzweig [Wed, 10 Jul 2019 17:33:24 +0000 (10:33 -0700)]
panfrost: Move non-Gallium files outside of Gallium

In preparation for a Panfrost-based non-Gallium driver (maybe
Vulkan...?), hoist everything except for the Gallium driver into a
shared src/panfrost. Practically, that means the compilers, the headers,
and pandecode.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost: Style main Gallium driver
Alyssa Rosenzweig [Wed, 10 Jul 2019 17:10:31 +0000 (10:10 -0700)]
panfrost: Style main Gallium driver

   $ astyle *.c *.h --style=linux -s8

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost/midgard: Apply code styling
Alyssa Rosenzweig [Wed, 10 Jul 2019 17:00:50 +0000 (10:00 -0700)]
panfrost/midgard: Apply code styling

   $ astyle *.c *.h --style=linux -s8

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost/nir: Apply NIR style
Alyssa Rosenzweig [Wed, 10 Jul 2019 16:58:21 +0000 (09:58 -0700)]
panfrost/nir: Apply NIR style

   $ astyle *.c *.h --style=linux -s3

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost: Move midgard/nir* to nir folder
Alyssa Rosenzweig [Wed, 10 Jul 2019 16:51:32 +0000 (09:51 -0700)]
panfrost: Move midgard/nir* to nir folder

The reason for doing this is two-fold:

   1. These passes are likely to be shared with the Bifrost compiler
      Therefore, we don't want to restrict them to Midgard

   2. The coding style is different (NIR-style vs Panfrost-style)
      The NIR passes are candidates for moving upstream into
      compiler/nir, so don't block that off for stylistic reasons

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost: Typofix
Alyssa Rosenzweig [Wed, 10 Jul 2019 15:06:36 +0000 (08:06 -0700)]
panfrost: Typofix

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost: Identify shared tiler structure
Alyssa Rosenzweig [Wed, 10 Jul 2019 14:22:19 +0000 (07:22 -0700)]
panfrost: Identify shared tiler structure

This is identical across SFBD/MFBD so pull it out to allow for better
code sharing.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost/midgard: Drop unnecessary assert
Alyssa Rosenzweig [Wed, 10 Jul 2019 16:37:08 +0000 (09:37 -0700)]
panfrost/midgard: Drop unnecessary assert

Just use the #define instead.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Suggested-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
5 years agopanfrost: Don't expose OES_standard_derivatives
Alyssa Rosenzweig [Wed, 10 Jul 2019 16:36:03 +0000 (09:36 -0700)]
panfrost: Don't expose OES_standard_derivatives

This has not been implemented quite yet.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agogallium: get rid of PIPE_CAP_SM3
Erik Faye-Lund [Fri, 5 Jul 2019 14:36:41 +0000 (16:36 +0200)]
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>
5 years agogallium: give vertex-shader saturate its own cap
Erik Faye-Lund [Fri, 5 Jul 2019 14:21:45 +0000 (16:21 +0200)]
gallium: give vertex-shader saturate its own cap

Shader Model 3.0 is a big promise to make to the state-tracker, and
for instance mobile hardware might support vertex-shader saturate but
not some of the other features of SM3. So let's give this its own cap
for simplicity.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
5 years agogallium: give fragment-shader derivatives its own cap
Erik Faye-Lund [Fri, 5 Jul 2019 14:08:19 +0000 (16:08 +0200)]
gallium: give fragment-shader derivatives its own cap

Shader Model 3.0 is a big promise to make to the state-tracker, and
for instance mobile hardware might support fragment-shader derivatives
but not some of the other features of SM3. So let's give this its own
cap for simplicity.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
5 years agogallium: give fragment-shader texture-lod its own cap
Erik Faye-Lund [Fri, 5 Jul 2019 13:46:38 +0000 (15:46 +0200)]
gallium: give fragment-shader texture-lod its own cap

Shader Model 3.0 is a big promise to make to the state-tracker, and
for instance mobile hardware might support texture lod but not some
of the other features of SM3. So let's give this its own cap for
simplicity.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
5 years agomesa/st: drop needless has_shader_model3 boolean
Erik Faye-Lund [Fri, 5 Jul 2019 14:10:49 +0000 (16:10 +0200)]
mesa/st: drop needless has_shader_model3 boolean

This boolean is only consulted once during init, so there's nothing
much saved by storing this in the context. So let's just check directly
when we need it instead.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
5 years agopanfrost: Fix copyright identifier in a few places
Alyssa Rosenzweig [Wed, 10 Jul 2019 13:23:13 +0000 (06:23 -0700)]
panfrost: Fix copyright identifier in a few places

Oops.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
5 years agopanfrost: Bikeshed pan_screen.c comment
Alyssa Rosenzweig [Mon, 8 Jul 2019 16:25:08 +0000 (09:25 -0700)]
panfrost: Bikeshed pan_screen.c comment

The asterisks were inherited from... softpipe, maybe?

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
5 years agopanfrost: Check GPU version before loading
Alyssa Rosenzweig [Mon, 8 Jul 2019 16:14:59 +0000 (09:14 -0700)]
panfrost: Check GPU version before loading

Panfrost is known to only work on a select few CPU/GPU combinations at
the moment (tested system-on-chips: RK3288, RK3399, and S912). Whitelist
the combinations known to work and refuse to load on others where
nothing works yet to avoid user confusion.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
5 years agopanfrost: Be more honest about PIPE_CAPs
Alyssa Rosenzweig [Mon, 8 Jul 2019 15:44:49 +0000 (08:44 -0700)]
panfrost: Be more honest about PIPE_CAPs

A lot of the pan_screen.c code was cargoculted from other drivers. The
upshot is that we return true for a lot of PIPE_CAPs that we don't
actually support, resulting in us exposing way too many extensions that
we don't actually support. Be more careful.

Some CAPs we do need to fake to access higher dEQP versions (i.e. in
order to debug the features we're hiding behind the CAP). For these, we
hide the CAP behind a special PAN_MESA_DEBUG=deqp option to avoid
apps randomly using these in-development features.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
5 years agopanfrost/midgard: Hit missed scheduling opportunity
Alyssa Rosenzweig [Tue, 9 Jul 2019 17:59:34 +0000 (10:59 -0700)]
panfrost/midgard: Hit missed scheduling opportunity

Don't try to schedule to vmul when that can't possible work (forcing a
bundle break). glmark:

total bundles in shared programs: 2700 -> 2683 (-0.63%)
bundles in affected programs: 695 -> 678 (-2.45%)
helped: 14
HURT: 0
helped stats (abs) min: 1 max: 4 x̄: 1.21 x̃: 1
helped stats (rel) min: 1.27% max: 7.69% x̄: 4.30% x̃: 4.77%
95% mean confidence interval for bundles value: -1.68 -0.75
95% mean confidence interval for bundles %-change: -5.63% -2.97%
Bundles are helped.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost/midgard: Include shader size for shader-db
Alyssa Rosenzweig [Tue, 9 Jul 2019 18:16:57 +0000 (11:16 -0700)]
panfrost/midgard: Include shader size for shader-db

It's easy to forget about, but shader size does matter for things like
i-cache, so let's include it in the analysis.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost/midgard: Include loop count for shader-db
Alyssa Rosenzweig [Tue, 9 Jul 2019 18:10:49 +0000 (11:10 -0700)]
panfrost/midgard: Include loop count for shader-db

We have to emit it anyway for the report to be happy (with respect to
unrolling), so return an actual count rather than dummy numbers.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost/midgard: Dump shader-db stats
Alyssa Rosenzweig [Mon, 8 Jul 2019 23:42:29 +0000 (16:42 -0700)]
panfrost/midgard: Dump shader-db stats

All the kool kids are doing it.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost/midgard: Flush undefineds to zero
Alyssa Rosenzweig [Mon, 8 Jul 2019 19:40:34 +0000 (12:40 -0700)]
panfrost/midgard: Flush undefineds to zero

Fixes a buggy dEQP test.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost/midgard: Specify channel count for broadcasting ops
Alyssa Rosenzweig [Mon, 8 Jul 2019 19:02:33 +0000 (12:02 -0700)]
panfrost/midgard: Specify channel count for broadcasting ops

bany/ball type ops read from all 4 channels even though they only write
to 1; specify this in the opcode table like we do for dot products.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost/midgard: Don't try to "alias" texture registers
Alyssa Rosenzweig [Mon, 8 Jul 2019 18:51:14 +0000 (11:51 -0700)]
panfrost/midgard: Don't try to "alias" texture registers

It won't work. Just, stop it.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agoradv: compute correct number of input vertices for NGG
Samuel Pitoiset [Tue, 9 Jul 2019 07:18:25 +0000 (09:18 +0200)]
radv: compute correct number of input vertices for NGG

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoradv: remove extra code for exporting LayerID to the next stage
Samuel Pitoiset [Wed, 10 Jul 2019 11:03:50 +0000 (13:03 +0200)]
radv: remove extra code for exporting LayerID to the next stage

Now that the output usage mask is set to 0x1 the LayerID is
correctly exported in the loop above.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoradv: set the LayerId output usage mask if FS needs it
Samuel Pitoiset [Wed, 10 Jul 2019 11:03:49 +0000 (13:03 +0200)]
radv: set the LayerId output usage mask if FS needs it

When the stage preceding FS doesn't export it the fragment shader
might read it, even if it's 0.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agopanfrost: Update supported formats
Alyssa Rosenzweig [Mon, 1 Jul 2019 18:53:38 +0000 (11:53 -0700)]
panfrost: Update supported formats

Much of the format selection code was inherited from softpipe (!) of all
places, and a lot of it is accordingly cruft. Later if-elses were added
in random places to workaround missing formats at various points in
history. Clean up some of this.

Theoretically, any format we can texture from we can also render to. In
practice, there are a few corner cases that we need to disable
explicitly.

For one, we do have to restrict SCANOUT formats to workaround
buggy apps (in particular, dEQP which with --deqp-surface-type=window
under Weston will end up with RGB10_A2 and complain about low alpha
precision). Just be clearer about how/why.

Also, RGB5_A1 support is still broken; let's not worry about that quite
yet.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost/mfbd: Cleanup format code selection
Alyssa Rosenzweig [Fri, 5 Jul 2019 13:26:48 +0000 (06:26 -0700)]
panfrost/mfbd: Cleanup format code selection

Rather than have random variables flying around and a long if-else
chain, use a switch. They're literally *designed* for this.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost/midgard: Cleanup blend switch
Alyssa Rosenzweig [Wed, 3 Jul 2019 22:31:24 +0000 (15:31 -0700)]
panfrost/midgard: Cleanup blend switch

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost/mfbd: Handle PIPE_FORMAT_B10G10R10A2_UNORM
Alyssa Rosenzweig [Fri, 5 Jul 2019 22:59:22 +0000 (15:59 -0700)]
panfrost/mfbd: Handle PIPE_FORMAT_B10G10R10A2_UNORM

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost/midgard: Handle PIPE_FORMAT_B10G10R10A2_UNORM
Alyssa Rosenzweig [Fri, 5 Jul 2019 22:58:54 +0000 (15:58 -0700)]
panfrost/midgard: Handle PIPE_FORMAT_B10G10R10A2_UNORM

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost: Implement ES3-format writeout
Alyssa Rosenzweig [Wed, 3 Jul 2019 19:34:32 +0000 (12:34 -0700)]
panfrost: Implement ES3-format writeout

We add support for writing out (via a blend shader):

   - RGBA4
   - RGB10_A2_UNORM
   - RGB10_A2_UINT
   - RGB5_A1_UNORM
   - R11G11B10_FLOAT

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost: Refactor blend infrastructure
Alyssa Rosenzweig [Fri, 5 Jul 2019 22:40:08 +0000 (15:40 -0700)]
panfrost: Refactor blend infrastructure

We would like to permit keying blend shaders against the framebuffer
format, which requires some new blending abstractions.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost/midgard: Use unsigned blend patch offset
Alyssa Rosenzweig [Fri, 5 Jul 2019 23:51:30 +0000 (16:51 -0700)]
panfrost/midgard: Use unsigned blend patch offset

We would like the offset field to be unsigned, letting 0 represent "no
offset" and positive represent an offset.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost/midgard: Handle pure int formats
Alyssa Rosenzweig [Tue, 2 Jul 2019 17:54:23 +0000 (10:54 -0700)]
panfrost/midgard: Handle pure int formats

I'm not sure I'm totally comfortable with this, but conceptually neither
float nor pure-int formats require any format conversion, except size
conversion. Going from a shaderable format (fp32 or i16, for instance)
into a blendable format (fp16) is a separate question, one we can defer
momentarily while we're not interested in actually blending.

As an aside, I'd be fascinated by an integer-based blending
implementation.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost/mfbd: Handle pure int formats
Alyssa Rosenzweig [Tue, 2 Jul 2019 17:50:00 +0000 (10:50 -0700)]
panfrost/mfbd: Handle pure int formats

We see that the render target itself turns out to be typeless
(surprise!)

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost: Set rt_count_2 for bpp>4 formats
Alyssa Rosenzweig [Tue, 2 Jul 2019 16:54:23 +0000 (09:54 -0700)]
panfrost: Set rt_count_2 for bpp>4 formats

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost/midgard: Implement preliminary float converters
Alyssa Rosenzweig [Tue, 2 Jul 2019 16:23:31 +0000 (09:23 -0700)]
panfrost/midgard: Implement preliminary float converters

We'll need some careful handling, but for now, get some baseline code
out for handling float formats in a blend shader.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost/midgard: Skip blend for REPLACE (shader)
Alyssa Rosenzweig [Tue, 2 Jul 2019 16:48:19 +0000 (09:48 -0700)]
panfrost/midgard: Skip blend for REPLACE (shader)

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost: Handle "blend disabled" blend shaders
Alyssa Rosenzweig [Tue, 2 Jul 2019 16:08:18 +0000 (09:08 -0700)]
panfrost: Handle "blend disabled" blend shaders

Normally, disabled blend can definitely be fixed-function'd away, but
if a blend shader is used merely for format conversion rather than
blending, this code path can be nevertheless hit.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost: Route format through fixed-function blending
Alyssa Rosenzweig [Tue, 2 Jul 2019 13:47:13 +0000 (06:47 -0700)]
panfrost: Route format through fixed-function blending

Not all framebuffer formats are supported by the fixed-function blender.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost: Pipe framebuffer format around
Alyssa Rosenzweig [Tue, 2 Jul 2019 13:34:52 +0000 (06:34 -0700)]
panfrost: Pipe framebuffer format around

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost/midgard: Use Gallium framebuffer formats
Alyssa Rosenzweig [Tue, 2 Jul 2019 13:28:47 +0000 (06:28 -0700)]
panfrost/midgard: Use Gallium framebuffer formats

Ideally, we would keep Galliumisms far away from the compiler;
unfortunately, Mesa hasn't standardized on system of format codes to be
shared across APIs and across drivers, so using Gallium formats is our
best bet in the short run.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost/midgard: Use fp16 exclusively while blending
Alyssa Rosenzweig [Tue, 2 Jul 2019 02:55:00 +0000 (19:55 -0700)]
panfrost/midgard: Use fp16 exclusively while blending

We now have some preliminary fp16 support available. We're not able to
expose this for GLSL quite yet, but for internal blend shaders, we're
able to do control bitness ourselves just fine. So let's fp16 that
stuff!

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost/midgard: Remove opt_copy_prop_tex
Alyssa Rosenzweig [Tue, 2 Jul 2019 13:05:18 +0000 (06:05 -0700)]
panfrost/midgard: Remove opt_copy_prop_tex

Eventually this should be replaced by proper tex RA / not emitting so
many silly moves to begin with / better general copy prop. For now
remove it since it breaks things.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost/midgard: Fix scalarification
Alyssa Rosenzweig [Tue, 2 Jul 2019 03:23:50 +0000 (20:23 -0700)]
panfrost/midgard: Fix scalarification

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost/midgard: Handle fp16 in embedded_to_inline_constants
Alyssa Rosenzweig [Tue, 2 Jul 2019 03:02:57 +0000 (20:02 -0700)]
panfrost/midgard: Handle fp16 in embedded_to_inline_constants

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost/midgard: Eliminate redundant type convert
Alyssa Rosenzweig [Tue, 2 Jul 2019 02:57:49 +0000 (19:57 -0700)]
panfrost/midgard: Eliminate redundant type convert

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost/midgard: Fix fp16 embedded constants
Alyssa Rosenzweig [Tue, 2 Jul 2019 02:49:51 +0000 (19:49 -0700)]
panfrost/midgard: Fix fp16 embedded constants

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost/midgard: Hoist mask field
Alyssa Rosenzweig [Tue, 2 Jul 2019 01:51:48 +0000 (18:51 -0700)]
panfrost/midgard: Hoist mask field

Share a single mask field in midgard_instruction with a unified format,
rather than using separate masks for each instruction tag with
hardware-specific formats. Eliminates quite a bit of duplicated code and
will enable vec8/vec16 masks as well (which don't map as cleanly to the
hardware as we might like).

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost/midgard: Allow fp16 in scalar ALU
Alyssa Rosenzweig [Tue, 2 Jul 2019 01:35:28 +0000 (18:35 -0700)]
panfrost/midgard: Allow fp16 in scalar ALU

The packing is a little different, so implement that.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost/midgard: Implement f2u16 and friends
Alyssa Rosenzweig [Tue, 2 Jul 2019 00:41:20 +0000 (17:41 -0700)]
panfrost/midgard: Implement f2u16 and friends

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost/midgard: Implement f2f16/f2f32
Alyssa Rosenzweig [Tue, 2 Jul 2019 00:38:26 +0000 (17:38 -0700)]
panfrost/midgard: Implement f2f16/f2f32

These conversions handle half-floats within the shader.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost/midgard: Verify src_bitsize == dst_bitsize
Alyssa Rosenzweig [Tue, 2 Jul 2019 00:35:25 +0000 (17:35 -0700)]
panfrost/midgard: Verify src_bitsize == dst_bitsize

We can handle differing, but we'd prefer not to because there are
restrictions on sizing which aren't accounted for yet.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost/midgard: Simplify blend read
Alyssa Rosenzweig [Tue, 2 Jul 2019 00:23:58 +0000 (17:23 -0700)]
panfrost/midgard: Simplify blend read

It's not clear where the extra indirection was from (older hardware or
just older blobs?)

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost/midgard: NIRify blend load scale/convert
Alyssa Rosenzweig [Mon, 1 Jul 2019 23:45:07 +0000 (16:45 -0700)]
panfrost/midgard: NIRify blend load scale/convert

The scale and type-convert can now be expressed in NIR, rather than MIR,
which is significantly more maintainable and demonstrates correctness of
the type conversion patches.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost/midgard: Fix blend constant scheduling bug
Alyssa Rosenzweig [Mon, 1 Jul 2019 23:44:49 +0000 (16:44 -0700)]
panfrost/midgard: Fix blend constant scheduling bug

Blend constant conflicts run in two directions.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost/midgard: Implement upscaling type converts
Alyssa Rosenzweig [Mon, 1 Jul 2019 23:44:00 +0000 (16:44 -0700)]
panfrost/midgard: Implement upscaling type converts

Rather than using a dest_override, we upscale integers by using a half
field with a sign-extend bit. A variant of this trick should also work
for floats, but one step at a time!

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost/midgard: Move blend load/store into NIR
Alyssa Rosenzweig [Mon, 1 Jul 2019 22:02:40 +0000 (15:02 -0700)]
panfrost/midgard: Move blend load/store into NIR

We have dedicated intrinsics to access the raw contents of the tile
buffer so we can use a dedicated NIR pass to lower appropriately for
blend shaders, rather than introducing a bizarre hardcoded blend
epilogue that only works for RGBA8_UNORM.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost/midgard: Use nir_dest_num_components
Alyssa Rosenzweig [Mon, 1 Jul 2019 22:28:37 +0000 (15:28 -0700)]
panfrost/midgard: Use nir_dest_num_components

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost/midgard: Implement integer downsize ops
Alyssa Rosenzweig [Mon, 1 Jul 2019 22:26:22 +0000 (15:26 -0700)]
panfrost/midgard: Implement integer downsize ops

Oh, dear. No turning back now.

We begin implementing non-32-bit types, using downsizing integer type
conversions as the initial instructions. We implement them naively as
type-converting moves; substantially more efficient operation is
possible by copypropping the type conversion modifier, but this
optimization is not implemented here.

Size converting modifiers on Midgard allow an instruction to write to a
destination 1/2 the size, or to read from a source 1/2 the size. If we
need an extreme conversion (32-bit to 8-bit, for instance), multiple
type converting ops are chained together, which here is handled via an
algebraic pass.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost/midgard: Move scale from MIR to NIR
Alyssa Rosenzweig [Mon, 1 Jul 2019 21:46:43 +0000 (14:46 -0700)]
panfrost/midgard: Move scale from MIR to NIR

This begins the process of removing blend shader specific MIR into a
more general NIR lowering pass for formats.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost/midgard: Passthrough nir_lower_framebuffer
Alyssa Rosenzweig [Mon, 1 Jul 2019 20:26:07 +0000 (13:26 -0700)]
panfrost/midgard: Passthrough nir_lower_framebuffer

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost: Extend clear colour packing
Alyssa Rosenzweig [Mon, 1 Jul 2019 18:49:06 +0000 (11:49 -0700)]
panfrost: Extend clear colour packing

Eventually, this will allow packing clear colours for all formats,
including floating-point framebuffers, pure integer buffers, and special
formats. Currently, a few of these formats are supported, and many more
are handled through a generic Gallium colour packing path (which is not
a perfect fit for the hardware, but works for many formats and is a sane
default for the moment.)

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost/mfbd: Include codes for float framebuffers
Alyssa Rosenzweig [Mon, 1 Jul 2019 16:44:40 +0000 (09:44 -0700)]
panfrost/mfbd: Include codes for float framebuffers

We see the hardware doesn't actually support float framebuffers in the
native sense -- rather, it just allows higher bpp framebuffers and lets
a blend shader / additional clear_color fields sort out the formats.
This will be.. interesting.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost: Prepare some code for MRT
Alyssa Rosenzweig [Mon, 1 Jul 2019 16:09:03 +0000 (09:09 -0700)]
panfrost: Prepare some code for MRT

Full MRT support is a while away, but in the mean time, we can remove
code that explicitly assumes nr_cbufs <= 0, to minimize the obstacles
we'll face later when we add the whole thing.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost: Use standard ALIGN_POT/INFINITY macros
Alyssa Rosenzweig [Fri, 5 Jul 2019 15:25:56 +0000 (08:25 -0700)]
panfrost: Use standard ALIGN_POT/INFINITY macros

We had vendored duplicates from pre-Mesa days; clean that up.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agoegl: add glvnd symbols check
Eric Engestrom [Thu, 11 Oct 2018 17:38:52 +0000 (18:38 +0100)]
egl: add glvnd symbols check

According to the spec [1], `__egl_Main` is the only symbol that needs to
be exported. We don't want applications directly linking against
libEGL_mesa.so (apps should always go through libEGL.so, regardless of
who is providing it), so we shouldn't export any other symbols either.

[1] https://github.com/NVIDIA/libglvnd/blob/master/include/glvnd/libeglabi.h
    (this header is the closest there is to a spec)

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
5 years agoegl: rewrite entrypoints check
Eric Engestrom [Thu, 22 Nov 2018 18:44:29 +0000 (18:44 +0000)]
egl: rewrite entrypoints check

Part of the effort to replace shell scripts with portable python scripts.
I could've used a trivial `assert lines == sorted(lines)`, but this way
the caller is shown which entrypoint is out of order.

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
5 years agomapi: add shared glapi symbols check
Eric Engestrom [Thu, 22 Nov 2018 19:16:00 +0000 (19:16 +0000)]
mapi: add shared glapi symbols check

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
5 years agotu: add exported symbols check
Eric Engestrom [Fri, 29 Mar 2019 17:15:45 +0000 (17:15 +0000)]
tu: add exported symbols check

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
5 years agovulkan: add symbols file
Eric Engestrom [Thu, 11 Oct 2018 14:01:46 +0000 (15:01 +0100)]
vulkan: add symbols file

According to the Vulkan ICD spec [1], these two symbols must be exposed:
- vk_icdGetInstanceProcAddr
- vk_icdNegotiateLoaderICDInterfaceVersion

and this one is optional:
- vk_icdGetPhysicalDeviceProcAddr

[1] https://github.com/KhronosGroup/Vulkan-Loader/blob/master/loader/LoaderAndLayerInterface.md

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
5 years agomeson: remove unused env_test
Eric Engestrom [Thu, 11 Oct 2018 17:36:36 +0000 (18:36 +0100)]
meson: remove unused env_test

No longer used as of last commit :)

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
5 years agogles: use new symbols check script
Eric Engestrom [Thu, 11 Oct 2018 13:46:34 +0000 (14:46 +0100)]
gles: use new symbols check script

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
5 years agogbm: sort symbols
Eric Engestrom [Tue, 11 Jun 2019 18:00:33 +0000 (19:00 +0100)]
gbm: sort symbols

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
5 years agogbm: use new symbols check script
Eric Engestrom [Thu, 11 Oct 2018 13:43:35 +0000 (14:43 +0100)]
gbm: use new symbols check script

Note: the list in gbm-symbols.txt is the same as the one that was in
gbm-symbols-check, I just took the opportunity to sort it.

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
5 years agoegl: use new symbols check script
Eric Engestrom [Thu, 11 Oct 2018 13:40:28 +0000 (14:40 +0100)]
egl: use new symbols check script

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
5 years agosymbols-check: introduce new python script
Eric Engestrom [Thu, 11 Oct 2018 12:08:42 +0000 (13:08 +0100)]
symbols-check: introduce new python script

I've re-written this in bash a couple times over the years, and then
I realised python is much more portable and already required by Mesa, so
we might as well make use of it.

I decided to still use the build system's NM instead of re-implementing
symbols extraction, to offload the complexity of keeping it compatible
with many systems (Linux, Unix, BSD, MacOS, etc.), especially when
cross-building.

This new script checks not only that nothing is exported when it
shouldn't be, but also that everything that should be exported is.
Sometimes, some symbols _can_ be exported but don't have to be, in which
case they can be prefixed with `(optional)`.

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
5 years agonv50/ir/nir: implement load/store_global
Karol Herbst [Thu, 22 Feb 2018 10:58:44 +0000 (11:58 +0100)]
nv50/ir/nir: implement load/store_global

required by OpenCL

v2: fix setting globalAccess

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Pierre Moreau <pierre.morrow@free.fr>
5 years agonv50/ir/nir: handle kernel inputs
Karol Herbst [Thu, 31 Jan 2019 11:33:03 +0000 (12:33 +0100)]
nv50/ir/nir: handle kernel inputs

required by OpenCL

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Pierre Moreau <pierre.morrow@free.fr>
5 years agonv50/ir/nir: don't assert on !main
Karol Herbst [Fri, 8 Mar 2019 13:12:00 +0000 (14:12 +0100)]
nv50/ir/nir: don't assert on !main

required for OpenCL

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Pierre Moreau <pierre.morrow@free.fr>
5 years agonv50/ir/nir: parse system values first and stop for compute shaders
Karol Herbst [Thu, 31 Jan 2019 11:24:44 +0000 (12:24 +0100)]
nv50/ir/nir: parse system values first and stop for compute shaders

required by OpenCL

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Pierre Moreau <pierre.morrow@free.fr>
5 years agonir/lower_io: Don't use variable to get deref mode
Connor Abbott [Wed, 10 Jul 2019 09:55:24 +0000 (11:55 +0200)]
nir/lower_io: Don't use variable to get deref mode

Drivers only use lower_io for modes where pointers don't have a
meaningful value, and dereferences can always be traced back to a
variable. But there can be other modes, like global mode with
VK_EXT_buffer_device_address, where pointers cannot be traced back to a
variable, and lower_io would segfault on loads/stores of these since
nir_deref_instr_get_variable() would return NULL.

Just use the mode on the deref itself to filter out these modes before
we try to get the variable.

Fixes: 118a66df990 ("radv: Use NIR barycentric coordinates")
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoradv: Don't optimize after lowering FS inputs
Connor Abbott [Tue, 9 Jul 2019 11:43:13 +0000 (13:43 +0200)]
radv: Don't optimize after lowering FS inputs

Currently this is done rather late in radv, after lowering booleans, so
it isn't safe to run additional optimizations that may add e.g. 1-bit
booleans. We could move the lowering parts earlier, but since right now
we only lower FS inputs and by this point all indirects have been
lowered away, there's no reason we should need to optimize anything.

One shader from Devil May Cry 5 was getting optimized, but only because
the optimization loop was working on 32-bit booleans which revealed an
opportunity that was hidden with 1-bit booleans, and we generated a
1-bit boolean which is invalid.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111092
Fixes: 118a66df9907772bb9e5503b736c95d7bb62d52c
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoandroid: amd/addrlib: add gfx10 support
Mauro Rossi [Sat, 6 Jul 2019 19:16:04 +0000 (21:16 +0200)]
android: amd/addrlib: add gfx10 support

Fix the following building error:

external/mesa/src/amd/addrlib/src/gfx10/gfx10addrlib.cpp:35:10:
fatal error: 'gfx10_gb_reg.h' file not found
         ^~~~~~~~~~~~~~~~
1 error generated.

Fixes: 78cdf9a ("amd/addrlib: add gfx10 support")
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
5 years agoandroid: amd/common/gfx10: add register JSON
Mauro Rossi [Sat, 6 Jul 2019 18:21:31 +0000 (20:21 +0200)]
android: amd/common/gfx10: add register JSON

The necessary Android makefile building rules are added
and the generation rules are simplified for readability

Fixes the following building errors:

external/mesa/src/amd/common/ac_llvm_build.c:1496:45:
error: use of undeclared identifier 'V_008F0C_IMG_FORMAT_8_UINT'
   case V_008F0C_BUF_DATA_FORMAT_8: format = V_008F0C_IMG_FORMAT_8_UINT; break;
                                             ^
Fixes: 74a26af ("amd/common/gfx10: add register JSON")
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
5 years agoandroid: radeonsi/gfx10: generate gfx10_format_table.h (v2)
Mauro Rossi [Sat, 6 Jul 2019 19:27:21 +0000 (21:27 +0200)]
android: radeonsi/gfx10: generate gfx10_format_table.h (v2)

Fix Android building rules for gfx10_format_table.h generated header

(v2) Add LOCAL_C_INCLUDES += $(intermediates)/radeonsi to fix error:

external/mesa/src/gallium/drivers/radeonsi/si_state.c:46:10:
fatal error: 'gfx10_format_table.h' file not found
         ^~~~~~~~~~~~~~~~~~~~~~
1 error generated.

Fixes: 0ffa229 ("radeonsi/gfx10: generate gfx10_format_table.h")
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
5 years agoandroid: virgl: remove unnecessary LOCAL_C_INCLUDES
Chih-Wei Huang [Mon, 8 Jul 2019 02:16:18 +0000 (10:16 +0800)]
android: virgl: remove unnecessary LOCAL_C_INCLUDES

The path could be imported automatically.

Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
Reviewed-by: Mauro Rossi <issor.oruam@gmail.com>
5 years agoandroid: vulkan/util: fix generating vk_enum_to_str.*
Chih-Wei Huang [Fri, 5 Jul 2019 08:35:19 +0000 (16:35 +0800)]
android: vulkan/util: fix generating vk_enum_to_str.*

The gen_enum_to_str.py generates vk_enum_to_str.c and its header at once.
However, the makefiles incorrectly list both files parallel with the same
recipes. That means both two files may be generated simultaneously by two
processes. The generating files may be truncated by another process, as
shown below:

$ cd $OUT/obj/STATIC_LIBRARIES/libmesa_vulkan_util_intermediates/util
$ ls -l

-rw-rw-r-- 1 lh lh 193713 Jul  5 13:31 vk_enum_to_str.c
-rw-rw-r-- 1 lh lh   4609 Jul  5 13:31 vk_enum_to_str.d
-rw-rw-r-- 1 lh lh      0 Jul  5 16:21 vk_enum_to_str.h

Let one file depends on the other with empty recipe to avoid the issue.

Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agoandroid: radv: import include paths from used libraries
Chih-Wei Huang [Tue, 25 Jun 2019 09:11:12 +0000 (17:11 +0800)]
android: radv: import include paths from used libraries

It's unnecessary to manually add these include paths since they could
be imported automatically.

Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
5 years agoandroid: anv: import include path of libmesa_nir
Chih-Wei Huang [Thu, 20 Jun 2019 10:14:35 +0000 (18:14 +0800)]
android: anv: import include path of libmesa_nir

Add libmesa_nir to a common LOCAL_STATIC_LIBRARIES defined by
ANV_STATIC_LIBRARIES so that its include path can be imported
automatically. Then ANV_INCLUDES is unnecessary and could be
eliminated.

Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
Acked-by: Emil Velikov <emil.velikov@collabora.com>