Skip to content

Commit b3c8fa0

Browse files
jnikulahogander
authored andcommitted
drm/{i915, xe}/display: pass parent interface to display probe
Let's gradually start calling i915 and xe parent, or core, drivers from display via function pointers passed at display probe. Going forward, the struct intel_display_parent_interface is expected to include const pointers to sub-structs by functionality, for example: struct intel_display_rpm { struct ref_tracker *(*get)(struct drm_device *drm); /* ... */ }; struct intel_display_parent_interface { /* ... */ const struct intel_display_rpm *rpm; }; This is a baby step towards not building display as part of both i915 and xe drivers, but rather making it an independent driver interfacing with the two. v3: useless include additions dropped v2: unrelated include removal dropped Cc: Jouni Högander <jouni.hogander@intel.com> Cc: Lucas De Marchi <lucas.demarchi@intel.com> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Jouni Högander <jouni.hogander@intel.com> Link: https://patch.msgid.link/20251030202836.1815680-2-jouni.hogander@intel.com
1 parent ad7108f commit b3c8fa0

8 files changed

Lines changed: 57 additions & 5 deletions

File tree

drivers/gpu/drm/i915/display/intel_display_core.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ struct intel_cdclk_vals;
4141
struct intel_color_funcs;
4242
struct intel_crtc;
4343
struct intel_crtc_state;
44+
struct intel_display_parent_interface;
4445
struct intel_dmc;
4546
struct intel_dpll_global_funcs;
4647
struct intel_dpll_mgr;
@@ -291,6 +292,9 @@ struct intel_display {
291292
/* Intel PCH: where the south display engine lives */
292293
enum intel_pch pch_type;
293294

295+
/* Parent, or core, driver functions exposed to display */
296+
const struct intel_display_parent_interface *parent;
297+
294298
/* Display functions */
295299
struct {
296300
/* Top level crtc-ish functions */

drivers/gpu/drm/i915/display/intel_display_device.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1647,7 +1647,8 @@ static void display_platforms_or(struct intel_display_platforms *dst,
16471647
bitmap_or(dst->bitmap, dst->bitmap, src->bitmap, display_platforms_num_bits());
16481648
}
16491649

1650-
struct intel_display *intel_display_device_probe(struct pci_dev *pdev)
1650+
struct intel_display *intel_display_device_probe(struct pci_dev *pdev,
1651+
const struct intel_display_parent_interface *parent)
16511652
{
16521653
struct intel_display *display;
16531654
const struct intel_display_device_info *info;
@@ -1663,6 +1664,8 @@ struct intel_display *intel_display_device_probe(struct pci_dev *pdev)
16631664
/* Add drm device backpointer as early as possible. */
16641665
display->drm = pci_get_drvdata(pdev);
16651666

1667+
display->parent = parent;
1668+
16661669
intel_display_params_copy(&display->params);
16671670

16681671
if (has_no_display(pdev)) {

drivers/gpu/drm/i915/display/intel_display_device.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
struct drm_printer;
1515
struct intel_display;
16+
struct intel_display_parent_interface;
1617
struct pci_dev;
1718

1819
/*
@@ -313,7 +314,8 @@ struct intel_display_device_info {
313314

314315
bool intel_display_device_present(struct intel_display *display);
315316
bool intel_display_device_enabled(struct intel_display *display);
316-
struct intel_display *intel_display_device_probe(struct pci_dev *pdev);
317+
struct intel_display *intel_display_device_probe(struct pci_dev *pdev,
318+
const struct intel_display_parent_interface *parent);
317319
void intel_display_device_remove(struct intel_display *display);
318320
void intel_display_device_info_runtime_init(struct intel_display *display);
319321

drivers/gpu/drm/i915/i915_driver.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
#include <drm/drm_managed.h>
4848
#include <drm/drm_probe_helper.h>
4949
#include <drm/intel/display_member.h>
50+
#include <drm/intel/display_parent_interface.h>
5051

5152
#include "display/i9xx_display_sr.h"
5253
#include "display/intel_bw.h"
@@ -738,6 +739,14 @@ static void i915_welcome_messages(struct drm_i915_private *dev_priv)
738739
"DRM_I915_DEBUG_RUNTIME_PM enabled\n");
739740
}
740741

742+
static const struct intel_display_parent_interface parent = {
743+
};
744+
745+
const struct intel_display_parent_interface *i915_driver_parent_interface(void)
746+
{
747+
return &parent;
748+
}
749+
741750
/* Ensure drm and display members are placed properly. */
742751
INTEL_DISPLAY_MEMBER_STATIC_ASSERT(struct drm_i915_private, drm, display);
743752

@@ -762,7 +771,7 @@ i915_driver_create(struct pci_dev *pdev, const struct pci_device_id *ent)
762771
/* Set up device info and initial runtime info. */
763772
intel_device_info_driver_create(i915, pdev->device, match_info);
764773

765-
display = intel_display_device_probe(pdev);
774+
display = intel_display_device_probe(pdev, &parent);
766775
if (IS_ERR(display))
767776
return ERR_CAST(display);
768777

drivers/gpu/drm/i915/i915_driver.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ struct pci_dev;
1212
struct pci_device_id;
1313
struct drm_i915_private;
1414
struct drm_printer;
15+
struct intel_display_parent_interface;
1516

1617
#define DRIVER_NAME "i915"
1718
#define DRIVER_DESC "Intel Graphics"
@@ -24,6 +25,7 @@ void i915_driver_shutdown(struct drm_i915_private *i915);
2425

2526
int i915_driver_resume_switcheroo(struct drm_i915_private *i915);
2627
int i915_driver_suspend_switcheroo(struct drm_i915_private *i915, pm_message_t state);
28+
const struct intel_display_parent_interface *i915_driver_parent_interface(void);
2729

2830
void
2931
i915_print_iommu_status(struct drm_i915_private *i915, struct drm_printer *p);

drivers/gpu/drm/i915/selftests/mock_gem_device.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "gt/intel_gt.h"
3434
#include "gt/intel_gt_requests.h"
3535
#include "gt/mock_engine.h"
36+
#include "i915_driver.h"
3637
#include "intel_memory_region.h"
3738
#include "intel_region_ttm.h"
3839

@@ -183,7 +184,8 @@ struct drm_i915_private *mock_gem_device(void)
183184
/* Set up device info and initial runtime info. */
184185
intel_device_info_driver_create(i915, pdev->device, &mock_info);
185186

186-
display = intel_display_device_probe(pdev);
187+
/* FIXME: Can we run selftests using a mock device without display? */
188+
display = intel_display_device_probe(pdev, i915_driver_parent_interface());
187189
if (IS_ERR(display))
188190
goto err_device;
189191

drivers/gpu/drm/xe/display/xe_display.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <drm/drm_managed.h>
1515
#include <drm/drm_probe_helper.h>
1616
#include <drm/intel/display_member.h>
17+
#include <drm/intel/display_parent_interface.h>
1718
#include <uapi/drm/xe_drm.h>
1819

1920
#include "soc/intel_dram.h"
@@ -515,6 +516,9 @@ static void display_device_remove(struct drm_device *dev, void *arg)
515516
intel_display_device_remove(display);
516517
}
517518

519+
static const struct intel_display_parent_interface parent = {
520+
};
521+
518522
/**
519523
* xe_display_probe - probe display and create display struct
520524
* @xe: XE device instance
@@ -535,7 +539,7 @@ int xe_display_probe(struct xe_device *xe)
535539
if (!xe->info.probe_display)
536540
goto no_display;
537541

538-
display = intel_display_device_probe(pdev);
542+
display = intel_display_device_probe(pdev, &parent);
539543
if (IS_ERR(display))
540544
return PTR_ERR(display);
541545

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/* SPDX-License-Identifier: MIT */
2+
/* Copyright © 2025 Intel Corporation x*/
3+
4+
#ifndef __DISPLAY_PARENT_INTERFACE_H__
5+
#define __DISPLAY_PARENT_INTERFACE_H__
6+
7+
#include <linux/types.h>
8+
9+
struct drm_device;
10+
11+
/**
12+
* struct intel_display_parent_interface - services parent driver provides to display
13+
*
14+
* The parent, or core, driver provides a pointer to this structure to display
15+
* driver when calling intel_display_device_probe(). The display driver uses it
16+
* to access services provided by the parent driver. The structure may contain
17+
* sub-struct pointers to group function pointers by functionality.
18+
*
19+
* All function and sub-struct pointers must be initialized and callable unless
20+
* explicitly marked as "optional" below. The display driver will only NULL
21+
* check the optional pointers.
22+
*/
23+
struct intel_display_parent_interface {
24+
};
25+
26+
#endif

0 commit comments

Comments
 (0)