mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 13:58:04 +02:00
gfxstream: simplify GLESv1/GLESv2/EGL/Vulkan builds
Certain libraries (libEGL_emulation, GLESv1/GLESv2, and
vulkan.ranchu) have duplicated variants due to two issues:
- whether to use the Kumquat and Linux VirtGpu backends
is a build time decision. This leads to "libplatform" and
"libplatform_kumquat".
- virtgpu_kumquat_ffi pulls in librutabaga_gfx_gfxstream,
which pulls in libgfxstream_backend -- which does not compile
for glibc_x86 or android32. This means "compile_multilib: 64"
is needed for glibc_x86_64 and android64 builds. The
non-kumquat dependent Android build actually needs 32-bit
libraries, while the kumquat dependent Android built does not.
This leads to different libraries.
The follow changes are made:
- Kumquat and Linux backends are both built for
host-builds. An environment variable controls
selection ("VIRTGPU_KUMQUAT").
- For Android builds, a stub Kumquat is built. We can
build a real Kumquat, but the use case does not exist.
These changes allow for a much simpler build.
Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
This commit is contained in:
parent
089c5162b8
commit
05dac426a7
12 changed files with 106 additions and 27 deletions
|
|
@ -13,9 +13,13 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "VirtGpu.h"
|
||||
|
||||
#include "VirtGpu.h"
|
||||
#include <cutils/log.h>
|
||||
#include <cutils/log.h>
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
#include "Sync.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
|
@ -23,6 +27,14 @@ static VirtGpuDevice* sDevice = nullptr;
|
|||
|
||||
} // namespace
|
||||
|
||||
VirtGpuDevice* createPlatformVirtGpuDevice(enum VirtGpuCapset capset, int32_t descriptor) {
|
||||
if (getenv("VIRTGPU_KUMQUAT")) {
|
||||
return kumquatCreateVirtGpuDevice(capset, descriptor);
|
||||
} else {
|
||||
return osCreateVirtGpuDevice(capset, descriptor);
|
||||
}
|
||||
}
|
||||
|
||||
VirtGpuDevice* VirtGpuDevice::getInstance(enum VirtGpuCapset capset, int32_t descriptor) {
|
||||
// If kCapsetNone is passed, we return a device that was created with any capset.
|
||||
// Otherwise, the created device's capset must match the requested capset.
|
||||
|
|
@ -45,3 +57,15 @@ void VirtGpuDevice::resetInstance() {
|
|||
sDevice = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
namespace gfxstream {
|
||||
|
||||
SyncHelper* createPlatformSyncHelper() {
|
||||
if (getenv("VIRTGPU_KUMQUAT")) {
|
||||
return kumquatCreateSyncHelper();
|
||||
} else {
|
||||
return osCreateSyncHelper();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace gfxstream
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include <cstdlib>
|
||||
|
||||
#include "FuchsiaVirtGpu.h"
|
||||
#include "Sync.h"
|
||||
|
||||
FuchsiaVirtGpuDevice::FuchsiaVirtGpuDevice(enum VirtGpuCapset capset, magma_device_t device)
|
||||
: VirtGpuDevice(capset), device_(device) {
|
||||
|
|
@ -95,7 +96,7 @@ int FuchsiaVirtGpuDevice::execBuffer(struct VirtGpuExecBuffer& execbuffer,
|
|||
|
||||
struct VirtGpuCaps FuchsiaVirtGpuDevice::getCaps(void) { return {}; }
|
||||
|
||||
VirtGpuDevice* createPlatformVirtGpuDevice(enum VirtGpuCapset capset, int32_t descriptor) {
|
||||
VirtGpuDevice* osCreateVirtGpuDevice(enum VirtGpuCapset capset, int32_t descriptor) {
|
||||
// We don't handle the VirtioGpuPipeStream case.
|
||||
if (descriptor >= 0) {
|
||||
ALOGE("Fuchsia: fd not handled");
|
||||
|
|
@ -145,3 +146,9 @@ VirtGpuDevice* createPlatformVirtGpuDevice(enum VirtGpuCapset capset, int32_t de
|
|||
|
||||
return gpu_device;
|
||||
}
|
||||
|
||||
namespace gfxstream {
|
||||
|
||||
SyncHelper* osCreateSyncHelper() { return nullptr; }
|
||||
|
||||
} // namespace gfxstream
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@ class SyncHelper {
|
|||
virtual int close(int syncFd) = 0;
|
||||
};
|
||||
|
||||
SyncHelper* osCreateSyncHelper();
|
||||
SyncHelper* kumquatCreateSyncHelper();
|
||||
SyncHelper* createPlatformSyncHelper();
|
||||
|
||||
} // namespace gfxstream
|
||||
|
|
|
|||
|
|
@ -204,6 +204,9 @@ class VirtGpuDevice {
|
|||
enum VirtGpuCapset mCapset;
|
||||
};
|
||||
|
||||
VirtGpuDevice* kumquatCreateVirtGpuDevice(enum VirtGpuCapset capset = kCapsetNone, int fd = -1);
|
||||
VirtGpuDevice* osCreateVirtGpuDevice(enum VirtGpuCapset capset = kCapsetNone, int fd = -1);
|
||||
|
||||
VirtGpuDevice* createPlatformVirtGpuDevice(enum VirtGpuCapset capset = kCapsetNone, int fd = -1);
|
||||
|
||||
// HACK: We can use gfxstream::guest::EnumFlags, but we'll have to do more guest
|
||||
|
|
|
|||
|
|
@ -249,6 +249,6 @@ int VirtGpuKumquatDevice::execBuffer(struct VirtGpuExecBuffer& execbuffer,
|
|||
return 0;
|
||||
}
|
||||
|
||||
VirtGpuDevice* createPlatformVirtGpuDevice(enum VirtGpuCapset capset, int32_t descriptor) {
|
||||
VirtGpuDevice* kumquatCreateVirtGpuDevice(enum VirtGpuCapset capset, int32_t descriptor) {
|
||||
return new VirtGpuKumquatDevice(capset, descriptor);
|
||||
}
|
||||
|
|
|
|||
31
src/gfxstream/guest/platform/kumquat/VirtGpuKumquatStub.cpp
Normal file
31
src/gfxstream/guest/platform/kumquat/VirtGpuKumquatStub.cpp
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright 2022 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <cutils/log.h>
|
||||
|
||||
#include "Sync.h"
|
||||
#include "VirtGpu.h"
|
||||
|
||||
VirtGpuDevice* kumquatCreateVirtGpuDevice(enum VirtGpuCapset capset, int32_t descriptor) {
|
||||
ALOGE("Using stub implementation of kumquat");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
namespace gfxstream {
|
||||
|
||||
SyncHelper* kumquatCreateSyncHelper() { return nullptr; }
|
||||
|
||||
} // namespace gfxstream
|
||||
|
|
@ -47,6 +47,6 @@ int VirtGpuKumquatSyncHelper::dup(int syncFd) { return ::dup(syncFd); }
|
|||
|
||||
int VirtGpuKumquatSyncHelper::close(int syncFd) { return ::close(syncFd); }
|
||||
|
||||
SyncHelper* createPlatformSyncHelper() { return new VirtGpuKumquatSyncHelper(); }
|
||||
SyncHelper* kumquatCreateSyncHelper() { return new VirtGpuKumquatSyncHelper(); }
|
||||
|
||||
} // namespace gfxstream
|
||||
|
|
|
|||
|
|
@ -1,17 +1,20 @@
|
|||
# Copyright 2022 Android Open Source Project
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
files_lib_platform = files(
|
||||
'../VirtGpu.cpp',
|
||||
'VirtGpuKumquatDevice.cpp',
|
||||
'VirtGpuKumquatBlobMapping.cpp',
|
||||
'VirtGpuKumquatBlob.cpp',
|
||||
'VirtGpuKumquatSync.cpp',
|
||||
)
|
||||
if with_kumquat
|
||||
files_lib_platform_kumquat = files(
|
||||
'VirtGpuKumquatDevice.cpp',
|
||||
'VirtGpuKumquatBlobMapping.cpp',
|
||||
'VirtGpuKumquatBlob.cpp',
|
||||
'VirtGpuKumquatSync.cpp',
|
||||
)
|
||||
else
|
||||
files_lib_platform_kumquat = files('VirtGpuKumquatStub.cpp')
|
||||
endif
|
||||
|
||||
lib_platform = static_library(
|
||||
'platform',
|
||||
files_lib_platform,
|
||||
lib_platform_kumquat = static_library(
|
||||
'platform_kumquat',
|
||||
files_lib_platform_kumquat,
|
||||
cpp_args: gfxstream_guest_args,
|
||||
include_directories: [inc_platform, inc_android_compat],
|
||||
dependencies: virtgpu_kumquat_dep,
|
||||
|
|
|
|||
|
|
@ -39,6 +39,6 @@ int LinuxSyncHelper::dup(int syncFd) { return ::dup(syncFd); }
|
|||
|
||||
int LinuxSyncHelper::close(int syncFd) { return ::close(syncFd); }
|
||||
|
||||
SyncHelper* createPlatformSyncHelper() { return new LinuxSyncHelper(); }
|
||||
SyncHelper* osCreateSyncHelper() { return new LinuxSyncHelper(); }
|
||||
|
||||
} // namespace gfxstream
|
||||
|
|
|
|||
|
|
@ -258,6 +258,6 @@ int LinuxVirtGpuDevice::execBuffer(struct VirtGpuExecBuffer& execbuffer,
|
|||
return 0;
|
||||
}
|
||||
|
||||
VirtGpuDevice* createPlatformVirtGpuDevice(enum VirtGpuCapset capset, int32_t descriptor) {
|
||||
VirtGpuDevice* osCreateVirtGpuDevice(enum VirtGpuCapset capset, int32_t descriptor) {
|
||||
return new LinuxVirtGpuDevice(capset, descriptor);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,17 +1,16 @@
|
|||
# Copyright 2022 Android Open Source Project
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
files_lib_platform = files(
|
||||
'../VirtGpu.cpp',
|
||||
files_lib_platform_linux = files(
|
||||
'LinuxVirtGpuDevice.cpp',
|
||||
'LinuxVirtGpuBlobMapping.cpp',
|
||||
'LinuxVirtGpuBlob.cpp',
|
||||
'LinuxSync.cpp',
|
||||
)
|
||||
|
||||
lib_platform = static_library(
|
||||
'platform',
|
||||
files_lib_platform,
|
||||
lib_platform_linux = static_library(
|
||||
'platform_linux',
|
||||
files_lib_platform_linux,
|
||||
cpp_args: gfxstream_guest_args,
|
||||
include_directories: [inc_platform, inc_android_compat],
|
||||
dependencies: drm_dep,
|
||||
|
|
|
|||
|
|
@ -2,8 +2,18 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
|
||||
inc_platform = include_directories('include')
|
||||
if with_guest_test
|
||||
subdir('kumquat')
|
||||
else
|
||||
subdir('linux')
|
||||
endif
|
||||
|
||||
subdir('kumquat')
|
||||
subdir('linux')
|
||||
|
||||
files_lib_platform = files(
|
||||
'VirtGpu.cpp',
|
||||
)
|
||||
|
||||
lib_platform = static_library(
|
||||
'platform',
|
||||
files_lib_platform,
|
||||
cpp_args: gfxstream_guest_args,
|
||||
include_directories: [inc_platform, inc_android_compat],
|
||||
link_with: [lib_platform_kumquat, lib_platform_linux]
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue