mesa.git
5 years agoturnip: preliminary support for tu_BindImageMemory2
Chia-I Wu [Thu, 10 Jan 2019 19:51:39 +0000 (11:51 -0800)]
turnip: preliminary support for tu_BindImageMemory2

5 years agoturnip: add cmdbuf->bo_list to bo_list in queue submit
Chia-I Wu [Thu, 17 Jan 2019 19:15:39 +0000 (11:15 -0800)]
turnip: add cmdbuf->bo_list to bo_list in queue submit

5 years agoturnip: add tu_bo_list_merge
Chia-I Wu [Thu, 17 Jan 2019 19:15:21 +0000 (11:15 -0800)]
turnip: add tu_bo_list_merge

tu_bo_list_merge adds an entire list to the current list.

5 years agoturnip: build drm_msm_gem_submit_bo array directly
Chia-I Wu [Thu, 17 Jan 2019 18:23:19 +0000 (10:23 -0800)]
turnip: build drm_msm_gem_submit_bo array directly

Build drm_msm_gem_submit_bo array directly in tu_bo_list.  We might
change this again, but this is good enough for now.

There are other issues as well, such as not using
VkAllocationCallbacks and sloppy error checking.  We should revisit
this in the near future.  Same to tu_cs.

5 years agoturnip: add more tu_cs helpers
Chia-I Wu [Wed, 16 Jan 2019 22:40:37 +0000 (14:40 -0800)]
turnip: add more tu_cs helpers

5 years agoturnip: inline tu_cs_check_space
Chia-I Wu [Wed, 16 Jan 2019 22:12:53 +0000 (14:12 -0800)]
turnip: inline tu_cs_check_space

This allows the fast path (size check) to be inlined.

5 years agoturnip: update cs->start in tu_cs_end
Chia-I Wu [Wed, 16 Jan 2019 22:05:55 +0000 (14:05 -0800)]
turnip: update cs->start in tu_cs_end

This allows us to assert that there is no dangling command in
tu_cs_begin, rather than discarding them silently.

5 years agoturnip: minor cleanup to tu_cs_end
Chia-I Wu [Wed, 16 Jan 2019 22:00:43 +0000 (14:00 -0800)]
turnip: minor cleanup to tu_cs_end

Add comments and error checking.

5 years agoturnip: add tu_cs_add_bo
Chia-I Wu [Wed, 16 Jan 2019 19:17:26 +0000 (11:17 -0800)]
turnip: add tu_cs_add_bo

Refactor BO allocation code out of tu_cs_begin.  Add error checking.

5 years agoturnip: document tu_cs
Chia-I Wu [Wed, 16 Jan 2019 18:20:33 +0000 (10:20 -0800)]
turnip: document tu_cs

5 years agoturnip: run sed and clang-format on tu_cs
Chia-I Wu [Wed, 16 Jan 2019 18:03:02 +0000 (10:03 -0800)]
turnip: run sed and clang-format on tu_cs

5 years agoturnip: Only get bo offset when we need to mmap
Kristian H. Kristensen [Wed, 16 Jan 2019 19:02:38 +0000 (11:02 -0800)]
turnip: Only get bo offset when we need to mmap

The offset we get from MSM_INFO_GET_OFFSET is an offset into the drm fd
for the purpose of mmaping the buffer.

5 years agoturnip: Move stream functions to tu_cs.c
Bas Nieuwenhuizen [Wed, 16 Jan 2019 17:27:04 +0000 (18:27 +0100)]
turnip: Move stream functions to tu_cs.c

5 years agoturnip: Add emit functions in a header.
Bas Nieuwenhuizen [Tue, 15 Jan 2019 21:18:15 +0000 (22:18 +0100)]
turnip: Add emit functions in a header.

This adds a radv-style check_space functions + emit functions.

Also puts them in a header as a bunch of inlines, so

(1) we can use them from meta code.
(2) they are inline for performance as these are common and small.

Did not put them in tu_private.h as a bunch of inlines only
clutters up that huge headerfile.

Precise error propagation for memory allocation failures is still
todo.

5 years agoturnip: preliminary support for tu_QueueWaitIdle
Chia-I Wu [Thu, 10 Jan 2019 22:07:50 +0000 (14:07 -0800)]
turnip: preliminary support for tu_QueueWaitIdle

This creates a new fd on each queue submit.  I do not go with
DRM_IOCTL_MSM_WAIT_FENCE solely because the path is marked legacy.
Otherwise, we can use the  fence id rather than requesting a fence
fd until external fences are supported and enabled.

5 years agoturnip: constify tu_device in tu_gem_*
Chia-I Wu [Fri, 11 Jan 2019 18:55:15 +0000 (10:55 -0800)]
turnip: constify tu_device in tu_gem_*

5 years agoturnip: add wrappers around DRM_MSM_SUBMITQUEUE_*
Chia-I Wu [Thu, 10 Jan 2019 23:34:44 +0000 (15:34 -0800)]
turnip: add wrappers around DRM_MSM_SUBMITQUEUE_*

Add tu_drm_submitqueue_new and tu_drm_submitqueue_close.

5 years agoturnip: add wrappers around DRM_MSM_GET_PARAM
Chia-I Wu [Thu, 10 Jan 2019 23:27:28 +0000 (15:27 -0800)]
turnip: add wrappers around DRM_MSM_GET_PARAM

Add tu_drm_get_gpu_id and tu_drm_get_gmem_size.

5 years agoturnip: remove unnecessary libfreedreno_drm dep
Chia-I Wu [Fri, 11 Jan 2019 18:09:53 +0000 (10:09 -0800)]
turnip: remove unnecessary libfreedreno_drm dep

Remove libfreedreno_drm dep and unused fd_device.

5 years agoturnip: use msm_drm.h from inc_freedreno
Chia-I Wu [Fri, 11 Jan 2019 18:03:51 +0000 (10:03 -0800)]
turnip: use msm_drm.h from inc_freedreno

The recent change to msm_drm.h changed the APIs in an incompatible
way.

5 years agoturnip: Shorten primary_cmd_stream name.
Bas Nieuwenhuizen [Thu, 10 Jan 2019 21:07:04 +0000 (22:07 +0100)]
turnip: Shorten primary_cmd_stream name.

It really is too long.

5 years agoturnip: Fill command buffer
Bas Nieuwenhuizen [Thu, 10 Jan 2019 20:39:14 +0000 (21:39 +0100)]
turnip: Fill command buffer

5 years agoturnip: Implement submission.
Bas Nieuwenhuizen [Thu, 10 Jan 2019 20:25:20 +0000 (21:25 +0100)]
turnip: Implement submission.

5 years agoturnip: Make bo_list functions not static
Bas Nieuwenhuizen [Thu, 10 Jan 2019 20:20:35 +0000 (21:20 +0100)]
turnip: Make bo_list functions not static

5 years agoturnip: Add msm queue support.
Bas Nieuwenhuizen [Thu, 10 Jan 2019 20:12:38 +0000 (21:12 +0100)]
turnip: Add msm queue support.

5 years agoturnip: Add a command stream.
Bas Nieuwenhuizen [Mon, 31 Dec 2018 13:15:30 +0000 (14:15 +0100)]
turnip: Add a command stream.

5 years agoturnip: Implement a slow bo list
Bas Nieuwenhuizen [Mon, 31 Dec 2018 10:34:32 +0000 (11:34 +0100)]
turnip: Implement a slow bo list

5 years agoturnip: Implement some UUIDs.
Bas Nieuwenhuizen [Mon, 31 Dec 2018 10:08:45 +0000 (11:08 +0100)]
turnip: Implement some UUIDs.

5 years agoturnip: clean up TODO.
Bas Nieuwenhuizen [Fri, 28 Dec 2018 16:27:12 +0000 (17:27 +0100)]
turnip: clean up TODO.

./deqp-vk -n dEQP-VK.info.*
Writing test log into TestResults.qpa
dEQP Core unknown (0xcafebabe) starting..
  target implementation = 'Surfaceless'
WARNING: tu is not a conformant vulkan implementation, testing use only.
WARNING: tu is not a conformant vulkan implementation, testing use only.

Test case 'dEQP-VK.info.build'..
  Pass (Not validated)

Test case 'dEQP-VK.info.device'..
  Pass (Not validated)

Test case 'dEQP-VK.info.platform'..
  Pass (Not validated)

Test case 'dEQP-VK.info.memory_limits'..
  Pass (Pass)

DONE!

Test run totals:
  Passed:        4/4 (100.0%)
  Failed:        0/4 (0.0%)
  Not supported: 0/4 (0.0%)
  Warnings:      0/4 (0.0%)

5 years agoturnip: Remove some radv leftovers.
Bas Nieuwenhuizen [Fri, 28 Dec 2018 16:25:17 +0000 (17:25 +0100)]
turnip: Remove some radv leftovers.

5 years agoturnip: Implement some format properties for RGBA8.
Bas Nieuwenhuizen [Fri, 28 Dec 2018 15:27:24 +0000 (16:27 +0100)]
turnip: Implement some format properties for RGBA8.

Just to get some tests to not skip. This is neither complete
nor completely correct.

5 years agoturnip: add .clang-format
Chia-I Wu [Wed, 9 Jan 2019 22:16:01 +0000 (14:16 -0800)]
turnip: add .clang-format

Add and apply .clang-format.

