Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v6.14 74 lines 1.9 kB view raw
1// SPDX-License-Identifier: MIT 2/* Copyright © 2024 Intel Corporation */ 3 4#include <linux/slab.h> 5 6#include <drm/drm_drv.h> 7 8#include "intel_display_core.h" 9#include "intel_display_device.h" 10#include "intel_display_params.h" 11#include "intel_display_snapshot.h" 12#include "intel_dmc.h" 13#include "intel_overlay.h" 14 15struct intel_display_snapshot { 16 struct intel_display *display; 17 18 struct intel_display_device_info info; 19 struct intel_display_runtime_info runtime_info; 20 struct intel_display_params params; 21 struct intel_overlay_snapshot *overlay; 22 struct intel_dmc_snapshot *dmc; 23}; 24 25struct intel_display_snapshot *intel_display_snapshot_capture(struct intel_display *display) 26{ 27 struct intel_display_snapshot *snapshot; 28 29 snapshot = kzalloc(sizeof(*snapshot), GFP_ATOMIC); 30 if (!snapshot) 31 return NULL; 32 33 snapshot->display = display; 34 35 memcpy(&snapshot->info, DISPLAY_INFO(display), sizeof(snapshot->info)); 36 memcpy(&snapshot->runtime_info, DISPLAY_RUNTIME_INFO(display), 37 sizeof(snapshot->runtime_info)); 38 39 intel_display_params_copy(&snapshot->params); 40 41 snapshot->overlay = intel_overlay_snapshot_capture(display); 42 snapshot->dmc = intel_dmc_snapshot_capture(display); 43 44 return snapshot; 45} 46 47void intel_display_snapshot_print(const struct intel_display_snapshot *snapshot, 48 struct drm_printer *p) 49{ 50 struct intel_display *display; 51 52 if (!snapshot) 53 return; 54 55 display = snapshot->display; 56 57 intel_display_device_info_print(&snapshot->info, &snapshot->runtime_info, p); 58 intel_display_params_dump(&snapshot->params, display->drm->driver->name, p); 59 60 intel_overlay_snapshot_print(snapshot->overlay, p); 61 intel_dmc_snapshot_print(snapshot->dmc, p); 62} 63 64void intel_display_snapshot_free(struct intel_display_snapshot *snapshot) 65{ 66 if (!snapshot) 67 return; 68 69 intel_display_params_free(&snapshot->params); 70 71 kfree(snapshot->overlay); 72 kfree(snapshot->dmc); 73 kfree(snapshot); 74}