mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-20 13:26:02 +00:00
(cherry picked from commit b2b033d675a04d201eb07672b57a93ec1983d86f)
(cherry picked from commit 5764373060)
51 lines
1.9 KiB
Diff
51 lines
1.9 KiB
Diff
--- a/src/gallium/frontends/dri/kopper.c
|
|
+++ b/src/gallium/frontends/dri/kopper.c
|
|
@@ -43,6 +43,7 @@
|
|
|
|
#ifdef VK_USE_PLATFORM_XCB_KHR
|
|
#include <xcb/xcb.h>
|
|
+#include <xcb/xcbext.h>
|
|
#include <xcb/dri3.h>
|
|
#include <xcb/present.h>
|
|
#include <xcb/xfixes.h>
|
|
@@ -97,6 +98,15 @@
|
|
unsigned statts_count);
|
|
|
|
#ifdef VK_USE_PLATFORM_XCB_KHR
|
|
+static bool
|
|
+kopper_has_dri3(struct dri_drawable *drawable)
|
|
+{
|
|
+ VkXcbSurfaceCreateInfoKHR *xcb = (VkXcbSurfaceCreateInfoKHR *)&drawable->info.bos;
|
|
+ const xcb_query_extension_reply_t *extension =
|
|
+ xcb_get_extension_data(xcb->connection, &xcb_dri3_id);
|
|
+ return extension && extension->present;
|
|
+}
|
|
+
|
|
/* Translate from the pipe_format enums used by Gallium to the DRM FourCC
|
|
* codes used by dmabuf import */
|
|
static int
|
|
@@ -321,7 +331,8 @@
|
|
drawable->window_valid = !!drawable->textures[statts[i]];
|
|
}
|
|
#ifdef VK_USE_PLATFORM_XCB_KHR
|
|
- else if (is_pixmap && statts[i] == ST_ATTACHMENT_FRONT_LEFT && !screen->is_sw) {
|
|
+ else if (is_pixmap && statts[i] == ST_ATTACHMENT_FRONT_LEFT &&
|
|
+ screen->has_dmabuf && kopper_has_dri3(drawable)) {
|
|
drawable->textures[statts[i]] = kopper_get_pixmap_buffer(drawable, format);
|
|
if (drawable->textures[statts[i]])
|
|
dri_image_fence_sync(ctx, drawable->image);
|
|
@@ -451,8 +462,12 @@
|
|
struct pipe_resource *res)
|
|
{
|
|
struct dri_screen *screen = drawable->screen;
|
|
- if (screen->has_dmabuf || drawable->is_window || drawable->info.bos.sType != VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR)
|
|
+ if (drawable->is_window || drawable->info.bos.sType != VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR)
|
|
return;
|
|
+#ifdef VK_USE_PLATFORM_XCB_KHR
|
|
+ if (screen->has_dmabuf && kopper_has_dri3(drawable))
|
|
+ return;
|
|
+#endif
|
|
drisw_update_tex_buffer(drawable, ctx, res);
|
|
}
|
|
|