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 <cstdint>
#include "math/Math.hpp" #include "math/Math.hpp"
#include <aquamarine/backend/Misc.hpp>
typedef uint32_t DRMFormat; typedef uint32_t DRMFormat;
typedef uint32_t SHMFormat; typedef uint32_t SHMFormat;
@ -18,10 +19,7 @@ struct SPixelFormat {
Vector2D blockSize; Vector2D blockSize;
}; };
struct SDRMFormat { typedef Aquamarine::SDRMFormat SDRMFormat;
DRMFormat format = 0; /* DRM_FORMAT_INVALID */
std::vector<uint64_t> mods;
};
namespace FormatUtils { namespace FormatUtils {
SHMFormat drmToShm(DRMFormat drm); 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; std::set<std::pair<uint32_t, uint64_t>> formats;
for (auto& t : tranches_) { for (auto& t : tranches_) {
for (auto& fmt : t.formats) { for (auto& fmt : t.formats) {
for (auto& mod : fmt.mods) { for (auto& mod : fmt.modifiers) {
formats.insert(std::make_pair<>(fmt.format, mod)); formats.insert(std::make_pair<>(fmt.drmFormat, mod));
} }
} }
} }
@ -387,11 +387,16 @@ CLinuxDMABufV1Protocol::CLinuxDMABufV1Protocol(const wl_interface* iface, const
mainDevice = *dev; 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 = { SDMABufTranche tranche = {
.device = *dev, .device = *dev,
.formats = fmts, .formats = aqFormats,
}; };
std::vector<SDMABufTranche> tches; std::vector<SDMABufTranche> tches;

View file

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

View file

@ -87,7 +87,7 @@ CMesaDRMResource::CMesaDRMResource(SP<CWlDrm> resource_) : resource(resource_) {
auto fmts = g_pHyprOpenGL->getDRMFormats(); auto fmts = g_pHyprOpenGL->getDRMFormats();
for (auto& fmt : fmts) { 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); mods.push_back(DRM_FORMAT_MOD_INVALID);
dmaFormats.push_back(SDRMFormat{ dmaFormats.push_back(SDRMFormat{
.format = fmt, .drmFormat = fmt,
.mods = mods, .modifiers = mods,
}); });
std::vector<std::pair<uint64_t, std::string>> modifierData; std::vector<std::pair<uint64_t, std::string>> modifierData;