update wlroots dep

This commit is contained in:
vaxerski 2023-03-03 21:28:22 +00:00
parent fe007fd36a
commit a34b747661
2 changed files with 10 additions and 38 deletions

View file

@ -746,48 +746,20 @@ void CHyprRenderer::setWindowScanoutMode(CWindow* pWindow) {
return; return;
} }
const auto RENDERERDRMFD = wlr_renderer_get_drm_fd(g_pCompositor->m_sWLRRenderer);
const auto BACKENDDRMFD = wlr_backend_get_drm_fd(g_pCompositor->m_sWLRBackend);
if (RENDERERDRMFD < 0 || BACKENDDRMFD < 0)
return;
auto deviceIDFromFD = [](int fd, unsigned long* deviceID) -> bool {
struct stat stat;
if (fstat(fd, &stat) != 0) {
return false;
}
*deviceID = stat.st_rdev;
return true;
};
unsigned long rendererDevice, scanoutDevice;
if (!deviceIDFromFD(RENDERERDRMFD, &rendererDevice) || !deviceIDFromFD(BACKENDDRMFD, &scanoutDevice))
return;
const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID); const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID);
const auto POUTPUTFORMATS = wlr_output_get_primary_formats(PMONITOR->output, WLR_BUFFER_CAP_DMABUF); const wlr_linux_dmabuf_feedback_v1_init_options INIT_OPTIONS = {
if (!POUTPUTFORMATS) .main_renderer = g_pCompositor->m_sWLRRenderer,
.scanout_primary_output = PMONITOR->output,
};
wlr_linux_dmabuf_feedback_v1 feedback = {0};
if (!wlr_linux_dmabuf_feedback_v1_init_with_options(&feedback, &INIT_OPTIONS))
return; return;
const auto PRENDERERFORMATS = wlr_renderer_get_dmabuf_texture_formats(g_pCompositor->m_sWLRRenderer); wlr_linux_dmabuf_v1_set_surface_feedback(g_pCompositor->m_sWLRLinuxDMABuf, g_pXWaylandManager->getWindowSurface(pWindow), &feedback);
wlr_drm_format_set scanoutFormats = {0}; wlr_linux_dmabuf_feedback_v1_finish(&feedback);
if (!wlr_drm_format_set_intersect(&scanoutFormats, POUTPUTFORMATS, PRENDERERFORMATS))
return;
const wlr_linux_dmabuf_feedback_v1_tranche TRANCHES[] = {
{.target_device = scanoutDevice, .flags = ZWP_LINUX_DMABUF_FEEDBACK_V1_TRANCHE_FLAGS_SCANOUT, .formats = &scanoutFormats},
{.target_device = rendererDevice, .formats = PRENDERERFORMATS}};
const wlr_linux_dmabuf_feedback_v1 FEEDBACK = {.main_device = rendererDevice, .tranches_len = sizeof(TRANCHES) / sizeof(TRANCHES[0]), .tranches = TRANCHES};
if (!wlr_linux_dmabuf_v1_set_surface_feedback(g_pCompositor->m_sWLRLinuxDMABuf, g_pXWaylandManager->getWindowSurface(pWindow), &FEEDBACK)) {
Debug::log(ERR, "Error in scanout mode setting: wlr_linux_dmabuf_v1_set_surface_feedback returned false.");
}
wlr_drm_format_set_finish(&scanoutFormats);
Debug::log(LOG, "Scanout mode ON set for %x", pWindow); Debug::log(LOG, "Scanout mode ON set for %x", pWindow);
} }

@ -1 +1 @@
Subproject commit 677a3f2f8847ed2de49dd60868f9d9487a546f58 Subproject commit 5ae17de23f5fd9bb252a698f3771c840280e2c05