meson: delete dri3 build option
this existed for historical reasons, but realistically now it should be possible to build mesa with dri3 always enabled. additionally, this check was often used as a substitute for having drm functionality, which is sort of similar but also not really a direct match this simplifies a bunch of conditionals and prevents users from footgunnning themselves into orbit Reviewed-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Eric Engestrom <eric@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30952>
This commit is contained in:

committed by
Marge Bot

parent
56ac378454
commit
8f6fca89aa
@@ -96,7 +96,6 @@ debian-testing:
|
|||||||
-D glvnd=disabled
|
-D glvnd=disabled
|
||||||
-D platforms=x11,wayland
|
-D platforms=x11,wayland
|
||||||
GALLIUM_ST: >
|
GALLIUM_ST: >
|
||||||
-D dri3=enabled
|
|
||||||
-D gallium-nine=true
|
-D gallium-nine=true
|
||||||
-D gallium-va=enabled
|
-D gallium-va=enabled
|
||||||
-D gallium-rusticl=true
|
-D gallium-rusticl=true
|
||||||
@@ -196,7 +195,6 @@ debian-testing-msan:
|
|||||||
-D glvnd=disabled
|
-D glvnd=disabled
|
||||||
-D platforms=x11,wayland
|
-D platforms=x11,wayland
|
||||||
GALLIUM_ST: >
|
GALLIUM_ST: >
|
||||||
-D dri3=enabled
|
|
||||||
-D gallium-extra-hud=true
|
-D gallium-extra-hud=true
|
||||||
-D gallium-vdpau=enabled
|
-D gallium-vdpau=enabled
|
||||||
-D gallium-omx=bellagio
|
-D gallium-omx=bellagio
|
||||||
@@ -262,7 +260,6 @@ debian-release:
|
|||||||
-D glvnd=disabled
|
-D glvnd=disabled
|
||||||
-D platforms=x11,wayland
|
-D platforms=x11,wayland
|
||||||
GALLIUM_ST: >
|
GALLIUM_ST: >
|
||||||
-D dri3=enabled
|
|
||||||
-D gallium-extra-hud=true
|
-D gallium-extra-hud=true
|
||||||
-D gallium-vdpau=enabled
|
-D gallium-vdpau=enabled
|
||||||
-D gallium-omx=disabled
|
-D gallium-omx=disabled
|
||||||
@@ -307,7 +304,6 @@ alpine-build-testing:
|
|||||||
-D platforms=wayland
|
-D platforms=wayland
|
||||||
GALLIUM_DRIVERS: "crocus,etnaviv,freedreno,iris,lima,nouveau,panfrost,r300,r600,radeonsi,svga,llvmpipe,softpipe,tegra,v3d,vc4,virgl,zink"
|
GALLIUM_DRIVERS: "crocus,etnaviv,freedreno,iris,lima,nouveau,panfrost,r300,r600,radeonsi,svga,llvmpipe,softpipe,tegra,v3d,vc4,virgl,zink"
|
||||||
GALLIUM_ST: >
|
GALLIUM_ST: >
|
||||||
-D dri3=enabled
|
|
||||||
-D gallium-extra-hud=true
|
-D gallium-extra-hud=true
|
||||||
-D gallium-vdpau=disabled
|
-D gallium-vdpau=disabled
|
||||||
-D gallium-omx=disabled
|
-D gallium-omx=disabled
|
||||||
@@ -359,7 +355,6 @@ fedora-release:
|
|||||||
-D teflon=true
|
-D teflon=true
|
||||||
GALLIUM_DRIVERS: "crocus,etnaviv,freedreno,i915,iris,lima,nouveau,panfrost,r300,r600,radeonsi,svga,llvmpipe,softpipe,tegra,v3d,vc4,virgl,zink"
|
GALLIUM_DRIVERS: "crocus,etnaviv,freedreno,i915,iris,lima,nouveau,panfrost,r300,r600,radeonsi,svga,llvmpipe,softpipe,tegra,v3d,vc4,virgl,zink"
|
||||||
GALLIUM_ST: >
|
GALLIUM_ST: >
|
||||||
-D dri3=enabled
|
|
||||||
-D gallium-extra-hud=true
|
-D gallium-extra-hud=true
|
||||||
-D gallium-vdpau=enabled
|
-D gallium-vdpau=enabled
|
||||||
-D gallium-omx=disabled
|
-D gallium-omx=disabled
|
||||||
@@ -412,7 +407,6 @@ debian-android:
|
|||||||
-D android-libbacktrace=disabled
|
-D android-libbacktrace=disabled
|
||||||
-D intel-clc=system
|
-D intel-clc=system
|
||||||
GALLIUM_ST: >
|
GALLIUM_ST: >
|
||||||
-D dri3=disabled
|
|
||||||
-D gallium-vdpau=disabled
|
-D gallium-vdpau=disabled
|
||||||
-D gallium-omx=disabled
|
-D gallium-omx=disabled
|
||||||
-D gallium-va=disabled
|
-D gallium-va=disabled
|
||||||
@@ -456,7 +450,6 @@ debian-android:
|
|||||||
-D platforms=x11,wayland
|
-D platforms=x11,wayland
|
||||||
-D osmesa=false
|
-D osmesa=false
|
||||||
GALLIUM_ST: >
|
GALLIUM_ST: >
|
||||||
-D dri3=enabled
|
|
||||||
-D gallium-vdpau=disabled
|
-D gallium-vdpau=disabled
|
||||||
-D gallium-omx=disabled
|
-D gallium-omx=disabled
|
||||||
-D gallium-va=disabled
|
-D gallium-va=disabled
|
||||||
@@ -614,7 +607,6 @@ debian-clang:
|
|||||||
-D glvnd=enabled
|
-D glvnd=enabled
|
||||||
-D platforms=x11,wayland
|
-D platforms=x11,wayland
|
||||||
GALLIUM_ST: >
|
GALLIUM_ST: >
|
||||||
-D dri3=enabled
|
|
||||||
-D gallium-extra-hud=true
|
-D gallium-extra-hud=true
|
||||||
-D gallium-vdpau=enabled
|
-D gallium-vdpau=enabled
|
||||||
-D gallium-omx=bellagio
|
-D gallium-omx=bellagio
|
||||||
@@ -653,7 +645,6 @@ debian-clang-release:
|
|||||||
-D glx=xlib
|
-D glx=xlib
|
||||||
-D platforms=x11,wayland
|
-D platforms=x11,wayland
|
||||||
GALLIUM_ST: >
|
GALLIUM_ST: >
|
||||||
-D dri3=enabled
|
|
||||||
-D gallium-extra-hud=true
|
-D gallium-extra-hud=true
|
||||||
-D gallium-vdpau=enabled
|
-D gallium-vdpau=enabled
|
||||||
-D gallium-omx=bellagio
|
-D gallium-omx=bellagio
|
||||||
@@ -701,7 +692,6 @@ debian-vulkan:
|
|||||||
-D platforms=x11,wayland
|
-D platforms=x11,wayland
|
||||||
-D osmesa=false
|
-D osmesa=false
|
||||||
GALLIUM_ST: >
|
GALLIUM_ST: >
|
||||||
-D dri3=enabled
|
|
||||||
-D gallium-vdpau=disabled
|
-D gallium-vdpau=disabled
|
||||||
-D gallium-omx=disabled
|
-D gallium-omx=disabled
|
||||||
-D gallium-va=disabled
|
-D gallium-va=disabled
|
||||||
|
27
meson.build
27
meson.build
@@ -566,23 +566,15 @@ if with_vulkan_icd_dir == ''
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
with_dri2 = (with_dri or with_any_vk) and (with_dri_platform == 'drm' or with_dri_platform == 'apple')
|
with_dri2 = (with_dri or with_any_vk) and (with_dri_platform == 'drm' or with_dri_platform == 'apple')
|
||||||
with_dri3 = get_option('dri3').disable_auto_if(not (system_has_kms_drm and with_dri2)).allowed()
|
|
||||||
|
|
||||||
with_x11_dri2 = with_dri2 and get_option('legacy-x11').contains('dri2')
|
with_x11_dri2 = with_dri2 and get_option('legacy-x11').contains('dri2')
|
||||||
|
|
||||||
if with_any_vk and (with_platform_x11 and not with_dri3)
|
|
||||||
error('Vulkan drivers require dri3 for X11 support')
|
|
||||||
endif
|
|
||||||
if with_dri
|
if with_dri
|
||||||
if with_glx == 'disabled' and not with_egl and not with_gbm
|
if with_glx == 'disabled' and not with_egl and not with_gbm
|
||||||
error('building dri drivers require at least one windowing system')
|
error('building dri drivers require at least one windowing system')
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if with_gallium_kmsro and (with_platform_x11 and not with_dri3)
|
|
||||||
error('kmsro requires dri3 for X11 support')
|
|
||||||
endif
|
|
||||||
|
|
||||||
dep_dxheaders = null_dep
|
dep_dxheaders = null_dep
|
||||||
if with_gallium_d3d12 or with_microsoft_clc or with_microsoft_vk
|
if with_gallium_d3d12 or with_microsoft_clc or with_microsoft_vk
|
||||||
dep_dxheaders = dependency('directx-headers', required : false)
|
dep_dxheaders = dependency('directx-headers', required : false)
|
||||||
@@ -786,9 +778,6 @@ if with_gallium_st_nine
|
|||||||
].contains(true)
|
].contains(true)
|
||||||
error('The nine state tracker requires at least one non-swrast gallium driver.')
|
error('The nine state tracker requires at least one non-swrast gallium driver.')
|
||||||
endif
|
endif
|
||||||
if not with_dri3
|
|
||||||
error('Using nine with wine requires dri3')
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
with_gallium_st_d3d10umd = get_option('gallium-d3d10umd')
|
with_gallium_st_d3d10umd = get_option('gallium-d3d10umd')
|
||||||
if with_gallium_st_d3d10umd
|
if with_gallium_st_d3d10umd
|
||||||
@@ -1749,7 +1738,7 @@ with_gallium_drisw_kms = false
|
|||||||
if system_has_kms_drm
|
if system_has_kms_drm
|
||||||
dep_libdrm = dependency(
|
dep_libdrm = dependency(
|
||||||
'libdrm', version : '>=' + _drm_ver,
|
'libdrm', version : '>=' + _drm_ver,
|
||||||
required : with_dri2 or with_dri3
|
required : with_dri2 or with_dri
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
# We should prevent libdrm from being available when the target doesn't have it to avoid transitive
|
# We should prevent libdrm from being available when the target doesn't have it to avoid transitive
|
||||||
@@ -2190,10 +2179,9 @@ if with_platform_x11
|
|||||||
error('libdrm required for gallium video statetrackers when using x11')
|
error('libdrm required for gallium video statetrackers when using x11')
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
if with_any_vk or with_egl or (with_glx == 'dri' and with_dri_platform == 'drm')
|
if with_dri_platform == 'drm'
|
||||||
dep_xcb_dri2 = dependency('xcb-dri2', version : '>= 1.8', required : with_x11_dri2)
|
dep_xcb_dri2 = dependency('xcb-dri2', version : '>= 1.8', required : with_x11_dri2)
|
||||||
|
|
||||||
if with_dri3
|
|
||||||
dep_xcb_dri3 = dependency('xcb-dri3')
|
dep_xcb_dri3 = dependency('xcb-dri3')
|
||||||
dep_xcb_present = dependency('xcb-present')
|
dep_xcb_present = dependency('xcb-present')
|
||||||
# until xcb-dri3 has been around long enough to make a hard-dependency:
|
# until xcb-dri3 has been around long enough to make a hard-dependency:
|
||||||
@@ -2208,7 +2196,7 @@ if with_platform_x11
|
|||||||
dep_xcb_shm = dependency('xcb-shm')
|
dep_xcb_shm = dependency('xcb-shm')
|
||||||
dep_xcb_sync = dependency('xcb-sync')
|
dep_xcb_sync = dependency('xcb-sync')
|
||||||
dep_xshmfence = dependency('xshmfence', version : '>= 1.1')
|
dep_xshmfence = dependency('xshmfence', version : '>= 1.1')
|
||||||
endif
|
pre_args += '-DHAVE_X11_DRM'
|
||||||
endif
|
endif
|
||||||
if with_glx == 'dri' or with_glx == 'xlib'
|
if with_glx == 'dri' or with_glx == 'xlib'
|
||||||
dep_glproto = dependency('glproto', version : '>= 1.4.14')
|
dep_glproto = dependency('glproto', version : '>= 1.4.14')
|
||||||
@@ -2222,9 +2210,9 @@ if with_platform_x11
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
if (with_egl or
|
if (with_egl or
|
||||||
with_dri3 or (
|
with_any_vk or
|
||||||
with_gallium_vdpau or with_gallium_xa or
|
with_gallium_vdpau or with_gallium_xa or
|
||||||
with_gallium_omx != 'disabled'))
|
with_gallium_omx != 'disabled')
|
||||||
dep_xcb_xfixes = dependency('xcb-xfixes')
|
dep_xcb_xfixes = dependency('xcb-xfixes')
|
||||||
endif
|
endif
|
||||||
if with_xlib_lease or with_any_vk
|
if with_xlib_lease or with_any_vk
|
||||||
@@ -2244,9 +2232,6 @@ endif
|
|||||||
if with_x11_dri2
|
if with_x11_dri2
|
||||||
pre_args += '-DHAVE_X11_DRI2'
|
pre_args += '-DHAVE_X11_DRI2'
|
||||||
endif
|
endif
|
||||||
if with_dri3
|
|
||||||
pre_args += '-DHAVE_DRI3'
|
|
||||||
endif
|
|
||||||
if with_dri3_modifiers
|
if with_dri3_modifiers
|
||||||
pre_args += '-DHAVE_DRI3_MODIFIERS'
|
pre_args += '-DHAVE_DRI3_MODIFIERS'
|
||||||
endif
|
endif
|
||||||
@@ -2419,7 +2404,7 @@ if with_egl
|
|||||||
if with_dri
|
if with_dri
|
||||||
egl_drivers += 'builtin:egl_dri2'
|
egl_drivers += 'builtin:egl_dri2'
|
||||||
endif
|
endif
|
||||||
if with_dri3
|
if with_dri_platform == 'drm'
|
||||||
egl_drivers += 'builtin:egl_dri3'
|
egl_drivers += 'builtin:egl_dri3'
|
||||||
endif
|
endif
|
||||||
if with_platform_windows
|
if with_platform_windows
|
||||||
|
@@ -51,13 +51,6 @@ option(
|
|||||||
description : 'Use Android\'s libbacktrace',
|
description : 'Use Android\'s libbacktrace',
|
||||||
)
|
)
|
||||||
|
|
||||||
option(
|
|
||||||
'dri3',
|
|
||||||
type : 'feature',
|
|
||||||
deprecated: {'true': 'enabled', 'false': 'disabled'},
|
|
||||||
description : 'enable support for dri3'
|
|
||||||
)
|
|
||||||
|
|
||||||
option(
|
option(
|
||||||
'dri-drivers-path',
|
'dri-drivers-path',
|
||||||
type : 'string',
|
type : 'string',
|
||||||
|
@@ -41,7 +41,7 @@
|
|||||||
#include <xcb/xfixes.h>
|
#include <xcb/xfixes.h>
|
||||||
|
|
||||||
#include "loader_dri_helper.h"
|
#include "loader_dri_helper.h"
|
||||||
#ifdef HAVE_DRI3
|
#ifdef HAVE_LIBDRM
|
||||||
#include "loader_dri3_helper.h"
|
#include "loader_dri3_helper.h"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@@ -280,7 +280,7 @@ struct dri2_egl_display {
|
|||||||
xcb_connection_t *conn;
|
xcb_connection_t *conn;
|
||||||
xcb_screen_t *screen;
|
xcb_screen_t *screen;
|
||||||
bool swap_available;
|
bool swap_available;
|
||||||
#ifdef HAVE_DRI3
|
#ifdef HAVE_LIBDRM
|
||||||
struct loader_screen_resources screen_resources;
|
struct loader_screen_resources screen_resources;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@@ -43,6 +43,7 @@
|
|||||||
/* clang-format on */
|
/* clang-format on */
|
||||||
#ifdef HAVE_LIBDRM
|
#ifdef HAVE_LIBDRM
|
||||||
#include <xf86drm.h>
|
#include <xf86drm.h>
|
||||||
|
#include "platform_x11_dri3.h"
|
||||||
#endif
|
#endif
|
||||||
#include "util/bitscan.h"
|
#include "util/bitscan.h"
|
||||||
#include "util/macros.h"
|
#include "util/macros.h"
|
||||||
@@ -57,9 +58,6 @@
|
|||||||
#include "drm-uapi/drm_fourcc.h"
|
#include "drm-uapi/drm_fourcc.h"
|
||||||
#include "dri_util.h"
|
#include "dri_util.h"
|
||||||
|
|
||||||
#ifdef HAVE_DRI3
|
|
||||||
#include "platform_x11_dri3.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static EGLBoolean
|
static EGLBoolean
|
||||||
dri2_x11_swap_interval(_EGLDisplay *disp, _EGLSurface *surf, EGLint interval);
|
dri2_x11_swap_interval(_EGLDisplay *disp, _EGLSurface *surf, EGLint interval);
|
||||||
@@ -1412,7 +1410,7 @@ dri2_x11_get_msc_rate(_EGLDisplay *display, _EGLSurface *surface,
|
|||||||
{
|
{
|
||||||
struct dri2_egl_display *dri2_dpy = dri2_egl_display(display);
|
struct dri2_egl_display *dri2_dpy = dri2_egl_display(display);
|
||||||
|
|
||||||
#ifdef HAVE_DRI3
|
#ifdef HAVE_LIBDRM
|
||||||
loader_update_screen_resources(&dri2_dpy->screen_resources);
|
loader_update_screen_resources(&dri2_dpy->screen_resources);
|
||||||
|
|
||||||
if (dri2_dpy->screen_resources.num_crtcs == 0) {
|
if (dri2_dpy->screen_resources.num_crtcs == 0) {
|
||||||
@@ -1434,6 +1432,7 @@ dri2_x11_get_msc_rate(_EGLDisplay *display, _EGLSurface *surface,
|
|||||||
*denominator = 1;
|
*denominator = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* In a multi-monitor setup, look at each CRTC and perform a box
|
/* In a multi-monitor setup, look at each CRTC and perform a box
|
||||||
* intersection between the CRTC and surface. Use the CRTC whose
|
* intersection between the CRTC and surface. Use the CRTC whose
|
||||||
* box intersection has the largest area.
|
* box intersection has the largest area.
|
||||||
@@ -1455,7 +1454,7 @@ dri2_x11_get_msc_rate(_EGLDisplay *display, _EGLSurface *surface,
|
|||||||
return EGL_FALSE;
|
return EGL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_DRI3
|
#ifdef HAVE_LIBDRM
|
||||||
int area = 0;
|
int area = 0;
|
||||||
|
|
||||||
for (unsigned c = 0; c < dri2_dpy->screen_resources.num_crtcs; c++) {
|
for (unsigned c = 0; c < dri2_dpy->screen_resources.num_crtcs; c++) {
|
||||||
@@ -1471,7 +1470,6 @@ dri2_x11_get_msc_rate(_EGLDisplay *display, _EGLSurface *surface,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* If the window is entirely off-screen, then area will still be 0.
|
/* If the window is entirely off-screen, then area will still be 0.
|
||||||
* We defaulted to the first CRTC in the list's refresh rate, earlier.
|
* We defaulted to the first CRTC in the list's refresh rate, earlier.
|
||||||
*/
|
*/
|
||||||
@@ -1817,12 +1815,14 @@ dri2_initialize_x11_swrast(_EGLDisplay *disp)
|
|||||||
* here will allow is to simply free the memory at dri2_terminate().
|
* here will allow is to simply free the memory at dri2_terminate().
|
||||||
*/
|
*/
|
||||||
dri2_dpy->driver_name = strdup(disp->Options.Zink ? "zink" : "swrast");
|
dri2_dpy->driver_name = strdup(disp->Options.Zink ? "zink" : "swrast");
|
||||||
#ifdef HAVE_DRI3
|
#ifdef HAVE_LIBDRM
|
||||||
|
|
||||||
if (disp->Options.Zink &&
|
if (disp->Options.Zink &&
|
||||||
!debug_get_bool_option("LIBGL_DRI3_DISABLE", false) &&
|
!debug_get_bool_option("LIBGL_DRI3_DISABLE", false) &&
|
||||||
!dri2_dpy->kopper_without_modifiers)
|
!dri2_dpy->kopper_without_modifiers)
|
||||||
dri3_x11_connect(dri2_dpy, disp->Options.Zink, disp->Options.ForceSoftware);
|
dri3_x11_connect(dri2_dpy, disp->Options.Zink, disp->Options.ForceSoftware);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!dri2_load_driver(disp))
|
if (!dri2_load_driver(disp))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
@@ -1860,7 +1860,7 @@ dri2_initialize_x11_swrast(_EGLDisplay *disp)
|
|||||||
disp->Extensions.CHROMIUM_sync_control = EGL_TRUE;
|
disp->Extensions.CHROMIUM_sync_control = EGL_TRUE;
|
||||||
disp->Extensions.EXT_swap_buffers_with_damage = !!dri2_dpy->kopper;
|
disp->Extensions.EXT_swap_buffers_with_damage = !!dri2_dpy->kopper;
|
||||||
|
|
||||||
#ifdef HAVE_DRI3
|
#ifdef HAVE_LIBDRM
|
||||||
if (dri2_dpy->multibuffers_available)
|
if (dri2_dpy->multibuffers_available)
|
||||||
dri2_set_WL_bind_wayland_display(disp);
|
dri2_set_WL_bind_wayland_display(disp);
|
||||||
#endif
|
#endif
|
||||||
@@ -1887,8 +1887,7 @@ cleanup:
|
|||||||
return EGL_FALSE;
|
return EGL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_DRI3
|
#ifdef HAVE_LIBDRM
|
||||||
|
|
||||||
static const __DRIextension *dri3_image_loader_extensions[] = {
|
static const __DRIextension *dri3_image_loader_extensions[] = {
|
||||||
&dri3_image_loader_extension.base,
|
&dri3_image_loader_extension.base,
|
||||||
&image_lookup_extension.base,
|
&image_lookup_extension.base,
|
||||||
@@ -2072,7 +2071,7 @@ dri2_initialize_x11(_EGLDisplay *disp)
|
|||||||
(disp->Options.Zink && !debug_get_bool_option("LIBGL_KOPPER_DISABLE", false)))
|
(disp->Options.Zink && !debug_get_bool_option("LIBGL_KOPPER_DISABLE", false)))
|
||||||
return dri2_initialize_x11_swrast(disp);
|
return dri2_initialize_x11_swrast(disp);
|
||||||
|
|
||||||
#ifdef HAVE_DRI3
|
#ifdef HAVE_LIBDRM
|
||||||
if (!debug_get_bool_option("LIBGL_DRI3_DISABLE", false)) {
|
if (!debug_get_bool_option("LIBGL_DRI3_DISABLE", false)) {
|
||||||
status = dri2_initialize_x11_dri3(disp);
|
status = dri2_initialize_x11_dri3(disp);
|
||||||
if (status == DRI2_EGL_DRIVER_LOADED)
|
if (status == DRI2_EGL_DRIVER_LOADED)
|
||||||
@@ -2093,7 +2092,7 @@ dri2_initialize_x11(_EGLDisplay *disp)
|
|||||||
void
|
void
|
||||||
dri2_teardown_x11(struct dri2_egl_display *dri2_dpy)
|
dri2_teardown_x11(struct dri2_egl_display *dri2_dpy)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_DRI3
|
#ifdef HAVE_LIBDRM
|
||||||
if (dri2_dpy->dri2_major >= 3)
|
if (dri2_dpy->dri2_major >= 3)
|
||||||
loader_destroy_screen_resources(&dri2_dpy->screen_resources);
|
loader_destroy_screen_resources(&dri2_dpy->screen_resources);
|
||||||
#endif
|
#endif
|
||||||
|
@@ -98,7 +98,7 @@ if with_dri
|
|||||||
|
|
||||||
if with_platform_x11
|
if with_platform_x11
|
||||||
files_egl += files('drivers/dri2/platform_x11.c')
|
files_egl += files('drivers/dri2/platform_x11.c')
|
||||||
if with_dri3
|
if with_dri_platform == 'drm'
|
||||||
files_egl += files('drivers/dri2/platform_x11_dri3.c')
|
files_egl += files('drivers/dri2/platform_x11_dri3.c')
|
||||||
link_for_egl += [libloader_x11]
|
link_for_egl += [libloader_x11]
|
||||||
endif
|
endif
|
||||||
|
@@ -437,9 +437,9 @@ if host_machine.system() == 'windows'
|
|||||||
else
|
else
|
||||||
files_libgalliumvlwinsys += files('vl/vl_winsys_drm.c')
|
files_libgalliumvlwinsys += files('vl/vl_winsys_drm.c')
|
||||||
endif
|
endif
|
||||||
if with_dri2 and with_platform_x11
|
if with_platform_x11
|
||||||
files_libgalliumvlwinsys += files('vl/vl_winsys_dri.c')
|
files_libgalliumvlwinsys += files('vl/vl_winsys_dri.c')
|
||||||
if with_dri3
|
if with_dri_platform == 'drm'
|
||||||
vlwinsys_deps += [
|
vlwinsys_deps += [
|
||||||
dep_xcb_sync, dep_xcb_present, dep_xshmfence, dep_xcb_xfixes,
|
dep_xcb_sync, dep_xcb_present, dep_xshmfence, dep_xcb_xfixes,
|
||||||
dep_xcb_dri3,
|
dep_xcb_dri3,
|
||||||
|
@@ -92,7 +92,7 @@ static inline struct vl_screen *
|
|||||||
vl_dri2_screen_create(void *display, int screen) { return NULL; };
|
vl_dri2_screen_create(void *display, int screen) { return NULL; };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_X11_PLATFORM) && defined(HAVE_DRI3)
|
#if defined(HAVE_X11_PLATFORM) && defined(HAVE_LIBDRM)
|
||||||
struct vl_screen *
|
struct vl_screen *
|
||||||
vl_dri3_screen_create(Display *display, int screen);
|
vl_dri3_screen_create(Display *display, int screen);
|
||||||
#else
|
#else
|
||||||
|
@@ -21,7 +21,7 @@ files_libdri = files(
|
|||||||
|
|
||||||
if with_platform_x11
|
if with_platform_x11
|
||||||
deps_for_libdri += dep_xcb
|
deps_for_libdri += dep_xcb
|
||||||
if with_dri3
|
if with_dri_platform == 'drm'
|
||||||
deps_for_libdri += [dep_xcb_dri3, dep_xcb_present, dep_xcb_sync,
|
deps_for_libdri += [dep_xcb_dri3, dep_xcb_present, dep_xcb_sync,
|
||||||
dep_xshmfence, dep_xcb_xfixes]
|
dep_xshmfence, dep_xcb_xfixes]
|
||||||
files_libdri += files('loader_dri3_helper.c')
|
files_libdri += files('loader_dri3_helper.c')
|
||||||
|
@@ -1207,7 +1207,7 @@ dri_device_create(int fd, uint32_t gbm_backend_version)
|
|||||||
|
|
||||||
struct dri_screen *screen = dri_screen(dri->screen);
|
struct dri_screen *screen = dri_screen(dri->screen);
|
||||||
struct pipe_screen *pscreen = screen->base.screen;
|
struct pipe_screen *pscreen = screen->base.screen;
|
||||||
#ifdef HAVE_DRI3
|
#ifdef HAVE_LIBDRM
|
||||||
if (pscreen->get_param(pscreen, PIPE_CAP_DMABUF) & DRM_PRIME_CAP_IMPORT)
|
if (pscreen->get_param(pscreen, PIPE_CAP_DMABUF) & DRM_PRIME_CAP_IMPORT)
|
||||||
dri->has_dmabuf_import = true;
|
dri->has_dmabuf_import = true;
|
||||||
if (pscreen->get_param(pscreen, PIPE_CAP_DMABUF) & DRM_PRIME_CAP_EXPORT)
|
if (pscreen->get_param(pscreen, PIPE_CAP_DMABUF) & DRM_PRIME_CAP_EXPORT)
|
||||||
|
@@ -42,7 +42,7 @@
|
|||||||
#define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0]))
|
#define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0]))
|
||||||
#define VER_MIN(a, b) ((a) < (b) ? (a) : (b))
|
#define VER_MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||||
|
|
||||||
#if defined(HAVE_DRI) || defined(HAVE_DRI2) || defined(HAVE_DRI3)
|
#ifdef HAVE_DRI
|
||||||
extern const struct gbm_backend gbm_dri_backend;
|
extern const struct gbm_backend gbm_dri_backend;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ struct gbm_backend_desc {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const struct gbm_backend_desc builtin_backends[] = {
|
static const struct gbm_backend_desc builtin_backends[] = {
|
||||||
#if defined(HAVE_DRI) || defined(HAVE_DRI2) || defined(HAVE_DRI3)
|
#ifdef HAVE_DRI
|
||||||
{ "dri", &gbm_dri_backend },
|
{ "dri", &gbm_dri_backend },
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
@@ -26,11 +26,6 @@
|
|||||||
#include "glxclient.h"
|
#include "glxclient.h"
|
||||||
#include "glx_error.h"
|
#include "glx_error.h"
|
||||||
#include "mesa_interface.h"
|
#include "mesa_interface.h"
|
||||||
#include "dri2_priv.h"
|
|
||||||
#if defined(HAVE_DRI3)
|
|
||||||
#include "dri3_priv.h"
|
|
||||||
#endif
|
|
||||||
#include "drisw_priv.h"
|
|
||||||
#include "dri_util.h"
|
#include "dri_util.h"
|
||||||
#include "dri_common.h"
|
#include "dri_common.h"
|
||||||
|
|
||||||
|
@@ -32,7 +32,7 @@
|
|||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include "dri_common.h"
|
#include "dri_common.h"
|
||||||
#include "drisw_priv.h"
|
#include "drisw_priv.h"
|
||||||
#ifdef HAVE_DRI3
|
#ifdef HAVE_LIBDRM
|
||||||
#include "dri3_priv.h"
|
#include "dri3_priv.h"
|
||||||
#endif
|
#endif
|
||||||
#include <X11/extensions/shmproto.h>
|
#include <X11/extensions/shmproto.h>
|
||||||
|
@@ -143,7 +143,7 @@ extern __GLXDRIdisplay *driwindowsCreateDisplay(Display * dpy);
|
|||||||
|
|
||||||
|
|
||||||
#if defined(GLX_DIRECT_RENDERING) && (!defined(GLX_USE_APPLEGL) || defined(GLX_USE_APPLE))
|
#if defined(GLX_DIRECT_RENDERING) && (!defined(GLX_USE_APPLEGL) || defined(GLX_USE_APPLE))
|
||||||
#ifdef HAVE_DRI3
|
#ifdef HAVE_LIBDRM
|
||||||
struct glx_screen *dri3_create_screen(int screen, struct glx_display * priv, bool driver_name_is_inferred, bool *return_zink);
|
struct glx_screen *dri3_create_screen(int screen, struct glx_display * priv, bool driver_name_is_inferred, bool *return_zink);
|
||||||
void dri3_destroy_display(__GLXDRIdisplay * dpy);
|
void dri3_destroy_display(__GLXDRIdisplay * dpy);
|
||||||
#endif
|
#endif
|
||||||
|
@@ -33,7 +33,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "loader_x11.h"
|
#include "loader_x11.h"
|
||||||
#ifdef HAVE_DRI3
|
#ifdef HAVE_LIBDRM
|
||||||
#include "loader_dri3_helper.h"
|
#include "loader_dri3_helper.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -870,7 +870,6 @@ AllocAndFetchScreenConfigs(Display * dpy, struct glx_display * priv, enum glx_dr
|
|||||||
psc = NULL;
|
psc = NULL;
|
||||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||||
#if defined(GLX_USE_DRM)
|
#if defined(GLX_USE_DRM)
|
||||||
#if defined(HAVE_DRI3)
|
|
||||||
if (glx_driver & GLX_DRIVER_DRI3) {
|
if (glx_driver & GLX_DRIVER_DRI3) {
|
||||||
bool use_zink;
|
bool use_zink;
|
||||||
psc = dri3_create_screen(i, priv, driver_name_is_inferred, &use_zink);
|
psc = dri3_create_screen(i, priv, driver_name_is_inferred, &use_zink);
|
||||||
@@ -880,7 +879,6 @@ AllocAndFetchScreenConfigs(Display * dpy, struct glx_display * priv, enum glx_dr
|
|||||||
driver_name_is_inferred = false;
|
driver_name_is_inferred = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* HAVE_DRI3 */
|
|
||||||
#if defined(HAVE_X11_DRI2)
|
#if defined(HAVE_X11_DRI2)
|
||||||
if (psc == NULL && glx_driver & GLX_DRIVER_DRI2 && dri2CheckSupport(dpy)) {
|
if (psc == NULL && glx_driver & GLX_DRIVER_DRI2 && dri2CheckSupport(dpy)) {
|
||||||
psc = dri2CreateScreen(i, priv, driver_name_is_inferred);
|
psc = dri2CreateScreen(i, priv, driver_name_is_inferred);
|
||||||
@@ -1015,7 +1013,6 @@ __glXInitialize(Display * dpy)
|
|||||||
dpyPriv->has_multibuffer = x11_dri3_check_multibuffer(XGetXCBConnection(dpy), &dri3_err, &dpyPriv->has_explicit_modifiers);
|
dpyPriv->has_multibuffer = x11_dri3_check_multibuffer(XGetXCBConnection(dpy), &dri3_err, &dpyPriv->has_explicit_modifiers);
|
||||||
if (glx_direct && glx_accel &&
|
if (glx_direct && glx_accel &&
|
||||||
(!(glx_driver & GLX_DRIVER_ZINK_YES) || !kopper)) {
|
(!(glx_driver & GLX_DRIVER_ZINK_YES) || !kopper)) {
|
||||||
#if defined(HAVE_DRI3)
|
|
||||||
if (dri3) {
|
if (dri3) {
|
||||||
/* dri3 is tried as long as this doesn't error; whether modifiers work is not relevant */
|
/* dri3 is tried as long as this doesn't error; whether modifiers work is not relevant */
|
||||||
if (!dri3_err) {
|
if (!dri3_err) {
|
||||||
@@ -1025,7 +1022,6 @@ __glXInitialize(Display * dpy)
|
|||||||
glx_driver |= GLX_DRIVER_ZINK_INFER;
|
glx_driver |= GLX_DRIVER_ZINK_INFER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* HAVE_DRI3 */
|
|
||||||
#if defined(HAVE_X11_DRI2)
|
#if defined(HAVE_X11_DRI2)
|
||||||
if (!debug_get_bool_option("LIBGL_DRI2_DISABLE", false))
|
if (!debug_get_bool_option("LIBGL_DRI2_DISABLE", false))
|
||||||
glx_driver |= GLX_DRIVER_DRI2;
|
glx_driver |= GLX_DRIVER_DRI2;
|
||||||
|
@@ -69,7 +69,7 @@ if with_x11_dri2
|
|||||||
)
|
)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if with_dri3
|
if with_dri_platform == 'drm'
|
||||||
files_libglx += files('dri3_glx.c', 'dri3_priv.h')
|
files_libglx += files('dri3_glx.c', 'dri3_priv.h')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@@ -210,7 +210,7 @@ wsi_device_init(struct wsi_device *wsi,
|
|||||||
WSI_GET_CB(WaitSemaphores);
|
WSI_GET_CB(WaitSemaphores);
|
||||||
#undef WSI_GET_CB
|
#undef WSI_GET_CB
|
||||||
|
|
||||||
#ifdef VK_USE_PLATFORM_XCB_KHR
|
#if defined(VK_USE_PLATFORM_XCB_KHR)
|
||||||
result = wsi_x11_init_wsi(wsi, alloc, dri_options);
|
result = wsi_x11_init_wsi(wsi, alloc, dri_options);
|
||||||
if (result != VK_SUCCESS)
|
if (result != VK_SUCCESS)
|
||||||
goto fail;
|
goto fail;
|
||||||
@@ -311,7 +311,7 @@ wsi_device_finish(struct wsi_device *wsi,
|
|||||||
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
||||||
wsi_win32_finish_wsi(wsi, alloc);
|
wsi_win32_finish_wsi(wsi, alloc);
|
||||||
#endif
|
#endif
|
||||||
#ifdef VK_USE_PLATFORM_XCB_KHR
|
#if defined(VK_USE_PLATFORM_XCB_KHR)
|
||||||
wsi_x11_finish_wsi(wsi, alloc);
|
wsi_x11_finish_wsi(wsi, alloc);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@@ -104,7 +104,7 @@ struct wsi_x11_vk_surface {
|
|||||||
};
|
};
|
||||||
bool has_alpha;
|
bool has_alpha;
|
||||||
};
|
};
|
||||||
|
#ifdef HAVE_X11_DRM
|
||||||
/**
|
/**
|
||||||
* Wrapper around xcb_dri3_open. Returns the opened fd or -1 on error.
|
* Wrapper around xcb_dri3_open. Returns the opened fd or -1 on error.
|
||||||
*/
|
*/
|
||||||
@@ -137,7 +137,6 @@ wsi_dri3_open(xcb_connection_t *conn,
|
|||||||
|
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks compatibility of the device wsi_dev with the device the X server
|
* Checks compatibility of the device wsi_dev with the device the X server
|
||||||
* provides via DRI3.
|
* provides via DRI3.
|
||||||
@@ -166,6 +165,7 @@ wsi_x11_check_dri3_compatible(const struct wsi_device *wsi_dev,
|
|||||||
|
|
||||||
return match;
|
return match;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
wsi_x11_detect_xwayland(xcb_connection_t *conn,
|
wsi_x11_detect_xwayland(xcb_connection_t *conn,
|
||||||
@@ -347,6 +347,7 @@ wsi_x11_connection_create(struct wsi_device *wsi_dev,
|
|||||||
wsi_conn->is_proprietary_x11 = true;
|
wsi_conn->is_proprietary_x11 = true;
|
||||||
|
|
||||||
wsi_conn->has_mit_shm = false;
|
wsi_conn->has_mit_shm = false;
|
||||||
|
#ifdef HAVE_X11_DRM
|
||||||
if (wsi_conn->has_dri3 && wsi_conn->has_present && wants_shm) {
|
if (wsi_conn->has_dri3 && wsi_conn->has_present && wants_shm) {
|
||||||
bool has_mit_shm = shm_reply->present != 0;
|
bool has_mit_shm = shm_reply->present != 0;
|
||||||
|
|
||||||
@@ -370,6 +371,7 @@ wsi_x11_connection_create(struct wsi_device *wsi_dev,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
free(dri3_reply);
|
free(dri3_reply);
|
||||||
free(pres_reply);
|
free(pres_reply);
|
||||||
@@ -1234,10 +1236,10 @@ x11_get_wsi_image(struct wsi_swapchain *wsi_chain, uint32_t image_index)
|
|||||||
struct x11_swapchain *chain = (struct x11_swapchain *)wsi_chain;
|
struct x11_swapchain *chain = (struct x11_swapchain *)wsi_chain;
|
||||||
return &chain->images[image_index].base;
|
return &chain->images[image_index].base;
|
||||||
}
|
}
|
||||||
|
#ifdef HAVE_DRI3_MODIFIERS
|
||||||
static bool
|
static bool
|
||||||
wsi_x11_swapchain_query_dri3_modifiers_changed(struct x11_swapchain *chain);
|
wsi_x11_swapchain_query_dri3_modifiers_changed(struct x11_swapchain *chain);
|
||||||
|
#endif
|
||||||
static VkResult
|
static VkResult
|
||||||
x11_wait_for_explicit_sync_release_submission(struct x11_swapchain *chain,
|
x11_wait_for_explicit_sync_release_submission(struct x11_swapchain *chain,
|
||||||
uint64_t rel_timeout_ns,
|
uint64_t rel_timeout_ns,
|
||||||
@@ -1365,7 +1367,7 @@ x11_handle_dri3_present_event(struct x11_swapchain *chain,
|
|||||||
|
|
||||||
return VK_SUCCESS;
|
return VK_SUCCESS;
|
||||||
}
|
}
|
||||||
|
#ifdef HAVE_X11_DRM
|
||||||
/**
|
/**
|
||||||
* Send image to X server via Present extension.
|
* Send image to X server via Present extension.
|
||||||
*/
|
*/
|
||||||
@@ -1465,7 +1467,7 @@ x11_present_to_x11_dri3(struct x11_swapchain *chain, uint32_t image_index,
|
|||||||
xcb_flush(chain->conn);
|
xcb_flush(chain->conn);
|
||||||
return x11_swapchain_result(chain, VK_SUCCESS);
|
return x11_swapchain_result(chain, VK_SUCCESS);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
/**
|
/**
|
||||||
* Send image to X server unaccelerated (software drivers).
|
* Send image to X server unaccelerated (software drivers).
|
||||||
*/
|
*/
|
||||||
@@ -1691,7 +1693,11 @@ x11_present_to_x11(struct x11_swapchain *chain, uint32_t image_index,
|
|||||||
if (chain->base.wsi->sw && !chain->has_mit_shm)
|
if (chain->base.wsi->sw && !chain->has_mit_shm)
|
||||||
result = x11_present_to_x11_sw(chain, image_index);
|
result = x11_present_to_x11_sw(chain, image_index);
|
||||||
else
|
else
|
||||||
|
#ifdef HAVE_X11_DRM
|
||||||
result = x11_present_to_x11_dri3(chain, image_index, target_msc, present_mode);
|
result = x11_present_to_x11_dri3(chain, image_index, target_msc, present_mode);
|
||||||
|
#else
|
||||||
|
unreachable("X11 missing DRI3 support!");
|
||||||
|
#endif
|
||||||
|
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
x11_swapchain_notify_error(chain, result);
|
x11_swapchain_notify_error(chain, result);
|
||||||
@@ -1771,9 +1777,11 @@ x11_acquire_next_image(struct wsi_swapchain *anv_chain,
|
|||||||
return result;
|
return result;
|
||||||
|
|
||||||
assert(*image_index < chain->base.image_count);
|
assert(*image_index < chain->base.image_count);
|
||||||
|
#ifdef HAVE_X11_DRM
|
||||||
if (chain->images[*image_index].shm_fence &&
|
if (chain->images[*image_index].shm_fence &&
|
||||||
!chain->base.image_info.explicit_sync)
|
!chain->base.image_info.explicit_sync)
|
||||||
xshmfence_await(chain->images[*image_index].shm_fence);
|
xshmfence_await(chain->images[*image_index].shm_fence);
|
||||||
|
#endif
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -2055,25 +2063,25 @@ x11_image_init(VkDevice device_h, struct x11_swapchain *chain,
|
|||||||
const VkAllocationCallbacks* pAllocator,
|
const VkAllocationCallbacks* pAllocator,
|
||||||
struct x11_image *image)
|
struct x11_image *image)
|
||||||
{
|
{
|
||||||
xcb_void_cookie_t cookie;
|
|
||||||
xcb_generic_error_t *error = NULL;
|
|
||||||
VkResult result;
|
VkResult result;
|
||||||
uint32_t bpp = 32;
|
|
||||||
int fence_fd;
|
|
||||||
|
|
||||||
result = wsi_create_image(&chain->base, &chain->base.image_info,
|
result = wsi_create_image(&chain->base, &chain->base.image_info,
|
||||||
&image->base);
|
&image->base);
|
||||||
if (result != VK_SUCCESS)
|
if (result != VK_SUCCESS)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
if (chain->base.wsi->sw && !chain->has_mit_shm)
|
||||||
|
return VK_SUCCESS;
|
||||||
|
|
||||||
|
#ifdef HAVE_X11_DRM
|
||||||
|
xcb_void_cookie_t cookie;
|
||||||
|
xcb_generic_error_t *error = NULL;
|
||||||
|
uint32_t bpp = 32;
|
||||||
|
int fence_fd;
|
||||||
image->update_region = xcb_generate_id(chain->conn);
|
image->update_region = xcb_generate_id(chain->conn);
|
||||||
xcb_xfixes_create_region(chain->conn, image->update_region, 0, NULL);
|
xcb_xfixes_create_region(chain->conn, image->update_region, 0, NULL);
|
||||||
|
|
||||||
if (chain->base.wsi->sw) {
|
if (chain->base.wsi->sw) {
|
||||||
if (!chain->has_mit_shm) {
|
|
||||||
return VK_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
image->shmseg = xcb_generate_id(chain->conn);
|
image->shmseg = xcb_generate_id(chain->conn);
|
||||||
|
|
||||||
xcb_shm_attach(chain->conn,
|
xcb_shm_attach(chain->conn,
|
||||||
@@ -2194,7 +2202,6 @@ out_fence:
|
|||||||
fence_fd);
|
fence_fd);
|
||||||
|
|
||||||
xshmfence_trigger(image->shm_fence);
|
xshmfence_trigger(image->shm_fence);
|
||||||
|
|
||||||
return VK_SUCCESS;
|
return VK_SUCCESS;
|
||||||
|
|
||||||
fail_shmfence_alloc:
|
fail_shmfence_alloc:
|
||||||
@@ -2207,6 +2214,9 @@ fail_pixmap:
|
|||||||
fail_image:
|
fail_image:
|
||||||
wsi_destroy_image(&chain->base, &image->base);
|
wsi_destroy_image(&chain->base, &image->base);
|
||||||
|
|
||||||
|
#else
|
||||||
|
unreachable("SHM support not compiled in");
|
||||||
|
#endif
|
||||||
return VK_ERROR_INITIALIZATION_FAILED;
|
return VK_ERROR_INITIALIZATION_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2216,18 +2226,19 @@ x11_image_finish(struct x11_swapchain *chain,
|
|||||||
struct x11_image *image)
|
struct x11_image *image)
|
||||||
{
|
{
|
||||||
xcb_void_cookie_t cookie;
|
xcb_void_cookie_t cookie;
|
||||||
|
|
||||||
if (!chain->base.wsi->sw || chain->has_mit_shm) {
|
if (!chain->base.wsi->sw || chain->has_mit_shm) {
|
||||||
|
#ifdef HAVE_X11_DRM
|
||||||
cookie = xcb_sync_destroy_fence(chain->conn, image->sync_fence);
|
cookie = xcb_sync_destroy_fence(chain->conn, image->sync_fence);
|
||||||
xcb_discard_reply(chain->conn, cookie.sequence);
|
xcb_discard_reply(chain->conn, cookie.sequence);
|
||||||
xshmfence_unmap_shm(image->shm_fence);
|
xshmfence_unmap_shm(image->shm_fence);
|
||||||
|
#endif
|
||||||
|
|
||||||
cookie = xcb_free_pixmap(chain->conn, image->pixmap);
|
cookie = xcb_free_pixmap(chain->conn, image->pixmap);
|
||||||
xcb_discard_reply(chain->conn, cookie.sequence);
|
xcb_discard_reply(chain->conn, cookie.sequence);
|
||||||
|
#ifdef HAVE_X11_DRM
|
||||||
cookie = xcb_xfixes_destroy_region(chain->conn, image->update_region);
|
cookie = xcb_xfixes_destroy_region(chain->conn, image->update_region);
|
||||||
xcb_discard_reply(chain->conn, cookie.sequence);
|
xcb_discard_reply(chain->conn, cookie.sequence);
|
||||||
|
#endif
|
||||||
#ifdef HAVE_DRI3_EXPLICIT_SYNC
|
#ifdef HAVE_DRI3_EXPLICIT_SYNC
|
||||||
if (chain->base.image_info.explicit_sync) {
|
if (chain->base.image_info.explicit_sync) {
|
||||||
for (uint32_t i = 0; i < WSI_ES_COUNT; i++) {
|
for (uint32_t i = 0; i < WSI_ES_COUNT; i++) {
|
||||||
@@ -2335,7 +2346,7 @@ wsi_x11_get_dri3_modifiers(struct wsi_x11_connection *wsi_conn,
|
|||||||
out:
|
out:
|
||||||
*num_tranches_in = 0;
|
*num_tranches_in = 0;
|
||||||
}
|
}
|
||||||
|
#ifdef HAVE_DRI3_MODIFIERS
|
||||||
static bool
|
static bool
|
||||||
wsi_x11_swapchain_query_dri3_modifiers_changed(struct x11_swapchain *chain)
|
wsi_x11_swapchain_query_dri3_modifiers_changed(struct x11_swapchain *chain)
|
||||||
{
|
{
|
||||||
@@ -2380,13 +2391,12 @@ wsi_x11_swapchain_query_dri3_modifiers_changed(struct x11_swapchain *chain)
|
|||||||
|
|
||||||
return memcmp(hash, chain->dri3_modifier_hash, sizeof(hash)) != 0;
|
return memcmp(hash, chain->dri3_modifier_hash, sizeof(hash)) != 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
static VkResult
|
static VkResult
|
||||||
x11_swapchain_destroy(struct wsi_swapchain *anv_chain,
|
x11_swapchain_destroy(struct wsi_swapchain *anv_chain,
|
||||||
const VkAllocationCallbacks *pAllocator)
|
const VkAllocationCallbacks *pAllocator)
|
||||||
{
|
{
|
||||||
struct x11_swapchain *chain = (struct x11_swapchain *)anv_chain;
|
struct x11_swapchain *chain = (struct x11_swapchain *)anv_chain;
|
||||||
xcb_void_cookie_t cookie;
|
|
||||||
|
|
||||||
mtx_lock(&chain->thread_state_lock);
|
mtx_lock(&chain->thread_state_lock);
|
||||||
chain->status = VK_ERROR_OUT_OF_DATE_KHR;
|
chain->status = VK_ERROR_OUT_OF_DATE_KHR;
|
||||||
@@ -2404,13 +2414,14 @@ x11_swapchain_destroy(struct wsi_swapchain *anv_chain,
|
|||||||
|
|
||||||
for (uint32_t i = 0; i < chain->base.image_count; i++)
|
for (uint32_t i = 0; i < chain->base.image_count; i++)
|
||||||
x11_image_finish(chain, pAllocator, &chain->images[i]);
|
x11_image_finish(chain, pAllocator, &chain->images[i]);
|
||||||
|
#ifdef HAVE_X11_DRM
|
||||||
|
xcb_void_cookie_t cookie;
|
||||||
xcb_unregister_for_special_event(chain->conn, chain->special_event);
|
xcb_unregister_for_special_event(chain->conn, chain->special_event);
|
||||||
cookie = xcb_present_select_input_checked(chain->conn, chain->event_id,
|
cookie = xcb_present_select_input_checked(chain->conn, chain->event_id,
|
||||||
chain->window,
|
chain->window,
|
||||||
XCB_PRESENT_EVENT_MASK_NO_EVENT);
|
XCB_PRESENT_EVENT_MASK_NO_EVENT);
|
||||||
xcb_discard_reply(chain->conn, cookie.sequence);
|
xcb_discard_reply(chain->conn, cookie.sequence);
|
||||||
|
#endif
|
||||||
mtx_destroy(&chain->present_progress_mutex);
|
mtx_destroy(&chain->present_progress_mutex);
|
||||||
u_cnd_monotonic_destroy(&chain->present_progress_cond);
|
u_cnd_monotonic_destroy(&chain->present_progress_cond);
|
||||||
mtx_destroy(&chain->thread_state_lock);
|
mtx_destroy(&chain->thread_state_lock);
|
||||||
@@ -2598,6 +2609,7 @@ x11_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32_t present_caps = 0;
|
uint32_t present_caps = 0;
|
||||||
|
#ifdef HAVE_X11_DRM
|
||||||
xcb_present_query_capabilities_cookie_t present_query_cookie;
|
xcb_present_query_capabilities_cookie_t present_query_cookie;
|
||||||
xcb_present_query_capabilities_reply_t *present_query_reply;
|
xcb_present_query_capabilities_reply_t *present_query_reply;
|
||||||
present_query_cookie = xcb_present_query_capabilities(conn, window);
|
present_query_cookie = xcb_present_query_capabilities(conn, window);
|
||||||
@@ -2606,12 +2618,11 @@ x11_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
|
|||||||
present_caps = present_query_reply->capabilities;
|
present_caps = present_query_reply->capabilities;
|
||||||
free(present_query_reply);
|
free(present_query_reply);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
struct wsi_base_image_params *image_params = NULL;
|
struct wsi_base_image_params *image_params = NULL;
|
||||||
struct wsi_cpu_image_params cpu_image_params;
|
struct wsi_cpu_image_params cpu_image_params;
|
||||||
struct wsi_drm_image_params drm_image_params;
|
|
||||||
uint64_t *modifiers[2] = {NULL, NULL};
|
uint64_t *modifiers[2] = {NULL, NULL};
|
||||||
uint32_t num_modifiers[2] = {0, 0};
|
|
||||||
if (wsi_device->sw) {
|
if (wsi_device->sw) {
|
||||||
cpu_image_params = (struct wsi_cpu_image_params) {
|
cpu_image_params = (struct wsi_cpu_image_params) {
|
||||||
.base.image_type = WSI_IMAGE_TYPE_CPU,
|
.base.image_type = WSI_IMAGE_TYPE_CPU,
|
||||||
@@ -2619,7 +2630,9 @@ x11_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
|
|||||||
};
|
};
|
||||||
image_params = &cpu_image_params.base;
|
image_params = &cpu_image_params.base;
|
||||||
} else {
|
} else {
|
||||||
drm_image_params = (struct wsi_drm_image_params) {
|
#ifdef HAVE_X11_DRM
|
||||||
|
uint32_t num_modifiers[2] = {0, 0};
|
||||||
|
struct wsi_drm_image_params drm_image_params = {
|
||||||
.base.image_type = WSI_IMAGE_TYPE_DRM,
|
.base.image_type = WSI_IMAGE_TYPE_DRM,
|
||||||
.same_gpu = wsi_x11_check_dri3_compatible(wsi_device, conn),
|
.same_gpu = wsi_x11_check_dri3_compatible(wsi_device, conn),
|
||||||
.explicit_sync =
|
.explicit_sync =
|
||||||
@@ -2642,6 +2655,9 @@ x11_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
|
|||||||
wsi_x11_recompute_dri3_modifier_hash(&chain->dri3_modifier_hash, &drm_image_params);
|
wsi_x11_recompute_dri3_modifier_hash(&chain->dri3_modifier_hash, &drm_image_params);
|
||||||
}
|
}
|
||||||
image_params = &drm_image_params.base;
|
image_params = &drm_image_params.base;
|
||||||
|
#else
|
||||||
|
unreachable("X11 DRM support missing!");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
result = wsi_swapchain_init(wsi_device, &chain->base, device, pCreateInfo,
|
result = wsi_swapchain_init(wsi_device, &chain->base, device, pCreateInfo,
|
||||||
@@ -2701,7 +2717,7 @@ x11_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
|
|||||||
* 'PresentOptionSuboptimal' complete mode.
|
* 'PresentOptionSuboptimal' complete mode.
|
||||||
*/
|
*/
|
||||||
chain->copy_is_suboptimal = false;
|
chain->copy_is_suboptimal = false;
|
||||||
|
#ifdef HAVE_X11_DRM
|
||||||
/* For our swapchain we need to listen to following Present extension events:
|
/* For our swapchain we need to listen to following Present extension events:
|
||||||
* - Configure: Window dimensions changed. Images in the swapchain might need
|
* - Configure: Window dimensions changed. Images in the swapchain might need
|
||||||
* to be reallocated.
|
* to be reallocated.
|
||||||
@@ -2722,7 +2738,7 @@ x11_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
|
|||||||
chain->special_event =
|
chain->special_event =
|
||||||
xcb_register_for_special_xge(chain->conn, &xcb_present_id,
|
xcb_register_for_special_xge(chain->conn, &xcb_present_id,
|
||||||
chain->event_id, NULL);
|
chain->event_id, NULL);
|
||||||
|
#endif
|
||||||
/* Create the graphics context. */
|
/* Create the graphics context. */
|
||||||
chain->gc = xcb_generate_id(chain->conn);
|
chain->gc = xcb_generate_id(chain->conn);
|
||||||
if (!chain->gc) {
|
if (!chain->gc) {
|
||||||
@@ -2802,8 +2818,9 @@ fail_init_images:
|
|||||||
x11_image_finish(chain, pAllocator, &chain->images[j]);
|
x11_image_finish(chain, pAllocator, &chain->images[j]);
|
||||||
|
|
||||||
fail_register:
|
fail_register:
|
||||||
|
#ifdef HAVE_X11_DRM
|
||||||
xcb_unregister_for_special_event(chain->conn, chain->special_event);
|
xcb_unregister_for_special_event(chain->conn, chain->special_event);
|
||||||
|
#endif
|
||||||
wsi_swapchain_finish(&chain->base);
|
wsi_swapchain_finish(&chain->base);
|
||||||
|
|
||||||
fail_alloc:
|
fail_alloc:
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
inc_loader_x11 = include_directories('.')
|
inc_loader_x11 = include_directories('.')
|
||||||
|
|
||||||
if with_platform_x11 and with_dri3
|
if with_platform_x11 and with_dri_platform == 'drm'
|
||||||
libloader_x11 = static_library(
|
libloader_x11 = static_library(
|
||||||
'loader_x11',
|
'loader_x11',
|
||||||
'loader_x11.c',
|
'loader_x11.c',
|
||||||
|
Reference in New Issue
Block a user