i915g: implement unfenced color&depth buffer using tiling bits
[mesa.git] / src / gallium / drivers / i915 / i915_winsys.h
index 246e95b00d6fcfb6af9e0b0e78523316b49811d0..24ea416f015469b84215dba63bd9f2ca1b19e624 100644 (file)
@@ -31,7 +31,7 @@
 struct i915_winsys;
 struct i915_winsys_buffer;
 struct i915_winsys_batchbuffer;
-struct pipe_texture;
+struct pipe_resource;
 struct pipe_fence_handle;
 struct winsys_handle;
 
@@ -53,6 +53,7 @@ enum i915_winsys_buffer_type
    I915_NEW_VERTEX
 };
 
+/* These need to be in sync with the definitions of libdrm-intel! */
 enum i915_winsys_buffer_tile
 {
    I915_TILE_NONE,
@@ -81,6 +82,8 @@ struct i915_winsys_batchbuffer {
 
 struct i915_winsys {
 
+   unsigned pci_id; /**< PCI ID for the device */
+
    /**
     * Batchbuffer functions.
     */
@@ -104,7 +107,7 @@ struct i915_winsys {
    int (*batchbuffer_reloc)(struct i915_winsys_batchbuffer *batch,
                             struct i915_winsys_buffer *reloc,
                             enum i915_winsys_buffer_usage usage,
-                            unsigned offset);
+                            unsigned offset, bool fenced);
 
    /**
     * Flush a bufferbatch.
@@ -128,22 +131,37 @@ struct i915_winsys {
     */
    struct i915_winsys_buffer *
       (*buffer_create)(struct i915_winsys *iws,
-                       unsigned size, unsigned alignment,
+                       unsigned size,
                        enum i915_winsys_buffer_type type);
 
+   /**
+    * Create a tiled buffer.
+    *
+    * *stride, height are in bytes. The winsys tries to allocate the buffer with
+    * the tiling mode provide in *tiling. If tiling is no possible, *tiling will
+    * be set to I915_TILE_NONE. The calculated stride (incorporateing hw/kernel
+    * requirements) is always returned in *stride.
+    */
+   struct i915_winsys_buffer *
+      (*buffer_create_tiled)(struct i915_winsys *iws,
+                             unsigned *stride, unsigned height,
+                             enum i915_winsys_buffer_tile *tiling,
+                             enum i915_winsys_buffer_type type);
+
    /**
     * Creates a buffer from a handle.
-    * Used to implement pipe_screen::texture_from_handle.
+    * Used to implement pipe_screen::resource_from_handle.
     * Also provides the stride information needed for the
     * texture via the stride argument.
     */
    struct i915_winsys_buffer *
       (*buffer_from_handle)(struct i915_winsys *iws,
                             struct winsys_handle *whandle,
+                            enum i915_winsys_buffer_tile *tiling,
                             unsigned *stride);
 
    /**
-    * Used to implement pipe_screen::texture_get_handle.
+    * Used to implement pipe_screen::resource_get_handle.
     * The winsys might need the stride information.
     */
    boolean (*buffer_get_handle)(struct i915_winsys *iws,
@@ -151,15 +169,6 @@ struct i915_winsys {
                                 struct winsys_handle *whandle,
                                 unsigned stride);
 
-   /**
-    * Fence a buffer with a fence reg.
-    * Not to be confused with pipe_fence_handle.
-    */
-   int (*buffer_set_fence_reg)(struct i915_winsys *iws,
-                               struct i915_winsys_buffer *buffer,
-                               unsigned stride,
-                               enum i915_winsys_buffer_tile tile);
-
    /**
     * Map a buffer.
     */
@@ -220,11 +229,4 @@ struct i915_winsys {
    void (*destroy)(struct i915_winsys *iws);
 };
 
-
-/**
- * Create i915 pipe_screen.
- */
-struct pipe_screen *i915_create_screen(struct i915_winsys *iws, unsigned pci_id);
-
-
 #endif