Skip to content

Commit

Permalink
Don't use vulkan hw decoding for hdr with amd graphics cards on Windo…
Browse files Browse the repository at this point in the history
…ws as it's not supported

Closes #393
  • Loading branch information
streetpea committed Dec 3, 2024
1 parent f948db1 commit 26e32e9
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
4 changes: 4 additions & 0 deletions gui/include/qmlmainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ class QmlMainWindow : public QWindow
float zoomFactor() const;
void setZoomFactor(float factor);

bool amdCard() const;

VideoPreset videoPreset() const;
void setVideoPreset(VideoPreset mode);

Expand Down Expand Up @@ -117,6 +119,7 @@ class QmlMainWindow : public QWindow
QObject *focusObject() const override;

bool has_video = false;
bool amd_card = false;
bool keep_video = false;
int grab_input = 0;
int dropped_frames = 0;
Expand Down Expand Up @@ -175,6 +178,7 @@ class QmlMainWindow : public QWindow
PFN_vkDestroySurfaceKHR vkDestroySurfaceKHR;
PFN_vkWaitSemaphores vkWaitSemaphores;
PFN_vkGetPhysicalDeviceQueueFamilyProperties vkGetPhysicalDeviceQueueFamilyProperties;
PFN_vkGetPhysicalDeviceProperties vkGetPhysicalDeviceProperties;
} vk_funcs;

friend class QmlBackend;
Expand Down
8 changes: 7 additions & 1 deletion gui/src/qmlbackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,13 @@ void QmlBackend::createSession(const StreamSessionConnectInfo &connect_info)
}
#endif
}

#if defined(Q_OS_WIN)
if(session_info.hw_decoder == "vulkan" && session_info.video_profile.codec == CHIAKI_CODEC_H265_HDR && window->amdCard())
{
qCInfo(chiakiGui) << "Using amd card with vulkan hw decoding and hdr not supported on Windows, falling back to d3d11va...";
session_info.hw_decoder = "d3d11va";
}
#endif
if (session_info.hw_decoder == "vulkan") {
session_info.hw_device_ctx = window->vulkanHwDeviceCtx();
if (!session_info.hw_device_ctx)
Expand Down
13 changes: 13 additions & 0 deletions gui/src/qmlmainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ void QmlMainWindow::init(Settings *settings, bool exit_app_on_stream_exit)
#endif
GET_PROC(vkDestroySurfaceKHR)
GET_PROC(vkGetPhysicalDeviceQueueFamilyProperties)
GET_PROC(vkGetPhysicalDeviceProperties)
#undef GET_PROC

const char *opt_dev_extensions[] = {
Expand Down Expand Up @@ -445,6 +446,13 @@ void QmlMainWindow::init(Settings *settings, bool exit_app_on_stream_exit)
});
if (queue_it != queueFamilyProperties.end())
vk_decode_queue_index = std::distance(queueFamilyProperties.begin(), queue_it);
VkPhysicalDeviceProperties device_props;
vk_funcs.vkGetPhysicalDeviceProperties(placebo_vulkan->phys_device, &device_props);
if(device_props.vendorID == 0x1002)
{
amd_card = true;
qCInfo(chiakiGui) << "Using amd graphics card";
}

struct pl_cache_params cache_params = {
.log = placebo_log,
Expand Down Expand Up @@ -948,6 +956,11 @@ bool QmlMainWindow::handleShortcut(QKeyEvent *event)
}
}

bool QmlMainWindow::amdCard() const
{
return amd_card;
}

bool QmlMainWindow::event(QEvent *event)
{
switch (event->type()) {
Expand Down

0 comments on commit 26e32e9

Please sign in to comment.