2024-06-08 10:07:59 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <cstdint>
|
2024-07-21 13:09:54 +02:00
|
|
|
#include <string>
|
2024-06-19 16:20:06 +02:00
|
|
|
#include "math/Math.hpp"
|
2024-07-21 13:09:54 +02:00
|
|
|
#include <aquamarine/backend/Misc.hpp>
|
2024-06-08 10:07:59 +02:00
|
|
|
|
|
|
|
typedef uint32_t DRMFormat;
|
|
|
|
typedef uint32_t SHMFormat;
|
|
|
|
|
|
|
|
struct SPixelFormat {
|
|
|
|
DRMFormat drmFormat = 0; /* DRM_FORMAT_INVALID */
|
|
|
|
bool flipRB = false;
|
|
|
|
int glInternalFormat = 0;
|
|
|
|
int glFormat = 0;
|
|
|
|
int glType = 0;
|
|
|
|
bool withAlpha = true;
|
|
|
|
DRMFormat alphaStripped = 0; /* DRM_FORMAT_INVALID */
|
|
|
|
uint32_t bytesPerBlock = 0;
|
|
|
|
Vector2D blockSize;
|
|
|
|
};
|
|
|
|
|
2024-07-21 13:09:54 +02:00
|
|
|
typedef Aquamarine::SDRMFormat SDRMFormat;
|
2024-06-08 10:07:59 +02:00
|
|
|
|
|
|
|
namespace FormatUtils {
|
|
|
|
SHMFormat drmToShm(DRMFormat drm);
|
|
|
|
DRMFormat shmToDRM(SHMFormat shm);
|
|
|
|
|
|
|
|
const SPixelFormat* getPixelFormatFromDRM(DRMFormat drm);
|
|
|
|
const SPixelFormat* getPixelFormatFromGL(uint32_t glFormat, uint32_t glType, bool alpha);
|
|
|
|
bool isFormatOpaque(DRMFormat drm);
|
|
|
|
int pixelsPerBlock(const SPixelFormat* const fmt);
|
|
|
|
int minStride(const SPixelFormat* const fmt, int32_t width);
|
|
|
|
uint32_t drmFormatToGL(DRMFormat drm);
|
|
|
|
uint32_t glFormatToType(uint32_t gl);
|
2024-07-21 13:09:54 +02:00
|
|
|
std::string drmFormatName(DRMFormat drm);
|
|
|
|
std::string drmModifierName(uint64_t mod);
|
2024-06-08 10:07:59 +02:00
|
|
|
};
|