162306a36Sopenharmony_ci/* SPDX-License-Identifier: MIT */
262306a36Sopenharmony_ci#ifndef __NOUVEAU_GEM_H__
362306a36Sopenharmony_ci#define __NOUVEAU_GEM_H__
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci#include "nouveau_drv.h"
662306a36Sopenharmony_ci#include "nouveau_bo.h"
762306a36Sopenharmony_ci
862306a36Sopenharmony_ciextern const struct drm_gem_object_funcs nouveau_gem_object_funcs;
962306a36Sopenharmony_ci
1062306a36Sopenharmony_cistatic inline struct nouveau_bo *
1162306a36Sopenharmony_cinouveau_gem_object(struct drm_gem_object *gem)
1262306a36Sopenharmony_ci{
1362306a36Sopenharmony_ci	return gem ? container_of(gem, struct nouveau_bo, bo.base) : NULL;
1462306a36Sopenharmony_ci}
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci/* nouveau_gem.c */
1762306a36Sopenharmony_ciextern int nouveau_gem_new(struct nouveau_cli *, u64 size, int align,
1862306a36Sopenharmony_ci			   uint32_t domain, uint32_t tile_mode,
1962306a36Sopenharmony_ci			   uint32_t tile_flags, struct nouveau_bo **);
2062306a36Sopenharmony_ciextern void nouveau_gem_object_del(struct drm_gem_object *);
2162306a36Sopenharmony_ciextern int nouveau_gem_object_open(struct drm_gem_object *, struct drm_file *);
2262306a36Sopenharmony_ciextern void nouveau_gem_object_close(struct drm_gem_object *,
2362306a36Sopenharmony_ci				     struct drm_file *);
2462306a36Sopenharmony_ciextern int nouveau_gem_ioctl_new(struct drm_device *, void *,
2562306a36Sopenharmony_ci				 struct drm_file *);
2662306a36Sopenharmony_ciextern int nouveau_gem_ioctl_pushbuf(struct drm_device *, void *,
2762306a36Sopenharmony_ci				     struct drm_file *);
2862306a36Sopenharmony_ciextern int nouveau_gem_ioctl_cpu_prep(struct drm_device *, void *,
2962306a36Sopenharmony_ci				      struct drm_file *);
3062306a36Sopenharmony_ciextern int nouveau_gem_ioctl_cpu_fini(struct drm_device *, void *,
3162306a36Sopenharmony_ci				      struct drm_file *);
3262306a36Sopenharmony_ciextern int nouveau_gem_ioctl_info(struct drm_device *, void *,
3362306a36Sopenharmony_ci				  struct drm_file *);
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ciextern int nouveau_gem_prime_pin(struct drm_gem_object *);
3662306a36Sopenharmony_ciextern void nouveau_gem_prime_unpin(struct drm_gem_object *);
3762306a36Sopenharmony_ciextern struct sg_table *nouveau_gem_prime_get_sg_table(struct drm_gem_object *);
3862306a36Sopenharmony_ciextern struct drm_gem_object *nouveau_gem_prime_import_sg_table(
3962306a36Sopenharmony_ci	struct drm_device *, struct dma_buf_attachment *, struct sg_table *);
4062306a36Sopenharmony_cistruct dma_buf *nouveau_gem_prime_export(struct drm_gem_object *gobj,
4162306a36Sopenharmony_ci					 int flags);
4262306a36Sopenharmony_ci#endif
43