Skip to contentSkip to conversation

drm/i915/display: replace boilerplate code with helper macros

PATCH In review Hamza Mahfooz 3 participants 3 messages Jun 26, 2021 – Jun 29, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/i915/display: replace boilerplate code with helper macros

As per commit 22be87401289 ("drm: TODO: Add DRM_MODESET_LOCK_ALL* conversion to todo.rst"), drm_modeset_lock_all()/drm_modeset_unlock_all() and boilerplate code surrounding instances of drm_modeset_lock_all_ctx() with a local acquire context should be replaced with the relevant helper macros.

---
 drivers/gpu/drm/i915/display/intel_display.c | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +7 -13
index 64e9107d70f7..e8cb2881d2b4 100644
@@ -40,6 +40,7 @@
 #include <drm/drm_dp_helper.h>
 #include <drm/drm_edid.h>
 #include <drm/drm_fourcc.h>
+#include "drm/drm_modeset_lock.h"
 #include <drm/drm_plane_helper.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_rect.h>
@@ -11836,6 +11837,7 @@ int intel_modeset_init_nogem(struct drm_i915_private *i915)
 	struct drm_device *dev = &i915->drm;
 	enum pipe pipe;
 	struct intel_crtc *crtc;
+	struct drm_modeset_acquire_ctx ctx;
 	int ret;
 
 	intel_init_pm(i915);
@@ -11884,9 +11886,9 @@ int intel_modeset_init_nogem(struct drm_i915_private *i915)
 	intel_vga_disable(i915);
 	intel_setup_outputs(i915);
 
-	drm_modeset_lock_all(dev);
+	DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, ret);
 	intel_modeset_setup_hw_state(dev, dev->mode_config.acquire_ctx);
-	drm_modeset_unlock_all(dev);
+	DRM_MODESET_LOCK_ALL_END(dev, ctx, ret);
 
 	for_each_intel_crtc(dev, crtc) {
 		struct intel_initial_plane_config plane_config = {};
@@ -12795,22 +12797,14 @@ void intel_display_resume(struct drm_device *dev)
 	if (state)
 		state->acquire_ctx = &ctx;
 
-	drm_modeset_acquire_init(&ctx, 0);
-
-	while (1) {
-		ret = drm_modeset_lock_all_ctx(dev, &ctx);
-		if (ret != -EDEADLK)
-			break;
-
-		drm_modeset_backoff(&ctx);
-	}
+	DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, ret);
 
 	if (!ret)
 		ret = __intel_display_resume(dev, state, &ctx);
 
 	intel_enable_ipc(dev_priv);
-	drm_modeset_drop_locks(&ctx);
-	drm_modeset_acquire_fini(&ctx);
+
+	DRM_MODESET_LOCK_ALL_END(dev, ctx, ret);
 
 	if (ret)
 		drm_err(&dev_priv->drm,
Signature · 1 line
2.32.0
#1 lore raw

[Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/display: replace boilerplate code with helper macros (rev2)

== Series Details ==

== Series Details ==

Series: drm/i915/display: replace boilerplate code with helper macros (rev2)
URL : https://patchwork.freedesktop.org/series/91967/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_10284 -> Patchwork_20476
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_20476 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_20476, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20476/index.html

Possible new issues
-------------------

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

### CI changes ###

#### Possible regressions ####

* boot:
- fi-bwr-2160: [PASS][1] -> [FAIL][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10284/fi-bwr-2160/boot.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20476/fi-bwr-2160/boot.html

### IGT changes ###

#### Suppressed ####

The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.

* igt@i915_selftest@live@hangcheck:
- {fi-ehl-2}: [PASS][3] -> [INCOMPLETE][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10284/fi-ehl-2/igt@i915_selftest@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20476/fi-ehl-2/igt@i915_selftest@[email protected]

Known issues
------------

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

### IGT changes ###

#### Issues hit ####

* igt@amdgpu/amd_cs_nop@sync-fork-compute0:
- fi-snb-2600: NOTRUN -> [SKIP][5] ([fdo#109271]) +17 similar issues
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20476/fi-snb-2600/igt@amdgpu/[email protected]

* igt@runner@aborted:
- fi-bdw-5557u: NOTRUN -> [FAIL][6] ([i915#1602] / [i915#2029])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20476/fi-bdw-5557u/igt@[email protected]

#### Possible fixes ####

* igt@i915_selftest@live@hangcheck:
- fi-snb-2600: [INCOMPLETE][7] ([i915#2782]) -> [PASS][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10284/fi-snb-2600/igt@i915_selftest@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20476/fi-snb-2600/igt@i915_selftest@[email protected]

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

[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[i915#1602]: https://gitlab.freedesktop.org/drm/intel/issues/1602
[i915#2029]: https://gitlab.freedesktop.org/drm/intel/issues/2029
[i915#2782]: https://gitlab.freedesktop.org/drm/intel/issues/2782
[i915#3626]: https://gitlab.freedesktop.org/drm/intel/issues/3626

Participating hosts (40 -> 37)
------------------------------

Missing (3): fi-bsw-cyan fi-bdw-samus fi-hsw-4200u

Build changes
-------------

* Linux: CI_DRM_10284 -> Patchwork_20476

CI-20190529: 20190529
CI_DRM_10284: c4cc46175b38e554eab7ac3d1b95a85c79963d4a @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_6120: c45c6b727c1efaced0b53620bd41c8e4facfb31f @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_20476: 2a21dd480cf2dbe2521d1c73625ce6ea84008965 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

2a21dd480cf2 drm/i915/display: replace boilerplate code with helper macros

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20476/index.html

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw
In reply to Hamza Mahfooz
Quoted 32 lines · Hamza Mahfooz

As per commit 22be87401289 ("drm: TODO: Add DRM_MODESET_LOCK_ALL* conversion to todo.rst"), drm_modeset_lock_all()/drm_modeset_unlock_all() and boilerplate code surrounding instances of drm_modeset_lock_all_ctx() with a local acquire context should be replaced with the relevant helper macros.

---
 drivers/gpu/drm/i915/display/intel_display.c | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +2 -0
index 64e9107d70f7..e8cb2881d2b4 100644
@@ -40,6 +40,7 @@
 #include <drm/drm_dp_helper.h>
 #include <drm/drm_edid.h>
 #include <drm/drm_fourcc.h>
+#include "drm/drm_modeset_lock.h"
 #include <drm/drm_plane_helper.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_rect.h>
@@ -11836,6 +11837,7 @@ int intel_modeset_init_nogem(struct drm_i915_private *i915)
 	struct drm_device *dev = &i915->drm;
 	enum pipe pipe;
 	struct intel_crtc *crtc;
+	struct drm_modeset_acquire_ctx ctx;
 	int ret;
 
 	intel_init_pm(i915);

drivers/gpu/drm/i915/display/intel_display.c int intel_modeset_init_nogem(struct drm_i915_private *i915) · line 11891

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_display.c +2 -2
@@ -11884,9 +11886,9 @@ int intel_modeset_init_nogem(struct drm_i915_private *i915)
 	intel_vga_disable(i915);
 	intel_setup_outputs(i915);
 
-	drm_modeset_lock_all(dev);
+	DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, ret);
 	intel_modeset_setup_hw_state(dev, dev->mode_config.acquire_ctx);
-	drm_modeset_unlock_all(dev);
+	DRM_MODESET_LOCK_ALL_END(dev, ctx, ret);

That looks wrong. You're using a private ctx here, but still passing dev->mode_config.acquire_ctx to the lower level stuff.

Also DRM_MODESET_LOCK_ALL_{BEGIN,END}() do not seem to be equivalent to drm_modeset_{lock,unlock}_all() when it comes to mode_config.mutex. So would need a proper review whether we actually need that lock or not.

Signature · 2 lines
Ville Syrjälä
Intel