5 years agoturnip: Implement pipe-less param query.
Bas Nieuwenhuizen [Fri, 21 Dec 2018 13:49:30 +0000 (14:49 +0100)]
turnip: Implement pipe-less param query.

5 years agoturnip: move tu_gem.c to tu_drm.c
Bas Nieuwenhuizen [Fri, 21 Dec 2018 13:12:17 +0000 (14:12 +0100)]
turnip: move tu_gem.c to tu_drm.c

5 years agoturnip: Stop hardcoding the msm version check.
Bas Nieuwenhuizen [Fri, 21 Dec 2018 12:46:06 +0000 (13:46 +0100)]
turnip: Stop hardcoding the msm version check.

5 years agoturnip: Add image layout calculations.
Bas Nieuwenhuizen [Fri, 21 Dec 2018 11:50:55 +0000 (12:50 +0100)]
turnip: Add image layout calculations.

5 years agoturnip: Fix memory mapping.
Bas Nieuwenhuizen [Thu, 20 Dec 2018 23:54:15 +0000 (00:54 +0100)]
turnip: Fix memory mapping.

5 years agoturnip: Fix bo allocation after we stopped using libdrm_freedreno ...
Bas Nieuwenhuizen [Thu, 20 Dec 2018 21:57:07 +0000 (22:57 +0100)]
turnip: Fix bo allocation after we stopped using libdrm_freedreno ...

Al this figuring out new errors is why I don't like reinventing the
wheel.

5 years agoturnip: Add 630 to the list.
Bas Nieuwenhuizen [Thu, 20 Dec 2018 17:08:49 +0000 (18:08 +0100)]
turnip: Add 630 to the list.

5 years agoturnip: Don't return from tu_stub funcs
Chad Versace [Mon, 12 Nov 2018 22:45:47 +0000 (14:45 -0800)]
turnip: Don't return from tu_stub funcs

Since the macros are lowercase and look like normal functions, that they
change control flow with a hidden return is surprising.

5 years agoturnip: Fix 'unused' warnings
Chad Versace [Mon, 12 Nov 2018 22:42:36 +0000 (14:42 -0800)]
turnip: Fix 'unused' warnings

Now turnip builds without warnings on my machine.

5 years agoturnip: Add TODO file
Chad Versace [Mon, 12 Nov 2018 22:28:58 +0000 (14:28 -0800)]
turnip: Add TODO file

5 years agoturnip: Replace fd_bo with tu_bo
Chad Versace [Wed, 7 Nov 2018 04:26:45 +0000 (21:26 -0700)]
turnip: Replace fd_bo with tu_bo

(olv, after rebase) remove inc_drm_uapi

5 years agoturnip: Use vk_errorf() for initialization error messages
Chad Versace [Mon, 12 Nov 2018 22:21:45 +0000 (14:21 -0800)]
turnip: Use vk_errorf() for initialization error messages

This small cleanup better prepares turnip for VK_EXT_debug_report.

5 years agoturnip: Add TODO for Android logging
Chad Versace [Mon, 12 Nov 2018 22:23:42 +0000 (14:23 -0800)]
turnip: Add TODO for Android logging

5 years agoturnip: Require DRM device version >= 1.3
Chad Versace [Mon, 12 Nov 2018 22:13:13 +0000 (14:13 -0800)]
turnip: Require DRM device version >= 1.3

Because the driver will require support for iova.

5 years agoturnip: Fix indentation
Chad Versace [Wed, 7 Nov 2018 05:14:04 +0000 (22:14 -0700)]
turnip: Fix indentation

5 years agoturnip: Fix a real -Wmaybe-uninitialized
Chad Versace [Wed, 7 Nov 2018 07:17:30 +0000 (00:17 -0700)]
turnip: Fix a real -Wmaybe-uninitialized

5 years agoturnip: Use vk_outarray in all relevant public functions
Chad Versace [Wed, 7 Nov 2018 06:51:05 +0000 (23:51 -0700)]
turnip: Use vk_outarray in all relevant public functions

5 years agoturnip: Fix result of vkEnumerate*ExtensionProperties
Chad Versace [Wed, 7 Nov 2018 07:01:03 +0000 (00:01 -0700)]
turnip: Fix result of vkEnumerate*ExtensionProperties

Given an unsupported layer name, the functions must return
VK_ERROR_LAYER_NOT_PRESENT.

5 years agoturnip: Fix result of vkEnumerate*LayerProperties
Chad Versace [Wed, 7 Nov 2018 06:52:57 +0000 (23:52 -0700)]
turnip: Fix result of vkEnumerate*LayerProperties

The functions must not return VK_ERROR_LAYER_NOT_PRESENT. The spec
reserves that error for vkEnumerate*ExtensionProperties.

5 years agoturnip: Fix indentation in function signatures
Chad Versace [Mon, 5 Nov 2018 06:42:55 +0000 (23:42 -0700)]
turnip: Fix indentation in function signatures

Due to s/anv/tu/, in many function signatures the indentation of
parameters was off-by-one.

5 years agoturnip: Disable more features.
Bas Nieuwenhuizen [Fri, 17 Aug 2018 12:48:46 +0000 (14:48 +0200)]
turnip: Disable more features.

5 years agoturnip: Initialize memory type in requirements.
Bas Nieuwenhuizen [Fri, 17 Aug 2018 12:43:01 +0000 (14:43 +0200)]
turnip: Initialize memory type in requirements.

5 years agoturnip: Cargo cult the Intel heap size functionality.
Bas Nieuwenhuizen [Fri, 17 Aug 2018 12:35:59 +0000 (14:35 +0200)]
turnip: Cargo cult the Intel heap size functionality.

5 years agoturnip: Report a memory type and heap.
Bas Nieuwenhuizen [Fri, 10 Aug 2018 11:30:08 +0000 (13:30 +0200)]
turnip: Report a memory type and heap.

5 years agoturnip: Add buffer allocation & mapping support.
Bas Nieuwenhuizen [Fri, 10 Aug 2018 11:19:22 +0000 (13:19 +0200)]
turnip: Add buffer allocation & mapping support.

5 years agoturnip: Fix newly introduced warning.
Bas Nieuwenhuizen [Thu, 9 Aug 2018 18:45:49 +0000 (20:45 +0200)]
turnip: Fix newly introduced warning.

5 years agoturnip: Remove abort.
Bas Nieuwenhuizen [Thu, 9 Aug 2018 09:14:33 +0000 (11:14 +0200)]
turnip: Remove abort.

5 years agoturnip: Gather some device info.
Bas Nieuwenhuizen [Thu, 9 Aug 2018 09:09:01 +0000 (11:09 +0200)]
turnip: Gather some device info.

5 years agoturnip: Fix up detection of device.
Bas Nieuwenhuizen [Thu, 9 Aug 2018 08:36:06 +0000 (10:36 +0200)]
turnip: Fix up detection of device.

5 years agoturnip: Drop Makefile.am and Android.mk
Chad Versace [Mon, 5 Nov 2018 06:27:54 +0000 (22:27 -0800)]
turnip: Drop Makefile.am and Android.mk

The Makefile.am doesn't work. I tried fixing it but gave up because
I don't understand Autotools. I strongly suspect the Android.mk also
doesn't work.

Rather than maintain the broken build files, let's delete them and
re-add working build files if-and-when we need them. (Maybe we'll be
lucky and turnip will never need to support Autotools!).

5 years agoturnip: Add driver skeleton (v2)
Bas Nieuwenhuizen [Wed, 8 Aug 2018 22:23:57 +0000 (22:23 +0000)]
turnip: Add driver skeleton (v2)

meson files have been updated, autotools and android still need
updating.

Only build tested.

v2 (chadv):
  - Rebase onto master.
  - Fix build breakage in Python scripts.
  - Drop the WSI code. The internal WSI apis have changed recently, and
    will likely change again before the driver goes upstream. To avoid
    unnecessary rebase work, let's drop the WSI code and re-add it when
    we're ready to really use WSI.

(olv, after rebase) do not enable freedreno by default on ARM

5 years agonir/serialize: Prevent writing uninitialized state_slot data
Connor Abbott [Fri, 8 Mar 2019 12:05:53 +0000 (13:05 +0100)]
nir/serialize: Prevent writing uninitialized state_slot data

The nir_state_slot struct had some padding that was never initialized.
Serializing the individual parts of the struct is more robust and avoids
the overhead of zeroing it at creation, so just do that.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoanv: release memory allocated by glsl types during spirv_to_nir
Tapani Pälli [Mon, 11 Mar 2019 09:30:01 +0000 (11:30 +0200)]
anv: release memory allocated by glsl types during spirv_to_nir

Fixes leaks for each glsl_type generated:

  ==32470== 384 bytes in 3 blocks are possibly lost in loss record 18 of 18
  ==32470==    at 0x483880B: malloc (vg_replace_malloc.c:309)
  ==32470==    by 0x4C43F4A: ralloc_size (ralloc.c:119)
  ==32470==    by 0x4C44014: rzalloc_size (ralloc.c:151)
  ==32470==    by 0x4C44258: rzalloc_array_size (ralloc.c:215)
  ==32470==    by 0x4D38957: glsl_type::glsl_type(glsl_struct_field const*, unsigned int, char const*) (glsl_types.cpp:114)
  ==32470==    by 0x4D3BEED: glsl_type::get_struct_instance(glsl_struct_field const*, unsigned int, char const*) (glsl_types.cpp:1146)
  ==32470==    by 0x4D42ECC: glsl_struct_type (nir_types.cpp:501)
  ==32470==    by 0x4CDB5A1: vtn_handle_type (spirv_to_nir.c:1269)
  ==32470==    by 0x4CE53DD: vtn_handle_variable_or_type_instruction (spirv_to_nir.c:4018)
  ==32470==    by 0x4CD8CFF: vtn_foreach_instruction (spirv_to_nir.c:365)
  ==32470==    by 0x4CE5E6B: spirv_to_nir (spirv_to_nir.c:4490)
  ==32470==    by 0x497AF10: anv_shader_compile_to_nir (anv_pipeline.c:173)

