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 Mar 24, 2020
1 parent 8707a9b commit 6356a28
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
21 changes: 18 additions & 3 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 @@ -355,10 +356,24 @@ static bool gles2_init_wl_display(struct wlr_renderer *wlr_renderer,
struct wl_display *wl_display) {
struct wlr_gles2_renderer *renderer =
gles2_get_renderer(wlr_renderer);
if (!wlr_egl_bind_display(renderer->egl, wl_display)) {
wlr_log(WLR_INFO, "failed to bind wl_display to EGL");
return false;

if (renderer->egl->exts.bind_wayland_display_wl) {
if (!wlr_egl_bind_display(renderer->egl, wl_display)) {
wlr_log(WLR_ERROR, "Failed to bind wl_display to EGL");
return false;
}
} else {
wlr_log(WLR_DEBUG, "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_DEBUG, "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 6356a28

Please sign in to comment.