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.

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

authored by

Jani Nikula and committed by
Jouni Högander
b3c8fa0d ad7108f9

+57 -5
+4
drivers/gpu/drm/i915/display/intel_display_core.h
··· 41 41 struct intel_color_funcs; 42 42 struct intel_crtc; 43 43 struct intel_crtc_state; 44 + struct intel_display_parent_interface; 44 45 struct intel_dmc; 45 46 struct intel_dpll_global_funcs; 46 47 struct intel_dpll_mgr; ··· 291 290 292 291 /* Intel PCH: where the south display engine lives */ 293 292 enum intel_pch pch_type; 293 + 294 + /* Parent, or core, driver functions exposed to display */ 295 + const struct intel_display_parent_interface *parent; 294 296 295 297 /* Display functions */ 296 298 struct {
+4 -1
drivers/gpu/drm/i915/display/intel_display_device.c
··· 1647 1647 bitmap_or(dst->bitmap, dst->bitmap, src->bitmap, display_platforms_num_bits()); 1648 1648 } 1649 1649 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) 1651 1652 { 1652 1653 struct intel_display *display; 1653 1654 const struct intel_display_device_info *info; ··· 1663 1662 1664 1663 /* Add drm device backpointer as early as possible. */ 1665 1664 display->drm = pci_get_drvdata(pdev); 1665 + 1666 + display->parent = parent; 1666 1667 1667 1668 intel_display_params_copy(&display->params); 1668 1669
+3 -1
drivers/gpu/drm/i915/display/intel_display_device.h
··· 13 13 14 14 struct drm_printer; 15 15 struct intel_display; 16 + struct intel_display_parent_interface; 16 17 struct pci_dev; 17 18 18 19 /* ··· 314 313 315 314 bool intel_display_device_present(struct intel_display *display); 316 315 bool intel_display_device_enabled(struct intel_display *display); 317 - struct intel_display *intel_display_device_probe(struct pci_dev *pdev); 316 + struct intel_display *intel_display_device_probe(struct pci_dev *pdev, 317 + const struct intel_display_parent_interface *parent); 318 318 void intel_display_device_remove(struct intel_display *display); 319 319 void intel_display_device_info_runtime_init(struct intel_display *display); 320 320
+10 -1
drivers/gpu/drm/i915/i915_driver.c
··· 47 47 #include <drm/drm_managed.h> 48 48 #include <drm/drm_probe_helper.h> 49 49 #include <drm/intel/display_member.h> 50 + #include <drm/intel/display_parent_interface.h> 50 51 51 52 #include "display/i9xx_display_sr.h" 52 53 #include "display/intel_bw.h" ··· 739 738 "DRM_I915_DEBUG_RUNTIME_PM enabled\n"); 740 739 } 741 740 741 + static const struct intel_display_parent_interface parent = { 742 + }; 743 + 744 + const struct intel_display_parent_interface *i915_driver_parent_interface(void) 745 + { 746 + return &parent; 747 + } 748 + 742 749 /* Ensure drm and display members are placed properly. */ 743 750 INTEL_DISPLAY_MEMBER_STATIC_ASSERT(struct drm_i915_private, drm, display); 744 751 ··· 771 762 /* Set up device info and initial runtime info. */ 772 763 intel_device_info_driver_create(i915, pdev->device, match_info); 773 764 774 - display = intel_display_device_probe(pdev); 765 + display = intel_display_device_probe(pdev, &parent); 775 766 if (IS_ERR(display)) 776 767 return ERR_CAST(display); 777 768
+2
drivers/gpu/drm/i915/i915_driver.h
··· 12 12 struct pci_device_id; 13 13 struct drm_i915_private; 14 14 struct drm_printer; 15 + struct intel_display_parent_interface; 15 16 16 17 #define DRIVER_NAME "i915" 17 18 #define DRIVER_DESC "Intel Graphics" ··· 25 24 26 25 int i915_driver_resume_switcheroo(struct drm_i915_private *i915); 27 26 int i915_driver_suspend_switcheroo(struct drm_i915_private *i915, pm_message_t state); 27 + const struct intel_display_parent_interface *i915_driver_parent_interface(void); 28 28 29 29 void 30 30 i915_print_iommu_status(struct drm_i915_private *i915, struct drm_printer *p);
+3 -1
drivers/gpu/drm/i915/selftests/mock_gem_device.c
··· 33 33 #include "gt/intel_gt.h" 34 34 #include "gt/intel_gt_requests.h" 35 35 #include "gt/mock_engine.h" 36 + #include "i915_driver.h" 36 37 #include "intel_memory_region.h" 37 38 #include "intel_region_ttm.h" 38 39 ··· 184 183 /* Set up device info and initial runtime info. */ 185 184 intel_device_info_driver_create(i915, pdev->device, &mock_info); 186 185 187 - display = intel_display_device_probe(pdev); 186 + /* FIXME: Can we run selftests using a mock device without display? */ 187 + display = intel_display_device_probe(pdev, i915_driver_parent_interface()); 188 188 if (IS_ERR(display)) 189 189 goto err_device; 190 190
+5 -1
drivers/gpu/drm/xe/display/xe_display.c
··· 14 14 #include <drm/drm_managed.h> 15 15 #include <drm/drm_probe_helper.h> 16 16 #include <drm/intel/display_member.h> 17 + #include <drm/intel/display_parent_interface.h> 17 18 #include <uapi/drm/xe_drm.h> 18 19 19 20 #include "soc/intel_dram.h" ··· 516 515 intel_display_device_remove(display); 517 516 } 518 517 518 + static const struct intel_display_parent_interface parent = { 519 + }; 520 + 519 521 /** 520 522 * xe_display_probe - probe display and create display struct 521 523 * @xe: XE device instance ··· 539 535 if (!xe->info.probe_display) 540 536 goto no_display; 541 537 542 - display = intel_display_device_probe(pdev); 538 + display = intel_display_device_probe(pdev, &parent); 543 539 if (IS_ERR(display)) 544 540 return PTR_ERR(display); 545 541
+26
include/drm/intel/display_parent_interface.h
··· 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