some format fixes

This commit is contained in:
Vaxry 2024-07-01 19:23:09 +02:00
parent 012235b332
commit 16a2cb4ffc
2 changed files with 21 additions and 6 deletions

View file

@ -24,11 +24,9 @@ static std::optional<dev_t> devIDFromFD(int fd) {
CCompiledDMABUFFeedback::CCompiledDMABUFFeedback(dev_t device, std::vector<SDMABufTranche> tranches_) {
std::set<std::pair<uint32_t, uint64_t>> formats;
for (auto& t : tranches_) {
for (auto& fmt : t.formats) {
for (auto& mod : fmt.modifiers) {
formats.insert(std::make_pair<>(fmt.drmFormat, mod));
}
for (auto& fmt : g_pHyprOpenGL->getDRMFormats()) {
for (auto& mod : fmt.modifiers) {
formats.insert(std::make_pair<>(fmt.drmFormat, mod));
}
}

View file

@ -60,10 +60,27 @@ CMesaDRMResource::CMesaDRMResource(SP<CWlDrm> resource_) : resource(resource_) {
return;
}
uint64_t mod = DRM_FORMAT_MOD_INVALID;
auto fmts = g_pHyprOpenGL->getDRMFormats();
for (auto& f : fmts) {
if (f.drmFormat != fmt)
continue;
for (auto& m : f.modifiers) {
if (m == DRM_FORMAT_MOD_LINEAR)
continue;
mod = m;
break;
}
break;
}
Aquamarine::SDMABUFAttrs attrs;
attrs.success = true;
attrs.size = {w, h};
attrs.modifier = DRM_FORMAT_MOD_INVALID;
attrs.modifier = mod;
attrs.planes = 1;
attrs.offsets[0] = off0;
attrs.strides[0] = str0;