File: display_member.h

package info (click to toggle)
linux 6.19.2-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 1,759,612 kB
  • sloc: ansic: 27,004,852; asm: 273,402; sh: 151,313; python: 81,277; makefile: 58,544; perl: 34,311; xml: 21,064; cpp: 5,984; yacc: 4,841; lex: 2,901; awk: 1,707; sed: 30; ruby: 25
file content (42 lines) | stat: -rw-r--r-- 1,496 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* SPDX-License-Identifier: MIT */
/* Copyright © 2025 Intel Corporation */

#ifndef __DRM_INTEL_DISPLAY_H__
#define __DRM_INTEL_DISPLAY_H__

#include <linux/build_bug.h>
#include <linux/stddef.h>
#include <linux/stringify.h>

#include <drm/drm_device.h>

struct intel_display;

/*
 * A dummy device struct to define the relative offsets of drm and display
 * members. With the members identically placed in struct drm_i915_private and
 * struct xe_device, this allows figuring out the struct intel_display pointer
 * without the definition of either driver specific structure.
 */
struct __intel_generic_device {
	struct drm_device drm;
	struct intel_display *display;
};

/**
 * INTEL_DISPLAY_MEMBER_STATIC_ASSERT() - ensure correct placing of drm and display members
 * @type: The struct to check
 * @drm_member: Name of the struct drm_device member
 * @display_member: Name of the struct intel_display * member.
 *
 * Use this static assert macro to ensure the struct drm_i915_private and struct
 * xe_device struct drm_device and struct intel_display * members are at the
 * same relative offsets.
 */
#define INTEL_DISPLAY_MEMBER_STATIC_ASSERT(type, drm_member, display_member) \
	static_assert( \
		offsetof(struct __intel_generic_device, display) - offsetof(struct __intel_generic_device, drm) == \
		offsetof(type, display_member) - offsetof(type, drm_member), \
		__stringify(type) " " __stringify(drm_member) " and " __stringify(display_member) " members at invalid offsets")

#endif