xref: /linux/drivers/gpu/drm/nouveau/nouveau_gem.h (revision b88baab828713ce0b49b185444b2ee83bed373a8)
1b7019ac5SIlia Mirkin /* SPDX-License-Identifier: MIT */
266f24723SBen Skeggs #ifndef __NOUVEAU_GEM_H__
366f24723SBen Skeggs #define __NOUVEAU_GEM_H__
466f24723SBen Skeggs 
54dc28134SBen Skeggs #include "nouveau_drv.h"
666f24723SBen Skeggs #include "nouveau_bo.h"
766f24723SBen Skeggs 
8ed853f6cSThomas Zimmermann extern const struct drm_gem_object_funcs nouveau_gem_object_funcs;
9ed853f6cSThomas Zimmermann 
1066f24723SBen Skeggs static inline struct nouveau_bo *
1166f24723SBen Skeggs nouveau_gem_object(struct drm_gem_object *gem)
1266f24723SBen Skeggs {
13f8659be8SGerd Hoffmann 	return gem ? container_of(gem, struct nouveau_bo, bo.base) : NULL;
1466f24723SBen Skeggs }
1566f24723SBen Skeggs 
1666f24723SBen Skeggs /* nouveau_gem.c */
174d8b3d34SBen Skeggs extern int nouveau_gem_new(struct nouveau_cli *, u64 size, int align,
1866f24723SBen Skeggs 			   uint32_t domain, uint32_t tile_mode,
1966f24723SBen Skeggs 			   uint32_t tile_flags, struct nouveau_bo **);
2066f24723SBen Skeggs extern void nouveau_gem_object_del(struct drm_gem_object *);
2166f24723SBen Skeggs extern int nouveau_gem_object_open(struct drm_gem_object *, struct drm_file *);
2266f24723SBen Skeggs extern void nouveau_gem_object_close(struct drm_gem_object *,
2366f24723SBen Skeggs 				     struct drm_file *);
2466f24723SBen Skeggs extern int nouveau_gem_ioctl_new(struct drm_device *, void *,
2566f24723SBen Skeggs 				 struct drm_file *);
2666f24723SBen Skeggs extern int nouveau_gem_ioctl_pushbuf(struct drm_device *, void *,
2766f24723SBen Skeggs 				     struct drm_file *);
2866f24723SBen Skeggs extern int nouveau_gem_ioctl_cpu_prep(struct drm_device *, void *,
2966f24723SBen Skeggs 				      struct drm_file *);
3066f24723SBen Skeggs extern int nouveau_gem_ioctl_cpu_fini(struct drm_device *, void *,
3166f24723SBen Skeggs 				      struct drm_file *);
3266f24723SBen Skeggs extern int nouveau_gem_ioctl_info(struct drm_device *, void *,
3366f24723SBen Skeggs 				  struct drm_file *);
3466f24723SBen Skeggs 
35ab9ccb96SAaron Plattner extern int nouveau_gem_prime_pin(struct drm_gem_object *);
361af7c7ddSMaarten Lankhorst extern void nouveau_gem_prime_unpin(struct drm_gem_object *);
37ab9ccb96SAaron Plattner extern struct sg_table *nouveau_gem_prime_get_sg_table(struct drm_gem_object *);
38ab9ccb96SAaron Plattner extern struct drm_gem_object *nouveau_gem_prime_import_sg_table(
39b5e9c1a2SMaarten Lankhorst 	struct drm_device *, struct dma_buf_attachment *, struct sg_table *);
40*b88baab8SDanilo Krummrich struct dma_buf *nouveau_gem_prime_export(struct drm_gem_object *gobj,
41*b88baab8SDanilo Krummrich 					 int flags);
4266f24723SBen Skeggs #endif
43