platform/upstream/mesa.git
2 years agomesa/st: start moving bufferobject alloc/free/reference to main.
Dave Airlie [Thu, 9 Dec 2021 01:58:35 +0000 (11:58 +1000)]
mesa/st: start moving bufferobject alloc/free/reference to main.

This moves these out of the state tracker code

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14133>

2 years agomesa/st: merge st buffer object into GL
Dave Airlie [Thu, 9 Dec 2021 01:37:58 +0000 (11:37 +1000)]
mesa/st: merge st buffer object into GL

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14133>

2 years agobroadcom/compiler: avoid unneeded sint/unorm clamping when lowering stores
Alejandro Piñeiro [Mon, 13 Dec 2021 14:25:47 +0000 (15:25 +0100)]
broadcom/compiler: avoid unneeded sint/unorm clamping when lowering stores

They are being used on integer to integer stores. From Vulkan sec,
final paragraph of 16.4.4 "Texel Output Format Conversion":
    "Each component is converted based on its type and size (as
     defined in the Format Definition section for each
     VkFormat). ... Integer outputs are converted such that their value
     is preserved. The converted value of any integer that cannot be
     represented in the target format is undefined."

I didn't find a equivalent quote for OpenGL as all conversion entries
are forcused on float to integer, fixed-point to integer, etc, and not
on integer to integer. Didn't find any test failure with this change.

We didn't get any shader-db stats change with shaderdb (even
overriding to OpenGL 4.4 to get more shaders built), so as a reference
Vulkan shader-db stats with the pattern
dEQP-VK.image.*.with_format.*.*
   total instructions in shared programs: 37534 -> 36522 (-2.70%)
   instructions in affected programs: 12080 -> 11068 (-8.38%)
   helped: 241
   HURT: 0
   Instructions are helped.

   total uniforms in shared programs: 9100 -> 8550 (-6.04%)
   uniforms in affected programs: 3004 -> 2454 (-18.31%)
   helped: 229
   HURT: 0

   total max-temps in shared programs: 6110 -> 6014 (-1.57%)
   max-temps in affected programs: 402 -> 306 (-23.88%)
   helped: 43
   HURT: 0
   Max-temps are helped.

   total nops in shared programs: 1523 -> 1526 (0.20%)
   nops in affected programs: 21 -> 24 (14.29%)
   helped: 3
   HURT: 6
   Inconclusive result (value mean confidence interval includes 0).

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14194>

2 years agoradv/winsys: update sparse mappings with OP_REPLACE instead of OP_MAP/OP_UNMAP
Samuel Pitoiset [Tue, 14 Dec 2021 08:54:07 +0000 (09:54 +0100)]
radv/winsys: update sparse mappings with OP_REPLACE instead of OP_MAP/OP_UNMAP

When the BO is NULL, AMDGPU will reset the PTE VA range to the initial
state. Otherwise, it will first unmap all existing VA that overlap the
requested range and then map. This seems better than using MAP/UNMAP.

This reduces stuttering in Forza Horizon 5.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14116>

2 years agoradv/winsys: stop using reference counting for virtual BOs
Samuel Pitoiset [Mon, 6 Dec 2021 17:43:27 +0000 (18:43 +0100)]
radv/winsys: stop using reference counting for virtual BOs

This shouldn't be necessary because applications have to manage
resources and memory themselves.

This also prevented memory to be freed if an application doesn't unbind
a sparse memory object and free it, which is legal as long as the
resource isn't used afterwards.

This was introduced to unmap the sparse mappings when destroying
a virtual BO, but now that the driver uses OP_CLEAR it's no longer
needed.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14116>

2 years agoradv/winsys: clear the PRT VA range when destroying a virtual BO
Samuel Pitoiset [Mon, 6 Dec 2021 17:35:19 +0000 (18:35 +0100)]
radv/winsys: clear the PRT VA range when destroying a virtual BO

Instead of unmapping every range.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14116>

2 years agoradv/winsys: remove useless has_sparse_vm_mappings checks
Samuel Pitoiset [Mon, 6 Dec 2021 17:32:46 +0000 (18:32 +0100)]
radv/winsys: remove useless has_sparse_vm_mappings checks

Sparse is only exposed on GFX8+, so this is always TRUE.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14116>

2 years agoRevert "anv: Stop doing too much per-sample shading"
Jason Ekstrand [Tue, 14 Dec 2021 17:55:06 +0000 (11:55 -0600)]
Revert "anv: Stop doing too much per-sample shading"

This reverts commit 1f559930b6b7a633d93cd4e9cc4965b3f5e7c607.  Turns
out, this approach won't work.

Fixes: 1f559930b6b7 ("anv: Stop doing too much per-sample shading")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14196>

2 years agomesa: use nop dispatch for ColorTable/Convolution/Histogram
Marek Olšák [Tue, 7 Dec 2021 22:50:35 +0000 (17:50 -0500)]
mesa: use nop dispatch for ColorTable/Convolution/Histogram

The nop dispatch generates GL_INVALID_OPERATION too.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14000>

2 years agomesa: remove all GL func forward declarations because they are autogenerated
Marek Olšák [Tue, 7 Dec 2021 21:48:11 +0000 (16:48 -0500)]
mesa: remove all GL func forward declarations because they are autogenerated

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14000>

2 years agomesa,vbo: make ES wrapper functions static
Marek Olšák [Tue, 14 Dec 2021 17:11:09 +0000 (12:11 -0500)]
mesa,vbo: make ES wrapper functions static

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14000>

2 years agoglapi: add missing no_error settings for implemented functions
Marek Olšák [Tue, 14 Dec 2021 17:02:32 +0000 (12:02 -0500)]
glapi: add missing no_error settings for implemented functions

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14000>

2 years agomesa: remove COPY_DISPATCH code that doesn't do anything
Marek Olšák [Thu, 2 Dec 2021 00:55:30 +0000 (19:55 -0500)]
mesa: remove COPY_DISPATCH code that doesn't do anything

When we get into create_beginend_table, ctx->Exec only contains nops
set by _mesa_alloc_dispatch_table. This function calls
_mesa_alloc_dispatch_table too, so table and ctx->Exec are identical,
and then it copies identical entries from one table to the other.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14000>

2 years agomesa: rename _ae_ArrayElement -> _mesa_ArrayElement to match glapi
Marek Olšák [Wed, 1 Dec 2021 21:59:23 +0000 (16:59 -0500)]
mesa: rename _ae_ArrayElement -> _mesa_ArrayElement to match glapi

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14000>

2 years agomesa: use ctx->GLThread.enabled now that it's correct
Marek Olšák [Mon, 29 Nov 2021 19:04:42 +0000 (14:04 -0500)]
mesa: use ctx->GLThread.enabled now that it's correct

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14000>

2 years agoglthread: disable glthread if the context is lost
Marek Olšák [Tue, 30 Nov 2021 13:28:35 +0000 (08:28 -0500)]
glthread: disable glthread if the context is lost

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14000>

2 years agoglthread: fix restoring the dispatch in destroy when the context is not current
Marek Olšák [Mon, 29 Nov 2021 18:51:23 +0000 (13:51 -0500)]
glthread: fix restoring the dispatch in destroy when the context is not current

also remove an invalid comment in mtypes.h

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14000>

2 years agoglthread: inline _mesa_glthread_restore_dispatch and merge disable & destroy
Marek Olšák [Mon, 29 Nov 2021 18:58:59 +0000 (13:58 -0500)]
glthread: inline _mesa_glthread_restore_dispatch and merge disable & destroy

No change in behavior.

This fixes ctx->GLThread.enabled, which was only set to false by destroy.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14000>

2 years agoglthread: set marshal functions in dispatch only if they exist in the API
Marek Olšák [Mon, 29 Nov 2021 00:39:45 +0000 (19:39 -0500)]
glthread: set marshal functions in dispatch only if they exist in the API

We now have proper nop dispatch for the unset functions.

The autogenerated code looks like this:

   if ((ctx->API == API_OPENGLES2 && ctx->Version >= 31)) {
      if (_gloffset_DepthRangeArrayfvOES >= 0)
         ((_glapi_proc *)(ctx->MarshalExec))[_gloffset_DepthRangeArrayfvOES] = (_glapi_proc)_mesa_marshal_DepthRangeArrayfvOES;
      if (_gloffset_DepthRangeIndexedfOES >= 0)
         ((_glapi_proc *)(ctx->MarshalExec))[_gloffset_DepthRangeIndexedfOES] = (_glapi_proc)_mesa_marshal_DepthRangeIndexedfOES;
   }
   if (_mesa_is_desktop_gl(ctx)) {
      if (_gloffset_AlphaToCoverageDitherControlNV >= 0)
         ((_glapi_proc *)(ctx->MarshalExec))[_gloffset_AlphaToCoverageDitherControlNV] = (_glapi_proc)_mesa_marshal_AlphaToCoverageDitherControlNV;
      if (_gloffset_AttachObjectARB >= 0)
         ((_glapi_proc *)(ctx->MarshalExec))[_gloffset_AttachObjectARB] = (_glapi_proc)_mesa_marshal_AttachObjectARB;
      if (_gloffset_BeginQueryIndexed >= 0)
         ((_glapi_proc *)(ctx->MarshalExec))[_gloffset_BeginQueryIndexed] = (_glapi_proc)_mesa_marshal_BeginQueryIndexed;
      if (_gloffset_BindBufferOffsetEXT >= 0)
         ((_glapi_proc *)(ctx->MarshalExec))[_gloffset_BindBufferOffsetEXT] = (_glapi_proc)_mesa_marshal_BindBufferOffsetEXT;
   ...

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14000>

2 years agoglthread: add nop dispatch
Marek Olšák [Mon, 29 Nov 2021 11:11:35 +0000 (06:11 -0500)]
glthread: add nop dispatch

so that glthread behaves the same as the main dispatch.

Also fix the SetError function for GLES 1.0.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14000>

2 years agovbo: expose all exec entrypoints for glthread and match api_exec_decl.h names
Marek Olšák [Mon, 29 Nov 2021 23:52:48 +0000 (18:52 -0500)]
vbo: expose all exec entrypoints for glthread and match api_exec_decl.h names

Autogenerated glthread code will call these directly.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14000>

2 years agomesa: remove GLvertexformat
Marek Olšák [Mon, 29 Nov 2021 14:02:07 +0000 (09:02 -0500)]
mesa: remove GLvertexformat

Function pointers were first set in GLvertexformat, and then
GLvertexformat was copied to the dispatch.

This just sets the function pointers in the dispatch directly,
skipping the intermediate GLvertexformat structure.

The code with SET_* calls is autogenerated by api_vtxfmt_init_h.py.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14000>

2 years agoglapi: autogenerate install_vtxfmt with python
Marek Olšák [Mon, 29 Nov 2021 01:31:06 +0000 (20:31 -0500)]
glapi: autogenerate install_vtxfmt with python

This is a prerequisite for the GLvertexformat removal.

The autogenerated file looks like this:

if (_mesa_is_desktop_gl(ctx) || (ctx->API == API_OPENGLES2 && ctx->Version >= 30)) {
   SET_VertexAttribI4iEXT(tab, NAME(VertexAttribI4iEXT));
   SET_VertexAttribI4ivEXT(tab, NAME(VertexAttribI4ivEXT));
   SET_VertexAttribI4uiEXT(tab, NAME(VertexAttribI4uiEXT));
   SET_VertexAttribI4uivEXT(tab, NAME(VertexAttribI4uivEXT));
}
if (ctx->API == API_OPENGLES2) {
   SET_VertexAttrib1fARB(tab, NAME_ES(VertexAttrib1fARB));
   SET_VertexAttrib1fvARB(tab, NAME_ES(VertexAttrib1fvARB));
   SET_VertexAttrib2fARB(tab, NAME_ES(VertexAttrib2fARB));
   SET_VertexAttrib2fvARB(tab, NAME_ES(VertexAttrib2fvARB));
   SET_VertexAttrib3fARB(tab, NAME_ES(VertexAttrib3fARB));
   SET_VertexAttrib3fvARB(tab, NAME_ES(VertexAttrib3fvARB));
   SET_VertexAttrib4fARB(tab, NAME_ES(VertexAttrib4fARB));
   SET_VertexAttrib4fvARB(tab, NAME_ES(VertexAttrib4fvARB));
}
if (ctx->API == API_OPENGL_COMPAT) {
   SET_ArrayElement(tab, NAME_AE(ArrayElement));
   SET_Begin(tab, NAME(Begin));
   SET_CallList(tab, NAME_CALLLIST(CallList));
   SET_CallLists(tab, NAME_CALLLIST(CallLists));
   SET_Color3b(tab, NAME(Color3b));
   SET_Color3bv(tab, NAME(Color3bv));
   ...

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14000>

2 years agoglapi: autogenerate all _mesa_* forward declarations in api_exec_decl.h
Marek Olšák [Mon, 29 Nov 2021 21:27:35 +0000 (16:27 -0500)]
glapi: autogenerate all _mesa_* forward declarations in api_exec_decl.h

We could remove them from other header files now.

This purposefully omits "_exec" in _mesa_exec such as _mesa_exec_Begin
to make it pretty. Later commits will remove _exec from names, e.g. it
will become _mesa_Begin. The only other variants are really just
save_Begin (dlist) and _save_Begin (vbo).

The autogenerated file looks like this:

void GLAPIENTRY _mesa_NewList(GLuint list, GLenum mode);
void GLAPIENTRY _mesa_EndList(void);
void GLAPIENTRY _mesa_CallList(GLuint list);
void GLAPIENTRY _mesa_CallLists(GLsizei n, GLenum type, const GLvoid * lists);
void GLAPIENTRY _mesa_DeleteLists(GLuint list, GLsizei range);
GLuint GLAPIENTRY _mesa_GenLists(GLsizei range);
void GLAPIENTRY _mesa_ListBase(GLuint base);
void GLAPIENTRY _mesa_Begin(GLenum mode);
void GLAPIENTRY _mesa_Bitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte * bitmap);
void GLAPIENTRY _mesa_Color3b(GLbyte red, GLbyte green, GLbyte blue);
void GLAPIENTRY _mesa_Color3bv(const GLbyte * v);
...

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14000>

2 years agomesa: remove api_exec.h and move its contents into context.h
Marek Olšák [Mon, 29 Nov 2021 21:16:51 +0000 (16:16 -0500)]
mesa: remove api_exec.h and move its contents into context.h

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14000>

2 years agoglapi: autogenerate api_save.h with save_* function declarations
Marek Olšák [Mon, 29 Nov 2021 12:55:42 +0000 (07:55 -0500)]
glapi: autogenerate api_save.h with save_* function declarations

This is planned to be used by glthread for its own dispatch mechanism.

The autogenerated file looks like this:

void GLAPIENTRY save_NewList(GLuint list, GLenum mode);
void GLAPIENTRY save_ListBase(GLuint base);
void GLAPIENTRY save_Bitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte * bitmap);
void GLAPIENTRY save_RasterPos2d(GLdouble x, GLdouble y);
void GLAPIENTRY save_RasterPos2dv(const GLdouble * v);
void GLAPIENTRY save_RasterPos2f(GLfloat x, GLfloat y);
void GLAPIENTRY save_RasterPos2fv(const GLfloat * v);
void GLAPIENTRY save_RasterPos2i(GLint x, GLint y);
void GLAPIENTRY save_RasterPos2iv(const GLint * v);
...

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14000>

2 years agoglapi: autogenerate _mesa_initialize_save_table with python
Marek Olšák [Mon, 29 Nov 2021 00:14:52 +0000 (19:14 -0500)]
glapi: autogenerate _mesa_initialize_save_table with python

The generated file looks like this:

SET_NewList(table, save_NewList);
SET_ListBase(table, save_ListBase);
SET_Bitmap(table, save_Bitmap);
SET_RasterPos2d(table, save_RasterPos2d);
SET_RasterPos2dv(table, save_RasterPos2dv);
SET_RasterPos2f(table, save_RasterPos2f);
SET_RasterPos2fv(table, save_RasterPos2fv);
SET_RasterPos2i(table, save_RasterPos2i);
SET_RasterPos2iv(table, save_RasterPos2iv);
SET_RasterPos2s(table, save_RasterPos2s);
...

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14000>

2 years agoglapi: move reusable glapi printing code to apiexec.py
Marek Olšák [Tue, 7 Dec 2021 21:41:28 +0000 (16:41 -0500)]
glapi: move reusable glapi printing code to apiexec.py

This will be used by all new scripts.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14000>

2 years agovbo: rename ES vertex functions to match GL dispatch names
Marek Olšák [Mon, 29 Nov 2021 17:15:07 +0000 (12:15 -0500)]
vbo: rename ES vertex functions to match GL dispatch names

vbo_init_tmp.h will be autogenerated.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14000>

2 years agovbo: rename vertex functions to match GL dispatch names
Marek Olšák [Mon, 29 Nov 2021 17:15:07 +0000 (12:15 -0500)]
vbo: rename vertex functions to match GL dispatch names

vbo_init_tmp.h will be autogenerated.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14000>

2 years agomesa: add EXT suffix to VertexAttribI*EXT to match glapi name
Marek Olšák [Mon, 29 Nov 2021 02:03:14 +0000 (21:03 -0500)]
mesa: add EXT suffix to VertexAttribI*EXT to match glapi name

I don't wanna do it the other way and potentially break the libGL - *_dri ABI.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14000>

2 years agoglapi: replace dispatch.h inline functions with macros for faster compilation
Marek Olšák [Mon, 29 Nov 2021 12:14:31 +0000 (07:14 -0500)]
glapi: replace dispatch.h inline functions with macros for faster compilation

A change in dispatch.h now takes 11.7% less user+sys time to compile.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14000>

2 years agoglapi: move apiexec API condition determination to common code
Marek Olšák [Mon, 29 Nov 2021 00:28:57 +0000 (19:28 -0500)]
glapi: move apiexec API condition determination to common code

it will be used elsewhere

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14000>

2 years agoglapi: rename gl_genexec.py to api_exec_init.py, api_exec.c to api_exec_init.c
Marek Olšák [Mon, 29 Nov 2021 10:41:44 +0000 (05:41 -0500)]
glapi: rename gl_genexec.py to api_exec_init.py, api_exec.c to api_exec_init.c

this seems cleaner

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14000>

2 years agomesa: rename dlist functions to match dispatch function names
Marek Olšák [Sun, 28 Nov 2021 23:17:23 +0000 (18:17 -0500)]
mesa: rename dlist functions to match dispatch function names

_mesa_initialize_save_table will be autogenerated.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14000>

2 years agomesa: don't set CallList* redundantly in _mesa_initialize_save_table
Marek Olšák [Sun, 28 Nov 2021 22:24:59 +0000 (17:24 -0500)]
mesa: don't set CallList* redundantly in _mesa_initialize_save_table

It's set by _mesa_install_save_vtxfmt.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14000>

2 years agoglapi: rename exec="dynamic" to exec "vtxfmt" to make it self-explanatory
Marek Olšák [Sun, 28 Nov 2021 22:34:26 +0000 (17:34 -0500)]
glapi: rename exec="dynamic" to exec "vtxfmt" to make it self-explanatory

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14000>

2 years agomesa: move the ES2 check from vbo_init_tmp.h to install_vtxfmt
Marek Olšák [Sun, 28 Nov 2021 22:05:59 +0000 (17:05 -0500)]
mesa: move the ES2 check from vbo_init_tmp.h to install_vtxfmt

It's where other API checks are done.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14000>

2 years agomesa: inline _vbo_install_exec_vtxfmt
Marek Olšák [Mon, 29 Nov 2021 14:40:17 +0000 (09:40 -0500)]
mesa: inline _vbo_install_exec_vtxfmt

also remove unused vbo_initialize_exec_dispatch

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14000>

2 years agomesa: move _mesa_initialize_vbo_vtxfmt calls to a common place and inline
Marek Olšák [Mon, 29 Nov 2021 14:34:38 +0000 (09:34 -0500)]
mesa: move _mesa_initialize_vbo_vtxfmt calls to a common place and inline

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14000>

2 years agomesa: inline _mesa_install_dlist_vtxfmt
Marek Olšák [Sun, 28 Nov 2021 22:21:08 +0000 (17:21 -0500)]
mesa: inline _mesa_install_dlist_vtxfmt

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14000>

2 years agomesa: inline _mesa_install_eval_vtxfmt
Marek Olšák [Sun, 28 Nov 2021 21:56:44 +0000 (16:56 -0500)]
mesa: inline _mesa_install_eval_vtxfmt

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14000>

2 years agomesa: inline _mesa_install_arrayelt_vtxfmt
Marek Olšák [Sun, 28 Nov 2021 21:54:35 +0000 (16:54 -0500)]
mesa: inline _mesa_install_arrayelt_vtxfmt

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14000>

2 years agomesa: inline vbo_initialize_save_dispatch and rename the functions
Marek Olšák [Sun, 28 Nov 2021 21:45:55 +0000 (16:45 -0500)]
mesa: inline vbo_initialize_save_dispatch and rename the functions

_mesa_initialize_save_table will be autogenerated.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14000>

2 years agomesa: include less stuff in dlist.c
Marek Olšák [Mon, 29 Nov 2021 12:52:10 +0000 (07:52 -0500)]
mesa: include less stuff in dlist.c

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14000>

2 years agovirgl: Enable higher compatibility profiles if host supports it
Gert Wollny [Wed, 25 Aug 2021 14:02:31 +0000 (16:02 +0200)]
virgl: Enable higher compatibility profiles if host supports it

v2: Update CI expectations

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Italo Nicola <italonicola@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12542>

2 years agoci: pin virglrenderer version
Gert Wollny [Mon, 6 Dec 2021 10:13:55 +0000 (11:13 +0100)]
ci: pin virglrenderer version

Currently we always just pull in whatever version of
virglrenderer happens to be TOT in googlesource.

Instead, pin a specific version, and this should also
trigger an update of the container when this versions
is changed.

v2: Fix spelling error (tomeu)

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12542>

2 years agoradv: have the null winsys set more fields
Rhys Perry [Wed, 8 Dec 2021 16:52:33 +0000 (16:52 +0000)]
radv: have the null winsys set more fields

I copied stuff from ac_gpu_info.c until there were no Sienna Cichild or
Polaris10 fossil-db changes between real hardware and RADV_FORCE_FAMILY.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14126>

2 years agoradv: Expose the ETC2 emulation.
Bas Nieuwenhuizen [Mon, 6 Dec 2021 02:39:01 +0000 (03:39 +0100)]
radv: Expose the ETC2 emulation.

As needed on Android (as it is required) and by driconf flag otherwise.
The non-Android case would be on the host side for an Android VM.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14071>

2 years agoradv: Deal with border colors with emulated ETC2.
Bas Nieuwenhuizen [Mon, 6 Dec 2021 01:22:32 +0000 (02:22 +0100)]
radv: Deal with border colors with emulated ETC2.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14071>

2 years agoradv: Add ETC2 decode shader.
Bas Nieuwenhuizen [Wed, 3 Nov 2021 23:49:45 +0000 (00:49 +0100)]
radv: Add ETC2 decode shader.

To make sure that apps actually get something when the HW doesn't
support ETC2. To do that we decompress after every copy operation.

Includes a quite complicated decode shader. It is not bit-to-bit
equivalent to AMD APUs that support ETC2, but close enough to
pass CTS. Likely missing bits are related to the R11 and R11G11
formats where we decode to 16 bits but likely do the extension
differently.

Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14071>

2 years agoradv: Add extra plane for decoding ETC images with emulation.
Bas Nieuwenhuizen [Wed, 3 Nov 2021 23:00:59 +0000 (00:00 +0100)]
radv: Add extra plane for decoding ETC images with emulation.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14071>

2 years agoradv: Use the correct base format for reintepretation.
Bas Nieuwenhuizen [Tue, 30 Nov 2021 00:47:15 +0000 (01:47 +0100)]
radv: Use the correct base format for reintepretation.

Going to hit it when emulating ETC2 through another plane.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14071>

2 years agoradv: Set up ETC2 emulation wiring.
Bas Nieuwenhuizen [Wed, 3 Nov 2021 11:55:28 +0000 (12:55 +0100)]
radv: Set up ETC2 emulation wiring.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14071>

2 years agov3d: Don't force SCANOUT for PIPE_BIND_SHARED requests
Roman Stratiienko [Fri, 10 Dec 2021 17:35:55 +0000 (19:35 +0200)]
v3d: Don't force SCANOUT for PIPE_BIND_SHARED requests

This was workaround for the users of gbm_bo_create_with_modifiers(),
which were unable to specify the buffer usage (GPU / GPU+DISPLAY).

But after the commit [1] this become possible. And forcing usage to
GBM_BO_USE_SCANOUT migrated directly into gbm_bo_create_with_modifiers
[2], allowing us to remove such workarounds from the drivers.

This makes possible to allocate the buffers in VRAM using
{gbm_bo_create_with_modifiers2 | gbm_bo_create} and providing correct
use flag thus saving CMA memory.

This should also enable tiling for such buffers.

[1]: 268e12c60534 ("gbm: add gbm_{bo,surface}_create_with_modifiers2")
[2]: ad50b47a14e9 ("gbm: assume USE_SCANOUT in create_with_modifiers")

Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
Reviewed-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14151>

2 years agov3dv: Hotfix: Rename remaining V3DV_HAS_SURFACE->V3DV_USE_WSI_PLATFORM
Roman Stratiienko [Tue, 14 Dec 2021 09:53:33 +0000 (11:53 +0200)]
v3dv: Hotfix: Rename remaining V3DV_HAS_SURFACE->V3DV_USE_WSI_PLATFORM

This was somehow missed by me and during review.

Fixes fcfc4ddfccd5: ("v3dv: Fix V3DV_HAS_SURFACE preprocessor condition")

Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14190>

2 years agobroadcom/compiler: improve thrsw merge
Iago Toral Quiroga [Mon, 13 Dec 2021 07:56:43 +0000 (08:56 +0100)]
broadcom/compiler: improve thrsw merge

Instead of stopping the merge process when we find an instruction
with an incompatible signal (such as an small immediate), keep
going and see if we can merge the thrsw in a previous instruction
that is compatible.

total instructions in shared programs: 13409835 -> 13356648 (-0.40%)
instructions in affected programs: 3556860 -> 3503673 (-1.50%)
helped: 17457
HURT: 18
Instructions are helped.

total max-temps in shared programs: 2353971 -> 2352956 (-0.04%)
max-temps in affected programs: 13960 -> 12945 (-7.27%)
helped: 703
HURT: 0
Max-temps are helped.

total spills in shared programs: 12301 -> 12301 (0.00%)
total sfu-stalls in shared programs: 32596 -> 32499 (-0.30%)
sfu-stalls in affected programs: 225 -> 128 (-43.11%)
helped: 79
HURT: 3
Sfu-stalls are helped.

total nops in shared programs: 347204 -> 325234 (-6.33%)
nops in affected programs: 99834 -> 77864 (-22.01%)
helped: 11515
HURT: 158
Nops are helped.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14172>

2 years agoutil/ra: use adjacency matrix for undirected graph
Kostiantyn Lazukin [Wed, 10 Nov 2021 16:01:09 +0000 (18:01 +0200)]
util/ra: use adjacency matrix for undirected graph

Since this graph is actually not oriented, its adjacency matrix can be
represented using less than half bits required by full adjacency matrix.
It reduces memory consumption and number of cache misses. It also simplifies
logic of growing this matrix - no need to touch adjacency bits for previously
allocated number of nodes.

Move adjacency bits from nodes to graph to reduce the number of allocations.

No changes to shader-db.

Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Kostiantyn Lazukin <kostiantyn.lazukin@globallogic.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14189>

2 years agolvp: Free the driver_data pointer for all commands
Tomeu Vizoso [Mon, 6 Dec 2021 15:28:02 +0000 (16:28 +0100)]
lvp: Free the driver_data pointer for all commands

We were only freeing it for commands that had a struct as their
parameter, but all commands can have driver_data.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5715
Reported-by: Jose Fonseca <jfonsec@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14081>

2 years agonir: use call_once() to init debug variable
Juan A. Suarez Romero [Mon, 13 Dec 2021 09:21:34 +0000 (10:21 +0100)]
nir: use call_once() to init debug variable

For data-race safety, let's use this function to ensure NIR debug is
initialized only once.

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14057>

2 years agotgsi-to-nir: initialize NIR_DEBUG envvar
Juan A. Suarez Romero [Sat, 4 Dec 2021 06:39:51 +0000 (07:39 +0100)]
tgsi-to-nir: initialize NIR_DEBUG envvar

This envvar is initialized when creating a NIR shader, but it needs to
be used before. So initialize it here.

v2 (Juan):
 - Use static variable for first initialization.

Fixes: f77ccdfb4a2 ("nir: add NIR_DEBUG envvar")
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14057>

2 years agoiris: Disable the SMEM fallback for CCS on XeHP
Nanley Chery [Tue, 28 Sep 2021 00:09:02 +0000 (17:09 -0700)]
iris: Disable the SMEM fallback for CCS on XeHP

On XeHP, CCS is only supported in local memory.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14012>

2 years agoiris: Rework the DEVICE_LOCAL heap
Nanley Chery [Wed, 1 Dec 2021 20:45:25 +0000 (15:45 -0500)]
iris: Rework the DEVICE_LOCAL heap

Split it into a local-only heap (which keeps the original enum) and a
local-preferred heap (which has a new enum).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14012>

2 years agoiris: Add and use bucket_info_for_heap
Nanley Chery [Wed, 1 Dec 2021 18:48:57 +0000 (13:48 -0500)]
iris: Add and use bucket_info_for_heap

Add a helper that maps a heap to the related cache bucket information.
This avoids complicating existing ternaries when new cache buckets are
added.

Rework:
 * Jordan: Add default and set pointers in default branch of
   bucket_info_for_heap to prevent "may be used uninitialized" warning
   in release builds.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14012>

2 years agoiris: Add and use BUCKET_ARRAY_SIZE
Nanley Chery [Thu, 2 Dec 2021 15:18:23 +0000 (10:18 -0500)]
iris: Add and use BUCKET_ARRAY_SIZE

This improves an assert in add_bucket.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14012>

2 years agoiris: Replace "local" with "heap" in bufmgr fn params
Nanley Chery [Wed, 1 Dec 2021 18:08:55 +0000 (13:08 -0500)]
iris: Replace "local" with "heap" in bufmgr fn params

We'll want to describe more than two placement options for BOs. Switch
to using the more flexible heap enum.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14012>

2 years agoiris: Use a num_buckets pointer in add_bucket
Nanley Chery [Wed, 1 Dec 2021 18:45:05 +0000 (13:45 -0500)]
iris: Use a num_buckets pointer in add_bucket

