streetpea / chiaki-ng

Next-Generation of Chiaki (the open-source remote play client for PlayStation)
https://streetpea.github.io/chiaki-ng/
GNU Affero General Public License v3.0
1.05k stars 66 forks source link

[Feature Request] Support HDR for Windows and MacOS #393

Open cgarst opened 4 weeks ago

cgarst commented 4 weeks ago

Describe the bug When switching to "H265 HDR (PS5 only)" on a Windows machine with HDR display, the stream opens with a black display. Uncertain from documentation is HDR is intended for Windows or only Steam Deck.

Debug Log chiaki_session_2024-08-19_02-20-49-553553 - Copy.log

To Reproduce Steps to reproduce the behavior:

  1. Switch codec to "H265 HDR (PS5 only)" on an HDR Windows system
  2. Connect to PS5
  3. Observe black video

Expected behavior An HDR stream appears similarly to the official remote play app

Screenshots

000000

Desktop (please complete the following information):

Additional context HDR is working in official remote play app on same device.

jbaiter commented 4 weeks ago

HDR is currently only supported and tested on SteamOS (and maybe with some hackery, other Linux systems). There's nothing that prevents Windows or MacOS support, is just that nobody has yet done the work required to get it running.

cgarst commented 4 weeks ago

Makes sense. A documentation opportunity also exists for things like this.

The github.io doc site could benefit from a having a features page with a table indicating what chiaki-ng's features are, and which platforms each is supported on. The fork has been built up so much at this point (hooray!) that the advantages and use cases can be confusing for new users.

If there is appetite for this doc I could put something together and PR.

streetpea commented 4 weeks ago

@cgarst theoretically libplacebo supports HDR on Windows as mpv has hdr in Windows using libplacebo. However, it was just never tested on our end and there is likely some configuration that needs to be done, etc. to get it working. I'll try with my Windows PC connected to an HDR monitor and get back to you. As for the other features, they should pretty much all be cross-platform.

streetpea commented 2 weeks ago

For MacOS it correctly works but it crashes when the application is closed when HDR is selected. Tested on m1 MacBook Pro with internal hdr screen

streetpea commented 2 weeks ago

@nowrep i noticed it crashes even when not connected to an hdr monitor if H265 HDR is selected as the codec and streaming begins. Once you quit the stream and try to close the app the app crashes. Could you look at this since I remember you had a Mac system?

nowrep commented 2 weeks ago

I don't have a mac to easily test this, sorry. I suggest posting here the crash log from macos. And maybe also using debug build.

streetpea commented 2 weeks ago

@nowrep here is the bt from the crash when using HDR. I also attached the log from the crash using H265 HDR as the codec crash-h265-hdr.log as well as a log from a non-crash close using H265 as the codec non-crash-h265-sdr.log

(lldb) bt
* thread #17, name = 'render', stop reason = EXC_BAD_ACCESS (code=1, address=0x3eadde7804a0)
  * frame #0: 0x00007ff813011e2f libobjc.A.dylib`objc_release + 31
    frame #1: 0x00007ff813015dea libobjc.A.dylib`AutoreleasePoolPage::releaseUntil(objc_object**) + 164
    frame #2: 0x00007ff813012d6f libobjc.A.dylib`objc_autoreleasePoolPop + 168
    frame #3: 0x00007ff813019e61 libobjc.A.dylib`AutoreleasePoolPage::tls_dealloc(void*) + 91
    frame #4: 0x00007ff81317a567 libsystem_pthread.dylib`_pthread_tsd_cleanup + 487
    frame #5: 0x00007ff81317cb89 libsystem_pthread.dylib`_pthread_exit + 70
    frame #6: 0x00007ff81317c4ec libsystem_pthread.dylib`_pthread_start + 136
    frame #7: 0x00007ff813177f6b libsystem_pthread.dylib`thread_start + 15

also here is a bt of all threads

