diff options
author | Drew DeVault <sir@cmpwn.com> | 2017-10-02 08:46:06 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-02 08:46:06 -0400 |
commit | 87a0cb7ba37eed29662ec16ce95493a0238ef660 (patch) | |
tree | 95554cb777848ce7246b651c09740d307bcdd506 /render | |
parent | aa8a4f12b7e7ea8c3a1876f0585dd6171f8cb705 (diff) | |
parent | 9ec9edc40d4694dedfd7f00eb9106ce5ed133239 (diff) |
Merge pull request #182 from ascent12/drm-multi-gpu
DRM Multi-GPU
Diffstat (limited to 'render')
-rw-r--r-- | render/gles2/texture.c | 20 | ||||
-rw-r--r-- | render/wlr_texture.c | 5 |
2 files changed, 25 insertions, 0 deletions
diff --git a/render/gles2/texture.c b/render/gles2/texture.c index 98d1a112..5e934aa4 100644 --- a/render/gles2/texture.c +++ b/render/gles2/texture.c @@ -205,6 +205,25 @@ static bool gles2_texture_upload_drm(struct wlr_texture *_tex, return true; } +static bool gles2_texture_upload_eglimage(struct wlr_texture *wlr_tex, + EGLImageKHR image, uint32_t width, uint32_t height) { + struct wlr_gles2_texture *tex = (struct wlr_gles2_texture *)wlr_tex; + + tex->image = image; + tex->pixel_format = &external_pixel_format; + tex->wlr_texture.valid = true; + tex->wlr_texture.width = width; + tex->wlr_texture.height = height; + + gles2_texture_ensure_texture(tex); + + GL_CALL(glActiveTexture(GL_TEXTURE0)); + GL_CALL(glBindTexture(GL_TEXTURE_EXTERNAL_OES, tex->tex_id)); + GL_CALL(glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES, tex->image)); + + return true; +} + static void gles2_texture_get_matrix(struct wlr_texture *_texture, float (*matrix)[16], const float (*projection)[16], int x, int y) { struct wlr_gles2_texture *texture = (struct wlr_gles2_texture *)_texture; @@ -270,6 +289,7 @@ static struct wlr_texture_impl wlr_texture_impl = { .upload_shm = gles2_texture_upload_shm, .update_shm = gles2_texture_update_shm, .upload_drm = gles2_texture_upload_drm, + .upload_eglimage = gles2_texture_upload_eglimage, .get_matrix = gles2_texture_get_matrix, .get_buffer_size = gles2_texture_get_buffer_size, .bind = gles2_texture_bind, diff --git a/render/wlr_texture.c b/render/wlr_texture.c index 9faea820..4ce86bdd 100644 --- a/render/wlr_texture.c +++ b/render/wlr_texture.c @@ -48,6 +48,11 @@ bool wlr_texture_upload_drm(struct wlr_texture *texture, return texture->impl->upload_drm(texture, drm_buffer); } +bool wlr_texture_upload_eglimage(struct wlr_texture *texture, + EGLImageKHR image, uint32_t width, uint32_t height) { + return texture->impl->upload_eglimage(texture, image, width, height); +} + void wlr_texture_get_matrix(struct wlr_texture *texture, float (*matrix)[16], const float (*projection)[16], int x, int y) { texture->impl->get_matrix(texture, matrix, projection, x, y); |