virgl: Don't allow creating staging pipe_resources
authorAlexandros Frantzis <alexandros.frantzis@collabora.com>
Thu, 27 Jun 2019 07:48:50 +0000 (10:48 +0300)
committerChia-I Wu <olvaffe@gmail.com>
Fri, 28 Jun 2019 04:30:02 +0000 (04:30 +0000)
Staging buffers are now created directly by the virgl_staging_mgr. We
don't need to support creating staging pipe_resources.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
src/gallium/drivers/virgl/virgl_buffer.c
src/gallium/drivers/virgl/virgl_resource.h
src/gallium/drivers/virgl/virgl_texture.c

index bc12f3f887645c92de0c0a20ded5b132115d0a00..fb97ce15aae426eef6c91fdb522a4ae8b0a6e1e4 100644 (file)
@@ -90,12 +90,6 @@ static void virgl_buffer_transfer_unmap(struct pipe_context *ctx,
 {
    struct virgl_context *vctx = virgl_context(ctx);
    struct virgl_transfer *trans = virgl_transfer(transfer);
-   struct virgl_screen *vs = virgl_screen(ctx->screen);
-   struct pipe_resource *res = transfer->resource;
-
-   /* We don't transfer the contents of staging resources, since they don't
-    * have any host-side storage. */
-   assert(pipe_to_virgl_bind(vs, res->bind, res->flags) != VIRGL_BIND_STAGING);
 
    if (trans->base.usage & PIPE_TRANSFER_WRITE) {
       if (transfer->usage & PIPE_TRANSFER_FLUSH_EXPLICIT) {
index 47aefb4bd38849a1ecdd3b5a133d9b41363ccbcb..f41c1ce98b374d8393c19f75292fb89c11e38abb 100644 (file)
 #include "virgl_screen.h"
 #define VR_MAX_TEXTURE_2D_LEVELS 15
 
-/* Indicates that the resource will be used as a staging buffer, not requiring
- * dedicated host-side storage. Can only be used with PIPE_BUFFER resources
- * that have a PIPE_BIND_CUSTOM bind type.
- */
-#define VIRGL_RESOURCE_FLAG_STAGING (PIPE_RESOURCE_FLAG_DRV_PRIV << 0)
-
 struct winsys_handle;
 struct virgl_screen;
 struct virgl_context;
@@ -144,12 +138,8 @@ static inline unsigned pipe_to_virgl_bind(const struct virgl_screen *vs,
       outbind |= VIRGL_BIND_STREAM_OUTPUT;
    if (pbind & PIPE_BIND_CURSOR)
       outbind |= VIRGL_BIND_CURSOR;
-   if (pbind & PIPE_BIND_CUSTOM) {
-      if (flags & VIRGL_RESOURCE_FLAG_STAGING)
-         outbind |= VIRGL_BIND_STAGING;
-      else
-         outbind |= VIRGL_BIND_CUSTOM;
-   }
+   if (pbind & PIPE_BIND_CUSTOM)
+      outbind |= VIRGL_BIND_CUSTOM;
    if (pbind & PIPE_BIND_SCANOUT)
       outbind |= VIRGL_BIND_SCANOUT;
    if (pbind & PIPE_BIND_SHARED)
@@ -161,6 +151,12 @@ static inline unsigned pipe_to_virgl_bind(const struct virgl_screen *vs,
    if (pbind & PIPE_BIND_COMMAND_ARGS_BUFFER)
       if (vs->caps.caps.v2.capability_bits & VIRGL_CAP_BIND_COMMAND_ARGS)
          outbind |= VIRGL_BIND_COMMAND_ARGS;
+
+   /* Staging resources should only be created directly through the winsys,
+    * not using pipe_resources.
+    */
+   assert(!(outbind & VIRGL_BIND_STAGING));
+
    return outbind;
 }
 
index 8a85a28cec4809b09760a222d7e21bdeabad043c..f33b3f8808d685793a2554168e653b7cd59bfd9c 100644 (file)
@@ -313,14 +313,8 @@ static void virgl_texture_transfer_unmap(struct pipe_context *ctx,
 {
    struct virgl_context *vctx = virgl_context(ctx);
    struct virgl_transfer *trans = virgl_transfer(transfer);
-   struct virgl_screen *vs = virgl_screen(ctx->screen);
-   struct pipe_resource *res = transfer->resource;
    bool queue_unmap = false;
 
-   /* We don't transfer the contents of staging resources, since they don't
-    * have any host-side storage. */
-   assert(pipe_to_virgl_bind(vs, res->bind, res->flags) != VIRGL_BIND_STAGING);
-
    if (transfer->usage & PIPE_TRANSFER_WRITE &&
        (transfer->usage & PIPE_TRANSFER_FLUSH_EXPLICIT) == 0) {