mirror of
https://git.outfoxxed.me/quickshell/quickshell.git
synced 2026-02-25 03:43:58 +11:00
wayland/screencopy: enable vulkan dmabuf support on session locks
Some checks are pending
Build / Nix (push) Waiting to run
Build / Nix-1 (push) Waiting to run
Build / Nix-2 (push) Waiting to run
Build / Nix-3 (push) Waiting to run
Build / Nix-4 (push) Waiting to run
Build / Nix-5 (push) Waiting to run
Build / Nix-6 (push) Waiting to run
Build / Nix-7 (push) Waiting to run
Build / Nix-8 (push) Waiting to run
Build / Nix-9 (push) Waiting to run
Build / Nix-10 (push) Waiting to run
Build / Nix-11 (push) Waiting to run
Build / Nix-12 (push) Waiting to run
Build / Nix-13 (push) Waiting to run
Build / Nix-14 (push) Waiting to run
Build / Nix-15 (push) Waiting to run
Build / Nix-16 (push) Waiting to run
Build / Nix-17 (push) Waiting to run
Build / Nix-18 (push) Waiting to run
Build / Nix-19 (push) Waiting to run
Build / Nix-20 (push) Waiting to run
Build / Nix-21 (push) Waiting to run
Build / Nix-22 (push) Waiting to run
Build / Nix-23 (push) Waiting to run
Build / Nix-24 (push) Waiting to run
Build / Nix-25 (push) Waiting to run
Build / Nix-26 (push) Waiting to run
Build / Nix-27 (push) Waiting to run
Build / Nix-28 (push) Waiting to run
Build / Nix-29 (push) Waiting to run
Build / Nix-30 (push) Waiting to run
Build / Nix-31 (push) Waiting to run
Build / Nix-32 (push) Waiting to run
Build / Nix-33 (push) Waiting to run
Build / Archlinux (push) Waiting to run
Lint / Lint (push) Waiting to run
Some checks are pending
Build / Nix (push) Waiting to run
Build / Nix-1 (push) Waiting to run
Build / Nix-2 (push) Waiting to run
Build / Nix-3 (push) Waiting to run
Build / Nix-4 (push) Waiting to run
Build / Nix-5 (push) Waiting to run
Build / Nix-6 (push) Waiting to run
Build / Nix-7 (push) Waiting to run
Build / Nix-8 (push) Waiting to run
Build / Nix-9 (push) Waiting to run
Build / Nix-10 (push) Waiting to run
Build / Nix-11 (push) Waiting to run
Build / Nix-12 (push) Waiting to run
Build / Nix-13 (push) Waiting to run
Build / Nix-14 (push) Waiting to run
Build / Nix-15 (push) Waiting to run
Build / Nix-16 (push) Waiting to run
Build / Nix-17 (push) Waiting to run
Build / Nix-18 (push) Waiting to run
Build / Nix-19 (push) Waiting to run
Build / Nix-20 (push) Waiting to run
Build / Nix-21 (push) Waiting to run
Build / Nix-22 (push) Waiting to run
Build / Nix-23 (push) Waiting to run
Build / Nix-24 (push) Waiting to run
Build / Nix-25 (push) Waiting to run
Build / Nix-26 (push) Waiting to run
Build / Nix-27 (push) Waiting to run
Build / Nix-28 (push) Waiting to run
Build / Nix-29 (push) Waiting to run
Build / Nix-30 (push) Waiting to run
Build / Nix-31 (push) Waiting to run
Build / Nix-32 (push) Waiting to run
Build / Nix-33 (push) Waiting to run
Build / Archlinux (push) Waiting to run
Lint / Lint (push) Waiting to run
Also reformat dmabuf
This commit is contained in:
parent
c3c3e2ca25
commit
8e8f27a22a
2 changed files with 20 additions and 17 deletions
|
|
@ -28,6 +28,7 @@
|
||||||
#include <qscopedpointer.h>
|
#include <qscopedpointer.h>
|
||||||
#include <qsgrendererinterface.h>
|
#include <qsgrendererinterface.h>
|
||||||
#include <qsgtexture_platform.h>
|
#include <qsgtexture_platform.h>
|
||||||
|
#include <qtypes.h>
|
||||||
#include <qvulkanfunctions.h>
|
#include <qvulkanfunctions.h>
|
||||||
#include <qvulkaninstance.h>
|
#include <qvulkaninstance.h>
|
||||||
#include <qwayland-linux-dmabuf-v1.h>
|
#include <qwayland-linux-dmabuf-v1.h>
|
||||||
|
|
@ -35,7 +36,6 @@
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <qtypes.h>
|
|
||||||
#include <vulkan/vulkan_core.h>
|
#include <vulkan/vulkan_core.h>
|
||||||
#include <wayland-client-protocol.h>
|
#include <wayland-client-protocol.h>
|
||||||
#include <wayland-linux-dmabuf-v1-client-protocol.h>
|
#include <wayland-linux-dmabuf-v1-client-protocol.h>
|
||||||
|
|
@ -80,10 +80,8 @@ bool drmFormatHasAlpha(uint32_t drmFormat) {
|
||||||
case DRM_FORMAT_ABGR8888:
|
case DRM_FORMAT_ABGR8888:
|
||||||
case DRM_FORMAT_ARGB2101010:
|
case DRM_FORMAT_ARGB2101010:
|
||||||
case DRM_FORMAT_ABGR2101010:
|
case DRM_FORMAT_ABGR2101010:
|
||||||
case DRM_FORMAT_ABGR16161616F:
|
case DRM_FORMAT_ABGR16161616F: return true;
|
||||||
return true;
|
default: return false;
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -818,7 +816,8 @@ WlBufferQSGTexture* WlDmaBuffer::createQsgTextureVulkan(QQuickWindow* window) co
|
||||||
|
|
||||||
// dup() is required because vkAllocateMemory with VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT
|
// dup() is required because vkAllocateMemory with VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT
|
||||||
// takes ownership of the fd on succcess. Without dup, WlDmaBuffer would double-close.
|
// takes ownership of the fd on succcess. Without dup, WlDmaBuffer would double-close.
|
||||||
const int dupFd = dup(this->planes[0].fd); // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic)
|
const int dupFd =
|
||||||
|
dup(this->planes[0].fd); // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic)
|
||||||
if (dupFd < 0) {
|
if (dupFd < 0) {
|
||||||
qCWarning(logDmabuf) << "Failed to dup() fd for DMA-BUF import";
|
qCWarning(logDmabuf) << "Failed to dup() fd for DMA-BUF import";
|
||||||
goto cleanup_fail; // NOLINT
|
goto cleanup_fail; // NOLINT
|
||||||
|
|
@ -909,12 +908,12 @@ WlBufferQSGTexture* WlDmaBuffer::createQsgTextureVulkan(QQuickWindow* window) co
|
||||||
// find the graphics queue family index for the ownrship transfer.
|
// find the graphics queue family index for the ownrship transfer.
|
||||||
uint32_t graphicsQueueFamily = 0;
|
uint32_t graphicsQueueFamily = 0;
|
||||||
uint32_t queueFamilyCount = 0;
|
uint32_t queueFamilyCount = 0;
|
||||||
instFuncs->vkGetPhysicalDeviceQueueFamilyProperties(
|
instFuncs->vkGetPhysicalDeviceQueueFamilyProperties(physDevice, &queueFamilyCount, nullptr);
|
||||||
physDevice, &queueFamilyCount, nullptr
|
|
||||||
);
|
|
||||||
std::vector<VkQueueFamilyProperties> queueFamilies(queueFamilyCount);
|
std::vector<VkQueueFamilyProperties> queueFamilies(queueFamilyCount);
|
||||||
instFuncs->vkGetPhysicalDeviceQueueFamilyProperties(
|
instFuncs->vkGetPhysicalDeviceQueueFamilyProperties(
|
||||||
physDevice, &queueFamilyCount, queueFamilies.data()
|
physDevice,
|
||||||
|
&queueFamilyCount,
|
||||||
|
queueFamilies.data()
|
||||||
);
|
);
|
||||||
for (uint32_t i = 0; i < queueFamilyCount; ++i) {
|
for (uint32_t i = 0; i < queueFamilyCount; ++i) {
|
||||||
if (queueFamilies[i].queueFlags & VK_QUEUE_GRAPHICS_BIT) {
|
if (queueFamilies[i].queueFlags & VK_QUEUE_GRAPHICS_BIT) {
|
||||||
|
|
@ -989,13 +988,7 @@ WlBufferQSGTexture* WlDmaBuffer::createQsgTextureVulkan(QQuickWindow* window) co
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto* tex = new WlDmaBufferVulkanQSGTexture(
|
auto* tex = new WlDmaBufferVulkanQSGTexture(devFuncs, device, image, memory, qsgTexture);
|
||||||
devFuncs,
|
|
||||||
device,
|
|
||||||
image,
|
|
||||||
memory,
|
|
||||||
qsgTexture
|
|
||||||
);
|
|
||||||
qCDebug(logDmabuf) << "Created WlDmaBufferVulkanQSGTexture" << tex << "from" << this;
|
qCDebug(logDmabuf) << "Created WlDmaBufferVulkanQSGTexture" << tex << "from" << this;
|
||||||
return tex;
|
return tex;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
#include <qqmlcomponent.h>
|
#include <qqmlcomponent.h>
|
||||||
#include <qqmlengine.h>
|
#include <qqmlengine.h>
|
||||||
#include <qqmllist.h>
|
#include <qqmllist.h>
|
||||||
|
#include <qquickgraphicsconfiguration.h>
|
||||||
#include <qquickitem.h>
|
#include <qquickitem.h>
|
||||||
#include <qquickwindow.h>
|
#include <qquickwindow.h>
|
||||||
#include <qscreen.h>
|
#include <qscreen.h>
|
||||||
|
|
@ -216,6 +217,15 @@ void WlSessionLockSurface::onReload(QObject* oldInstance) {
|
||||||
|
|
||||||
if (this->window == nullptr) {
|
if (this->window == nullptr) {
|
||||||
this->window = new QQuickWindow();
|
this->window = new QQuickWindow();
|
||||||
|
|
||||||
|
// needed for vulkan dmabuf import, qt ignores these if not applicable
|
||||||
|
auto graphicsConfig = this->window->graphicsConfiguration();
|
||||||
|
graphicsConfig.setDeviceExtensions({
|
||||||
|
"VK_KHR_external_memory_fd",
|
||||||
|
"VK_EXT_external_memory_dma_buf",
|
||||||
|
"VK_EXT_image_drm_format_modifier",
|
||||||
|
});
|
||||||
|
this->window->setGraphicsConfiguration(graphicsConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->mContentItem->setParentItem(this->window->contentItem());
|
this->mContentItem->setParentItem(this->window->contentItem());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue