Mesa (main): v3dv/build: meson infrastructure for multi-hw-version support
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Jun 22 10:35:43 UTC 2021
Module: Mesa
Branch: main
Commit: 26af7ef67fd8d1b6bb22e9332984136ec61b358b
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=26af7ef67fd8d1b6bb22e9332984136ec61b358b
Author: Alejandro Piñeiro <apinheiro at igalia.com>
Date: Thu Jun 10 00:21:45 2021 +0200
v3dv/build: meson infrastructure for multi-hw-version support
We follow the same approach that v3d. We compile the files that
depends on the version several times, passing a different version each
time. We link all those per-version libs on the main library.
Note that right now we only support version == 42, so the array of
supported versions is one-sized.
Also note that although we were doing a previous work to split
hw-version dependant code from general code, this is the first commit
that only inject the current V3D_VERSION on the former.
We have two cases where we hardcode the V3D_VERSION (as a full
wrapping would be an overkill) that we need to include here to avoid
warnings/errors if we do that before or after.
Having some exceptions also happens on v3d. As we are here we add some
comment on v3d clarifying that.
Reviewed-by: Iago Toral Quiroga <itoral at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11310>
---
src/broadcom/vulkan/meson.build | 23 +++++++++++++++++++++--
src/broadcom/vulkan/v3dv_cl.c | 7 +++++++
src/broadcom/vulkan/v3dv_uniforms.c | 6 ++++++
src/gallium/drivers/v3d/v3d_cl.c | 5 ++++-
src/gallium/drivers/v3d/v3d_uniforms.c | 4 ++++
5 files changed, 42 insertions(+), 3 deletions(-)
diff --git a/src/broadcom/vulkan/meson.build b/src/broadcom/vulkan/meson.build
index 3dadb49e69f..41a3c03071b 100644
--- a/src/broadcom/vulkan/meson.build
+++ b/src/broadcom/vulkan/meson.build
@@ -25,6 +25,7 @@ v3dv_entrypoints = custom_target(
command : [
prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak',
'--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@', '--prefix', 'v3dv',
+ '--device-prefix', 'ver42',
],
depend_files : vk_entrypoints_gen_depend_files,
)
@@ -69,7 +70,9 @@ files_per_version = files(
# 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']
+v3d_versions = ['42']
+
+v3dv_flags = []
dep_v3dv3 = dependency('v3dv3', required : false)
if dep_v3dv3.found()
@@ -107,9 +110,24 @@ if system_has_kms_drm and not with_platform_android
libv3dv_files += files('v3dv_wsi_display.c')
endif
+per_version_libs = []
+foreach ver : v3d_versions
+ per_version_libs += static_library(
+ 'v3dv-v' + ver,
+ [files_per_version, v3d_xml_pack, v3dv_entrypoints[0]],
+ include_directories : [
+ inc_src, inc_include, inc_gallium, inc_gallium_aux, inc_broadcom,
+ inc_compiler, inc_util, inc_vulkan_wsi,
+ ],
+ c_args : [v3dv_flags, '-DV3D_VERSION=' + ver],
+ gnu_symbol_visibility : 'hidden',
+ dependencies : [v3dv_deps],
+)
+endforeach
+
libvulkan_broadcom = shared_library(
'vulkan_broadcom',
- [libv3dv_files, files_per_version, v3dv_entrypoints, sha1_h],
+ [libv3dv_files, v3dv_entrypoints, sha1_h],
include_directories : [
inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_broadcom, inc_compiler, inc_util, inc_vulkan_wsi,
],
@@ -117,6 +135,7 @@ libvulkan_broadcom = shared_library(
libbroadcom_cle,
libbroadcom_v3d,
libvulkan_wsi,
+ per_version_libs,
],
dependencies : v3dv_deps,
c_args : v3dv_flags,
diff --git a/src/broadcom/vulkan/v3dv_cl.c b/src/broadcom/vulkan/v3dv_cl.c
index c36cb6a7e19..ed11f53c4bb 100644
--- a/src/broadcom/vulkan/v3dv_cl.c
+++ b/src/broadcom/vulkan/v3dv_cl.c
@@ -22,6 +22,13 @@
*/
#include "v3dv_private.h"
+
+/* We don't expect that the packets we use in this file change across hw
+ * versions, so we just explicitly set the V3D_VERSION and include v3dx_pack
+ * here
+ */
+#define V3D_VERSION 33
+#include "broadcom/common/v3d_macros.h"
#include "broadcom/cle/v3dx_pack.h"
void
diff --git a/src/broadcom/vulkan/v3dv_uniforms.c b/src/broadcom/vulkan/v3dv_uniforms.c
index e51ece3e161..b4ee96a3092 100644
--- a/src/broadcom/vulkan/v3dv_uniforms.c
+++ b/src/broadcom/vulkan/v3dv_uniforms.c
@@ -28,6 +28,12 @@
#include "v3dv_private.h"
#include "vk_format_info.h"
+/* The only version specific structure that we need is
+ * TMU_CONFIG_PARAMETER_1. This didn't seem to change significantly from
+ * previous V3D versions and we don't expect that to change, so for now let's
+ * just hardcode the V3D version here.
+ */
+#define V3D_VERSION 41
#include "broadcom/common/v3d_macros.h"
#include "broadcom/cle/v3dx_pack.h"
diff --git a/src/gallium/drivers/v3d/v3d_cl.c b/src/gallium/drivers/v3d/v3d_cl.c
index 8d3d56eed74..c03927e0453 100644
--- a/src/gallium/drivers/v3d/v3d_cl.c
+++ b/src/gallium/drivers/v3d/v3d_cl.c
@@ -24,7 +24,10 @@
#include "util/u_math.h"
#include "util/ralloc.h"
#include "v3d_context.h"
-/* The branching packets are the same across V3D versions. */
+/* We don't expect that the packets we use in this file change across across
+ * hw versions, so we just explicitly set the V3D_VERSION and include
+ * v3dx_pack here
+ */
#define V3D_VERSION 33
#include "broadcom/common/v3d_macros.h"
#include "broadcom/cle/v3dx_pack.h"
diff --git a/src/gallium/drivers/v3d/v3d_uniforms.c b/src/gallium/drivers/v3d/v3d_uniforms.c
index 5811d07ecdf..e6ec49f6cd3 100644
--- a/src/gallium/drivers/v3d/v3d_uniforms.c
+++ b/src/gallium/drivers/v3d/v3d_uniforms.c
@@ -27,6 +27,10 @@
#include "v3d_context.h"
#include "compiler/v3d_compiler.h"
+
+/* We don't expect that the packets we use in this file change across across
+ * hw versions, so we just include directly the v33 header
+ */
#include "broadcom/cle/v3d_packet_v33_pack.h"
static uint32_t
More information about the mesa-commit
mailing list