lib/igt_kms, tests/testdisplay: allow probing of new connector modes

Fixup some fallout from the connector probing changes so testdisplay -m
will pick up newly hotplugged displays correctly.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org.
This commit is contained in:
Jesse Barnes
2016-01-14 14:03:53 -08:00
parent e2c9a023f2
commit e28acefc5c
5 changed files with 67 additions and 14 deletions
+14 -7
View File
@@ -191,12 +191,19 @@ static void dump_info(void)
static void connector_find_preferred_mode(uint32_t connector_id,
unsigned long crtc_idx_mask,
int mode_num, struct connector *c)
int mode_num, struct connector *c,
bool probe)
{
struct kmstest_connector_config config;
bool ret;
if (!kmstest_get_connector_config(drm_fd, connector_id, crtc_idx_mask,
&config)) {
if (probe)
ret = kmstest_probe_connector_config(drm_fd, connector_id,
crtc_idx_mask, &config);
else
ret = kmstest_get_connector_config(drm_fd, connector_id,
crtc_idx_mask, &config);
if (!ret) {
c->mode_valid = 0;
return;
}
@@ -456,7 +463,7 @@ set_stereo_mode(struct connector *c)
* Each connector has a corresponding encoder, except in the SDVO case
* where an encoder may have multiple connectors.
*/
int update_display(void)
int update_display(bool probe)
{
struct connector *connectors;
int c;
@@ -488,7 +495,7 @@ int update_display(void)
connector_find_preferred_mode(connector->id,
crtc_idx_mask,
specified_mode_num,
connector);
connector, probe);
if (!connector->mode_valid)
continue;
@@ -513,7 +520,7 @@ int update_display(void)
connector_find_preferred_mode(connector->id,
-1UL,
specified_mode_num,
connector);
connector, probe);
if (!connector->mode_valid)
continue;
@@ -765,7 +772,7 @@ int main(int argc, char **argv)
ret = 0;
if (!update_display()) {
if (!update_display(false)) {
ret = 1;
goto out_stdio;
}
+1 -1
View File
@@ -32,4 +32,4 @@ gboolean testdisplay_setup_hotplug(void);
void testdisplay_cleanup_hotplug(void);
/* called by the hotplug code */
int update_display(void);
int update_display(bool probe);
+1 -1
View File
@@ -59,7 +59,7 @@ static gboolean hotplug_event(GIOChannel *source, GIOCondition condition,
if (memcmp(&s.st_rdev, &udev_devnum, sizeof(dev_t)) == 0 &&
hotplug && atoi(hotplug) == 1)
update_display();
update_display(true);
udev_device_unref(dev);
out: