mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 12:55:58 +01:00
drm: check for PRIME support
PRIME support for buffer sharing has become mandatory since the renderer rewrite. Make sure we check for the appropriate capabilities in backend, allocator and renderer. See also #2819.
This commit is contained in:
parent
d5105c42e3
commit
9f012cac2f
3 changed files with 18 additions and 7 deletions
|
@ -30,14 +30,13 @@
|
||||||
|
|
||||||
bool check_drm_features(struct wlr_drm_backend *drm) {
|
bool check_drm_features(struct wlr_drm_backend *drm) {
|
||||||
uint64_t cap;
|
uint64_t cap;
|
||||||
if (drm->parent) {
|
if (drmGetCap(drm->fd, DRM_CAP_PRIME, &cap) ||
|
||||||
if (drmGetCap(drm->fd, DRM_CAP_PRIME, &cap) ||
|
!(cap & DRM_PRIME_CAP_IMPORT)) {
|
||||||
!(cap & DRM_PRIME_CAP_IMPORT)) {
|
wlr_log(WLR_ERROR, "PRIME import not supported");
|
||||||
wlr_log(WLR_ERROR,
|
return false;
|
||||||
"PRIME import not supported on secondary GPU");
|
}
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (drm->parent) {
|
||||||
if (drmGetCap(drm->parent->fd, DRM_CAP_PRIME, &cap) ||
|
if (drmGetCap(drm->parent->fd, DRM_CAP_PRIME, &cap) ||
|
||||||
!(cap & DRM_PRIME_CAP_EXPORT)) {
|
!(cap & DRM_PRIME_CAP_EXPORT)) {
|
||||||
wlr_log(WLR_ERROR,
|
wlr_log(WLR_ERROR,
|
||||||
|
|
|
@ -160,6 +160,13 @@ static struct wlr_gbm_allocator *get_gbm_alloc_from_alloc(
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_gbm_allocator *wlr_gbm_allocator_create(int fd) {
|
struct wlr_gbm_allocator *wlr_gbm_allocator_create(int fd) {
|
||||||
|
uint64_t cap;
|
||||||
|
if (drmGetCap(fd, DRM_CAP_PRIME, &cap) ||
|
||||||
|
!(cap & DRM_PRIME_CAP_EXPORT)) {
|
||||||
|
wlr_log(WLR_ERROR, "PRIME export not supported");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
struct wlr_gbm_allocator *alloc = calloc(1, sizeof(*alloc));
|
struct wlr_gbm_allocator *alloc = calloc(1, sizeof(*alloc));
|
||||||
if (alloc == NULL) {
|
if (alloc == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -746,6 +746,11 @@ struct wlr_renderer *wlr_gles2_renderer_create(struct wlr_egl *egl) {
|
||||||
wlr_log(WLR_INFO, "GL renderer: %s", glGetString(GL_RENDERER));
|
wlr_log(WLR_INFO, "GL renderer: %s", glGetString(GL_RENDERER));
|
||||||
wlr_log(WLR_INFO, "Supported GLES2 extensions: %s", exts_str);
|
wlr_log(WLR_INFO, "Supported GLES2 extensions: %s", exts_str);
|
||||||
|
|
||||||
|
if (!renderer->egl->exts.image_dmabuf_import_ext) {
|
||||||
|
wlr_log(WLR_ERROR, "EGL_EXT_image_dma_buf_import not supported");
|
||||||
|
free(renderer);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
if (!check_gl_ext(exts_str, "GL_EXT_texture_format_BGRA8888")) {
|
if (!check_gl_ext(exts_str, "GL_EXT_texture_format_BGRA8888")) {
|
||||||
wlr_log(WLR_ERROR, "BGRA8888 format not supported by GLES2");
|
wlr_log(WLR_ERROR, "BGRA8888 format not supported by GLES2");
|
||||||
free(renderer);
|
free(renderer);
|
||||||
|
|
Loading…
Reference in a new issue