meson: Add build option for gallium-d3d12-video feature

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6511
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16597>
This commit is contained in:
Sil Vilerino 2022-05-23 07:10:36 -07:00 committed by Marge Bot
parent 4a9e068a6e
commit e5ddd8ad94
8 changed files with 61 additions and 34 deletions

View File

@ -625,6 +625,25 @@ if with_gallium_kmsro and (with_platform_x11 and not with_dri3)
error('kmsro requires dri3 for X11 support')
endif
dep_dxheaders = null_dep
if with_gallium_d3d12 or with_microsoft_clc or with_microsoft_vk
dep_dxheaders = dependency('directx-headers', required : false)
if not dep_dxheaders.found()
dep_dxheaders = dependency('DirectX-Headers',
version : '>= 1.602.0',
fallback : ['DirectX-Headers', 'dep_dxheaders'],
required : with_gallium_d3d12 or with_microsoft_vk
)
endif
endif
_with_gallium_d3d12_video = get_option('gallium-d3d12-video')
with_gallium_d3d12_video = false
if with_gallium_d3d12 and not _with_gallium_d3d12_video.disabled()
with_gallium_d3d12_video = true
pre_args += '-DHAVE_GALLIUM_D3D12_VIDEO'
endif
_vdpau = get_option('gallium-vdpau')
if _vdpau == 'true'
_vdpau = 'enabled'
@ -646,9 +665,9 @@ elif not with_platform_x11
_vdpau = 'disabled'
endif
elif not (with_gallium_r300 or with_gallium_r600 or with_gallium_radeonsi or
with_gallium_nouveau or with_gallium_d3d12)
with_gallium_nouveau or with_gallium_d3d12_video)
if _vdpau == 'enabled'
error('VDPAU state tracker requires at least one of the following gallium drivers: r300, r600, radeonsi, nouveau, d3d12.')
error('VDPAU state tracker requires at least one of the following gallium drivers: r300, r600, radeonsi, nouveau, d3d12 (with option gallium-d3d12-video).')
else
_vdpau = 'disabled'
endif
@ -671,18 +690,6 @@ if vdpau_drivers_path == ''
vdpau_drivers_path = join_paths(get_option('libdir'), 'vdpau')
endif
dep_dxheaders = null_dep
if with_gallium_d3d12 or with_microsoft_clc or with_microsoft_vk
dep_dxheaders = dependency('directx-headers', required : false)
if not dep_dxheaders.found()
dep_dxheaders = dependency('DirectX-Headers',
version : '>= 1.602.0',
fallback : ['DirectX-Headers', 'dep_dxheaders'],
required : with_gallium_d3d12 or with_microsoft_vk
)
endif
endif
if with_vulkan_overlay_layer or with_aco_tests or with_amd_vk
prog_glslang = find_program('glslangValidator')
if run_command(prog_glslang, [ '--quiet', '--version' ], check : false).returncode() == 0
@ -827,9 +834,9 @@ if not system_has_kms_drm
else
_va = 'disabled'
endif
elif not (with_gallium_r600 or with_gallium_radeonsi or with_gallium_nouveau or with_gallium_d3d12)
elif not (with_gallium_r600 or with_gallium_radeonsi or with_gallium_nouveau or with_gallium_d3d12_video)
if _va == 'enabled'
error('VA state tracker requires at least one of the following gallium drivers: r600, radeonsi, nouveau, d3d12.')
error('VA state tracker requires at least one of the following gallium drivers: r600, radeonsi, nouveau, d3d12 (with option gallium-d3d12-video).')
else
_va = 'disabled'
endif

View File

@ -536,3 +536,9 @@ option(
],
description : 'List of patent encumbered codecs to build support for. Distros might want to consult their legal department before enabling these. This is used for all video APIs (vaapi, vdpau, vulkan). Non-patent encumbered codecs will be enabled by default.'
)
option(
'gallium-d3d12-video',
type : 'feature',
value : 'auto',
description : 'build gallium d3d12 with video support.',
)

View File

@ -34,10 +34,11 @@
#include "d3d12_root_signature.h"
#include "d3d12_screen.h"
#include "d3d12_surface.h"
#ifdef HAVE_GALLIUM_D3D12_VIDEO
#include "d3d12_video_dec.h"
#include "d3d12_video_enc.h"
#include "d3d12_video_buffer.h"
#endif
#include "util/u_atomic.h"
#include "util/u_blitter.h"
#include "util/u_dual_blend.h"
@ -2378,6 +2379,7 @@ d3d12_get_reset_status(struct pipe_context *pctx)
}
}
#ifdef HAVE_GALLIUM_D3D12_VIDEO
struct pipe_video_codec*
d3d12_video_create_codec(struct pipe_context *context,
const struct pipe_video_codec *templat)
@ -2391,6 +2393,7 @@ d3d12_video_create_codec(struct pipe_context *context,
return nullptr;
}
}
#endif
struct pipe_context *
d3d12_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
@ -2506,10 +2509,11 @@ d3d12_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
d3d12_context_query_init(&ctx->base);
d3d12_context_blit_init(&ctx->base);
#ifdef HAVE_GALLIUM_D3D12_VIDEO
// Add d3d12 video functions entrypoints
ctx->base.create_video_codec = d3d12_video_create_codec;
ctx->base.create_video_buffer = d3d12_video_buffer_create;
#endif
slab_create_child(&ctx->transfer_pool, &d3d12_screen(pscreen)->transfer_pool);
slab_create_child(&ctx->transfer_pool_unsync, &d3d12_screen(pscreen)->transfer_pool);

View File

@ -355,8 +355,9 @@ d3d12_need_zero_one_depth_range(struct d3d12_context *ctx);
void
d3d12_init_sampler_view_descriptor(struct d3d12_sampler_view *sampler_view);
#ifdef HAVE_GALLIUM_D3D12_VIDEO
struct pipe_video_codec* d3d12_video_create_codec( struct pipe_context *context,
const struct pipe_video_codec *t);
#endif
#endif

View File

@ -28,7 +28,9 @@
#include "d3d12_context.h"
#include "d3d12_debug.h"
#include "d3d12_fence.h"
#ifdef HAVE_GALLIUM_D3D12_VIDEO
#include "d3d12_video_screen.h"
#endif
#include "d3d12_format.h"
#include "d3d12_residency.h"
#include "d3d12_resource.h"
@ -1240,7 +1242,9 @@ d3d12_init_screen(struct d3d12_screen *screen, IUnknown *adapter)
d3d12_screen_fence_init(&screen->base);
d3d12_screen_resource_init(&screen->base);
#ifdef HAVE_GALLIUM_D3D12_VIDEO
d3d12_screen_video_init(&screen->base);
#endif
slab_create_parent(&screen->transfer_pool, sizeof(struct d3d12_transfer), 16);
struct pb_desc desc;

View File

@ -47,21 +47,26 @@ files_libd3d12 = files(
'd3d12_surface.cpp',
'd3d12_tcs_variant.cpp',
'D3D12ResourceState.cpp',
'd3d12_video_dec.cpp',
'd3d12_video_dec_references_mgr.cpp',
'd3d12_video_dec_h264.cpp',
'd3d12_video_buffer.cpp',
'd3d12_video_enc.cpp',
'd3d12_video_enc_h264.cpp',
'd3d12_video_encoder_references_manager_h264.cpp',
'd3d12_video_encoder_nalu_writer_h264.cpp',
'd3d12_video_encoder_bitstream_builder_h264.cpp',
'd3d12_video_encoder_bitstream.cpp',
'd3d12_video_texture_array_dpb_manager.cpp',
'd3d12_video_array_of_textures_dpb_manager.cpp',
'd3d12_video_screen.cpp',
)
if with_gallium_d3d12_video
files_libd3d12 += [
'd3d12_video_dec.cpp',
'd3d12_video_dec_references_mgr.cpp',
'd3d12_video_dec_h264.cpp',
'd3d12_video_buffer.cpp',
'd3d12_video_enc.cpp',
'd3d12_video_enc_h264.cpp',
'd3d12_video_encoder_references_manager_h264.cpp',
'd3d12_video_encoder_nalu_writer_h264.cpp',
'd3d12_video_encoder_bitstream_builder_h264.cpp',
'd3d12_video_encoder_bitstream.cpp',
'd3d12_video_texture_array_dpb_manager.cpp',
'd3d12_video_array_of_textures_dpb_manager.cpp',
'd3d12_video_screen.cpp',
]
endif
if host_machine.system() == 'windows'
files_libd3d12 += files('d3d12_dxgi_screen.cpp')
endif

View File

@ -64,7 +64,7 @@ libva_gallium = shared_library(
foreach d : [[with_gallium_r600, 'r600'],
[with_gallium_radeonsi, 'radeonsi'],
[with_gallium_nouveau, 'nouveau'],
[with_gallium_d3d12, 'd3d12']]
[with_gallium_d3d12_video, 'd3d12']]
if d[0]
va_drivers += '@0@_drv_video.so'.format(d[1])
endif

View File

@ -69,7 +69,7 @@ foreach d : [[with_gallium_r300, 'r300'],
[with_gallium_r600, 'r600'],
[with_gallium_radeonsi, 'radeonsi'],
[with_gallium_nouveau, 'nouveau'],
[with_gallium_d3d12, 'd3d12']]
[with_gallium_d3d12_video, 'd3d12']]
if d[0]
vdpau_drivers += 'libvdpau_@0@.so.@1@.@2@.0'.format(d[1], VDPAU_MAJOR, VDPAU_MINOR)
endif