mesa.git
5 years agoturnip: Fix error behavior for VkPhysicalDeviceExternalImageFormatInfo
Chad Versace [Sat, 2 Feb 2019 00:48:44 +0000 (16:48 -0800)]
turnip: Fix error behavior for VkPhysicalDeviceExternalImageFormatInfo

If the handle type is unsupported, then the spec requires us to return
VK_ERROR_FORMAT_NOT_SUPPORTED.

Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Closes: https://gitlab.freedesktop.org/bnieuwenhuizen/mesa/merge_requests/17
5 years agoturnip: add a more complete format table
Chia-I Wu [Fri, 25 Jan 2019 19:13:54 +0000 (11:13 -0800)]
turnip: add a more complete format table

A format table is an array of tu_native_format.  Table lookup is
done through array indexing.

This commit defines a single format table for core VkFormat.  It is
derived from the table in the gallium driver.  There might be errors
introduced in the process of the conversion.

When an extension that defines new VkFormat is supported, we need to
add a new table for the extension.

5 years agoturnip: preliminary support for loadOp and storeOp
Chia-I Wu [Fri, 11 Jan 2019 23:01:26 +0000 (15:01 -0800)]
turnip: preliminary support for loadOp and storeOp

 - create tile_load_ib and tile_store_ib at the beginning of each
   subpass
 - execute the IBs at the end of each subpass
 - no DONT_CARE support
 - no subpass dependency analysis and subpass merging
 - no zs support
 - no true VkImageView support
   - assume VK_FORMAT_B8G8R8A8_UNORM
   - no tiling
   - no MSAA

This also removes cur_cs from tu_cmd_buffer.

5 years agoturnip: add TU_CS_MODE_SUB_STREAM
Chia-I Wu [Tue, 29 Jan 2019 23:00:34 +0000 (15:00 -0800)]
turnip: add TU_CS_MODE_SUB_STREAM

When in TU_CS_MODE_SUB_STREAM, tu_cs_begin_sub_stream (or
tu_cs_end_sub_stream) should be called instead of tu_cs_begin (or
tu_cs_end).  It gives the caller a TU_CS_MODE_EXTERNAL cs to emit
commands to.

5 years agoturnip: add tu_cs_mode
Chia-I Wu [Mon, 28 Jan 2019 22:33:20 +0000 (14:33 -0800)]
turnip: add tu_cs_mode

Add tu_cs_mode and TU_CS_MODE_EXTERNAL.  When in
TU_CS_MODE_EXTERNAL, tu_cs wraps an external buffer and can not
grow.

This also moves tu_cs* up in tu_private.h, such that other structs
can embed tu_cs_entry.

5 years agoturnip: provide both emit_ib and emit_call
Chia-I Wu [Tue, 29 Jan 2019 18:43:48 +0000 (10:43 -0800)]
turnip: provide both emit_ib and emit_call

tu_cs_emit_ib emits a CP_INDIRECT_BUFFER for a BO.  tu_cs_emit_call
emits a CP_INDIRECT_BUFFER for each entry of a target cs.

5 years agoturnip: add tu_cs_sanity_check
Chia-I Wu [Tue, 29 Jan 2019 00:31:54 +0000 (16:31 -0800)]
turnip: add tu_cs_sanity_check

It replaces tu_cs_reserve_space_assert and can be called at any
time to sanity check tu_cs.

5 years agoturnip: never fail tu_cs_begin/tu_cs_end
Chia-I Wu [Mon, 28 Jan 2019 23:55:40 +0000 (15:55 -0800)]
turnip: never fail tu_cs_begin/tu_cs_end

Error checking tu_cs_begin/tu_cs_end is too tedious for the callers.
Move tu_cs_add_bo and tu_cs_reserve_entry to tu_cs_reserve_space
such that tu_cs_begin/tu_cs_end never fails.

5 years agoturnip: specify initial size in tu_cs_init
Chia-I Wu [Tue, 29 Jan 2019 00:24:48 +0000 (16:24 -0800)]
turnip: specify initial size in tu_cs_init

We will drop size parameter from tu_cs_begin shortly, such that
tu_cs_begin never fails.

5 years agoturnip: add tu_cs_{reserve,add}_entry
Chia-I Wu [Mon, 28 Jan 2019 23:52:36 +0000 (15:52 -0800)]
turnip: add tu_cs_{reserve,add}_entry

We will stop calling tu_cs_reserve_entry in tu_cs_end shortly, such
that tu_cs_end never fails.

5 years agoturnip: add internal helpers for tu_cs
Chia-I Wu [Tue, 29 Jan 2019 22:09:17 +0000 (14:09 -0800)]
turnip: add internal helpers for tu_cs

Add tu_cs_get_offset, tu_cs_get_size, tu_cs_get_space, and
tu_cs_is_empty.

5 years agoturnip: add tu_tiling_config
Chia-I Wu [Tue, 22 Jan 2019 18:27:22 +0000 (10:27 -0800)]
turnip: add tu_tiling_config

We need the current color/depth/stencil attachments and the current
render area to compute the tiling config.

We compute the tiling config at the beginning of each subpass for
the moment.  We should change that when the driver can reorder/merge
subpasses.

It is very common that the render area is the entire framebuffer.
We might want to optimize for the case and compute the tiling config
in tu_framebuffer ctor.

5 years agoturnip: preliminary support for tu_GetRenderAreaGranularity
Chia-I Wu [Tue, 22 Jan 2019 18:27:18 +0000 (10:27 -0800)]
turnip: preliminary support for tu_GetRenderAreaGranularity

Set it to tile alignments, 32x32 on 6xx.

5 years agoturnip: emit HW init in tu_BeginCommandBuffer
Chia-I Wu [Fri, 18 Jan 2019 16:54:04 +0000 (08:54 -0800)]
turnip: emit HW init in tu_BeginCommandBuffer

Being the first commit that emits meaningful command packets, there
are many things included in this commit

 - tu6_emit_xxx are low-level helpers that emit command packets
   without boundary checks
 - tu6_xxx are high-level helpers that emit command packets with
   boundary checks
 - cmdbuf->cs is a pointer to the current CS, so that we can use the
   helpers above to emit to other CS
 - use cmd as the variable name of tu_cmd_buffer
 - there is a per-cmdbuf scratch bo for CP_EVENT_WRITE writeback
 - there is a per-cmdbuf debug marker, using scratch reg 7 or 6
   depending on whether the cmdbuf is primary or secondary

(olv, after rebase) REG_A6XX_SP_UNKNOWN_AB20 is renamed

5 years agoturnip: add tu_cs_reserve_space(_assert)
Chia-I Wu [Fri, 18 Jan 2019 22:24:45 +0000 (14:24 -0800)]
turnip: add tu_cs_reserve_space(_assert)

They are used like

 tu_cs_reserve_space(...);
 tu_cs_emit(...);
 ...;
 tu_cs_reserve_space_assert();

to make sure we reserved enough space at the beginning.

5 years agoturnip: Annotate vkGetImageSubresourceLayout with tu_stub
Chad Versace [Wed, 16 Jan 2019 23:01:35 +0000 (15:01 -0800)]
turnip: Annotate vkGetImageSubresourceLayout with tu_stub

Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoturnip: preliminary support for tu_CmdBeginRenderPass
Chia-I Wu [Fri, 11 Jan 2019 22:27:01 +0000 (14:27 -0800)]
turnip: preliminary support for tu_CmdBeginRenderPass

5 years agoturnip: preliminary support for tu_image_view_init
Chia-I Wu [Thu, 10 Jan 2019 19:58:07 +0000 (11:58 -0800)]
turnip: preliminary support for tu_image_view_init

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>