sna: Force a reprobe for the specified hotplug connector
If the kernel can provide us with the exact connector that needs reprobing following a hotplug event, use it. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
a43455d4a3
commit
6a2e5bca42
|
|
@ -470,6 +470,7 @@ extern void sna_shadow_unset_crtc(struct sna *sna, xf86CrtcPtr crtc);
|
||||||
extern bool sna_pixmap_discard_shadow_damage(struct sna_pixmap *priv,
|
extern bool sna_pixmap_discard_shadow_damage(struct sna_pixmap *priv,
|
||||||
const RegionRec *region);
|
const RegionRec *region);
|
||||||
extern void sna_mode_set_primary(struct sna *sna);
|
extern void sna_mode_set_primary(struct sna *sna);
|
||||||
|
extern bool sna_mode_find_hotplug_connector(struct sna *sna, unsigned id);
|
||||||
extern void sna_mode_close(struct sna *sna);
|
extern void sna_mode_close(struct sna *sna);
|
||||||
extern void sna_mode_fini(struct sna *sna);
|
extern void sna_mode_fini(struct sna *sna);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -273,6 +273,7 @@ struct sna_output {
|
||||||
uint32_t last_detect;
|
uint32_t last_detect;
|
||||||
uint32_t status;
|
uint32_t status;
|
||||||
bool update_properties;
|
bool update_properties;
|
||||||
|
bool reprobe;
|
||||||
|
|
||||||
int num_modes;
|
int num_modes;
|
||||||
struct drm_mode_modeinfo *modes;
|
struct drm_mode_modeinfo *modes;
|
||||||
|
|
@ -3548,6 +3549,7 @@ sna_output_detect(xf86OutputPtr output)
|
||||||
DBG(("%s(%s): found %d modes, connection status=%d\n",
|
DBG(("%s(%s): found %d modes, connection status=%d\n",
|
||||||
__FUNCTION__, output->name, sna_output->num_modes, compat_conn.conn.connection));
|
__FUNCTION__, output->name, sna_output->num_modes, compat_conn.conn.connection));
|
||||||
|
|
||||||
|
sna_output->reprobe = false;
|
||||||
sna_output->last_detect = now;
|
sna_output->last_detect = now;
|
||||||
switch (compat_conn.conn.connection) {
|
switch (compat_conn.conn.connection) {
|
||||||
case DRM_MODE_CONNECTED:
|
case DRM_MODE_CONNECTED:
|
||||||
|
|
@ -5147,6 +5149,22 @@ static bool disable_unused_crtc(struct sna *sna)
|
||||||
return update;
|
return update;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool sna_mode_find_hotplug_connector(struct sna *sna, unsigned id)
|
||||||
|
{
|
||||||
|
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(sna->scrn);
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < sna->mode.num_real_output; i++) {
|
||||||
|
struct sna_output *output = to_sna_output(config->output[i]);
|
||||||
|
if (output->id == id) {
|
||||||
|
output->reprobe = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
output_check_status(struct sna *sna, struct sna_output *output)
|
output_check_status(struct sna *sna, struct sna_output *output)
|
||||||
{
|
{
|
||||||
|
|
@ -5156,6 +5174,9 @@ output_check_status(struct sna *sna, struct sna_output *output)
|
||||||
xf86OutputStatus status;
|
xf86OutputStatus status;
|
||||||
char *edid;
|
char *edid;
|
||||||
|
|
||||||
|
if (output->reprobe)
|
||||||
|
return false;
|
||||||
|
|
||||||
VG_CLEAR(compat_conn);
|
VG_CLEAR(compat_conn);
|
||||||
|
|
||||||
compat_conn.conn.connection = -1;
|
compat_conn.conn.connection = -1;
|
||||||
|
|
@ -5237,7 +5258,7 @@ void sna_mode_discover(struct sna *sna, bool tell)
|
||||||
res.count_connectors, sna->mode.num_real_output,
|
res.count_connectors, sna->mode.num_real_output,
|
||||||
res.count_encoders, res.count_crtcs));
|
res.count_encoders, res.count_crtcs));
|
||||||
if (res.count_connectors > 32)
|
if (res.count_connectors > 32)
|
||||||
return;
|
res.count_connectors = 32;
|
||||||
|
|
||||||
assert(sna->mode.num_real_crtc == res.count_crtcs || is_zaphod(sna->scrn));
|
assert(sna->mode.num_real_crtc == res.count_crtcs || is_zaphod(sna->scrn));
|
||||||
assert(sna->mode.max_crtc_width == res.max_width);
|
assert(sna->mode.max_crtc_width == res.max_width);
|
||||||
|
|
|
||||||
|
|
@ -796,8 +796,13 @@ sna_handle_uevents(int fd, void *closure)
|
||||||
const char *str;
|
const char *str;
|
||||||
|
|
||||||
str = udev_device_get_property_value(dev, "HOTPLUG");
|
str = udev_device_get_property_value(dev, "HOTPLUG");
|
||||||
if (str && atoi(str) == 1)
|
if (str && atoi(str) == 1) {
|
||||||
hotplug = true;
|
str = udev_device_get_property_value(dev, "CONNECTOR");
|
||||||
|
if (str)
|
||||||
|
hotplug |= sna_mode_find_hotplug_connector(sna, atoi(str));
|
||||||
|
else
|
||||||
|
hotplug = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
udev_device_unref(dev);
|
udev_device_unref(dev);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue