Commit 3834ea74 authored by Jani Nikula's avatar Jani Nikula
Browse files

drm/i915/dpt: move suspend/resume to parent interface



Add per-vm DPT suspend/resume calls to the display parent interface, and
lift the generic code away from i915 specific code.

Reviewed-by: default avatarJuha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Link: https://patch.msgid.link/080945a49559ec1f5183ad409e1526736e828d90.1772030909.git.jani.nikula@intel.com


Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
parent 2a62dc74
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -10,13 +10,10 @@

struct i915_address_space;
struct i915_vma;
struct intel_display;

struct i915_vma *intel_dpt_pin_to_ggtt(struct i915_address_space *vm,
				       unsigned int alignment);
void intel_dpt_unpin_from_ggtt(struct i915_address_space *vm);
void intel_dpt_suspend(struct intel_display *display);
void intel_dpt_resume(struct intel_display *display);
u64 intel_dpt_offset(struct i915_vma *dpt_vma);

#endif /* __INTEL_DPT_H__ */
+59 −0
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@
#include "intel_display_regs.h"
#include "intel_display_types.h"
#include "intel_dpt_common.h"
#include "intel_parent.h"
#include "skl_universal_plane_regs.h"

void intel_dpt_configure(struct intel_crtc *crtc)
@@ -33,3 +34,61 @@ void intel_dpt_configure(struct intel_crtc *crtc)
			     CHICKEN_MISC_DISABLE_DPT);
	}
}

/**
 * intel_dpt_suspend - suspend the memory mapping for all DPT FBs during system suspend
 * @display: display device instance
 *
 * Suspend the memory mapping during system suspend for all framebuffers which
 * are mapped to HW via a GGTT->DPT page table.
 *
 * This function must be called before the mappings in GGTT are suspended calling
 * i915_ggtt_suspend().
 */
void intel_dpt_suspend(struct intel_display *display)
{
	struct drm_framebuffer *drm_fb;

	if (!HAS_DISPLAY(display))
		return;

	mutex_lock(&display->drm->mode_config.fb_lock);

	drm_for_each_fb(drm_fb, display->drm) {
		struct intel_framebuffer *fb = to_intel_framebuffer(drm_fb);

		if (fb->dpt_vm)
			intel_parent_dpt_suspend(display, fb->dpt_vm);
	}

	mutex_unlock(&display->drm->mode_config.fb_lock);
}

/**
 * intel_dpt_resume - restore the memory mapping for all DPT FBs during system resume
 * @display: display device instance
 *
 * Restore the memory mapping during system resume for all framebuffers which
 * are mapped to HW via a GGTT->DPT page table. The content of these page
 * tables are not stored in the hibernation image during S4 and S3RST->S4
 * transitions, so here we reprogram the PTE entries in those tables.
 *
 * This function must be called after the mappings in GGTT have been restored calling
 * i915_ggtt_resume().
 */
void intel_dpt_resume(struct intel_display *display)
{
	struct drm_framebuffer *drm_fb;

	if (!HAS_DISPLAY(display))
		return;

	mutex_lock(&display->drm->mode_config.fb_lock);
	drm_for_each_fb(drm_fb, display->drm) {
		struct intel_framebuffer *fb = to_intel_framebuffer(drm_fb);

		if (fb->dpt_vm)
			intel_parent_dpt_resume(display, fb->dpt_vm);
	}
	mutex_unlock(&display->drm->mode_config.fb_lock);
}
+3 −0
Original line number Diff line number Diff line
@@ -7,7 +7,10 @@
#define __INTEL_DPT_COMMON_H__

struct intel_crtc;
struct intel_display;

void intel_dpt_configure(struct intel_crtc *crtc);
void intel_dpt_suspend(struct intel_display *display);
void intel_dpt_resume(struct intel_display *display);

#endif /* __INTEL_DPT_COMMON_H__ */
+12 −0
Original line number Diff line number Diff line
@@ -40,6 +40,18 @@ void intel_parent_dpt_destroy(struct intel_display *display, struct i915_address
		display->parent->dpt->destroy(vm);
}

void intel_parent_dpt_suspend(struct intel_display *display, struct i915_address_space *vm)
{
	if (display->parent->dpt)
		display->parent->dpt->suspend(vm);
}

void intel_parent_dpt_resume(struct intel_display *display, struct i915_address_space *vm)
{
	if (display->parent->dpt)
		display->parent->dpt->resume(vm);
}

/* hdcp */
ssize_t intel_parent_hdcp_gsc_msg_send(struct intel_display *display,
				       struct intel_hdcp_gsc_context *gsc_context,
+2 −0
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@ struct i915_address_space *intel_parent_dpt_create(struct intel_display *display
						   struct drm_gem_object *obj,
						   size_t size);
void intel_parent_dpt_destroy(struct intel_display *display, struct i915_address_space *vm);
void intel_parent_dpt_suspend(struct intel_display *display, struct i915_address_space *vm);
void intel_parent_dpt_resume(struct intel_display *display, struct i915_address_space *vm);

/* hdcp */
ssize_t intel_parent_hdcp_gsc_msg_send(struct intel_display *display,
Loading