Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong buffer format for frame captured with wlr_screencopy #9109

Open
2 of 6 tasks
Syudagye opened this issue Jan 18, 2025 · 3 comments
Open
2 of 6 tasks

Wrong buffer format for frame captured with wlr_screencopy #9109

Syudagye opened this issue Jan 18, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@Syudagye
Copy link

Already reported ? *

  • I have searched the existing open and closed issues.

Regression?

Probably not a regression / I don't remember it happening before

System Info and Hyprland Version

System/Version info
Hyprland 0.46.2 built from branch  at commit 0bd541f2fd902dbfa04c3ea2ccf679395e316887  (version: bump to 0.46.2).
Date: Thu Dec 19 19:26:47 2024
Tag: v0.46.2, commits: 5566
built against:
 aquamarine 0.7.0
 hyprlang 0.6.0
 hyprutils 0.3.3
 hyprcursor 0.1.11
 hyprgraphics 0.1.1


flags set:
debug


System Information:
System name: Linux
Node name: archbtw
Release: 6.12.8-arch1-1
Version: #1 SMP PREEMPT_DYNAMIC Thu, 02 Jan 2025 22:52:26 +0000


GPU information:
21:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Navi 23 [Radeon RX 6600/6600 XT/6600M] [1002:73ff] (rev c7) (prog-if 00 [VGA controller])


os-release: NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
ID=arch
BUILD_ID=rolling
ANSI_COLOR="38;2;23;147;209"
HOME_URL="https://archlinux.org/"
DOCUMENTATION_URL="https://wiki.archlinux.org/"
SUPPORT_URL="https://bbs.archlinux.org/"
BUG_REPORT_URL="https://gitlab.archlinux.org/groups/archlinux/-/issues"
PRIVACY_POLICY_URL="https://terms.archlinux.org/docs/privacy-policy/"
LOGO=archlinux-logo


plugins:
	unknown: not runtime

Description

When capturing a frame using zwlr_screencopy_v1, it seems the format advertised is not corresponding to the buffer content.

I'm writing a custom screenshot utility and the resulting image have some color channels in the wrong place if i don't reinterpret the pixel format.
For me, screencopy frames are advertised as XRGB8888 but the data is in BGRA8888 (or BGRX8888 since all alpha is 255)

How to reproduce

With my project:

  1. run it with cargo run, you get a <output>.png file, should be normal
  2. in src/main.rs comment line 55 and uncomment line 54 (which specifies with which format to interpret the buffer)
  3. run again with cargo r, you get a <output>.png file with red and blue channel reversed

Attach not paste

  • I understand that all text files must be attached, and not pasted directly. If not respected, this issue will likely get closed as spam

Checklist of files to include below

  • Hyprland config - hyprctl systeminfo -c (always include)
  • Crash report (always include in case of crash)
  • Video (always include in case of a visual bug)
  • Logs (might contain useful info such as errors)

Additional info & File uploads

screenshot taken by reinterpreting XRGB8888 as BGRA8888:
Image

screenshot taken by assuming the data is XRGB8888 (or ARGB8888)
Image

@Syudagye Syudagye added the bug Something isn't working label Jan 18, 2025
@vaxerski
Copy link
Member

shm or dma?

xdph hyprlock and hyprpicker all work fine

@Syudagye
Copy link
Author

Syudagye commented Jan 18, 2025 via email

@Syudagye
Copy link
Author

I don't know if this could be useful, but looking at the code i see that the format given to opengl when issuing zwlr_screencopy_frame_v1::copy on a shm buffer seems to be either BRGA and RGBA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants