sna: Query CRTC states following a hotplug event

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2012-05-24 12:51:46 +01:00
parent 3f3bde4f0c
commit 0ab226e27e
3 changed files with 17 additions and 0 deletions

View File

@ -310,6 +310,7 @@ struct sna {
Bool sna_mode_pre_init(ScrnInfoPtr scrn, struct sna *sna);
extern void sna_mode_remove_fb(struct sna *sna);
extern void sna_mode_hotplug(struct sna *sna);
extern void sna_mode_fini(struct sna *sna);
extern int sna_crtc_id(xf86CrtcPtr crtc);

View File

@ -2243,3 +2243,18 @@ bool sna_crtc_is_bound(struct sna *sna, xf86CrtcPtr crtc)
mode.mode_valid, sna->mode.fb_id == mode.fb_id));
return mode.mode_valid && sna->mode.fb_id == mode.fb_id;
}
void sna_mode_hotplug(struct sna *sna)
{
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(sna->scrn);
int i;
/* Validate CRTC attachments */
for (i = 0; i < xf86_config->num_crtc; i++) {
xf86CrtcPtr crtc = xf86_config->crtc[i];
if (crtc->enabled) {
struct sna_crtc *sna_crtc = crtc->driver_private;
sna_crtc->active = sna_crtc_is_bound(sna, crtc);
}
}
}

View File

@ -635,6 +635,7 @@ sna_handle_uevents(int fd, void *closure)
if (memcmp(&s.st_rdev, &udev_devnum, sizeof (dev_t)) == 0 &&
hotplug && atoi(hotplug) == 1) {
DBG(("%s: hotplug event\n", __FUNCTION__));
sna_mode_hotplug(sna);
RRGetInfo(xf86ScrnToScreen(scrn), TRUE);
}