vl: Use CS composite shader only if TEX_LZ and DIV are supported
authorGert Wollny <gert.wollny@collabora.com>
Thu, 13 Jun 2019 07:26:01 +0000 (09:26 +0200)
committerGert Wollny <gert.wollny@collabora.com>
Sun, 30 Jun 2019 16:41:38 +0000 (18:41 +0200)
Enable the compute shader copositer only when TEX_LZ is supported by the driver.

v2: Also check whether DIV is supported.

https://bugs.freedesktop.org/show_bug.cgi?id=110783

Fixes: 9364d66cb7f7
 gallium/auxiliary/vl: Add video compositor compute shader render

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/auxiliary/vl/vl_compositor.c
src/gallium/auxiliary/vl/vl_compositor.h

index 12c58ff7436db2ac865b4847f553646e9a767dd8..193a073756ae9c1b234861b34794f09ed7628550 100644 (file)
@@ -70,7 +70,7 @@ init_shaders(struct vl_compositor *c)
       return false;
    }
 
-   if (c->pipe_compute_supported) {
+   if (c->pipe_cs_composit_supported) {
       c->cs_video_buffer = vl_compositor_cs_create_shader(c, compute_shader_video_buffer);
       if (!c->cs_video_buffer) {
          debug_printf("Unable to create video_buffer compute shader.\n");
@@ -125,7 +125,7 @@ static void cleanup_shaders(struct vl_compositor *c)
    c->pipe->delete_fs_state(c->pipe, c->fs_rgb_yuv.y);
    c->pipe->delete_fs_state(c->pipe, c->fs_rgb_yuv.uv);
 
-   if (c->pipe_compute_supported) {
+   if (c->pipe_cs_composit_supported) {
       c->pipe->delete_compute_state(c->pipe, c->cs_video_buffer);
       c->pipe->delete_compute_state(c->pipe, c->cs_weave_rgb);
       c->pipe->delete_compute_state(c->pipe, c->cs_rgba);
@@ -561,7 +561,7 @@ vl_compositor_set_buffer_layer(struct vl_compositor_state *s,
       float half_a_line = 0.5f / s->layers[layer].zw.y;
       switch(deinterlace) {
       case VL_COMPOSITOR_WEAVE:
-         if (c->pipe_compute_supported)
+         if (c->pipe_cs_composit_supported)
             s->layers[layer].cs = c->cs_weave_rgb;
          else
             s->layers[layer].fs = c->fs_weave_rgb;
@@ -571,7 +571,7 @@ vl_compositor_set_buffer_layer(struct vl_compositor_state *s,
          s->layers[layer].zw.x = 0.0f;
          s->layers[layer].src.tl.y += half_a_line;
          s->layers[layer].src.br.y += half_a_line;
-         if (c->pipe_compute_supported)
+         if (c->pipe_cs_composit_supported)
             s->layers[layer].cs = c->cs_video_buffer;
          else
             s->layers[layer].fs = c->fs_video_buffer;
@@ -581,7 +581,7 @@ vl_compositor_set_buffer_layer(struct vl_compositor_state *s,
          s->layers[layer].zw.x = 1.0f;
          s->layers[layer].src.tl.y -= half_a_line;
          s->layers[layer].src.br.y -= half_a_line;
-         if (c->pipe_compute_supported)
+         if (c->pipe_cs_composit_supported)
             s->layers[layer].cs = c->cs_video_buffer;
          else
             s->layers[layer].fs = c->fs_video_buffer;
@@ -589,7 +589,7 @@ vl_compositor_set_buffer_layer(struct vl_compositor_state *s,
       }
 
    } else {
-      if (c->pipe_compute_supported)
+      if (c->pipe_cs_composit_supported)
          s->layers[layer].cs = c->cs_video_buffer;
       else
          s->layers[layer].fs = c->fs_video_buffer;
@@ -757,7 +757,10 @@ vl_compositor_init(struct vl_compositor *c, struct pipe_context *pipe)
 
    memset(c, 0, sizeof(*c));
 
-   c->pipe_compute_supported = pipe->screen->get_param(pipe->screen, PIPE_CAP_COMPUTE);
+   c->pipe_cs_composit_supported = pipe->screen->get_param(pipe->screen, PIPE_CAP_COMPUTE) &&
+            pipe->screen->get_param(pipe->screen, PIPE_CAP_TGSI_TEX_TXF_LZ) &&
+            pipe->screen->get_param(pipe->screen, PIPE_CAP_TGSI_DIV);
+
    c->pipe = pipe;
 
    if (!init_pipe_state(c)) {
index d42618824a7281b0e05cd82b10e50babd1985136..ae06c153d5b7229cada2a564e12c2f9e36f65f29 100644 (file)
@@ -121,7 +121,7 @@ struct vl_compositor
    void *cs_weave_rgb;
    void *cs_rgba;
 
-   bool pipe_compute_supported;
+   bool pipe_cs_composit_supported;
 
    struct {
       struct {