Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
8b17b32
Improve `gbm_bo_with_modifiers_or_linear` to handle nvidia when alloc…
tarek-y-ismail Jan 15, 2026
9a3b8fc
Modify `as_texture` to accept a `Buffer` instead `NativeBufferBase`
tarek-y-ismail Jan 16, 2026
c3823db
Always do cross-GPU copies through the CPU. Remove unused code
tarek-y-ismail Jan 16, 2026
ee9a17e
Pass information to `DMABufEGLProvider` to enable CPU transfer on nvidia
tarek-y-ismail Jan 16, 2026
6cd0cc4
Remove duplicate header include block
tarek-y-ismail Jan 19, 2026
3b57d89
Fix typo in error message
tarek-y-ismail Jan 19, 2026
e3a8751
Fix inveerted `DRM_FORMAT_MOD_LINEAR` check in
tarek-y-ismail Jan 19, 2026
6a02801
Remove `export_egl_image`
tarek-y-ismail Jan 19, 2026
c64558a
Revert "Remove `export_egl_image`"
tarek-y-ismail Jan 19, 2026
d2165e7
Refactor `get_gl_pixel_format` to return an optional "pair"
tarek-y-ismail Jan 19, 2026
b3a4516
Take parent pixel format into account when constructing a `GLMapping`
tarek-y-ismail Jan 19, 2026
20d595c
Fix incorrect closing paren in quirk format error message.
tarek-y-ismail Jan 19, 2026
9ba59cb
Use explicit types for gbm_bo allocation functions
tarek-y-ismail Jan 19, 2026
5bb1f40
Fix switch statement whitespace.
tarek-y-ismail Jan 19, 2026
f253e9d
Fix swapped source and importing dpy/vendor
tarek-y-ismail Jan 19, 2026
dcec51a
Change the buffer transfer strategy based on both source and importing
tarek-y-ismail Jan 19, 2026
5e6eeca
pre-commit: apply automatic fixes
pre-commit-ci-lite[bot] Jan 19, 2026
9a4334e
Fix crash caused by constantly querying DRM names
tarek-y-ismail Jan 19, 2026
1a04fce
Remove unused `VendorPairTransferStrategy::get_strategy`
tarek-y-ismail Jan 19, 2026
8372373
Better error handling in `egl_display_to_drm_name`
tarek-y-ismail Jan 19, 2026
cd4da4f
Merge branch 'main' into MIRENG-1289/fix-warping-on-nvidia-atomic-kms
tarek-y-ismail Jan 20, 2026
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
39 changes: 28 additions & 11 deletions include/platform/mir/graphics/linux_dmabuf.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,23 @@ 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)>;

enum class BufferTransferStrategy
{
cpu,
dma,
};

using TransferStrategySelector =
std::function<BufferTransferStrategy(std::string_view source_vendor, std::string_view dest_vendor)>;

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);
EGLImageAllocator allocate_importable_image,
TransferStrategySelector strategy_selector);

~DMABufEGLProvider();

Expand All @@ -85,19 +96,25 @@ class DMABufEGLProvider : public std::enable_shared_from_this<DMABufEGLProvider>
void validate_import(DMABufBuffer const& dma_buf);

auto as_texture(
std::shared_ptr<NativeBufferBase> buffer)
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;
dev_t const devnum_;
std::unique_ptr<DmaBufFormatDescriptors> const formats;
std::shared_ptr<common::EGLContextExecutor> const egl_delegate;
EGLImageAllocator allocate_importable_image;
std::unique_ptr<EGLBufferCopier> const blitter;
private:
class DmabufTexBuffer;
auto cpu_transfer(std::shared_ptr<DmabufTexBuffer> const& dmabuf_tex) -> std::shared_ptr<gl::Texture>;
auto dma_transfer(std::shared_ptr<DmabufTexBuffer> const& dmabuf_tex) -> std::shared_ptr<gl::Texture>;

EGLDisplay const dpy;
std::string const vendor_drm_name;
std::shared_ptr<EGLExtensions> const egl_extensions;
std::optional<EGLExtensions::MESADmaBufExport> const dmabuf_export_ext;
dev_t const devnum_;
std::unique_ptr<DmaBufFormatDescriptors> const formats;
std::shared_ptr<common::EGLContextExecutor> const egl_delegate;
EGLImageAllocator allocate_importable_image;
std::unique_ptr<EGLBufferCopier> const blitter;
TransferStrategySelector const strategy_selector_;
};

class LinuxDmaBuf : public mir::wayland::LinuxDmabufV1::Global
Expand Down
18 changes: 15 additions & 3 deletions include/platform/mir/graphics/quirk_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@

#include <mir/udev/wrapper.h>

#include <algorithm>
#include <optional>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
Expand Down Expand Up @@ -54,7 +52,21 @@ struct ValuedOption
std::unordered_map<std::string, std::string> devnodes;
};

auto validate_structure(std::vector<std::string> const& tokens, std::set<std::string> const& available_options)
struct OptionStructure
{
static auto freeform(size_t expected_tokens) -> OptionStructure
{
return {
.expected_token_count = expected_tokens,
.check_specifiers = false,
};
}

size_t const expected_token_count{3}; // option name, specifier, specifier value
bool const check_specifiers{true};
};

auto validate_structure(std::vector<std::string> const& tokens, std::unordered_map<std::string, OptionStructure> const& available_options)
-> std::optional<std::tuple<std::string, std::string, std::string>>;

auto matches(std::vector<std::string> tokens, std::string option_name, std::initializer_list<std::string> valid_values)
Expand Down
Loading
Loading