mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-26 14:45:58 +01:00
Fix output enable in DRM backend
This commit is contained in:
parent
8ebd7d4dbe
commit
53ba9b4eec
4 changed files with 19 additions and 7 deletions
|
@ -123,14 +123,22 @@ static bool atomic_crtc_pageflip(struct wlr_drm_backend *drm,
|
||||||
mode);
|
mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void atomic_conn_enable(struct wlr_drm_backend *drm,
|
static bool atomic_conn_enable(struct wlr_drm_backend *drm,
|
||||||
struct wlr_drm_connector *conn, bool enable) {
|
struct wlr_drm_connector *conn, bool enable) {
|
||||||
struct wlr_drm_crtc *crtc = conn->crtc;
|
struct wlr_drm_crtc *crtc = conn->crtc;
|
||||||
struct atomic atom;
|
|
||||||
|
|
||||||
|
struct atomic atom;
|
||||||
atomic_begin(crtc, &atom);
|
atomic_begin(crtc, &atom);
|
||||||
atomic_add(&atom, crtc->id, crtc->props.active, enable);
|
atomic_add(&atom, crtc->id, crtc->props.active, enable);
|
||||||
atomic_end(drm->fd, &atom);
|
if (enable) {
|
||||||
|
atomic_add(&atom, conn->id, conn->props.crtc_id, crtc->id);
|
||||||
|
atomic_add(&atom, crtc->id, crtc->props.mode_id, crtc->mode_id);
|
||||||
|
} else {
|
||||||
|
atomic_add(&atom, conn->id, conn->props.crtc_id, 0);
|
||||||
|
atomic_add(&atom, crtc->id, crtc->props.mode_id, 0);
|
||||||
|
}
|
||||||
|
return atomic_commit(drm->fd, &atom, conn, DRM_MODE_ATOMIC_ALLOW_MODESET,
|
||||||
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool legacy_crtc_set_cursor(struct wlr_drm_backend *drm,
|
bool legacy_crtc_set_cursor(struct wlr_drm_backend *drm,
|
||||||
|
|
|
@ -252,7 +252,10 @@ static void wlr_drm_connector_enable(struct wlr_output *output, bool enable) {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_drm_backend *drm = (struct wlr_drm_backend *)output->backend;
|
struct wlr_drm_backend *drm = (struct wlr_drm_backend *)output->backend;
|
||||||
drm->iface->conn_enable(drm, conn, enable);
|
bool ok = drm->iface->conn_enable(drm, conn, enable);
|
||||||
|
if (!ok) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (enable) {
|
if (enable) {
|
||||||
wlr_drm_connector_start_renderer(conn);
|
wlr_drm_connector_start_renderer(conn);
|
||||||
|
|
|
@ -25,10 +25,11 @@ static bool legacy_crtc_pageflip(struct wlr_drm_backend *drm,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void legacy_conn_enable(struct wlr_drm_backend *drm,
|
static bool legacy_conn_enable(struct wlr_drm_backend *drm,
|
||||||
struct wlr_drm_connector *conn, bool enable) {
|
struct wlr_drm_connector *conn, bool enable) {
|
||||||
drmModeConnectorSetProperty(drm->fd, conn->id, conn->props.dpms,
|
int ret = drmModeConnectorSetProperty(drm->fd, conn->id, conn->props.dpms,
|
||||||
enable ? DRM_MODE_DPMS_ON : DRM_MODE_DPMS_OFF);
|
enable ? DRM_MODE_DPMS_ON : DRM_MODE_DPMS_OFF);
|
||||||
|
return ret >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool legacy_crtc_set_cursor(struct wlr_drm_backend *drm,
|
bool legacy_crtc_set_cursor(struct wlr_drm_backend *drm,
|
||||||
|
|
|
@ -15,7 +15,7 @@ struct wlr_drm_crtc;
|
||||||
// Used to provide atomic or legacy DRM functions
|
// Used to provide atomic or legacy DRM functions
|
||||||
struct wlr_drm_interface {
|
struct wlr_drm_interface {
|
||||||
// Enable or disable DPMS for connector
|
// Enable or disable DPMS for connector
|
||||||
void (*conn_enable)(struct wlr_drm_backend *drm,
|
bool (*conn_enable)(struct wlr_drm_backend *drm,
|
||||||
struct wlr_drm_connector *conn, bool enable);
|
struct wlr_drm_connector *conn, bool enable);
|
||||||
// Pageflip on crtc. If mode is non-NULL perform a full modeset using it.
|
// Pageflip on crtc. If mode is non-NULL perform a full modeset using it.
|
||||||
bool (*crtc_pageflip)(struct wlr_drm_backend *drm,
|
bool (*crtc_pageflip)(struct wlr_drm_backend *drm,
|
||||||
|
|
Loading…
Reference in a new issue