v2: move release call to vkDestroyInstance

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agowsi/x11: use WSI_FROM_HANDLE() instead of pointer casts
Eric Engestrom [Sun, 25 Nov 2018 15:15:09 +0000 (15:15 +0000)]
wsi/x11: use WSI_FROM_HANDLE() instead of pointer casts

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
5 years agowsi/wayland: fix pointer casting warning on 32bit
Eric Engestrom [Sun, 28 Oct 2018 13:40:12 +0000 (13:40 +0000)]
wsi/wayland: fix pointer casting warning on 32bit

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
5 years agowsi/display: s/#if/#ifdef/ to fix -Wundef
Eric Engestrom [Sun, 28 Oct 2018 13:39:30 +0000 (13:39 +0000)]
wsi/display: s/#if/#ifdef/ to fix -Wundef

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
5 years agowsi: deduplicate get_current_time() functions between display and x11
Eric Engestrom [Sun, 28 Oct 2018 13:37:26 +0000 (13:37 +0000)]
wsi: deduplicate get_current_time() functions between display and x11

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
5 years agoanv: release memory allocated by bo_heap when descriptor pool is destroyed
Tapani Pälli [Fri, 8 Mar 2019 08:29:26 +0000 (10:29 +0200)]
anv: release memory allocated by bo_heap when descriptor pool is destroyed

Fixes following leak:

   ==21853== 32 bytes in 1 blocks are definitely lost in loss record 2 of 20
   ==21853==    at 0x483AB1A: calloc (vg_replace_malloc.c:762)
   ==21853==    by 0x4C4DD7F: util_vma_heap_free (vma.c:221)
   ==21853==    by 0x4C4D647: util_vma_heap_init (vma.c:46)
   ==21853==    by 0x4957B9F: anv_CreateDescriptorPool (anv_descriptor_set.c:578)

Fixes: c520f4dec9cb ("anv: Add a concept of a descriptor buffer")
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoanv: destroy descriptor sets when pool gets destroyed
Tapani Pälli [Mon, 4 Mar 2019 12:22:36 +0000 (14:22 +0200)]
anv: destroy descriptor sets when pool gets destroyed

Patch maintains a list of sets in the pool and destroys possible
remaining sets when pool is destroyed.

As stated in Vulkan spec:
   "When a pool is destroyed, all descriptor sets allocated from
    the pool are implicitly freed and become invalid."

This fixes memory leaks spotted with valgrind:

   ==19622== 96 bytes in 1 blocks are definitely lost in loss record 2 of 3
   ==19622==    at 0x483880B: malloc (vg_replace_malloc.c:309)
   ==19622==    by 0x495B67E: default_alloc_func (anv_device.c:547)
   ==19622==    by 0x4955E05: vk_alloc (vk_alloc.h:36)
   ==19622==    by 0x4956A8F: anv_multialloc_alloc (anv_private.h:538)
   ==19622==    by 0x4956A8F: anv_CreateDescriptorSetLayout (anv_descriptor_set.c:217)

Fixes: 14f6275c92f1 ("anv/descriptor_set: add reference counting for descriptor set layouts")
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoanv: add support for dumping shader info via VK_EXT_debug_report
Timothy Arceri [Mon, 18 Feb 2019 04:40:49 +0000 (15:40 +1100)]
anv: add support for dumping shader info via VK_EXT_debug_report

This information will be used by the vkpipeline-db tool.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoiris: Fix backface stencil write condition
Kenneth Graunke [Sat, 9 Mar 2019 08:25:30 +0000 (00:25 -0800)]
iris: Fix backface stencil write condition

A bit too much search and replace here.

5 years agopanfrost/drm: Cast pointer to u64 to fix warning
Alyssa Rosenzweig [Sun, 10 Mar 2019 19:16:56 +0000 (19:16 +0000)]
panfrost/drm: Cast pointer to u64 to fix warning

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
5 years agopanfrost: Add backend targeting the DRM driver
Tomeu Vizoso [Fri, 8 Mar 2019 09:27:07 +0000 (10:27 +0100)]
panfrost: Add backend targeting the DRM driver

This backend interacts with the new DRM driver for Midgard GPUs which is
currently in development.

When using this backend, Panfrost has roughly on-par functionality as
when using the non-DRM driver from Arm.

Alyssa Rosenzweig: To do so, we implement additional routines for
runtime GPU version detection and fencing. We cleanup some duplicate
code interfering with the new driver. We fix a long-standing memory leak
which is aggravated on the new driver. Finally, we implement BO
import/export in a way compatible with the new driver. These changes are
squashed to preserve bisectability given the hard-to-track ABI shifts in
the nondrm module

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
5 years agopanfrost: Add gem_handle to panfrost_memory and panfrost_bo
Tomeu Vizoso [Fri, 8 Mar 2019 09:27:06 +0000 (10:27 +0100)]
panfrost: Add gem_handle to panfrost_memory and panfrost_bo

It will be used by the DRM backend to store GEM handles from the kernel.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
5 years agofreedreno/a6xx: more bcolor fixes
Rob Clark [Sun, 10 Mar 2019 15:08:10 +0000 (11:08 -0400)]
freedreno/a6xx: more bcolor fixes

Non-zero offset wasn't working, which breaks a bunch of
dEQP-GLES31.functional.texture.border_clamp.formats.* when doing sharded
deqp runs (because order of tests changes, resulting in different
texture state bound.. deqp doesn't really clean up it's gl state between
tests very well)

Previously, if additional textures were bound, due to using too small of
a bcolor_entry size, the last 32bytes of the bcolor_entry would be
overwritten.

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agogitlab-ci: add panfrost to the gallium drivers build
Eric Engestrom [Sat, 9 Mar 2019 22:53:27 +0000 (22:53 +0000)]
gitlab-ci: add panfrost to the gallium drivers build

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
5 years agopanfrost: move #include to fix compilation
Eric Engestrom [Sat, 9 Mar 2019 22:27:51 +0000 (22:27 +0000)]
panfrost: move #include to fix compilation

In standalone.h, the struct gl_context type is not declared by #includ'ing
mtypes.h:

In file included from src/gallium/drivers/panfrost/midgard/cmdline.c:24:
src/compiler/glsl/standalone.h:46:14: warning: ‘struct gl_context’ declared inside parameter list will not be visible outside of this definition or declaration
       struct gl_context *ctx);
              ^~~~~~~~~~

This causes the following compilation failure:

src/gallium/drivers/panfrost/midgard/cmdline.c: In function ‘compile_shader’:
src/gallium/drivers/panfrost/midgard/cmdline.c:58:61: error: passing argument 4 of ‘standalone_compile_shader’ from incompatible pointer type [-Werror=incompatible-pointer-types]
         prog = standalone_compile_shader(&options, 2, argv, &local_ctx);
                                                             ^~~~~~~~~~
