gem.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * Tegra host1x GEM implementation
  3. *
  4. * Copyright (c) 2012-2013, NVIDIA Corporation.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #ifndef __HOST1X_GEM_H
  11. #define __HOST1X_GEM_H
  12. #include <linux/host1x.h>
  13. #include <drm/drm.h>
  14. #include <drm/drmP.h>
  15. #define TEGRA_BO_TILED (1 << 0)
  16. #define TEGRA_BO_BOTTOM_UP (1 << 1)
  17. struct tegra_bo {
  18. struct drm_gem_object gem;
  19. struct host1x_bo base;
  20. unsigned long flags;
  21. struct sg_table *sgt;
  22. dma_addr_t paddr;
  23. void *vaddr;
  24. };
  25. static inline struct tegra_bo *to_tegra_bo(struct drm_gem_object *gem)
  26. {
  27. return container_of(gem, struct tegra_bo, gem);
  28. }
  29. struct tegra_bo *tegra_bo_create(struct drm_device *drm, unsigned int size,
  30. unsigned long flags);
  31. struct tegra_bo *tegra_bo_create_with_handle(struct drm_file *file,
  32. struct drm_device *drm,
  33. unsigned int size,
  34. unsigned long flags,
  35. unsigned int *handle);
  36. void tegra_bo_free_object(struct drm_gem_object *gem);
  37. int tegra_bo_dumb_create(struct drm_file *file, struct drm_device *drm,
  38. struct drm_mode_create_dumb *args);
  39. int tegra_bo_dumb_map_offset(struct drm_file *file, struct drm_device *drm,
  40. uint32_t handle, uint64_t *offset);
  41. int tegra_drm_mmap(struct file *file, struct vm_area_struct *vma);
  42. extern const struct vm_operations_struct tegra_bo_vm_ops;
  43. struct dma_buf *tegra_gem_prime_export(struct drm_device *drm,
  44. struct drm_gem_object *gem,
  45. int flags);
  46. struct drm_gem_object *tegra_gem_prime_import(struct drm_device *drm,
  47. struct dma_buf *buf);
  48. #endif