Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1#ifndef __DRM_GEM_FB_HELPER_H__
2#define __DRM_GEM_FB_HELPER_H__
3
4#include <linux/dma-buf.h>
5#include <linux/iosys-map.h>
6
7#include <drm/drm_fourcc.h>
8
9struct drm_afbc_framebuffer;
10struct drm_device;
11struct drm_fb_helper_surface_size;
12struct drm_file;
13struct drm_framebuffer;
14struct drm_framebuffer_funcs;
15struct drm_gem_object;
16struct drm_mode_fb_cmd2;
17
18#define AFBC_VENDOR_AND_TYPE_MASK GENMASK_ULL(63, 52)
19
20struct drm_gem_object *drm_gem_fb_get_obj(struct drm_framebuffer *fb,
21 unsigned int plane);
22void drm_gem_fb_destroy(struct drm_framebuffer *fb);
23int drm_gem_fb_create_handle(struct drm_framebuffer *fb, struct drm_file *file,
24 unsigned int *handle);
25
26int drm_gem_fb_init_with_funcs(struct drm_device *dev,
27 struct drm_framebuffer *fb,
28 struct drm_file *file,
29 const struct drm_mode_fb_cmd2 *mode_cmd,
30 const struct drm_framebuffer_funcs *funcs);
31struct drm_framebuffer *
32drm_gem_fb_create_with_funcs(struct drm_device *dev, struct drm_file *file,
33 const struct drm_mode_fb_cmd2 *mode_cmd,
34 const struct drm_framebuffer_funcs *funcs);
35struct drm_framebuffer *
36drm_gem_fb_create(struct drm_device *dev, struct drm_file *file,
37 const struct drm_mode_fb_cmd2 *mode_cmd);
38struct drm_framebuffer *
39drm_gem_fb_create_with_dirty(struct drm_device *dev, struct drm_file *file,
40 const struct drm_mode_fb_cmd2 *mode_cmd);
41
42int drm_gem_fb_vmap(struct drm_framebuffer *fb,
43 struct iosys_map map[static DRM_FORMAT_MAX_PLANES],
44 struct iosys_map data[DRM_FORMAT_MAX_PLANES]);
45void drm_gem_fb_vunmap(struct drm_framebuffer *fb,
46 struct iosys_map map[static DRM_FORMAT_MAX_PLANES]);
47int drm_gem_fb_begin_cpu_access(struct drm_framebuffer *fb, enum dma_data_direction dir);
48void drm_gem_fb_end_cpu_access(struct drm_framebuffer *fb, enum dma_data_direction dir);
49
50#define drm_is_afbc(modifier) \
51 (((modifier) & AFBC_VENDOR_AND_TYPE_MASK) == DRM_FORMAT_MOD_ARM_AFBC(0))
52
53int drm_gem_fb_afbc_init(struct drm_device *dev,
54 const struct drm_mode_fb_cmd2 *mode_cmd,
55 struct drm_afbc_framebuffer *afbc_fb);
56
57#endif