hyprwm / Hyprland

Hyprland is an independent, highly customizable, dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
https://hyprland.org
BSD 3-Clause "New" or "Revised" License
19.6k stars 826 forks source link

10-bit color depth does not work #7379

Closed PancakeTAS closed 2 weeks ago

PancakeTAS commented 3 weeks ago

Regression?

Yes

System Info and Version

System/Version info ```sh Hyprland, built from branch main at commit 912e7ba82defdb10efc892a5db578598c972fe4a (render: fixup format mismatch after leaving DS). Date: Sat Aug 17 19:27:20 2024 Tag: v0.42.0-31-g912e7ba8, commits: 5100 flags: (if any) System Information: System name: Linux Node name: cute Release: 6.10.5-arch1-1 Version: #1 SMP PREEMPT_DYNAMIC Thu, 15 Aug 2024 00:25:30 +0000 GPU information: 0a:00.0 VGA compatible controller [0300]: NVIDIA Corporation GA102 [GeForce RTX 3080 Lite Hash Rate] [10de:2216] (rev a1) (prog-if 00 [VGA controller]) NVRM version: NVIDIA UNIX x86_64 Kernel Module 555.58.02 Tue Jun 25 01:39:15 UTC 2024 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: ======Config-Start====== Config File: /home/pancake/.config/hypr/hyprland.conf: Read Succeeded # === Main Configuration === general { layout = dwindle allow_tearing = true } opengl { nvidia_anti_flicker = true } render { explicit_sync = 1 explicit_sync_kms = 0 direct_scanout = 1 } dwindle { pseudotile = yes preserve_split = yes force_split = 2 permanent_direction_override = yes } misc { disable_hyprland_logo = yes disable_splash_rendering = yes force_default_wallpaper = 0 mouse_move_enables_dpms = no key_press_enables_dpms = true animate_manual_resizes = true } cursor { no_hardware_cursors = true default_monitor = DP-2 no_warps = true enable_hyprcursor = false } xwayland { force_zero_scaling = true } debug { disable_logs = false } # env vars env = XCURSOR_SIZE,24 env = XCURSOR_THEME,Bibata-Modern-Classic env = QT_QPA_PLATFORMTHEME,qt6ct env = LIBVA_DRIVER_NAME,nvidia env = XDG_SESSION_TYPE,wayland env = GBM_BACKEND,nvidia-drm env = __GLX_VENDOR_LIBRARY_NAME,nvidia env = NVD_BACKEND, direct env = MOZ_DISABLE_RDD_SANDBOX, 1 env = __EGL_VENDOR_LIBRARY_FILENAMES, /usr/share/glvnd/egl_vendor.d/10_nvidia.json env = QT_AUTO_SCREEN_SCALE_FACTOR, 1 env = QT_ENABLE_HIGHDPI_SCALING, 1 # workspaces $ws1 = 3 $ws2 = 4 $ws3 = 2 $ws4 = 1 # startup apps exec-once = hyprpaper exec-once = nvidia-settings --load-config-only exec-once = pipewire exec-once = sleep 0.2 && wireplumber exec-once = /home/pancake/.local/bin/wallpaper # === Decoration Configuration === general { gaps_in = 5 gaps_out = 20 border_size = 0 col.active_border = rgba(000000AA) col.inactive_border = rgba(00000055) } decoration { rounding = 20 blur { enabled = true size = 1 passes = 1 } drop_shadow = yes shadow_range = 4 shadow_render_power = 3 col.shadow = rgba(1a1a1aee) } animations { enabled = yes bezier = bezier, 0.0, 1.0, 0.3, 1.0 animation = global, 0, 0, default animation = fade, 1, 4, default animation = windows, 1, 4, bezier animation = workspaces, 1, 4, default, fade } # === Input Configuration === input { kb_layout = de numlock_by_default = true sensitivity = -0.6666 accel_profile = flat follow_mouse = 1 } # === Keybinds === $alt = Alt_L $super = SUPER $ctrl = Control_L $shift = SHIFT # main keybinds bind = $alt $shift $ctrl, Delete, exit bind = $alt $ctrl, Return, exec, kitty bind = $alt $shift $ctrl, q, killactive bind = $alt $ctrl, e, exec, bash -c '( "/home/pancake/.docs/Start Menu/$(ls /home/pancake/.docs/Start\ Menu/ | rofi -dmenu -i)" & )' & bind = $alt $shift, d, exec, grim -g "$(slurp -d)" - | wl-copy bind = $alt $ctrl, w, exec, hyprctl --batch "keyword general:gaps_out 0 ; keyword general:gaps_in 0 ; keyword decoration:rounding 0" bind = $alt $ctrl $shift, w, exec, hyprctl --batch "keyword general:gaps_out 20 ; keyword general:gaps_in 5 ; keyword decoration:rounding 20" # split keybinds bind = $alt $ctrl, d, layoutmsg, preselect r bind = $alt $ctrl, s, layoutmsg, preselect d bind = $alt $ctrl, y, layoutmsg, togglesplit # TODO: layout swap 2 # window keybinds bind = $alt $shift, 2, movetoworkspace, special:magic bind = $alt, space, togglespecialworkspace, magic bind = $alt $ctrl, f, fullscreen bind = $alt $ctrl, v, togglefloating bindm = $super, mouse:272, movewindow bindm = $super, mouse:273, resizewindow # media keybinds bind = , XF86AudioMute, exec, amixer sset 'Line 01 Mute' toggle && amixer sset 'Line 02 Mute' toggle && amixer sset 'Line 03 Mute' toggle && amixer sset 'Line 04 Mute' toggle bind = , XF86AudioNext, exec, playerctl next bind = , XF86AudioPrev, exec, playerctl previous bind = , XF86AudioPlay, exec, playerctl play-pause bind = , XF86AudioPause, exec, playerctl play-pause # workspaces bind = $alt, 1, movetoworkspace, $ws1 bind = $alt, 2, movetoworkspace, $ws2 bind = $alt, 3, movetoworkspace, $ws3 bind = $alt, 4, movetoworkspace, $ws4 # See https://wiki.hyprland.org/Configuring/Monitors/ monitor=DP-2,1920x1080@240,-1920x50,1,bitdepth,10 monitor=DP-3,2560x1440@240,0x-100,1.25,bitdepth,10 monitor=HDMI-A-1,1920x1080@60,2048x0,1 monitor=DP-1,3840x2160@60,3968x0,1.666667,bitdepth,10 windowrulev2 = suppressevent maximize, class:.* windowrulev2 = immediate, class:.* # nautilus windowrulev2 = float,class:(Nautilus) windowrulev2 = size 1200 800,class:(Nautilus) # amberol windowrulev2 = float,class:(Amberol) windowrulev2 = size 768 768,class:(Amberol) # steam windowrulev2 = float,initialTitle:(Steam Settings) windowrulev2 = float,initialTitle:(Friends List) windowrulev2 = float,initialTitle:(Sign in to Steam) # rofi windowrulev2 = float,class:(Rofi) # obs # TODO ======Config-End======== ```

Description

10-bit color depth does not seem to work.

A few commits ago, the log showed this: output DP-3 succeeded basic test on format DRM_FORMAT_XRGB2101010, but then proceeded to create an 8-bit buffer (verified through hyprctl monitors. Checking again on latest master commit, all 3 of my 10-bit monitors show the correct format in hyprctl monitors, but in reality all black out and don't show anything at all.

Commit that broke 10-bit rendering according to bisect: 016da234d0e852de3ef20eb2e89ac58d2a85f6e7

How to reproduce

Add bitdepth,10 to a monitor that supports 10-bit in the hyprland config

Crash reports, logs, images, videos

hyprland.log.tar.gz hyprctlmonitors.txt sysinfo.txt huge log..

aayushsenapati commented 3 weeks ago

same issue here,on my external monitor im facing another issue,on launch eternal monitor is detected,but if my laptop suspends/I disconnect and reconnect the monitor,it does not work but it does show up on hyprctl monitors

vaxerski commented 3 weeks ago

are you on aquamarine-git?

PancakeTAS commented 3 weeks ago

didn't realize aquamarine was actually a dependency and not part of hyprland itself-

either way, issue persists with aquamarine-git

aayushsenapati commented 3 weeks ago

ya i'm on aquamarine-git, issue still persists

vaxerski commented 3 weeks ago

is there a way to verify this? like hyprctl monitors reports 10b, how do you know it isnt?

PancakeTAS commented 3 weeks ago

is there a way to verify this? like hyprctl monitors reports 10b, how do you know it isnt?

on the latest git commit, there is no monitor output. hyprctl reports 10b, but there is no output.

when editing the config from 8 to 10 bit while Hyprland is running, the monitor will freeze

on previous commits, hyprctl did not even report 10 bit to begin with

vaxerski commented 3 weeks ago

can you post a trace log then? https://wiki.hyprland.org/Crashes-and-Bugs/#obtaining-a-trace-log

PancakeTAS commented 3 weeks ago

website is down. is the hyprland.log I sent in my original message not a trace log?

And i can't really send a stacktrace because Hyprland does not crash, it just doesn't display on the monitor

vaxerski commented 3 weeks ago

website isn't down?

No, it's not unfortunately

PancakeTAS commented 3 weeks ago

Here you go hyprland.log.tar.gz

vaxerski commented 3 weeks ago

huh yea something went real wrong. What's your aquamarine version?

PancakeTAS commented 3 weeks ago

Compiled using aquamarine-git on this commit: https://github.com/hyprwm/aquamarine/commit/7f8df01d4297b9068a9592400f16044602844f86

vaxerski commented 3 weeks ago

can you pull latest aq-git from right now? I added some more trace logs. Get a trace log as before, just launch hl and exit

PancakeTAS commented 3 weeks ago

Alright latest hyprland-git and aquamarine-git: hyprland.log.tar.gz

PancakeTAS commented 3 weeks ago

Alright, I can recreate the issue in rust. From the looks of it aquamarine tries to create an XR30 buffer with the flags SCANOUT and RENDERING.

let gbm = gbm::Device::new(File::open(PathBuf::from("/dev/dri/renderD128")).unwrap()).unwrap();
let bo: BufferObject<()> = gbm.create_buffer_object(2560, 1440, gbm::Format::Xrgb2101010, BufferObjectFlags::SCANOUT | BufferObjectFlags::RENDERING).unwrap();
println!("{:?}", bo);

Running this code snippet also fails, with this error here: src/gbm_drv_common.c:131: GBM-DRV error (get_bytes_per_component): Unknown or not supported format: 808669784

Changing the format from XRGB2101010 to XBGR2101010, works just fine BufferObject { ptr: 0x60858fd18eb0, device: 0x7ffcfe085c70, width: 2560, height: 1440, offsets: [0, 0, 0, 0], stride: 10240, format: Some(DrmFourcc(XB30)), modifier: Some(Unrecognized(216172782120099860)) }.

I don't exactly know what this means for aquamarine, if a big portion has to be changed to get this to work again or not, but if this really is the issue then that's already a big step forward.

ARGB2101010, ABGR2101010, RGBA1010102 and BGRA1010102 also create a buffer successfully

PancakeTAS commented 3 weeks ago

I changed aquamarines default go-to format to BGR

diff --git a/src/allocator/GBM.cpp b/src/allocator/GBM.cpp
index 252ba97..6aa9e68 100644
--- a/src/allocator/GBM.cpp
+++ b/src/allocator/GBM.cpp
@@ -25,7 +25,7 @@ static SDRMFormat guessFormatFrom(std::vector<SDRMFormat> formats, bool cursor)
         if (auto it = std::find_if(formats.begin(), formats.end(), [](const auto& f) { return f.drmFormat == DRM_FORMAT_ARGB2101010; }); it != formats.end())
             return *it;

-        if (auto it = std::find_if(formats.begin(), formats.end(), [](const auto& f) { return f.drmFormat == DRM_FORMAT_XRGB2101010; }); it != formats.end())
+        if (auto it = std::find_if(formats.begin(), formats.end(), [](const auto& f) { return f.drmFormat == DRM_FORMAT_XBGR2101010; }); it != formats.end())
             return *it;
     }

And shuffled the order of this array in Hyprland

diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index c2ecbbf3..ad7e9f2b 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -2138,7 +2138,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
     // clang-format off
     static const std::array<std::vector<std::pair<std::string, uint32_t>>, 2> formats{
         std::vector<std::pair<std::string, uint32_t>>{ /* 10-bit */
-            {"DRM_FORMAT_XRGB2101010", DRM_FORMAT_XRGB2101010}, {"DRM_FORMAT_XBGR2101010", DRM_FORMAT_XBGR2101010}, {"DRM_FORMAT_XRGB8888", DRM_FORMAT_XRGB8888}, {"DRM_FORMAT_XBGR8888", DRM_FORMAT_XBGR8888}, {"DRM_FORMAT_INVALID", DRM_FORMAT_INVALID}
+            {"DRM_FORMAT_XBGR2101010", DRM_FORMAT_XBGR2101010}, {"DRM_FORMAT_XRGB2101010", DRM_FORMAT_XRGB2101010}, {"DRM_FORMAT_XRGB8888", DRM_FORMAT_XRGB8888}, {"DRM_FORMAT_XBGR8888", DRM_FORMAT_XBGR8888}, {"DRM_FORMAT_INVALID", DRM_FORMAT_INVALID}
         },
         std::vector<std::pair<std::string, uint32_t>>{ /* 8-bit */
             {"DRM_FORMAT_XRGB8888", DRM_FORMAT_XRGB8888}, {"DRM_FORMAT_XBGR8888", DRM_FORMAT_XBGR8888}, {"DRM_FORMAT_INVALID", DRM_FORMAT_INVALID}

Doing that makes my monitor show signs of life again and hyprctl reports XBGR2101010 for A and H (which I presume is aquamarine and Hyprland?).

Definitely not a permanent fix.. but it works for me and I guess that's better than a broken monitor for the time being

vaxerski commented 3 weeks ago

I'd say what we need to look into is why test passes on XR30 if the swapchain fails to alloc buffers?

vaxerski commented 3 weeks ago

patch.txt try this aquamarine patch pls

vaxerski commented 3 weeks ago

I've committed it anyways with another patch, please check now on aq-git

aayushsenapati commented 3 weeks ago

this commit fixed the "eternal monitor is detected,but if my laptop suspends/I disconnect and reconnect the monitor,it does not work but it does show up on hyprctl monitors" but now I can't screenshare on 10bit monitors

vaxerski commented 3 weeks ago

can you screenshare on 8 bit ones? also can grim screenshot 10b monitors?

PancakeTAS commented 3 weeks ago

The patch does indeed work for me as well. grim cannot screenshot 10-bit monitors for whatever reason, but an OBS PipeWire capture as well as my own capture program both work just fine (it even captures in 10-bit rather than copying to an 8-bit texture!).

I also ran a quick check, while feh doesn't seem to like 10-bit textures, a 10-bit gradient video with mpv plays in perfect 10-bit color.

I would say issue closed but I'll wait for a final confirmation from other users (regarding the laptop suspend thingy)

vaxerski commented 3 weeks ago

can you post output of grim when it fails?

PancakeTAS commented 3 weeks ago

grim doesn't "fail", it just copies a black texture, so there's no output either.. 10-bit support is an open issue on their github (though they moved to another host now)

vaxerski commented 3 weeks ago

it should still work, or at least it used to...

aayushsenapati commented 3 weeks ago

Ya I'm able to screenshare on the 8 bit ones

PancakeTAS commented 3 weeks ago

I believe the pipewire backend or the portal is actually at fault here, as my own ZwlrScreencopyManager/FrameV1 client works just fine (see ambient-led on branch "rustify") and creates a 10-bit capture.

I am able to create a PipeWire capture in OBS, however it's really weirdly translated to 8-bit even on my 10-bit monitor, as switching OBS to a 10-bit color format results in.. really odd much whiter screen??

Screensharing in discord doesn't work on 10-bit monitors, though I don't know if this is related to the actual capturing.

About grim... no clue, it never worked for me ever

gnusenpai commented 3 weeks ago

@PancakeTAS

mpv plays in perfect 10-bit color

Can you give some detail on how to test? I tried with a random "10-bit" test video, but mpv still thinks the display is 8-bit.

gnusenpai commented 3 weeks ago

I get a crash whenever 10-bit is enabled and I switch TTYs. Sometimes it seems to take the whole driver with it.

hyprlandCrashReport15156.txt.gz hyprland.log.gz

PancakeTAS commented 3 weeks ago

Can you give some detail on how to test? I tried with a random "10-bit" test video, but mpv still thinks the display is 8-bit.

I simply watched mpv gradient_3840-2160_0-100_gbrp10le_x265.mp4 from https://github.com/jursonovicst/gradient and confirmed it was 10-bit

gnusenpai commented 3 weeks ago

Got the same results with that video. mpv -v ... shows:

[vo/gpu] Reported display depth: 8
[vo/gpu] Dither to 8.

The tricky thing is if you do nothing, it looks like 10-bit is working, but it's actually just dithering to 8-bit unless you use --dither-depth=no, which then shows color banding.

PancakeTAS commented 3 weeks ago

Indeed you're right. I did not even realize there even was dithering (impressive on it's own)

PancakeTAS commented 2 weeks ago

I did some more tests.. not very scientific, but oh well: I ran ffplay -enable_vulkan and it seemed to create a 10-bit surface, as the test video once again looked correct, I don't know believe ffplay does dithering by itself but I may be wrong. I cloned a random GLFW + Vulkan hello world I wrote a year ago and dumped all the available surface formats, which resulted in only 2 8-bit surfaces being available. Then I rewrote it in c and now it supported a 16-bit texture and 2 10-bit texture formats (??) Something is definitely wrong, but I don't believe it's the fault of Hyprland?

PancakeTAS commented 2 weeks ago

About grim not being able to copy 10-bit monitors. It works via DMABUF but not SHM.. because https://github.com/hyprwm/Hyprland/blob/f634b9e61af7dae0ca70379bd207eea45bb417d1/src/protocols/Screencopy.cpp#L241

I assume this line was added due to the surprising lack of RGB 10-bit formats (there seem to be only BGR 10-bit on nvidia, which is weird). Simply removing this however makes 10-bit screenshots work just fine

vaxerski commented 2 weeks ago

it was a wlroots remnant, I can remove it, yeah, thanks

vaxerski commented 2 weeks ago

done

gnusenpai commented 2 weeks ago

I don't know believe ffplay does dithering by itself but I may be wrong

When using vulkan, it does do dithering by default. I couldn't find a way to disable it though...

PancakeTAS commented 2 weeks ago

Argh so annoying, indeed the trace log says this (see at the bottom):

fplay version n7.0.2 Copyright (c) 2003-2024 the FFmpeg developers
  built with gcc 14.2.1 (GCC) 20240805
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-frei0r --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libdav1d --enable-libdrm --enable-libdvdnav --enable-libdvdread --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libharfbuzz --enable-libiec61883 --enable-libjack --enable-libjxl --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libplacebo --enable-libpulse --enable-librav1e --enable-librsvg --enable-librubberband --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpl --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-opencl --enable-opengl --enable-shared --enable-vapoursynth --enable-version3 --enable-vulkan
  libavutil      59.  8.100 / 59.  8.100
  libavcodec     61.  3.100 / 61.  3.100
  libavformat    61.  1.100 / 61.  1.100
  libavdevice    61.  1.100 / 61.  1.100
  libavfilter    10.  1.100 / 10.  1.100
  libswscale      8.  1.100 /  8.  1.100
  libswresample   5.  1.100 /  5.  1.100
  libpostproc    58.  1.100 / 58.  1.100
[Vulkan Renderer @ 0x5966e7b34300] Initialized libplacebo v7.349.0 (API v349)
[AVHWDeviceContext @ 0x5966e7c34640] device extension "VK_EXT_hdr_metadata" not found, excluding.
[AVHWDeviceContext @ 0x5966e7c34640] device extension "VK_KHR_portability_subset" not found, excluding.
[Vulkan Renderer @ 0x5966e7b34300] Imported vulkan device properties:
[Vulkan Renderer @ 0x5966e7b34300]     Device Name: NVIDIA GeForce RTX 3080
[Vulkan Renderer @ 0x5966e7b34300]     Device ID: 10de:2216
[Vulkan Renderer @ 0x5966e7b34300]     Device UUID: FC:AB:A7:0E:F0:33:5C:FE:D2:68:34:82:36:99:03:52
[Vulkan Renderer @ 0x5966e7b34300]     Driver version: 8ace8080
[Vulkan Renderer @ 0x5966e7b34300]     API version: 1.3.278
[Vulkan Renderer @ 0x5966e7b34300] Memory heaps supported by device:
[Vulkan Renderer @ 0x5966e7b34300]     0: flags 0x1 size   10G
[Vulkan Renderer @ 0x5966e7b34300]     1: flags 0x0 size   23G
[Vulkan Renderer @ 0x5966e7b34300] Memory summary:     0 used     0 res     0 alloc, efficiency 100.00%, utilization 100.00%, max page:  640M
[Vulkan Renderer @ 0x5966e7b34300] shaderc SPIR-V version 1.6 rev 1
[Vulkan Renderer @ 0x5966e7b34300] Initialized SPIR-V compiler 'shaderc'
[Vulkan Renderer @ 0x5966e7b34300] GPU information:
[Vulkan Renderer @ 0x5966e7b34300]     GLSL version: 450 (vulkan)
[Vulkan Renderer @ 0x5966e7b34300]       max_shmem_size:            49152
[Vulkan Renderer @ 0x5966e7b34300]       max_group_threads:         1024
[Vulkan Renderer @ 0x5966e7b34300]       max_group_size[0]:         1024
[Vulkan Renderer @ 0x5966e7b34300]       max_group_size[1]:         1024
[Vulkan Renderer @ 0x5966e7b34300]       max_group_size[2]:         64
[Vulkan Renderer @ 0x5966e7b34300]       subgroup_size:             32
[Vulkan Renderer @ 0x5966e7b34300]       min_gather_offset:         -32
[Vulkan Renderer @ 0x5966e7b34300]       max_gather_offset:         31
[Vulkan Renderer @ 0x5966e7b34300]     Limits:
[Vulkan Renderer @ 0x5966e7b34300]       thread_safe:               1
[Vulkan Renderer @ 0x5966e7b34300]       callbacks:                 1
[Vulkan Renderer @ 0x5966e7b34300]       max_buf_size:              25165138944
[Vulkan Renderer @ 0x5966e7b34300]       max_ubo_size:              65536
[Vulkan Renderer @ 0x5966e7b34300]       max_ssbo_size:             4294967295
[Vulkan Renderer @ 0x5966e7b34300]       max_vbo_size:              10737418240
[Vulkan Renderer @ 0x5966e7b34300]       max_mapped_size:           25165138944
[Vulkan Renderer @ 0x5966e7b34300]       max_buffer_texels:         134217728
[Vulkan Renderer @ 0x5966e7b34300]       align_host_ptr:            4096
[Vulkan Renderer @ 0x5966e7b34300]       host_cached:               1
[Vulkan Renderer @ 0x5966e7b34300]       max_tex_1d_dim:            32768
[Vulkan Renderer @ 0x5966e7b34300]       max_tex_2d_dim:            32768
[Vulkan Renderer @ 0x5966e7b34300]       max_tex_3d_dim:            16384
[Vulkan Renderer @ 0x5966e7b34300]       blittable_1d_3d:           1
[Vulkan Renderer @ 0x5966e7b34300]       buf_transfer:              1
[Vulkan Renderer @ 0x5966e7b34300]       align_tex_xfer_pitch:      1
[Vulkan Renderer @ 0x5966e7b34300]       align_tex_xfer_offset:     4
[Vulkan Renderer @ 0x5966e7b34300]       max_variable_comps:        0
[Vulkan Renderer @ 0x5966e7b34300]       max_constants:             18446744073709551615
[Vulkan Renderer @ 0x5966e7b34300]       max_pushc_size:            256
[Vulkan Renderer @ 0x5966e7b34300]       align_vertex_stride:       1
[Vulkan Renderer @ 0x5966e7b34300]       max_dispatch[0]:           2147483647
[Vulkan Renderer @ 0x5966e7b34300]       max_dispatch[1]:           65535
[Vulkan Renderer @ 0x5966e7b34300]       max_dispatch[2]:           65535
[Vulkan Renderer @ 0x5966e7b34300]       fragment_queues:           16
[Vulkan Renderer @ 0x5966e7b34300]       compute_queues:            8
[Vulkan Renderer @ 0x5966e7b34300]     External API interop:
[Vulkan Renderer @ 0x5966e7b34300]       UUID: FC:AB:A7:0E:F0:33:5C:FE:D2:68:34:82:36:99:03:52
[Vulkan Renderer @ 0x5966e7b34300]       PCI: 0000:0a:00:0
[Vulkan Renderer @ 0x5966e7b34300]       buf export caps: 0x19
[Vulkan Renderer @ 0x5966e7b34300]       buf import caps: 0x19
[Vulkan Renderer @ 0x5966e7b34300]       tex export caps: 0x19
[Vulkan Renderer @ 0x5966e7b34300]       tex import caps: 0x19
[Vulkan Renderer @ 0x5966e7b34300]       sync export caps: 0x1
[Vulkan Renderer @ 0x5966e7b34300]       sync import caps: 0x0
[Vulkan Renderer @ 0x5966e7b34300] Available surface configurations:
[Vulkan Renderer @ 0x5966e7b34300]     0: VK_FORMAT_B8G8R8A8_UNORM                 VK_COLOR_SPACE_SRGB_NONLINEAR_KHR
[Vulkan Renderer @ 0x5966e7b34300]     1: VK_FORMAT_B8G8R8A8_SRGB                  VK_COLOR_SPACE_SRGB_NONLINEAR_KHR
[Vulkan Renderer @ 0x5966e7b34300] Picked surface configuration 0: VK_FORMAT_B8G8R8A8_UNORM + VK_COLOR_SPACE_SRGB_NONLINEAR_KHR
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'gradient_3840-2160_0-50_gbrp10le_x265.mp4':

So the surface configuration is not supported. But why would this be the case?

MCPO-Spartan-117 commented 2 weeks ago

It is only seeing two formats because it is using X11, if using Wayland it'll dither to 10-bit, this shouldn't affect 10-bit formats but i don't know how dithering works.

Mpv supports 10-bit but only through -vo dmabuf-wayland --hwdec=vaapi and -vo drm --drm-format=xrgb/xbgr2101010, both don't work on Nvidia.

PancakeTAS commented 2 weeks ago

-vo drm is not really meant to be used anyways.. -vo wlshm also dithers

PancakeTAS commented 2 weeks ago

It is only seeing two formats because it is using X11, if using Wayland it'll dither to 10-bit, this shouldn't affect 10-bit formats but i don't know how dithering works.

Oh good point I did not think about that! DISPLAY= ffplay -enable_vulkan will actually display and use a 10-bit surface.

[Vulkan Renderer @ 0x5e6637fbb900] Available surface configurations:
[Vulkan Renderer @ 0x5e6637fbb900]     0: VK_FORMAT_R8G8B8A8_SRGB                  VK_COLOR_SPACE_SRGB_NONLINEAR_KHR
[Vulkan Renderer @ 0x5e6637fbb900]     1: VK_FORMAT_R8G8B8A8_UNORM                 VK_COLOR_SPACE_SRGB_NONLINEAR_KHR
[Vulkan Renderer @ 0x5e6637fbb900]     2: VK_FORMAT_R16G16B16A16_SFLOAT            VK_COLOR_SPACE_SRGB_NONLINEAR_KHR
[Vulkan Renderer @ 0x5e6637fbb900]     3: VK_FORMAT_B8G8R8A8_SRGB                  VK_COLOR_SPACE_SRGB_NONLINEAR_KHR
[Vulkan Renderer @ 0x5e6637fbb900]     4: VK_FORMAT_B8G8R8A8_UNORM                 VK_COLOR_SPACE_SRGB_NONLINEAR_KHR
[Vulkan Renderer @ 0x5e6637fbb900]     5: VK_FORMAT_A2R10G10B10_UNORM_PACK32       VK_COLOR_SPACE_SRGB_NONLINEAR_KHR
[Vulkan Renderer @ 0x5e6637fbb900]     6: VK_FORMAT_A2B10G10R10_UNORM_PACK32       VK_COLOR_SPACE_SRGB_NONLINEAR_KHR
[Vulkan Renderer @ 0x5e6637fbb900] Picked surface configuration 5: VK_FORMAT_A2R10G10B10_UNORM_PACK32 + VK_COLOR_SPACE_SRGB_NONLINEAR_KHR

It also prints [Vulkan Renderer @ 0x5edeb2e086c0] Dithering to 10 bit depth, which is nice.

However... the gradients are still 8-bit. What the heck could this mean..

gnusenpai commented 2 weeks ago

It also prints [Vulkan Renderer @ 0x5edeb2e086c0] Dithering to 10 bit depth, which is nice.

However... the gradients are still 8-bit. What the heck could this mean..

Yeah, I noticed the same. I tried in gamescope to test if 10-bit even works at all and the gradients were smooth there. But, because it's still "dithering to 10 bit depth" I can't say for sure if it's actually working.

MCPO-Spartan-117 commented 2 weeks ago

Can't say Mpv actually works either, honestly looks more like 6-bit without dithering in both dmabuf-wayland and drm.

MCPO-Spartan-117 commented 2 weeks ago

ffplay does actually seem to work, in gamescope i can't really see the lines that i could in Hyprland, hardly can even see the actual 10-bits line, tested side by side with gamescope in embedded switching with the DRM mode the same(going from gamescope to hyprland causes a modesetting event despite the same modesetting, please fix this), i've compiled custom test videos to make 100% sure that there was no artifacts or anything from the video resolution itself.

I don't get the dithering message, might be because the surface configuration is different, VK_FORMAT_R16G16B16A16_UNORM which Nvidia doesn't have instead of VK_FORMAT_A2R10G10B10_UNORM_PACK32, Nvidia doesn't have VK_FORMAT_R5G6B5_UNORM_PACK16 either.

vaxerski commented 2 weeks ago

going from gamescope to hyprland causes a modesetting event despite the same modesetting, please fix this

you sound pretty involved for something so minor as 2s of blackness when changing tty

MCPO-Spartan-117 commented 2 weeks ago

I did not intend for it to convey any emotion, i simply wanted to highlight it incase someone skimmed through it.

In most cases it is a non-issue especially if you don't use TTYs very often(i do for gamescope alot, normal TTYs can also benefit if same modesetting), though minorly annoying for this test.

For this it'd help to visualize the difference between Hyprland and Gamescope, Gamescope is doing its half which helped, i am not sure if you have to do this in the backend(wlroots and aquamarine) or the compositor.

PancakeTAS commented 2 weeks ago

Is there any step in the rendering process where the texture could accidentally be copied to an 8-bit texture and then dithered by OpenGL/Vulkan? Because we've confirmed that applications are able to render to a 10-bit texture.. but from my testing this 10-bit texture is only actually rendered in 8-bit, sometimes dithered and sometimes just not dithered. It would be really nice to have a test application for this.. something like a Vulkan triangle except a modified shader to make it a gradient

PancakeTAS commented 2 weeks ago

Modified the vulkan tutorial triangle: https://gist.github.com/PancakeTAS/43b9fd6d8cabbd80f9d83a5d34c95fc8 glslc shaders/vert.vert -o shaders/vert.spv glslc shaders/frag.frag -o shaders/frag.spv g++ -lglfw -lvulkan main.cpp && DISPLAY= ./a.out

I don't know anymore, ctrl+f for "change" to quickly change the two spots I changed to making 10-bit color work..

It doesn't make any sense, but the moment I enable 10-bit in my code, the entire application just turns.. darker? It looks like it's darker but still has the same amount of red shades, but I can't tell without a proper comparison.

(screenshots are not 10b) image image

MCPO-Spartan-117 commented 2 weeks ago

Hyprland isn't properly outputting in 10-bit, Gamescope always picks a 10-bit output if it can even without --hdr-enabled and ffplay definitely doesn't dither on the 16-bit formats.

Grab this script from the the gradient github https://github.com/jursonovicst/gradient/blob/master/prepareraw.sh

Make it to whatever your screen resolution is and set the gradient range to 9-10, if it isn't dithering 8-bit and 10-bit gradients are going to mismatch. the 10-bit gradient will have a bright section on the far right with the middle mismatching which makes 10-bit look like it has been shifted to the right.

You can get gamescope, start it in a TTY with a terminal(pray to god it doesn't get your framebuffer for your Xwayland on Nvidia) to start ffplay and you can see it is working properly there.

EDIT: for some reason the scratchpad greatly exaggerates this effect, making it more obvious than normal.

MCPO-Spartan-117 commented 2 weeks ago

Top is Gamescope, bottom is Hyprland, taken with gamescopectl screenshot and grimblast. gamescope hyprland

EDIT: I'm not actually sure what went wrong here, i think i may have somehow started a 8-bit instance in gamescope and forgot???, it is dimmed in half in both 10 and 16-bit formats so it is the application's fault there, Gamescope Xwayland there is no banding and WSI says all the correct formats, couldn't test Wayland because it just wouldn't show a window at all.