Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Platform api merge #2962

Merged
merged 112 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
f0d28da
All the new-platform-API
RAOF Apr 3, 2023
9d1ea5a
Aaaaargh
RAOF Apr 28, 2023
ec7d148
tests/x11: Test refusal to start at a higher level
RAOF May 16, 2023
16623a4
platforms/X11: Drop precondition check
RAOF May 16, 2023
1fee101
inclusive-naming: platform: Dumb -> CPUAddressable
RAOF May 19, 2023
a5cc801
Yo! Give this a better commit message when it's done
RAOF May 22, 2023
190e5ed
graphics/probe: Rework `probe_module` helper.
RAOF May 26, 2023
e72fb69
platform/graphics: Improve RenderingPlatform selection.
RAOF May 29, 2023
d2572a0
Fix typo
RAOF May 29, 2023
d393a68
compositor/BasicScreenShooter: Update for new Platform API
RAOF Jun 1, 2023
9a201a6
platform/DRMFormat: Add from_mir_format conversion
RAOF Jun 9, 2023
d0133e9
renderer::gl::OutputSurface: Add `release_current`
RAOF Jun 9, 2023
3a41bea
renderers::gl::Renderer: Hook up `make_current()`/`release_current()`
RAOF Jun 9, 2023
3ca7d91
CPUAddressableDisplayProvider: Expose supported pixel formats.
RAOF Jun 9, 2023
9abffdf
platforms/gbm-kms: Fix GBMSurface lifetime
RAOF Jun 9, 2023
71675b0
multiple/CPUCopyOutputSurface: Fix EGL context
RAOF Jun 9, 2023
1e919fd
platforms/gbm-kms: Fix KMSDisplayProvider
RAOF Jun 9, 2023
16e7161
compositor/BasicScreenShooter: Fix it! ☺
RAOF Jun 9, 2023
8d1c736
graphics::DefaultServerConfiguration: Use MultiplexingDisplay.
RAOF Jun 9, 2023
81f1e36
platforms/common: Pull out CPUCopyOutputSurface
RAOF Jun 13, 2023
cb697bc
tests/GLRenderer: Fix make_current test
RAOF Jun 13, 2023
112ad64
GBMHelper: Drop dead code
RAOF Jun 20, 2023
3119e74
gbm-kms: Also populate offset for KMS FB
RAOF Jun 20, 2023
f7e27c7
gbm-kms: factor out gbm_surface creation
RAOF Jun 20, 2023
d1b7e4d
gbm-kms: Throw on KMS FB creation failure, rather than returning garbage
RAOF Jun 20, 2023
131b3c8
unit-tests/gbm-kms/CMake: Stop double-linking server_platform_common
RAOF Jun 20, 2023
bb1abcc
gbm-kms: Fix build where sizof(u64) != sizeof(size_t)
RAOF Jun 20, 2023
c1610cd
gbm-kms: Drop unused udev::Device members
RAOF Jun 20, 2023
c8170e9
Clean up dropped BasicBufferRenderTarget detritus
RAOF Jul 4, 2023
949b9a9
mtd::MockGLRenderingPlatform: Mock the other half of GLRenderingProvider
RAOF Jul 13, 2023
eb54667
Re-enable BasicScreenShooter tests
RAOF Jul 13, 2023
1141bb9
BasicScreenShooter: Cleanup
RAOF Jul 13, 2023
1e62f8d
BasicScreenShooter: Sanity-check destination buffer size
RAOF Jul 13, 2023
73969e9
TestBasicScreenShooter: Make mock Renderer interaction more authentic.
RAOF Jul 13, 2023
a4a29b8
TestBasicScreenShooter: Fix throw_in_render_causes_graceful_failure
RAOF Jul 13, 2023
a385de4
TestBasicScreenShooter: Test threading requirements.
RAOF Jul 13, 2023
87aeeb3
BasicScreenShooter: Actually cache current_renderer
RAOF Jul 13, 2023
d593ce4
Remove unused remnants of merge-broken file
RAOF Jul 14, 2023
9d31e28
gbm-kms: Return unsupported for SW-rasterised rendering platforms.
RAOF Jul 25, 2023
aa79625
gbm-kms: Make GBM optional for KMS output.
RAOF Jul 25, 2023
ccbc38c
CPUCopyOutputSurface: Fix EGL context usage.
RAOF Jul 28, 2023
d32e781
Fix typo
AlanGriffiths Jul 28, 2023
06f516c
Building implementation of the CRTC-only smooth boot support
mattkae Sep 6, 2023
2a61739
Regenerating debian symbols
mattkae Sep 6, 2023
d926d21
Rename variable from smooth_boot to smooth_transition
mattkae Sep 6, 2023
44d563b
Setting the CRTC when there is a resolution mismatch on startup
mattkae Sep 7, 2023
397ee9a
Adding SmoothBootSupport to the demo server
mattkae Sep 7, 2023
deeb09c
Reverted the Smooth Boot flag in favor of always smooth booting
mattkae Sep 7, 2023
6898e53
Resetting some files that are now deprecated
mattkae Sep 7, 2023
804453b
Adding a check for a crtc mismatch instead of just rectangle comparing
mattkae Sep 8, 2023
0d4d85b
Getting rid of accidental spacing
mattkae Sep 8, 2023
7f5c19d
Disable the initial set of the CRTC when modes match
RAOF Sep 11, 2023
4c56281
platform: Drop `NativeBuffer` detritus
RAOF Aug 29, 2023
3cbce7a
platform/linux-dma-buf: Use DRMFormat more.
RAOF Aug 29, 2023
08203ab
platform/dma-buf: More DRMFormat usage
RAOF Aug 29, 2023
103e347
platform/DMA-buf: Handle cross-GPU buffers
RAOF Sep 12, 2023
12163f8
platform/DMA-buf: Ensure on_consumed is triggered
RAOF Sep 12, 2023
54ce2d2
platform/DMA-buf: Tiny style
RAOF Sep 12, 2023
3a226de
platforms/gbm-kms: Oops. Actually hook up DMABufEGLProvider.
RAOF Sep 14, 2023
620dd8e
platform/linux-dma-buf: More complete cross-device buffer handling.
RAOF Sep 25, 2023
1676ee5
Drop the default quirk disabling evdi (#2997)
AlanGriffiths Sep 15, 2023
3eb1e77
sphinx: add libepoxy dependency
Saviq Sep 25, 2023
171c42a
cmake: always require epoxy
Saviq Sep 25, 2023
4a56d2c
platforms/x11: Fix linux-dmabuf integration.
RAOF Sep 26, 2023
b4efda4
platform/EGLBufferCopier: Fix release of EGL resources
RAOF Oct 2, 2023
b04856c
platforms/wayland: Update to new Platform API.
RAOF Oct 2, 2023
c08fba9
platforms/wayland: Actually add new files to git 🤦‍♀️
RAOF Oct 2, 2023
feab24b
performance-tests: Explicitly select hosted driver for nested tests. …
RAOF Oct 4, 2023
dfb228b
platform/linux-dma-buf: Drop use of mir::EGLExtensions
RAOF Oct 4, 2023
80262c6
Trivial: fix trailing whitespace
RAOF Oct 4, 2023
5466884
platforms/gbm-kms: Drop some unused headers
RAOF Oct 4, 2023
4de2f93
wayland: add missing include
Saviq Oct 4, 2023
cec1335
Revert "platform/linux-dma-buf: Drop use of mir::EGLExtensions"
RAOF Oct 5, 2023
708cc58
platform/linux-dma-buf: Drop remnant libepoxy use.
RAOF Oct 5, 2023
b2b0f9e
platform/EGLBufferCopier: Drop libepoxy usage
RAOF Oct 5, 2023
4772b34
Trivial: Trailing whitespace
RAOF Oct 5, 2023
724ff80
platforms/eglstream-kms: Re-add missing Display implementation.
RAOF Oct 6, 2023
fd3f31c
graphics/probe: Tweak manually-specified display-platform selection.
RAOF Oct 6, 2023
264eb0e
platforms/eglstream-kms: Fixup.
RAOF Oct 6, 2023
35f4a39
platforms/eglstream-kms: Just the worst bug.
RAOF Oct 6, 2023
2453073
platforms/eglstream-kms: Disable eglstream acceleration for XWayland
RAOF Oct 6, 2023
3f195a9
platform/GLRenderingPlatform: Add `suitability_for_allocator()`
RAOF Oct 6, 2023
6b3b3bb
platforms/wayland: Hand-hold clang
RAOF Oct 6, 2023
d160b64
Some error logging
AlanGriffiths Oct 10, 2023
bda9447
Fix spelling
AlanGriffiths Oct 10, 2023
12ea68a
linux_dmabuf: use eglDestroyImageKHR extension (#3069)
Saviq Oct 10, 2023
330fee3
Unused headers
AlanGriffiths Oct 11, 2023
fb01be0
Bump platform ABI
AlanGriffiths Oct 11, 2023
ccc6e47
Update file headers
AlanGriffiths Oct 11, 2023
18a303c
Bunp Miroil ABI (Miroil uses `graphics::Buffer` which has changed)
AlanGriffiths Oct 11, 2023
839a0aa
Drop documentation stub
AlanGriffiths Oct 11, 2023
49bd5a5
Add a feature flag to hide hybrid capability
AlanGriffiths Oct 11, 2023
55c9c91
C++23 FTW!
AlanGriffiths Oct 12, 2023
c7c2d2b
Restore some dropped tests
AlanGriffiths Oct 12, 2023
d60bff9
Make test slightly stricter
AlanGriffiths Oct 12, 2023
a77df47
Use MOCK_METHOD constently
AlanGriffiths Oct 12, 2023
69de0d4
Better naming in the RenderingProvider class hierarchy
AlanGriffiths Oct 13, 2023
cf7376c
Better naming in RenderingPlatform
AlanGriffiths Oct 13, 2023
79622a9
Better naming in and around `RenderingPlatform::acquire_provider<>`
AlanGriffiths Oct 13, 2023
2df8871
Fix the build(?!)
RAOF Oct 16, 2023
72b1738
Merge pull request #3079 from MirServer/platform-API-merge-rename
RAOF Oct 16, 2023
36ccfe8
platforms/gbm-kms: Clean up EGL resources when destroying a GBMOutput…
RAOF Oct 16, 2023
d7ebab7
Drop dead files - these test are tests of implementation, not feature…
AlanGriffiths Oct 16, 2023
7bea001
Replace graphics::PlatformPriority with graphics::probe::Result
AlanGriffiths Oct 16, 2023
61d74cb
Rename `DisplayInterfaceBase` -> `DisplayProvider`
AlanGriffiths Oct 17, 2023
743c278
Missing header comment and header guards
AlanGriffiths Oct 17, 2023
6a40e4d
Fix the feature flag to support multiple devices on the same platform
AlanGriffiths Oct 17, 2023
63a2fd7
Adding DisplayConfigurationPolicy::confirm so that the display
mattkae Oct 17, 2023
ffac096
Merge pull request #3082
AlanGriffiths Oct 17, 2023
3d073f6
Merge remote-tracking branch 'origin/main' into platform-API-merge
AlanGriffiths Oct 18, 2023
7285052
Fixup
AlanGriffiths Oct 18, 2023
926748e
Fix for mir_performance_tests failure due to not cleaning up our disp…
mattkae Oct 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "${build_types}" FORCE)
# Enable cmake-gui to display a drop down list for CMAKE_BUILD_TYPE
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "${build_types}")

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

Expand Down Expand Up @@ -233,6 +233,7 @@ if(NOT GLM_FOUND)
endif()
pkg_check_modules(DRM REQUIRED IMPORTED_TARGET libdrm)
pkg_check_modules(EGL REQUIRED IMPORTED_TARGET egl)
pkg_check_modules(EPOXY REQUIRED IMPORTED_TARGET epoxy)
pkg_check_modules(GFlags REQUIRED IMPORTED_TARGET gflags)
pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0 gio-unix-2.0)
pkg_check_modules(GLESv2 REQUIRED IMPORTED_TARGET glesv2)
Expand Down Expand Up @@ -271,14 +272,6 @@ if (MIR_BUILD_PLATFORM_GBM_KMS)
pkg_check_modules(GBM REQUIRED IMPORTED_TARGET gbm>=11.0.0)
endif()

if (MIR_BUILD_PLATFORM_EGLSTREAM_KMS)
pkg_check_modules(EPOXY REQUIRED IMPORTED_TARGET epoxy)
endif()

if (MIR_BUILD_PLATFORM_WAYLAND)
pkg_check_modules(EPOXY REQUIRED IMPORTED_TARGET epoxy)
endif()

set(MIR_TRACEPOINT_LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/mir/tools)

mir_make_pkgconfig_variable(PKGCONFIG_LIBDIR "${CMAKE_INSTALL_LIBDIR}")
Expand Down
8 changes: 4 additions & 4 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Description: Display server for Ubuntu - server library
.
Contains the shared library needed by server applications for Mir.

Package: libmirplatform26
Package: libmirplatform27
Section: libs
Architecture: linux-any
Multi-Arch: same
Expand Down Expand Up @@ -124,7 +124,7 @@ Section: libdevel
Architecture: linux-any
Multi-Arch: same
Pre-Depends: ${misc:Pre-Depends}
Depends: libmirplatform26 (= ${binary:Version}),
Depends: libmirplatform27 (= ${binary:Version}),
libmircommon-dev (= ${binary:Version}),
libboost-program-options-dev,
${misc:Depends},
Expand Down Expand Up @@ -520,7 +520,7 @@ Description: Developer files for the Mir ABI-stable abstraction layer
Contains header files required for development using the MirAL abstraction
layer.

Package: libmiroil3
Package: libmiroil4
Section: libs
Architecture: linux-any
Multi-Arch: same
Expand All @@ -537,7 +537,7 @@ Section: libdevel
Architecture: linux-any
Multi-Arch: same
Pre-Depends: ${misc:Pre-Depends}
Depends: libmiroil3 (= ${binary:Version}),
Depends: libmiroil4 (= ${binary:Version}),
${misc:Depends},
Description: Developer files for the Mir Lomiri compatibility library
MirOil provides the Lomiri compatibility API.
Expand Down
1 change: 0 additions & 1 deletion debian/libmiroil3.install

This file was deleted.

1 change: 1 addition & 0 deletions debian/libmiroil4.install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
usr/lib/*/libmiroil.so.4
1 change: 0 additions & 1 deletion debian/libmirplatform26.install

This file was deleted.

1 change: 1 addition & 0 deletions debian/libmirplatform27.install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
usr/lib/*/libmirplatform.so.27
1 change: 1 addition & 0 deletions doc/sphinx/.readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ build:
- libboost-system-dev
- libdrm-dev
- libegl-dev
- libepoxy-dev
- libfreetype-dev
- libglib2.0-dev
- libgles2-mesa-dev
Expand Down
3 changes: 0 additions & 3 deletions include/platform/mir/graphics/buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@
#include "mir/geometry/size.h"
#include "mir_toolkit/common.h"

#include <memory>
#include <functional>

namespace mir
{
namespace graphics
Expand Down
2 changes: 1 addition & 1 deletion include/platform/mir/graphics/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class DisplaySyncGroup
/**
* Interface to the display subsystem.
*/
class Display : public renderer::gl::ContextSource
class Display
AlanGriffiths marked this conversation as resolved.
Show resolved Hide resolved
{
public:
/**
Expand Down
47 changes: 30 additions & 17 deletions include/platform/mir/graphics/display_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,24 @@ namespace mir
namespace graphics
{

class Buffer;
class Framebuffer;
class DisplayInterfaceProvider;

class NativeDisplayBuffer
struct DisplayElement
{
protected:
NativeDisplayBuffer() = default;
virtual ~NativeDisplayBuffer() = default;
NativeDisplayBuffer(NativeDisplayBuffer const&) = delete;
NativeDisplayBuffer operator=(NativeDisplayBuffer const&) = delete;
/// Position and size of this element on-screen
geometry::Rectangle screen_positon;
/** Position and size of region of the buffer to sample from
*
* This will typically be (0,0) ->(buffer width, buffer height)
* to use the whole buffer (with screen_position.size = (buffer width, buffer height)).
*
* Scaling can be specified by having screen_position.size != source_position.size,
* clipping can be specified by having source_position.size != buffer.size
*/
geometry::RectangleF source_position;
std::shared_ptr<Framebuffer> buffer;
};

/**
* Interface to an output framebuffer.
*/
Expand All @@ -64,7 +71,20 @@ class DisplayBuffer
* caller should then render the list another way using a graphics
* library such as OpenGL.
**/
virtual bool overlay(RenderableList const& renderlist) = 0;
virtual bool overlay(std::vector<DisplayElement> const& renderlist) = 0;

/**
* Set the content for the next submission of this display
*
* This is basically a specialisation of overlay(), above, with extra constraints
* and guarantees. Namely:
* * The Framebuffer must be exactly view_area().size big, and
* * The DisplayPlatform guarantees that this call will succeed with a framebuffer
* allocated for this DisplayBuffer
*
* \param content
*/
virtual void set_next_image(std::unique_ptr<Framebuffer> content) = 0;

/**
* Returns a transformation that the renderer must apply to all rendering.
Expand All @@ -75,14 +95,7 @@ class DisplayBuffer
*/
virtual glm::mat2 transformation() const = 0;

/** Returns a pointer to the native display buffer object backing this
* display buffer.
*
* The pointer to the native display buffer remains valid as long as the
* display buffer object is valid.
*/
virtual NativeDisplayBuffer* native_display_buffer() = 0;

virtual auto display_provider() const -> std::shared_ptr<DisplayInterfaceProvider> = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. There's a mismatch between the function name and the type returned
  2. Could probably use a doc comment to clarify

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm tempted to rename the function to display_interface_provider(), but I'm not convinced that "Interface" conveys anything useful.

protected:
DisplayBuffer() = default;
DisplayBuffer(DisplayBuffer const& c) = delete;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class DisplayConfigurationPolicy
virtual ~DisplayConfigurationPolicy() = default;

virtual void apply_to(DisplayConfiguration& conf) = 0;
virtual void confirm(DisplayConfiguration const& conf) = 0;

protected:
DisplayConfigurationPolicy() = default;
Expand Down
8 changes: 6 additions & 2 deletions include/platform/mir/graphics/dmabuf_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@
#include <optional>

#include "mir/graphics/buffer.h"
#include "mir/graphics/texture.h"
#include "mir/fd.h"

namespace mir
{
namespace graphics
{
class DRMFormat;
/**
* A logical buffer backed by one-or-more dmabuf buffers
*/
Expand All @@ -42,9 +44,9 @@ class DMABufBuffer : public NativeBufferBase
virtual ~DMABufBuffer() = default;

/**
* The format of this logical buffer, as in <drm_fourcc.h>
* The format of this logical buffer
*/
virtual auto drm_fourcc() const -> uint32_t = 0;
virtual auto format() const -> DRMFormat = 0;

/**
* The DRM modifier of this logical buffer, if specified.
Expand All @@ -57,6 +59,8 @@ class DMABufBuffer : public NativeBufferBase

virtual auto planes() const -> std::vector<PlaneDescriptor> const& = 0;

virtual auto layout() const -> gl::Texture::Layout = 0;

virtual auto size() const -> geometry::Size = 0;
};
}
Expand Down
2 changes: 2 additions & 0 deletions include/platform/mir/graphics/drm_formats.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ class DRMFormat
operator uint32_t() const;

auto as_mir_format() const -> std::optional<MirPixelFormat>;
static auto from_mir_format(MirPixelFormat format) -> DRMFormat;

struct FormatInfo;
private:
FormatInfo const* info;
Expand Down
11 changes: 10 additions & 1 deletion include/platform/mir/graphics/egl_extensions.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,17 @@ struct EGLExtensions
PFNEGLQUERYDMABUFFORMATSEXTPROC const eglQueryDmaBufFormatsExt;
PFNEGLQUERYDMABUFMODIFIERSEXTPROC const eglQueryDmaBufModifiersExt;
};
};

struct MESADmaBufExport
{
MESADmaBufExport(EGLDisplay dpy);

static auto extension_if_supported(EGLDisplay dpy) -> std::optional<MESADmaBufExport>;

PFNEGLEXPORTDMABUFIMAGEMESAPROC const eglExportDMABUFImageMESA;
PFNEGLEXPORTDMABUFIMAGEQUERYMESAPROC const eglExportDMABUFImageQueryMESA;
};
};
}
}

Expand Down
2 changes: 1 addition & 1 deletion include/platform/mir/graphics/graphic_buffer_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class GraphicBufferAllocator
* Deinitialise the BufferAllocator for this Wayland display
*
* This should do whatever is required to clean up before the Wayland loop is stopped. For
* example, calling eglUnindWaylandDisplayWL.
* example, calling eglUnbindWaylandDisplayWL.
*
* \param display [in] The Wayland display to unbind from
*/
Expand Down
68 changes: 58 additions & 10 deletions include/platform/mir/graphics/linux_dmabuf.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@
#include "linux-dmabuf-unstable-v1_wrapper.h"

#include <EGL/egl.h>
#include <memory>
#include <span>

#include "mir/graphics/buffer.h"
#include "mir/graphics/drm_formats.h"
#include "mir/graphics/egl_extensions.h"


namespace mir
{
namespace renderer
Expand All @@ -38,35 +40,81 @@ class Context;

namespace graphics
{
namespace gl
{
class Texture;
}

namespace common
{
class EGLContextExecutor;
}

class DmaBufFormatDescriptors;
class DMABufBuffer;
class EGLBufferCopier;

class DMABufEGLProvider : public std::enable_shared_from_this<DMABufEGLProvider>
{
public:
using EGLImageAllocator =
std::function<std::shared_ptr<DMABufBuffer>(DRMFormat, std::span<uint64_t const>, geometry::Size)>;
DMABufEGLProvider(
EGLDisplay dpy,
std::shared_ptr<EGLExtensions> egl_extensions,
EGLExtensions::EXTImageDmaBufImportModifiers const& dmabuf_ext,
std::shared_ptr<common::EGLContextExecutor> egl_delegate,
EGLImageAllocator allocate_importable_image);

~DMABufEGLProvider();

auto import_dma_buf(
DMABufBuffer const& dma_buf,
std::function<void()>&& on_consumed,
std::function<void()>&& on_release)
-> std::shared_ptr<Buffer>;

/**
* Validate that this provider *can* import this DMA-BUF
*
* @param dma_buf
* \throws EGL exception on failure
*/
void validate_import(DMABufBuffer const& dma_buf);

auto as_texture(
std::shared_ptr<Buffer> buffer)
-> std::shared_ptr<gl::Texture>;

auto supported_formats() const -> DmaBufFormatDescriptors const&;
private:
EGLDisplay const dpy;
std::shared_ptr<EGLExtensions> const egl_extensions;
std::optional<EGLExtensions::MESADmaBufExport> const dmabuf_export_ext;
std::unique_ptr<DmaBufFormatDescriptors> const formats;
std::shared_ptr<common::EGLContextExecutor> const egl_delegate;
EGLImageAllocator allocate_importable_image;
std::unique_ptr<EGLBufferCopier> const blitter;
};

class LinuxDmaBufUnstable : public mir::wayland::LinuxDmabufV1::Global
{
public:
LinuxDmaBufUnstable(
wl_display* display,
EGLDisplay dpy,
std::shared_ptr<EGLExtensions> egl_extensions,
EGLExtensions::EXTImageDmaBufImportModifiers const& dmabuf_ext);
std::shared_ptr<DMABufEGLProvider> provider);

std::shared_ptr<Buffer> buffer_from_resource(
auto buffer_from_resource(
wl_resource* buffer,
std::function<void()>&& on_consumed,
std::function<void()>&& on_release,
std::shared_ptr<common::EGLContextExecutor> egl_delegate);

std::shared_ptr<common::EGLContextExecutor> egl_delegate)
-> std::shared_ptr<Buffer>;
private:
class Instance;
void bind(wl_resource* new_resource) override;

EGLDisplay const dpy;
std::shared_ptr<EGLExtensions> const egl_extensions;
std::shared_ptr<DmaBufFormatDescriptors> const formats;
std::shared_ptr<DMABufEGLProvider> const provider;
};

}
Expand Down
Loading
Loading