mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-29 16:05:59 +01:00
Merge pull request #1286 from emersion/drm-no-crtc
backend/drm: better handle GPUs without CRTCs
This commit is contained in:
commit
fb5572db5a
1 changed files with 9 additions and 4 deletions
|
@ -156,6 +156,11 @@ bool init_drm_resources(struct wlr_drm_backend *drm) {
|
||||||
wlr_log(WLR_INFO, "Found %d DRM CRTCs", res->count_crtcs);
|
wlr_log(WLR_INFO, "Found %d DRM CRTCs", res->count_crtcs);
|
||||||
|
|
||||||
drm->num_crtcs = res->count_crtcs;
|
drm->num_crtcs = res->count_crtcs;
|
||||||
|
if (drm->num_crtcs == 0) {
|
||||||
|
drmModeFreeResources(res);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
drm->crtcs = calloc(drm->num_crtcs, sizeof(drm->crtcs[0]));
|
drm->crtcs = calloc(drm->num_crtcs, sizeof(drm->crtcs[0]));
|
||||||
if (!drm->crtcs) {
|
if (!drm->crtcs) {
|
||||||
wlr_log_errno(WLR_ERROR, "Allocation failed");
|
wlr_log_errno(WLR_ERROR, "Allocation failed");
|
||||||
|
@ -433,9 +438,9 @@ static void realloc_planes(struct wlr_drm_backend *drm, const uint32_t *crtc_in,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t possible[drm->num_type_planes[type]];
|
uint32_t possible[drm->num_type_planes[type] + 1];
|
||||||
uint32_t crtc[drm->num_crtcs];
|
uint32_t crtc[drm->num_crtcs + 1];
|
||||||
uint32_t crtc_res[drm->num_crtcs];
|
uint32_t crtc_res[drm->num_crtcs + 1];
|
||||||
|
|
||||||
for (size_t i = 0; i < drm->num_type_planes[type]; ++i) {
|
for (size_t i = 0; i < drm->num_type_planes[type]; ++i) {
|
||||||
possible[i] = drm->type_planes[type][i].possible_crtcs;
|
possible[i] = drm->type_planes[type][i].possible_crtcs;
|
||||||
|
@ -1160,7 +1165,7 @@ void scan_drm_connectors(struct wlr_drm_backend *drm) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool changed_outputs[wl_list_length(&drm->outputs)];
|
bool changed_outputs[wl_list_length(&drm->outputs) + 1];
|
||||||
memset(changed_outputs, false, sizeof(changed_outputs));
|
memset(changed_outputs, false, sizeof(changed_outputs));
|
||||||
for (size_t i = 0; i < new_outputs_len; ++i) {
|
for (size_t i = 0; i < new_outputs_len; ++i) {
|
||||||
struct wlr_drm_connector *conn = new_outputs[i];
|
struct wlr_drm_connector *conn = new_outputs[i];
|
||||||
|
|
Loading…
Reference in a new issue