2019-11-25 16:29:12 +01:00
|
|
|
# Copyright © 2019 Raspberry Pi
|
|
|
|
|
#
|
|
|
|
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
|
# of this software and associated documentation files (the "Software"), to deal
|
|
|
|
|
# in the Software without restriction, including without limitation the rights
|
|
|
|
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
|
# copies of the Software, and to permit persons to whom the Software is
|
|
|
|
|
# furnished to do so, subject to the following conditions:
|
|
|
|
|
#
|
|
|
|
|
# The above copyright notice and this permission notice shall be included in
|
|
|
|
|
# all copies or substantial portions of the Software.
|
|
|
|
|
#
|
|
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
|
# SOFTWARE.
|
|
|
|
|
|
|
|
|
|
v3dv_entrypoints = custom_target(
|
2021-01-28 00:21:38 +01:00
|
|
|
'v3dv_entrypoints',
|
|
|
|
|
input : [vk_entrypoints_gen, vk_api_xml],
|
2019-11-25 16:29:12 +01:00
|
|
|
output : ['v3dv_entrypoints.h', 'v3dv_entrypoints.c'],
|
|
|
|
|
command : [
|
2021-01-28 00:21:38 +01:00
|
|
|
prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak',
|
|
|
|
|
'--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@', '--prefix', 'v3dv',
|
2019-11-25 16:29:12 +01:00
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
v3dv_extensions_c = custom_target(
|
|
|
|
|
'v3dv_extensions.c',
|
|
|
|
|
input : ['v3dv_extensions_gen.py', vk_api_xml],
|
|
|
|
|
output : 'v3dv_extensions.c',
|
|
|
|
|
command : [
|
|
|
|
|
prog_python, '@INPUT0@', '--xml', '@INPUT1@',
|
|
|
|
|
'--out-c', '@OUTPUT@',
|
|
|
|
|
],
|
2021-01-28 13:51:57 -06:00
|
|
|
depend_files : [files('v3dv_extensions.py'), vk_extensions_gen],
|
2019-11-25 16:29:12 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
v3dv_extensions_h = custom_target(
|
|
|
|
|
'v3dv_extensions.h',
|
|
|
|
|
input : ['v3dv_extensions_gen.py', vk_api_xml],
|
|
|
|
|
output : 'v3dv_extensions.h',
|
|
|
|
|
command : [
|
|
|
|
|
prog_python, '@INPUT0@', '--xml', '@INPUT1@',
|
|
|
|
|
'--out-h', '@OUTPUT@',
|
|
|
|
|
],
|
2021-01-28 13:51:57 -06:00
|
|
|
depend_files : [files('v3dv_extensions.py'), vk_extensions_gen],
|
2019-11-25 16:29:12 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
libv3dv_files = files(
|
2019-12-10 12:00:49 +01:00
|
|
|
'v3dv_bo.c',
|
2019-12-11 10:10:27 +01:00
|
|
|
'v3dv_cl.c',
|
2019-12-10 09:03:49 +01:00
|
|
|
'v3dv_cmd_buffer.c',
|
2019-12-02 22:43:35 +01:00
|
|
|
'v3dv_debug.c',
|
|
|
|
|
'v3dv_debug.h',
|
2019-11-30 22:59:23 +01:00
|
|
|
'v3dv_descriptor_set.c',
|
2019-11-25 16:29:12 +01:00
|
|
|
'v3dv_device.c',
|
2019-12-02 11:25:28 +01:00
|
|
|
'v3dv_formats.c',
|
2019-12-03 12:54:30 +01:00
|
|
|
'v3dv_image.c',
|
2020-07-30 14:32:26 +02:00
|
|
|
'v3dv_limits.h',
|
v3dv: implement vkCmdClearAttachments
For now this only implements a fast path using the tile buffer, so it
can only be used when clearing full images, but this is good enough
for VkRunner.
The implementation is a bit tricky because this command executes
inside a render pass, and yet, since we are using the tile buffer to
clear, this needs to go in its own job. This means that with this, we
need to be able to split a subpass into multiple jobs which creates
some issues.
For example, certain operations, such as the subpass load operation
(particularly if it is a clear) should only happen on the first job of
the subpass and subsequent jobs in the same subpass should always
load.
Similarly, we should not discard the last store on an attachment
unless we know it is the last job for the last subpass that uses the
attachment.
To handle these cases we add two new flags to the job, one to know if
the job is not the first in a subpass (is_subpass_continue) and
another one to know if a job is the last in a subpass
(is_subpass_finish).
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-02-06 12:39:48 +01:00
|
|
|
'v3dv_meta_clear.c',
|
2019-12-16 09:09:40 +01:00
|
|
|
'v3dv_meta_copy.c',
|
2019-12-09 11:16:09 +01:00
|
|
|
'v3dv_pass.c',
|
2019-11-25 16:29:12 +01:00
|
|
|
'v3dv_pipeline.c',
|
2020-01-16 13:22:57 +01:00
|
|
|
'v3dv_pipeline_cache.c',
|
2019-11-25 16:29:12 +01:00
|
|
|
'v3dv_private.h',
|
v3dv: implement occlusion queries
The design for queries in Vulkan requires that some commands execute
in the GPU as part of a command buffer. Unfortunately, V3D doesn't
really have supprt for this, which means that we need to execute them
in the CPU but we still need to make it look as if they happened
inside the comamnd buffer from the point of view of the user, which
adds certain hassle.
The above means that in some cases we need to do CPU waits for certain
parts of the command buffer to execute so we can then run the CPU
code. For exmaple, we need to wait before executing a query resets
just in case the GPU is using them, and we have to do a CPU wait wait
for previous GPU jobs to complete before copying query results if the
user has asked us to do that. In the future, we may want to have
submission thread instead so we don't block the main thread in these
scenarios.
Because we now need to execute some tasks in the CPU as part of a
command buffer, this introduces the concept of job types, there is one
type for all GPU jobs, and then we have one type for each kind of job
that needs to execute in the CPU. CPU jobs are executed by the queue
in order just like GPU jobs, only that they are exclusively CPU tasks.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-04-16 10:30:38 +02:00
|
|
|
'v3dv_query.c',
|
2019-12-16 09:09:40 +01:00
|
|
|
'v3dv_queue.c',
|
2020-01-03 12:43:35 +01:00
|
|
|
'v3dv_uniforms.c',
|
2019-11-25 16:29:12 +01:00
|
|
|
'v3dv_util.c',
|
2020-01-16 11:14:17 +01:00
|
|
|
'v3dv_wsi.c',
|
2019-12-03 12:54:30 +01:00
|
|
|
'v3d_tiling.c',
|
2019-11-25 16:29:12 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# The vulkan driver only supports version >= 42, which is the version present in
|
|
|
|
|
# Rpi4. We need to explicitly set it as we are reusing pieces from the GL v3d
|
|
|
|
|
# driver.
|
|
|
|
|
v3dv_flags = ['-DV3D_VERSION=42']
|
|
|
|
|
|
2019-11-29 13:55:38 +01:00
|
|
|
dep_v3dv3 = dependency('v3dv3', required : false)
|
|
|
|
|
if dep_v3dv3.found()
|
|
|
|
|
v3dv_flags += '-DUSE_V3D_SIMULATOR'
|
|
|
|
|
endif
|
|
|
|
|
|
2019-11-25 16:29:12 +01:00
|
|
|
v3dv_deps = [
|
2020-07-04 13:09:58 +02:00
|
|
|
dep_dl,
|
2019-11-25 16:29:12 +01:00
|
|
|
dep_libdrm,
|
2019-11-27 11:49:12 +01:00
|
|
|
dep_valgrind,
|
2019-11-29 13:55:38 +01:00
|
|
|
dep_v3dv3,
|
2019-12-02 13:59:04 +01:00
|
|
|
idep_nir,
|
|
|
|
|
idep_nir_headers,
|
2019-11-25 16:29:12 +01:00
|
|
|
idep_vulkan_util,
|
|
|
|
|
]
|
|
|
|
|
|
2020-01-16 11:14:17 +01:00
|
|
|
if with_platform_x11
|
|
|
|
|
v3dv_deps += dep_xcb_dri3
|
|
|
|
|
v3dv_flags += [
|
|
|
|
|
'-DVK_USE_PLATFORM_XCB_KHR',
|
|
|
|
|
'-DVK_USE_PLATFORM_XLIB_KHR',
|
|
|
|
|
]
|
|
|
|
|
libv3dv_files += files('v3dv_wsi_x11.c')
|
|
|
|
|
endif
|
|
|
|
|
|
2020-11-20 08:57:07 +00:00
|
|
|
if with_platform_wayland
|
|
|
|
|
v3dv_deps += [dep_wayland_client, dep_wl_protocols]
|
|
|
|
|
v3dv_flags += '-DVK_USE_PLATFORM_WAYLAND_KHR'
|
|
|
|
|
libv3dv_files += files('v3dv_wsi_wayland.c')
|
|
|
|
|
libv3dv_files += [wayland_drm_client_protocol_h, wayland_drm_protocol_c]
|
|
|
|
|
endif
|
|
|
|
|
|
2020-11-04 17:45:10 +00:00
|
|
|
if system_has_kms_drm and not with_platform_android
|
|
|
|
|
v3dv_flags += '-DVK_USE_PLATFORM_DISPLAY_KHR'
|
|
|
|
|
libv3dv_files += files('v3dv_wsi_display.c')
|
|
|
|
|
endif
|
|
|
|
|
|
2019-11-25 16:29:12 +01:00
|
|
|
libvulkan_broadcom = shared_library(
|
|
|
|
|
'vulkan_broadcom',
|
|
|
|
|
[libv3dv_files, v3dv_entrypoints, v3dv_extensions_c, v3dv_extensions_h, sha1_h],
|
|
|
|
|
include_directories : [
|
2020-01-16 11:14:17 +01:00
|
|
|
inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_broadcom, inc_compiler, inc_util, inc_vulkan_wsi,
|
2019-11-25 16:29:12 +01:00
|
|
|
],
|
|
|
|
|
link_with : [
|
2020-01-02 13:31:59 +01:00
|
|
|
libbroadcom_cle,
|
2019-11-25 16:29:12 +01:00
|
|
|
libbroadcom_v3d,
|
2019-11-27 11:49:49 +01:00
|
|
|
# For glsl_type_singleton_init_or_ref:
|
|
|
|
|
libglsl,
|
2020-01-16 11:14:17 +01:00
|
|
|
libvulkan_wsi,
|
2019-11-25 16:29:12 +01:00
|
|
|
],
|
|
|
|
|
dependencies : v3dv_deps,
|
|
|
|
|
c_args : v3dv_flags,
|
|
|
|
|
link_args : ['-Wl,--build-id=sha1', ld_args_bsymbolic, ld_args_gc_sections],
|
|
|
|
|
gnu_symbol_visibility : 'hidden',
|
|
|
|
|
install : true,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
if with_symbols_check
|
|
|
|
|
test(
|
|
|
|
|
'v3dv symbols check',
|
|
|
|
|
symbols_check,
|
|
|
|
|
args : [
|
|
|
|
|
'--lib', libvulkan_broadcom,
|
|
|
|
|
'--symbols-file', vulkan_icd_symbols,
|
|
|
|
|
symbols_check_args,
|
|
|
|
|
],
|
|
|
|
|
suite : ['broadcom'],
|
|
|
|
|
)
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
broadcom_icd = custom_target(
|
|
|
|
|
'broadcom_icd',
|
|
|
|
|
input : 'v3dv_icd.py',
|
|
|
|
|
output : 'broadcom_icd.@0@.json'.format(host_machine.cpu()),
|
|
|
|
|
command : [
|
|
|
|
|
prog_python, '@INPUT@',
|
|
|
|
|
'--lib-path', join_paths(get_option('prefix'), get_option('libdir')),
|
|
|
|
|
'--out', '@OUTPUT@',
|
|
|
|
|
],
|
|
|
|
|
depend_files : files('v3dv_extensions.py'),
|
|
|
|
|
build_by_default : true,
|
|
|
|
|
install_dir : with_vulkan_icd_dir,
|
|
|
|
|
install : true,
|
|
|
|
|
)
|