[Intel-gfx] [PATCH igt] lib/kms: Force connector probing on first use
Chris Wilson
chris at chris-wilson.co.uk
Tue Aug 23 10:33:11 UTC 2016
In order for igt to run completely standalone, it must coldplug
connectors on first use by forcing the probe.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
lib/igt_kms.c | 21 ++++++++++-----------
lib/igt_kms.h | 2 +-
tests/kms_fbc_crc.c | 2 +-
3 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 0a26569..e9c8961 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1217,7 +1217,6 @@ static void igt_display_log_shift(igt_display_t *display, int shift)
static void igt_output_refresh(igt_output_t *output)
{
igt_display_t *display = output->display;
- bool ret;
unsigned long crtc_idx_mask;
/* we mask out the pipes already in use */
@@ -1225,14 +1224,11 @@ static void igt_output_refresh(igt_output_t *output)
kmstest_free_connector_config(&output->config);
- ret = kmstest_get_connector_config(display->drm_fd,
- output->id,
- crtc_idx_mask,
- &output->config);
- if (ret)
- output->valid = true;
- else
- output->valid = false;
+ output->valid = _kmstest_connector_config(display->drm_fd,
+ output->id,
+ crtc_idx_mask,
+ &output->config,
+ output->valid < 0);
if (!output->name && output->config.connector) {
drmModeConnector *c = output->config.connector;
@@ -1502,6 +1498,7 @@ void igt_display_init(igt_display_t *display, int drm_fd)
* We don't assign each output a pipe unless
* a pipe is set with igt_output_set_pipe().
*/
+ output->valid = -1;
output->pending_crtc_idx_mask = 0;
output->id = resources->connectors[i];
output->display = display;
@@ -1538,7 +1535,7 @@ static void igt_pipe_fini(igt_pipe_t *pipe)
static void igt_output_fini(igt_output_t *output)
{
- if (output->valid)
+ if (output->valid > 0)
kmstest_free_connector_config(&output->config);
free(output->name);
}
@@ -2243,7 +2240,7 @@ static int do_display_commit(igt_display_t *display,
igt_pipe_t *pipe_obj = &display->pipes[pipe];
igt_output_t *output = igt_pipe_get_output(pipe_obj);
- if (output && output->valid)
+ if (output && output->valid > 0)
valid_outs++;
ret = igt_pipe_commit(pipe_obj, s, fail_on_error);
@@ -2443,6 +2440,8 @@ void igt_output_set_pipe(igt_output_t *output, enum pipe pipe)
igt_display_t *display = output->display;
igt_pipe_t *old_pipe;
+ igt_assert(output->valid != -1);
+
if (output->pending_crtc_idx_mask) {
old_pipe = igt_output_get_driving_pipe(output);
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 005d7e8..6422adc 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -297,7 +297,7 @@ typedef struct {
uint32_t id; /* KMS id */
struct kmstest_connector_config config;
char *name;
- bool valid;
+ int valid; /* -1 == never probed */
unsigned long pending_crtc_idx_mask;
bool use_override_mode;
drmModeModeInfo override_mode;
diff --git a/tests/kms_fbc_crc.c b/tests/kms_fbc_crc.c
index 02e95e5..2a2c93f 100644
--- a/tests/kms_fbc_crc.c
+++ b/tests/kms_fbc_crc.c
@@ -470,7 +470,7 @@ static void reset_display(data_t *data)
igt_display_t *display = &data->display;
for_each_connected_output(display, data->output) {
- if (data->output->valid) {
+ if (data->output->valid > 0) {
data->primary = igt_output_get_plane(data->output, IGT_PLANE_PRIMARY);
igt_plane_set_fb(data->primary, NULL);
}
--
2.9.3
More information about the Intel-gfx
mailing list