#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "ui/gfx/linux/gbm_wrapper.h"
#include <gbm.h>
#include <memory>
#include <utility>
#include <vector>
#include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/raw_ptr_exclusion.h"
#include "base/numerics/safe_conversions.h"
#include "base/posix/eintr_wrapper.h"
#include "skia/ext/legacy_display_globals.h"
#include "third_party/skia/include/core/SkSurface.h"
#include "ui/gfx/buffer_format_util.h"
#include "ui/gfx/linux/drm_util_linux.h"
#include "ui/gfx/linux/gbm_buffer.h"
#include "ui/gfx/linux/gbm_device.h"
#include "ui/gfx/linux/scoped_gbm_device.h"
#if !defined(MINIGBM)
#include <dlfcn.h>
#include <fcntl.h>
#include <xf86drm.h>
#include "base/strings/stringize_macros.h"
#endif
namespace ui {
namespace gbm_wrapper {
namespace {
uint32_t GetHandleForPlane(struct gbm_bo* bo, int plane) { … }
uint32_t GetStrideForPlane(struct gbm_bo* bo, int plane) { … }
uint32_t GetOffsetForPlane(struct gbm_bo* bo, int plane) { … }
int GetPlaneCount(struct gbm_bo* bo) { … }
base::ScopedFD GetPlaneFdForBo(gbm_bo* bo, size_t plane) { … }
size_t GetSizeOfPlane(gbm_bo* bo,
uint32_t format,
const gfx::Size& size,
size_t plane) { … }
}
class Buffer final : public ui::GbmBuffer { … };
std::unique_ptr<Buffer> CreateBufferForBO(struct gbm_bo* bo,
uint32_t format,
const gfx::Size& size,
uint32_t flags) { … }
class Device final : public ui::GbmDevice { … };
}
std::unique_ptr<GbmDevice> CreateGbmDevice(int fd) { … }
}