(lldb) bt all
  thread #1, queue = 'com.apple.main-thread'
    frame #0: 0x000000010521506b QtQml`QQmlData::disconnectNotifiers(QQmlData::DeleteNotifyList) + 261
    frame #1: 0x00000001052144ec QtQml`QQmlData::markAsDeleted(QObject*) + 140
    frame #2: 0x0000000104b9c1d0 QtQuick`QQmlPrivate::QQmlElement<QQuickItem>::~QQmlElement() + 14
    frame #3: 0x000000010010a77a chiaki`QmlMainWindow::~QmlMainWindow(this=0x00007ff7bfefe240) at qmlmainwindow.cpp:120:5
    frame #4: 0x000000010010ad45 chiaki`QmlMainWindow::~QmlMainWindow(this=0x00007ff7bfefe240) at qmlmainwindow.cpp:112:1
    frame #5: 0x0000000100038dfe chiaki`RunMain(app=0x00007ff7bfeff5f0, settings=0x00007ff7bfefefd0) at main.cpp:287:1
    frame #6: 0x0000000100037bd8 chiaki`real_main(argc=1, argv=0x00007ff7bfeff808) at main.cpp:158:10
    frame #7: 0x00000001000367a2 chiaki`main(argc=1, argv=0x00007ff7bfeff808) at main.cpp:4:43
    frame #8: 0x0000000100a3152e dyld`start + 462
  thread #2
    frame #0: 0x00007ff81314101a libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x00007ff813179034 libsystem_pthread.dylib`_pthread_wqthread + 426
    frame #2: 0x00007ff813177f57 libsystem_pthread.dylib`start_wqthread + 15
  thread #3
    frame #0: 0x00007ff81314101a libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x00007ff813179034 libsystem_pthread.dylib`_pthread_wqthread + 426
    frame #2: 0x00007ff813177f57 libsystem_pthread.dylib`start_wqthread + 15
  thread #5, name = 'AMCP Logging Spool'
    frame #0: 0x00007ff81313f976 libsystem_kernel.dylib`semaphore_wait_trap + 10
    frame #1: 0x00007ff81bc802e6 caulk`caulk::mach::semaphore::wait_or_error() + 16
    frame #2: 0x00007ff81bc68148 caulk`caulk::concurrent::details::worker_thread::run() + 36
    frame #3: 0x00007ff81bc67e0c caulk`void* caulk::thread_proxy<std::__1::tuple<caulk::thread::attributes, void (caulk::concurrent::details::worker_thread::*)(), std::__1::tuple<caulk::concurrent::details::worker_thread*> > >(void*) + 41
    frame #4: 0x00007ff81317c4e1 libsystem_pthread.dylib`_pthread_start + 125
    frame #5: 0x00007ff813177f6b libsystem_pthread.dylib`thread_start + 15
  thread #8, name = 'QQmlThread'
    frame #0: 0x00007ff81314606a libsystem_kernel.dylib`poll + 10
    frame #1: 0x000000010578c3c2 QtCore`qt_safe_poll(pollfd*, unsigned int, timespec const*) + 567
    frame #2: 0x000000010578d2fd QtCore`QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 635
    frame #3: 0x0000000105662c2d QtCore`QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 367
    frame #4: 0x000000010570a32e QtCore`QThread::exec() + 160
    frame #5: 0x0000000105791216 QtCore`QThreadPrivate::start(void*) + 328
    frame #6: 0x00007ff81317c4e1 libsystem_pthread.dylib`_pthread_start + 125
    frame #7: 0x00007ff813177f6b libsystem_pthread.dylib`thread_start + 15
  thread #9, name = 'frame'
    frame #0: 0x00007ff81314606a libsystem_kernel.dylib`poll + 10
    frame #1: 0x000000010578c3c2 QtCore`qt_safe_poll(pollfd*, unsigned int, timespec const*) + 567
    frame #2: 0x000000010578d2fd QtCore`QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 635
    frame #3: 0x0000000105662c2d QtCore`QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 367
    frame #4: 0x000000010570a32e QtCore`QThread::exec() + 160
    frame #5: 0x0000000105791216 QtCore`QThreadPrivate::start(void*) + 328
    frame #6: 0x00007ff81317c4e1 libsystem_pthread.dylib`_pthread_start + 125
    frame #7: 0x00007ff813177f6b libsystem_pthread.dylib`thread_start + 15
  thread #10, name = 'QThread'
    frame #0: 0x00007ff81314606a libsystem_kernel.dylib`poll + 10
    frame #1: 0x000000010578c3c2 QtCore`qt_safe_poll(pollfd*, unsigned int, timespec const*) + 567
    frame #2: 0x000000010578d2fd QtCore`QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 635
    frame #3: 0x0000000105662c2d QtCore`QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 367
    frame #4: 0x000000010570a32e QtCore`QThread::exec() + 160
    frame #5: 0x0000000105791216 QtCore`QThreadPrivate::start(void*) + 328
    frame #6: 0x00007ff81317c4e1 libsystem_pthread.dylib`_pthread_start + 125
    frame #7: 0x00007ff813177f6b libsystem_pthread.dylib`thread_start + 15
  thread #12
    frame #0: 0x00007ff8131423aa libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x00007ff81317caa4 libsystem_pthread.dylib`_pthread_cond_wait + 1302
    frame #2: 0x0000000100172f50 chiaki`chiaki_cond_timedwait(cond=0x000000010e92a9b0, mutex=0x000000010e92a9e0, timeout_ms=500) at thread.c:294:10
    frame #3: 0x000000010017305b chiaki`chiaki_cond_timedwait_pred(cond=0x000000010e92a9b0, mutex=0x000000010e92a9e0, timeout_ms=500, check_pred=(chiaki`bool_pred_cond_check_pred at thread.c:413), check_pred_user=0x000000010e92a9b0) at thread.c:332:25
    frame #4: 0x00000001001732e0 chiaki`chiaki_bool_pred_cond_timedwait(cond=0x000000010e92a9b0, timeout_ms=500) at thread.c:425:9
    frame #5: 0x000000010018c6c2 chiaki`discovery_service_thread_func(user=0x000000010e92a868) at discoveryservice.c:157:9
    frame #6: 0x00007ff81317c4e1 libsystem_pthread.dylib`_pthread_start + 125
    frame #7: 0x00007ff813177f6b libsystem_pthread.dylib`thread_start + 15
  thread #14
    frame #0: 0x00007ff813147d1a libsystem_kernel.dylib`__select + 10
    frame #1: 0x000000010018b09b chiaki`chiaki_stop_pipe_select_single(stop_pipe=0x000070000524ff78, fd=13, write=false, timeout_ms=18446744073709551615) at stoppipe.c:153:7
    frame #2: 0x0000000100189ff2 chiaki`discovery_thread_func(user=0x000070000524ff68) at discovery.c:326:25
    frame #3: 0x00007ff81317c4e1 libsystem_pthread.dylib`_pthread_start + 125
    frame #4: 0x00007ff813177f6b libsystem_pthread.dylib`thread_start + 15
  thread #15, name = 'QDBusConnectionManager'
    frame #0: 0x00007ff81314606a libsystem_kernel.dylib`poll + 10
    frame #1: 0x000000010578c3c2 QtCore`qt_safe_poll(pollfd*, unsigned int, timespec const*) + 567
    frame #2: 0x000000010578d2fd QtCore`QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 635
    frame #3: 0x0000000105662c2d QtCore`QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 367
    frame #4: 0x000000010570a32e QtCore`QThread::exec() + 160
    frame #5: 0x0000000101f158dc QtDBus`QDBusConnectionManager::run() + 22
    frame #6: 0x0000000105791216 QtCore`QThreadPrivate::start(void*) + 328
    frame #7: 0x00007ff81317c4e1 libsystem_pthread.dylib`_pthread_start + 125
    frame #8: 0x00007ff813177f6b libsystem_pthread.dylib`thread_start + 15
