Skip to content

[Linux] Content rendered shifted by half the window when glBlitFramebuffer is unavailable (composite_layer offset off by -1) #195885

Closed

Description

@lunerien

Steps to reproduce

  1. Use Flutter 3.50.0-0.3.pre on Linux.
  2. flutter create --platforms=linux repro && cd repro
  3. flutter run -d linux on a system where the OpenGL compositor cannot blit (can_blit == false), for example:
    • NVIDIA proprietary driver (blocklisted for blit in [Linux] Make glBlitFramebuffer optional in the OpenGL compositor #189476). Reproduced on RTX 4060 Laptop, driver 595.99.02, Ubuntu 24.04, GNOME on X11.
    • A GPU whose GLES context is < 3.0 without GL_EXT_framebuffer_blit / GL_NV_framebuffer_blit. Reproduced on Intel HD Graphics (Ironlake, 8086:0042), Mesa 24.2.8 crocus, OpenGL ES 2.0, Rocky Linux 9.6, Xorg/XFCE.
  4. The result is the same with Impeller (default) and with Skia (FLUTTER_ENGINE_SWITCHES=1 FLUTTER_ENGINE_SWITCH_1=enable-impeller=false).

Expected results

The app content fills the whole window at the correct position, as it does when the compositor uses glBlitFramebuffer.

Actual results

The content is translated by (-width/2, -height/2): the bottom-left quarter of the window shows the top-right quarter of the UI at 1:1 scale (in the counter app, the right part of the AppBar and the DEBUG banner), and the rest of the window is black. Hit testing is unaffected (clicks land on the correct
logical positions), so only compositing is wrong.

Root cause: in engine/src/flutter/shell/platform/linux/fl_compositor_opengl.cc, composite_layer():

fl_compositor_opengl_shader_set_offset(self->shader, (2 * x / width) - 1.0,                                                                                                                                                                                                                                      
                                       (2 * y / height) - 1.0);                                                                                                                                                                                                                                                  

The quad in fl_compositor_opengl_shader.cc already spans the full NDC range (vertex_data = -1..1), and the vertex shader computes gl_Position = vec4(offset + position * scale, 0, 1). For a layer at (0, 0) the offset is therefore (-1, -1), and the quad is drawn at [-2, 0] x [-2, 0], which is exactly
the observed shift. For a layer at (0, 0) the offset should be (0, 0), i.e. 2 * x / width without - 1.0. The sign of the y term for non-zero layer offsets needs checking: layer offsets are top-down, while GL NDC is bottom-up.

The - 1.0 was introduced in #172090. Before #189476, composite_layer() was only used for the second and later layers (overlays). Since #189476 it is also used for the first layer whenever blit is unavailable, so every frame is affected. The code is unchanged on master (#188145 fixed y / width but
kept the - 1.0).

Secondary issue: texture_width / width and texture_height / height use integer division (size_t / int), so the scale truncates whenever the backing store size differs from the view size, e.g. during a resize.

Workaround: on Mesa, MESA_GLES_VERSION_OVERRIDE=3.0 makes can_blit true, and the window renders correctly (verified on the Ironlake machine). There is no workaround for NVIDIA.

Flutter GPU without usable blit
3.35.7 renders correctly
3.38.0 – 3.47.x aborts: No provider of glBlitFramebuffer found (#189322, since #172090)
3.50.0-0.3.pre starts, but the content is shifted by half the window (this issue)

Related: #172090, #189322, #189476, #188145, #152099

Code sample

Code sample Unmodified `flutter create --platforms=linux repro` (the default counter app). No code changes are needed.

Screenshots or Video

Screenshots / Video demonstration Image Image Image

Logs

Logs

Nothing relevant is logged; there are no GL errors or warnings. Impeller run:

[IMPORTANT:flutter/shell/platform/embedder/embedder_surface_gl_impeller.cc(127)] Using the Impeller rendering backend (OpenGLESSDF). 

Flutter Doctor output

Doctor output
[!] Flutter (Channel [user-branch], 3.50.0-0.3.pre, on Ubuntu 24.04.5 LTS 7.0.0-38-generic, locale en_US.UTF-8)                                                                                                                                                                                                  
      • Framework revision 13ced38318 (6 days ago), 2026-10-28 09:52:50 -0700                                                                                                                                                                                                                                      
      • Engine revision 8ec493d4d9                                                                                                                                                                                                                                                                                 
      • Dart version 3.14.0 (build 3.14.0-315.3.beta)                                                                                                                                                                                                                                                              
      • DevTools version 2.61.0                                                                                                                                                                                                                                                                                    
  [✗] Android toolchain - develop for Android devices                                                                                                                                                                                                                                                              
      ✗ Unable to locate Android SDK.                                                                                                                                                                                                                                                                              
  [✓] Chrome - develop for the web                                                                                                                                                                                                                                                                                 
  [✓] Linux toolchain - develop for Linux desktop                                                                                                                                                                                                                                                                  
      • Ubuntu clang version 18.1.3 (1ubuntu1)                                                                                                                                                                                                                                                                     
      • cmake version 3.28.1                                                                                                                                                                                                                                                                                       
      • ninja version 1.11.1                                                                                                                                                                                                                                                                                       
      • pkg-config version 1.8.1                                                                                                                                                                                                                                                                                   
  [✓] Connected device (2 available)                                                                                                                                                                                                                                                                               
      • Linux (desktop) • linux • linux-x64 • Ubuntu 24.04.5 LTS 7.0.0-38-generic                                                                                                                                                                                                                                  
  [✓] Network resources        

Activity

  1. suryaKommana2662 commented on Nov 3, 2026

    @suryaKommana2662
    Contributor

    @lunerien Thanks for the report. I tested the default Flutter counter application on Linux with both Impeller and Skia, but couldn't reproduce the issue.

    My environment uses Mesa llvmpipe with OpenGL ES 3.2, and GL_EXT_framebuffer_blit is available. The reported configurations use an NVIDIA RTX 4060 with a proprietary driver and Intel HD Graphics (Ironlake) with OpenGL ES 2.0.

    My environment differs from the reported configurations, so I may not be exercising the affected compositor path. Routing to team-linux for further investigation.

  2. added
    platform-linuxBuilding on or for Linux specifically
    team-linuxOwned by the Linux platform team
    engineflutter/engine related. See also e: labels.
    and removed
    in triagePresently being triaged by the triage team
    on Nov 3, 2026
  3. added
    P1High-priority issues at the top of the work list
    triaged-linuxTriaged by the Linux platform team
    P0Critical issues such as a build break or regression
    and removed
    P1High-priority issues at the top of the work list
    on Nov 6, 2026
  4. self-assigned this
    on Nov 6, 2026
  5. robert-ancell commented on Nov 6, 2026

    @robert-ancell
    Contributor

    Looks like this will have to be in 3.50.1 - please hold of updating if you are getting this issue.

  6. andreclinio commented on Nov 11, 2026

    @andreclinio

    I still get this problem with Flutter 3.50.0 version

    [✓] Flutter (Channel stable, 3.50.0, on Ubuntu 26.04.1 LTS 7.0.0-43-generic, locale en_US.UTF-8) [29ms]
        • Flutter version 3.50.0 on channel stable at /home/clinio/apps/flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision ab2912035e (2 days ago), 2026-11-09 08:50:21 -0800
        • Engine revision 371f77202a
        • Dart version 3.14.0
        • DevTools version 2.61.0
        • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android,
          enable-ios, cli-animations, enable-native-assets, enable-record-use, enable-swift-package-manager,
          omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 37.0.0) [189ms]
        • Android SDK at /home/clinio/Android/Sdk
        • Emulator version 37.2.13.0 (build_id 16740729) (CL:N/A)
        • Platform android-37.1, build-tools 37.0.0
        • Java binary at: /usr/lib/jvm/java-17-openjdk-amd64/bin/java
          This JDK is specified in your Flutter configuration.
          To change the current JDK, run: `flutter config --jdk-dir="path/to/jdk"`.
        • Java version OpenJDK Runtime Environment (build 17.0.21.0.3+1-1-26.04.1-Ubuntu)
        • All Android licenses accepted.
    
    [✓] Chrome - develop for the web [6ms]
        • Chrome at google-chrome
    
    [✓] Linux toolchain - develop for Linux desktop [370ms]
        • Ubuntu clang version 21.1.8 (6ubuntu1)
        • cmake version 4.2.3
        • ninja version 1.13.2
        • pkg-config version 2.5.1
        • OpenGL core renderer: NVIDIA GeForce GTX 1050 Ti/PCIe/SSE2
        • OpenGL core version: 4.6.0 NVIDIA 580.178.04
        • OpenGL core shading language version: 4.60 NVIDIA
        • OpenGL ES renderer: NVIDIA GeForce GTX 1050 Ti/PCIe/SSE2
        • OpenGL ES version: OpenGL ES 3.2 NVIDIA 580.178.04
        • OpenGL ES shading language version: OpenGL ES GLSL ES 3.20
        • GL_EXT_framebuffer_blit: yes
        • GL_EXT_texture_format_BGRA8888: yes
    
    [✓] Connected device (2 available) [74ms]
        • Linux (desktop) • linux  • linux-x64      • Ubuntu 26.04.1 LTS 7.0.0-43-generic
        • Chrome (web)    • chrome • web-javascript • Google Chrome 157.0.8103.50
    
    [✓] Network resources [438ms]
        • All expected network resources are available.
    
    
  7. lunerien commented on Nov 11, 2026

    @lunerien
    Author

    @robert-ancell said #195885 (comment) that fix will be in 3.50.1 version

  8. andreclinio commented on Nov 12, 2026

    @andreclinio

    👍🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P0Critical issues such as a build break or regressiona: desktopRunning on desktopengineflutter/engine related. See also e: labels.platform-linuxBuilding on or for Linux specificallyteam-linuxOwned by the Linux platform teamtriaged-linuxTriaged by the Linux platform team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions