aboutsummaryrefslogtreecommitdiff
path: root/backend/drm
diff options
context:
space:
mode:
authorScott Anderson <scott@anderso.nz>2018-08-05 18:25:25 +1200
committerScott Anderson <scott@anderso.nz>2018-08-05 18:25:25 +1200
commit2d8f53affd586709fe568b0b16e4c7e215d9db7a (patch)
tree390a6534733984595335ea3c5a279a4317346caf /backend/drm
parente8fa25e0276e179015c8bcd70e857734cb32ab08 (diff)
Check for DRM prime
This will indicate the user properly when multi-GPU is not supported by their GPU driver.
Diffstat (limited to 'backend/drm')
-rw-r--r--backend/drm/drm.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index c050a356..a666ce71 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -27,6 +27,23 @@
#include "util/signal.h"
bool check_drm_features(struct wlr_drm_backend *drm) {
+ if (drm->parent) {
+ uint64_t cap;
+ if (drmGetCap(drm->fd, DRM_CAP_PRIME, &cap) ||
+ !(cap & DRM_PRIME_CAP_IMPORT)) {
+ wlr_log(WLR_ERROR,
+ "PRIME import not supported on secondary GPU");
+ return false;
+ }
+
+ if (drmGetCap(drm->parent->fd, DRM_CAP_PRIME, &cap) ||
+ !(cap & DRM_PRIME_CAP_EXPORT)) {
+ wlr_log(WLR_ERROR,
+ "PRIME export not supported on primary GPU");
+ return false;
+ }
+ }
+
if (drmSetClientCap(drm->fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1)) {
wlr_log(WLR_ERROR, "DRM universal planes unsupported");
return false;