aboutsummaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-05-30 08:39:45 -0400
committerGitHub <noreply@github.com>2018-05-30 08:39:45 -0400
commit5d8e38702175fcc7cb991effeadca1f5a9308e6d (patch)
tree9cbc288ea690b5a038ac0ad7cf198c04d992c89f /render
parent8c9d0f15ce416029256ebb437c99b93f34edba18 (diff)
parent28020ff57728d07ae0715fc15696b8fe40337b3d (diff)
Merge pull request #1015 from emersion/dmabuf-single-modifier
Only allow one modifier per DMA-BUF, split attributes struct in render/
Diffstat (limited to 'render')
-rw-r--r--render/egl.c19
-rw-r--r--render/gles2/renderer.c6
-rw-r--r--render/gles2/texture.c4
-rw-r--r--render/wlr_renderer.c4
-rw-r--r--render/wlr_texture.c2
5 files changed, 17 insertions, 18 deletions
diff --git a/render/egl.c b/render/egl.c
index 579bb5fe..6ac3ee2a 100644
--- a/render/egl.c
+++ b/render/egl.c
@@ -340,9 +340,9 @@ EGLImageKHR wlr_egl_create_image_from_wl_drm(struct wlr_egl *egl,
}
EGLImageKHR wlr_egl_create_image_from_dmabuf(struct wlr_egl *egl,
- struct wlr_dmabuf_buffer_attribs *attributes) {
+ struct wlr_dmabuf_attributes *attributes) {
bool has_modifier = false;
- if (attributes->modifier[0] != DRM_FORMAT_MOD_INVALID) {
+ if (attributes->modifier != DRM_FORMAT_MOD_INVALID) {
if (!egl->egl_exts.dmabuf_import_modifiers) {
return NULL;
}
@@ -364,7 +364,7 @@ EGLImageKHR wlr_egl_create_image_from_dmabuf(struct wlr_egl *egl,
EGLint pitch;
EGLint mod_lo;
EGLint mod_hi;
- } attr_names[WLR_LINUX_DMABUF_MAX_PLANES] = {
+ } attr_names[WLR_DMABUF_MAX_PLANES] = {
{
EGL_DMA_BUF_PLANE0_FD_EXT,
EGL_DMA_BUF_PLANE0_OFFSET_EXT,
@@ -401,9 +401,9 @@ EGLImageKHR wlr_egl_create_image_from_dmabuf(struct wlr_egl *egl,
attribs[atti++] = attributes->stride[i];
if (has_modifier) {
attribs[atti++] = attr_names[i].mod_lo;
- attribs[atti++] = attributes->modifier[i] & 0xFFFFFFFF;
+ attribs[atti++] = attributes->modifier & 0xFFFFFFFF;
attribs[atti++] = attr_names[i].mod_hi;
- attribs[atti++] = attributes->modifier[i] >> 32;
+ attribs[atti++] = attributes->modifier >> 32;
}
}
attribs[atti++] = EGL_NONE;
@@ -414,11 +414,11 @@ EGLImageKHR wlr_egl_create_image_from_dmabuf(struct wlr_egl *egl,
}
#ifndef DRM_FORMAT_BIG_ENDIAN
-# define DRM_FORMAT_BIG_ENDIAN 0x80000000
+#define DRM_FORMAT_BIG_ENDIAN 0x80000000
#endif
bool wlr_egl_check_import_dmabuf(struct wlr_egl *egl,
- struct wlr_dmabuf_buffer *dmabuf) {
- switch (dmabuf->attributes.format & ~DRM_FORMAT_BIG_ENDIAN) {
+ struct wlr_dmabuf_attributes *attribs) {
+ switch (attribs->format & ~DRM_FORMAT_BIG_ENDIAN) {
/* TODO: YUV based formats not yet supported, require multiple
* wlr_create_image_from_dmabuf */
case WL_SHM_FORMAT_YUYV:
@@ -431,8 +431,7 @@ bool wlr_egl_check_import_dmabuf(struct wlr_egl *egl,
break;
}
- EGLImage egl_image = wlr_egl_create_image_from_dmabuf(egl,
- &dmabuf->attributes);
+ EGLImage egl_image = wlr_egl_create_image_from_dmabuf(egl, attribs);
if (egl_image) {
/* We can import the image, good. No need to keep it
since wlr_texture_upload_dmabuf will import it again */
diff --git a/render/gles2/renderer.c b/render/gles2/renderer.c
index 5cea5c3b..e68bb83f 100644
--- a/render/gles2/renderer.c
+++ b/render/gles2/renderer.c
@@ -243,9 +243,9 @@ static int gles2_get_dmabuf_modifiers(struct wlr_renderer *wlr_renderer,
}
static bool gles2_check_import_dmabuf(struct wlr_renderer *wlr_renderer,
- struct wlr_dmabuf_buffer *dmabuf) {
+ struct wlr_dmabuf_attributes *attribs) {
struct wlr_gles2_renderer *renderer = gles2_get_renderer(wlr_renderer);
- return wlr_egl_check_import_dmabuf(renderer->egl, dmabuf);
+ return wlr_egl_check_import_dmabuf(renderer->egl, attribs);
}
static bool gles2_read_pixels(struct wlr_renderer *wlr_renderer,
@@ -299,7 +299,7 @@ static struct wlr_texture *gles2_texture_from_wl_drm(
static struct wlr_texture *gles2_texture_from_dmabuf(
struct wlr_renderer *wlr_renderer,
- struct wlr_dmabuf_buffer_attribs *attribs) {
+ struct wlr_dmabuf_attributes *attribs) {
struct wlr_gles2_renderer *renderer = gles2_get_renderer(wlr_renderer);
return wlr_gles2_texture_from_dmabuf(renderer->egl, attribs);
}
diff --git a/render/gles2/texture.c b/render/gles2/texture.c
index 37424802..2627e292 100644
--- a/render/gles2/texture.c
+++ b/render/gles2/texture.c
@@ -199,7 +199,7 @@ 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_buffer_attribs *attribs) {
+ struct wlr_dmabuf_attributes *attribs) {
assert(wlr_egl_is_current(egl));
if (!glEGLImageTargetTexture2DOES) {
@@ -225,7 +225,7 @@ struct wlr_texture *wlr_gles2_texture_from_dmabuf(struct wlr_egl *egl,
texture->type = WLR_GLES2_TEXTURE_DMABUF;
texture->has_alpha = true;
texture->inverted_y =
- (attribs->flags & WLR_DMABUF_BUFFER_ATTRIBS_FLAGS_Y_INVERT) != 0;
+ (attribs->flags & WLR_DMABUF_ATTRIBUTES_FLAGS_Y_INVERT) != 0;
texture->image = wlr_egl_create_image_from_dmabuf(egl, attribs);
if (texture->image == NULL) {
diff --git a/render/wlr_renderer.c b/render/wlr_renderer.c
index aed821c9..32b0a779 100644
--- a/render/wlr_renderer.c
+++ b/render/wlr_renderer.c
@@ -136,11 +136,11 @@ int wlr_renderer_get_dmabuf_modifiers(struct wlr_renderer *r, int format,
}
bool wlr_renderer_check_import_dmabuf(struct wlr_renderer *r,
- struct wlr_dmabuf_buffer *dmabuf) {
+ struct wlr_dmabuf_attributes *attribs) {
if (!r->impl->check_import_dmabuf) {
return false;
}
- return r->impl->check_import_dmabuf(r, dmabuf);
+ return r->impl->check_import_dmabuf(r, attribs);
}
bool wlr_renderer_read_pixels(struct wlr_renderer *r, enum wl_shm_format fmt,
diff --git a/render/wlr_texture.c b/render/wlr_texture.c
index 9aecfd98..38c75d28 100644
--- a/render/wlr_texture.c
+++ b/render/wlr_texture.c
@@ -35,7 +35,7 @@ struct wlr_texture *wlr_texture_from_wl_drm(struct wlr_renderer *renderer,
}
struct wlr_texture *wlr_texture_from_dmabuf(struct wlr_renderer *renderer,
- struct wlr_dmabuf_buffer_attribs *attribs) {
+ struct wlr_dmabuf_attributes *attribs) {
if (!renderer->impl->texture_from_dmabuf) {
return NULL;
}