get dma formats from aq

This commit is contained in:
Vaxry 2024-06-26 22:35:22 +02:00
parent 00a8171643
commit 65a16b84fc
5 changed files with 14 additions and 12 deletions

View file

@ -2,6 +2,7 @@
#include <cstdint>
#include "math/Math.hpp"
#include <aquamarine/backend/Misc.hpp>
typedef uint32_t DRMFormat;
typedef uint32_t SHMFormat;
@ -18,10 +19,7 @@ struct SPixelFormat {
Vector2D blockSize;
};
struct SDRMFormat {
DRMFormat format = 0; /* DRM_FORMAT_INVALID */
std::vector<uint64_t> mods;
};
typedef Aquamarine::SDRMFormat SDRMFormat;
namespace FormatUtils {
SHMFormat drmToShm(DRMFormat drm);

View file

@ -26,8 +26,8 @@ CCompiledDMABUFFeedback::CCompiledDMABUFFeedback(dev_t device, std::vector<SDMAB
std::set<std::pair<uint32_t, uint64_t>> formats;
for (auto& t : tranches_) {
for (auto& fmt : t.formats) {
for (auto& mod : fmt.mods) {
formats.insert(std::make_pair<>(fmt.format, mod));
for (auto& mod : fmt.modifiers) {
formats.insert(std::make_pair<>(fmt.drmFormat, mod));
}
}
}
@ -387,11 +387,16 @@ CLinuxDMABufV1Protocol::CLinuxDMABufV1Protocol(const wl_interface* iface, const
mainDevice = *dev;
auto fmts = g_pHyprOpenGL->getDRMFormats();
// FIXME: this will break on multi-gpu
std::vector<Aquamarine::SDRMFormat> aqFormats;
for (auto& impl : g_pCompositor->m_pAqBackend->getImplementations()) {
aqFormats = impl->getRenderFormats();
break;
}
SDMABufTranche tranche = {
.device = *dev,
.formats = fmts,
.formats = aqFormats,
};
std::vector<SDMABufTranche> tches;

View file

@ -10,7 +10,6 @@
#include <aquamarine/buffer/Buffer.hpp>
class CDMABuffer;
struct SDRMFormat;
class CWLSurfaceResource;
class CLinuxDMABuffer {

View file

@ -87,7 +87,7 @@ CMesaDRMResource::CMesaDRMResource(SP<CWlDrm> resource_) : resource(resource_) {
auto fmts = g_pHyprOpenGL->getDRMFormats();
for (auto& fmt : fmts) {
resource->sendFormat(fmt.format);
resource->sendFormat(fmt.drmFormat);
}
}

View file

@ -344,8 +344,8 @@ void CHyprOpenGLImpl::initDRMFormats() {
mods.push_back(DRM_FORMAT_MOD_INVALID);
dmaFormats.push_back(SDRMFormat{
.format = fmt,
.mods = mods,
.drmFormat = fmt,
.modifiers = mods,
});
std::vector<std::pair<uint64_t, std::string>> modifierData;