Skip to content

Commit adceb41

Browse files
committed
drm/i915/display: add intel_display_conversion.c to hide stuff better
The __to_intel_display() generics require the definition of struct drm_i915_private i.e. inclusion of i915_drv.h. Add intel_display_conversion.c with a __i915_to_display() function to do the conversion without the intel_display_conversion.h having an implicit dependency on i915_drv.h. The long term goal is to remove __to_intel_display() and the intel_display_conversion.[ch] files altoghether, and this is merely a transitional step to make the dependencies on i915_drv.h explicit. Reviewed-by: Luca Coelho <luciano.coelho@intel.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/39e99b765b8c1a05d001659c39686a661ac268e2.1732104170.git.jani.nikula@intel.com
1 parent 17d7072 commit adceb41

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

drivers/gpu/drm/i915/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ i915-y += \
238238
display/intel_crtc_state_dump.o \
239239
display/intel_cursor.o \
240240
display/intel_display.o \
241+
display/intel_display_conversion.o \
241242
display/intel_display_driver.o \
242243
display/intel_display_irq.o \
243244
display/intel_display_params.o \
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// SPDX-License-Identifier: MIT
2+
/* Copyright © 2024 Intel Corporation */
3+
4+
#include "i915_drv.h"
5+
6+
struct intel_display *__i915_to_display(struct drm_i915_private *i915)
7+
{
8+
return &i915->display;
9+
}

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,19 @@
88
#ifndef __INTEL_DISPLAY_CONVERSION__
99
#define __INTEL_DISPLAY_CONVERSION__
1010

11+
struct drm_i915_private;
12+
struct intel_display;
13+
14+
struct intel_display *__i915_to_display(struct drm_i915_private *i915);
15+
1116
/*
1217
* Transitional macro to optionally convert struct drm_i915_private * to struct
1318
* intel_display *, also accepting the latter.
1419
*/
1520
#define __to_intel_display(p) \
1621
_Generic(p, \
17-
const struct drm_i915_private *: (&((const struct drm_i915_private *)(p))->display), \
18-
struct drm_i915_private *: (&((struct drm_i915_private *)(p))->display), \
22+
const struct drm_i915_private *: __i915_to_display((struct drm_i915_private *)(p)), \
23+
struct drm_i915_private *: __i915_to_display((struct drm_i915_private *)(p)), \
1924
const struct intel_display *: (p), \
2025
struct intel_display *: (p))
2126

drivers/gpu/drm/xe/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ xe-$(CONFIG_DRM_XE_DISPLAY) += \
206206
i915-display/intel_ddi.o \
207207
i915-display/intel_ddi_buf_trans.o \
208208
i915-display/intel_display.o \
209+
i915-display/intel_display_conversion.o \
209210
i915-display/intel_display_device.o \
210211
i915-display/intel_display_driver.o \
211212
i915-display/intel_display_irq.o \

0 commit comments

Comments
 (0)