In file included from src/gallium/drivers/panfrost/midgard/cmdline.c:24:
src/compiler/glsl/standalone.h:43:28: note: expected ‘struct gl_context *’ but argument is of type ‘struct gl_context *’
 struct gl_shader_program * standalone_compile_shader(
                            ^~~~~~~~~~~~~~~~~~~~~~~~~

Fixes: e67e0726372ab65f4104 "panfrost: Implement Midgard shader toolchain"
Cc: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
5 years agopanfrost: fix tgsi_to_nir() call
Eric Engestrom [Sat, 9 Mar 2019 22:04:21 +0000 (22:04 +0000)]
panfrost: fix tgsi_to_nir() call

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=109945
Fixes: 7da251fc721360fc28b9 "panfrost: Check in sources for command stream"
Cc: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
5 years agoRevert "d3dadapter9: Support software renderer on any DRI device"
Axel Davy [Sat, 9 Mar 2019 13:29:07 +0000 (14:29 +0100)]
Revert "d3dadapter9: Support software renderer on any DRI device"

This reverts commit 0d0847659385e298badd6ef6ca4d0a9e537ae288.

It makes gitlab's travis fail. Revert until patch is fixed.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
5 years agost/nine: Change a few advertised caps
Axel Davy [Mon, 4 Feb 2019 23:11:46 +0000 (00:11 +0100)]
st/nine: Change a few advertised caps

Most hw on the native platform advertise these
caps this way.

D3DCAPS_READ_SCANLINE: We don't really have hardware
support for that, but many games don't even check the
flag, and expect GetRasterStatus to work, which is
why we emulated it with a timer (like wine). So we
may as well advertise the cap.
D3DCURSORCAPS_LOWRES: I don't know what is the status
of this on X11, but I don't know of any dx9 game
running at height < 400 either.
D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE: The cap should
correspond to what the current generation of hw is doing.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
5 years agost/nine: Do not advertise CANMANAGERESOURCE
Axel Davy [Mon, 4 Feb 2019 22:42:06 +0000 (23:42 +0100)]
st/nine: Do not advertise CANMANAGERESOURCE

It doesn't seem the main vendors advertise it.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
5 years agost/nine: Do not advertise support for D15S1 and D24X4S4
Axel Davy [Mon, 4 Feb 2019 21:32:45 +0000 (22:32 +0100)]
st/nine: Do not advertise support for D15S1 and D24X4S4

The former is supported on Matrox cards but no other hw.
The latter isn't supported anywhere.

It is fine to not advertise them as supported,
and it could prevent apps to trigger weird rendering paths.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agod3dadapter9: Support software renderer on any DRI device
Patrick Rudolph [Thu, 28 Feb 2019 17:13:39 +0000 (18:13 +0100)]
d3dadapter9: Support software renderer on any DRI device

If D3D_ALWAYS_SOFTWARE is set for debugging purposes,
run on any DRI enabled platform.
Instead of probing for a compatible gallium driver (which might
fail if there's none) always use the KMS DRI software renderer.

Allows to run nine on i915 when D3D_ALWAYS_SOFTWARE=1.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <davyaxel0@gmail.com>
5 years agost/nine: Disable depth write when nothing gets updated
Axel Davy [Mon, 25 Feb 2019 20:02:14 +0000 (21:02 +0100)]
st/nine: Disable depth write when nothing gets updated

I do not see any perf impact on radeonsi, but it
seems iris needs this.
It seems something sensible to do.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Andre Heider <a.heider@gmail.com>
5 years agovirgl: Return an error if we use fp64 on top of GLES
Elie Tournier [Fri, 15 Feb 2019 16:21:42 +0000 (16:21 +0000)]
virgl: Return an error if we use fp64 on top of GLES

Signed-off-by: Elie Tournier <elie.tournier@collabora.com>
Reviewed-by: <Gurchetan Singh gurchetansingh@chromium.org>
5 years agovirgl: Set PIPE_CAP_DOUBLES when running on GLES This is a lie but no known app use...
Elie Tournier [Fri, 15 Feb 2019 16:18:25 +0000 (16:18 +0000)]
virgl: Set PIPE_CAP_DOUBLES when running on GLES This is a lie but no known app use fp64.

Signed-off-by: Elie Tournier <elie.tournier@collabora.com>
Reviewed-by: <Gurchetan Singh gurchetansingh@chromium.org>
5 years agovirgl: Add a caps to advertise GLES backend
Elie Tournier [Fri, 15 Feb 2019 16:14:10 +0000 (16:14 +0000)]
virgl: Add a caps to advertise GLES backend

Signed-off-by: Elie Tournier <elie.tournier@collabora.com>
Reviewed-by: <Gurchetan Singh gurchetansingh@chromium.org>
5 years agoRevert MR 369 (Fix extract_i8 and extract_u8 for 64-bit integers)
Kenneth Graunke [Sat, 9 Mar 2019 09:39:20 +0000 (01:39 -0800)]
Revert MR 369 (Fix extract_i8 and extract_u8 for 64-bit integers)

This broke piles of image load store tests (179 failures on CI,
mesa_master build #15546, previous build right before this landed
was green).  I'd rather not leave the tree on fire over the weekend,
so let's revert for now, and we can figure out what happened next week.

5 years agonir/algebraic: Add missing 16-bit extract_[iu]8 patterns
Ian Romanick [Thu, 28 Feb 2019 04:15:32 +0000 (20:15 -0800)]
nir/algebraic: Add missing 16-bit extract_[iu]8 patterns

No shader-db changes on any Intel platform.

v2: Use a loop to generate patterns.  Suggested by Jason.

Reviewed-by: Matt Turner <mattst88@gmail.com> [v1]
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agonir/algebraic: Add missing 64-bit extract_[iu]8 patterns
Ian Romanick [Thu, 28 Feb 2019 04:12:46 +0000 (20:12 -0800)]
nir/algebraic: Add missing 64-bit extract_[iu]8 patterns

No shader-db changes on any Intel platform.

v2: Use a loop to generate patterns.  Suggested by Jason.

Reviewed-by: Matt Turner <mattst88@gmail.com> [v1]
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agonir/algebraic: Remove redundant extract_[iu]8 patterns
Ian Romanick [Thu, 28 Feb 2019 04:08:38 +0000 (20:08 -0800)]
nir/algebraic: Remove redundant extract_[iu]8 patterns

No shader-db changes on any Intel platform.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agonir/algebraic: Fix up extract_[iu]8 after loop unrolling
Ian Romanick [Thu, 28 Feb 2019 03:52:12 +0000 (19:52 -0800)]
nir/algebraic: Fix up extract_[iu]8 after loop unrolling

Skylake, Broadwell, and Haswell had similar results. (Skylake shown)
total instructions in shared programs: 15256840 -> 15256837 (<.01%)
instructions in affected programs: 4713 -> 4710 (-0.06%)
helped: 3
HURT: 0
helped stats (abs) min: 1 max: 1 x̄: 1.00 x̃: 1
helped stats (rel) min: 0.06% max: 0.08% x̄: 0.06% x̃: 0.06%

total cycles in shared programs: 372286583 -> 372286583 (0.00%)
cycles in affected programs: 198516 -> 198516 (0.00%)
helped: 1
HURT: 1
helped stats (abs) min: 10 max: 10 x̄: 10.00 x̃: 10
helped stats (rel) min: <.01% max: <.01% x̄: <.01% x̃: <.01%
HURT stats (abs)   min: 10 max: 10 x̄: 10.00 x̃: 10
HURT stats (rel)   min: 0.01% max: 0.01% x̄: 0.01% x̃: 0.01%

No changes on any other Intel platform.

v2: Use a loop to generate patterns.  Suggested by Jason.

Reviewed-by: Matt Turner <mattst88@gmail.com> [v1]
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoanv/pipeline: Move lower_explicit_io much later
Jason Ekstrand [Thu, 10 Jan 2019 19:39:05 +0000 (13:39 -0600)]
anv/pipeline: Move lower_explicit_io much later

Now that nir_opt_copy_prop_vars can properly handle array derefs on
vectors, it's safe to move UBO and SSBO lowering to late in the
pipeline.  This should allow NIR to actually start optimizing SSBO
access.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agointel/nir: Move lower_mem_access_bit_sizes to postprocess_nir
Jason Ekstrand [Sat, 12 Jan 2019 02:19:18 +0000 (20:19 -0600)]
intel/nir: Move lower_mem_access_bit_sizes to postprocess_nir

It doesn't really matter where this pass goes as long as it's after we
call nir_lower_explicit_io and before we go into the back-end.  Putting
it brw_postprocess_nir lets us move nir_lower_explicit_io significantly
later in the pipeline.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agofreedreno/ir3: turn on [iu]mul_high
Rob Clark [Fri, 8 Mar 2019 23:42:22 +0000 (18:42 -0500)]
freedreno/ir3: turn on [iu]mul_high

Which also requires uadd_carry lowering

Until recently this was lowered in glsl ir so it went unnoticed that we
weren't lowering it.

Fixes: 1d8994a63b5 glsl: [u/i]mulExtended optimization for GLSL
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agofreedreno/ir3: fix ir3_cmdline harder
Rob Clark [Fri, 8 Mar 2019 22:48:13 +0000 (17:48 -0500)]
freedreno/ir3: fix ir3_cmdline harder

Fixes: 45271702ec9 freedreno: fix ir3_cmdline build
Fixes: 7530d4abfcf glsl/freedreno/panfrost: pass gl_context to the standalone compiler
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agost/dri: Set the PIPE_BIND_SHARED flag on create_image_with_modifiers.
Eric Anholt [Wed, 6 Mar 2019 19:08:43 +0000 (11:08 -0800)]
st/dri: Set the PIPE_BIND_SHARED flag on create_image_with_modifiers.

With createImage(), the caller was expected to set a SHARED flag if they
needed the ability to get a GEM handle.  DRI3, wayland, and gbm all set
it, EGL_MESA_drm_image passes it through, and surfaceless doesn't need it
because there's no way to request a handle.

With the new createImageWithModifiers() DRI method to replace it, the
expectation is that you'll always be able to share the buffer, so the flag
is unnecessary in its arguments.  However, we do need to tell gallium
about this expectation.

Without this, kmscube's modifiers path using
gbm_bo_create_with_modifiers(&modifier, 1) instead of
gbm_bo_create(SCANOUT | SHARED) will call the driver's resource_create()
function wtih PIPE_BIND_SHARED unset, so the driver (particularly
renderonly drivers) may allocate in such a way that it can't return an
answer from gbm_bo_get_handle().  I used to have a hack in v3d using
count==1 && modifier==LINEAR to indicate that you wanted SHARED anyway,
but that was dropped recently.

Fixes: 59527a36e975 ("v3d: Restructure RO allocations using
resource_from_handle.")
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
5 years agoiris: Use copy_region and staging resources to avoid transfer stalls
Kenneth Graunke [Fri, 21 Dec 2018 11:04:18 +0000 (03:04 -0800)]
iris: Use copy_region and staging resources to avoid transfer stalls

This is similar to intel_miptree_map_blit and intel_buffer_object.c's
temporary blits in i965.

Improves performance of DiRT Rally by 20-25% by eliminating stalls.

Breaks piglit's spec/arb_shader_image_load_store/host-mem-barrier,
by using the GPU to do uploads, exposing a st/mesa issue where it
doesn't give us memory_barrier() calls.  This is a pre-existing issue
and will be fixed by a later patch (currently out for review).