* thread #17, name = 'render', stop reason = EXC_BAD_ACCESS (code=1, address=0x3eadde8ee6e0)
  * frame #0: 0x00007ff813011e2f libobjc.A.dylib`objc_release + 31
    frame #1: 0x00007ff813015dea libobjc.A.dylib`AutoreleasePoolPage::releaseUntil(objc_object**) + 164
    frame #2: 0x00007ff813012d6f libobjc.A.dylib`objc_autoreleasePoolPop + 168
    frame #3: 0x00007ff813019e61 libobjc.A.dylib`AutoreleasePoolPage::tls_dealloc(void*) + 91
    frame #4: 0x00007ff81317a567 libsystem_pthread.dylib`_pthread_tsd_cleanup + 487
    frame #5: 0x00007ff81317cb89 libsystem_pthread.dylib`_pthread_exit + 70
    frame #6: 0x00007ff81317c4ec libsystem_pthread.dylib`_pthread_start + 136
    frame #7: 0x00007ff813177f6b libsystem_pthread.dylib`thread_start + 15
  thread #18, name = 'Thread (pooled)'
    frame #0: 0x00007ff8131423aa libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x00007ff81317ca6f libsystem_pthread.dylib`_pthread_cond_wait + 1249
    frame #2: 0x0000000105798b1e QtCore`QWaitConditionPrivate::wait_relative(QDeadlineTimer) + 148
    frame #3: 0x0000000105798893 QtCore`QWaitConditionPrivate::wait(QDeadlineTimer) + 69
    frame #4: 0x00000001057987fc QtCore`QWaitCondition::wait(QMutex*, QDeadlineTimer) + 84
    frame #5: 0x0000000105793b88 QtCore`QThreadPoolThread::run() + 586
    frame #6: 0x0000000105791216 QtCore`QThreadPrivate::start(void*) + 328
    frame #7: 0x00007ff81317c4e1 libsystem_pthread.dylib`_pthread_start + 125
    frame #8: 0x00007ff813177f6b libsystem_pthread.dylib`thread_start + 15
  thread #21, name = 'Thread (pooled)'
    frame #0: 0x00007ff8131423aa libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x00007ff81317ca6f libsystem_pthread.dylib`_pthread_cond_wait + 1249
    frame #2: 0x0000000105798b1e QtCore`QWaitConditionPrivate::wait_relative(QDeadlineTimer) + 148
    frame #3: 0x0000000105798893 QtCore`QWaitConditionPrivate::wait(QDeadlineTimer) + 69
    frame #4: 0x00000001057987fc QtCore`QWaitCondition::wait(QMutex*, QDeadlineTimer) + 84
    frame #5: 0x0000000105793b88 QtCore`QThreadPoolThread::run() + 586
    frame #6: 0x0000000105791216 QtCore`QThreadPrivate::start(void*) + 328
    frame #7: 0x00007ff81317c4e1 libsystem_pthread.dylib`_pthread_start + 125
    frame #8: 0x00007ff813177f6b libsystem_pthread.dylib`thread_start + 15
  thread #24, name = 'Thread (pooled)'
    frame #0: 0x00007ff8131423aa libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x00007ff81317ca6f libsystem_pthread.dylib`_pthread_cond_wait + 1249
    frame #2: 0x0000000105798b1e QtCore`QWaitConditionPrivate::wait_relative(QDeadlineTimer) + 148
    frame #3: 0x0000000105798893 QtCore`QWaitConditionPrivate::wait(QDeadlineTimer) + 69
    frame #4: 0x00000001057987fc QtCore`QWaitCondition::wait(QMutex*, QDeadlineTimer) + 84
    frame #5: 0x0000000105793b88 QtCore`QThreadPoolThread::run() + 586
    frame #6: 0x0000000105791216 QtCore`QThreadPrivate::start(void*) + 328
    frame #7: 0x00007ff81317c4e1 libsystem_pthread.dylib`_pthread_start + 125
    frame #8: 0x00007ff813177f6b libsystem_pthread.dylib`thread_start + 15
  thread #28, name = 'com.apple.NSEventThread'
    frame #0: 0x00007ff81313f93a libsystem_kernel.dylib`mach_msg_trap + 10
    frame #1: 0x00007ff81313fca8 libsystem_kernel.dylib`mach_msg + 56
    frame #2: 0x00007ff81324329d CoreFoundation`__CFRunLoopServiceMachPort + 319
    frame #3: 0x00007ff813241928 CoreFoundation`__CFRunLoopRun + 1276
    frame #4: 0x00007ff813240d6c CoreFoundation`CFRunLoopRunSpecific + 562
    frame #5: 0x00007ff815ded572 AppKit`_NSEventThread + 132
    frame #6: 0x00007ff81317c4e1 libsystem_pthread.dylib`_pthread_start + 125
    frame #7: 0x00007ff813177f6b libsystem_pthread.dylib`thread_start + 15
  thread #30
    frame #0: 0x00007ff813177f48 libsystem_pthread.dylib`start_wqthread
  thread #33
    frame #0: 0x00007ff813177f48 libsystem_pthread.dylib`start_wqthread
  thread #34, queue = 'NSCGSDisableUpdates'
    frame #0: 0x00007ff81313f98e libsystem_kernel.dylib`semaphore_timedwait_trap + 10
    frame #1: 0x00007ff812fc4848 libdispatch.dylib`_dispatch_sema4_timedwait + 72
    frame #2: 0x00007ff812fc4c75 libdispatch.dylib`_dispatch_semaphore_wait_slow + 58
    frame #3: 0x00007ff8181a9f1e SkyLight`CGSUpdateManager::enable_updates_common() + 1038
    frame #4: 0x00007ff8181aa96e SkyLight`SLSReenableUpdateTokenWithSeed + 130
    frame #5: 0x00007ff812fc30cc libdispatch.dylib`_dispatch_call_block_and_release + 12
    frame #6: 0x00007ff812fc4317 libdispatch.dylib`_dispatch_client_callout + 8
    frame #7: 0x00007ff812fca317 libdispatch.dylib`_dispatch_lane_serial_drain + 672
    frame #8: 0x00007ff812fcadfd libdispatch.dylib`_dispatch_lane_invoke + 366
    frame #9: 0x00007ff812fd4eee libdispatch.dylib`_dispatch_workloop_worker_thread + 753
    frame #10: 0x00007ff813178fd0 libsystem_pthread.dylib`_pthread_wqthread + 326
    frame #11: 0x00007ff813177f57 libsystem_pthread.dylib`start_wqthread + 15
  thread #35, queue = 'com.apple.SkyLight.UpdateManager.SerialSema'
    frame #0: 0x00007ff81313f976 libsystem_kernel.dylib`semaphore_wait_trap + 10
    frame #1: 0x00007ff8181aa12f SkyLight`invocation function for block in (anonymous namespace)::InterprocessSerialSemaphore::asyncWait(void (int) block_pointer) + 35
    frame #2: 0x00007ff812fc30cc libdispatch.dylib`_dispatch_call_block_and_release + 12
    frame #3: 0x00007ff812fc4317 libdispatch.dylib`_dispatch_client_callout + 8
    frame #4: 0x00007ff812fca317 libdispatch.dylib`_dispatch_lane_serial_drain + 672
    frame #5: 0x00007ff812fcadfd libdispatch.dylib`_dispatch_lane_invoke + 366
    frame #6: 0x00007ff812fd4eee libdispatch.dylib`_dispatch_workloop_worker_thread + 753
    frame #7: 0x00007ff813178fd0 libsystem_pthread.dylib`_pthread_wqthread + 326
    frame #8: 0x00007ff813177f57 libsystem_pthread.dylib`start_wqthread + 15
  thread #38
    frame #0: 0x00007ff813177f48 libsystem_pthread.dylib`start_wqthread
  thread #45
    frame #0: 0x00007ff81313f976 libsystem_kernel.dylib`semaphore_wait_trap + 10
    frame #1: 0x00007ff81bc802e6 caulk`caulk::mach::semaphore::wait_or_error() + 16
    frame #2: 0x00007ff81bc68148 caulk`caulk::concurrent::details::worker_thread::run() + 36
    frame #3: 0x00007ff81bc67e0c caulk`void* caulk::thread_proxy<std::__1::tuple<caulk::thread::attributes, void (caulk::concurrent::details::worker_thread::*)(), std::__1::tuple<caulk::concurrent::details::worker_thread*> > >(void*) + 41
    frame #4: 0x00007ff81317c4e1 libsystem_pthread.dylib`_pthread_start + 125
    frame #5: 0x00007ff813177f6b libsystem_pthread.dylib`thread_start + 15
  thread #49, name = 'com.apple.coremedia.rootQueue.47'
    frame #0: 0x00007ff81313f98e libsystem_kernel.dylib`semaphore_timedwait_trap + 10
    frame #1: 0x00007ff812fc4848 libdispatch.dylib`_dispatch_sema4_timedwait + 72
    frame #2: 0x00007ff812fc4c75 libdispatch.dylib`_dispatch_semaphore_wait_slow + 58
    frame #3: 0x00007ff812fd38ef libdispatch.dylib`_dispatch_worker_thread + 308
    frame #4: 0x00007ff81317c4e1 libsystem_pthread.dylib`_pthread_start + 125
    frame #5: 0x00007ff813177f6b libsystem_pthread.dylib`thread_start + 15
  thread #50
    frame #0: 0x00007ff81314101a libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x00007ff813179034 libsystem_pthread.dylib`_pthread_wqthread + 426
    frame #2: 0x00007ff813177f57 libsystem_pthread.dylib`start_wqthread + 15
  thread #51
    frame #0: 0x00007ff81314101a libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x00007ff813179034 libsystem_pthread.dylib`_pthread_wqthread + 426
    frame #2: 0x00007ff813177f57 libsystem_pthread.dylib`start_wqthread + 15
  thread #52
    frame #0: 0x00007ff81314101a libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x00007ff813179034 libsystem_pthread.dylib`_pthread_wqthread + 426
    frame #2: 0x00007ff813177f57 libsystem_pthread.dylib`start_wqthread + 15
  thread #53
    frame #0: 0x0000000000000000
  thread #54
    frame #0: 0x00007ff81314101a libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x00007ff813179034 libsystem_pthread.dylib`_pthread_wqthread + 426
    frame #2: 0x00007ff813177f57 libsystem_pthread.dylib`start_wqthread + 15
  thread #55
    frame #0: 0x00007ff81314101a libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x00007ff813179034 libsystem_pthread.dylib`_pthread_wqthread + 426
    frame #2: 0x00007ff813177f57 libsystem_pthread.dylib`start_wqthread + 15
  thread #56, name = 'Thread (pooled)'
    frame #0: 0x00007ff8131423aa libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x00007ff81317ca6f libsystem_pthread.dylib`_pthread_cond_wait + 1249
    frame #2: 0x0000000105798b1e QtCore`QWaitConditionPrivate::wait_relative(QDeadlineTimer) + 148
    frame #3: 0x0000000105798893 QtCore`QWaitConditionPrivate::wait(QDeadlineTimer) + 69
    frame #4: 0x00000001057987fc QtCore`QWaitCondition::wait(QMutex*, QDeadlineTimer) + 84
    frame #5: 0x0000000105793b88 QtCore`QThreadPoolThread::run() + 586
    frame #6: 0x0000000105791216 QtCore`QThreadPrivate::start(void*) + 328
    frame #7: 0x00007ff81317c4e1 libsystem_pthread.dylib`_pthread_start + 125
    frame #8: 0x00007ff813177f6b libsystem_pthread.dylib`thread_start + 15
  thread #57, name = 'Thread (pooled)'
    frame #0: 0x00007ff8131423aa libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x00007ff81317ca6f libsystem_pthread.dylib`_pthread_cond_wait + 1249
    frame #2: 0x0000000105798b1e QtCore`QWaitConditionPrivate::wait_relative(QDeadlineTimer) + 148
    frame #3: 0x0000000105798893 QtCore`QWaitConditionPrivate::wait(QDeadlineTimer) + 69
    frame #4: 0x00000001057987fc QtCore`QWaitCondition::wait(QMutex*, QDeadlineTimer) + 84
    frame #5: 0x0000000105793b88 QtCore`QThreadPoolThread::run() + 586
    frame #6: 0x0000000105791216 QtCore`QThreadPrivate::start(void*) + 328
    frame #7: 0x00007ff81317c4e1 libsystem_pthread.dylib`_pthread_start + 125
    frame #8: 0x00007ff813177f6b libsystem_pthread.dylib`thread_start + 15
  thread #58, name = 'Thread (pooled)'
    frame #0: 0x00007ff8131423aa libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x00007ff81317ca6f libsystem_pthread.dylib`_pthread_cond_wait + 1249
    frame #2: 0x0000000105798b1e QtCore`QWaitConditionPrivate::wait_relative(QDeadlineTimer) + 148
    frame #3: 0x0000000105798893 QtCore`QWaitConditionPrivate::wait(QDeadlineTimer) + 69
    frame #4: 0x00000001057987fc QtCore`QWaitCondition::wait(QMutex*, QDeadlineTimer) + 84
    frame #5: 0x0000000105793b88 QtCore`QThreadPoolThread::run() + 586
    frame #6: 0x0000000105791216 QtCore`QThreadPrivate::start(void*) + 328
    frame #7: 0x00007ff81317c4e1 libsystem_pthread.dylib`_pthread_start + 125
    frame #8: 0x00007ff813177f6b libsystem_pthread.dylib`thread_start + 15
  thread #59, name = 'Thread (pooled)'
    frame #0: 0x00007ff8131423aa libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x00007ff81317ca6f libsystem_pthread.dylib`_pthread_cond_wait + 1249
    frame #2: 0x0000000105798b1e QtCore`QWaitConditionPrivate::wait_relative(QDeadlineTimer) + 148
    frame #3: 0x0000000105798893 QtCore`QWaitConditionPrivate::wait(QDeadlineTimer) + 69
    frame #4: 0x00000001057987fc QtCore`QWaitCondition::wait(QMutex*, QDeadlineTimer) + 84
    frame #5: 0x0000000105793b88 QtCore`QThreadPoolThread::run() + 586
    frame #6: 0x0000000105791216 QtCore`QThreadPrivate::start(void*) + 328
    frame #7: 0x00007ff81317c4e1 libsystem_pthread.dylib`_pthread_start + 125
    frame #8: 0x00007ff813177f6b libsystem_pthread.dylib`thread_start + 15
  thread #60, name = 'Thread (pooled)'
    frame #0: 0x00007ff8131423aa libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x00007ff81317ca6f libsystem_pthread.dylib`_pthread_cond_wait + 1249
    frame #2: 0x0000000105798b1e QtCore`QWaitConditionPrivate::wait_relative(QDeadlineTimer) + 148
    frame #3: 0x0000000105798893 QtCore`QWaitConditionPrivate::wait(QDeadlineTimer) + 69
    frame #4: 0x00000001057987fc QtCore`QWaitCondition::wait(QMutex*, QDeadlineTimer) + 84
    frame #5: 0x0000000105793b88 QtCore`QThreadPoolThread::run() + 586
    frame #6: 0x0000000105791216 QtCore`QThreadPrivate::start(void*) + 328
    frame #7: 0x00007ff81317c4e1 libsystem_pthread.dylib`_pthread_start + 125
    frame #8: 0x00007ff813177f6b libsystem_pthread.dylib`thread_start + 15
  thread #61
    frame #0: 0x00007ff8131423aa libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x00007ff81317caa4 libsystem_pthread.dylib`_pthread_cond_wait + 1302
    frame #2: 0x0000000100172f50 chiaki`chiaki_cond_timedwait(cond=0x000000010e92a7f0, mutex=0x000000010e92a820, timeout_ms=500) at thread.c:294:10
    frame #3: 0x000000010017305b chiaki`chiaki_cond_timedwait_pred(cond=0x000000010e92a7f0, mutex=0x000000010e92a820, timeout_ms=500, check_pred=(chiaki`bool_pred_cond_check_pred at thread.c:413), check_pred_user=0x000000010e92a7f0) at thread.c:332:25
    frame #4: 0x00000001001732e0 chiaki`chiaki_bool_pred_cond_timedwait(cond=0x000000010e92a7f0, timeout_ms=500) at thread.c:425:9
    frame #5: 0x000000010018c6c2 chiaki`discovery_service_thread_func(user=0x000000010e92a6a8) at discoveryservice.c:157:9
    frame #6: 0x00007ff81317c4e1 libsystem_pthread.dylib`_pthread_start + 125
    frame #7: 0x00007ff813177f6b libsystem_pthread.dylib`thread_start + 15
  thread #62
    frame #0: 0x00007ff813147d1a libsystem_kernel.dylib`__select + 10
    frame #1: 0x000000010018b09b chiaki`chiaki_stop_pipe_select_single(stop_pipe=0x0000700005873f78, fd=36, write=false, timeout_ms=18446744073709551615) at stoppipe.c:153:7
    frame #2: 0x0000000100189ff2 chiaki`discovery_thread_func(user=0x0000700005873f68) at discovery.c:326:25
    frame #3: 0x00007ff81317c4e1 libsystem_pthread.dylib`_pthread_start + 125
    frame #4: 0x00007ff813177f6b libsystem_pthread.dylib`thread_start + 15
  thread #63
    frame #0: 0x00007ff8131423aa libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x00007ff81317caa4 libsystem_pthread.dylib`_pthread_cond_wait + 1302
    frame #2: 0x0000000100172f50 chiaki`chiaki_cond_timedwait(cond=0x000000010e92a9b0, mutex=0x000000010e92a9e0, timeout_ms=500) at thread.c:294:10
    frame #3: 0x000000010017305b chiaki`chiaki_cond_timedwait_pred(cond=0x000000010e92a9b0, mutex=0x000000010e92a9e0, timeout_ms=500, check_pred=(chiaki`bool_pred_cond_check_pred at thread.c:413), check_pred_user=0x000000010e92a9b0) at thread.c:332:25
    frame #4: 0x00000001001732e0 chiaki`chiaki_bool_pred_cond_timedwait(cond=0x000000010e92a9b0, timeout_ms=500) at thread.c:425:9
    frame #5: 0x000000010018c6c2 chiaki`discovery_service_thread_func(user=0x000000010e92a868) at discoveryservice.c:157:9
    frame #6: 0x00007ff81317c4e1 libsystem_pthread.dylib`_pthread_start + 125
    frame #7: 0x00007ff813177f6b libsystem_pthread.dylib`thread_start + 15
  thread #64
    frame #0: 0x00007ff813147d1a libsystem_kernel.dylib`__select + 10
    frame #1: 0x000000010018b09b chiaki`chiaki_stop_pipe_select_single(stop_pipe=0x0000700005c08f78, fd=39, write=false, timeout_ms=18446744073709551615) at stoppipe.c:153:7
    frame #2: 0x0000000100189ff2 chiaki`discovery_thread_func(user=0x0000700005c08f68) at discovery.c:326:25
    frame #3: 0x00007ff81317c4e1 libsystem_pthread.dylib`_pthread_start + 125
    frame #4: 0x00007ff813177f6b libsystem_pthread.dylib`thread_start + 15
streetpea commented 1 week ago

Testing on windows 11 22H2 HDR works with amd radeon 23.19.12-240220a-403852C-AMD-Software-Adrenaline-Adition and windows driver 31.0.21912.14. Also I used d3d11va for hw decoder bc my computer doesn’t support Vulkan. @cgarst just confirming you enabled hdr for your hdr compatible monitor in windows settings and have downloaded the latest amd drivers via https://www.amd.com/en/support/download/drivers.html? You can update the driver via the app on that page once installed.

cgarst commented 1 week ago

@streetpea Good news - my HDR is working as well now when I select d3d11va decoder. The "auto" decoder option uses Vulkan which causes a black screen on here. I thought I tried d3d11va before but maybe there was some other issue going on during that test.

My driver is the latest version vetted by Asus for this laptop listed as "31.0.22060.5000 (Adrenalin 23.20.60.05) DCH / Win11 64".

Thanks for looking into this!

streetpea commented 1 week ago

@cgarst @nowrep vulkan hw decode w/ HDR not working appears to be an issue with libplacebo, see: https://github.com/haasn/libplacebo/issues/272 and HDR rendering using vulkan and the amd driver on Windows. Ideally this would work as vulkan is better than d3d11va on Windows because it has zero-copy.

streetpea commented 1 week ago

@cgarst just to confirm Vulkan works you if you don't select hdr 265 as the codec (I.e., you use h265 instead)?

cgarst commented 1 week ago

@streetpea Yes, can confirm selecting H265 (not HDR) with Vulkan works.

streetpea commented 1 week ago

@nowrep @cgarst I opened an issue for libplacebo for problems with windows vulkan hw decoder w/ HDR here: https://github.com/haasn/libplacebo/issues/287

MapleHinata commented 1 week ago

On my end, while the stream does work on d3d11va, it results in a washed out HDR image. Here's an HDR JXR showing the issue, you may open it on a HDR-compatible photo viewer and a verbose log. (The JXR can be opened with the default Windows 11 Photo Viewer, or with https://github.com/SpecialKO/SKIV for something that works on Windows 10 ) chiaki-ng 2024-09-06 12_51_27 PM.zip chiaki_session_2024-09-06_12-55-13-252252.log

I'm experiencing this issue on Windows 11 24H2 (build 10.0.26100.1591.ge_release_svc_prod3.240820-2119), with an NVIDIA RTX 3070 running on the latest driver (560.94)

streetpea commented 1 week ago

@MapleHinata are you sure you are activating hdr in the associated game? Please go to the menu of the game and confirm hdr options are toggleable. Many times this requires the hdr monitor/tv connected to the ps5 to be on (there must be an hdr monitor/tv connected to the ps5 to enable hdr images to be sent to chiaki-ng bc that is how the ps5 knows to create hdr frames). Otherwise it is likely that you are streaming sdr content to the hdr colorspace (i.e., pc has hdr activated but ps5 isn’t generating hdr images).

MapleHinata commented 1 week ago

@streetpea Yes, I'm certain HDR is enabled, it works under the official Remote Play Client, on my Steam Deck OLED with Chiaki, and, while I can't go to the PS5 Settings menu under Chiaki, games show up HDR calibration options.

chiaki-ng 2024-09-06 1_24_33 PM.zip chiaki-ng 2024-09-06 1_28_08 PM.zip

Here's captures of Honkai: Star Rail, showing off the HDR calibration options

MapleHinata commented 1 week ago

Ok, i figured out the problem, apologies, i sent an older log by accident. chiaki_session_2024-09-06_13-59-47-263263.log

Pay attention here: [2024-09-06 13:59:49:719719] [D] [libplacebo] (Re)creating 1920x1080x0 texture with format rgba16hf: src/renderer.c:2185 The video is being decoded under with the VK_FORMAT_R16G16B16A16_SFLOAT texture format, which is a floating point 16-bit format, however, we're outputting in a Swapchain with this configuration: [2024-09-06 13:59:49:716716] [I] [libplacebo] Picked surface configuration 5: VK_FORMAT_A2B10G10R10_UNORM_PACK32 + VK_COLOR_SPACE_HDR10_ST2084_EXT Which is an unsigned 10-bit format, there is a color space mishmash between what is being decoded and what is being displayed.

If i use a tool to force Chiaki to output with a 16-bit swapchain, it renders correctly. I also noticed the UI is broken when outputting in HDR, take a look: VK_FORMAT_R16G16B16A16_SFLOAT.zip VK_FORMAT_A2B10G10R10_UNORM_PACK32.zip

MapleHinata commented 1 week ago

I'm also attaching below a DebugView of Chiaki Chiaki-Ng_DebugView.log

This seems to be a libplacebo bug? Why is preferring HDR10 (VK_FORMAT_A2B10G10R10_UNORM_PACK32 + VK_COLOR_SPACE_HDR10_ST2084_EXT) over scRGB (VK_FORMAT_R16G16B16A16_SFLOAT VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT), which is the format Windows uses for HDR natively, especially when it's decoding video with VK_FORMAT_R16G16B16A16_SFLOAT anyway...

streetpea commented 1 week ago

@MapleHinata i don’t believe scrgb is supported by libplacebo for Vulkan. See https://github.com/haasn/libplacebo/blob/efb89342b0c19b9773226624651839686172e88b/src/vulkan/swapchain.c#L93 Meaning VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT is skipped here https://github.com/haasn/libplacebo/blob/efb89342b0c19b9773226624651839686172e88b/src/vulkan/swapchain.c#L163 and a relevant comment here https://github.com/haasn/libplacebo/issues/11#issuecomment-395184719 @MapleHinata You could make an issue to support scrgb with libplacebo if you would like.

streetpea commented 1 week ago

@MapleHinata not sure what you mean by decoding in 16bit the decoder format is 10 bit P010LE see https://github.com/streetpea/chiaki-ng/blob/a9781cf40b0d2f63b1f32614505ac75cc663bf83/lib/src/ffmpegdecoder.c#L212 if a hw decoder is used and YUV420P10LE if no hw decoder is used