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@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11310>
This commit is contained in:
Alejandro Piñeiro 2021-06-10 00:21:45 +02:00
parent f257c79ea4
commit 26af7ef67f
5 changed files with 42 additions and 3 deletions

View file

@ -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,

View file

@ -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

View file

@ -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"

View file

@ -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"

View file

@ -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