Store a pointer to the appropriate cache bucket counter, then increment
the integer it points to. This keeps us from having to add code for
incrementing when a new cache bucket is added.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14012>

2 years agoiris: Add and use flags_to_heap
Nanley Chery [Tue, 28 Sep 2021 00:09:02 +0000 (17:09 -0700)]
iris: Add and use flags_to_heap

Reduces duplicated calculations.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14012>

2 years agoiris: Replace bo->real.local with bo->real.heap
Nanley Chery [Wed, 1 Dec 2021 16:28:31 +0000 (11:28 -0500)]
iris: Replace bo->real.local with bo->real.heap

We'll want to describe more than two placement options for BOs. Switch
to using the more flexible heap enum.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14012>

2 years agoiris: Free the local cache bucket in bufmgr_destroy
Nanley Chery [Tue, 7 Dec 2021 21:25:20 +0000 (16:25 -0500)]
iris: Free the local cache bucket in bufmgr_destroy

Fixes: 55be94dcab4 ("iris/bufmgr: Add new set of buckets for local memory.")
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14012>

2 years agovenus: fix vn_buffer_get_max_buffer_size
Chia-I Wu [Tue, 14 Dec 2021 01:02:34 +0000 (17:02 -0800)]
venus: fix vn_buffer_get_max_buffer_size

The binary search can lead to infinite loop.  Fixes
dEQP-VK.api.object_management.alloc_callback_fail.device where
vn_CreateBuffer can always fail.

Fixes: a74f2495ca0 ("venus: implement vn_buffer_get_max_buffer_size")
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14184>

2 years agopan/mdg: Fix definition of UBO unpack
Alyssa Rosenzweig [Tue, 14 Dec 2021 03:25:46 +0000 (22:25 -0500)]
pan/mdg: Fix definition of UBO unpack

Needed to link the disassembler separate from the rest of the compiler,
as in out-of-tree pandecode builds. Which I haven't done for Midgard in
well over a year, enough time for this to bit rot.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14185>

2 years agointel/compiler: Assert that unsupported tg4 offsets were lowered for XeHP
Rafael Antognolli [Fri, 12 Oct 2018 22:50:04 +0000 (15:50 -0700)]
intel/compiler: Assert that unsupported tg4 offsets were lowered for XeHP

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14142>

2 years agointel/compiler: Use nir_lower_tex_options::lower_offset_filter for tg4 on XeHP
Jordan Justen [Thu, 9 Dec 2021 21:05:29 +0000 (13:05 -0800)]
intel/compiler: Use nir_lower_tex_options::lower_offset_filter for tg4 on XeHP

Based on Rafael's:
 * "nir/lower_tex: Add option to lower offset for tg4 too."
 * "intel/compiler: Lower offsets for tg4 on gen9+."
 * "WIP: Do not lower basic offsets."
 * "WIP: intel/compiler: Enable lowering offsets restriction."

But, with these changes:
 * Fixed range checking to be signed 4 bits
 * Converted to filter
 * Apply only to gfx12.5+
 * Use nir_src_is_const / nir_src_comp_as_int (s-b Jason)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14142>

2 years agonir/lower_tex: Add filter for tex offset lowering
Jordan Justen [Thu, 9 Dec 2021 20:55:21 +0000 (12:55 -0800)]
nir/lower_tex: Add filter for tex offset lowering

Rework:
 * Add callback_data (s-b Jason)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14142>

2 years agoiris: Align buffer VMA to 2MiB for XeHP
Jordan Justen [Thu, 3 Dec 2020 23:38:59 +0000 (15:38 -0800)]
iris: Align buffer VMA to 2MiB for XeHP

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14155>

2 years agoanv: Align buffer VMA to 2MiB for XeHP
Jordan Justen [Wed, 9 Dec 2020 22:24:14 +0000 (14:24 -0800)]
anv: Align buffer VMA to 2MiB for XeHP

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14155>

2 years agoiris: Not all gfx12+ have aux_map_ctx
Jordan Justen [Mon, 1 Feb 2021 21:23:10 +0000 (13:23 -0800)]
iris: Not all gfx12+ have aux_map_ctx

This code matches other similar cases in iris.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14152>

2 years agoglapi: Never use dllimport/dllexport for TLS vars on Windows
Jesse Natalie [Sat, 11 Dec 2021 00:54:08 +0000 (16:54 -0800)]
glapi: Never use dllimport/dllexport for TLS vars on Windows

Fixes: c691149f ("win32: Fixes thread local on win32 with clang/mingw")
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14162>

2 years agoradv,aco: don't lower some ffma instructions
Rhys Perry [Tue, 16 Jun 2020 13:34:05 +0000 (14:34 +0100)]
radv,aco: don't lower some ffma instructions

GFX10.3 has no v_mad_f32 and we can't recombine exact ffma into a
v_fma_f32 if they're split. GFX9+ only has v_fma_f16 and no generation has
a 64-bit MAD.

fossil-db (GFX10.3):
Totals from 84040 (57.46% of 146267) affected shaders:
VGPRs: 3717256 -> 3688064 (-0.79%); split: -0.87%, +0.08%
SpillSGPRs: 10419 -> 10403 (-0.15%)
CodeSize: 263064884 -> 262442820 (-0.24%); split: -0.31%, +0.07%
MaxWaves: 2036908 -> 2038374 (+0.07%); split: +0.10%, -0.03%
Instrs: 49849448 -> 49572182 (-0.56%); split: -0.60%, +0.04%
Latency: 908130602 -> 907764246 (-0.04%); split: -0.18%, +0.14%
InvThroughput: 207051300 -> 206762704 (-0.14%); split: -0.24%, +0.10%

fossil-db (GFX10):
Totals from 2 (0.00% of 146267) affected shaders:
Latency: 8123 -> 8107 (-0.20%)

fossil-db (GFX9):
Totals from 2 (0.00% of 146401) affected shaders:
(no statistics affected)

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9805>

2 years agoradv,aco: implement nir_op_ffma
Rhys Perry [Wed, 24 Mar 2021 17:17:38 +0000 (17:17 +0000)]
radv,aco: implement nir_op_ffma

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9805>

2 years agoaco: swap multiplication operands if needed to create v_fmac_f32/etc
Rhys Perry [Wed, 13 Jan 2021 16:35:01 +0000 (16:35 +0000)]
aco: swap multiplication operands if needed to create v_fmac_f32/etc

For v_pk_fma_f32 and v_fma_f32 from nir_op_ffma, we don't try to put
scalars in the first operand.

No fossil-db changes.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9805>

2 years agoaco: swap operands if necessary to create v_madak/v_fmaak
Rhys Perry [Thu, 13 May 2021 12:34:52 +0000 (13:34 +0100)]
aco: swap operands if necessary to create v_madak/v_fmaak

Also rewrite the check_literal logic to be more straightforward.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9805>

2 years agoaco: create v_fmamk_f32/v_fmaak_f32 from nir_op_ffma
Rhys Perry [Tue, 16 Jun 2020 17:04:21 +0000 (18:04 +0100)]
aco: create v_fmamk_f32/v_fmaak_f32 from nir_op_ffma

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9805>

2 years agoaco: use more predictable tiebreaker when forming MADs
Rhys Perry [Thu, 18 Mar 2021 11:33:41 +0000 (11:33 +0000)]
aco: use more predictable tiebreaker when forming MADs

fossil-db (GFX10.3):
Totals from 84981 (58.10% of 146267) affected shaders:
VGPRs: 3829896 -> 3820480 (-0.25%); split: -0.33%, +0.08%
CodeSize: 270860472 -> 270850132 (-0.00%); split: -0.08%, +0.08%
MaxWaves: 2035822 -> 2042516 (+0.33%); split: +0.39%, -0.06%
Instrs: 51285526 -> 51308869 (+0.05%); split: -0.03%, +0.08%
Latency: 931503706 -> 932556231 (+0.11%); split: -0.19%, +0.30%
InvThroughput: 217084232 -> 217070849 (-0.01%); split: -0.12%, +0.11%

fossil-db (GFX10):
Totals from 85520 (58.47% of 146267) affected shaders:
VGPRs: 3729132 -> 3725344 (-0.10%); split: -0.21%, +0.10%
CodeSize: 272796500 -> 272783084 (-0.00%); split: -0.09%, +0.08%
MaxWaves: 2246410 -> 2249012 (+0.12%); split: +0.17%, -0.05%
Instrs: 51643962 -> 51664865 (+0.04%); split: -0.04%, +0.08%
Latency: 932331949 -> 933274979 (+0.10%); split: -0.19%, +0.29%
InvThroughput: 214187040 -> 214130994 (-0.03%); split: -0.13%, +0.11%

fossil-db (GFX9):
Totals from 84619 (57.80% of 146401) affected shaders:
SGPRs: 5366240 -> 5366944 (+0.01%); split: -0.09%, +0.10%
VGPRs: 3765608 -> 3764972 (-0.02%); split: -0.23%, +0.22%
CodeSize: 263634732 -> 263616320 (-0.01%); split: -0.08%, +0.08%
MaxWaves: 546617 -> 547091 (+0.09%); split: +0.18%, -0.09%
Instrs: 51426195 -> 51458334 (+0.06%); split: -0.03%, +0.10%
Latency: 1164445660 -> 1161923480 (-0.22%); split: -0.46%, +0.24%
InvThroughput: 542964697 -> 542329595 (-0.12%); split: -0.26%, +0.14%

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9805>

2 years agoradv: ignore dynamic inheritance if the render pass isn't NULL
Samuel Pitoiset [Tue, 7 Dec 2021 13:44:38 +0000 (14:44 +0100)]
radv: ignore dynamic inheritance if the render pass isn't NULL

From the Vulkan spec:

    "If the pNext chain of VkCommandBufferInheritanceInfo includes a
     VkCommandBufferInheritanceRenderingInfoKHR structure, then that
     structure controls parameters of dynamic render pass instances
     that the VkCommandBuffer can be executed within. If
     VkCommandBufferInheritanceInfo::renderPass is not VK_NULL_HANDLE,
     or VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT is not
     specified in VkCommandBufferBeginInfo::flags, parameters of this
     structure are ignored."

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14109>

2 years agoradv: fix dynamic rendering inheritance if the subpass index isn't 0
Samuel Pitoiset [Tue, 7 Dec 2021 13:33:09 +0000 (14:33 +0100)]
radv: fix dynamic rendering inheritance if the subpass index isn't 0

The driver will always create only one subpass in the render pass
for inheritance but the subpass index isn't always zero.

This fixes dEQP-VK.multiview.dynamic_rendering.secondary_cmd_buffer*.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14109>

2 years agoradv: enable lower_lod_zero_width
Samuel Pitoiset [Fri, 10 Dec 2021 12:47:44 +0000 (13:47 +0100)]
radv: enable lower_lod_zero_width

This fixes dEQP-VK.glsl.texture_functions.query.texturequerylod.*.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14147>

2 years agonir/lower_tex: add lower_lod_zero_width
Samuel Pitoiset [Fri, 10 Dec 2021 12:45:36 +0000 (13:45 +0100)]
nir/lower_tex: add lower_lod_zero_width

On AMD, the hardware will return 0 for the raw LOD if the sum of the
absolute values of derivatives is 0 but Vulkan expects the value to
be in the [-inf, -22.0f] range.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14147>

2 years agoradeonsi: use max_zplanes after the last write
Pierre-Eric Pelloux-Prayer [Mon, 6 Dec 2021 20:15:33 +0000 (21:15 +0100)]
radeonsi: use max_zplanes after the last write

Fixes: c0f723ce2b8 ("radeonsi: allow and finish TC-compatible MSAA HTILE")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14089>

2 years agoradeonsi: silence a warning
Pierre-Eric Pelloux-Prayer [Mon, 6 Dec 2021 20:13:08 +0000 (21:13 +0100)]
radeonsi: silence a warning

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14089>

2 years agoradeonsi: fix fast clear / depth decompression corruption
Pierre-Eric Pelloux-Prayer [Thu, 2 Dec 2021 10:56:41 +0000 (11:56 +0100)]
radeonsi: fix fast clear / depth decompression corruption

Insert a flush after a depth decompression pass if the texture
was fast cleared.
This fixes a corruption which seems to only affect gfx10.3 chips.

Ideally we should also clear tex->need_flush_after_depth_decompression
after a flush but there's no easy way for this so this commit will
introduce extra flushes.

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14089>

2 years agonir: limit lower_clip_cull_distance_arrays input to traditional stages
Marcin Ślusarz [Wed, 24 Nov 2021 11:38:07 +0000 (12:38 +0100)]
nir: limit lower_clip_cull_distance_arrays input to traditional stages

Compute, task, mesh & raytracing stages don't support
ClipDistance/CullDistance as input.

This change is not needed for correctness. Just something I stumbled on.

Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14149>

2 years agov3dv: Fix V3DV_HAS_SURFACE preprocessor condition
Roman Stratiienko [Fri, 10 Dec 2021 09:08:21 +0000 (11:08 +0200)]
v3dv: Fix V3DV_HAS_SURFACE preprocessor condition

Currently V3DV_HAS_SURFACE is always defined.
There is no WSI for Android in mesa3d, therefore WSI related extensions
should not be exposed.

1. Define V3DV_HAS_SURFACE only for platforms which has WSI implemented.
2. Rename V3DV_HAS_SURFACE -> V3DV_USE_WSI_PLATFORM to align naming
with other platforms.

Fixes dEQP-VK.wsi.android.surface#query_protected_capabilities

Fixes: 79e445143054 ("v3dv: move extensions table to v3dv_device")
Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14144>

2 years agointel/compiler: Use a struct for brw_compile_bs parameters
Caio Oliveira [Wed, 24 Mar 2021 04:21:40 +0000 (21:21 -0700)]
intel/compiler: Use a struct for brw_compile_bs parameters

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14139>

2 years agointel/compiler: Use a struct for brw_compile_gs parameters
Caio Oliveira [Tue, 23 Mar 2021 22:19:05 +0000 (15:19 -0700)]
intel/compiler: Use a struct for brw_compile_gs parameters

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14139>

2 years agointel/compiler: Use a struct for brw_compile_tes parameters
Caio Oliveira [Tue, 23 Mar 2021 22:03:50 +0000 (15:03 -0700)]
intel/compiler: Use a struct for brw_compile_tes parameters

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14139>

2 years agointel/compiler: Use a struct for brw_compile_tcs parameters
Caio Oliveira [Tue, 23 Mar 2021 21:34:23 +0000 (14:34 -0700)]
intel/compiler: Use a struct for brw_compile_tcs parameters

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14139>

2 years agocrocus: cleanup bo exports for external objects
Dave Airlie [Mon, 13 Dec 2021 00:21:47 +0000 (10:21 +1000)]
crocus: cleanup bo exports for external objects

This might have led to a leak in firefox/webrender/webgl scenarios

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Fixes: f3630548f1da ("crocus: initial gallium driver for Intel gfx 4-7")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14167>

2 years agoradeonsi: unroll loops of up to 128 iterations
Marek Olšák [Sun, 28 Nov 2021 09:55:47 +0000 (04:55 -0500)]
radeonsi: unroll loops of up to 128 iterations

It's not exactly 128 because longer loop bodies scale the number down.

This improves perf for VP13/Creo and Piano. Most other tests either didn't
show any difference or are CPU-bound.

v2:
- The lowering passes had to be moved to the optimization loop because unrolling creates lowerable variables.
- Piano has some pattern that looks like corruption and the pattern changed with loop unrolling.
  The pattern is present on other drivers as well.

v3:
- I removed the Piano test from CI traces because the image is random. The output was wrong even before
  this MR, and now it's randomly wrong.

|   PERCENTAGE DELTAS    |  Shaders |    SGPRs |    VGPRs |SpillSGPR |SpillVGPR | PrivVGPR |  Scratch | CodeSize | MaxWaves |
|------------------------|----------|----------|----------|----------|----------|----------|----------|----------|----------|
| alien_isolation        |      2936|    .     |    0.02 %|    .     |    .     |    .     |    .     |    0.83 %|    .     |
| deadcore               |        76|   18.47 %|    .     |    .     |    .     |    .     |    .     |  167.69 %|    .     |
| deus_ex_mankind_div..  |      1410|    0.10 %|    0.15 %|    .     |    .     |    .     |    .     |    1.70 %|    .     |
| f1-2015                |       775|    0.37 %|    0.16 %|    .     |    .     |    .     |    .     |    3.25 %|   -0.07 %|
| hitman                 |      1413|    0.10 %|   -0.03 %|    6.45 %|    .     |    .     |    .     |    0.61 %|    0.03 %|
| metro_2033_redux       |      2670|    .     |    .     |    .     |    .     |    .     |    .     |    0.13 %|    0.01 %|
| pixmark-piano-0.7.0    |         2|    .     |   14.29 %| -100.00 %|    .     |    .     |    .     |   78.07 %|   -4.76 %|
| reflections_subway     |        98|   -0.53 %|    .     |    .     |    .     |    .     |    .     |    7.64 %|    .     |
| thea                   |       172|    0.12 %|   -0.81 %|    .     |    .     |    .     |    .     |    0.65 %|    0.15 %|
| ubershaders            |        54|    .     |    .     |    .     |    .     |    .     |    .     |   61.13 %|    .     |
| ue4_effects_cave       |       290|    0.05 %|    .     |    .     |    .     |    .     |    .     |    2.62 %|    .     |
| vp13-creo              |        26|   -3.38 %|   -4.20 %|    .     |    .     |    .     |    .     |   88.56 %|    2.62 %|
| vp13-sw                |       100|   -0.36 %|   -9.14 %|    .     | -100.00 %|    .     | -100.00 %|  -17.97 %|    0.39 %|
| vp20-creo              |        22|   -0.82 %|   -3.33 %|    .     |    .     |    .     |    .     |   81.59 %|    1.51 %|
| vp20-sw                |       296|   -4.51 %|   -0.63 %|    .     |    .     |    .     |    .     |   58.93 %|    0.20 %|
|------------------------|----------|----------|----------|----------|----------|----------|----------|----------|----------|
| All affected           |       189|    3.05 %|   -2.87 %|  500.00 %| -100.00 %|    .     | -100.00 %|  135.61 %|    1.32 %|
|------------------------|----------|----------|----------|----------|----------|----------|----------|----------|----------|
| Total                  |     57794|    0.01 %|   -0.02 %|    0.27 %|   -3.13 %|    .     |   -2.89 %|    1.73 %|    .     |

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> (v1)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13966>