[mutter] cogl/journal: Invalidate framebuffer mipmaps on each journal insertion



commit f0a9ec05192201c89f42f312cefac83f4cc46bec
Author: Daniel van Vugt <daniel van vugt canonical com>
Date:   Thu Jan 7 17:55:33 2021 +0800

    cogl/journal: Invalidate framebuffer mipmaps on each journal insertion
    
    Because the framebuffer itself might be backed by a texture, which might
    have mipmapping enabled. If so then rendering to the framebuffer will make
    those mipmaps out of date.
    
    Technically we are flagging the framebuffer's mipmaps as dirty *before*
    they are, because the journal hasn't been flushed yet. But we need to do
    it early because ideally the next flush will both write the offscreen
    framebuffer contents and then read them for use in rendering to an onscreen
    framebuffer. And the `mipmaps_dirty` flag needs to be set before the read,
    so therefore we need to do it before the next journal flush.
    
    Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3146
    where the offscreen framebuffer in question is meta-background's
    `monitor->fbo`.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1664>

 cogl/cogl/cogl-journal.c | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/cogl/cogl/cogl-journal.c b/cogl/cogl/cogl-journal.c
index 4949232d37..2edb8e9f0c 100644
--- a/cogl/cogl/cogl-journal.c
+++ b/cogl/cogl/cogl-journal.c
@@ -35,6 +35,7 @@
 #include "cogl-graphene.h"
 #include "cogl-journal-private.h"
 #include "cogl-texture-private.h"
+#include "cogl-texture-2d-private.h"
 #include "cogl-pipeline-private.h"
 #include "cogl-framebuffer-private.h"
 #include "cogl-profile.h"
@@ -1629,6 +1630,13 @@ _cogl_journal_log_quad (CoglJournal  *journal,
                                          add_framebuffer_deps_cb,
                                          framebuffer);
 
+  if (COGL_IS_OFFSCREEN (framebuffer))
+    {
+      CoglOffscreen *offscreen = COGL_OFFSCREEN (framebuffer);
+
+      _cogl_texture_2d_externally_modified (offscreen->texture);
+    }
+
   if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_SYNC_PRIMITIVE)))
     {
       _cogl_journal_flush (journal);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]