virgl: honor DISCARD_WHOLE_RESOURCE in virgl_res_needs_readback
[mesa.git] / src / gallium / drivers / iris / iris_clear.c
index 9fc242526a403afdf33dd029169dd72569330b3e..da2593c78dd3044207ca69dc49bae0b2aece9168 100644 (file)
@@ -78,9 +78,6 @@ can_fast_clear_color(struct iris_context *ice,
    struct iris_batch *batch = &ice->batches[IRIS_BATCH_RENDER];
    const struct gen_device_info *devinfo = &batch->screen->devinfo;
 
-   if (devinfo->gen > 9)
-      return false;
-
    if (res->aux.usage == ISL_AUX_USAGE_NONE)
       return false;
 
@@ -269,7 +266,13 @@ fast_clear_color(struct iris_context *ice,
    iris_blorp_surf_for_resource(&ice->vtbl, &surf, p_res, res->aux.usage,
                                 level, true);
 
-   blorp_fast_clear(&blorp_batch, &surf, format,
+   /* In newer gens (> 9), the hardware will do a linear -> sRGB conversion of
+    * the clear color during the fast clear, if the surface format is of sRGB
+    * type. We use the linear version of the surface format here to prevent
+    * that from happening, since we already do our own linear -> sRGB
+    * conversion in convert_fast_clear_color().
+    */
+   blorp_fast_clear(&blorp_batch, &surf, isl_format_srgb_to_linear(format),
                     level, box->z, box->depth,
                     box->x, box->y, box->x + box->width,
                     box->y + box->height);