Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pmaports
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
postmarketOS
pmaports
Commits
f5184062
Unverified
Commit
f5184062
authored
5 years ago
by
Dang Huynh
Committed by
Oliver Smith
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
hybris/libhybris: updated for gralloc handler (
!428
)
Signed-off-by:
Danct12
<
danct12@disroot.org
>
parent
593fe01b
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
hybris/libhybris/0003-PATCH-v2-Implement-X11-EGL-platform-based-on-wayland.patch
+46
-62
46 additions, 62 deletions
...ATCH-v2-Implement-X11-EGL-platform-based-on-wayland.patch
hybris/libhybris/APKBUILD
+3
-3
3 additions, 3 deletions
hybris/libhybris/APKBUILD
with
49 additions
and
65 deletions
hybris/libhybris/0003-Implement-X11-EGL-platform-based-on-wayland
-code
.patch
→
hybris/libhybris/0003-
PATCH-v2-
Implement-X11-EGL-platform-based-on-wayland.patch
+
46
−
62
View file @
f5184062
From ae11619430c59ba4a23acd8659157f43b863d2ed Mon Sep 17 00:00:00 2001
From: NeKit <nekit1000@gmail.com>
Date: Wed, 18 Oct 2017 23:12:51 +0300
Subject: [PATCH 3/3] Implement X11 EGL platform based on wayland code.
From d3fece21813f0a0e00e751703a8998b40f8dad73 Mon Sep 17 00:00:00 2001
From: Danct12 <danct12@disroot.org>
Date: Sat, 8 Jun 2019 16:56:10 +0700
Subject: [PATCH] [PATCH v2] Implement X11 EGL platform based on wayland code.
Original patch by NeKit <nekit1000@gmail.com>
Patched up for compatibility with libhybris gralloc support by Danct12 <danct12@disroot.org>
* Allow window system to hook eglGetConfigAttrib (needed for X11 EGL_NATIVE_VISUAL_ID)
...
...
@@ -13,20 +16,21 @@ Subject: [PATCH 3/3] Implement X11 EGL platform based on wayland code.
* x11nativewindow: use same depth as target window for pixmap.
Call xcb_present_pixmap instead of xcb_copy_area to present pixmap
Signed-off-by: Danct12 <danct12@disroot.org>
---
hybris/configure.ac | 1 +
hybris/egl/egl.c | 13 +-
hybris/egl/platforms/Makefile.am | 2 +-
.../platforms/common/eglplatformcommon.cpp | 2 +-
hybris/egl/platforms/x11/Makefile.am | 43 +
hybris/egl/platforms/x11/eglplatform_x11.cpp | 235 ++++++
hybris/egl/platforms/x11/x11_window.cpp | 742 ++++++++++++++++++
hybris/egl/platforms/x11/x11_window.h | 206 +++++
hybris/egl/platforms/x11/xcb_drihybris.c | 167 ++++
hybris/egl/platforms/x11/xcb_drihybris.h | 122 +++
hybris/egl/ws.c | 9 +
hybris/egl/ws.h | 2 +
12 files changed, 1541 insertions(+), 3 deletions(-)
hybris/configure.ac | 1 +
hybris/egl/egl.c | 13 +-
hybris/egl/platforms/Makefile.am | 2 +-
hybris/egl/platforms/x11/Makefile.am | 43 ++
hybris/egl/platforms/x11/eglplatform_x11.cpp | 229 ++++++
hybris/egl/platforms/x11/x11_window.cpp | 739 +++++++++++++++++++
hybris/egl/platforms/x11/x11_window.h | 195 +++++
hybris/egl/platforms/x11/xcb_drihybris.c | 167 +++++
hybris/egl/platforms/x11/xcb_drihybris.h | 122 +++
hybris/egl/ws.c | 9 +
hybris/egl/ws.h | 2 +
11 files changed, 1520 insertions(+), 2 deletions(-)
create mode 100644 hybris/egl/platforms/x11/Makefile.am
create mode 100644 hybris/egl/platforms/x11/eglplatform_x11.cpp
create mode 100644 hybris/egl/platforms/x11/x11_window.cpp
...
...
@@ -35,10 +39,10 @@ Subject: [PATCH 3/3] Implement X11 EGL platform based on wayland code.
create mode 100644 hybris/egl/platforms/x11/xcb_drihybris.h
diff --git a/hybris/configure.ac b/hybris/configure.ac
index
dac8bc9..526567a
100644
index
b3ddc50..7d20c34
100644
--- a/hybris/configure.ac
+++ b/hybris/configure.ac
@@ -2
5
4,6 +2
5
4,7 @@
AC_CONFIG_FILES([
@@ -2
6
4,6 +2
6
4,7 @@
AC_CONFIG_FILES([
egl/platforms/null/Makefile
egl/platforms/fbdev/Makefile
egl/platforms/wayland/Makefile
...
...
@@ -87,7 +91,7 @@ index 4126752..c52de15 100644
+SUBDIRS += x11
diff --git a/hybris/egl/platforms/x11/Makefile.am b/hybris/egl/platforms/x11/Makefile.am
new file mode 100644
index 0000000..
22eac5e
index 0000000..
4ab00f2
--- /dev/null
+++ b/hybris/egl/platforms/x11/Makefile.am
@@ -0,0 +1,43 @@
...
...
@@ -123,7 +127,7 @@ index 0000000..22eac5e
+eglplatform_x11_la_LDFLAGS = \
+ -avoid-version -module -shared -export-dynamic \
+ $(top_builddir)/egl/platforms/common/libhybris-eglplatformcommon.la \
+ $(top_builddir)/
hardware/libhardware
.la \
+ $(top_builddir)/
gralloc/libgralloc
.la \
+ -lXext -lxcb -lX11-xcb -lxcb-present
+
+if HAS_ANDROID_4_2_0
...
...
@@ -136,10 +140,10 @@ index 0000000..22eac5e
+
diff --git a/hybris/egl/platforms/x11/eglplatform_x11.cpp b/hybris/egl/platforms/x11/eglplatform_x11.cpp
new file mode 100644
index 0000000..
001b733
index 0000000..
3a1ac4f
--- /dev/null
+++ b/hybris/egl/platforms/x11/eglplatform_x11.cpp
@@ -0,0 +1,2
35
@@
@@ -0,0 +1,2
29
@@
+/****************************************************************************************
+**
+** Copyright (C) 2013 Jolla Ltd.
...
...
@@ -190,16 +194,13 @@ index 0000000..001b733
+#include <wayland-egl.h>
+}
+
+#include <hybris/gralloc/gralloc.h>
+#include "x11_window.h"
+#include "logging.h"
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+
+static gralloc_module_t *gralloc = 0;
+static alloc_device_t *alloc = 0;
+
+
+static const char * (*_eglQueryString)(EGLDisplay dpy, EGLint name) = NULL;
+static __eglMustCastToProperFunctionPointerType (*_eglGetProcAddress)(const char *procname) = NULL;
+static EGLSyncKHR (*_eglCreateSyncKHR)(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list) = NULL;
...
...
@@ -213,10 +214,7 @@ index 0000000..001b733
+
+extern "C" void x11ws_init_module(struct ws_egl_interface *egl_iface)
+{
+ int err;
+ hw_get_module(GRALLOC_HARDWARE_MODULE_ID, (const hw_module_t **) &gralloc);
+ err = gralloc_open((const hw_module_t *) gralloc, &alloc);
+ TRACE("++ %lu x11: got gralloc %p err:%s", pthread_self(), gralloc, strerror(-err));
+ hybris_gralloc_initialize(0);
+ eglplatformcommon_init(egl_iface);
+}
+
...
...
@@ -275,7 +273,7 @@ index 0000000..001b733
+ abort();
+ }
+
+ X11NativeWindow *window = new X11NativeWindow(xdpy->xl_display, xlib_window
, alloc, gralloc
);
+ X11NativeWindow *window = new X11NativeWindow(xdpy->xl_display, xlib_window);
+ window->common.incRef(&window->common);
+ return (EGLNativeWindowType) static_cast<struct ANativeWindow *>(window);
+}
...
...
@@ -377,10 +375,10 @@ index 0000000..001b733
+};
diff --git a/hybris/egl/platforms/x11/x11_window.cpp b/hybris/egl/platforms/x11/x11_window.cpp
new file mode 100644
index 0000000..
2
6e
8844
index 0000000..6e
ea75b
--- /dev/null
+++ b/hybris/egl/platforms/x11/x11_window.cpp
@@ -0,0 +1,7
42
@@
@@ -0,0 +1,7
39
@@
+/****************************************************************************************
+ **
+ ** Copyright (C) 2013 Jolla Ltd.
...
...
@@ -442,7 +440,7 @@ index 0000000..26e8844
+ pthread_mutex_unlock(&this->mutex);
+}
+
+X11NativeWindow::X11NativeWindow(Display* xl_display, Window xl_window
, alloc_device_t* alloc, gralloc_module_t* gralloc
)
+X11NativeWindow::X11NativeWindow(Display* xl_display, Window xl_window)
+{
+ int wayland_ok;
+
...
...
@@ -459,9 +457,6 @@ index 0000000..26e8844
+ // This is the default as per the EGL documentation
+ this->m_swap_interval = 1;
+
+ this->m_alloc = alloc;
+ m_gralloc = gralloc;
+
+ TRACE("getting X11 window information");
+
+ XWindowAttributes window_attributes;
...
...
@@ -918,7 +913,7 @@ index 0000000..26e8844
+
+ X11NativeWindowBuffer *wnb;
+
+ wnb = new ClientX11Buffer(
m_alloc,
m_width, m_height, m_format, m_usage, m_depth);
+ wnb = new ClientX11Buffer(m_width, m_height, m_format, m_usage, m_depth);
+ m_bufList.push_back(wnb);
+ ++m_freeBufs;
+
...
...
@@ -990,7 +985,7 @@ index 0000000..26e8844
+ void *vaddr;
+ std::list<X11NativeWindowBuffer *>::iterator it;
+
+ ret =
m
_gralloc
->
lock(
m_gralloc,
wnb->handle, wnb->usage, 0, 0, wnb->width, wnb->height, &vaddr);
+ ret =
hybris
_gralloc
_
lock(wnb->handle, wnb->usage, 0, 0, wnb->width, wnb->height, &vaddr);
+ TRACE("wnb:%p gralloc lock returns %i", wnb, ret);
+ TRACE("wnb:%p lock to vaddr %p", wnb, vaddr);
+ TRACE("wnb:%p width=%d stride=%d height=%d format=%d", wnb, wnb->width, wnb->stride, wnb->height, wnb->format);
...
...
@@ -1028,14 +1023,14 @@ index 0000000..26e8844
+ if (m_useShm)
+ {
+ memcpy(m_image->data, vaddr, m_image->bytes_per_line * m_image->height);
+
m
_gralloc
->
unlock(
m_gralloc,
wnb->handle);
+
hybris
_gralloc
_
unlock(wnb->handle);
+ XShmPutImage(m_display, m_window, m_gc, m_image, 0, 0, 0, 0, m_width, m_height, 0);
+ }
+ else
+ {
+ m_image->data = (char *)vaddr;
+ XPutImage(m_display, m_window, m_gc, m_image, 0, 0, 0, 0, m_width, m_height);
+
m
_gralloc
->
unlock(
m_gralloc,
wnb->handle);
+
hybris
_gralloc
_
unlock(wnb->handle);
+ }
+
+ lock();
...
...
@@ -1125,10 +1120,10 @@ index 0000000..26e8844
+// vim: noai:ts=4:sw=4:ss=4:expandtab
diff --git a/hybris/egl/platforms/x11/x11_window.h b/hybris/egl/platforms/x11/x11_window.h
new file mode 100644
index 0000000..e
5be070
index 0000000..e
4464db
--- /dev/null
+++ b/hybris/egl/platforms/x11/x11_window.h
@@ -0,0 +1,
206
@@
@@ -0,0 +1,
195
@@
+/****************************************************************************************
+ **
+ ** Copyright (C) 2013 Jolla Ltd.
...
...
@@ -1159,7 +1154,7 @@ index 0000000..e5be070
+#define X11_WINDOW_H
+#include "nativewindowbase.h"
+#include <linux/fb.h>
+#include <h
ardware
/gralloc.h>
+#include <h
ybris/gralloc
/gralloc.h>
+extern "C" {
+#include <X11/Xlib-xcb.h>
+#include <xcb/present.h>
...
...
@@ -1202,12 +1197,7 @@ index 0000000..e5be070
+{
+friend class X11NativeWindow;
+protected:
+ ClientX11Buffer()
+ : m_alloc(0)
+ {}
+
+ ClientX11Buffer(alloc_device_t* alloc_device,
+ unsigned int width,
+ ClientX11Buffer( unsigned int width,
+ unsigned int height,
+ unsigned int format,
+ unsigned int usage,
...
...
@@ -1221,11 +1211,9 @@ index 0000000..e5be070
+
+ this->busy = 0;
+ this->other = NULL;
+ this->m_alloc = alloc_device;
+ int alloc_ok = this->m_alloc->alloc(this->m_alloc,
+ this->width ? this->width : 1, this->height ? this->height : 1,
+ int alloc_ok = hybris_gralloc_allocate(this->width ? this->width : 1, this->height ? this->height : 1,
+ this->format, this->usage,
+ &this->handle, &this->stride);
+ &this->handle,
(uint32_t*)
&this->stride);
+ assert(alloc_ok == 0);
+ this->youngest = 0;
+ this->common.incRef(&this->common);
...
...
@@ -1236,13 +1224,11 @@ index 0000000..e5be070
+
+ ~ClientX11Buffer()
+ {
+ if (this->m_alloc)
+ m_alloc->free(m_alloc, this->handle);
+ hybris_gralloc_release(this->handle, 1);
+ }
+
+protected:
+ void* vaddr;
+ alloc_device_t* m_alloc;
+
+public:
+
...
...
@@ -1250,7 +1236,7 @@ index 0000000..e5be070
+
+class X11NativeWindow : public BaseNativeWindow {
+public:
+ X11NativeWindow(Display* xl_display, Window xl_window
, alloc_device_t* alloc, gralloc_module_t* gralloc
);
+ X11NativeWindow(Display* xl_display, Window xl_window);
+ ~X11NativeWindow();
+
+ void lock();
...
...
@@ -1323,14 +1309,12 @@ index 0000000..e5be070
+ unsigned int m_defaultHeight;
+ unsigned int m_usage;
+
+ alloc_device_t* m_alloc;
+ pthread_mutex_t mutex;
+ pthread_cond_t cond;
+ int m_queueReads;
+ int m_freeBufs;
+ EGLint *m_damage_rects, m_damage_n_rects;
+ int m_swap_interval;
+ gralloc_module_t *m_gralloc;
+};
+
+#endif
...
...
@@ -1674,5 +1658,5 @@ index c4811c0..92b221a 100644
#endif
--
2.1
7
.0
2.
2
1.0
This diff is collapsed.
Click to expand it.
hybris/libhybris/APKBUILD
+
3
−
3
View file @
f5184062
pkgname
=
libhybris
pkgver
=
1.0_git20190508
pkgrel
=
0
pkgrel
=
1
arch
=
"x86 armhf armv7 aarch64"
url
=
"https://github.com/libhybris/libhybris"
license
=
"Apache"
...
...
@@ -12,7 +12,7 @@ _commit="8ddb15b53d6a63b1545bbf97d00ea93827bd68eb"
source
=
"
$pkgname
-
$_commit
.tar.gz::https://github.com/libhybris/libhybris/archive/
$_commit
.tar.gz
0001-Make-libhybris-compile-with-musl.patch
0002-tests-Regression-test-for-EGL-glibc-TLS-conflict.patch
0003-Implement-X11-EGL-platform-based-on-wayland
-code
.patch
0003-
PATCH-v2-
Implement-X11-EGL-platform-based-on-wayland.patch
0004-Build-test-hwcomposer-7-caf.patch"
pkgdesc
=
"libhybris allows to use bionic-based HW adaptations"
...
...
@@ -164,5 +164,5 @@ dev() {
sha512sums
=
"681e8345ba56d5b9684ab3901c9cfdc6d4f48f55ef97611eef14d9471f08f1c0f60803298224df5110f2a3d08da145a61e38ea241585bc07e30cb48a893dc92b libhybris-8ddb15b53d6a63b1545bbf97d00ea93827bd68eb.tar.gz
9f7a324f18332e44f8789108e32f0587c268d10adaee0040c42d1bece7ab58e292d68243e7814f34f37b3b5dff590758269e531b4f2fd1991334eda4333f5854 0001-Make-libhybris-compile-with-musl.patch
1355a4403d1af8bdf75b9e4502cbfc093b9788224ce7c24a1f6a53dd7996d385d31a3362577a4293db6b6d0dd0ae4e88140b38c658ff0a288d9acfc2753859bb 0002-tests-Regression-test-for-EGL-glibc-TLS-conflict.patch
3915889f243f8232db2b926f9a456b042df61119ada351f27a33888edcc5da605f53d5bd12e4ef30f
65
e
f9
62cd2371952776655e4eaf67f5d8cb6da2664c85b2 0003
-Implement-X11-EGL-platform-based-on-wayland
-code
.patch
db7bb0ffc04042b32d870db364df4d38d9769978f26d71f98dd2569b4cae7fb3839c7a0c421b4
65f9
31a57fcde38b8eca091b7ae0062e32a7e09b93a701397f3 0003-PATCH-v2
-Implement-X11-EGL-platform-based-on-wayland.patch
eda57804fefa1d586e90fb2198c310f65e6dbc7e09b5d1dd7d15df4ab152c4c8915c212230a92c35ec8a013d3ec7a7b1d289653bedb46b7eb2850a477ccebe16 0004-Build-test-hwcomposer-7-caf.patch"
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment