18c2ecf20Sopenharmony_ci#ifndef __DRM_GEM_FB_HELPER_H__
28c2ecf20Sopenharmony_ci#define __DRM_GEM_FB_HELPER_H__
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_cistruct drm_afbc_framebuffer;
58c2ecf20Sopenharmony_cistruct drm_device;
68c2ecf20Sopenharmony_cistruct drm_fb_helper_surface_size;
78c2ecf20Sopenharmony_cistruct drm_file;
88c2ecf20Sopenharmony_cistruct drm_framebuffer;
98c2ecf20Sopenharmony_cistruct drm_framebuffer_funcs;
108c2ecf20Sopenharmony_cistruct drm_gem_object;
118c2ecf20Sopenharmony_cistruct drm_mode_fb_cmd2;
128c2ecf20Sopenharmony_cistruct drm_plane;
138c2ecf20Sopenharmony_cistruct drm_plane_state;
148c2ecf20Sopenharmony_cistruct drm_simple_display_pipe;
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#define AFBC_VENDOR_AND_TYPE_MASK	GENMASK_ULL(63, 52)
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_cistruct drm_gem_object *drm_gem_fb_get_obj(struct drm_framebuffer *fb,
198c2ecf20Sopenharmony_ci					  unsigned int plane);
208c2ecf20Sopenharmony_civoid drm_gem_fb_destroy(struct drm_framebuffer *fb);
218c2ecf20Sopenharmony_ciint drm_gem_fb_create_handle(struct drm_framebuffer *fb, struct drm_file *file,
228c2ecf20Sopenharmony_ci			     unsigned int *handle);
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ciint drm_gem_fb_init_with_funcs(struct drm_device *dev,
258c2ecf20Sopenharmony_ci			       struct drm_framebuffer *fb,
268c2ecf20Sopenharmony_ci			       struct drm_file *file,
278c2ecf20Sopenharmony_ci			       const struct drm_mode_fb_cmd2 *mode_cmd,
288c2ecf20Sopenharmony_ci			       const struct drm_framebuffer_funcs *funcs);
298c2ecf20Sopenharmony_cistruct drm_framebuffer *
308c2ecf20Sopenharmony_cidrm_gem_fb_create_with_funcs(struct drm_device *dev, struct drm_file *file,
318c2ecf20Sopenharmony_ci			     const struct drm_mode_fb_cmd2 *mode_cmd,
328c2ecf20Sopenharmony_ci			     const struct drm_framebuffer_funcs *funcs);
338c2ecf20Sopenharmony_cistruct drm_framebuffer *
348c2ecf20Sopenharmony_cidrm_gem_fb_create(struct drm_device *dev, struct drm_file *file,
358c2ecf20Sopenharmony_ci		  const struct drm_mode_fb_cmd2 *mode_cmd);
368c2ecf20Sopenharmony_cistruct drm_framebuffer *
378c2ecf20Sopenharmony_cidrm_gem_fb_create_with_dirty(struct drm_device *dev, struct drm_file *file,
388c2ecf20Sopenharmony_ci			     const struct drm_mode_fb_cmd2 *mode_cmd);
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci#define drm_is_afbc(modifier) \
418c2ecf20Sopenharmony_ci	(((modifier) & AFBC_VENDOR_AND_TYPE_MASK) == DRM_FORMAT_MOD_ARM_AFBC(0))
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ciint drm_gem_fb_afbc_init(struct drm_device *dev,
448c2ecf20Sopenharmony_ci			 const struct drm_mode_fb_cmd2 *mode_cmd,
458c2ecf20Sopenharmony_ci			 struct drm_afbc_framebuffer *afbc_fb);
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ciint drm_gem_fb_prepare_fb(struct drm_plane *plane,
488c2ecf20Sopenharmony_ci			  struct drm_plane_state *state);
498c2ecf20Sopenharmony_ciint drm_gem_fb_simple_display_pipe_prepare_fb(struct drm_simple_display_pipe *pipe,
508c2ecf20Sopenharmony_ci					      struct drm_plane_state *plane_state);
518c2ecf20Sopenharmony_ci#endif
52