Revert "etnaviv: completely turn off MSAA"
authorChristian Gmeiner <christian.gmeiner@gmail.com>
Sat, 2 Jul 2022 11:59:18 +0000 (13:59 +0200)
committerMarge Bot <emma+marge@anholt.net>
Wed, 2 Nov 2022 18:58:09 +0000 (18:58 +0000)
This reverts commit 044b238507bb54ff8b6129c9754f1efc0f0834b9 and extends it with
 - putting the comments directly in front of the if's
 - do not support 2x MSAA on SMALL_MSAA hardware
 - checking if blt/rs supports the format

MSAA should work as expected now. Tested with kmscube and qt5.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19013>

src/gallium/drivers/etnaviv/etnaviv_screen.c

index 62ebfa7..7c212ec 100644 (file)
@@ -495,10 +495,29 @@ gpu_supports_render_format(struct etna_screen *screen, enum pipe_format format,
    if (fmt == ETNA_NO_MATCH)
       return false;
 
-   /* MSAA is broken */
-   if (sample_count > 1)
+   if (sample_count > 1) {
+      /* The hardware supports it. */
+      if (!VIV_FEATURE(screen, chipFeatures, MSAA))
          return false;
 
+      /* Number of samples must be allowed. */
+      if (!translate_samples_to_xyscale(sample_count, NULL, NULL))
+         return false;
+
+      /* On SMALL_MSAA hardware 2x MSAA does not work. */
+      if (sample_count == 2 && VIV_FEATURE(screen, chipMinorFeatures4, SMALL_MSAA))
+         return false;
+
+      /* BLT/RS supports the format. */
+      if (screen->specs.use_blt) {
+         if (translate_blt_format(format) == ETNA_NO_MATCH)
+            return false;
+      } else {
+         if (translate_rs_format(format) == ETNA_NO_MATCH)
+            return false;
+      }
+   }
+
    if (format == PIPE_FORMAT_R8_UNORM)
       return VIV_FEATURE(screen, chipMinorFeatures5, HALTI5);