r600g: emit streamout from dma copy shader
[mesa.git] / src / gallium / drivers / svga / svga_winsys.h
index 59f299c185865fc21fd25e3a8d8ca5aaf6ecaa95..f410cf0b3e76261e0fc71196ff4b7130f1f07dc6 100644 (file)
@@ -49,20 +49,24 @@ struct svga_winsys_buffer;
 struct pipe_screen;
 struct pipe_context;
 struct pipe_fence_handle;
-struct pipe_texture;
+struct pipe_resource;
 struct svga_region;
+struct winsys_handle;
 
 
-#define SVGA_BUFFER_USAGE_PINNED  (PIPE_BUFFER_USAGE_CUSTOM << 0)
-#define SVGA_BUFFER_USAGE_WRAPPED (PIPE_BUFFER_USAGE_CUSTOM << 1)
+#define SVGA_BUFFER_USAGE_PINNED  (1 << 0)
+#define SVGA_BUFFER_USAGE_WRAPPED (1 << 1)
 
 
+#define SVGA_RELOC_WRITE 0x1
+#define SVGA_RELOC_READ  0x2
+
+#define SVGA_FENCE_FLAG_EXEC      (1 << 0)
+#define SVGA_FENCE_FLAG_QUERY     (1 << 1)
+
 /** Opaque surface handle */
 struct svga_winsys_surface;
 
-/** Opaque buffer handle */
-struct svga_winsys_handle;
-
 
 /**
  * SVGA per-context winsys interface.
@@ -79,7 +83,7 @@ struct svga_winsys_context
    /**
     * Emit a relocation for a host surface.
     * 
-    * @param flags PIPE_BUFFER_USAGE_GPU_READ/WRITE
+    * @param flags bitmask of SVGA_RELOC_* flags
     * 
     * NOTE: Order of this call does matter. It should be the same order
     * as relocations appear in the command buffer.
@@ -93,7 +97,7 @@ struct svga_winsys_context
    /**
     * Emit a relocation for a guest memory region.
     * 
-    * @param flags PIPE_BUFFER_USAGE_GPU_READ/WRITE
+    * @param flags bitmask of SVGA_RELOC_* flags
     * 
     * NOTE: Order of this call does matter. It should be the same order
     * as relocations appear in the command buffer.
@@ -130,6 +134,9 @@ struct svga_winsys_screen
    void
    (*destroy)(struct svga_winsys_screen *sws);
    
+   SVGA3dHardwareVersion
+   (*get_hw_version)(struct svga_winsys_screen *sws);
+
    boolean
    (*get_cap)(struct svga_winsys_screen *sws,
               SVGA3dDevCapIndex index,
@@ -186,6 +193,25 @@ struct svga_winsys_screen
                      uint32 numFaces,
                      uint32 numMipLevels);
 
+   /**
+    * Creates a surface from a winsys handle.
+    * Used to implement pipe_screen::resource_from_handle.
+    */
+   struct svga_winsys_surface *
+   (*surface_from_handle)(struct svga_winsys_screen *sws,
+                          struct winsys_handle *whandle,
+                          SVGA3dSurfaceFormat *format);
+
+   /**
+    * Get a winsys_handle from a surface.
+    * Used to implement pipe_screen::resource_get_handle.
+    */
+   boolean
+   (*surface_get_handle)(struct svga_winsys_screen *sws,
+                         struct svga_winsys_surface *surface,
+                         unsigned stride,
+                         struct winsys_handle *whandle);
+
    /**
     * Whether this surface is sitting in a validate list
     */
@@ -205,13 +231,7 @@ struct svga_winsys_screen
    /**
     * Buffer management. Buffer attributes are mostly fixed over its lifetime.
     *
-    * Remember that gallium gets to choose the interface it needs, and the
-    * window systems must then implement that interface (rather than the
-    * other way around...).
-    *
-    * usage is a bitmask of PIPE_BUFFER_USAGE_PIXEL/VERTEX/INDEX/CONSTANT. This
-    * usage argument is only an optimization hint, not a guarantee, therefore 
-    * proper behavior must be observed in all circumstances.
+    * @param usage bitmask of SVGA_BUFFER_USAGE_* flags.
     *
     * alignment indicates the client's alignment requirements, eg for
     * SSE instructions.
@@ -224,10 +244,7 @@ struct svga_winsys_screen
 
    /** 
     * Map the entire data store of a buffer object into the client's address.
-    * flags is a bitmask of:
-    * - PIPE_BUFFER_USAGE_CPU_READ/WRITE
-    * - PIPE_BUFFER_USAGE_DONTBLOCK
-    * - PIPE_BUFFER_USAGE_UNSYNCHRONIZED
+    * usage is a bitmask of PIPE_TRANSFER_*
     */
    void *
    (*buffer_map)( struct svga_winsys_screen *sws, 
@@ -272,28 +289,18 @@ struct svga_winsys_screen
 };
 
 
-struct pipe_context *
-svga_context_create(struct pipe_screen *screen);
-
-struct pipe_screen *
-svga_screen_create(struct svga_winsys_screen *sws);
-
 struct svga_winsys_screen *
 svga_winsys_screen(struct pipe_screen *screen);
 
-struct pipe_buffer *
+struct svga_winsys_context *
+svga_winsys_context(struct pipe_context *context);
+
+struct pipe_resource *
 svga_screen_buffer_wrap_surface(struct pipe_screen *screen,
                                enum SVGA3dSurfaceFormat format,
                                struct svga_winsys_surface *srf);
 
 struct svga_winsys_surface *
-svga_screen_texture_get_winsys_surface(struct pipe_texture *texture);
-struct svga_winsys_surface *
-svga_screen_buffer_get_winsys_surface(struct pipe_buffer *buffer);
-
-boolean
-svga_screen_buffer_from_texture(struct pipe_texture *texture,
-                               struct pipe_buffer **buffer,
-                               unsigned *stride);
+svga_screen_buffer_get_winsys_surface(struct pipe_resource *buffer);
 
 #endif /* SVGA_WINSYS_H_ */