mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2024-11-25 08:32:30 +00:00
backend/drm: don't destroy previous DRM master blobs
On startup, we fetch the previous MODE_ID blob ID so that compositors can keep using the previous mode if they want to. However, that blob doesn't belong to us, it belongs to the previous DRM master. As a result, we get an error when trying to destroy it. Fix this by tracking whether the blob belongs to us or not. Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3811
This commit is contained in:
parent
d8f4a3d78c
commit
0d9ffef774
@ -379,6 +379,10 @@ static bool atomic_crtc_commit(struct wlr_drm_connector *conn,
|
|||||||
atomic_finish(&atom);
|
atomic_finish(&atom);
|
||||||
|
|
||||||
if (ok && !test_only) {
|
if (ok && !test_only) {
|
||||||
|
if (!crtc->own_mode_id) {
|
||||||
|
crtc->mode_id = 0; // don't try to delete previous master's blobs
|
||||||
|
}
|
||||||
|
crtc->own_mode_id = true;
|
||||||
commit_blob(drm, &crtc->mode_id, mode_id);
|
commit_blob(drm, &crtc->mode_id, mode_id);
|
||||||
commit_blob(drm, &crtc->gamma_lut, gamma_lut);
|
commit_blob(drm, &crtc->gamma_lut, gamma_lut);
|
||||||
|
|
||||||
|
@ -329,7 +329,7 @@ void finish_drm_resources(struct wlr_drm_backend *drm) {
|
|||||||
for (size_t i = 0; i < drm->num_crtcs; ++i) {
|
for (size_t i = 0; i < drm->num_crtcs; ++i) {
|
||||||
struct wlr_drm_crtc *crtc = &drm->crtcs[i];
|
struct wlr_drm_crtc *crtc = &drm->crtcs[i];
|
||||||
|
|
||||||
if (crtc->mode_id) {
|
if (crtc->mode_id && crtc->own_mode_id) {
|
||||||
drmModeDestroyPropertyBlob(drm->fd, crtc->mode_id);
|
drmModeDestroyPropertyBlob(drm->fd, crtc->mode_id);
|
||||||
}
|
}
|
||||||
if (crtc->gamma_lut) {
|
if (crtc->gamma_lut) {
|
||||||
@ -1483,6 +1483,7 @@ static bool connect_drm_connector(struct wlr_drm_connector *wlr_conn,
|
|||||||
get_drm_prop(drm->fd, wlr_conn->crtc->id,
|
get_drm_prop(drm->fd, wlr_conn->crtc->id,
|
||||||
wlr_conn->crtc->props.mode_id, &mode_id);
|
wlr_conn->crtc->props.mode_id, &mode_id);
|
||||||
|
|
||||||
|
wlr_conn->crtc->own_mode_id = false;
|
||||||
wlr_conn->crtc->mode_id = mode_id;
|
wlr_conn->crtc->mode_id = mode_id;
|
||||||
wlr_conn->refresh = calculate_refresh_rate(current_modeinfo);
|
wlr_conn->refresh = calculate_refresh_rate(current_modeinfo);
|
||||||
}
|
}
|
||||||
|
@ -475,6 +475,10 @@ out:
|
|||||||
drmModeAtomicFree(req);
|
drmModeAtomicFree(req);
|
||||||
|
|
||||||
if (ok && !test_only) {
|
if (ok && !test_only) {
|
||||||
|
if (!crtc->own_mode_id) {
|
||||||
|
crtc->mode_id = 0; // don't try to delete previous master's blobs
|
||||||
|
}
|
||||||
|
crtc->own_mode_id = true;
|
||||||
commit_blob(drm, &crtc->mode_id, mode_id);
|
commit_blob(drm, &crtc->mode_id, mode_id);
|
||||||
commit_blob(drm, &crtc->gamma_lut, gamma_lut);
|
commit_blob(drm, &crtc->gamma_lut, gamma_lut);
|
||||||
|
|
||||||
|
@ -61,6 +61,7 @@ struct wlr_drm_crtc {
|
|||||||
struct wl_list layers; // wlr_drm_layer.link
|
struct wl_list layers; // wlr_drm_layer.link
|
||||||
|
|
||||||
// Atomic modesetting only
|
// Atomic modesetting only
|
||||||
|
bool own_mode_id;
|
||||||
uint32_t mode_id;
|
uint32_t mode_id;
|
||||||
uint32_t gamma_lut;
|
uint32_t gamma_lut;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user