diff mbox series

[3/4] drm/i915/display: move device info and params handling to snapshot

Message ID 1450de944e897ebe0c7c0cb9a859483df14208bf.1725372032.git.jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/display: add snapshot capture/print infra | expand

Commit Message

Jani Nikula Sept. 3, 2024, 2:02 p.m. UTC
Snapshot display device and runtime info as well as display parameters
in display snapshot.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 .../drm/i915/display/intel_display_snapshot.c | 25 +++++++++++++++++++
 drivers/gpu/drm/i915/i915_gpu_error.c         | 10 --------
 drivers/gpu/drm/i915/i915_gpu_error.h         |  5 ----
 3 files changed, 25 insertions(+), 15 deletions(-)

Comments

Rodrigo Vivi Sept. 5, 2024, 4:56 p.m. UTC | #1
On Tue, Sep 03, 2024 at 05:02:59PM +0300, Jani Nikula wrote:
> Snapshot display device and runtime info as well as display parameters
> in display snapshot.
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> ---
>  .../drm/i915/display/intel_display_snapshot.c | 25 +++++++++++++++++++
>  drivers/gpu/drm/i915/i915_gpu_error.c         | 10 --------
>  drivers/gpu/drm/i915/i915_gpu_error.h         |  5 ----
>  3 files changed, 25 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display_snapshot.c b/drivers/gpu/drm/i915/display/intel_display_snapshot.c
> index 78b019dcd41d..a61ff0f81397 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_snapshot.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_snapshot.c
> @@ -3,10 +3,18 @@
>  
>  #include <linux/slab.h>
>  
> +#include "i915_drv.h"
> +#include "intel_display_device.h"
> +#include "intel_display_params.h"
>  #include "intel_display_snapshot.h"
>  #include "intel_overlay.h"
>  
>  struct intel_display_snapshot {
> +	struct intel_display *display;
> +
> +	struct intel_display_device_info info;
> +	struct intel_display_runtime_info runtime_info;
> +	struct intel_display_params params;
>  	struct intel_overlay_snapshot *overlay;
>  };
>  
> @@ -18,6 +26,14 @@ struct intel_display_snapshot *intel_display_snapshot_capture(struct intel_displ
>  	if (!snapshot)
>  		return NULL;
>  
> +	snapshot->display = display;
> +
> +	memcpy(&snapshot->info, DISPLAY_INFO(display), sizeof(snapshot->info));
> +	memcpy(&snapshot->runtime_info, DISPLAY_RUNTIME_INFO(display),
> +	       sizeof(snapshot->runtime_info));
> +
> +	intel_display_params_copy(&snapshot->params);
> +
>  	snapshot->overlay = intel_overlay_snapshot_capture(display);
>  
>  	return snapshot;
> @@ -26,9 +42,16 @@ struct intel_display_snapshot *intel_display_snapshot_capture(struct intel_displ
>  void intel_display_snapshot_print(const struct intel_display_snapshot *snapshot,
>  				  struct drm_printer *p)
>  {
> +	struct intel_display *display;
> +
>  	if (!snapshot)
>  		return;
>  
> +	display = snapshot->display;
> +
> +	intel_display_device_info_print(&snapshot->info, &snapshot->runtime_info, p);
> +	intel_display_params_dump(&snapshot->params, display->drm->driver->name, p);
> +
>  	intel_overlay_snapshot_print(snapshot->overlay, p);
>  }
>  
> @@ -37,6 +60,8 @@ void intel_display_snapshot_free(struct intel_display_snapshot *snapshot)
>  	if (!snapshot)
>  		return;
>  
> +	intel_display_params_free(&snapshot->params);
> +
>  	kfree(snapshot->overlay);
>  	kfree(snapshot);
>  }
> diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
> index b047b24a90d5..15d57206b281 100644
> --- a/drivers/gpu/drm/i915/i915_gpu_error.c
> +++ b/drivers/gpu/drm/i915/i915_gpu_error.c
> @@ -651,8 +651,6 @@ static void err_print_capabilities(struct drm_i915_error_state_buf *m,
>  	struct drm_printer p = i915_error_printer(m);
>  
>  	intel_device_info_print(&error->device_info, &error->runtime_info, &p);
> -	intel_display_device_info_print(&error->display_device_info,
> -					&error->display_runtime_info, &p);
>  	intel_driver_caps_print(&error->driver_caps, &p);
>  }
>  
> @@ -660,10 +658,8 @@ static void err_print_params(struct drm_i915_error_state_buf *m,
>  			     const struct i915_params *params)
>  {
>  	struct drm_printer p = i915_error_printer(m);
> -	struct intel_display *display = &m->i915->display;
>  
>  	i915_params_dump(params, &p);
> -	intel_display_params_dump(&display->params, display->drm->driver->name, &p);
>  }
>  
>  static void err_print_pciid(struct drm_i915_error_state_buf *m,
> @@ -1031,7 +1027,6 @@ static void i915_vma_coredump_free(struct i915_vma_coredump *vma)
>  static void cleanup_params(struct i915_gpu_coredump *error)
>  {
>  	i915_params_free(&error->params);
> -	intel_display_params_free(&error->display_params);
>  }
>  
>  static void cleanup_uc(struct intel_uc_coredump *uc)
> @@ -1992,17 +1987,12 @@ static void capture_gen(struct i915_gpu_coredump *error)
>  	error->suspend_count = i915->suspend_count;
>  
>  	i915_params_copy(&error->params, &i915->params);
> -	intel_display_params_copy(&error->display_params);
>  	memcpy(&error->device_info,
>  	       INTEL_INFO(i915),
>  	       sizeof(error->device_info));
>  	memcpy(&error->runtime_info,
>  	       RUNTIME_INFO(i915),
>  	       sizeof(error->runtime_info));
> -	memcpy(&error->display_device_info, DISPLAY_INFO(i915),
> -	       sizeof(error->display_device_info));
> -	memcpy(&error->display_runtime_info, DISPLAY_RUNTIME_INFO(i915),
> -	       sizeof(error->display_runtime_info));
>  	error->driver_caps = i915->caps;
>  }
>  
> diff --git a/drivers/gpu/drm/i915/i915_gpu_error.h b/drivers/gpu/drm/i915/i915_gpu_error.h
> index 1a11942d7800..78a8928562a9 100644
> --- a/drivers/gpu/drm/i915/i915_gpu_error.h
> +++ b/drivers/gpu/drm/i915/i915_gpu_error.h
> @@ -14,8 +14,6 @@
>  
>  #include <drm/drm_mm.h>
>  
> -#include "display/intel_display_device.h"
> -#include "display/intel_display_params.h"
>  #include "gt/intel_engine.h"
>  #include "gt/intel_engine_types.h"
>  #include "gt/intel_gt_types.h"
> @@ -212,11 +210,8 @@ struct i915_gpu_coredump {
>  
>  	struct intel_device_info device_info;
>  	struct intel_runtime_info runtime_info;
> -	struct intel_display_device_info display_device_info;
> -	struct intel_display_runtime_info display_runtime_info;
>  	struct intel_driver_caps driver_caps;
>  	struct i915_params params;
> -	struct intel_display_params display_params;
>  
>  	struct scatterlist *sgl, *fit;
>  
> -- 
> 2.39.2
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_display_snapshot.c b/drivers/gpu/drm/i915/display/intel_display_snapshot.c
index 78b019dcd41d..a61ff0f81397 100644
--- a/drivers/gpu/drm/i915/display/intel_display_snapshot.c
+++ b/drivers/gpu/drm/i915/display/intel_display_snapshot.c
@@ -3,10 +3,18 @@ 
 
 #include <linux/slab.h>
 
+#include "i915_drv.h"
+#include "intel_display_device.h"
+#include "intel_display_params.h"
 #include "intel_display_snapshot.h"
 #include "intel_overlay.h"
 
 struct intel_display_snapshot {
+	struct intel_display *display;
+
+	struct intel_display_device_info info;
+	struct intel_display_runtime_info runtime_info;
+	struct intel_display_params params;
 	struct intel_overlay_snapshot *overlay;
 };
 
@@ -18,6 +26,14 @@  struct intel_display_snapshot *intel_display_snapshot_capture(struct intel_displ
 	if (!snapshot)
 		return NULL;
 
+	snapshot->display = display;
+
+	memcpy(&snapshot->info, DISPLAY_INFO(display), sizeof(snapshot->info));
+	memcpy(&snapshot->runtime_info, DISPLAY_RUNTIME_INFO(display),
+	       sizeof(snapshot->runtime_info));
+
+	intel_display_params_copy(&snapshot->params);
+
 	snapshot->overlay = intel_overlay_snapshot_capture(display);
 
 	return snapshot;
@@ -26,9 +42,16 @@  struct intel_display_snapshot *intel_display_snapshot_capture(struct intel_displ
 void intel_display_snapshot_print(const struct intel_display_snapshot *snapshot,
 				  struct drm_printer *p)
 {
+	struct intel_display *display;
+
 	if (!snapshot)
 		return;
 
+	display = snapshot->display;
+
+	intel_display_device_info_print(&snapshot->info, &snapshot->runtime_info, p);
+	intel_display_params_dump(&snapshot->params, display->drm->driver->name, p);
+
 	intel_overlay_snapshot_print(snapshot->overlay, p);
 }
 
@@ -37,6 +60,8 @@  void intel_display_snapshot_free(struct intel_display_snapshot *snapshot)
 	if (!snapshot)
 		return;
 
+	intel_display_params_free(&snapshot->params);
+
 	kfree(snapshot->overlay);
 	kfree(snapshot);
 }
diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
index b047b24a90d5..15d57206b281 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -651,8 +651,6 @@  static void err_print_capabilities(struct drm_i915_error_state_buf *m,
 	struct drm_printer p = i915_error_printer(m);
 
 	intel_device_info_print(&error->device_info, &error->runtime_info, &p);
-	intel_display_device_info_print(&error->display_device_info,
-					&error->display_runtime_info, &p);
 	intel_driver_caps_print(&error->driver_caps, &p);
 }
 
@@ -660,10 +658,8 @@  static void err_print_params(struct drm_i915_error_state_buf *m,
 			     const struct i915_params *params)
 {
 	struct drm_printer p = i915_error_printer(m);
-	struct intel_display *display = &m->i915->display;
 
 	i915_params_dump(params, &p);
-	intel_display_params_dump(&display->params, display->drm->driver->name, &p);
 }
 
 static void err_print_pciid(struct drm_i915_error_state_buf *m,
@@ -1031,7 +1027,6 @@  static void i915_vma_coredump_free(struct i915_vma_coredump *vma)
 static void cleanup_params(struct i915_gpu_coredump *error)
 {
 	i915_params_free(&error->params);
-	intel_display_params_free(&error->display_params);
 }
 
 static void cleanup_uc(struct intel_uc_coredump *uc)
@@ -1992,17 +1987,12 @@  static void capture_gen(struct i915_gpu_coredump *error)
 	error->suspend_count = i915->suspend_count;
 
 	i915_params_copy(&error->params, &i915->params);
-	intel_display_params_copy(&error->display_params);
 	memcpy(&error->device_info,
 	       INTEL_INFO(i915),
 	       sizeof(error->device_info));
 	memcpy(&error->runtime_info,
 	       RUNTIME_INFO(i915),
 	       sizeof(error->runtime_info));
-	memcpy(&error->display_device_info, DISPLAY_INFO(i915),
-	       sizeof(error->display_device_info));
-	memcpy(&error->display_runtime_info, DISPLAY_RUNTIME_INFO(i915),
-	       sizeof(error->display_runtime_info));
 	error->driver_caps = i915->caps;
 }
 
diff --git a/drivers/gpu/drm/i915/i915_gpu_error.h b/drivers/gpu/drm/i915/i915_gpu_error.h
index 1a11942d7800..78a8928562a9 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.h
+++ b/drivers/gpu/drm/i915/i915_gpu_error.h
@@ -14,8 +14,6 @@ 
 
 #include <drm/drm_mm.h>
 
-#include "display/intel_display_device.h"
-#include "display/intel_display_params.h"
 #include "gt/intel_engine.h"
 #include "gt/intel_engine_types.h"
 #include "gt/intel_gt_types.h"
@@ -212,11 +210,8 @@  struct i915_gpu_coredump {
 
 	struct intel_device_info device_info;
 	struct intel_runtime_info runtime_info;
-	struct intel_display_device_info display_device_info;
-	struct intel_display_runtime_info display_runtime_info;
 	struct intel_driver_caps driver_caps;
 	struct i915_params params;
-	struct intel_display_params display_params;
 
 	struct scatterlist *sgl, *fit;