@@ -127,3 +127,14 @@ void igt_psr_print_status(int fd)
igt_debugfs_read(fd, "i915_edp_psr_status", buf);
igt_info("PSR status:\n%s\n", buf);
}
+
+/**
+ * igt_psr_valid_connector:
+ * @connector: a drmModeConnector pointer to check
+ *
+ * Returns true if connector is an eDP connector.
+ */
+bool igt_psr_valid_connector(drmModeConnectorPtr connector)
+{
+ return (connector->connector_type == DRM_MODE_CONNECTOR_eDP);
+}
@@ -33,5 +33,6 @@ bool igt_psr_possible(int fd);
bool igt_psr_active(int fd);
bool igt_psr_await_status(int fd, bool active);
void igt_psr_print_status(int fd);
+bool igt_psr_valid_connector(drmModeConnectorPtr connector);
#endif /* IGT_PSR_H */
@@ -424,11 +424,12 @@ static void init_mode_params(struct modeset_params *params, uint32_t crtc_id,
static bool connector_get_mode(drmModeConnectorPtr c, drmModeModeInfoPtr *mode)
{
*mode = NULL;
+ bool valid = igt_psr_valid_connector(c);
if (c->connection != DRM_MODE_CONNECTED || !c->count_modes)
return false;
- if (c->connector_type == DRM_MODE_CONNECTOR_eDP && opt.no_edp)
+ if (valid && opt.no_edp)
return false;
if (opt.small_modes)
@@ -461,7 +462,7 @@ static bool find_connector(bool edp_only, bool pipe_a, uint32_t forbidden_id,
for (i = 0; i < drm.res->count_connectors; i++) {
c = drm.connectors[i];
- if (edp_only && c->connector_type != DRM_MODE_CONNECTOR_eDP)
+ if (edp_only && !igt_psr_valid_connector(c))
continue;
if (pipe_a && !connector_supports_pipe_a(c))
continue;
@@ -1395,7 +1396,7 @@ static void setup_sink_crc(void)
drmModeConnectorPtr c;
c = get_connector(prim_mode_params.connector_id);
- if (c->connector_type != DRM_MODE_CONNECTOR_eDP) {
+ if (!igt_psr_valid_connector(c)) {
igt_info("Sink CRC not supported: primary screen is not eDP\n");
sink_crc.supported = false;
return;
@@ -1531,8 +1532,9 @@ static bool psr_sink_has_support(void)
static void setup_psr(void)
{
- if (get_connector(prim_mode_params.connector_id)->connector_type !=
- DRM_MODE_CONNECTOR_eDP) {
+ drmModeConnectorPtr c = get_connector(prim_mode_params.connector_id);
+
+ if (!igt_psr_valid_connector(c)) {
igt_info("Can't test PSR: no usable eDP screen.\n");
return;
}
@@ -103,7 +103,7 @@ static void setup_output(data_t *data)
for_each_pipe_with_valid_output(display, pipe, output) {
drmModeConnectorPtr c = output->config.connector;
- if (c->connector_type != DRM_MODE_CONNECTOR_eDP)
+ if (!igt_psr_valid_connector(c))
continue;
igt_output_set_pipe(output, pipe);
Signed-off-by: Jim Bride <jim.bride@linux.intel.com> --- lib/igt_psr.c | 11 +++++++++++ lib/igt_psr.h | 1 + tests/kms_frontbuffer_tracking.c | 12 +++++++----- tests/kms_psr_sink_crc.c | 2 +- 4 files changed, 20 insertions(+), 6 deletions(-)