aboutsummaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
Diffstat (limited to 'render')
-rw-r--r--render/gles2/renderer.c8
-rw-r--r--render/gles2/texture.c18
-rw-r--r--render/meson.build8
-rw-r--r--render/wlr_renderer.c7
4 files changed, 27 insertions, 14 deletions
diff --git a/render/gles2/renderer.c b/render/gles2/renderer.c
index 27c16e52..b6e97041 100644
--- a/render/gles2/renderer.c
+++ b/render/gles2/renderer.c
@@ -116,7 +116,7 @@ static bool gles2_render_texture_with_matrix(struct wlr_renderer *wlr_renderer,
struct wlr_gles2_renderer *renderer =
gles2_get_renderer_in_context(wlr_renderer);
struct wlr_gles2_texture *texture =
- get_gles2_texture_in_context(wlr_texture);
+ gles2_get_texture(wlr_texture);
struct wlr_gles2_tex_shader *shader = NULL;
GLenum target = 0;
@@ -213,7 +213,7 @@ static const enum wl_shm_format *gles2_renderer_formats(
static bool gles2_resource_is_wl_drm_buffer(struct wlr_renderer *wlr_renderer,
struct wl_resource *resource) {
struct wlr_gles2_renderer *renderer =
- gles2_get_renderer_in_context(wlr_renderer);
+ gles2_get_renderer(wlr_renderer);
if (!eglQueryWaylandBufferWL) {
return false;
@@ -227,7 +227,7 @@ static bool gles2_resource_is_wl_drm_buffer(struct wlr_renderer *wlr_renderer,
static void gles2_wl_drm_buffer_get_size(struct wlr_renderer *wlr_renderer,
struct wl_resource *buffer, int *width, int *height) {
struct wlr_gles2_renderer *renderer =
- gles2_get_renderer_in_context(wlr_renderer);
+ gles2_get_renderer(wlr_renderer);
if (!eglQueryWaylandBufferWL) {
return;
@@ -323,7 +323,7 @@ static struct wlr_texture *gles2_texture_from_dmabuf(
static void gles2_init_wl_display(struct wlr_renderer *wlr_renderer,
struct wl_display *wl_display) {
struct wlr_gles2_renderer *renderer =
- gles2_get_renderer_in_context(wlr_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");
}
diff --git a/render/gles2/texture.c b/render/gles2/texture.c
index 1e55f4c4..22d02cde 100644
--- a/render/gles2/texture.c
+++ b/render/gles2/texture.c
@@ -16,7 +16,7 @@
static const struct wlr_texture_impl texture_impl;
-static struct wlr_gles2_texture *gles2_get_texture(
+struct wlr_gles2_texture *gles2_get_texture(
struct wlr_texture *wlr_texture) {
assert(wlr_texture->impl == &texture_impl);
return (struct wlr_gles2_texture *)wlr_texture;
@@ -25,7 +25,9 @@ static struct wlr_gles2_texture *gles2_get_texture(
struct wlr_gles2_texture *get_gles2_texture_in_context(
struct wlr_texture *wlr_texture) {
struct wlr_gles2_texture *texture = gles2_get_texture(wlr_texture);
- assert(wlr_egl_is_current(texture->egl));
+ if (!wlr_egl_is_current(texture->egl)) {
+ wlr_egl_make_current(texture->egl, EGL_NO_SURFACE, NULL);
+ }
return texture;
}
@@ -143,7 +145,9 @@ static const struct wlr_texture_impl texture_impl = {
struct wlr_texture *wlr_gles2_texture_from_pixels(struct wlr_egl *egl,
enum wl_shm_format wl_fmt, uint32_t stride, uint32_t width,
uint32_t height, const void *data) {
- assert(wlr_egl_is_current(egl));
+ if (!wlr_egl_is_current(egl)) {
+ wlr_egl_make_current(egl, EGL_NO_SURFACE, NULL);
+ }
const struct wlr_gles2_pixel_format *fmt = get_gles2_format_from_wl(wl_fmt);
if (fmt == NULL) {
@@ -180,7 +184,9 @@ struct wlr_texture *wlr_gles2_texture_from_pixels(struct wlr_egl *egl,
struct wlr_texture *wlr_gles2_texture_from_wl_drm(struct wlr_egl *egl,
struct wl_resource *data) {
- assert(wlr_egl_is_current(egl));
+ if (!wlr_egl_is_current(egl)) {
+ wlr_egl_make_current(egl, EGL_NO_SURFACE, NULL);
+ }
if (!glEGLImageTargetTexture2DOES) {
return NULL;
@@ -239,7 +245,9 @@ struct wlr_texture *wlr_gles2_texture_from_wl_drm(struct wlr_egl *egl,
struct wlr_texture *wlr_gles2_texture_from_dmabuf(struct wlr_egl *egl,
struct wlr_dmabuf_attributes *attribs) {
- assert(wlr_egl_is_current(egl));
+ if (!wlr_egl_is_current(egl)) {
+ wlr_egl_make_current(egl, EGL_NO_SURFACE, NULL);
+ }
if (!glEGLImageTargetTexture2DOES) {
return NULL;
diff --git a/render/meson.build b/render/meson.build
index 4b90c229..ab66eab0 100644
--- a/render/meson.build
+++ b/render/meson.build
@@ -1,9 +1,10 @@
glgen = find_program('../glgen.sh')
-glapi = custom_target('glapi',
+glapi = custom_target(
+ 'glapi',
input: 'glapi.txt',
output: ['@BASENAME@.c', '@BASENAME@.h'],
- command: [glgen, '@INPUT@', '@OUTPUT0@', '@OUTPUT1@'],
+ command: [glgen, '@INPUT@', '@OUTDIR@'],
)
lib_wlr_render = static_library(
@@ -19,8 +20,7 @@ lib_wlr_render = static_library(
'wlr_renderer.c',
'wlr_texture.c',
),
- glapi[0],
- glapi[1],
+ glapi,
include_directories: wlr_inc,
dependencies: [egl, glesv2, pixman, wayland_server],
)
diff --git a/render/wlr_renderer.c b/render/wlr_renderer.c
index 6c2b9fbb..31bf2b18 100644
--- a/render/wlr_renderer.c
+++ b/render/wlr_renderer.c
@@ -1,10 +1,11 @@
#include <assert.h>
#include <stdbool.h>
#include <stdlib.h>
+#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/render/gles2.h>
#include <wlr/util/log.h>
#include "util/signal.h"
@@ -176,6 +177,10 @@ void wlr_renderer_init_wl_display(struct wlr_renderer *r,
}
}
+ if (r->impl->texture_from_dmabuf) {
+ wlr_linux_dmabuf_v1_create(wl_display, r);
+ }
+
if (r->impl->init_wl_display) {
r->impl->init_wl_display(r, wl_display);
}