summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Foss <robert.foss@collabora.com>2017-05-29 16:08:21 -0400
committerRobert Foss <robert.foss@collabora.com>2017-05-29 20:01:24 -0400
commit36bc81f7336756eede488e9d12e002fe3ddc1950 (patch)
treef7608d83c9ee3d30066d086c0e331c21715981e6
parent4a1671b3dbb61dc86e3965e4883c5deaa70457e3 (diff)
downloadmesa-android-etnaviv-modifiers-v2.tar.gz
mesa-android-etnaviv-modifiers-v2.tar.xz
-rw-r--r--src/egl/drivers/dri2/egl_dri2.c12
-rw-r--r--src/egl/drivers/dri2/platform_android.c14
-rw-r--r--src/egl/drivers/dri2/platform_drm.c6
-rw-r--r--src/gallium/Android.mk4
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_resource.c42
-rw-r--r--src/gallium/state_trackers/dri/dri2.c20
-rw-r--r--src/gbm/Android.mk4
-rw-r--r--src/gbm/backends/dri/gbm_dri.c7
-rw-r--r--src/gbm/main/gbm.c10
9 files changed, 100 insertions, 19 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index e761317..c008508 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -59,6 +59,9 @@
#include "loader/loader.h"
#include "util/u_atomic.h"
+#define LOG_TAG "EGL-DRI2"
+#include <cutils/log.h>
+
/* The kernel header drm_fourcc.h defines the DRM formats below. We duplicate
* some of the definitions here so that building Mesa won't bleeding-edge
* kernel headers.
@@ -2205,7 +2208,7 @@ dri2_create_image_dma_buf(_EGLDisplay *disp, _EGLContext *ctx,
uint64_t modifier;
bool has_modifier = false;
unsigned error;
-
+ALOGE("%s 1", __func__);
/**
* The spec says:
*
@@ -2244,9 +2247,14 @@ dri2_create_image_dma_buf(_EGLDisplay *disp, _EGLContext *ctx,
((uint64_t) attrs.DMABufPlaneModifiersHi[0].Value << 32) |
attrs.DMABufPlaneModifiersLo[0].Value;
has_modifier = true;
+ ALOGE("%s 1.1 has_modifier modifier=%llu", __func__, modifier);
+
} else {
modifier = DRM_FORMAT_MOD_INVALID;
+ ALOGE("%s 1.1 has_modifier modifier=DRM_FORMAT_MOD_INVALID", __func__);
+
}
+ ALOGE("%s 2 modifier=%llu", __func__, modifier);
if (has_modifier) {
if (dri2_dpy->image->base.version < 15 ||
@@ -2254,6 +2262,7 @@ dri2_create_image_dma_buf(_EGLDisplay *disp, _EGLContext *ctx,
_eglError(EGL_BAD_MATCH, "unsupported dma_buf format modifier");
return EGL_NO_IMAGE_KHR;
}
+ ALOGE("%s 2.1 modifier=%llu", __func__, modifier);
dri_image =
dri2_dpy->image->createImageFromDmaBufs2(dri2_dpy->dri_screen,
attrs.Width, attrs.Height, attrs.DMABufFourCC.Value,
@@ -2485,6 +2494,7 @@ dri2_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp,
case EGL_DRM_BUFFER_MESA:
return dri2_create_image_mesa_drm_buffer(disp, ctx, buffer, attr_list);
case EGL_LINUX_DMA_BUF_EXT:
+ ALOGE("dri2_create_image_khr");
return dri2_create_image_dma_buf(disp, ctx, buffer, attr_list);
#endif
#ifdef HAVE_WAYLAND_PLATFORM
diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
index 2eded0f..29c8ae9 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -39,6 +39,9 @@
#include "egl_dri2_fallbacks.h"
#include "platform_android_gralloc_drm.h"
+#define LOG_TAG "PLATFORM_ANDROID"
+#include <cutils/log.h>
+
#define ALIGN(val, align) (((val) + (align) - 1) & ~((align) - 1))
struct droid_yuv_format {
@@ -546,7 +549,7 @@ droid_create_image_from_prime_fd_yuv(_EGLDisplay *disp, _EGLContext *ctx,
int is_ycrcb;
int fourcc;
int ret;
-
+ ALOGE("droid_create_image_from_prime_fd_yuv 1");
if (!dri2_dpy->gralloc->lock_ycbcr) {
_eglLog(_EGL_WARNING, "Gralloc does not support lock_ycbcr");
return NULL;
@@ -605,7 +608,7 @@ droid_create_image_from_prime_fd_yuv(_EGLDisplay *disp, _EGLContext *ctx,
EGL_DMA_BUF_PLANE1_OFFSET_EXT, offsets[1],
EGL_NONE, 0
};
-
+ ALOGE("droid_create_image_from_prime_fd_yuv 1.1");
return dri2_create_image_dma_buf(disp, ctx, NULL, attr_list_2plane);
} else {
/* Fully planar Y + Cb + Cr or Y + Cr + Cb format. */
@@ -624,11 +627,15 @@ droid_create_image_from_prime_fd_yuv(_EGLDisplay *disp, _EGLContext *ctx,
EGL_DMA_BUF_PLANE2_OFFSET_EXT, offsets[2],
EGL_NONE, 0
};
-
+ ALOGE("droid_create_image_from_prime_fd_yuv 1.2");
return dri2_create_image_dma_buf(disp, ctx, NULL, attr_list_3plane);
}
}
+#ifndef DRM_FORMAT_MOD_INVALID
+#define DRM_FORMAT_MOD_INVALID ((1ULL<<56) - 1)
+#endif
+
static _EGLImage *
droid_create_image_from_prime_fd(_EGLDisplay *disp, _EGLContext *ctx,
struct ANativeWindowBuffer *buf, int fd)
@@ -636,6 +643,7 @@ droid_create_image_from_prime_fd(_EGLDisplay *disp, _EGLContext *ctx,
unsigned int pitch;
uint64_t modifier = get_native_buffer_modifier(buf);
+ ALOGE("%s: modifier %llu (DRM_FORMAT_MOD_INVALID is %llu)\n", __func__, modifier, DRM_FORMAT_MOD_INVALID);
if (is_yuv(buf->format))
return droid_create_image_from_prime_fd_yuv(disp, ctx, buf, fd);
diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c
index 9431d95..4265f06 100644
--- a/src/egl/drivers/dri2/platform_drm.c
+++ b/src/egl/drivers/dri2/platform_drm.c
@@ -40,6 +40,9 @@
#include "egl_dri2_fallbacks.h"
#include "loader.h"
+#define LOG_TAG "PLATFORM-DRM"
+#include <cutils/log.h>
+
static struct gbm_bo *
lock_front_buffer(struct gbm_surface *_surf)
{
@@ -217,7 +220,6 @@ get_back_bo(struct dri2_egl_surface *dri2_surf)
struct gbm_dri_surface *surf = dri2_surf->gbm_surf;
int age = 0;
unsigned i;
-
if (dri2_surf->back == NULL) {
for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) {
if (!dri2_surf->color_buffers[i].locked &&
@@ -228,8 +230,10 @@ get_back_bo(struct dri2_egl_surface *dri2_surf)
}
}
+ ALOGE("%s 1 surf->base.count=%u", __func__, surf->base.count);
if (dri2_surf->back == NULL)
return -1;
+
if (dri2_surf->back->bo == NULL) {
if (surf->base.modifiers)
dri2_surf->back->bo = gbm_bo_create_with_modifiers(&dri2_dpy->gbm_dri->base.base,
diff --git a/src/gallium/Android.mk b/src/gallium/Android.mk
index 2710831..4e13b31 100644
--- a/src/gallium/Android.mk
+++ b/src/gallium/Android.mk
@@ -47,6 +47,10 @@ SUBDIRS += winsys/etnaviv/drm drivers/etnaviv drivers/renderonly
SUBDIRS += winsys/imx/drm
SUBDIRS += state_trackers/dri
+LOCAL_SHARED_LIBRARIES := \
+ liblog \
+ libcutils
+
# sort to eliminate any duplicates
INC_DIRS := $(call all-named-subdir-makefiles,$(sort $(SUBDIRS)))
# targets/dri must be included last
diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c b/src/gallium/drivers/etnaviv/etnaviv_resource.c
index 9e4ce6b..ae21408 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
@@ -38,6 +38,10 @@
#include <drm_fourcc.h>
+
+#define LOG_TAG "ETNA-RESOURCE"
+#include <cutils/log.h>
+
#ifndef DRM_FORMAT_MOD_INVALID
#define DRM_FORMAT_MOD_INVALID ((1ULL<<56) - 1)
#endif
@@ -145,14 +149,24 @@ static unsigned int modifier_to_layout(uint64_t modifier)
{
switch (modifier) {
case DRM_FORMAT_MOD_VIVANTE_TILED:
+ ALOGE("%s modifier=%llu layout=ETNA_LAYOUT_TILED", __func__, modifier);
+
return ETNA_LAYOUT_TILED;
case DRM_FORMAT_MOD_VIVANTE_SUPER_TILED:
+ ALOGE("%s modifier=%llu layout=ETNA_LAYOUT_SUPER_TILED", __func__, modifier);
+
return ETNA_LAYOUT_SUPER_TILED;
case DRM_FORMAT_MOD_VIVANTE_SPLIT_TILED:
+ ALOGE("%s modifier=%llu layout=ETNA_LAYOUT_MULTI_TILED", __func__, modifier);
+
return ETNA_LAYOUT_MULTI_TILED;
case DRM_FORMAT_MOD_VIVANTE_SPLIT_SUPER_TILED:
+ ALOGE("%s modifier=%llu layout=ETNA_LAYOUT_MULTI_SUPERTILED", __func__, modifier);
+
return ETNA_LAYOUT_MULTI_SUPERTILED;
case DRM_FORMAT_MOD_LINEAR:
+ ALOGE("%s modifier=%llu layout=ETNA_LAYOUT_LINEAR", __func__, modifier);
+
default:
return ETNA_LAYOUT_LINEAR;
}
@@ -190,6 +204,15 @@ etna_resource_alloc(struct pipe_screen *pscreen, unsigned layout,
struct etna_resource *scanout_rsc = NULL;
unsigned size;
+ ALOGE("%s modifier=%llu "
+ "target=%d, format=%s, %ux%ux%u, array_size=%u, "
+ "last_level=%u, nr_samples=%u, usage=%u, bind=%x, flags=%x",
+ __func__, modifier,
+ templat->target, util_format_name(templat->format), templat->width0,
+ templat->height0, templat->depth0, templat->array_size,
+ templat->last_level, templat->nr_samples, templat->usage,
+ templat->bind, templat->flags);
+
DBG_F(ETNA_DBG_RESOURCE_MSGS,
"target=%d, format=%s, %ux%ux%u, array_size=%u, "
"last_level=%u, nr_samples=%u, usage=%u, bind=%x, flags=%x",
@@ -292,7 +315,7 @@ etna_resource_create(struct pipe_screen *pscreen,
const struct pipe_resource *templat)
{
struct etna_screen *screen = etna_screen(pscreen);
-
+ ALOGE("etna_resource_create 1");
/* Figure out what tiling to use -- for now, assume that textures cannot be
* supertiled, and cannot be linear.
* There is a feature flag SUPERTILED_TEXTURE (not supported on any known hw)
@@ -345,7 +368,7 @@ etna_resource_create(struct pipe_screen *pscreen,
if (templat->bind & PIPE_BIND_LINEAR)
layout = ETNA_LAYOUT_LINEAR;
-
+ ALOGE("etna_resource_create 2 modifiers=%llu (DRM_FORMAT_MOD_LINEAR)", DRM_FORMAT_MOD_LINEAR);
return etna_resource_alloc(pscreen, layout, DRM_FORMAT_MOD_LINEAR, templat);
}
@@ -376,34 +399,41 @@ select_best_modifier(const struct etna_screen * screen,
for (int i = 0; i < count; i++) {
switch (modifiers[i]) {
case DRM_FORMAT_MOD_VIVANTE_SUPER_TILED:
+ ALOGE("%s modifiers[%d]=DRM_FORMAT_MOD_VIVANTE_SUPER_TILED", __func__, i);
if (screen->specs.pixel_pipes > 1 && !screen->specs.single_buffer)
break;
prio = MAX2(prio, MODIFIER_PRIORITY_SUPER_TILED);
break;
case DRM_FORMAT_MOD_VIVANTE_TILED:
+ ALOGE("%s modifiers[%d]=DRM_FORMAT_MOD_VIVANTE_TILED", __func__, i);
if (screen->specs.pixel_pipes > 1 && !screen->specs.single_buffer)
break;
prio = MAX2(prio, MODIFIER_PRIORITY_TILED);
break;
case DRM_FORMAT_MOD_VIVANTE_SPLIT_SUPER_TILED:
+ ALOGE("%s modifiers[%d]=DRM_FORMAT_MOD_VIVANTE_SPLIT_SUPER_TILED", __func__, i);
if (screen->specs.pixel_pipes < 2)
break;
prio = MAX2(prio, MODIFIER_PRIORITY_SPLIT_SUPER_TILED);
break;
case DRM_FORMAT_MOD_VIVANTE_SPLIT_TILED:
+ ALOGE("%s modifiers[%d]=DRM_FORMAT_MOD_VIVANTE_SPLIT_TILED", __func__, i);
if (screen->specs.pixel_pipes < 2)
break;
prio = MAX2(prio, MODIFIER_PRIORITY_SPLIT_TILED);
break;
case DRM_FORMAT_MOD_LINEAR:
+ ALOGE("%s modifiers[%d]=DRM_FORMAT_MOD_LINEAR", __func__, i);
prio = MAX2(prio, MODIFIER_PRIORITY_LINEAR);
break;
case DRM_FORMAT_MOD_INVALID:
+ ALOGE("%s modifiers[%d]=DRM_FORMAT_MOD_INVALID", __func__, i);
default:
break;
}
}
-
+ ALOGE("%s prio=%d", __func__, prio);
+ ALOGE("%s priority_to_modifier[%d]=%llu", __func__, prio, priority_to_modifier[prio]);
return priority_to_modifier[prio];
}
@@ -414,13 +444,19 @@ etna_resource_create_modifiers(struct pipe_screen *pscreen,
uint64_t *modifier)
{
struct etna_screen *screen = etna_screen(pscreen);
+ ALOGE("%s 1 modifier=%p", __func__, modifier);
+ ALOGE("%s 1 modifiers=%p", __func__, modifiers);
+ ALOGE("%s 1 modifiers count=%d", __func__, count);
*modifier = select_best_modifier(screen, modifiers, count);
unsigned int layout;
+ ALOGE("%s 2", __func__);
+ ALOGE("%s 2 modifier=%llu", __func__, *modifier);
if (*modifier == DRM_FORMAT_MOD_INVALID)
return NULL;
layout = modifier_to_layout(*modifier);
+
if (layout == ETNA_LAYOUT_LINEAR) {
layout = ETNA_LAYOUT_TILED;
if (screen->specs.can_supertile)
diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c
index 4e56691..ebc6f4f 100644
--- a/src/gallium/state_trackers/dri/dri2.c
+++ b/src/gallium/state_trackers/dri/dri2.c
@@ -52,6 +52,9 @@
#include "dri_query_renderer.h"
#include "dri2_buffer.h"
+#define LOG_TAG "DRI2"
+#include <cutils/log.h>
+
#ifndef DRM_FORMAT_MOD_INVALID
#define DRM_FORMAT_MOD_INVALID ((1ULL<<56) - 1)
#endif
@@ -913,14 +916,14 @@ dri2_create_image_from_winsys(__DRIscreen *_screen,
img = CALLOC_STRUCT(__DRIimageRec);
if (!img)
return NULL;
-
+ALOGE("%s 1", __func__);
memset(&templ, 0, sizeof(templ));
templ.bind = tex_usage;
templ.target = screen->target;
templ.last_level = 0;
templ.depth0 = 1;
templ.array_size = 1;
-
+ALOGE("%s 2", __func__);
for (i = f->nplanes - 1; i >= 0; i--) {
struct pipe_resource *tex;
@@ -928,6 +931,8 @@ dri2_create_image_from_winsys(__DRIscreen *_screen,
templ.height0 = height >> f->planes[i].height_shift;
templ.format = dri2_format_to_pipe_format(f->planes[i].dri_format);
+ ALOGE("%s 2.1 pscreen=%p", __func__, pscreen);
+ ALOGE("%s 2.1 pscreen->resource_from_handle=%p", __func__, pscreen->resource_from_handle);
tex = pscreen->resource_from_handle(pscreen,
&templ, &whandle[i], PIPE_HANDLE_USAGE_READ_WRITE);
if (!tex) {
@@ -939,6 +944,7 @@ dri2_create_image_from_winsys(__DRIscreen *_screen,
tex->next = img->texture;
img->texture = tex;
}
+ ALOGE("%s 3", __func__);
img->level = 0;
img->layer = 0;
@@ -1009,6 +1015,7 @@ dri2_create_image_from_fd(__DRIscreen *_screen,
whandles[i].stride = (unsigned)strides[i];
whandles[i].offset = (unsigned)offsets[i];
whandles[i].modifier = modifier;
+ ALOGE("%s fd=%p modifier=%llu", __func__, fds[i], modifier);
}
if (fourcc == __DRI_IMAGE_FOURCC_YVU420) {
@@ -1099,7 +1106,7 @@ dri2_create_image_common(__DRIscreen *_screen,
templ.height0 = height;
templ.depth0 = 1;
templ.array_size = 1;
-
+ ALOGE("%s 1 modifiers count=%u", __func__, count);
if (modifiers)
img->texture =
screen->base.screen
@@ -1149,6 +1156,7 @@ dri2_create_image_with_modifiers(__DRIscreen *dri_screen,
const unsigned count,
void *loaderPrivate)
{
+ ALOGE("%s 1 modifiers count=%u", __func__, count);
return dri2_create_image_common(dri_screen, width, height, format,
0 /* use */, modifiers, count,
loaderPrivate);
@@ -1407,7 +1415,7 @@ dri2_from_fds(__DRIscreen *screen, int width, int height, int fourcc,
{
__DRIimage *img;
int dri_components;
-
+ ALOGE("dri2_from_fds modifier=DRM_FORMAT_MOD_INVALID");
img = dri2_create_image_from_fd(screen, width, height, fourcc,
DRM_FORMAT_MOD_INVALID, fds, num_fds,
strides, offsets, NULL,
@@ -1477,7 +1485,7 @@ dri2_from_dma_bufs(__DRIscreen *screen,
{
__DRIimage *img;
int dri_components;
-
+ ALOGE("dri2_from_dma_bufs 1 modifiers=DRM_FORMAT_MOD_INVALID");
img = dri2_create_image_from_fd(screen, width, height, fourcc,
DRM_FORMAT_MOD_INVALID, fds, num_fds,
strides, offsets, error,
@@ -1509,7 +1517,7 @@ dri2_from_dma_bufs2(__DRIscreen *screen,
{
__DRIimage *img;
int dri_components;
-
+ ALOGE("dri2_from_dma_bufs2 modifier=%llu", modifier);
img = dri2_create_image_from_fd(screen, width, height, fourcc,
modifier, fds, num_fds, strides, offsets,
error, &dri_components, loaderPrivate);
diff --git a/src/gbm/Android.mk b/src/gbm/Android.mk
index a3f8fbb..5bb198b 100644
--- a/src/gbm/Android.mk
+++ b/src/gbm/Android.mk
@@ -35,6 +35,10 @@ LOCAL_C_INCLUDES := \
LOCAL_STATIC_LIBRARIES := libmesa_loader
LOCAL_MODULE := libgbm
+LOCAL_SHARED_LIBRARIES := \
+ liblog \
+ libcutils \
+
LOCAL_SRC_FILES := \
$(gbm_core_FILES) \
$(gbm_dri_FILES)
diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index 6f13c2b..4b9e764 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -49,6 +49,9 @@
#include "gbmint.h"
#include "loader.h"
+#define LOG_TAG "GBM-DRI"
+#include <cutils/log.h>
+
/* For importing wl_buffer */
#if HAVE_WAYLAND_PLATFORM
#include "../../../egl/wayland/wayland-drm/wayland-drm.h"
@@ -1073,7 +1076,7 @@ gbm_dri_bo_create(struct gbm_device *gbm,
struct gbm_dri_bo *bo;
int dri_format;
unsigned dri_use = 0;
-
+ ALOGE("%s 1 modifiers count=%u", __func__, count);
/* Callers of this may specify a modifier, or a dri usage, but not both. The
* newer modifier interface deprecates the older usage flags.
*/
@@ -1302,7 +1305,7 @@ gbm_dri_surface_create(struct gbm_device *gbm,
free(surf);
return NULL;
}
-
+ ALOGE("%s 1 modifiers count=%u modifiers=%p", __func__, count, modifiers);
/* TODO: We are deferring validation of modifiers until the image is actually
* created. This deferred creation can fail due to a modifier-format
* mismatch. The result is the client has a surface but no object to back it.
diff --git a/src/gbm/main/gbm.c b/src/gbm/main/gbm.c
index 79d78b7..58fdfdb 100644
--- a/src/gbm/main/gbm.c
+++ b/src/gbm/main/gbm.c
@@ -45,6 +45,9 @@
#include "gbmint.h"
#include "backend.h"
+#define LOG_TAG "GBM"
+#include <cutils/log.h>
+
/** Returns the file description for the gbm device
*
* \return The fd that the struct gbm_device was created with
@@ -387,7 +390,7 @@ gbm_bo_create(struct gbm_device *gbm,
errno = EINVAL;
return NULL;
}
-
+ ALOGE("%s 1 modifiers count=%u", __func__, 0);
return gbm->bo_create(gbm, width, height, format, usage, NULL, 0);
}
@@ -407,7 +410,7 @@ gbm_bo_create_with_modifiers(struct gbm_device *gbm,
errno = EINVAL;
return NULL;
}
-
+ ALOGE("%s 1 modifiers count=%u", __func__, count);
return gbm->bo_create(gbm, width, height, format, 0, modifiers, count);
}
/**
@@ -515,6 +518,7 @@ gbm_surface_create(struct gbm_device *gbm,
uint32_t width, uint32_t height,
uint32_t format, uint32_t flags)
{
+ ALOGE("%s 1 modifiers count=%u", __func__, 0);
return gbm->surface_create(gbm, width, height, format, flags, NULL, 0);
}
@@ -529,7 +533,7 @@ gbm_surface_create_with_modifiers(struct gbm_device *gbm,
errno = EINVAL;
return NULL;
}
-
+ ALOGE("%s 1 modifiers count=%u", __func__, count);
return gbm->surface_create(gbm, width, height, format, 0,
modifiers, count);
}