Add composition support to the end2end test framework

... so that we can start to test GL->VK->Host-Compositor flows.

Adds a fake render control lib that basically just exposes some of
the render control functions with scoped host connection inside of
a `RenderControlDevice`.

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:
Jason Macnak 2024-03-22 17:34:48 -07:00 committed by Marge Bot
parent c2d57b76be
commit d0a4d3f3bc
6 changed files with 43 additions and 0 deletions

View file

@ -218,6 +218,16 @@ uint32_t EmulatedGralloc::getFormatDrmFourcc(const AHardwareBuffer* handle) {
return ahb->getDrmFormat();
}
uint32_t EmulatedGralloc::getWidth(const AHardwareBuffer* handle) {
const auto* ahb = reinterpret_cast<const EmulatedAHardwareBuffer*>(handle);
return ahb->getWidth();
}
uint32_t EmulatedGralloc::getHeight(const AHardwareBuffer* handle) {
const auto* ahb = reinterpret_cast<const EmulatedAHardwareBuffer*>(handle);
return ahb->getHeight();
}
size_t EmulatedGralloc::getAllocatedSize(const native_handle_t*) {
ALOGE("Unimplemented.");
return 0;

View file

@ -87,6 +87,9 @@ class EmulatedGralloc : public Gralloc {
uint32_t getFormatDrmFourcc(const AHardwareBuffer* handle) override;
uint32_t getWidth(const AHardwareBuffer* ahb) override;
uint32_t getHeight(const AHardwareBuffer* ahb) override;
size_t getAllocatedSize(const native_handle_t*) override;
size_t getAllocatedSize(const AHardwareBuffer*) override;

View file

@ -79,6 +79,18 @@ int GoldfishGralloc::getFormat(const AHardwareBuffer* ahb) {
return getFormat(handle);
}
uint32_t GoldfishGralloc::getWidth(const AHardwareBuffer* ahb) {
AHardwareBuffer_Desc desc = {};
AHardwareBuffer_describe(ahb, &desc);
return desc.width;
}
uint32_t GoldfishGralloc::getHeight(const AHardwareBuffer* ahb) {
AHardwareBuffer_Desc desc = {};
AHardwareBuffer_describe(ahb, &desc);
return desc.height;
}
size_t GoldfishGralloc::getAllocatedSize(const native_handle_t* handle) {
return static_cast<size_t>(cb_handle_t::from(handle)->allocatedSize());
}

View file

@ -39,6 +39,9 @@ class GoldfishGralloc : public Gralloc {
int getFormat(const native_handle_t* handle) override;
int getFormat(const AHardwareBuffer* handle) override;
uint32_t getWidth(const AHardwareBuffer* ahb) override;
uint32_t getHeight(const AHardwareBuffer* ahb) override;
size_t getAllocatedSize(const native_handle_t* handle) override;
size_t getAllocatedSize(const AHardwareBuffer* handle) override;

View file

@ -221,6 +221,18 @@ uint32_t MinigbmGralloc::getFormatDrmFourcc(const AHardwareBuffer* ahb) {
return getFormatDrmFourcc(handle);
}
uint32_t MinigbmGralloc::getWidth(const AHardwareBuffer* ahb) {
AHardwareBuffer_Desc desc = {};
AHardwareBuffer_describe(ahb, &desc);
return desc.width;
}
uint32_t MinigbmGralloc::getHeight(const AHardwareBuffer* ahb) {
AHardwareBuffer_Desc desc = {};
AHardwareBuffer_describe(ahb, &desc);
return desc.height;
}
size_t MinigbmGralloc::getAllocatedSize(const native_handle_t* handle) {
struct drm_virtgpu_resource_info info;
if (!getVirtioGpuResourceInfo(m_fd, handle, &info)) {

View file

@ -42,6 +42,9 @@ class MinigbmGralloc : public Gralloc {
uint32_t getFormatDrmFourcc(const native_handle_t* handle) override;
uint32_t getFormatDrmFourcc(const AHardwareBuffer* handle) override;
uint32_t getWidth(const AHardwareBuffer* ahb) override;
uint32_t getHeight(const AHardwareBuffer* ahb) override;
size_t getAllocatedSize(const native_handle_t* handle) override;
size_t getAllocatedSize(const AHardwareBuffer* handle) override;