Commit 2cca2516 authored by Jani Nikula's avatar Jani Nikula
Browse files

drm/{i915, xe}/frontbuffer: move frontbuffer handling to parent interface



Move the get/put/ref/flush_for_display calls to the display parent
interface.

For i915, move the hooks next to the other i915 core frontbuffer code in
i915_gem_object_frontbuffer.c. For xe, add new file xe_frontbuffer.c for
the same.

Note: The intel_frontbuffer_flush() calls from
i915_gem_object_frontbuffer.c will partially route back to i915 core via
the parent interface. This is less than stellar.

Reviewed-by: default avatarJouni Högander <jouni.hogander@intel.com>
Link: https://patch.msgid.link/f69b967ed82bbcfd60ffa77ba197b26a1399f09f.1772475391.git.jani.nikula@intel.com


Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
parent 6a3e5eb3
Loading
Loading
Loading
Loading
+0 −36
Original line number Diff line number Diff line
@@ -45,42 +45,6 @@ int intel_bo_read_from_page(struct drm_gem_object *obj, u64 offset, void *dst, i
	return i915_gem_object_read_from_page(to_intel_bo(obj), offset, dst, size);
}

struct intel_frontbuffer *intel_bo_frontbuffer_get(struct drm_gem_object *_obj)
{
	struct drm_i915_gem_object *obj = to_intel_bo(_obj);
	struct i915_frontbuffer *front;

	front = i915_gem_object_frontbuffer_get(obj);
	if (!front)
		return NULL;

	return &front->base;
}

void intel_bo_frontbuffer_ref(struct intel_frontbuffer *_front)
{
	struct i915_frontbuffer *front =
		container_of(_front, typeof(*front), base);

	i915_gem_object_frontbuffer_ref(front);
}

void intel_bo_frontbuffer_put(struct intel_frontbuffer *_front)
{
	struct i915_frontbuffer *front =
		container_of(_front, typeof(*front), base);

	return i915_gem_object_frontbuffer_put(front);
}

void intel_bo_frontbuffer_flush_for_display(struct intel_frontbuffer *_front)
{
	struct i915_frontbuffer *front =
		container_of(_front, typeof(*front), base);

	i915_gem_object_flush_if_display(front->obj);
}

void intel_bo_describe(struct seq_file *m, struct drm_gem_object *obj)
{
	i915_debugfs_describe_obj(m, to_intel_bo(obj));
+0 −5
Original line number Diff line number Diff line
@@ -20,11 +20,6 @@ int intel_bo_key_check(struct drm_gem_object *obj);
int intel_bo_fb_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma);
int intel_bo_read_from_page(struct drm_gem_object *obj, u64 offset, void *dst, int size);

struct intel_frontbuffer *intel_bo_frontbuffer_get(struct drm_gem_object *obj);
void intel_bo_frontbuffer_ref(struct intel_frontbuffer *front);
void intel_bo_frontbuffer_put(struct intel_frontbuffer *front);
void intel_bo_frontbuffer_flush_for_display(struct intel_frontbuffer *front);

void intel_bo_describe(struct seq_file *m, struct drm_gem_object *obj);

#endif /* __INTEL_BO__ */
+7 −5
Original line number Diff line number Diff line
@@ -58,13 +58,13 @@
#include <drm/drm_gem.h>
#include <drm/drm_print.h>

#include "intel_bo.h"
#include "intel_display_trace.h"
#include "intel_display_types.h"
#include "intel_dp.h"
#include "intel_drrs.h"
#include "intel_fbc.h"
#include "intel_frontbuffer.h"
#include "intel_parent.h"
#include "intel_psr.h"
#include "intel_tdf.h"

@@ -150,7 +150,7 @@ void __intel_fb_flush(struct intel_frontbuffer *front,
	struct intel_display *display = front->display;

	if (origin == ORIGIN_DIRTYFB)
		intel_bo_frontbuffer_flush_for_display(front);
		intel_parent_frontbuffer_flush_for_display(display, front);

	if (origin == ORIGIN_CS) {
		spin_lock(&display->fb_tracking.lock);
@@ -166,7 +166,7 @@ void __intel_fb_flush(struct intel_frontbuffer *front,

static void intel_frontbuffer_ref(struct intel_frontbuffer *front)
{
	intel_bo_frontbuffer_ref(front);
	intel_parent_frontbuffer_ref(front->display, front);
}

static void intel_frontbuffer_flush_work(struct work_struct *work)
@@ -209,12 +209,14 @@ void intel_frontbuffer_fini(struct intel_frontbuffer *front)

struct intel_frontbuffer *intel_frontbuffer_get(struct drm_gem_object *obj)
{
	return intel_bo_frontbuffer_get(obj);
	struct intel_display *display = to_intel_display(obj->dev);

	return intel_parent_frontbuffer_get(display, obj);
}

void intel_frontbuffer_put(struct intel_frontbuffer *front)
{
	intel_bo_frontbuffer_put(front);
	intel_parent_frontbuffer_put(front->display, front);
}

/**
+21 −0
Original line number Diff line number Diff line
@@ -51,6 +51,27 @@ void intel_parent_dpt_resume(struct intel_display *display, struct intel_dpt *dp
		display->parent->dpt->resume(dpt);
}

/* frontbuffer */
struct intel_frontbuffer *intel_parent_frontbuffer_get(struct intel_display *display, struct drm_gem_object *obj)
{
	return display->parent->frontbuffer->get(obj);
}

void intel_parent_frontbuffer_ref(struct intel_display *display, struct intel_frontbuffer *front)
{
	display->parent->frontbuffer->ref(front);
}

void intel_parent_frontbuffer_put(struct intel_display *display, struct intel_frontbuffer *front)
{
	display->parent->frontbuffer->put(front);
}

void intel_parent_frontbuffer_flush_for_display(struct intel_display *display, struct intel_frontbuffer *front)
{
	display->parent->frontbuffer->flush_for_display(front);
}

/* hdcp */
ssize_t intel_parent_hdcp_gsc_msg_send(struct intel_display *display,
				       struct intel_hdcp_gsc_context *gsc_context,
+7 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@ struct drm_scanout_buffer;
struct i915_vma;
struct intel_display;
struct intel_dpt;
struct intel_frontbuffer;
struct intel_hdcp_gsc_context;
struct intel_panic;
struct intel_stolen_node;
@@ -24,6 +25,12 @@ void intel_parent_dpt_destroy(struct intel_display *display, struct intel_dpt *d
void intel_parent_dpt_suspend(struct intel_display *display, struct intel_dpt *dpt);
void intel_parent_dpt_resume(struct intel_display *display, struct intel_dpt *dpt);

/* frontbuffer */
struct intel_frontbuffer *intel_parent_frontbuffer_get(struct intel_display *display, struct drm_gem_object *obj);
void intel_parent_frontbuffer_ref(struct intel_display *display, struct intel_frontbuffer *front);
void intel_parent_frontbuffer_put(struct intel_display *display, struct intel_frontbuffer *front);
void intel_parent_frontbuffer_flush_for_display(struct intel_display *display, struct intel_frontbuffer *front);

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