xref: /linux/drivers/gpu/drm/nouveau/nouveau_gem.h (revision 4dc28134a8c124aa01b441e1e5b8b54312edc5dd)
166f24723SBen Skeggs #ifndef __NOUVEAU_GEM_H__
266f24723SBen Skeggs #define __NOUVEAU_GEM_H__
366f24723SBen Skeggs 
4612a9aabSLinus Torvalds #include <drm/drmP.h>
566f24723SBen Skeggs 
6*4dc28134SBen Skeggs #include "nouveau_drv.h"
766f24723SBen Skeggs #include "nouveau_bo.h"
866f24723SBen Skeggs 
966f24723SBen Skeggs #define nouveau_bo_tile_layout(nvbo)				\
1066f24723SBen Skeggs 	((nvbo)->tile_flags & NOUVEAU_GEM_TILE_LAYOUT_MASK)
1166f24723SBen Skeggs 
1266f24723SBen Skeggs static inline struct nouveau_bo *
1366f24723SBen Skeggs nouveau_gem_object(struct drm_gem_object *gem)
1466f24723SBen Skeggs {
1555fb74adSDavid Herrmann 	return gem ? container_of(gem, struct nouveau_bo, gem) : NULL;
1666f24723SBen Skeggs }
1766f24723SBen Skeggs 
1866f24723SBen Skeggs /* nouveau_gem.c */
1966f24723SBen Skeggs extern int nouveau_gem_new(struct drm_device *, int size, int align,
2066f24723SBen Skeggs 			   uint32_t domain, uint32_t tile_mode,
2166f24723SBen Skeggs 			   uint32_t tile_flags, struct nouveau_bo **);
2266f24723SBen Skeggs extern void nouveau_gem_object_del(struct drm_gem_object *);
2366f24723SBen Skeggs extern int nouveau_gem_object_open(struct drm_gem_object *, struct drm_file *);
2466f24723SBen Skeggs extern void nouveau_gem_object_close(struct drm_gem_object *,
2566f24723SBen Skeggs 				     struct drm_file *);
2666f24723SBen Skeggs extern int nouveau_gem_ioctl_new(struct drm_device *, void *,
2766f24723SBen Skeggs 				 struct drm_file *);
2866f24723SBen Skeggs extern int nouveau_gem_ioctl_pushbuf(struct drm_device *, void *,
2966f24723SBen Skeggs 				     struct drm_file *);
3066f24723SBen Skeggs extern int nouveau_gem_ioctl_cpu_prep(struct drm_device *, void *,
3166f24723SBen Skeggs 				      struct drm_file *);
3266f24723SBen Skeggs extern int nouveau_gem_ioctl_cpu_fini(struct drm_device *, void *,
3366f24723SBen Skeggs 				      struct drm_file *);
3466f24723SBen Skeggs extern int nouveau_gem_ioctl_info(struct drm_device *, void *,
3566f24723SBen Skeggs 				  struct drm_file *);
3666f24723SBen Skeggs 
37ab9ccb96SAaron Plattner extern int nouveau_gem_prime_pin(struct drm_gem_object *);
383aac4502SMaarten Lankhorst struct reservation_object *nouveau_gem_prime_res_obj(struct drm_gem_object *);
391af7c7ddSMaarten Lankhorst extern void nouveau_gem_prime_unpin(struct drm_gem_object *);
40ab9ccb96SAaron Plattner extern struct sg_table *nouveau_gem_prime_get_sg_table(struct drm_gem_object *);
41ab9ccb96SAaron Plattner extern struct drm_gem_object *nouveau_gem_prime_import_sg_table(
42b5e9c1a2SMaarten Lankhorst 	struct drm_device *, struct dma_buf_attachment *, struct sg_table *);
43ab9ccb96SAaron Plattner extern void *nouveau_gem_prime_vmap(struct drm_gem_object *);
44ab9ccb96SAaron Plattner extern void nouveau_gem_prime_vunmap(struct drm_gem_object *, void *);
4566f24723SBen Skeggs 
4666f24723SBen Skeggs #endif
47