aboutsummaryrefslogtreecommitdiff
path: root/backend/drm/drm.c
diff options
context:
space:
mode:
Diffstat (limited to 'backend/drm/drm.c')
-rw-r--r--backend/drm/drm.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index 9d030dff..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;
@@ -628,7 +645,6 @@ static bool drm_connector_set_cursor(struct wlr_output *output,
bool update_texture) {
struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output;
struct wlr_drm_backend *drm = (struct wlr_drm_backend *)output->backend;
- struct wlr_drm_renderer *renderer = &drm->renderer;
struct wlr_drm_crtc *crtc = conn->crtc;
if (!crtc) {
@@ -654,13 +670,16 @@ static bool drm_connector_set_cursor(struct wlr_output *output,
ret = drmGetCap(drm->fd, DRM_CAP_CURSOR_HEIGHT, &h);
h = ret ? 64 : h;
+ struct wlr_drm_renderer *renderer =
+ drm->parent ? &drm->parent->renderer : &drm->renderer;
+
if (!init_drm_surface(&plane->surf, renderer, w, h,
GBM_FORMAT_ARGB8888, 0)) {
wlr_log(WLR_ERROR, "Cannot allocate cursor resources");
return false;
}
- plane->cursor_bo = gbm_bo_create(renderer->gbm, w, h,
+ plane->cursor_bo = gbm_bo_create(drm->renderer.gbm, w, h,
GBM_FORMAT_ARGB8888, GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE);
if (!plane->cursor_bo) {
wlr_log_errno(WLR_ERROR, "Failed to create cursor bo");