#include "ui/ozone/platform/wayland/host/wayland_zwp_linux_dmabuf.h"
#include <drm_fourcc.h>
#include <linux-dmabuf-unstable-v1-client-protocol.h>
#include "base/logging.h"
#include "base/not_fatal_until.h"
#include "base/ranges/algorithm.h"
#include "ui/gfx/linux/drm_util_linux.h"
#include "ui/ozone/platform/wayland/host/wayland_buffer_factory.h"
#include "ui/ozone/platform/wayland/host/wayland_connection.h"
namespace ui {
namespace {
constexpr uint32_t kMinVersion = …;
constexpr uint32_t kMaxVersion = …;
}
constexpr char WaylandZwpLinuxDmabuf::kInterfaceName[];
void WaylandZwpLinuxDmabuf::Instantiate(WaylandConnection* connection,
wl_registry* registry,
uint32_t name,
const std::string& interface,
uint32_t version) { … }
WaylandZwpLinuxDmabuf::WaylandZwpLinuxDmabuf(
zwp_linux_dmabuf_v1* zwp_linux_dmabuf,
WaylandConnection* connection)
: … { … }
WaylandZwpLinuxDmabuf::~WaylandZwpLinuxDmabuf() = default;
void WaylandZwpLinuxDmabuf::CreateBuffer(const base::ScopedFD& fd,
const gfx::Size& size,
const std::vector<uint32_t>& strides,
const std::vector<uint32_t>& offsets,
const std::vector<uint64_t>& modifiers,
uint32_t format,
uint32_t planes_count,
wl::OnRequestBufferCallback callback) { … }
bool WaylandZwpLinuxDmabuf::CanCreateBufferImmed() const { … }
void WaylandZwpLinuxDmabuf::AddSupportedFourCCFormatAndModifier(
uint32_t fourcc_format,
std::optional<uint64_t> modifier) { … }
void WaylandZwpLinuxDmabuf::NotifyRequestCreateBufferDone(
zwp_linux_buffer_params_v1* params,
wl_buffer* new_buffer) { … }
void WaylandZwpLinuxDmabuf::OnModifiers(void* data,
zwp_linux_dmabuf_v1* linux_dmabuf,
uint32_t format,
uint32_t modifier_hi,
uint32_t modifier_lo) { … }
void WaylandZwpLinuxDmabuf::OnFormat(void* data,
zwp_linux_dmabuf_v1* linux_dmabuf,
uint32_t format) { … }
void WaylandZwpLinuxDmabuf::OnCreated(void* data,
zwp_linux_buffer_params_v1* params,
wl_buffer* new_buffer) { … }
void WaylandZwpLinuxDmabuf::OnFailed(void* data,
zwp_linux_buffer_params_v1* params) { … }
}