XenevaOS
Loading...
Searching...
No Matches
drm_gem_vram_helper.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2
3#ifndef DRM_GEM_VRAM_HELPER_H
4#define DRM_GEM_VRAM_HELPER_H
5
6#include <drm/drm_file.h>
7#include <drm/drm_gem.h>
9#include <drm/drm_ioctl.h>
10#include <drm/drm_modes.h>
11#include <drm/ttm/ttm_bo.h>
12#include <drm/ttm/ttm_placement.h>
13
14#include <linux/container_of.h>
15#include <linux/iosys-map.h>
16
18struct drm_plane;
19struct drm_plane_state;
20struct filp;
21struct vm_area_struct;
22
23#define DRM_GEM_VRAM_PL_FLAG_SYSTEM (1 << 0)
24#define DRM_GEM_VRAM_PL_FLAG_VRAM (1 << 1)
25#define DRM_GEM_VRAM_PL_FLAG_TOPDOWN (1 << 2)
26
27/*
28 * Buffer-object helpers
29 */
30
52 struct ttm_buffer_object bo;
53 struct iosys_map map;
54
61 unsigned int vmap_use_count;
62
63 /* Supported placements are %TTM_PL_VRAM and %TTM_PL_SYSTEM */
64 struct ttm_placement placement;
65 struct ttm_place placements[2];
66};
67
74static inline struct drm_gem_vram_object *drm_gem_vram_of_bo(
75 struct ttm_buffer_object *bo)
76{
77 return container_of(bo, struct drm_gem_vram_object, bo);
78}
79
86static inline struct drm_gem_vram_object *drm_gem_vram_of_gem(
87 struct drm_gem_object *gem)
88{
89 return container_of(gem, struct drm_gem_vram_object, bo.base);
90}
91
93 size_t size,
94 unsigned long pg_align);
99 struct iosys_map *map);
100
102 struct drm_device *dev,
103 unsigned long pg_align,
104 unsigned long pitch_align,
105 struct drm_mode_create_dumb *args);
106
107/*
108 * Helpers for struct drm_driver
109 */
110
112 struct drm_device *dev,
113 struct drm_mode_create_dumb *args);
114
115/*
116 * Helpers for struct drm_plane_helper_funcs
117 */
118int
120 struct drm_plane_state *new_state);
121void
123 struct drm_plane_state *old_state);
124
133#define DRM_GEM_VRAM_PLANE_HELPER_FUNCS \
134 .prepare_fb = drm_gem_vram_plane_helper_prepare_fb, \
135 .cleanup_fb = drm_gem_vram_plane_helper_cleanup_fb
136
144#define DRM_GEM_VRAM_DRIVER \
145 .debugfs_init = drm_vram_mm_debugfs_init, \
146 .dumb_create = drm_gem_vram_driver_dumb_create, \
147 .dumb_map_offset = drm_gem_ttm_dumb_map_offset
148
149/*
150 * VRAM memory manager
151 */
152
166 size_t vram_size;
167
168 struct ttm_device bdev;
169};
170
179static inline struct drm_vram_mm *drm_vram_mm_of_bdev(
180 struct ttm_device *bdev)
181{
182 return container_of(bdev, struct drm_vram_mm, bdev);
183}
184
186
187/*
188 * Helpers for integration with struct drm_device
189 */
190
192 size_t vram_size);
193
194/*
195 * Mode-config helpers
196 */
197
200 const struct drm_display_mode *mode);
201
202#endif
COMPILER_DEPENDENT_UINT64 uint64_t
Definition acefiex.h:165
#define container_of(ptr, type, member)
Definition container_of.h:19
int map
Definition d_mode.c:31
size_t size
Definition drm_bridge.h:1299
int drm_gem_vram_driver_dumb_create(struct drm_file *file, struct drm_device *dev, struct drm_mode_create_dumb *args)
int drm_gem_vram_vmap(struct drm_gem_vram_object *gbo, struct iosys_map *map)
void drm_gem_vram_put(struct drm_gem_vram_object *gbo)
int drm_gem_vram_fill_create_dumb(struct drm_file *file, struct drm_device *dev, unsigned long pg_align, unsigned long pitch_align, struct drm_mode_create_dumb *args)
enum drm_mode_status drm_vram_helper_mode_valid(struct drm_device *dev, const struct drm_display_mode *mode)
void drm_gem_vram_vunmap(struct drm_gem_vram_object *gbo, struct iosys_map *map)
void drm_vram_mm_debugfs_init(struct drm_minor *minor)
s64 drm_gem_vram_offset(struct drm_gem_vram_object *gbo)
struct drm_gem_vram_object * drm_gem_vram_create(struct drm_device *dev, size_t size, unsigned long pg_align)
void drm_gem_vram_plane_helper_cleanup_fb(struct drm_plane *plane, struct drm_plane_state *old_state)
int drmm_vram_helper_init(struct drm_device *dev, uint64_t vram_base, size_t vram_size)
int drm_gem_vram_plane_helper_prepare_fb(struct drm_plane *plane, struct drm_plane_state *new_state)
drm_mode_status
Definition drm_modes.h:91
struct drm_plane * plane
Definition drm_plane.h:828
const struct device * dev
Definition drm_print.h:519
int64_t s64
Definition kernel.h:21
const char const char va_list args
Definition seq_buf.h:182
Definition drm_device.h:75
Definition drm_modes.h:252
Definition drm_file.h:165
Definition drm_gem.h:277
Definition drm_gem_vram_helper.h:51
unsigned int vmap_use_count
Definition drm_gem_vram_helper.h:61
struct iosys_map map
Definition drm_gem_vram_helper.h:53
struct ttm_placement placement
Definition drm_gem_vram_helper.h:64
struct ttm_buffer_object bo
Definition drm_gem_vram_helper.h:52
struct ttm_place placements[2]
Definition drm_gem_vram_helper.h:65
Definition drm_file.h:78
Definition drm_mode.h:1249
Definition drm_plane.h:54
Definition drm_plane.h:641
Definition drm_gem_vram_helper.h:164
struct ttm_device bdev
Definition drm_gem_vram_helper.h:168
uint64_t vram_base
Definition drm_gem_vram_helper.h:165
size_t vram_size
Definition drm_gem_vram_helper.h:166
Definition fs.h:142
Definition iosys-map.h:109
Definition mm.h:182
#define mode(x)