#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include <wayland-drm-client-protocol.h>
#include <fcntl.h>
#include <xf86drm.h>
#include "base/files/scoped_file.h"
#include "base/logging.h"
#include "ui/gfx/buffer_format_util.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"
#include "ui/ozone/platform/wayland/host/wayland_drm.h"
#include "wayland-util.h"
namespace ui {
namespace {
constexpr uint32_t kMinVersion = …;
}
constexpr char WaylandDrm::kInterfaceName[];
void WaylandDrm::Instantiate(WaylandConnection* connection,
wl_registry* registry,
uint32_t name,
const std::string& interface,
uint32_t version) { … }
WaylandDrm::WaylandDrm(wl_drm* drm, WaylandConnection* connection)
: … { … }
WaylandDrm::~WaylandDrm() = default;
bool WaylandDrm::SupportsDrmPrime() const { … }
void WaylandDrm::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 WaylandDrm::CanCreateBufferImmed() const { … }
void WaylandDrm::HandleDrmFailure(const std::string& error) { … }
void WaylandDrm::AddSupportedFourCCFormat(uint32_t fourcc_format) { … }
void WaylandDrm::Authenticate(const char* drm_device_path) { … }
void WaylandDrm::DrmDeviceAuthenticated(wl_drm* drm) { … }
void WaylandDrm::HandleCapabilities(uint32_t value) { … }
void WaylandDrm::OnDevice(void* data, wl_drm* drm, const char* path) { … }
void WaylandDrm::OnFormat(void* data, wl_drm* drm, uint32_t format) { … }
void WaylandDrm::OnAuthenticated(void* data, wl_drm* drm) { … }
void WaylandDrm::OnCapabilities(void* data, wl_drm* drm, uint32_t value) { … }
}