#include "libANGLE/renderer/vulkan/linux/DmaBufImageSiblingVkLinux.h"
#include "common/linux/dma_buf_utils.h"
#include "libANGLE/Display.h"
#include "libANGLE/renderer/vulkan/DisplayVk.h"
#include "libANGLE/renderer/vulkan/vk_renderer.h"
#include <fcntl.h>
namespace rx
{
namespace
{
constexpr uint32_t kMaxPlaneCount = …;
PerPlane;
constexpr PerPlane<EGLenum> kFds = …;
constexpr PerPlane<EGLenum> kOffsets = …;
constexpr PerPlane<EGLenum> kPitches = …;
constexpr PerPlane<EGLenum> kModifiersLo = …;
constexpr PerPlane<EGLenum> kModifiersHi = …;
constexpr VkImageUsageFlags kTransferUsage = …;
constexpr VkImageUsageFlags kTextureUsage = …;
constexpr VkImageUsageFlags kRenderUsage = …;
constexpr VkImageUsageFlags kRenderAndInputUsage = …;
struct AllocateInfo
{ … };
uint32_t GetPlaneCount(const egl::AttributeMap &attribs)
{ … }
uint64_t GetModifier(const egl::AttributeMap &attribs, EGLenum lo, EGLenum hi)
{ … }
void GetModifiers(const egl::AttributeMap &attribs,
uint32_t planeCount,
PerPlane<uint64_t> *drmModifiersOut)
{ … }
bool GetFormatModifierProperties(DisplayVk *displayVk,
VkFormat vkFormat,
uint64_t drmModifier,
VkDrmFormatModifierPropertiesEXT *modifierPropertiesOut)
{ … }
VkImageUsageFlags GetUsageFlags(vk::Renderer *renderer,
const angle::Format &format,
const VkDrmFormatModifierPropertiesEXT &properties,
bool *texturableOut,
bool *renderableOut)
{ … }
bool IsFormatSupported(vk::Renderer *renderer,
VkFormat vkFormat,
uint64_t drmModifier,
VkImageUsageFlags usageFlags,
VkImageCreateFlags createFlags,
VkImageFormatListCreateInfoKHR imageFormatListInfo,
VkImageFormatProperties2 *imageFormatPropertiesOut)
{ … }
VkChromaLocation GetChromaLocation(const egl::AttributeMap &attribs, EGLenum hint)
{ … }
VkSamplerYcbcrModelConversion GetYcbcrModel(const egl::AttributeMap &attribs)
{ … }
VkSamplerYcbcrRange GetYcbcrRange(const egl::AttributeMap &attribs)
{ … }
angle::Result GetAllocateInfo(const egl::AttributeMap &attribs,
VkImage image,
uint32_t planeCount,
const VkDrmFormatModifierPropertiesEXT &properties,
AllocateInfo *infoOut,
uint32_t *infoCountOut)
{ … }
}
DmaBufImageSiblingVkLinux::DmaBufImageSiblingVkLinux(const egl::AttributeMap &attribs)
: … { … }
DmaBufImageSiblingVkLinux::~DmaBufImageSiblingVkLinux() { … }
egl::Error DmaBufImageSiblingVkLinux::initialize(const egl::Display *display)
{ … }
VkImageUsageFlags FindSupportedUsageFlagsForFormat(
vk::Renderer *renderer,
VkFormat format,
uint64_t drmModifier,
VkImageFormatListCreateInfo imageFormatListCreateInfo,
VkImageUsageFlags usageFlags,
VkImageCreateFlags createFlags,
VkImageFormatProperties2 *outImageFormatProperties)
{ … }
bool FindSupportedFlagsForFormat(vk::Renderer *renderer,
VkFormat format,
uint64_t drmModifier,
VkImageFormatListCreateInfo imageFormatListCreateInfo,
VkImageUsageFlags *outUsageFlags,
VkImageCreateFlags createFlags,
VkImageFormatProperties2 *outImageFormatProperties)
{ … }
angle::Result DmaBufImageSiblingVkLinux::initWithFormat(DisplayVk *displayVk,
const angle::Format &format,
VkFormat vulkanFormat,
MutableFormat mutableFormat,
InitResult *initResultOut)
{ … }
angle::Result DmaBufImageSiblingVkLinux::initImpl(DisplayVk *displayVk)
{ … }
void DmaBufImageSiblingVkLinux::onDestroy(const egl::Display *display)
{ … }
gl::Format DmaBufImageSiblingVkLinux::getFormat() const
{ … }
bool DmaBufImageSiblingVkLinux::isRenderable(const gl::Context *context) const
{ … }
bool DmaBufImageSiblingVkLinux::isTexturable(const gl::Context *context) const
{ … }
bool DmaBufImageSiblingVkLinux::isYUV() const
{ … }
bool DmaBufImageSiblingVkLinux::hasProtectedContent() const
{ … }
gl::Extents DmaBufImageSiblingVkLinux::getSize() const
{ … }
size_t DmaBufImageSiblingVkLinux::getSamples() const
{ … }
vk::ImageHelper *DmaBufImageSiblingVkLinux::getImage() const
{ … }
void DmaBufImageSiblingVkLinux::release(vk::Renderer *renderer)
{ … }
}