mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 12:55:58 +01:00
backend/drm: add destroy_blob()
Centralizes the logic to destroy a DRM blob: check whether it's zero, and print a nice error message.
This commit is contained in:
parent
741aaa3f76
commit
9a685cefa9
1 changed files with 12 additions and 11 deletions
|
@ -201,14 +201,21 @@ static uint64_t pick_max_bpc(struct wlr_drm_connector *conn, struct wlr_drm_fb *
|
||||||
return target_bpc;
|
return target_bpc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void destroy_blob(struct wlr_drm_backend *drm, uint32_t id) {
|
||||||
|
if (id == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (drmModeDestroyPropertyBlob(drm->fd, id) != 0) {
|
||||||
|
wlr_log_errno(WLR_ERROR, "Failed to destroy blob");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void commit_blob(struct wlr_drm_backend *drm,
|
static void commit_blob(struct wlr_drm_backend *drm,
|
||||||
uint32_t *current, uint32_t next) {
|
uint32_t *current, uint32_t next) {
|
||||||
if (*current == next) {
|
if (*current == next) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (*current != 0) {
|
destroy_blob(drm, *current);
|
||||||
drmModeDestroyPropertyBlob(drm->fd, *current);
|
|
||||||
}
|
|
||||||
*current = next;
|
*current = next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,9 +224,7 @@ static void rollback_blob(struct wlr_drm_backend *drm,
|
||||||
if (*current == next) {
|
if (*current == next) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (next != 0) {
|
destroy_blob(drm, next);
|
||||||
drmModeDestroyPropertyBlob(drm->fd, next);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void plane_disable(struct atomic *atom, struct wlr_drm_plane *plane) {
|
static void plane_disable(struct atomic *atom, struct wlr_drm_plane *plane) {
|
||||||
|
@ -382,11 +387,7 @@ static bool atomic_crtc_commit(struct wlr_drm_connector *conn,
|
||||||
rollback_blob(drm, &crtc->mode_id, mode_id);
|
rollback_blob(drm, &crtc->mode_id, mode_id);
|
||||||
rollback_blob(drm, &crtc->gamma_lut, gamma_lut);
|
rollback_blob(drm, &crtc->gamma_lut, gamma_lut);
|
||||||
}
|
}
|
||||||
|
destroy_blob(drm, fb_damage_clips);
|
||||||
if (fb_damage_clips != 0 &&
|
|
||||||
drmModeDestroyPropertyBlob(drm->fd, fb_damage_clips) != 0) {
|
|
||||||
wlr_log_errno(WLR_ERROR, "Failed to destroy FB_DAMAGE_CLIPS property blob");
|
|
||||||
}
|
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue