virgl: ARB_enhanced_layouts support
authorDave Airlie <airlied@redhat.com>
Thu, 14 Jun 2018 04:51:04 +0000 (14:51 +1000)
committerDave Airlie <airlied@redhat.com>
Tue, 21 Aug 2018 19:05:21 +0000 (05:05 +1000)
We need to handle the gaps in the streamout bindings on the guest
side and enable if it the host has the rest enabled.

Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
docs/features.txt
src/gallium/drivers/virgl/virgl_encode.c
src/gallium/drivers/virgl/virgl_hw.h
src/gallium/drivers/virgl/virgl_screen.c
src/gallium/drivers/virgl/virgl_streamout.c

index 800a132e509fff38e9218b9b42b4fbfb7587737b..be10cb7da9201b2fa9822e11b360c268bfa1bdbe 100644 (file)
@@ -196,7 +196,7 @@ GL 4.4, GLSL 4.40 -- all DONE: i965/gen8+, nvc0, r600, radeonsi
   GL_MAX_VERTEX_ATTRIB_STRIDE                           DONE (all drivers)
   GL_ARB_buffer_storage                                 DONE (freedreno, i965, nv50, llvmpipe, swr)
   GL_ARB_clear_texture                                  DONE (i965, nv50, llvmpipe, softpipe, swr)
-  GL_ARB_enhanced_layouts                               DONE (i965, nv50, llvmpipe, softpipe)
+  GL_ARB_enhanced_layouts                               DONE (i965, nv50, llvmpipe, softpipe, virgl)
   - compile-time constant expressions                   DONE
   - explicit byte offsets for blocks                    DONE
   - forced alignment within blocks                      DONE
index 190c338f4584ba7dfd71c4ef70cc59f52b5feb59..c09eb5a6382d06395cff8a026ae3f254e022d1c4 100644 (file)
@@ -880,7 +880,7 @@ int virgl_encoder_set_so_targets(struct virgl_context *ctx,
    virgl_encoder_write_dword(ctx->cbuf, append_bitmask);
    for (i = 0; i < num_targets; i++) {
       struct virgl_so_target *tg = virgl_so_target(targets[i]);
-      virgl_encoder_write_dword(ctx->cbuf, tg->handle);
+      virgl_encoder_write_dword(ctx->cbuf, tg ? tg->handle : 0);
    }
    return 0;
 }
index 787452d328716e5c292d88b844fb282de935e7a8..9a358dd8445839f4747554698f2d0398727dfff7 100644 (file)
@@ -230,6 +230,7 @@ enum virgl_formats {
 #define VIRGL_CAP_TGSI_FBFETCH         (1 << 10)
 #define VIRGL_CAP_SHADER_CLOCK         (1 << 11)
 #define VIRGL_CAP_TEXTURE_BARRIER      (1 << 12)
+#define VIRGL_CAP_TGSI_COMPONENTS      (1 << 13)
 
 /* virgl bind flags - these are compatible with mesa 10.5 gallium.
  * but are fixed, no other should be passed to virgl either.
index 86063c66aafd18d020d3bddf415ebf298968400c..7df865eb12304a176ed7680902ccf6ac7757931e 100644 (file)
@@ -236,6 +236,8 @@ virgl_get_param(struct pipe_screen *screen, enum pipe_cap param)
       return vscreen->caps.caps.v2.capability_bits & VIRGL_CAP_TGSI_FBFETCH;
    case PIPE_CAP_TGSI_CLOCK:
       return vscreen->caps.caps.v2.capability_bits & VIRGL_CAP_SHADER_CLOCK;
+   case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
+      return vscreen->caps.caps.v2.capability_bits & VIRGL_CAP_TGSI_COMPONENTS;
    case PIPE_CAP_TEXTURE_GATHER_SM5:
    case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
    case PIPE_CAP_FAKE_SW_MSAA:
@@ -272,7 +274,6 @@ virgl_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_MAX_WINDOW_RECTANGLES:
    case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
    case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
-   case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
    case PIPE_CAP_TGSI_CAN_READ_OUTPUTS:
    case PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY:
    case PIPE_CAP_TGSI_MUL_ZERO_WINS:
index b6a65fff29e25ab50d68271997b46a86404e15ea..0fc3af67959c02880f01aaf971b195c66e4ebedc 100644 (file)
@@ -72,7 +72,10 @@ static void virgl_set_so_targets(struct pipe_context *ctx,
    struct virgl_context *vctx = virgl_context(ctx);
    int i;
    for (i = 0; i < num_targets; i++) {
-      pipe_resource_reference(&vctx->so_targets[i].base.buffer, targets[i]->buffer);
+      if (targets[i])
+         pipe_resource_reference(&vctx->so_targets[i].base.buffer, targets[i]->buffer);
+      else
+         pipe_resource_reference(&vctx->so_targets[i].base.buffer, NULL);
    }
    for (i = num_targets; i < vctx->num_so_targets; i++)
       pipe_resource_reference(&vctx->so_targets[i].base.buffer, NULL);