2017-08-13 21:31:44 +08:00
|
|
|
#ifndef __DRM_GEM_FB_HELPER_H__
|
|
|
|
#define __DRM_GEM_FB_HELPER_H__
|
|
|
|
|
2021-07-16 22:07:55 +08:00
|
|
|
#include <linux/dma-buf.h>
|
2022-02-05 01:05:41 +08:00
|
|
|
#include <linux/iosys-map.h>
|
2021-07-16 22:07:55 +08:00
|
|
|
|
2021-07-31 02:35:08 +08:00
|
|
|
#include <drm/drm_fourcc.h>
|
|
|
|
|
2020-03-11 22:55:37 +08:00
|
|
|
struct drm_afbc_framebuffer;
|
2017-08-13 21:31:44 +08:00
|
|
|
struct drm_device;
|
|
|
|
struct drm_fb_helper_surface_size;
|
2017-09-12 00:37:45 +08:00
|
|
|
struct drm_file;
|
2017-08-13 21:31:44 +08:00
|
|
|
struct drm_framebuffer;
|
|
|
|
struct drm_framebuffer_funcs;
|
|
|
|
struct drm_gem_object;
|
|
|
|
struct drm_mode_fb_cmd2;
|
|
|
|
|
2020-03-11 22:55:37 +08:00
|
|
|
#define AFBC_VENDOR_AND_TYPE_MASK GENMASK_ULL(63, 52)
|
|
|
|
|
2017-08-13 21:31:44 +08:00
|
|
|
struct drm_gem_object *drm_gem_fb_get_obj(struct drm_framebuffer *fb,
|
|
|
|
unsigned int plane);
|
|
|
|
void drm_gem_fb_destroy(struct drm_framebuffer *fb);
|
|
|
|
int drm_gem_fb_create_handle(struct drm_framebuffer *fb, struct drm_file *file,
|
|
|
|
unsigned int *handle);
|
|
|
|
|
2020-03-11 22:55:36 +08:00
|
|
|
int drm_gem_fb_init_with_funcs(struct drm_device *dev,
|
|
|
|
struct drm_framebuffer *fb,
|
|
|
|
struct drm_file *file,
|
|
|
|
const struct drm_mode_fb_cmd2 *mode_cmd,
|
|
|
|
const struct drm_framebuffer_funcs *funcs);
|
2017-08-13 21:31:44 +08:00
|
|
|
struct drm_framebuffer *
|
|
|
|
drm_gem_fb_create_with_funcs(struct drm_device *dev, struct drm_file *file,
|
|
|
|
const struct drm_mode_fb_cmd2 *mode_cmd,
|
|
|
|
const struct drm_framebuffer_funcs *funcs);
|
|
|
|
struct drm_framebuffer *
|
|
|
|
drm_gem_fb_create(struct drm_device *dev, struct drm_file *file,
|
|
|
|
const struct drm_mode_fb_cmd2 *mode_cmd);
|
2019-01-15 12:36:39 +08:00
|
|
|
struct drm_framebuffer *
|
|
|
|
drm_gem_fb_create_with_dirty(struct drm_device *dev, struct drm_file *file,
|
|
|
|
const struct drm_mode_fb_cmd2 *mode_cmd);
|
2017-08-13 21:31:44 +08:00
|
|
|
|
2021-07-31 02:35:08 +08:00
|
|
|
int drm_gem_fb_vmap(struct drm_framebuffer *fb,
|
2022-02-05 01:05:41 +08:00
|
|
|
struct iosys_map map[static DRM_FORMAT_MAX_PLANES],
|
|
|
|
struct iosys_map data[DRM_FORMAT_MAX_PLANES]);
|
2021-07-31 02:35:08 +08:00
|
|
|
void drm_gem_fb_vunmap(struct drm_framebuffer *fb,
|
2022-02-05 01:05:41 +08:00
|
|
|
struct iosys_map map[static DRM_FORMAT_MAX_PLANES]);
|
2021-07-16 22:07:55 +08:00
|
|
|
int drm_gem_fb_begin_cpu_access(struct drm_framebuffer *fb, enum dma_data_direction dir);
|
|
|
|
void drm_gem_fb_end_cpu_access(struct drm_framebuffer *fb, enum dma_data_direction dir);
|
|
|
|
|
2020-03-11 22:55:37 +08:00
|
|
|
#define drm_is_afbc(modifier) \
|
|
|
|
(((modifier) & AFBC_VENDOR_AND_TYPE_MASK) == DRM_FORMAT_MOD_ARM_AFBC(0))
|
|
|
|
|
|
|
|
int drm_gem_fb_afbc_init(struct drm_device *dev,
|
|
|
|
const struct drm_mode_fb_cmd2 *mode_cmd,
|
|
|
|
struct drm_afbc_framebuffer *afbc_fb);
|
|
|
|
|
2017-08-13 21:31:44 +08:00
|
|
|
#endif
|