mirror of
https://github.com/hyprwm/Hyprland
synced 2024-12-25 08:09:51 +01:00
ds fixes
This commit is contained in:
parent
76b8be2349
commit
f472dcd67b
1 changed files with 19 additions and 9 deletions
|
@ -25,7 +25,7 @@ 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& fmt : g_pHyprOpenGL->getDRMFormats()) {
|
for (auto& fmt : tranches_.at(0).formats /* FIXME: multigpu */) {
|
||||||
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));
|
||||||
}
|
}
|
||||||
|
@ -48,11 +48,12 @@ CCompiledDMABUFFeedback::CCompiledDMABUFFeedback(dev_t device, std::vector<SDMAB
|
||||||
|
|
||||||
std::vector<std::pair<uint32_t, uint64_t>> formatsVec;
|
std::vector<std::pair<uint32_t, uint64_t>> formatsVec;
|
||||||
for (auto& f : formats) {
|
for (auto& f : formats) {
|
||||||
formatsVec.push_back(f);
|
formatsVec.emplace_back(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
for (auto& [fmt, mod] : formatsVec) {
|
for (auto& [fmt, mod] : formatsVec) {
|
||||||
|
LOGM(TRACE, "Feedback: format table index {}: fmt {} mod {}", i, FormatUtils::drmFormatName(fmt), mod);
|
||||||
arr[i++] = SDMABUFFeedbackTableEntry{
|
arr[i++] = SDMABUFFeedbackTableEntry{
|
||||||
.fmt = fmt,
|
.fmt = fmt,
|
||||||
.modifier = mod,
|
.modifier = mod,
|
||||||
|
@ -64,8 +65,6 @@ CCompiledDMABUFFeedback::CCompiledDMABUFFeedback(dev_t device, std::vector<SDMAB
|
||||||
mainDevice = device;
|
mainDevice = device;
|
||||||
tableFD = fds[1];
|
tableFD = fds[1];
|
||||||
this->formats = formatsVec;
|
this->formats = formatsVec;
|
||||||
|
|
||||||
// TODO: maybe calculate indices? currently we send all as available which could be wrong? I ain't no kernel dev tho.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CCompiledDMABUFFeedback::~CCompiledDMABUFFeedback() {
|
CCompiledDMABUFFeedback::~CCompiledDMABUFFeedback() {
|
||||||
|
@ -312,6 +311,8 @@ void CLinuxDMABUFFeedbackResource::sendDefault() {
|
||||||
resource->sendTrancheFormats(&indices);
|
resource->sendTrancheFormats(&indices);
|
||||||
wl_array_release(&indices);
|
wl_array_release(&indices);
|
||||||
resource->sendTrancheDone();
|
resource->sendTrancheDone();
|
||||||
|
|
||||||
|
resource->sendDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
CLinuxDMABUFResource::CLinuxDMABUFResource(SP<CZwpLinuxDmabufV1> resource_) : resource(resource_) {
|
CLinuxDMABUFResource::CLinuxDMABUFResource(SP<CZwpLinuxDmabufV1> resource_) : resource(resource_) {
|
||||||
|
@ -391,6 +392,8 @@ CLinuxDMABufV1Protocol::CLinuxDMABufV1Protocol(const wl_interface* iface, const
|
||||||
// FIXME: this will break on multi-gpu
|
// FIXME: this will break on multi-gpu
|
||||||
std::vector<Aquamarine::SDRMFormat> aqFormats;
|
std::vector<Aquamarine::SDRMFormat> aqFormats;
|
||||||
for (auto& impl : g_pCompositor->m_pAqBackend->getImplementations()) {
|
for (auto& impl : g_pCompositor->m_pAqBackend->getImplementations()) {
|
||||||
|
if (impl->type() != Aquamarine::AQ_BACKEND_DRM)
|
||||||
|
continue;
|
||||||
aqFormats = impl->getRenderFormats();
|
aqFormats = impl->getRenderFormats();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -499,15 +502,22 @@ void CLinuxDMABufV1Protocol::updateScanoutTranche(SP<CWLSurfaceResource> surface
|
||||||
|
|
||||||
wl_array indices2;
|
wl_array indices2;
|
||||||
wl_array_init(&indices2);
|
wl_array_init(&indices2);
|
||||||
for (size_t i = 0; i < feedback->formats.size(); ++i) {
|
const auto PRIMARYFORMATS = pMonitor->output->getBackend()->getRenderFormats();
|
||||||
if (feedback->formats.at(i).first != pMonitor->output->state->state().drmFormat)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
|
for (size_t i = 0; i < feedback->formats.size(); ++i) {
|
||||||
if (feedback->formats.at(i).second == DRM_FORMAT_MOD_LINEAR || feedback->formats.at(i).second == DRM_FORMAT_MOD_INVALID)
|
if (feedback->formats.at(i).second == DRM_FORMAT_MOD_LINEAR || feedback->formats.at(i).second == DRM_FORMAT_MOD_INVALID)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
LOGM(TRACE, "updateScanoutTranche: Format {} with modifier {} aka {} passed", FormatUtils::drmFormatName(feedback->formats.at(i).first), feedback->formats.at(i).second,
|
const auto PRIM_FORMAT = std::find_if(PRIMARYFORMATS.begin(), PRIMARYFORMATS.end(), [&](const auto& e) { return e.drmFormat == feedback->formats.at(i).first; });
|
||||||
FormatUtils::drmModifierName(feedback->formats.at(i).second));
|
|
||||||
|
if (PRIM_FORMAT == PRIMARYFORMATS.end())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (std::find(PRIM_FORMAT->modifiers.begin(), PRIM_FORMAT->modifiers.end(), feedback->formats.at(i).second) == PRIM_FORMAT->modifiers.end())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
LOGM(TRACE, "updateScanoutTranche: index {}: Format {} with modifier {} aka {} passed", i, FormatUtils::drmFormatName(feedback->formats.at(i).first),
|
||||||
|
feedback->formats.at(i).second, FormatUtils::drmModifierName(feedback->formats.at(i).second));
|
||||||
*((uint16_t*)wl_array_add(&indices2, sizeof(uint16_t))) = i;
|
*((uint16_t*)wl_array_add(&indices2, sizeof(uint16_t))) = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue