drm/ttm: remove TTM_PAGE_FLAG_WRITE
[linux-2.6-microblaze.git] / include / drm / ttm / ttm_tt.h
index bdc8aad..5d1835d 100644 (file)
@@ -34,61 +34,23 @@ struct ttm_resource;
 struct ttm_buffer_object;
 struct ttm_operation_ctx;
 
-#define TTM_PAGE_FLAG_WRITE           (1 << 3)
 #define TTM_PAGE_FLAG_SWAPPED         (1 << 4)
-#define TTM_PAGE_FLAG_PERSISTENT_SWAP (1 << 5)
 #define TTM_PAGE_FLAG_ZERO_ALLOC      (1 << 6)
 #define TTM_PAGE_FLAG_DMA32           (1 << 7)
 #define TTM_PAGE_FLAG_SG              (1 << 8)
 #define TTM_PAGE_FLAG_NO_RETRY       (1 << 9)
 
+#define TTM_PAGE_FLAG_PRIV_POPULATED  (1 << 31)
+
 enum ttm_caching_state {
        tt_uncached,
        tt_wc,
        tt_cached
 };
 
-struct ttm_backend_func {
-       /**
-        * struct ttm_backend_func member bind
-        *
-        * @ttm: Pointer to a struct ttm_tt.
-        * @bo_mem: Pointer to a struct ttm_resource describing the
-        * memory type and location for binding.
-        *
-        * Bind the backend pages into the aperture in the location
-        * indicated by @bo_mem. This function should be able to handle
-        * differences between aperture and system page sizes.
-        */
-       int (*bind) (struct ttm_bo_device *bdev, struct ttm_tt *ttm, struct ttm_resource *bo_mem);
-
-       /**
-        * struct ttm_backend_func member unbind
-        *
-        * @ttm: Pointer to a struct ttm_tt.
-        *
-        * Unbind previously bound backend pages. This function should be
-        * able to handle differences between aperture and system page sizes.
-        */
-       void (*unbind) (struct ttm_bo_device *bdev, struct ttm_tt *ttm);
-
-       /**
-        * struct ttm_backend_func member destroy
-        *
-        * @ttm: Pointer to a struct ttm_tt.
-        *
-        * Destroy the backend. This will be call back from ttm_tt_destroy so
-        * don't call ttm_tt_destroy from the callback or infinite loop.
-        */
-       void (*destroy) (struct ttm_bo_device *bdev, struct ttm_tt *ttm);
-};
-
 /**
  * struct ttm_tt
  *
- * @func: Pointer to a struct ttm_backend_func that describes
- * the backend methods.
- * pointer.
  * @pages: Array of pages backing the data.
  * @num_pages: Number of pages in the page array.
  * @bdev: Pointer to the current struct ttm_bo_device.
@@ -102,20 +64,29 @@ struct ttm_backend_func {
  * memory.
  */
 struct ttm_tt {
-       struct ttm_backend_func *func;
        struct page **pages;
        uint32_t page_flags;
        unsigned long num_pages;
        struct sg_table *sg; /* for SG objects via dma-buf */
        struct file *swap_storage;
        enum ttm_caching_state caching_state;
-       enum {
-               tt_bound,
-               tt_unbound,
-               tt_unpopulated,
-       } state;
 };
 
+static inline bool ttm_tt_is_populated(struct ttm_tt *tt)
+{
+       return tt->page_flags & TTM_PAGE_FLAG_PRIV_POPULATED;
+}
+
+static inline void ttm_tt_set_unpopulated(struct ttm_tt *tt)
+{
+       tt->page_flags &= ~TTM_PAGE_FLAG_PRIV_POPULATED;
+}
+
+static inline void ttm_tt_set_populated(struct ttm_tt *tt)
+{
+       tt->page_flags |= TTM_PAGE_FLAG_PRIV_POPULATED;
+}
+
 /**
  * struct ttm_dma_tt
  *
@@ -173,18 +144,6 @@ int ttm_sg_tt_init(struct ttm_dma_tt *ttm_dma, struct ttm_buffer_object *bo,
 void ttm_tt_fini(struct ttm_tt *ttm);
 void ttm_dma_tt_fini(struct ttm_dma_tt *ttm_dma);
 
-/**
- * ttm_ttm_bind:
- *
- * @ttm: The struct ttm_tt containing backing pages.
- * @bo_mem: The struct ttm_resource identifying the binding location.
- *
- * Bind the pages of @ttm to an aperture location identified by @bo_mem
- */
-int ttm_tt_bind(struct ttm_bo_device *bdev,
-               struct ttm_tt *ttm, struct ttm_resource *bo_mem,
-               struct ttm_operation_ctx *ctx);
-
 /**
  * ttm_ttm_destroy:
  *
@@ -195,13 +154,11 @@ int ttm_tt_bind(struct ttm_bo_device *bdev,
 void ttm_tt_destroy(struct ttm_bo_device *bdev, struct ttm_tt *ttm);
 
 /**
- * ttm_ttm_unbind:
- *
- * @ttm: The struct ttm_tt.
+ * ttm_tt_destroy_common:
  *
- * Unbind a struct ttm_tt.
+ * Called from driver to destroy common path.
  */
-void ttm_tt_unbind(struct ttm_bo_device *bdev, struct ttm_tt *ttm);
+void ttm_tt_destroy_common(struct ttm_bo_device *bdev, struct ttm_tt *ttm);
 
 /**
  * ttm_tt_swapin:
@@ -226,7 +183,7 @@ int ttm_tt_swapin(struct ttm_tt *ttm);
  * and cache flushes and potential page splitting / combining.
  */
 int ttm_tt_set_placement_caching(struct ttm_tt *ttm, uint32_t placement);
-int ttm_tt_swapout(struct ttm_bo_device *bdev, struct ttm_tt *ttm, struct file *persistent_swap_storage);
+int ttm_tt_swapout(struct ttm_bo_device *bdev, struct ttm_tt *ttm);
 
 /**
  * ttm_tt_populate - allocate pages for a ttm
@@ -267,6 +224,7 @@ struct ttm_tt *ttm_agp_tt_create(struct ttm_buffer_object *bo,
 int ttm_agp_bind(struct ttm_tt *ttm, struct ttm_resource *bo_mem);
 void ttm_agp_unbind(struct ttm_tt *ttm);
 void ttm_agp_destroy(struct ttm_tt *ttm);
+bool ttm_agp_is_bound(struct ttm_tt *ttm);
 #endif
 
 #endif