Skip to content

fix(graphics): add EGL_BAD_MATCH fallback for incompatible format modifiers#5288

Open
muracodex wants to merge 1 commit into
LizardByte:masterfrom
muracodex:fix/egl-bad-match-fallback
Open

fix(graphics): add EGL_BAD_MATCH fallback for incompatible format modifiers#5288
muracodex wants to merge 1 commit into
LizardByte:masterfrom
muracodex:fix/egl-bad-match-fallback

Conversation

@muracodex

Copy link
Copy Markdown

Problem

When capturing from displays that report DMA-BUF format modifiers incompatible with the GPU's EGL implementation (e.g. USB/DisplayLink monitors), eglCreateImage() fails with EGL_BAD_MATCH (0x3009). This causes the error:

Couldn't import RGB Image: 00003009

The result is that streaming shows only static/interference instead of the actual display content.

Root Cause

The surface_descriptor_to_egl_attribs() function includes the display's DMA-BUF format modifier when creating the EGL image. Some displays (particularly USB-connected ones) report modifiers that the GPU's EGL implementation cannot handle, causing eglCreateImage() to fail.

Fix

In import_source(), when the initial eglCreateImage() fails with EGL_BAD_MATCH, retry the import without the format modifier (DRM_FORMAT_MOD_INVALID). This uses a linear import that is universally supported by EGL implementations.

Code Changes

  • src/platform/linux/graphics.cpp: Modified import_source() to retry DMA-BUF import without modifiers when the initial attempt fails with EGL_BAD_MATCH
  • Only the modifier is removed from the retry; all other surface parameters (fourcc, fds, pitches, offsets) are preserved

Testing

  • Arch Linux with Sunshine 2026.531.163415
  • GPU: Intel Arc (i9 Ultra, integrated)
  • Display: USB-connected tablet/monitor reporting incompatible modifier
  • Before fix: continuous Couldn't import RGB Image: 00003009 errors, stream shows static
  • After fix: DMA-BUF import succeeds with fallback, stream works correctly

When capturing from displays that report format modifiers incompatible
with the GPU's EGL implementation (e.g. USB/DisplayLink monitors),
eglCreateImage() fails with EGL_BAD_MATCH (0x3009).

This change retries the DMA-BUF import without the format modifier
when the initial attempt fails with EGL_BAD_MATCH, falling back to
a linear/modifier-less import that is universally supported.

Fixes the 'Couldn't import RGB Image: 00003009' error that causes
streaming to show only static/interference on affected displays.
@sonarqubecloud

Copy link
Copy Markdown

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant