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;
};
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)
{
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