summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Foss <robert.foss@collabora.com>2017-05-26 16:17:54 -0400
committerRobert Foss <robert.foss@collabora.com>2017-05-26 16:17:54 -0400
commitf8697396650912b4b6ea47fbbec24041e0a1c3c4 (patch)
tree13d7601305ee9490eedceb32845de5b00ddab966
parent06d5f90658e90f8f5f5622fbc531cbcf77a164cf (diff)
downloadmesa-android-etnaviv-modifiers.tar.gz
mesa-android-etnaviv-modifiers.tar.xz
WIP: Initial modifiers codeandroid-etnaviv-modifiers
Signed-off-by: Robert Foss <robert.foss@collabora.com>
-rw-r--r--src/egl/drivers/dri2/platform_android.c10
-rw-r--r--src/egl/drivers/dri2/platform_android_gralloc_drm.h1
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_resource.c9
3 files changed, 20 insertions, 0 deletions
diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
index dd48a86..2eded0f 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -165,6 +165,13 @@ get_native_buffer_name(struct ANativeWindowBuffer *buf)
return (handle) ? handle->name : 0;
}
+static unsigned long long
+get_native_buffer_modifier(struct ANativeWindowBuffer *buf)
+{
+ struct gralloc_drm_handle_t *handle = gralloc_drm_handle(buf->handle);
+ return handle->modifier;
+}
+
static EGLBoolean
droid_window_dequeue_buffer(struct dri2_egl_surface *dri2_surf)
{
@@ -627,6 +634,7 @@ droid_create_image_from_prime_fd(_EGLDisplay *disp, _EGLContext *ctx,
struct ANativeWindowBuffer *buf, int fd)
{
unsigned int pitch;
+ uint64_t modifier = get_native_buffer_modifier(buf);
if (is_yuv(buf->format))
return droid_create_image_from_prime_fd_yuv(disp, ctx, buf, fd);
@@ -649,6 +657,8 @@ droid_create_image_from_prime_fd(_EGLDisplay *disp, _EGLContext *ctx,
EGL_LINUX_DRM_FOURCC_EXT, fourcc,
EGL_DMA_BUF_PLANE0_FD_EXT, fd,
EGL_DMA_BUF_PLANE0_PITCH_EXT, pitch,
+ EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT, (uint32_t)(modifier & 0xFFFFFFFFLL),
+ EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT, (uint32_t)((modifier & 0xFFFFFFFF00000000LL) >> 32),
EGL_DMA_BUF_PLANE0_OFFSET_EXT, 0,
EGL_NONE, 0
};
diff --git a/src/egl/drivers/dri2/platform_android_gralloc_drm.h b/src/egl/drivers/dri2/platform_android_gralloc_drm.h
index d0912bf..4ca7146 100644
--- a/src/egl/drivers/dri2/platform_android_gralloc_drm.h
+++ b/src/egl/drivers/dri2/platform_android_gralloc_drm.h
@@ -50,6 +50,7 @@ struct gralloc_drm_handle_t {
int name; /* the name of the bo */
int stride; /* the stride in bytes */
+ uint64_t modifier; /* buffer modifiers */
int data_owner; /* owner of data (for validation) */
union {
diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c b/src/gallium/drivers/etnaviv/etnaviv_resource.c
index e958009..e2a0dda 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
@@ -599,6 +599,14 @@ etna_resource_wait(struct pipe_context *pctx, struct etna_resource *rsc)
}
}
+static uint64_t
+etna_resource_get_modifier(struct pipe_screen *screen,
+ struct pipe_resource *prsc)
+{
+ struct etna_resource *rsc = etna_resource(prsc);
+ return layout_to_modifier(rsc->layout);
+}
+
void
etna_resource_screen_init(struct pipe_screen *pscreen)
{
@@ -609,4 +617,5 @@ etna_resource_screen_init(struct pipe_screen *pscreen)
pscreen->resource_get_handle = etna_resource_get_handle;
pscreen->resource_changed = etna_resource_changed;
pscreen->resource_destroy = etna_resource_destroy;
+ pscreen->resource_get_modifier = etna_resource_get_modifier;
}