mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 12:55:58 +01:00
backend/drm: only keep track of local buffer
Stop keeping track of buffers on the parent GPU when multi-GPU is used. This removes support for export_dmabuf on secondary GPUs, but renderer v6 will bring this back by managing the swapchains in wlr_output instead of the backends.
This commit is contained in:
parent
5bd86b94f9
commit
91cb0fc443
3 changed files with 9 additions and 11 deletions
|
@ -630,10 +630,14 @@ static bool drm_connector_export_dmabuf(struct wlr_output *output,
|
||||||
struct wlr_drm_backend *drm = conn->backend;
|
struct wlr_drm_backend *drm = conn->backend;
|
||||||
struct wlr_drm_crtc *crtc = conn->crtc;
|
struct wlr_drm_crtc *crtc = conn->crtc;
|
||||||
|
|
||||||
|
if (drm->parent) {
|
||||||
|
// We don't keep track of the original buffer on the parent GPU when
|
||||||
|
// using multi-GPU.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (!drm->session->active) {
|
if (!drm->session->active) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!crtc) {
|
if (!crtc) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -304,7 +304,6 @@ void drm_fb_clear(struct wlr_drm_fb **fb_ptr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
gbm_bo_destroy(fb->bo);
|
gbm_bo_destroy(fb->bo);
|
||||||
wlr_buffer_unlock(fb->local_wlr_buf);
|
|
||||||
wlr_buffer_unlock(fb->wlr_buf);
|
wlr_buffer_unlock(fb->wlr_buf);
|
||||||
free(fb);
|
free(fb);
|
||||||
|
|
||||||
|
@ -364,18 +363,16 @@ static struct gbm_bo *get_bo_for_dmabuf(struct gbm_device *gbm,
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct wlr_drm_fb *drm_fb_create(struct wlr_drm_backend *drm,
|
static struct wlr_drm_fb *drm_fb_create(struct wlr_drm_backend *drm,
|
||||||
struct wlr_buffer *buf, struct wlr_buffer *local_buf,
|
struct wlr_buffer *buf, const struct wlr_drm_format_set *formats) {
|
||||||
const struct wlr_drm_format_set *formats) {
|
|
||||||
struct wlr_drm_fb *fb = calloc(1, sizeof(*fb));
|
struct wlr_drm_fb *fb = calloc(1, sizeof(*fb));
|
||||||
if (!fb) {
|
if (!fb) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
fb->wlr_buf = wlr_buffer_lock(buf);
|
fb->wlr_buf = wlr_buffer_lock(buf);
|
||||||
fb->local_wlr_buf = wlr_buffer_lock(local_buf);
|
|
||||||
|
|
||||||
struct wlr_dmabuf_attributes attribs;
|
struct wlr_dmabuf_attributes attribs;
|
||||||
if (!wlr_buffer_get_dmabuf(local_buf, &attribs)) {
|
if (!wlr_buffer_get_dmabuf(buf, &attribs)) {
|
||||||
wlr_log(WLR_ERROR, "Failed to get DMA-BUF from buffer");
|
wlr_log(WLR_ERROR, "Failed to get DMA-BUF from buffer");
|
||||||
goto error_get_dmabuf;
|
goto error_get_dmabuf;
|
||||||
}
|
}
|
||||||
|
@ -411,7 +408,6 @@ static struct wlr_drm_fb *drm_fb_create(struct wlr_drm_backend *drm,
|
||||||
error_get_fb_for_bo:
|
error_get_fb_for_bo:
|
||||||
gbm_bo_destroy(fb->bo);
|
gbm_bo_destroy(fb->bo);
|
||||||
error_get_dmabuf:
|
error_get_dmabuf:
|
||||||
wlr_buffer_unlock(fb->local_wlr_buf);
|
|
||||||
wlr_buffer_unlock(fb->wlr_buf);
|
wlr_buffer_unlock(fb->wlr_buf);
|
||||||
free(fb);
|
free(fb);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -432,7 +428,7 @@ bool drm_fb_import(struct wlr_drm_fb **fb_ptr, struct wlr_drm_backend *drm,
|
||||||
local_buf = wlr_buffer_lock(buf);
|
local_buf = wlr_buffer_lock(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_drm_fb *fb = drm_fb_create(drm, buf, local_buf, formats);
|
struct wlr_drm_fb *fb = drm_fb_create(drm, local_buf, formats);
|
||||||
wlr_buffer_unlock(local_buf);
|
wlr_buffer_unlock(local_buf);
|
||||||
if (!fb) {
|
if (!fb) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -30,9 +30,7 @@ struct wlr_drm_surface {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct wlr_drm_fb {
|
struct wlr_drm_fb {
|
||||||
struct wlr_buffer *wlr_buf; // original buffer
|
struct wlr_buffer *wlr_buf;
|
||||||
|
|
||||||
struct wlr_buffer *local_wlr_buf; // GPU-local buffer
|
|
||||||
struct gbm_bo *bo;
|
struct gbm_bo *bo;
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue