[RFC 5/7] drm/i915: allocate struct intel_display dynamically
Jani Nikula
jani.nikula at intel.com
Tue Mar 11 17:06:12 UTC 2025
A quick hack to allocate struct intel_display dynamically. No error
handling yet.
For xe, xe->display may be NULL for DRM_XE_DISPLAY=n or
xe.probe_display=n. This needs to be handled gracefully.
Signed-off-by: Jani Nikula <jani.nikula at intel.com>
---
drivers/gpu/drm/i915/i915_driver.c | 4 ++--
drivers/gpu/drm/i915/i915_drv.h | 1 -
drivers/gpu/drm/xe/display/xe_display.c | 4 ++--
drivers/gpu/drm/xe/xe_device_types.h | 1 -
4 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
index 5e190085041f..284fcbe3b2c4 100644
--- a/drivers/gpu/drm/i915/i915_driver.c
+++ b/drivers/gpu/drm/i915/i915_driver.c
@@ -754,8 +754,8 @@ i915_driver_create(struct pci_dev *pdev, const struct pci_device_id *ent)
/* Set up device info and initial runtime info. */
intel_device_info_driver_create(i915, pdev->device, match_info);
- /* Transitional. To be allocated dynamically. */
- i915->display = &i915->__display;
+ /* FIXME: Error handling. */
+ i915->display = kzalloc(sizeof(struct intel_display), GFP_KERNEL);
intel_display_device_probe(pdev);
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 8ea147dd0fd8..32d5cca0ffc6 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -180,7 +180,6 @@ struct drm_i915_private {
struct drm_device drm;
struct intel_display *display;
- struct intel_display __display; /* Transitional. Do not use. */
/* FIXME: Device release actions should all be moved to drmm_ */
bool do_release;
diff --git a/drivers/gpu/drm/xe/display/xe_display.c b/drivers/gpu/drm/xe/display/xe_display.c
index 7c2f85ce7d2d..258518e65bdc 100644
--- a/drivers/gpu/drm/xe/display/xe_display.c
+++ b/drivers/gpu/drm/xe/display/xe_display.c
@@ -101,8 +101,8 @@ static void display_destroy(struct drm_device *dev, void *dummy)
*/
int xe_display_create(struct xe_device *xe)
{
- /* Transitional. To be allocated dynamically. */
- xe->display = &xe->__display;
+ /* FIXME: Error handling. */
+ xe->display = kzalloc(sizeof(struct intel_display), GFP_KERNEL);
spin_lock_init(&xe->display->fb_tracking.lock);
diff --git a/drivers/gpu/drm/xe/xe_device_types.h b/drivers/gpu/drm/xe/xe_device_types.h
index a7362c756caf..454975cd3327 100644
--- a/drivers/gpu/drm/xe/xe_device_types.h
+++ b/drivers/gpu/drm/xe/xe_device_types.h
@@ -570,7 +570,6 @@ struct xe_device {
* migrating to the right sub-structs
*/
struct intel_display *display;
- struct intel_display __display; /* Transitional. Do not use. */
enum intel_pch pch_type;
struct dram_info {
--
2.39.5
More information about the Intel-xe
mailing list