diff options
author | Russell King <rmk@armlinux.org.uk> | 2018-06-27 22:21:20 +0100 |
---|---|---|
committer | Russell King <rmk@armlinux.org.uk> | 2018-07-13 18:13:11 +0100 |
commit | 0874b95f67c2f1d5e2a140491d129ac8338e87a6 (patch) | |
tree | 2b34698151178d49e6145808376b727f89373d2a | |
parent | 37cfd644519c076f17ecf99b80ff4bab80630c4c (diff) |
src: lookup and store the DPMS connector property
Lookup and store the DPMS connector property, rather than doing this
each time we call the connectors DPMS function.
Signed-off-by: Russell King <rmk@armlinux.org.uk>
-rw-r--r-- | src/common_drm.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/common_drm.c b/src/common_drm.c index 2ff3363..ef8e499 100644 --- a/src/common_drm.c +++ b/src/common_drm.c @@ -68,6 +68,7 @@ struct common_conn_info { struct common_drm_property *props; drmModeConnectorPtr mode_output; drmModeEncoderPtr mode_encoder; + drmModePropertyPtr dpms; }; static DevPrivateKeyRec pixmap_key; @@ -287,13 +288,11 @@ static void common_drm_conn_create_resources(xf86OutputPtr output) static void common_drm_conn_dpms(xf86OutputPtr output, int mode) { struct common_conn_info *conn = output->driver_private; - drmModePropertyPtr p = common_drm_conn_find_property(conn, "DPMS", NULL); - if (p) { + if (conn->dpms) { drmModeConnectorSetProperty(conn->drm_fd, conn->drm_id, - p->prop_id, mode); + conn->dpms->prop_id, mode); conn->dpms_mode = mode; - drmModeFreeProperty(p); } } @@ -423,6 +422,7 @@ static void common_drm_conn_destroy(xf86OutputPtr output) { struct common_conn_info *conn = output->driver_private; + drmModeFreeProperty(conn->dpms); drmModeFreeConnector(conn->mode_output); drmModeFreeEncoder(conn->mode_encoder); free(conn); @@ -539,6 +539,9 @@ static void common_drm_conn_init(ScrnInfoPtr pScrn, uint32_t id) output->possible_clones = kencoder->possible_clones; output->interlaceAllowed = 1; /* wish there was a way to read that */ output->doubleScanAllowed = 0; + + /* Lookup and save the DPMS property */ + conn->dpms = common_drm_conn_find_property(conn, "DPMS", NULL); } /* |