Skip to content

Commit

Permalink
render: only expose linux-dmabuf if EGL extension is supported
Browse files Browse the repository at this point in the history
Only expose linux-dmabuf extension if EGL_EXT_image_dmabuf_import_ext is
supported.

Closes: swaywm#2076
  • Loading branch information
emersion committed Apr 8, 2020
1 parent 5cbc84f commit 3b4c471
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
10 changes: 10 additions & 0 deletions render/gles2/renderer.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <wlr/render/interface.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_matrix.h>
#include <wlr/types/wlr_linux_dmabuf_v1.h>
#include <wlr/util/log.h>
#include "render/gles2.h"

Expand Down Expand Up @@ -364,6 +365,15 @@ static bool gles2_init_wl_display(struct wlr_renderer *wlr_renderer,
} else {
wlr_log(WLR_INFO, "EGL_WL_bind_wayland_display is not supported");
}

if (renderer->egl->exts.image_dmabuf_import_ext) {
if (wlr_linux_dmabuf_v1_create(wl_display, wlr_renderer) == NULL) {
return false;
}
} else {
wlr_log(WLR_INFO, "EGL_EXT_image_dma_buf_import is not supported");
}

return true;
}

Expand Down
7 changes: 0 additions & 7 deletions render/wlr_renderer.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include <wlr/render/gles2.h>
#include <wlr/render/interface.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_linux_dmabuf_v1.h>
#include <wlr/types/wlr_matrix.h>
#include <wlr/util/log.h>
#include "util/signal.h"
Expand Down Expand Up @@ -182,12 +181,6 @@ bool wlr_renderer_init_wl_display(struct wlr_renderer *r,
}
}

if (r->impl->texture_from_dmabuf) {
if (wlr_linux_dmabuf_v1_create(wl_display, r) == NULL) {
return false;
}
}

if (r->impl->init_wl_display) {
if (!r->impl->init_wl_display(r, wl_display)) {
return false;
Expand Down

0 comments on commit 3b4c471

Please sign in to comment.