mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-26 22:55:58 +01:00
backend/drm: fix VLA overflow
This commit is contained in:
parent
3efc6bc363
commit
491f1dbf75
1 changed files with 17 additions and 1 deletions
|
@ -428,6 +428,19 @@ bool enable_drm_connector(struct wlr_output *output, bool enable) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static ssize_t connector_index_from_crtc(struct wlr_drm_backend *drm,
|
||||||
|
struct wlr_drm_crtc *crtc) {
|
||||||
|
size_t i = 0;
|
||||||
|
struct wlr_drm_connector *conn;
|
||||||
|
wl_list_for_each(conn, &drm->outputs, link) {
|
||||||
|
if (conn->crtc == crtc) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
static void realloc_planes(struct wlr_drm_backend *drm, const uint32_t *crtc_in,
|
static void realloc_planes(struct wlr_drm_backend *drm, const uint32_t *crtc_in,
|
||||||
bool *changed_outputs) {
|
bool *changed_outputs) {
|
||||||
wlr_log(WLR_DEBUG, "Reallocating planes");
|
wlr_log(WLR_DEBUG, "Reallocating planes");
|
||||||
|
@ -477,7 +490,10 @@ static void realloc_planes(struct wlr_drm_backend *drm, const uint32_t *crtc_in,
|
||||||
type,
|
type,
|
||||||
c->id);
|
c->id);
|
||||||
|
|
||||||
changed_outputs[crtc_res[i]] = true;
|
ssize_t conn_idx = connector_index_from_crtc(drm, c);
|
||||||
|
if (conn_idx >= 0) {
|
||||||
|
changed_outputs[conn_idx] = true;
|
||||||
|
}
|
||||||
if (*old) {
|
if (*old) {
|
||||||
finish_drm_surface(&(*old)->surf);
|
finish_drm_surface(&(*old)->surf);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue