[-]
[+]
|
Changed |
_service:tar_git:libhybris.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -2,7 +2,7 @@
<service name="tar_git">
<param name="url">https://github.com/mer-hybris/libhybris.git</param>
<param name="branch">master</param>
- <param name="revision">0.0.5.46</param>
+ <param name="revision"></param>
<param name="token"></param>
<param name="debian"></param>
<param name="dumb"></param>
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.48.tar.bz2/libhybris/compat/Android.common.mk
^
|
@@ -4,6 +4,13 @@
ANDROID_VERSION_MINOR := $(word 2, $(subst ., , $(PLATFORM_VERSION)))
ANDROID_VERSION_PATCH := $(word 3, $(subst ., , $(PLATFORM_VERSION)))
+ifeq ($(ANDROID_VERSION_MINOR),)
+ ANDROID_VERSION_MINOR := 0
+endif
+ifeq ($(ANDROID_VERSION_PATCH),)
+ ANDROID_VERSION_PATCH := 0
+endif
+
LOCAL_CFLAGS += \
-DANDROID_VERSION_MAJOR=$(ANDROID_VERSION_MAJOR) \
-DANDROID_VERSION_MINOR=$(ANDROID_VERSION_MINOR) \
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.48.tar.bz2/libhybris/compat/ui/Android.mk
^
|
@@ -19,8 +19,14 @@
libutils \
libbinder \
libhardware \
+ liblog \
libui
+ifeq ($(shell test $(ANDROID_VERSION_MAJOR) -ge 10 && echo true),true)
+LOCAL_SHARED_LIBRARIES += \
+ libhidlbase
+endif
+
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.48.tar.bz2/libhybris/compat/ui/ui_compatibility_layer.cpp
^
|
@@ -17,6 +17,9 @@
#include <fcntl.h>
#include <sys/stat.h>
+#if ANDROID_VERSION_MAJOR>=10
+#include <ui/Gralloc.h>
+#endif
#include <ui/GraphicBuffer.h>
#include <ui/GraphicBufferMapper.h>
#include <ui/GraphicBufferAllocator.h>
@@ -66,7 +69,13 @@
if (!buffer)
return NULL;
- buffer->self = new android::GraphicBuffer(w, h, format, usage, stride, (native_handle_t*) handle, keepOwnership);
+#if ANDROID_VERSION_MAJOR>=8
+ buffer->self = new android::GraphicBuffer(w, h, format, 1/* layerCount */, usage, stride,
+ (native_handle_t*) handle, keepOwnership);
+#else
+ buffer->self = new android::GraphicBuffer(w, h, format, usage, stride,
+ (native_handle_t*) handle, keepOwnership);
+#endif
return buffer;
@@ -108,7 +117,11 @@
uint32_t graphic_buffer_reallocate(struct graphic_buffer *buffer, uint32_t w,
uint32_t h, int32_t f, uint32_t usage)
{
+#if ANDROID_VERSION_MAJOR>=8
+ return buffer->self->reallocate(w, h, f, 1/* layerCount */, usage);
+#else
return buffer->self->reallocate(w, h, f, usage);
+#endif
}
uint32_t graphic_buffer_lock(struct graphic_buffer *buffer, uint32_t usage, void **vaddr)
@@ -142,3 +155,69 @@
{
return buffer->self->initCheck();
}
+
+#if ANDROID_VERSION_MAJOR>=10
+using android::GraphicBufferAllocator;
+using android::GraphicBufferMapper;
+using android::PixelFormat;
+using android::status_t;
+
+status_t graphic_buffer_allocator_allocate(uint32_t width, uint32_t height,
+ PixelFormat format, uint32_t layerCount, uint64_t usage,
+ buffer_handle_t* handle, uint32_t* stride,
+ uint64_t graphicBufferId, const char* requestorName)
+{
+ return GraphicBufferAllocator::getInstance().allocate(width, height, format, layerCount, usage,
+ handle, stride, graphicBufferId, requestorName);
+}
+
+status_t graphic_buffer_allocator_free(buffer_handle_t handle) {
+ return GraphicBufferAllocator::getInstance().free(handle);
+}
+
+status_t graphic_buffer_mapper_import_buffer(buffer_handle_t rawHandle,
+ uint32_t width, uint32_t height, uint32_t layerCount,
+ PixelFormat format, uint64_t usage, uint32_t stride,
+ buffer_handle_t* outHandle)
+{
+ return GraphicBufferMapper::getInstance().importBuffer(rawHandle, width, height, layerCount,
+ format, usage, stride, outHandle);
+}
+
+status_t graphic_buffer_mapper_import_buffer_no_size(buffer_handle_t rawHandle,
+ buffer_handle_t* outHandle)
+{
+ // adapted from GraphicBufferMapper::importBuffer() but skips validation part
+ // needed to implement hybris_gralloc_retain() which doesn't have buffer information passed
+
+ auto &mapper = GraphicBufferMapper::getInstance().getGrallocMapper();
+ buffer_handle_t bufferHandle;
+ status_t error = mapper.importBuffer(android::hardware::hidl_handle(rawHandle), &bufferHandle);
+ if (error != android::NO_ERROR) {
+ ALOGW("importBuffer(%p) failed: %d", rawHandle, error);
+ return error;
+ }
+
+ *outHandle = bufferHandle;
+
+ return android::NO_ERROR;
+}
+
+status_t graphic_buffer_mapper_free_buffer(buffer_handle_t handle) {
+ return GraphicBufferMapper::getInstance().freeBuffer(handle);
+}
+
+
+status_t graphic_buffer_mapper_lock(buffer_handle_t handle, uint32_t usage, const ARect* bounds,
+ void** vaddr, int32_t* outBytesPerPixel,
+ int32_t* outBytesPerStride) {
+ auto rect = android::Rect(bounds->left, bounds->top, bounds->right, bounds->bottom);
+ return GraphicBufferMapper::getInstance().lock(handle, usage, rect,
+ vaddr, outBytesPerPixel, outBytesPerStride);
+}
+
+status_t graphic_buffer_mapper_unlock(buffer_handle_t handle)
+{
+ return GraphicBufferMapper::getInstance().unlock(handle);
+}
+#endif // ANDROID_VERSION_MAJOR>=10
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.48.tar.bz2/libhybris/hybris/Makefile.am
^
|
@@ -1,4 +1,4 @@
-SUBDIRS = include common properties hardware gralloc
+SUBDIRS = include common properties hardware ui gralloc
if HAS_ANDROID_4_2_0
SUBDIRS += libsync
@@ -6,7 +6,7 @@
if HAS_ANDROID_5_0_0
SUBDIRS += libsync
endif
-SUBDIRS += platforms egl glesv1 glesv2 ui sf input camera vibrator media opencl wifi hwc2
+SUBDIRS += platforms egl glesv1 glesv2 sf input camera vibrator media opencl wifi hwc2
if HAS_VULKAN_HEADERS
SUBDIRS += vulkan
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.48.tar.bz2/libhybris/hybris/common/n/linker.cpp
^
|
@@ -4446,12 +4446,28 @@
static const char* get_executable_path() {
static std::string executable_path;
if (executable_path.empty()) {
+#ifdef DISABLED_FOR_HYBRIS_SUPPORT
char path[PATH_MAX];
ssize_t path_len = readlink("/proc/self/exe", path, sizeof(path));
if (path_len == -1 || path_len >= static_cast<ssize_t>(sizeof(path))) {
__libc_fatal("readlink('/proc/self/exe') failed: %s", strerror(errno));
}
executable_path = std::string(path, path_len);
+#else
+ if (!getauxval(AT_SECURE)) {
+ const char* use_vendor_namespace = getenv("HYBRIS_USE_VENDOR_NAMESPACE");
+ if (use_vendor_namespace != nullptr) {
+ executable_path = "/vendor/bin/yes";
+ }
+ }
+ if (executable_path.empty()) {
+#if defined(__aarch64__) || defined(__x86_64__)
+ executable_path = "/system/bin/app_process64";
+#else
+ executable_path = "/system/bin/app_process32";
+#endif
+ }
+#endif
}
return executable_path.c_str();
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.48.tar.bz2/libhybris/hybris/common/native_handle.c
^
|
@@ -58,3 +58,23 @@
}
return 0;
}
+
+native_handle_t* native_handle_clone(const native_handle_t* handle) {
+ native_handle_t* clone = native_handle_create(handle->numFds, handle->numInts);
+ if (clone == NULL) return NULL;
+
+ for (int i = 0; i < handle->numFds; i++) {
+ clone->data[i] = dup(handle->data[i]);
+ if (clone->data[i] == -1) {
+ clone->numFds = i;
+ native_handle_close(clone);
+ native_handle_delete(clone);
+ return NULL;
+ }
+ }
+
+ memcpy(&clone->data[handle->numFds], &handle->data[handle->numFds],
+ sizeof(int) * handle->numInts);
+
+ return clone;
+}
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.48.tar.bz2/libhybris/hybris/common/o/linker_main.cpp
^
|
@@ -192,12 +192,28 @@
static const char* get_executable_path() {
static std::string executable_path;
if (executable_path.empty()) {
+#ifdef DISABLED_FOR_HYBRIS_SUPPORT
char path[PATH_MAX];
ssize_t path_len = readlink("/proc/self/exe", path, sizeof(path));
if (path_len == -1 || path_len >= static_cast<ssize_t>(sizeof(path))) {
async_safe_fatal("readlink('/proc/self/exe') failed: %s", strerror(errno));
}
executable_path = std::string(path, path_len);
+#else
+ if (!getauxval(AT_SECURE)) {
+ const char* use_vendor_namespace = getenv("HYBRIS_USE_VENDOR_NAMESPACE");
+ if (use_vendor_namespace != nullptr) {
+ executable_path = "/vendor/bin/yes";
+ }
+ }
+ if (executable_path.empty()) {
+#if defined(__aarch64__) || defined(__x86_64__)
+ executable_path = "/system/bin/app_process64";
+#else
+ executable_path = "/system/bin/app_process32";
+#endif
+ }
+#endif
}
return executable_path.c_str();
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.48.tar.bz2/libhybris/hybris/common/q/Makefile.am
^
|
@@ -51,6 +51,11 @@
-D_USING_LIBCXX \
$(ARCH_FLAGS) \
$(ANDROID_HEADERS_CFLAGS)
+
+if HAS_ANDROID_11_0_0
+q_la_CPPFLAGS += -DHAS_ANDROID_11_0_0
+endif
+
q_la_LDFLAGS = \
-lsupc++ \
-module \
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.48.tar.bz2/libhybris/hybris/common/q/hybris_compat.h
^
|
@@ -50,10 +50,24 @@
* Experimental support for SHT_RELR sections. For details, see proposal
* at https://groups.google.com/forum/#!topic/generic-abi/bX460iggiKg
*/
-#define DT_RELR 0x6fffe000
-#define DT_RELRSZ 0x6fffe001
-#define DT_RELRENT 0x6fffe003
-#define DT_RELRCOUNT 0x6fffe005
+#define DT_ANDROID_RELR 0x6fffe000
+#define DT_ANDROID_RELRSZ 0x6fffe001
+#define DT_ANDROID_RELRENT 0x6fffe003
+#define DT_ANDROID_RELRCOUNT 0x6fffe005
+
+/* Defined in glibc >= 2.36, and used in bionic since apilevel 30 */
+#ifndef DT_RELRSZ
+#define DT_RELRSZ 35
+#endif
+
+#ifndef DT_RELR
+#define DT_RELR 36
+#endif
+
+#ifndef DT_RELRENT
+#define DT_RELRENT 37
+#endif
+
/*
* From bionic/libc/include/elf.h
*
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.48.tar.bz2/libhybris/hybris/common/q/linker.cpp
^
|
@@ -106,6 +106,10 @@
static const char* const kLdConfigFilePath = "/system/etc/ld.config.txt";
static const char* const kLdConfigVndkLiteFilePath = "/system/etc/ld.config.vndk_lite.txt";
+#ifdef HAS_ANDROID_11_0_0
+static const char* const kLdGeneratedConfigFilePath = "/linkerconfig/ld.config.txt";
+#endif
+
#if defined(__LP64__)
static const char* const kSystemLibDir = "/system/lib64";
static const char* const kOdmLibDir = "/odm/lib64";
@@ -3722,14 +3726,17 @@
#endif
case DT_RELR:
+ case DT_ANDROID_RELR:
relr_ = reinterpret_cast<ElfW(Relr)*>(load_bias + d->d_un.d_ptr);
break;
case DT_RELRSZ:
+ case DT_ANDROID_RELRSZ:
relr_count_ = d->d_un.d_val / sizeof(ElfW(Relr));
break;
case DT_RELRENT:
+ case DT_ANDROID_RELRENT:
if (d->d_un.d_val != sizeof(ElfW(Relr))) {
DL_ERR("invalid DT_RELRENT: %zd", static_cast<size_t>(d->d_un.d_val));
return false;
@@ -3737,7 +3744,7 @@
break;
// Ignored (see DT_RELCOUNT comments for details).
- case DT_RELRCOUNT:
+ case DT_ANDROID_RELRCOUNT:
break;
case DT_INIT:
@@ -4208,6 +4215,16 @@
return path;
}
+#ifdef HAS_ANDROID_11_0_0
+ if (file_exists(kLdGeneratedConfigFilePath)) {
+ return kLdGeneratedConfigFilePath;
+ } else {
+ // TODO(b/146386369) : Adjust log level and add more condition to log only when necessary
+ INFO("Warning: failed to find generated linker configuration from \"%s\"",
+ kLdGeneratedConfigFilePath);
+ }
+#endif
+
path = get_ld_config_file_vndk_path();
if (file_exists(path.c_str())) {
return path;
@@ -4317,9 +4334,10 @@
for (auto it : namespaces) {
// hybris we have no libdl soinfo
// it.second->add_soinfo(ld_android_so);
- if (vdso != nullptr) {
- it.second->add_soinfo(vdso);
- }
+// hybris adding vdso without the previous command causes a crash
+ // if (vdso != nullptr) {
+ // it.second->add_soinfo(vdso);
+ // }
// somain and ld_preloads are added to these namespaces after LD_PRELOAD libs are linked
}
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.48.tar.bz2/libhybris/hybris/common/q/linker_main.cpp
^
|
@@ -754,12 +754,28 @@
static const char* get_executable_path() {
static std::string executable_path;
if (executable_path.empty()) {
+#ifdef DISABLED_FOR_HYBRIS_SUPPORT
char path[PATH_MAX];
ssize_t path_len = readlink("/proc/self/exe", path, sizeof(path));
if (path_len == -1 || path_len >= static_cast<ssize_t>(sizeof(path))) {
async_safe_fatal("readlink('/proc/self/exe') failed: %s", strerror(errno));
}
executable_path = std::string(path, path_len);
+#else
+ if (!getauxval(AT_SECURE)) {
+ const char* use_vendor_namespace = getenv("HYBRIS_USE_VENDOR_NAMESPACE");
+ if (use_vendor_namespace != nullptr) {
+ executable_path = "/vendor/bin/yes";
+ }
+ }
+ if (executable_path.empty()) {
+#if defined(__aarch64__) || defined(__x86_64__)
+ executable_path = "/system/bin/app_process64";
+#else
+ executable_path = "/system/bin/app_process32";
+#endif
+ }
+#endif
}
return executable_path.c_str();
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.48.tar.bz2/libhybris/hybris/egl/Makefile.am
^
|
@@ -56,7 +56,7 @@
pkgconfig_DATA = egl.pc
endif
-libEGL__GL_LIB_SUFFIX__la_CFLAGS = -I$(top_srcdir)/include $(ANDROID_HEADERS_CFLAGS) -DPKGLIBDIR="\"$(pkglibdir)/\"" -I$(top_srcdir)/common -DDEFAULT_EGL_PLATFORM="\"@DEFAULT_EGL_PLATFORM@\""
+libEGL__GL_LIB_SUFFIX__la_CFLAGS = -I$(top_srcdir)/include $(ANDROID_HEADERS_CFLAGS) -DPKGLIBDIR="\"$(pkglibdir)/\"" -I$(top_srcdir)/common -I$(top_srcdir)/platforms/common -DDEFAULT_EGL_PLATFORM="\"@DEFAULT_EGL_PLATFORM@\""
if WANT_MESA
libEGL__GL_LIB_SUFFIX__la_CFLAGS += -DLIBHYBRIS_WANTS_MESA_X11_HEADERS
endif
@@ -70,7 +70,7 @@
libEGL__GL_LIB_SUFFIX__la_CFLAGS += $(GLVND_CFLAGS) -I$(srcdir)/glvnd -I$(builddir)/glvnd -fvisibility=hidden
endif
-libEGL__GL_LIB_SUFFIX__la_CXXFLAGS = -I$(top_srcdir)/include $(ANDROID_HEADERS_CFLAGS) -I$(top_srcdir)/common -DPKGLIBDIR="\"$(pkglibdir)/\""
+libEGL__GL_LIB_SUFFIX__la_CXXFLAGS = -I$(top_srcdir)/include $(ANDROID_HEADERS_CFLAGS) -I$(top_srcdir)/common -I$(top_srcdir)/platforms/common -DPKGLIBDIR="\"$(pkglibdir)/\""
if WANT_MESA
libEGL__GL_LIB_SUFFIX__la_CXXFLAGS += -DLIBHYBRIS_WANTS_MESA_X11_HEADERS
endif
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.48.tar.bz2/libhybris/hybris/egl/egl.c
^
|
@@ -315,6 +315,11 @@
HYBRIS_TRACE_END("hybris-egl", "eglCreateWindowSurface", "");
return result;
}
+EGLSurface eglCreatePlatformWindowSurface(EGLDisplay dpy, EGLConfig config,
+ void *native_window, const EGLAttrib *attrib_list)
+{
+ return eglCreateWindowSurface(dpy, config, (uintptr_t) native_window, (const EGLint *) attrib_list);
+}
static EGLSurface _my_eglCreatePlatformWindowSurfaceEXT(EGLDisplay dpy, EGLConfig config,
void *native_window, const EGLint *attrib_list)
@@ -503,6 +508,7 @@
OVERRIDE_SAMENAME(eglGetPlatformDisplay),
OVERRIDE_SAMENAME(eglTerminate),
OVERRIDE_SAMENAME(eglCreateWindowSurface),
+ OVERRIDE_SAMENAME(eglCreatePlatformWindowSurface),
OVERRIDE_SAMENAME(eglDestroySurface),
OVERRIDE_SAMENAME(eglSwapInterval),
OVERRIDE_SAMENAME(eglCreateContext),
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.48.tar.bz2/libhybris/hybris/egl/platforms/common/eglplatformcommon.cpp
^
|
@@ -159,11 +159,14 @@
memcpy(&native->data[0], fds, num_fds * sizeof(int));
memcpy(&native->data[num_fds], ints, num_ints * sizeof(int));
- int ret = hybris_gralloc_retain(native);
+ const native_handle_t* out_handle = NULL;
+ int ret = hybris_gralloc_import_buffer(native, &out_handle);
+ native_handle_close(native);
+ native_handle_delete(native);
if (ret == 0)
{
- RemoteWindowBuffer *buf = new RemoteWindowBuffer(width, height, stride, format, usage, (buffer_handle_t)native);
+ RemoteWindowBuffer *buf = new RemoteWindowBuffer(width, height, stride, format, usage, (buffer_handle_t)out_handle);
buf->common.incRef(&buf->common);
*buffer = (EGLClientBuffer) static_cast<ANativeWindowBuffer *>(buf);
return EGL_TRUE;
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.48.tar.bz2/libhybris/hybris/gralloc/Makefile.am
^
|
@@ -15,8 +15,8 @@
else
libgralloc_la_CFLAGS = -DHAS_GRALLOC1_HEADER=0
endif
-libgralloc_la_CFLAGS += -I$(top_srcdir)/include $(ANDROID_HEADERS_CFLAGS)
-libgralloc_la_CXXFLAGS = -std=gnu++11 -I$(top_srcdir)/include
+libgralloc_la_CFLAGS += -I$(top_srcdir)/include -I$(top_srcdir)/common $(ANDROID_HEADERS_CFLAGS)
+libgralloc_la_CXXFLAGS = -std=gnu++11 -I$(top_srcdir)/include -I$(top_srcdir)/common
if WANT_TRACE
libgralloc_la_CFLAGS += -DDEBUG
endif
@@ -25,4 +25,5 @@
endif
libgralloc_la_LDFLAGS = \
$(top_builddir)/hardware/libhardware.la \
+ $(top_builddir)/ui/libui.la \
-version-info "1":"0":"0"
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.48.tar.bz2/libhybris/hybris/gralloc/gralloc.c
^
|
@@ -33,6 +33,7 @@
#include "hybris-gralloc.h"
#else
#include <hybris/gralloc/gralloc.h>
+#include <hybris/ui/ui.h>
#include <hybris/common/binding.h>
#endif
@@ -43,6 +44,7 @@
#include <assert.h>
#include <dlfcn.h>
+#include "logging.h"
static int version = -1;
static hw_module_t *gralloc_hardware_module = NULL;
@@ -94,6 +96,12 @@
#define GRALLOC1(code) (0) {}
#endif
+#if ANDROID_VERSION_MAJOR>=10
+#define GRALLOC_COMPAT(code) (version == 2) { code }
+#else
+#define GRALLOC_COMPAT(code) (0) {}
+#endif
+
#define NO_GRALLOC { fprintf(stderr, "%s:%d: called gralloc method without gralloc loaded\n", __func__, __LINE__); assert(NULL); }
void hybris_gralloc_deinitialize(void);
@@ -144,12 +152,19 @@
assert(NULL);
}
} else {
- fprintf(stderr, "failed to find/load gralloc module\n");
- assert(NULL);
+#if ANDROID_VERSION_MAJOR>=10
+ hybris_ui_initialize();
+ if (hybris_ui_check_for_symbol("graphic_buffer_allocator_allocate")) {
+ version = 2;
+ } else
+#endif
+ {
+ fprintf(stderr, "failed to find/load gralloc module\n");
+ assert(NULL);
+ }
}
} else {
- // shouldn't reach here.
- assert(NULL);
+ TRACE("hybris gralloc module has been already initialized\n");
}
}
@@ -228,7 +243,13 @@
{
int ret = -ENOSYS;
- if GRALLOC1(
+ if GRALLOC_COMPAT(
+ if (was_allocated) {
+ ret = graphic_buffer_allocator_free(handle);
+ } else {
+ ret = graphic_buffer_mapper_free_buffer(handle);
+ }
+ ) else if GRALLOC1(
ret = gralloc1_release(gralloc1_device, handle);
// this needs to happen if the last reference is gone, this function is
@@ -253,6 +274,27 @@
return ret;
}
+int hybris_gralloc_import_buffer(buffer_handle_t raw_handle, buffer_handle_t* out_handle)
+{
+ int ret = -ENOSYS;
+
+ if GRALLOC_COMPAT(
+ ret = graphic_buffer_mapper_import_buffer_no_size(raw_handle, out_handle);
+ ) else {
+ // clone input buffer first when using gralloc 1 or 0
+ // to keep same ownership semantics with HIDL HAL
+ buffer_handle_t handle = NULL;
+ handle = native_handle_clone((native_handle_t*)raw_handle);
+ if (!handle)
+ return -ENOSYS;
+
+ ret = hybris_gralloc_retain(handle);
+ *out_handle = handle;
+ }
+
+ return ret;
+}
+
int hybris_gralloc_retain(buffer_handle_t handle)
{
int ret = -ENOSYS;
@@ -270,7 +312,10 @@
{
int ret = -ENOSYS;
- if GRALLOC1(
+ if GRALLOC_COMPAT(
+ ret = graphic_buffer_allocator_allocate(width, height, format, 1 /*layerCount*/, usage,
+ handle_ptr, stride_ptr, 0 /*graphicBufferId*/, "hybris-gralloc");
+ ) else if GRALLOC1(
gralloc1_buffer_descriptor_t desc;
uint64_t producer_usage;
uint64_t consumer_usage;
@@ -303,7 +348,19 @@
{
int ret = -ENOSYS;
- if GRALLOC1(
+ if GRALLOC_COMPAT(
+ ARect bounds;
+ int32_t outBytesPerPixel;
+ int32_t outBytesPerStride;
+
+ bounds.left = l;
+ bounds.top = t;
+ bounds.right = l + w;
+ bounds.bottom = t + h;
+
+ ret = graphic_buffer_mapper_lock(handle, usage, &bounds,
+ vaddr, &outBytesPerPixel, &outBytesPerStride);
+ ) else if GRALLOC1(
uint64_t producer_usage;
uint64_t consumer_usage;
gralloc1_rect_t access_region;
@@ -327,7 +384,9 @@
{
int ret = -ENOSYS;
- if GRALLOC1(
+ if GRALLOC_COMPAT(
+ ret = graphic_buffer_mapper_unlock(handle);
+ ) else if GRALLOC1(
int releaseFence = 0;
ret = gralloc1_unlock(gralloc1_device, handle, &releaseFence);
close(releaseFence);
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.48.tar.bz2/libhybris/hybris/include/hybris/gralloc/gralloc.h
^
|
@@ -29,6 +29,7 @@
void hybris_gralloc_initialize(int framebuffer);
void hybris_gralloc_deinitialize(void);
int hybris_gralloc_release(buffer_handle_t handle, int was_allocated);
+int hybris_gralloc_import_buffer(buffer_handle_t raw_handle, buffer_handle_t* out_handle);
int hybris_gralloc_retain(buffer_handle_t handle);
int hybris_gralloc_allocate(int width, int height, int format, int usage, buffer_handle_t *handle, uint32_t *stride);
int hybris_gralloc_lock(buffer_handle_t handle, int usage, int l, int t, int w, int h, void **vaddr);
|
[-]
[+]
|
Added |
_service:tar_git:libhybris-0.0.5.48.tar.bz2/libhybris/hybris/include/hybris/ui/ui.h
^
|
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2022 Jolla Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef hybris_ui_header_include_guard__
+#define hybris_ui_header_include_guard__
+
+#include <stdbool.h>
+#include <hybris/ui/ui_compatibility_layer.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void hybris_ui_initialize();
+bool hybris_ui_check_for_symbol(const char *sym);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // hybris_ui_header_include_guard__
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.48.tar.bz2/libhybris/hybris/include/hybris/ui/ui_compatibility_layer.h
^
|
@@ -57,6 +57,31 @@
int graphic_buffer_init_check(struct graphic_buffer *buffer);
+#if ANDROID_VERSION_MAJOR>=10
+ typedef int32_t status_t;
+ typedef int32_t PixelFormat;
+
+ status_t graphic_buffer_allocator_allocate(uint32_t width, uint32_t height,
+ PixelFormat format, uint32_t layerCount, uint64_t usage,
+ buffer_handle_t* handle, uint32_t* stride,
+ uint64_t graphicBufferId, const char* requestorName);
+ status_t graphic_buffer_allocator_free(buffer_handle_t handle);
+
+ status_t graphic_buffer_mapper_import_buffer(buffer_handle_t rawHandle,
+ uint32_t width, uint32_t height, uint32_t layerCount,
+ PixelFormat format, uint64_t usage, uint32_t stride,
+ buffer_handle_t* outHandle);
+ status_t graphic_buffer_mapper_import_buffer_no_size(buffer_handle_t rawHandle,
+ buffer_handle_t* outHandle);
+
+ status_t graphic_buffer_mapper_free_buffer(buffer_handle_t handle);
+
+ status_t graphic_buffer_mapper_lock(buffer_handle_t handle, uint32_t usage, const ARect* bounds,
+ void** vaddr, int32_t* outBytesPerPixel,
+ int32_t* outBytesPerStride);
+ status_t graphic_buffer_mapper_unlock(buffer_handle_t handle);
+#endif
+
#ifdef __cplusplus
}
#endif
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.48.tar.bz2/libhybris/hybris/platforms/common/server_wlegl.cpp
^
|
@@ -100,9 +100,11 @@
buffer = server_wlegl_buffer_create(client, id, width, height, stride,
format, usage, native, wlegl);
+ // hybris_gralloc_import_buffer copied the raw handle
+ native_handle_close((native_handle_t *)native);
+ native_handle_delete((native_handle_t *)native);
+
if (!buffer) {
- native_handle_close((native_handle_t *)native);
- native_handle_delete((native_handle_t *)native);
wl_resource_post_error(resource,
ANDROID_WLEGL_ERROR_BAD_HANDLE,
"invalid native handle");
@@ -127,6 +129,18 @@
usage |= GRALLOC_USAGE_HW_COMPOSER;
+ // frameworks/native/libs/gui/BufferQueueProducer.cpp:1434 (android-11.0.0_r37)
+ // TODO: do we need to specify a different default format in some cases?
+ // This avoids a crash if the pixel format is unspecified.
+ // Initially i chose HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED, but the documentation
+ // for the pixel formats says about the IMPLEMENTATION_DEFINED format:
+ // "This format must never be used with any of the BufferUsage::CPU_* usage flags."
+ // (hardware/interfaces/graphics/common/1.0/types.hal).
+ // The default in android seems to be RGBA_8888 if format == 0 (unless changed,
+ // via a call to setDefaultBufferFormat), so let's just use RGBA_8888 for now such
+ // that we don't need to analyze the usage flags.
+ if (format == 0) format = HAL_PIXEL_FORMAT_RGBA_8888;
+
int r = hybris_gralloc_allocate(width, height, format, usage, &_handle, (uint32_t*)&_stride);
if (r) {
HYBRIS_ERROR_LOG(SERVER_WLEGL, "failed to allocate buffer\n");
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.48.tar.bz2/libhybris/hybris/platforms/common/server_wlegl_buffer.cpp
^
|
@@ -71,14 +71,15 @@
buffer->resource = wl_resource_create(client, &wl_buffer_interface, 1, id);
wl_resource_set_implementation(buffer->resource, &server_wlegl_buffer_impl, buffer, server_wlegl_buffer_dtor);
- ret = hybris_gralloc_retain(handle);
+ const native_handle_t* out_handle = NULL;
+ ret = hybris_gralloc_import_buffer(handle, &out_handle);
if (ret) {
delete buffer;
return NULL;
}
buffer->buf = new RemoteWindowBuffer(
- width, height, stride, format, usage, handle);
+ width, height, stride, format, usage, out_handle);
buffer->buf->common.incRef(&buffer->buf->common);
return buffer;
}
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.48.tar.bz2/libhybris/hybris/platforms/wayland/wayland_window_common.cpp
^
|
@@ -584,11 +584,15 @@
/* ownership of fds passed to native_handle_t */
wsb->fds.size = 0;
- wsb->handle = (buffer_handle_t) native;
+ wsb->handle = NULL;
wsb->format = format;
wsb->stride = stride;
- int ret = hybris_gralloc_retain(wsb->handle);
+ int ret = hybris_gralloc_import_buffer(native, &wsb->handle);
+
+ native_handle_close(native);
+ native_handle_delete(native);
+
if (ret) {
fprintf(stderr,"failed to register buffer\n");
return;
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.48.tar.bz2/libhybris/hybris/tests/Makefile.am
^
|
@@ -20,8 +20,11 @@
if WANT_WAYLAND
bin_PROGRAMS += \
- test_vulkan \
test_camera
+if HAS_VULKAN_HEADERS
+bin_PROGRAMS += \
+ test_vulkan
+endif
endif
test_dlopen_SOURCES = test_dlopen.c
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.48.tar.bz2/libhybris/hybris/ui/ui.c
^
|
@@ -17,12 +17,19 @@
#include <dlfcn.h>
#include <stddef.h>
+#include <android-version.h>
+#if ANDROID_VERSION_MAJOR>=10
+#include <android/rect.h>
+#include <cutils/native_handle.h>
+#endif
+
#include <hybris/common/binding.h>
-#include <hybris/ui/ui_compatibility_layer.h>
+#include <hybris/ui/ui.h>
#define COMPAT_LIBRARY_PATH "libui_compat_layer.so"
HYBRIS_LIBRARY_INITIALIZE(ui, COMPAT_LIBRARY_PATH);
+HYBRIS_LIRBARY_CHECK_SYMBOL(ui);
HYBRIS_IMPLEMENT_FUNCTION0(ui, struct graphic_buffer*, graphic_buffer_new);
HYBRIS_IMPLEMENT_FUNCTION4(ui, struct graphic_buffer*,
@@ -56,3 +63,30 @@
#endif
HYBRIS_IMPLEMENT_FUNCTION1(ui, int, graphic_buffer_init_check,
struct graphic_buffer*);
+
+#if ANDROID_VERSION_MAJOR>=10
+HYBRIS_IMPLEMENT_FUNCTION9(ui, status_t, graphic_buffer_allocator_allocate,
+ uint32_t, uint32_t,
+ PixelFormat, uint32_t, uint64_t,
+ buffer_handle_t*, uint32_t*,
+ uint64_t, const char*);
+HYBRIS_IMPLEMENT_FUNCTION1(ui, status_t, graphic_buffer_allocator_free,
+ buffer_handle_t);
+
+HYBRIS_IMPLEMENT_FUNCTION8(ui, status_t, graphic_buffer_mapper_import_buffer,
+ buffer_handle_t, uint32_t, uint32_t, uint32_t,
+ PixelFormat, uint64_t, uint32_t,
+ buffer_handle_t*);
+
+HYBRIS_IMPLEMENT_FUNCTION2(ui, status_t, graphic_buffer_mapper_import_buffer_no_size,
+ buffer_handle_t, buffer_handle_t*);
+
+HYBRIS_IMPLEMENT_FUNCTION1(ui, status_t, graphic_buffer_mapper_free_buffer,
+ buffer_handle_t);
+
+HYBRIS_IMPLEMENT_FUNCTION6(ui, status_t, graphic_buffer_mapper_lock,
+ buffer_handle_t, uint32_t, const ARect*,
+ void**, int32_t*, int32_t*);
+HYBRIS_IMPLEMENT_FUNCTION1(ui, status_t, graphic_buffer_mapper_unlock,
+ buffer_handle_t);
+#endif
|