aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-05-10 06:54:47 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-05-10 06:54:47 +0000
commit1be79dc266d06d4cb1410df3b9df91797e720dba (patch)
treeb79805b2ba59d012920c08a4c90378978e3828fc
parentbb5901922e236e7eecb0b8546956c3dbb00007f8 (diff)
parent0197c63f219a8ba4e1534c01b3b06ab31cdd1dcf (diff)
downloadmesa3d-aml_cbr_331610010.tar.gz
Change-Id: I513b2e6b261e74fe71093dde7909ef1d8d5d0023
-rw-r--r--METADATA13
-rw-r--r--OWNERS1
-rw-r--r--src/egl/Android.mk5
-rw-r--r--src/egl/drivers/dri2/platform_android.c66
-rw-r--r--src/freedreno/Android.ir3.mk4
5 files changed, 66 insertions, 23 deletions
diff --git a/METADATA b/METADATA
index ee8d4b3e308..ea134b3a61c 100644
--- a/METADATA
+++ b/METADATA
@@ -18,10 +18,13 @@ third_party {
}
version: "17.0.4"
last_upgrade_date { year: 2017 month: 5 day: 22 }
- # would be NOTICE save for:
- # include/drm-uapi/etnaviv_drm.h
- # and RESTRICTED save for:
- # docs/README.VCE
- # docs/README.UVD
+ license_note: "would be NOTICE save for:\n"
+ " include/drm-uapi/etnaviv_drm.h\n"
+ " and RESTRICTED save for:\n"
+ " docs/README.VCE\n"
+ " docs/README.UVD"
license_type: BY_EXCEPTION_ONLY
+ security {
+ tag: "NVD-CPE2.3:cpe:/a:mesa3d:mesa:17.0.4"
+ }
}
diff --git a/OWNERS b/OWNERS
index 380fa8c19c4..7712dd0d45d 100644
--- a/OWNERS
+++ b/OWNERS
@@ -1,3 +1,2 @@
adelva@google.com
dimitrysh@google.com
-sadmac@google.com
diff --git a/src/egl/Android.mk b/src/egl/Android.mk
index 322a1113841..823ba94100c 100644
--- a/src/egl/Android.mk
+++ b/src/egl/Android.mk
@@ -88,6 +88,11 @@ ifneq ($(MESA_BUILD_GALLIUM),)
LOCAL_REQUIRED_MODULES += gallium_dri
endif
+# TODO(b/223646636): Temporary hack for handles with HDR metadata fds
+ifeq ($(BOARD_GPU_DRIVERS),virgl)
+LOCAL_CFLAGS += -DNUM_FDS_HACK
+endif
+
LOCAL_MODULE := libGLES_mesa
LOCAL_LICENSE_KINDS := SPDX-license-identifier-ISC SPDX-license-identifier-MIT
LOCAL_LICENSE_CONDITIONS := notice
diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
index 2b75dfa98a4..c8e0e7b2402 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -174,7 +174,11 @@ get_native_buffer_fds(struct ANativeWindowBuffer *buf, int fds[3])
for (int i = 0; i < handle->numFds; i++)
fds[i] = handle->data[i];
+#ifdef NUM_FDS_HACK
+ return 1;
+#else
return handle->numFds;
+#endif
}
#ifdef HAVE_DRM_GRALLOC
@@ -199,24 +203,56 @@ droid_create_image_from_prime_fds_yuv(_EGLDisplay *disp,
int ret;
unsigned error;
- if (!dri2_dpy->gralloc->lock_ycbcr) {
- _eglLog(_EGL_WARNING, "Gralloc does not support lock_ycbcr");
- return NULL;
- }
-
memset(&ycbcr, 0, sizeof(ycbcr));
- ret = dri2_dpy->gralloc->lock_ycbcr(dri2_dpy->gralloc, buf->handle,
- 0, 0, 0, 0, 0, &ycbcr);
- if (ret) {
- /* HACK: See droid_create_image_from_prime_fds() and
- * https://issuetracker.google.com/32077885.*/
- if (buf->format == HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED)
+ if (dri2_dpy->gralloc->lock_ycbcr) {
+ ret = dri2_dpy->gralloc->lock_ycbcr(dri2_dpy->gralloc, buf->handle,
+ 0, 0, 0, 0, 0, &ycbcr);
+ if (ret) {
+ /* HACK: See droid_create_image_from_prime_fds() and
+ * https://issuetracker.google.com/32077885.*/
+ if (buf->format == HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED)
+ return NULL;
+
+ _eglLog(_EGL_WARNING, "gralloc->lock_ycbcr failed: %d", ret);
return NULL;
-
- _eglLog(_EGL_WARNING, "gralloc->lock_ycbcr failed: %d", ret);
- return NULL;
+ }
+ dri2_dpy->gralloc->unlock(dri2_dpy->gralloc, buf->handle);
+ } else {
+ _eglLog(_EGL_WARNING, "Gralloc does not support lock_ycbcr!");
+ // HACK: Prepare a hardcoded ycrcb struct to prevent crashes while trying
+ // to create a YVU420_ANDROID or FLEX_YCbCr_420 (NV12) image with gralloc4
+ // see: b/225392099
+ if (buf->format == HAL_PIXEL_FORMAT_YV12) {
+ // HAL_PIXEL_FORMAT_YV12 => DRM_FORMAT_YVU420_ANDROID
+ // The stride of Android YV12 buffers is required to be aligned to 16 bytes
+ size_t luma_stride = ALIGN(buf->width, 32);
+ size_t chroma_stride = ALIGN(buf->width/2, 16);
+ ycbcr.y = 0;
+ ycbcr.cr = (void*)(luma_stride*buf->height);
+ ycbcr.cb = (void*)(luma_stride*buf->height+chroma_stride*buf->height/2);
+ ycbcr.ystride = luma_stride;
+ ycbcr.cstride = chroma_stride;
+ ycbcr.chroma_step = 1;
+ _eglLog(_EGL_WARNING,
+ "Using a hardcoded ycbcr struct for DRM_FORMAT_YVU420_ANDROID format.");
+ } else if (buf->format == HAL_PIXEL_FORMAT_YCbCr_420_888) {
+ // HAL_PIXEL_FORMAT_YCbCr_420_888 => DRM_FORMAT_FLEX_YCbCr_420_888
+ size_t luma_stride = buf->width;
+ size_t chroma_stride = buf->width;
+ ycbcr.y = 0;
+ ycbcr.cr = (void*)(luma_stride*buf->height+1);
+ ycbcr.cb = (void*)(luma_stride*buf->height);
+ ycbcr.ystride = luma_stride;
+ ycbcr.cstride = chroma_stride;
+ ycbcr.chroma_step = 2;
+ _eglLog(_EGL_WARNING,
+ "Using a hardcoded ycbcr struct for DRM_FORMAT_FLEX_YCbCr_420_888 format.");
+ } else {
+ _eglLog(_EGL_WARNING,
+ "Unable to create an image for native YUV format %x", buf->format);
+ return NULL;
+ }
}
- dri2_dpy->gralloc->unlock(dri2_dpy->gralloc, buf->handle);
/* When lock_ycbcr's usage argument contains no SW_READ/WRITE flags
* it will return the .y/.cb/.cr pointers based on a NULL pointer,
diff --git a/src/freedreno/Android.ir3.mk b/src/freedreno/Android.ir3.mk
index 50ad0faf8c9..c46564e55af 100644
--- a/src/freedreno/Android.ir3.mk
+++ b/src/freedreno/Android.ir3.mk
@@ -96,8 +96,8 @@ $(intermediates)/ir3/ir3_parser.c: $(ir3_parser_deps) $(BISON) $(BISON_DATA) $(M
$(intermediates)/ir3/ir3_parser.h: $(ir3_parser_deps) $(BISON) $(BISON_DATA) $(M4)
@mkdir -p $(dir $@)
@echo "Gen Header: $(PRIVATE_MODULE) <= $(notdir $(@))"
- $(hide) $(BISON) $< --name-prefix=ir3_yy --defines=$@
- $(hide) M4=$(M4) $(BISON) $< --name-prefix=ir3_yy --defines=$@
+ $(hide) $(BISON) $< --name-prefix=ir3_yy --defines=$@ --output=$@.tab.c
+ $(hide) M4=$(M4) $(BISON) $< --name-prefix=ir3_yy --defines=$@ --output=$@.tab.c
include $(MESA_COMMON_MK)
include $(BUILD_STATIC_LIBRARY)