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,13 +24,11 @@ static std::optional<dev_t> devIDFromFD(int fd) {
CCompiledDMABUFFeedback::CCompiledDMABUFFeedback(dev_t device, std::vector<SDMABufTranche> tranches_) { CCompiledDMABUFFeedback::CCompiledDMABUFFeedback(dev_t device, std::vector<SDMABufTranche> tranches_) {
std::set<std::pair<uint32_t, uint64_t>> formats; std::set<std::pair<uint32_t, uint64_t>> formats;
for (auto& t : tranches_) { for (auto& fmt : g_pHyprOpenGL->getDRMFormats()) {
for (auto& fmt : t.formats) {
for (auto& mod : fmt.modifiers) { for (auto& mod : fmt.modifiers) {
formats.insert(std::make_pair<>(fmt.drmFormat, mod)); formats.insert(std::make_pair<>(fmt.drmFormat, mod));
} }
} }
}
tableLen = formats.size() * sizeof(SDMABUFFeedbackTableEntry); tableLen = formats.size() * sizeof(SDMABUFFeedbackTableEntry);
int fds[2] = {0}; int fds[2] = {0};

View file

@ -60,10 +60,27 @@ CMesaDRMResource::CMesaDRMResource(SP<CWlDrm> resource_) : resource(resource_) {
return; 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; Aquamarine::SDMABUFAttrs attrs;
attrs.success = true; attrs.success = true;
attrs.size = {w, h}; attrs.size = {w, h};
attrs.modifier = DRM_FORMAT_MOD_INVALID; attrs.modifier = mod;
attrs.planes = 1; attrs.planes = 1;
attrs.offsets[0] = off0; attrs.offsets[0] = off0;
attrs.strides[0] = str0; attrs.strides[0] = str0;