v3d: Add SSBO/atomic counters support.
[mesa.git] / src / gallium / drivers / virgl / virgl_resource.h
index d41b9906fb1dac2c24aed7299b7967a52596286e..e211fb881b19168df209288ab01c478e421ce19c 100644 (file)
@@ -46,29 +46,8 @@ struct virgl_resource_metadata
 
 struct virgl_resource {
    struct u_resource u;
-   struct virgl_hw_res *hw_res;
    boolean clean;
-};
-
-struct virgl_buffer {
-   struct virgl_resource base;
-
-   struct list_head flush_list;
-   boolean on_list;
-
-   /* The buffer range which is initialized (with a write transfer,
-    * streamout, DMA, or as a random access target). The rest of
-    * the buffer is considered invalid and can be mapped unsynchronized.
-    *
-    * This allows unsychronized mapping of a buffer range which hasn't
-    * been used yet. It's for applications which forget to use
-    * the unsynchronized map flag and expect the driver to figure it out.
-    */
-   struct util_range valid_buffer_range;
-};
-
-struct virgl_texture {
-   struct virgl_resource base;
+   struct virgl_hw_res *hw_res;
    struct virgl_resource_metadata metadata;
 };
 
@@ -86,35 +65,19 @@ void virgl_init_screen_resource_functions(struct pipe_screen *screen);
 
 void virgl_init_context_resource_functions(struct pipe_context *ctx);
 
-struct pipe_resource *virgl_texture_create(struct virgl_screen *vs,
-                                           const struct pipe_resource *templ);
-
-struct pipe_resource *virgl_texture_from_handle(struct virgl_screen *vs,
-                                                const struct pipe_resource *templ,
-                                                struct winsys_handle *whandle);
+void virgl_texture_init(struct virgl_resource *res);
 
 static inline struct virgl_resource *virgl_resource(struct pipe_resource *r)
 {
    return (struct virgl_resource *)r;
 }
 
-static inline struct virgl_buffer *virgl_buffer(struct pipe_resource *r)
-{
-   return (struct virgl_buffer *)r;
-}
-
-static inline struct virgl_texture *virgl_texture(struct pipe_resource *r)
-{
-   return (struct virgl_texture *)r;
-}
-
 static inline struct virgl_transfer *virgl_transfer(struct pipe_transfer *trans)
 {
    return (struct virgl_transfer *)trans;
 }
 
-struct pipe_resource *virgl_buffer_create(struct virgl_screen *vs,
-                                          const struct pipe_resource *templ);
+void virgl_buffer_init(struct virgl_resource *res);
 
 static inline unsigned pipe_to_virgl_bind(unsigned pbind)
 {
@@ -166,4 +129,10 @@ virgl_resource_create_transfer(struct pipe_context *ctx,
 void virgl_resource_destroy_transfer(struct virgl_context *vctx,
                                      struct virgl_transfer *trans);
 
+void virgl_resource_destroy(struct pipe_screen *screen,
+                            struct pipe_resource *resource);
+
+boolean virgl_resource_get_handle(struct pipe_screen *screen,
+                                  struct pipe_resource *resource,
+                                  struct winsys_handle *whandle);
 #endif