mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2026-05-08 12:28:04 +02:00
compositor-drm: Cache the DPMS property on drm_output
This avoids one drmModeGetConnector() call every time the DPMS mode is set. That call can take hundreds of milliseconds due to DDC.
This commit is contained in:
parent
6737d1c052
commit
ba4e929fc3
1 changed files with 7 additions and 14 deletions
|
|
@ -146,6 +146,7 @@ struct drm_output {
|
|||
int pipe;
|
||||
uint32_t connector_id;
|
||||
drmModeCrtcPtr original_crtc;
|
||||
drmModePropertyPtr dpms_prop;
|
||||
|
||||
int vblank_pending;
|
||||
int page_flip_pending;
|
||||
|
|
@ -1029,6 +1030,8 @@ drm_output_destroy(struct weston_output *output_base)
|
|||
if (output->backlight)
|
||||
backlight_destroy(output->backlight);
|
||||
|
||||
drmModeFreeProperty(output->dpms_prop);
|
||||
|
||||
/* Turn off hardware cursor */
|
||||
drmModeSetCursor(c->drm.fd, output->crtc_id, 0, 0, 0);
|
||||
|
||||
|
|
@ -1341,23 +1344,12 @@ drm_set_dpms(struct weston_output *output_base, enum dpms_enum level)
|
|||
struct drm_output *output = (struct drm_output *) output_base;
|
||||
struct weston_compositor *ec = output_base->compositor;
|
||||
struct drm_compositor *c = (struct drm_compositor *) ec;
|
||||
drmModeConnectorPtr connector;
|
||||
drmModePropertyPtr prop;
|
||||
|
||||
connector = drmModeGetConnector(c->drm.fd, output->connector_id);
|
||||
if (!connector)
|
||||
if (!output->dpms_prop)
|
||||
return;
|
||||
|
||||
prop = drm_get_prop(c->drm.fd, connector, "DPMS");
|
||||
if (!prop) {
|
||||
drmModeFreeConnector(connector);
|
||||
return;
|
||||
}
|
||||
|
||||
drmModeConnectorSetProperty(c->drm.fd, connector->connector_id,
|
||||
prop->prop_id, level);
|
||||
drmModeFreeProperty(prop);
|
||||
drmModeFreeConnector(connector);
|
||||
drmModeConnectorSetProperty(c->drm.fd, output->connector_id,
|
||||
output->dpms_prop->prop_id, level);
|
||||
}
|
||||
|
||||
static const char *connector_type_names[] = {
|
||||
|
|
@ -1554,6 +1546,7 @@ create_output_for_connector(struct drm_compositor *ec,
|
|||
ec->connector_allocator |= (1 << output->connector_id);
|
||||
|
||||
output->original_crtc = drmModeGetCrtc(ec->drm.fd, output->crtc_id);
|
||||
output->dpms_prop = drm_get_prop(ec->drm.fd, connector, "DPMS");
|
||||
|
||||
/* Get the current mode on the crtc that's currently driving
|
||||
* this connector. */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue