All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t] igt/pm_rpm: Handle no-KMS gracefully
@ 2018-10-02 15:36 ` Chris Wilson
  0 siblings, 0 replies; 6+ messages in thread
From: Chris Wilson @ 2018-10-02 15:36 UTC (permalink / raw)
  To: intel-gfx; +Cc: igt-dev

If KMS is not supported, drmGetResources() will return NULL so be
careful not to dereference it. However, we still insist that runtime pm
works, so keep on testing.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/pm_rpm.c | 71 +++++++++++++++++++++++++++++++-------------------
 1 file changed, 44 insertions(+), 27 deletions(-)

diff --git a/tests/pm_rpm.c b/tests/pm_rpm.c
index 2d6c5b49c..7488efd74 100644
--- a/tests/pm_rpm.c
+++ b/tests/pm_rpm.c
@@ -220,9 +220,10 @@ static bool wait_for_active(void)
 
 static void disable_all_screens_dpms(struct mode_set_data *data)
 {
-	int i;
+	if (!data->res)
+		return;
 
-	for (i = 0; i < data->res->count_connectors; i++) {
+	for (int i = 0; i < data->res->count_connectors; i++) {
 		drmModeConnectorPtr c = data->connectors[i];
 
 		kmstest_set_connector_dpms(drm_fd, c, DRM_MODE_DPMS_OFF);
@@ -231,7 +232,8 @@ static void disable_all_screens_dpms(struct mode_set_data *data)
 
 static void disable_all_screens(struct mode_set_data *data)
 {
-	kmstest_unset_all_crtcs(drm_fd, data->res);
+	if (data->res)
+		kmstest_unset_all_crtcs(drm_fd, data->res);
 }
 
 #define disable_all_screens_and_wait(data) do { \
@@ -256,11 +258,13 @@ static bool init_modeset_params_for_type(struct mode_set_data *data,
 					 struct modeset_params *params,
 					 enum screen_type type)
 {
-	int i;
 	drmModeConnectorPtr connector = NULL;
 	drmModeModeInfoPtr mode = NULL;
 
-	for (i = 0; i < data->res->count_connectors; i++) {
+	if (!data->res)
+		return false;
+
+	for (int i = 0; i < data->res->count_connectors; i++) {
 		drmModeConnectorPtr c = data->connectors[i];
 
 		if (type == SCREEN_TYPE_LPSP &&
@@ -386,34 +390,31 @@ static drmModePropertyBlobPtr get_connector_edid(drmModeConnectorPtr connector,
 
 static void init_mode_set_data(struct mode_set_data *data)
 {
-	int i;
-
 	data->res = drmModeGetResources(drm_fd);
-	igt_assert(data->res);
-	igt_assert(data->res->count_connectors <= MAX_CONNECTORS);
+	if (data->res) {
+		igt_assert(data->res->count_connectors <= MAX_CONNECTORS);
+		for (int i = 0; i < data->res->count_connectors; i++) {
+			data->connectors[i] = drmModeGetConnectorCurrent(drm_fd,
+									 data->res->connectors[i]);
+			data->edids[i] = get_connector_edid(data->connectors[i], i);
+		}
 
-	for (i = 0; i < data->res->count_connectors; i++) {
-		data->connectors[i] = drmModeGetConnectorCurrent(drm_fd,
-						data->res->connectors[i]);
-		data->edids[i] = get_connector_edid(data->connectors[i], i);
+		kmstest_set_vt_graphics_mode();
 	}
 
 	data->devid = intel_get_drm_devid(drm_fd);
-
-	kmstest_set_vt_graphics_mode();
-
 	init_modeset_cached_params(&ms_data);
 }
 
 static void fini_mode_set_data(struct mode_set_data *data)
 {
-	int i;
-
-	for (i = 0; i < data->res->count_connectors; i++) {
-		drmModeFreeConnector(data->connectors[i]);
-		drmModeFreePropertyBlob(data->edids[i]);
+	if (data->res) {
+		for (int i = 0; i < data->res->count_connectors; i++) {
+			drmModeFreeConnector(data->connectors[i]);
+			drmModeFreePropertyBlob(data->edids[i]);
+		}
+		drmModeFreeResources(data->res);
 	}
-	drmModeFreeResources(data->res);
 }
 
 static void get_drm_info(struct compare_data *data)
@@ -421,7 +422,8 @@ static void get_drm_info(struct compare_data *data)
 	int i;
 
 	data->res = drmModeGetResources(drm_fd);
-	igt_assert(data->res);
+	if (!data->res)
+		return;
 
 	igt_assert(data->res->count_connectors <= MAX_CONNECTORS);
 	igt_assert(data->res->count_encoders <= MAX_ENCODERS);
@@ -445,6 +447,9 @@ static void free_drm_info(struct compare_data *data)
 {
 	int i;
 
+	if (!data->res)
+		return;
+
 	for (i = 0; i < data->res->count_connectors; i++) {
 		drmModeFreeConnector(data->connectors[i]);
 		drmModeFreePropertyBlob(data->edids[i]);
@@ -545,6 +550,12 @@ static void assert_drm_infos_equal(struct compare_data *d1,
 {
 	int i;
 
+	if (d1->res == d2->res)
+		return;
+
+	igt_assert(d1->res);
+	igt_assert(d2->res);
+
 	assert_drm_resources_equal(d1, d2);
 
 	for (i = 0; i < d1->res->count_connectors; i++) {
@@ -572,9 +583,12 @@ static bool edid_is_valid(const unsigned char *edid)
 
 static int count_drm_valid_edids(struct mode_set_data *data)
 {
-	int i, ret = 0;
+	int ret = 0;
 
-	for (i = 0; i < data->res->count_connectors; i++)
+	if (!data->res)
+		return 0;
+
+	for (int i = 0; i < data->res->count_connectors; i++)
 		if (data->edids[i] && edid_is_valid(data->edids[i]->data))
 			ret++;
 	return ret;
@@ -635,9 +649,12 @@ static int count_i2c_valid_edids(void)
 
 static int count_vga_outputs(struct mode_set_data *data)
 {
-	int i, count = 0;
+	int count = 0;
+
+	if (!data->res)
+		return 0;
 
-	for (i = 0; i < data->res->count_connectors; i++)
+	for (int i = 0; i < data->res->count_connectors; i++)
 		if (data->connectors[i]->connector_type ==
 		    DRM_MODE_CONNECTOR_VGA)
 			count++;
-- 
2.19.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [igt-dev] [PATCH i-g-t] igt/pm_rpm: Handle no-KMS gracefully
@ 2018-10-02 15:36 ` Chris Wilson
  0 siblings, 0 replies; 6+ messages in thread
From: Chris Wilson @ 2018-10-02 15:36 UTC (permalink / raw)
  To: intel-gfx; +Cc: igt-dev

If KMS is not supported, drmGetResources() will return NULL so be
careful not to dereference it. However, we still insist that runtime pm
works, so keep on testing.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/pm_rpm.c | 71 +++++++++++++++++++++++++++++++-------------------
 1 file changed, 44 insertions(+), 27 deletions(-)

diff --git a/tests/pm_rpm.c b/tests/pm_rpm.c
index 2d6c5b49c..7488efd74 100644
--- a/tests/pm_rpm.c
+++ b/tests/pm_rpm.c
@@ -220,9 +220,10 @@ static bool wait_for_active(void)
 
 static void disable_all_screens_dpms(struct mode_set_data *data)
 {
-	int i;
+	if (!data->res)
+		return;
 
-	for (i = 0; i < data->res->count_connectors; i++) {
+	for (int i = 0; i < data->res->count_connectors; i++) {
 		drmModeConnectorPtr c = data->connectors[i];
 
 		kmstest_set_connector_dpms(drm_fd, c, DRM_MODE_DPMS_OFF);
@@ -231,7 +232,8 @@ static void disable_all_screens_dpms(struct mode_set_data *data)
 
 static void disable_all_screens(struct mode_set_data *data)
 {
-	kmstest_unset_all_crtcs(drm_fd, data->res);
+	if (data->res)
+		kmstest_unset_all_crtcs(drm_fd, data->res);
 }
 
 #define disable_all_screens_and_wait(data) do { \
@@ -256,11 +258,13 @@ static bool init_modeset_params_for_type(struct mode_set_data *data,
 					 struct modeset_params *params,
 					 enum screen_type type)
 {
-	int i;
 	drmModeConnectorPtr connector = NULL;
 	drmModeModeInfoPtr mode = NULL;
 
-	for (i = 0; i < data->res->count_connectors; i++) {
+	if (!data->res)
+		return false;
+
+	for (int i = 0; i < data->res->count_connectors; i++) {
 		drmModeConnectorPtr c = data->connectors[i];
 
 		if (type == SCREEN_TYPE_LPSP &&
@@ -386,34 +390,31 @@ static drmModePropertyBlobPtr get_connector_edid(drmModeConnectorPtr connector,
 
 static void init_mode_set_data(struct mode_set_data *data)
 {
-	int i;
-
 	data->res = drmModeGetResources(drm_fd);
-	igt_assert(data->res);
-	igt_assert(data->res->count_connectors <= MAX_CONNECTORS);
+	if (data->res) {
+		igt_assert(data->res->count_connectors <= MAX_CONNECTORS);
+		for (int i = 0; i < data->res->count_connectors; i++) {
+			data->connectors[i] = drmModeGetConnectorCurrent(drm_fd,
+									 data->res->connectors[i]);
+			data->edids[i] = get_connector_edid(data->connectors[i], i);
+		}
 
-	for (i = 0; i < data->res->count_connectors; i++) {
-		data->connectors[i] = drmModeGetConnectorCurrent(drm_fd,
-						data->res->connectors[i]);
-		data->edids[i] = get_connector_edid(data->connectors[i], i);
+		kmstest_set_vt_graphics_mode();
 	}
 
 	data->devid = intel_get_drm_devid(drm_fd);
-
-	kmstest_set_vt_graphics_mode();
-
 	init_modeset_cached_params(&ms_data);
 }
 
 static void fini_mode_set_data(struct mode_set_data *data)
 {
-	int i;
-
-	for (i = 0; i < data->res->count_connectors; i++) {
-		drmModeFreeConnector(data->connectors[i]);
-		drmModeFreePropertyBlob(data->edids[i]);
+	if (data->res) {
+		for (int i = 0; i < data->res->count_connectors; i++) {
+			drmModeFreeConnector(data->connectors[i]);
+			drmModeFreePropertyBlob(data->edids[i]);
+		}
+		drmModeFreeResources(data->res);
 	}
-	drmModeFreeResources(data->res);
 }
 
 static void get_drm_info(struct compare_data *data)
@@ -421,7 +422,8 @@ static void get_drm_info(struct compare_data *data)
 	int i;
 
 	data->res = drmModeGetResources(drm_fd);
-	igt_assert(data->res);
+	if (!data->res)
+		return;
 
 	igt_assert(data->res->count_connectors <= MAX_CONNECTORS);
 	igt_assert(data->res->count_encoders <= MAX_ENCODERS);
@@ -445,6 +447,9 @@ static void free_drm_info(struct compare_data *data)
 {
 	int i;
 
+	if (!data->res)
+		return;
+
 	for (i = 0; i < data->res->count_connectors; i++) {
 		drmModeFreeConnector(data->connectors[i]);
 		drmModeFreePropertyBlob(data->edids[i]);
@@ -545,6 +550,12 @@ static void assert_drm_infos_equal(struct compare_data *d1,
 {
 	int i;
 
+	if (d1->res == d2->res)
+		return;
+
+	igt_assert(d1->res);
+	igt_assert(d2->res);
+
 	assert_drm_resources_equal(d1, d2);
 
 	for (i = 0; i < d1->res->count_connectors; i++) {
@@ -572,9 +583,12 @@ static bool edid_is_valid(const unsigned char *edid)
 
 static int count_drm_valid_edids(struct mode_set_data *data)
 {
-	int i, ret = 0;
+	int ret = 0;
 
-	for (i = 0; i < data->res->count_connectors; i++)
+	if (!data->res)
+		return 0;
+
+	for (int i = 0; i < data->res->count_connectors; i++)
 		if (data->edids[i] && edid_is_valid(data->edids[i]->data))
 			ret++;
 	return ret;
@@ -635,9 +649,12 @@ static int count_i2c_valid_edids(void)
 
 static int count_vga_outputs(struct mode_set_data *data)
 {
-	int i, count = 0;
+	int count = 0;
+
+	if (!data->res)
+		return 0;
 
-	for (i = 0; i < data->res->count_connectors; i++)
+	for (int i = 0; i < data->res->count_connectors; i++)
 		if (data->connectors[i]->connector_type ==
 		    DRM_MODE_CONNECTOR_VGA)
 			count++;
-- 
2.19.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [igt-dev] ✓ Fi.CI.BAT: success for igt/pm_rpm: Handle no-KMS gracefully
  2018-10-02 15:36 ` [igt-dev] " Chris Wilson
  (?)
@ 2018-10-02 16:12 ` Patchwork
  -1 siblings, 0 replies; 6+ messages in thread
From: Patchwork @ 2018-10-02 16:12 UTC (permalink / raw)
  To: Chris Wilson; +Cc: igt-dev

== Series Details ==

Series: igt/pm_rpm: Handle no-KMS gracefully
URL   : https://patchwork.freedesktop.org/series/50453/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4915 -> IGTPW_1893 =

== Summary - WARNING ==

  Minor unknown changes coming with IGTPW_1893 need to be verified
  manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in IGTPW_1893, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/50453/revisions/1/mbox/

== Possible new issues ==

  Here are the unknown changes that may have been introduced in IGTPW_1893:

  === IGT changes ===

    ==== Warnings ====

    igt@drv_selftest@live_guc:
      fi-glk-j4005:       SKIP -> PASS

    
== Known issues ==

  Here are the changes found in IGTPW_1893 that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@kms_pipe_crc_basic@nonblocking-crc-pipe-a-frame-sequence:
      fi-byt-clapper:     PASS -> FAIL (fdo#107362, fdo#103191)

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
      fi-cfl-8109u:       PASS -> INCOMPLETE (fdo#106070, fdo#108126)

    
    ==== Possible fixes ====

    igt@drv_selftest@live_coherency:
      fi-gdg-551:         DMESG-FAIL (fdo#107164) -> PASS

    igt@drv_selftest@live_execlists:
      fi-glk-j4005:       INCOMPLETE (fdo#103359, k.org#198133) -> PASS

    igt@kms_pipe_crc_basic@read-crc-pipe-a-frame-sequence:
      fi-byt-clapper:     FAIL (fdo#107362, fdo#103191) -> PASS

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
      fi-skl-guc:         FAIL (fdo#103191) -> PASS

    
  fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
  fdo#103359 https://bugs.freedesktop.org/show_bug.cgi?id=103359
  fdo#106070 https://bugs.freedesktop.org/show_bug.cgi?id=106070
  fdo#107164 https://bugs.freedesktop.org/show_bug.cgi?id=107164
  fdo#107362 https://bugs.freedesktop.org/show_bug.cgi?id=107362
  fdo#108126 https://bugs.freedesktop.org/show_bug.cgi?id=108126
  k.org#198133 https://bugzilla.kernel.org/show_bug.cgi?id=198133


== Participating hosts (46 -> 43) ==

  Missing    (3): fi-bsw-cyan fi-byt-squawks fi-icl-u2 


== Build changes ==

    * IGT: IGT_4660 -> IGTPW_1893

  CI_DRM_4915: 26e7a7d954a9c28b97af8ca7813f430fd9117232 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_1893: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1893/
  IGT_4660: d0975646c50568e66e65b44b81d28232d059b94e @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1893/issues.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [igt-dev] [PATCH i-g-t] igt/pm_rpm: Handle no-KMS gracefully
  2018-10-02 15:36 ` [igt-dev] " Chris Wilson
@ 2018-10-02 16:28   ` Ville Syrjälä
  -1 siblings, 0 replies; 6+ messages in thread
From: Ville Syrjälä @ 2018-10-02 16:28 UTC (permalink / raw)
  To: Chris Wilson; +Cc: igt-dev, intel-gfx

On Tue, Oct 02, 2018 at 04:36:07PM +0100, Chris Wilson wrote:
> If KMS is not supported, drmGetResources() will return NULL so be
> careful not to dereference it. However, we still insist that runtime pm
> works, so keep on testing.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> ---
>  tests/pm_rpm.c | 71 +++++++++++++++++++++++++++++++-------------------
>  1 file changed, 44 insertions(+), 27 deletions(-)
> 
> diff --git a/tests/pm_rpm.c b/tests/pm_rpm.c
> index 2d6c5b49c..7488efd74 100644
> --- a/tests/pm_rpm.c
> +++ b/tests/pm_rpm.c
> @@ -220,9 +220,10 @@ static bool wait_for_active(void)
>  
>  static void disable_all_screens_dpms(struct mode_set_data *data)
>  {
> -	int i;
> +	if (!data->res)
> +		return;
>  
> -	for (i = 0; i < data->res->count_connectors; i++) {
> +	for (int i = 0; i < data->res->count_connectors; i++) {
>  		drmModeConnectorPtr c = data->connectors[i];
>  
>  		kmstest_set_connector_dpms(drm_fd, c, DRM_MODE_DPMS_OFF);
> @@ -231,7 +232,8 @@ static void disable_all_screens_dpms(struct mode_set_data *data)
>  
>  static void disable_all_screens(struct mode_set_data *data)
>  {
> -	kmstest_unset_all_crtcs(drm_fd, data->res);
> +	if (data->res)
> +		kmstest_unset_all_crtcs(drm_fd, data->res);
>  }
>  
>  #define disable_all_screens_and_wait(data) do { \
> @@ -256,11 +258,13 @@ static bool init_modeset_params_for_type(struct mode_set_data *data,
>  					 struct modeset_params *params,
>  					 enum screen_type type)
>  {
> -	int i;
>  	drmModeConnectorPtr connector = NULL;
>  	drmModeModeInfoPtr mode = NULL;
>  
> -	for (i = 0; i < data->res->count_connectors; i++) {
> +	if (!data->res)
> +		return false;
> +
> +	for (int i = 0; i < data->res->count_connectors; i++) {
>  		drmModeConnectorPtr c = data->connectors[i];
>  
>  		if (type == SCREEN_TYPE_LPSP &&
> @@ -386,34 +390,31 @@ static drmModePropertyBlobPtr get_connector_edid(drmModeConnectorPtr connector,
>  
>  static void init_mode_set_data(struct mode_set_data *data)
>  {
> -	int i;
> -
>  	data->res = drmModeGetResources(drm_fd);
> -	igt_assert(data->res);
> -	igt_assert(data->res->count_connectors <= MAX_CONNECTORS);
> +	if (data->res) {
> +		igt_assert(data->res->count_connectors <= MAX_CONNECTORS);
> +		for (int i = 0; i < data->res->count_connectors; i++) {
> +			data->connectors[i] = drmModeGetConnectorCurrent(drm_fd,
> +									 data->res->connectors[i]);
> +			data->edids[i] = get_connector_edid(data->connectors[i], i);
> +		}
>  
> -	for (i = 0; i < data->res->count_connectors; i++) {
> -		data->connectors[i] = drmModeGetConnectorCurrent(drm_fd,
> -						data->res->connectors[i]);
> -		data->edids[i] = get_connector_edid(data->connectors[i], i);
> +		kmstest_set_vt_graphics_mode();
>  	}
>  
>  	data->devid = intel_get_drm_devid(drm_fd);
> -
> -	kmstest_set_vt_graphics_mode();
> -
>  	init_modeset_cached_params(&ms_data);
>  }
>  
>  static void fini_mode_set_data(struct mode_set_data *data)
>  {
> -	int i;
> -
> -	for (i = 0; i < data->res->count_connectors; i++) {
> -		drmModeFreeConnector(data->connectors[i]);
> -		drmModeFreePropertyBlob(data->edids[i]);
> +	if (data->res) {
> +		for (int i = 0; i < data->res->count_connectors; i++) {
> +			drmModeFreeConnector(data->connectors[i]);
> +			drmModeFreePropertyBlob(data->edids[i]);
> +		}
> +		drmModeFreeResources(data->res);
>  	}
> -	drmModeFreeResources(data->res);
>  }
>  
>  static void get_drm_info(struct compare_data *data)
> @@ -421,7 +422,8 @@ static void get_drm_info(struct compare_data *data)
>  	int i;
>  
>  	data->res = drmModeGetResources(drm_fd);
> -	igt_assert(data->res);
> +	if (!data->res)
> +		return;
>  
>  	igt_assert(data->res->count_connectors <= MAX_CONNECTORS);
>  	igt_assert(data->res->count_encoders <= MAX_ENCODERS);
> @@ -445,6 +447,9 @@ static void free_drm_info(struct compare_data *data)
>  {
>  	int i;
>  
> +	if (!data->res)
> +		return;
> +
>  	for (i = 0; i < data->res->count_connectors; i++) {
>  		drmModeFreeConnector(data->connectors[i]);
>  		drmModeFreePropertyBlob(data->edids[i]);
> @@ -545,6 +550,12 @@ static void assert_drm_infos_equal(struct compare_data *d1,
>  {
>  	int i;
>  
> +	if (d1->res == d2->res)
> +		return;
> +
> +	igt_assert(d1->res);
> +	igt_assert(d2->res);
> +
>  	assert_drm_resources_equal(d1, d2);
>  
>  	for (i = 0; i < d1->res->count_connectors; i++) {
> @@ -572,9 +583,12 @@ static bool edid_is_valid(const unsigned char *edid)
>  
>  static int count_drm_valid_edids(struct mode_set_data *data)
>  {
> -	int i, ret = 0;
> +	int ret = 0;
>  
> -	for (i = 0; i < data->res->count_connectors; i++)
> +	if (!data->res)
> +		return 0;
> +
> +	for (int i = 0; i < data->res->count_connectors; i++)
>  		if (data->edids[i] && edid_is_valid(data->edids[i]->data))
>  			ret++;
>  	return ret;
> @@ -635,9 +649,12 @@ static int count_i2c_valid_edids(void)
>  
>  static int count_vga_outputs(struct mode_set_data *data)
>  {
> -	int i, count = 0;
> +	int count = 0;
> +
> +	if (!data->res)
> +		return 0;
>  
> -	for (i = 0; i < data->res->count_connectors; i++)
> +	for (int i = 0; i < data->res->count_connectors; i++)
>  		if (data->connectors[i]->connector_type ==
>  		    DRM_MODE_CONNECTOR_VGA)
>  			count++;
> -- 
> 2.19.0
> 
> _______________________________________________
> igt-dev mailing list
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev

-- 
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Intel-gfx] [igt-dev] [PATCH i-g-t] igt/pm_rpm: Handle no-KMS gracefully
@ 2018-10-02 16:28   ` Ville Syrjälä
  0 siblings, 0 replies; 6+ messages in thread
From: Ville Syrjälä @ 2018-10-02 16:28 UTC (permalink / raw)
  To: Chris Wilson; +Cc: igt-dev, intel-gfx

On Tue, Oct 02, 2018 at 04:36:07PM +0100, Chris Wilson wrote:
> If KMS is not supported, drmGetResources() will return NULL so be
> careful not to dereference it. However, we still insist that runtime pm
> works, so keep on testing.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> ---
>  tests/pm_rpm.c | 71 +++++++++++++++++++++++++++++++-------------------
>  1 file changed, 44 insertions(+), 27 deletions(-)
> 
> diff --git a/tests/pm_rpm.c b/tests/pm_rpm.c
> index 2d6c5b49c..7488efd74 100644
> --- a/tests/pm_rpm.c
> +++ b/tests/pm_rpm.c
> @@ -220,9 +220,10 @@ static bool wait_for_active(void)
>  
>  static void disable_all_screens_dpms(struct mode_set_data *data)
>  {
> -	int i;
> +	if (!data->res)
> +		return;
>  
> -	for (i = 0; i < data->res->count_connectors; i++) {
> +	for (int i = 0; i < data->res->count_connectors; i++) {
>  		drmModeConnectorPtr c = data->connectors[i];
>  
>  		kmstest_set_connector_dpms(drm_fd, c, DRM_MODE_DPMS_OFF);
> @@ -231,7 +232,8 @@ static void disable_all_screens_dpms(struct mode_set_data *data)
>  
>  static void disable_all_screens(struct mode_set_data *data)
>  {
> -	kmstest_unset_all_crtcs(drm_fd, data->res);
> +	if (data->res)
> +		kmstest_unset_all_crtcs(drm_fd, data->res);
>  }
>  
>  #define disable_all_screens_and_wait(data) do { \
> @@ -256,11 +258,13 @@ static bool init_modeset_params_for_type(struct mode_set_data *data,
>  					 struct modeset_params *params,
>  					 enum screen_type type)
>  {
> -	int i;
>  	drmModeConnectorPtr connector = NULL;
>  	drmModeModeInfoPtr mode = NULL;
>  
> -	for (i = 0; i < data->res->count_connectors; i++) {
> +	if (!data->res)
> +		return false;
> +
> +	for (int i = 0; i < data->res->count_connectors; i++) {
>  		drmModeConnectorPtr c = data->connectors[i];
>  
>  		if (type == SCREEN_TYPE_LPSP &&
> @@ -386,34 +390,31 @@ static drmModePropertyBlobPtr get_connector_edid(drmModeConnectorPtr connector,
>  
>  static void init_mode_set_data(struct mode_set_data *data)
>  {
> -	int i;
> -
>  	data->res = drmModeGetResources(drm_fd);
> -	igt_assert(data->res);
> -	igt_assert(data->res->count_connectors <= MAX_CONNECTORS);
> +	if (data->res) {
> +		igt_assert(data->res->count_connectors <= MAX_CONNECTORS);
> +		for (int i = 0; i < data->res->count_connectors; i++) {
> +			data->connectors[i] = drmModeGetConnectorCurrent(drm_fd,
> +									 data->res->connectors[i]);
> +			data->edids[i] = get_connector_edid(data->connectors[i], i);
> +		}
>  
> -	for (i = 0; i < data->res->count_connectors; i++) {
> -		data->connectors[i] = drmModeGetConnectorCurrent(drm_fd,
> -						data->res->connectors[i]);
> -		data->edids[i] = get_connector_edid(data->connectors[i], i);
> +		kmstest_set_vt_graphics_mode();
>  	}
>  
>  	data->devid = intel_get_drm_devid(drm_fd);
> -
> -	kmstest_set_vt_graphics_mode();
> -
>  	init_modeset_cached_params(&ms_data);
>  }
>  
>  static void fini_mode_set_data(struct mode_set_data *data)
>  {
> -	int i;
> -
> -	for (i = 0; i < data->res->count_connectors; i++) {
> -		drmModeFreeConnector(data->connectors[i]);
> -		drmModeFreePropertyBlob(data->edids[i]);
> +	if (data->res) {
> +		for (int i = 0; i < data->res->count_connectors; i++) {
> +			drmModeFreeConnector(data->connectors[i]);
> +			drmModeFreePropertyBlob(data->edids[i]);
> +		}
> +		drmModeFreeResources(data->res);
>  	}
> -	drmModeFreeResources(data->res);
>  }
>  
>  static void get_drm_info(struct compare_data *data)
> @@ -421,7 +422,8 @@ static void get_drm_info(struct compare_data *data)
>  	int i;
>  
>  	data->res = drmModeGetResources(drm_fd);
> -	igt_assert(data->res);
> +	if (!data->res)
> +		return;
>  
>  	igt_assert(data->res->count_connectors <= MAX_CONNECTORS);
>  	igt_assert(data->res->count_encoders <= MAX_ENCODERS);
> @@ -445,6 +447,9 @@ static void free_drm_info(struct compare_data *data)
>  {
>  	int i;
>  
> +	if (!data->res)
> +		return;
> +
>  	for (i = 0; i < data->res->count_connectors; i++) {
>  		drmModeFreeConnector(data->connectors[i]);
>  		drmModeFreePropertyBlob(data->edids[i]);
> @@ -545,6 +550,12 @@ static void assert_drm_infos_equal(struct compare_data *d1,
>  {
>  	int i;
>  
> +	if (d1->res == d2->res)
> +		return;
> +
> +	igt_assert(d1->res);
> +	igt_assert(d2->res);
> +
>  	assert_drm_resources_equal(d1, d2);
>  
>  	for (i = 0; i < d1->res->count_connectors; i++) {
> @@ -572,9 +583,12 @@ static bool edid_is_valid(const unsigned char *edid)
>  
>  static int count_drm_valid_edids(struct mode_set_data *data)
>  {
> -	int i, ret = 0;
> +	int ret = 0;
>  
> -	for (i = 0; i < data->res->count_connectors; i++)
> +	if (!data->res)
> +		return 0;
> +
> +	for (int i = 0; i < data->res->count_connectors; i++)
>  		if (data->edids[i] && edid_is_valid(data->edids[i]->data))
>  			ret++;
>  	return ret;
> @@ -635,9 +649,12 @@ static int count_i2c_valid_edids(void)
>  
>  static int count_vga_outputs(struct mode_set_data *data)
>  {
> -	int i, count = 0;
> +	int count = 0;
> +
> +	if (!data->res)
> +		return 0;
>  
> -	for (i = 0; i < data->res->count_connectors; i++)
> +	for (int i = 0; i < data->res->count_connectors; i++)
>  		if (data->connectors[i]->connector_type ==
>  		    DRM_MODE_CONNECTOR_VGA)
>  			count++;
> -- 
> 2.19.0
> 
> _______________________________________________
> igt-dev mailing list
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev

-- 
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [igt-dev] ✗ Fi.CI.IGT: failure for igt/pm_rpm: Handle no-KMS gracefully
  2018-10-02 15:36 ` [igt-dev] " Chris Wilson
                   ` (2 preceding siblings ...)
  (?)
@ 2018-10-03  7:30 ` Patchwork
  -1 siblings, 0 replies; 6+ messages in thread
From: Patchwork @ 2018-10-03  7:30 UTC (permalink / raw)
  To: Chris Wilson; +Cc: igt-dev

== Series Details ==

Series: igt/pm_rpm: Handle no-KMS gracefully
URL   : https://patchwork.freedesktop.org/series/50453/
State : failure

== Summary ==

= CI Bug Log - changes from IGT_4660_full -> IGTPW_1893_full =

== Summary - FAILURE ==

  Serious unknown changes coming with IGTPW_1893_full absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in IGTPW_1893_full, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/50453/revisions/1/mbox/

== Possible new issues ==

  Here are the unknown changes that may have been introduced in IGTPW_1893_full:

  === IGT changes ===

    ==== Possible regressions ====

    igt@kms_color@pipe-a-ctm-max:
      shard-apl:          PASS -> FAIL

    {igt@kms_plane_alpha_blend@pipe-b-alpha-basic}:
      shard-apl:          SKIP -> FAIL +16

    {igt@kms_plane_alpha_blend@pipe-b-alpha-transparant-fb}:
      shard-kbl:          SKIP -> FAIL +16

    
    ==== Warnings ====

    igt@kms_atomic_transition@plane-all-transition-nonblocking:
      shard-snb:          PASS -> SKIP

    {igt@kms_plane_alpha_blend@pipe-a-constant-alpha-mid}:
      shard-kbl:          SKIP -> PASS +9

    {igt@kms_plane_alpha_blend@pipe-b-constant-alpha-mid}:
      shard-apl:          SKIP -> PASS +9

    
== Known issues ==

  Here are the changes found in IGTPW_1893_full that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@kms_available_modes_crc@available_mode_test_crc:
      shard-snb:          PASS -> FAIL (fdo#106641)

    igt@kms_busy@extended-modeset-hang-newfb-with-reset-render-b:
      shard-snb:          NOTRUN -> DMESG-WARN (fdo#107956) +1

    igt@kms_busy@extended-pageflip-modeset-hang-oldfb-render-c:
      shard-kbl:          NOTRUN -> DMESG-WARN (fdo#107956)

    igt@kms_cursor_crc@cursor-128x128-random:
      shard-apl:          PASS -> FAIL (fdo#103232) +3

    igt@kms_cursor_crc@cursor-128x128-suspend:
      shard-apl:          PASS -> FAIL (fdo#103232, fdo#103191)

    igt@kms_cursor_crc@cursor-256x85-sliding:
      shard-kbl:          PASS -> FAIL (fdo#103232)

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-render:
      shard-apl:          PASS -> FAIL (fdo#103167) +1

    igt@kms_plane_multiple@atomic-pipe-a-tiling-y:
      shard-apl:          PASS -> FAIL (fdo#103166) +2
      shard-kbl:          PASS -> FAIL (fdo#103166)

    
    ==== Possible fixes ====

    igt@gem_ctx_isolation@bcs0-s3:
      shard-kbl:          INCOMPLETE (fdo#103665) -> PASS +1

    igt@gem_exec_big:
      shard-hsw:          TIMEOUT (fdo#107937) -> PASS

    igt@gem_exec_suspend@basic-s3:
      shard-snb:          INCOMPLETE (fdo#105411) -> PASS

    
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  fdo#103166 https://bugs.freedesktop.org/show_bug.cgi?id=103166
  fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
  fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
  fdo#103232 https://bugs.freedesktop.org/show_bug.cgi?id=103232
  fdo#103665 https://bugs.freedesktop.org/show_bug.cgi?id=103665
  fdo#105411 https://bugs.freedesktop.org/show_bug.cgi?id=105411
  fdo#106641 https://bugs.freedesktop.org/show_bug.cgi?id=106641
  fdo#107937 https://bugs.freedesktop.org/show_bug.cgi?id=107937
  fdo#107956 https://bugs.freedesktop.org/show_bug.cgi?id=107956


== Participating hosts (6 -> 4) ==

  Missing    (2): shard-skl shard-glk 


== Build changes ==

    * IGT: IGT_4660 -> IGTPW_1893
    * Linux: CI_DRM_4912 -> CI_DRM_4915

  CI_DRM_4912: fde5d8f7153abb900a378cce97a7a6b32576a3fa @ git://anongit.freedesktop.org/gfx-ci/linux
  CI_DRM_4915: 26e7a7d954a9c28b97af8ca7813f430fd9117232 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_1893: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1893/
  IGT_4660: d0975646c50568e66e65b44b81d28232d059b94e @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1893/shards.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-10-03  7:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-02 15:36 [PATCH i-g-t] igt/pm_rpm: Handle no-KMS gracefully Chris Wilson
2018-10-02 15:36 ` [igt-dev] " Chris Wilson
2018-10-02 16:12 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2018-10-02 16:28 ` [igt-dev] [PATCH i-g-t] " Ville Syrjälä
2018-10-02 16:28   ` [Intel-gfx] " Ville Syrjälä
2018-10-03  7:30 ` [igt-dev] ✗ Fi.CI.IGT: failure for " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.