mirror of
https://git.yoctoproject.org/meta-raspberrypi
synced 2026-10-16 03:46:59 +00:00
userland: Add wayland support
backport and fix needed patches for supporting wayland-egl use PACKAGECONFIG for wayland so we can add proper DEPENDS on wayland Fix QA warnings about dev-so Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
1 parent
4db634bcda
commit
bfbe0ce3b4
8 files changed
+3093
-1
No files matched your search
+208
@@ -0,0 +1,208 @@
|
||||
From b5295cb247dfb062843f4a4c9996186e865d0cc2 Mon Sep 17 00:00:00 2001
|
||||
From: Dom Cobley <dc4@broadcom.com>
|
||||
Date: Tue, 9 Jul 2013 09:26:26 -0400
|
||||
Subject: [PATCH 08/16] Allow applications to set next resource handle
|
||||
|
||||
This patch adds provisions in userland to
|
||||
let apps callers set the next rendereing dispmanx resource.
|
||||
It's useful for implementing, say, a buffer carousel.
|
||||
---
|
||||
interface/khronos/common/khrn_client_rpc.h | 2 ++
|
||||
interface/khronos/common/khrn_int_ids.h | 2 ++
|
||||
interface/khronos/egl/egl_client.c | 30 +++++++++++++++++++++++++++---
|
||||
interface/khronos/egl/egl_client_surface.c | 24 +++++++++++++++++++++++-
|
||||
interface/khronos/egl/egl_client_surface.h | 3 ++-
|
||||
interface/khronos/egl/egl_int_impl.h | 5 +++--
|
||||
6 files changed, 59 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/interface/khronos/common/khrn_client_rpc.h b/interface/khronos/common/khrn_client_rpc.h
|
||||
index 418aa67..a7557a8 100644
|
||||
--- a/interface/khronos/common/khrn_client_rpc.h
|
||||
+++ b/interface/khronos/common/khrn_client_rpc.h
|
||||
@@ -683,6 +683,7 @@ static INLINE void rpc_call12_out_ctrl(CLIENT_THREAD_STATE_T *thread,uint32_t id
|
||||
static INLINE void rpc_call13_out_ctrl(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6, uint32_t p7, uint32_t p8, uint32_t p9, uint32_t p10, uint32_t p11, void *out) { rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11); rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_CTRL | RPC_RECV_FLAG_LEN)); rpc_end(thread); }
|
||||
static INLINE void rpc_call14_out_ctrl(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6, uint32_t p7, uint32_t p8, uint32_t p9, uint32_t p10, uint32_t p11, uint32_t p12, void *out) { rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12); rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_CTRL | RPC_RECV_FLAG_LEN)); rpc_end(thread); }
|
||||
static INLINE void rpc_call15_out_ctrl(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6, uint32_t p7, uint32_t p8, uint32_t p9, uint32_t p10, uint32_t p11, uint32_t p12, uint32_t p13, void *out) { rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13); rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_CTRL | RPC_RECV_FLAG_LEN)); rpc_end(thread); }
|
||||
+static INLINE void rpc_call16_out_ctrl(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6, uint32_t p7, uint32_t p8, uint32_t p9, uint32_t p10, uint32_t p11, uint32_t p12, uint32_t p13, uint32_t p14, void *out) { rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14); rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_CTRL | RPC_RECV_FLAG_LEN)); rpc_end(thread); }
|
||||
#endif
|
||||
|
||||
#define RPC_CALL1_OUT_CTRL(fn, thread, id, out) rpc_call1_out_ctrl(thread, id, out)
|
||||
@@ -700,6 +701,7 @@ static INLINE void rpc_call15_out_ctrl(CLIENT_THREAD_STATE_T *thread,uint32_t id
|
||||
#define RPC_CALL13_OUT_CTRL(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, out) rpc_call13_out_ctrl(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, out)
|
||||
#define RPC_CALL14_OUT_CTRL(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, out) rpc_call14_out_ctrl(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, out)
|
||||
#define RPC_CALL15_OUT_CTRL(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, out) rpc_call15_out_ctrl(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, out)
|
||||
+#define RPC_CALL16_OUT_CTRL(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, out) rpc_call16_out_ctrl(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, out)
|
||||
|
||||
# if !defined(__SYMBIAN32__) //use functions defined in khrpc.cpp
|
||||
static INLINE uint32_t rpc_call1_out_ctrl_res(CLIENT_THREAD_STATE_T *thread,uint32_t id, void *out) { uint32_t res; rpc_begin(thread); RPC_CALL(thread, id); res = rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_RES | RPC_RECV_FLAG_CTRL | RPC_RECV_FLAG_LEN)); rpc_end(thread); return res; }
|
||||
diff --git a/interface/khronos/common/khrn_int_ids.h b/interface/khronos/common/khrn_int_ids.h
|
||||
index 8378f4a..ec961e0 100644
|
||||
--- a/interface/khronos/common/khrn_int_ids.h
|
||||
+++ b/interface/khronos/common/khrn_int_ids.h
|
||||
@@ -367,6 +367,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#define EGLINTCREATESURFACE_ID 0x4000
|
||||
+#define EGLINTCREATESURFACE_ID_V2 0x4100
|
||||
#define EGLINTCREATEGLES11_ID 0x4001
|
||||
#define EGLINTCREATEGLES20_ID 0x4002
|
||||
#define EGLINTCREATEVG_ID 0x4003
|
||||
@@ -377,6 +378,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#define EGLINTMAKECURRENT_ID 0x4008
|
||||
#define EGLINTFLUSHANDWAIT_ID 0x4009
|
||||
#define EGLINTSWAPBUFFERS_ID 0x400a
|
||||
+#define EGLINTSWAPBUFFERS_ID_V2 0x410a
|
||||
#define EGLINTSELECTMIPMAP_ID 0x400b
|
||||
#define EGLINTFLUSH_ID 0x400c
|
||||
#define EGLINTGETCOLORDATA_ID 0x400d
|
||||
diff --git a/interface/khronos/egl/egl_client.c b/interface/khronos/egl/egl_client.c
|
||||
index 472ef0c..234da65 100644
|
||||
--- a/interface/khronos/egl/egl_client.c
|
||||
+++ b/interface/khronos/egl/egl_client.c
|
||||
@@ -162,6 +162,17 @@ static void egl_current_release(CLIENT_PROCESS_STATE_T *process, EGL_CURRENT_T *
|
||||
void egl_gl_flush_callback(bool wait);
|
||||
void egl_vg_flush_callback(bool wait);
|
||||
|
||||
+#include "interface/vmcs_host/vc_dispmanx_types.h"
|
||||
+/**HACKHACK - give us the ability to inject a DispmanX
|
||||
+ * resource handle into the CreateWindowSurface and
|
||||
+ * SwapBuffers calls */
|
||||
+static DISPMANX_RESOURCE_HANDLE_T next_resource_handle;
|
||||
+
|
||||
+EGLAPI EGLBoolean EGLAPIENTRY eglSetNextResourceHandle(DISPMANX_RESOURCE_HANDLE_T handle)
|
||||
+{
|
||||
+ next_resource_handle = handle;
|
||||
+}
|
||||
+
|
||||
/*
|
||||
TODO: do an RPC call to make sure the Khronos vll is loaded (and that it stays loaded until eglTerminate)
|
||||
Also affects global image (and possibly others?)
|
||||
@@ -644,7 +655,8 @@ EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig c
|
||||
false,
|
||||
EGL_NO_TEXTURE,
|
||||
EGL_NO_TEXTURE,
|
||||
- 0, 0);
|
||||
+ 0, 0,
|
||||
+ next_resource_handle);
|
||||
|
||||
if (surface) {
|
||||
if (khrn_pointer_map_insert(&process->surfaces, process->next_surface, surface)) {
|
||||
@@ -889,7 +901,7 @@ EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig
|
||||
mipmap_texture,
|
||||
texture_format,
|
||||
texture_target,
|
||||
- 0, 0);
|
||||
+ 0, 0, 0);
|
||||
|
||||
if (surface) {
|
||||
if (khrn_pointer_map_insert(&process->surfaces, process->next_surface, surface)) {
|
||||
@@ -1031,7 +1043,7 @@ EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig c
|
||||
false,
|
||||
EGL_NO_TEXTURE,
|
||||
EGL_NO_TEXTURE,
|
||||
- pixmap, ((server_handle[0] == 0) && (server_handle[1] == (uint32_t)(-1))) ? NULL : server_handle);
|
||||
+ pixmap, ((server_handle[0] == 0) && (server_handle[1] == (uint32_t)(-1))) ? NULL : server_handle, 0);
|
||||
|
||||
if (surface) {
|
||||
if (khrn_pointer_map_insert(&process->surfaces, process->next_surface, surface)) {
|
||||
@@ -2303,6 +2315,18 @@ EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surf)
|
||||
|
||||
vcos_log_trace("eglSwapBuffers server call");
|
||||
|
||||
+ if (next_resource_handle)
|
||||
+ RPC_CALL7(eglIntSwapBuffers_impl,
|
||||
+ thread,
|
||||
+ EGLINTSWAPBUFFERS_ID_V2,
|
||||
+ RPC_UINT(surface->serverbuffer),
|
||||
+ RPC_UINT(surface->width),
|
||||
+ RPC_UINT(surface->height),
|
||||
+ RPC_UINT(surface->internal_handle),
|
||||
+ RPC_UINT(surface->swap_behavior == EGL_BUFFER_PRESERVED ? 1 : 0),
|
||||
+ RPC_UINT(khrn_platform_get_window_position(surface->win)),
|
||||
+ RPC_INT(next_resource_handle));
|
||||
+ else
|
||||
RPC_CALL6(eglIntSwapBuffers_impl,
|
||||
thread,
|
||||
EGLINTSWAPBUFFERS_ID,
|
||||
diff --git a/interface/khronos/egl/egl_client_surface.c b/interface/khronos/egl/egl_client_surface.c
|
||||
index 0fa1fd1..0dc10e2 100644
|
||||
--- a/interface/khronos/egl/egl_client_surface.c
|
||||
+++ b/interface/khronos/egl/egl_client_surface.c
|
||||
@@ -314,7 +314,8 @@ EGL_SURFACE_T *egl_surface_create(
|
||||
EGLenum texture_format,
|
||||
EGLenum texture_target,
|
||||
EGLNativePixmapType pixmap,
|
||||
- const uint32_t *pixmap_server_handle)
|
||||
+ const uint32_t *pixmap_server_handle,
|
||||
+ DISPMANX_RESOURCE_HANDLE_T next_resource_handle)
|
||||
{
|
||||
KHRN_IMAGE_FORMAT_T color;
|
||||
KHRN_IMAGE_FORMAT_T depth;
|
||||
@@ -473,6 +474,27 @@ EGL_SURFACE_T *egl_surface_create(
|
||||
#endif
|
||||
uint32_t results[3];
|
||||
|
||||
+ if (next_resource_handle)
|
||||
+ RPC_CALL16_OUT_CTRL(eglIntCreateSurface_impl,
|
||||
+ thread,
|
||||
+ EGLINTCREATESURFACE_ID_V2,
|
||||
+ RPC_UINT(serverwin),
|
||||
+ RPC_UINT(buffers),
|
||||
+ RPC_UINT(width),
|
||||
+ RPC_UINT(height),
|
||||
+ RPC_UINT(color),
|
||||
+ RPC_UINT(depth),
|
||||
+ RPC_UINT(mask),
|
||||
+ RPC_UINT(multi),
|
||||
+ RPC_UINT(largest_pbuffer),
|
||||
+ RPC_UINT(mipmap_texture),
|
||||
+ RPC_UINT(config_depth_bits),
|
||||
+ RPC_UINT(config_stencil_bits),
|
||||
+ RPC_UINT(sem_name),
|
||||
+ RPC_UINT(type),
|
||||
+ RPC_INT(next_resource_handle),
|
||||
+ results);
|
||||
+ else
|
||||
RPC_CALL15_OUT_CTRL(eglIntCreateSurface_impl,
|
||||
thread,
|
||||
EGLINTCREATESURFACE_ID,
|
||||
diff --git a/interface/khronos/egl/egl_client_surface.h b/interface/khronos/egl/egl_client_surface.h
|
||||
index c99d44c..b5bf70a 100644
|
||||
--- a/interface/khronos/egl/egl_client_surface.h
|
||||
+++ b/interface/khronos/egl/egl_client_surface.h
|
||||
@@ -322,7 +322,8 @@ extern EGL_SURFACE_T *egl_surface_create(
|
||||
EGLenum texture_format,
|
||||
EGLenum texture_target,
|
||||
EGLNativePixmapType pixmap,
|
||||
- const uint32_t *pixmap_server_handle);
|
||||
+ const uint32_t *pixmap_server_handle,
|
||||
+ DISPMANX_RESOURCE_HANDLE_T next_resource_handle);
|
||||
extern EGL_SURFACE_T *egl_surface_from_vg_image(
|
||||
VGImage vg_handle,
|
||||
EGLSurface name,
|
||||
diff --git a/interface/khronos/egl/egl_int_impl.h b/interface/khronos/egl/egl_int_impl.h
|
||||
index 8a5734c..51b3580 100644
|
||||
--- a/interface/khronos/egl/egl_int_impl.h
|
||||
+++ b/interface/khronos/egl/egl_int_impl.h
|
||||
@@ -56,7 +56,8 @@ FN(int, eglIntCreateSurface_impl, (
|
||||
uint32_t config_stencil_bits,
|
||||
uint32_t sem,
|
||||
uint32_t type,
|
||||
- uint32_t *results))
|
||||
+ uint32_t *results,
|
||||
+ DISPMANX_RESOURCE_HANDLE_T next_resource_handle))
|
||||
|
||||
FN(int, eglIntCreatePbufferFromVGImage_impl, (
|
||||
VGImage vg_handle,
|
||||
@@ -110,7 +111,7 @@ FN(void, eglIntMakeCurrent_impl, (uint32_t pid_0, uint32_t pid_1, uint32_t glver
|
||||
FN(int, eglIntFlushAndWait_impl, (uint32_t flushgl, uint32_t flushvg))
|
||||
FN(void, eglIntFlush_impl, (uint32_t flushgl, uint32_t flushvg))
|
||||
|
||||
-FN(void, eglIntSwapBuffers_impl, (EGL_SURFACE_ID_T s, uint32_t width, uint32_t height, uint32_t handle, uint32_t preserve, uint32_t position))
|
||||
+FN(void, eglIntSwapBuffers_impl, (EGL_SURFACE_ID_T s, uint32_t width, uint32_t height, uint32_t handle, uint32_t preserve, uint32_t position, DISPMANX_RESOURCE_HANDLE_T new_back_buffer))
|
||||
FN(void, eglIntSelectMipmap_impl, (EGL_SURFACE_ID_T s, int level))
|
||||
|
||||
FN(void, eglIntGetColorData_impl, (EGL_SURFACE_ID_T s, KHRN_IMAGE_FORMAT_T format, uint32_t width, uint32_t height, int32_t stride, uint32_t y_offset, void *data))
|
||||
--
|
||||
2.7.0
|
||||
|
||||
+1880
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,866 @@
|
||||
From b853c05f425775a65cfc5a2d64b3491ab3673e36 Mon Sep 17 00:00:00 2001
|
||||
From: Tomeu Vizoso <tomeu.vizoso@collabora.com>
|
||||
Date: Tue, 1 Oct 2013 13:19:20 +0200
|
||||
Subject: [PATCH 10/16] wayland: Add Wayland example
|
||||
|
||||
---
|
||||
.../linux/apps/hello_pi/CMakeLists.txt | 1 +
|
||||
.../apps/hello_pi/hello_wayland/CMakeLists.txt | 8 +
|
||||
.../apps/hello_pi/hello_wayland/Djenne_128_128.raw | 3 +
|
||||
.../linux/apps/hello_pi/hello_wayland/Makefile | 5 +
|
||||
.../hello_wayland/cube_texture_and_coords.h | 100 ++++
|
||||
.../linux/apps/hello_pi/hello_wayland/triangle.c | 666 +++++++++++++++++++++
|
||||
host_applications/linux/apps/hello_pi/rebuild.sh | 3 +-
|
||||
7 files changed, 785 insertions(+), 1 deletion(-)
|
||||
create mode 100644 host_applications/linux/apps/hello_pi/hello_wayland/CMakeLists.txt
|
||||
create mode 100644 host_applications/linux/apps/hello_pi/hello_wayland/Djenne_128_128.raw
|
||||
create mode 100644 host_applications/linux/apps/hello_pi/hello_wayland/Makefile
|
||||
create mode 100644 host_applications/linux/apps/hello_pi/hello_wayland/cube_texture_and_coords.h
|
||||
create mode 100644 host_applications/linux/apps/hello_pi/hello_wayland/triangle.c
|
||||
|
||||
diff --git a/host_applications/linux/apps/hello_pi/CMakeLists.txt b/host_applications/linux/apps/hello_pi/CMakeLists.txt
|
||||
index f2c6aef..0df78f7 100644
|
||||
--- a/host_applications/linux/apps/hello_pi/CMakeLists.txt
|
||||
+++ b/host_applications/linux/apps/hello_pi/CMakeLists.txt
|
||||
@@ -21,6 +21,7 @@ add_subdirectory(hello_encode)
|
||||
add_subdirectory(hello_jpeg)
|
||||
add_subdirectory(hello_videocube)
|
||||
add_subdirectory(hello_teapot)
|
||||
+add_subdirectory(hello_wayland)
|
||||
|
||||
if(BUILD_FONT)
|
||||
set(VGFONT_SRCS libs/vgfont/font.c libs/vgfont/vgft.c libs/vgfont/graphics.c)
|
||||
diff --git a/host_applications/linux/apps/hello_pi/hello_wayland/CMakeLists.txt b/host_applications/linux/apps/hello_pi/hello_wayland/CMakeLists.txt
|
||||
new file mode 100644
|
||||
index 0000000..9a2f75c
|
||||
--- /dev/null
|
||||
+++ b/host_applications/linux/apps/hello_pi/hello_wayland/CMakeLists.txt
|
||||
@@ -0,0 +1,8 @@
|
||||
+set(EXEC hello_wayland.bin)
|
||||
+set(SRCS triangle.c)
|
||||
+
|
||||
+add_executable(${EXEC} ${SRCS})
|
||||
+target_link_libraries(${EXEC} ${HELLO_PI_LIBS} -lwayland-client -lwayland-egl)
|
||||
+
|
||||
+install(TARGETS ${EXEC}
|
||||
+ RUNTIME DESTINATION bin)
|
||||
diff --git a/host_applications/linux/apps/hello_pi/hello_wayland/Djenne_128_128.raw b/host_applications/linux/apps/hello_pi/hello_wayland/Djenne_128_128.raw
|
||||
new file mode 100644
|
||||
index 0000000..de9173c
|
||||
--- /dev/null
|
||||
+++ b/host_applications/linux/apps/hello_pi/hello_wayland/Djenne_128_128.raw
|
||||
@@ -0,0 +1,3 @@
|
||||
+�雛彑�潜愾毖丁效毖丁效喆濁拌喆濁拌喆濁拌喆濁拌荿茸拌荿茸拌櫢霜愾櫢霜愾�杉彑咩煽愾櫢霜愾櫢霜愾咩煎彑咩煎彑�蒸嵜咩煎彑�穣嫋�穣嫋�穣嫋�穣嫋�穣嫋�叙埆�穣嫋�穣嫋�呪埆�助喙�飼匯�飼匯�窄从�窄从�窄从�窄从�候儿�侯亳鯲虞老麩剣儿駘挙老麩倦裕鯲具裕駘拒裕駘拒裕靆基夢靆器乏鑠鰹乏酲猿鳳酲猿鳳酲猿鳳酲燕憤鑛逸憤酩�逼軾�猫貲㈹猫詁�頭詁�笛蠹�笛詁�頭菽�暢蘢�辿菽�辿菽�即喆諾效毖兆枋飯糖榲飯糖榲菶訂枋菶訂枋菶訂枋菶訂枋�蹄枋�蹄枋�蹄枋�蹄枋顗凋效顗凋效顗凋效顗凋效顗凋效顗凋效荿茸拌荿茸拌櫢霜愾櫢霜愾咩煎彑咩煎彑櫢鎗彑咩煎彑�据嵜�据嵜�据嵜�雛嫋�穣嫋�穣嫋�序喀�序喀�寿匱�寿匱�索啝�似啝�獄匣�策匣�候儿�鵠亳�侯亳�佼老�佼老麩兼老麩健龍鯲愚龍駑奇隆駑奇隆駑奇隆靈叶由鰺椛眠駝会眠靄縁憤鑛逸憤酩�逼酩�溌酩�溌軾�猫貲㍾溌軾�猫詁�頭蠹�笛菶訂枋菶訂枋飯糖榲飯糖榲飯糖榲飯糖榲飯糖榲飯糖榲飯糖榲飯糖榲菶訂枋菶訂枋�蹄枋顗凋效顗凋效顗凋效顗凋效顗凋效顗凋效荿諾愾荿茸拌荿茸拌櫢霜愾櫢霜愾櫢霜愾咩煎彑�据嵜�据嵜�杉彑�雛嫋�穣嫋�穣嫋�序喀�序喀�寿匱�寿匱�索啝�事匣�策匣�策匣�黒儿�黒儿�黒儿�侯亳�侯亳�佼老麩兼老鯲愚龍駑奇隆駑奇隆駑奇隆靈叶由鰺椛眠駝会眠靄艶鳳鑛逸憤鑛溢逼酩�逼鑛溢逼軾�猫貲㈹猫貲㈲頭貲㈲頭詁�頭飯糖榲飯糖榲�乳歹�乳歹飯糖榲飯糖榲飯糖榲飯糖榲飯糖榲飯糖榲菶訂枋菶訂枋顗喋枋�蹄枋顗凋效顗凋效顗凋效顗凋效荿茸拌荿茸拌荿茸拌荿茸拌櫢霜愾櫢霜愾櫢霜愾咩煎彑咩煎彑咩煎彑�杉彑�雛嫋�穣嫋�穣嫋�序喀�序喀�寿匱�寿匱�索啝�事匣�似啝�策匣�鵠亳�獄匣�黒儿�侯亳�鵠亳�侯亳麩兼老麩健龍鯱拠狼鯱拠狼駑奇隆靈叶由鰺椛眠駝会眠靄艶鳳靄縁憤鑛逸憤酩�逼酩�逼酩�逼軾�逼酩�溌貲㈹猫詁�頭葈糖歹�莫歹飼日歹飼日歹葈筒榲葈筒榲葈筒榲葈筒榲菶訂枋菶訂枋飯糖榲飯糖榲菶訂枋菶訂枋毖兆枋菶訂枋�喋枌�喋枌顗凧畋顗凧畋顗凋效顗凋效荿茸拌荿茸拌櫢煽慇櫢煎弯�恕慇櫢煎弯�据嵜�雛嫋�譲彑咩洗埔�授埃咜恕崗�腰埃咜徐媾�似啝�似啝�策匣�策匣�黒儿�黒儿�黒儿�黒儿�黒儿�黒儿�侯亳麩兼老麸愚狼鯱拠狼駑奇隆靈叶由駝会眠駝会眠駝会眠靄艶鳳靄艶鳳靄縁憤鑛溢逼酩�逼鑛溢逼酩�逼貲㈹猫貲㈲頭葈糖歹�駁淒飼日歹飼日歹葈筒榲葈筒榲葈筒榲葈筒榲飯糖榲飯糖榲飯糖榲飯糖榲飯糖榲飯糖榲菶訂枋飯筒枋�喋枌�喋枌�喋枌�喋枌�蹄枋�蹄枋顗凋效顗凋效顗凧畋顗茸拜櫢煽慇櫢煎弯咩煎彑咩潜嵜咩煎彑咩染嫂橳醸崗茁菅弯�樹媾咜序埃咜徐媾咜徐媾�授埃�授埃�似啝�似啝�似啝�似啝�黒儿�黒儿�鵠亳�侯亳麸虞亢麸愚狼麸虞亢鯱拠狼麥寄隆麥寄隆鰺椛眠駝会眠駝会眠靄艶鳳靄縁憤鑛逸憤鑛逸憤酩�逼酩�逼酩�溌飼乳淒�駁淒�駁淒�駁淒飼日歹飼日歹飼日歹飼日歹飼日歹飼日歹葈筒榲葈筒榲�乳歹�乳歹菶諦榲飯糖榲�逓楪�逓楪�喋枌�喋枌�蹄枋�蹄枋�蹄枋�蹄枋顗凧畋顗茸拜顗茸拜荿霜慇荿茸拌櫢霜愾櫢霜愾咩煎彑茁菅弯茁菅弯茁椙崗咜徐媾咜徐媾咜徐媾�授埃�授埃�授埃�授埃�似啝�似啝�似啝�似啝�策匣�黒儿�侯儼�券儼麸虞亢鯱拠狼�喰狼�渠狼麥寄隆鰺樺由鰺樺由鰺椛眠駝会眠靄艶鳳靄艶鳳靄縁憤鑛逸憤酩�溌飼乳淒�眉淒�駁淒�駁淒�駁淒�駁淒�駁淒�駁淒飼日歹飼日歹飼日歹飼日歹�乳歹�乳歹飯統歹�日榲�歸�歸�歸�歸�逓楪�逓楪�到榲�到榲�蹄枋�蹄枋�蹄枌�喋枌顗茸拜荿増枌顗凋效顗兆拌顗兆拌櫢騒拌�穿慇靑旋弯靑煽崗橳錠弯橳醸崗橳醸崗咜徐媾咜徐媾咜徐媾咜徐媾�授埃�授埃�授埃�授埃�似啝�策匣�黒匕�候匕�券儼�兼亢�空亢�挙隆�渠狼麥寄隆麥寄隆麥嬉由鰺樺由鰺椛眠駝会眠駝介鳳靄苑眠靄縁憤�駁淒�駁淒飼日歹飼日歹�駁淒�駁淒飼乳淒�駁淒�麦淒�麦淒�麦淒�麦淒�駁淒�駁淒飼日歹飼日歹�乳歹�乳歹飯糖榲飯糖榲葈凧歡飼訂榁葈兆榁葈兆榁�蛸楝�蛸楝�蛸楝�蛸楝顗凧畋顗凧畋顗凧畋顗凧畋櫤椙擔櫤椙擔櫤椙擔櫤杉愍櫢霜愾櫢霜愾�据嵜�据嵜�穣媾�女媾�女媾�女媾�寿媾�受啝�歯啝�飼匣麪鵠匣麪穀亳麪穀亳鯰交亳�佼老麩兼老�侯亳�侯亳駭倦老駭倹龍靂駒龍鑞居裕靈叶由靈鰹眠鑢駕眠酲猿鳳�美瀏�美瀏�美瀏�美瀏�美瀏�美瀏�駁淒�眉淒�駁淒�駁淒�駁淒�駁淒�駁淒�駁淒�駁淒�駁淒�乳歹�乳歹飯糖榲飯糖榲葈凋歡飼諦歡飼諦歡飼諦歡�寵歟�寵歟�蛸楝�蛸楝�喋枌�喋枌�喋枌�喋枌顥像杼顥像杼�蛸楝顥像楞櫢霜愾櫢霜愾櫢霜愾櫢霜愾櫢煽慇咩杉弯�蒸崗�蒸崗�序崗�叙埃�穣媾�叙埃�呪埃�飼匣�歯啝�柵匣�窄儿�黒儿麩兼老麩兼老駭倦老靂駒龍駭倹龍靂駒龍鯱拠狼鯱拒隆駑奇隆靈叶由�美瀏�美瀏�美瀏�美瀏�美瀏�美瀏�美瀏�猊�眉淒�駁淒�駁淒�駁淒�駁淒�駁淒�莫歹飼日歹飼入淒�麦淒�駁歹�乳歹�日歡�統淌飼蹄淌�統淌�統淌�統淌�糖歡飼諦歡飼訂榁葈兆榁葈兆榁葈兆榁葈兆榁葈兆榁葈兆榁葈兆榁葈丁效毖丁效毖貯拌喆濁拌喆鐸收�潜拈�染愎�雛愎�杉弯咩据崗�蒸崗�穣媾�女媾�叙埃�歯啝�歯啝�事匣�窄儿�鵠亳�侯亳�交亳鯰鯉老駭健亳鯰鯉老駭健狼鯱拠狼駑奇隆駑基由靈栢猗馞琵猗馞眉疉�幅疉�復猗馞琵猗馞琵猗�幅疉�服瀏�美瀏�美瀏�美瀏�美瀏�美瀏�眉淒�駁淒���瀏�瀏�瀏�瀏�麦淒�麦淒�統淌�乳淌�統淌�統淌�統淌�統淌�統淌�統淌飼諦歡飼諦歡飼諦歡飼諦歡飼諦歡飼諦歡葈兆榁飼諦歡菶訂枋菶訂枋毖丁效毖丁效氿諾杪氿濁攸坙鎗攸坙鎗攸櫢煽慇櫢煎弯櫢煎弯咩杉弯咩杉弯�穣媾�女媾�呪埃�受啝�歯啝�柵匣�柵匣�柵匣麪酷儿麪酷儿鯰交亳鰕倦亢駮具亢靉巨狼靉居隆馞琵猗�幅疉�幅疉�幅疉�幅疉�幅疉�幅疉�幅疉�猊�猊�猊�猊�猊�猊�猊�猊�美瀏�美瀏�美瀏�美瀏�麦瀏�眉淒�駁淒�駁淒飼日歹飼日歹飼日歹飼日歹�統淌�統淌�統淌�統淌�統淌�統淌飼諦歡飼諦歡飼諦歡飼諦歡飼諦歡�統淌飯糖榲飯糖榲飯糖榲飯統榮坙鎗攸坙鎗攸坙鎗攸坙鎗攸喆濁拌喆濁拌喆濁拌喆濁拌�雛愎�雛愎�畳彎�状崕�穣媾�女媾�呪埃�寿埃鰉昨唳鰉昨唳鰉昨唳駲国匚鯰交亳駭倦老駭倦老駭倹龍馞眉疉
Line truncated
|
||||
+bepSaiYfnYfn[hpWdlZgo\iq]iqYhrWfoYhq[ktUdm[jsZir[js[jr]ktZjrZirZir[js[js]lu\fo^hr]ir_kw^jv\kv\iwYftWgsQamO_kRbnM]iM]iM]iN^jgsy=IQDOY:HT6FS4IX/HX〆����BWc6JU8JU:LW7IT6KV4IS0<M8DR0@M7FS8HT(9ANah���t��Ws�OhzNdsL`lr����������z��{���Ν�揃鍍�サk��[q�AXhF\fO`gI[a@RX%7>&;B(9A)<C-@G5HO7JP?QX@RYBRZ<QX1@Ks���固�各k��Tl�酉���5NZ<LX@ITAISALR>KR9LM@MVAITHQ^1CO火��澗`}�BWj@QaNbmYjsYhm]gmbjr���41@gu|gt|cpxanvcpxamvZkqSdkZhpWfn[irZhq]ktXiqWhq[ltZlxYlvaq}`p|^o{ao{_ny^lxem{fm{amxbl{_hv\huZeuR]nL_lL_lL_lL_lJ^kI\iG[hFYgOjp2IN;LU8FR6FS3HW/JZ��v��>V\8MU3HP7IT4ER1AN1AN18;MX]ozey�k��j}�h~�PfsE]iG\gJ[eO_l^n~�������す�����さ�術�吃�����r��w��OfvI`pG^n{����ィ����音�┻���������・�����Σ�^δ勸累�歳�����Ur�袴�v��Gam>LT?HPESXAQWHV[HSY[ggO^cZp{d~���嫁d�@Yi7R^FakXkr`pyv��,1>kp~3YhpWgo\gr_ls]jqanu_ltbntWkyWkx[o{Xmx[ny^p{]oz\nz[nx^nz`p|aq}dqdqer�er�crz^nz[jvVgsPcrL`rKcsNfvOeqNepRerWguVfrUeqZgtWfoPjp;PV5HO;KW@P]2ET�荏�塞Yqw:PU6KS4IQ:LW5FSN^kbr~t��\nyRdoL`kM`mK^k>T`>T`4LX=S_\lyZkx>Raax����t��� ̄ャ������Ш���w��w��h~�\s�Yq�~������������\t�������┷�袷�Ⅸ���蛎�呼α��監��ゼt��y��宋�Σ<VbCR^ET\K[d>SZFXcQ]jK\aN`jXq�遮��栽�┝i��CZi=Vb9P[Ymt`kuYclX`mt{�06Ebs�_o|_o{_o{`nz^lxao{_lx[kxUfsTenTenSdmTfoTfoZirZjv]mxYiuScpScpYiuZhxVduTfpXhtUhuSfuSftRgxThyThzRhtPcpPdqSepXhuZjv\ktXgp\v|=T[3EP5DQ8HUL`l��p��G]b7LT5JR6GS9KV8IV8HU:IY7JT9KV>P[<P[ATb5HU9P[8OZ7M]9OZ粧�RboBVe9QaRl}���s」y�����������さ��y��n��n��Wp�t��y�����ザ�げ9JWl���ザ����管������竿�吃�嫁����Юs���Ю�桂�╋<Vd>MZ\myy������こ�安�古�屮置夷��砧���^t�DYh=T`9MXWhqbnxCLWHS\DMZ%,;as�^o|]n{Zkx_p}YjwQboYjx]jq]jr^ksbowiv~dqybowhu|ev�jz�jz�fw�`o�[m|TixPetPfuOfuQetNbsOctRduPbsM_qOcnPdoUfr_q}XiqRclRakQ`i^w�CYd/DN6HR8IV6GTl�H^j>QY9LT5IP6IT5FS8IU8HY:JZ7JT;MW8JU9LY6IV7JV7L[7L[4N]:Q`��@S`BUb=Ra7Qas��x�|��o�����x�����}��k��y��d}�h��[v�|��t���┿��DP`AUf������せ|��������曲�緩��だ{��z���Ь�そu��B\l?Q`Pdu�袷�叡�暇�����蕉�礒呑�戸t��]q�GVg<P]GYdTcl\iq`ksLU`8DNco|_itdoygr|hs}lt�eq~hu�iv�lu|nx~jt{ku}r}�v��r|�oyap�[jzSbrM`oK_pKbrIbrHaqGbrF_oGaqKcsMasPctTduTdvPbmYkvfz�\mvPajL_fIZ`EU\VnzDZf=P]<MZ:LW4FQ>P[9KV7HQ6GP7GS2BN7HU7GW9IX5EU8JT:KX8IV3FS6IV;M]5JY4IX3K]E^n��Rhs7MY6K[<Sc<Scay�x��{��������{��p��f��~��a}�f��j��y��t���吉m��Uaq2FXs��z���ぜw����機系�せ�暇���{��y��������泳|��AXh:K])=N�袷}���永���Ю�訊��v��l��Ul~M`oK\iCVcDUc?NWeszgrzZem1=Gkx���{�x~�u{x��z��w~�ox�t~�s~�s}�o{�lw�it}anz[hsTctN`qM^oI\mI_pI`rGbrF`pD_oIasJ`rOcuQds]m~aq~dt�\mvZjtVgqN`gL_fIY`FV]BRX]t�@Wf8NY7JW9KV5ER7FO7FO<KS7EQ5FR7GU5EQ,<L2BR5EW5FS5FS3DQ3GS3FV5GV2HV5JY+DX=Ug��Pfv@Va6LX:LY7JZ8PcMex������y��z��k��q�o��i��]y�h��z��p」�����O_lAVf3I\^w����黍����仝����ーw����n�ォ畜�稽k��AVgGVe8K]t��v�������y��p��GauB[n>VfCYhBTbFWaBWg>Q^>OXiv~v��}��$/7S_h������z��{��v}�w��x��x�n}�mz�iy�]lxWgsN`oObpM^oNasJ_rI_qG_pG_sHbuJcwFbvPfxNdwShy[o~`q~eu�Yiu]luK\eJ]dHZaEX_FV\AQWAPWBRXI`pNeu9N^=P]<NY?NW=JR<FN2@M1?K2@L0AN#2B#3C-=N4DU7HU6GT4ER6IX7JY3FU/DU/CT3Kb�弧���D_l=Ua5LX2ER;LY7N^7M]Ibr{��w��n��q��n��x��q��h��f}�y��o��巾��2Zr|>T`?QbQ^u������~���㌢��々}��x��x��}�堪否��c{�IXgETd8KZUp~�¨e}�L^tCXjEYl=OaG[h@R]DUa=RZAV]8O`8N[=QY[gox��jt|":CMclsgsxis{lw�iw�`o{[kwZjvUhwQcrQftLcrG^pG_sG`sG^uF`pFaqHauIbvIcvKcyMe|Nf}Xi}[n~aq�ZkxXhu[luN`gK[bL\cFV]M\dGV\CSYDTZ=PS;NQLctAXh=Ra9KXCT^DQYEQXIRZDO[6CO-:F,9G$+;-<M1@R5ER6FS3DQ2FU4GV1DS1DU*=N.E\暇����Zu�<T`FYd9JU@O\0JV;S_=VgB]nw�s��p��u��y��l��d~�h��~���������UtyLbm@N^NTiz�����Ь�|���┥}��y�����影�按~��Shw@OaBM[?P]*FQ2O]9Qa<K\AP`>M^BM\ANZ<MU?RY=RZ<QW6Ra9R^@RYCRXq{tyqv|gkoVdoTdpTdoK]kM`qJ`rI]sD\qI`oF`oE]nF^rE`tD`y=]tFeDcuHcwJexKg{Tl�Um�Un�Vo�lw�]i}_nWguM^hEW^GW]DUWDS[HX_>NTCTYCSYASU;OR@SVf��D_h6P\6P\5O[>YgB]kHcqTjtATaq�����o~�y�����t��r�������������x���`��E撻置��Vm|BXdATa?Rb8KZ>TXBZcF\i?ZjF`tk��p��m��w��s��j��g��}���㌢�吉�┝���7MY=P_.BSx�����せ�せ�B��y��{������映���d��FX^>QY@R]=OZ7HU=NZ9IY;K[;J[<MZ9JW:KX=N[<NY;MX<MX4IY3K[5M`/J[Gcx>ZoA]rB^q9Xr>Yt>XqBZsF^tBZqC[qF`sM_tK_tG_rB_tFcwFbzMgSi�Nk�Yt�Lg}^y�Wq�Wo~WlxLanHfkQjoEX_IY`IU]GW^ASZBT[=VV?TV>NTDOWEPXDOUCQT>OR_x�Piu7Q]4N\5O]:TbE^nOhx����げ���������������尭�����������������紘�鈎�奏�嘉���Vm|F\gI[h@Rb;N]DXXCV[K^fNaoVi|F`pv。}��|��z��o��q��v�┫刎�士�廓XpxC[g@Ud9M^t����x���せ���ゼ���{��d��Up�F]q?YjBT[BU]>P\:LW;LZ8JV:JZ9IZ4EQ6GT8IV<LZ8JU;MX=OZ:LW;LV<MU9LZ3HWJaqD[nC]mD]qA\qC^sD_tH_uBYpIbuJbuA]pKbzLe}Kf~Ml�Hg~Kk�Vp�]t�[w�`x�Icwp���ごj�KamNbnG`fI`eFX_GW^CPXAQW@SY=PW=STAUY>NUBMUFPXAMS?NQ=OPl��Sm{6P^2K[5O^:ScC[mLdul��������v「���~��~��m��q��l��}��{������サ�┨���肯�局v��k��?Sb@Ud@Ud=PbKZ^N]dTemZlvK^kYo{Umyw��~��z��{����甚�煮�敬��_{�?Ye>Tc.EUw�����������`y�k��;Sf@Wg>Vf0EU<S^5HV<NY;MX<NY=OZ8HV:KX3DQ5FS:KX8IV9JW8IV9KV6HS;LX:LY@KN@NT>NT9KUThwLcuGbuKfzMgzLezHeyEauLh{Kf~Hg}Gf|If�Kl�No�Su�Kk�Po�Sp�Ok�j�����y�}��p��at�I]hN_kCV^CT^BQZ@OX?NW?NW>OX:MU9MS@QZ>NV@LVAMW=KQ?MP=OPz��Xq�5N^6N`1I[;SeAYmH`ti��z�����Xs�uァg��Wu�q��〆{��|��r��}�����┰��テ��士��n��<RaE[j=Tc@WhL_hSeqXm{`s���������Ο�Ψ�����夏位紂述�景� ̄c��>Xf5Q^9Rb>Uem��?TfBUl:P^>Td?R_BVc9KU>P[5GR:IV<NY7IT4FQ+=H$28IV1BO8IV7IV5FS9JW6HS9KV9KW>QY8LT?MN@OU;MS7JUE^mJg{Mj�Jh�P
Line truncated
|
||||
+!" &'%&$$/(%$OD=k��y…�詠�ぢ��������������仨���歌{/���と{��r��o������g��|―������w��E\dCV]7FT>K[9FM3CP*<M$<R�果������㌧�Ю���仝�����{��|��s��r��m��k��>Ym=Yj:Te8Rc6Pb1KQ/FO9IR>KX����Ⅵ}��^x�[v�f}�Oct:L]BQbAN\;GSDMW;MV5GO1AM5EQ5EQ5ER9IV3BO1BO/@M3DQ/@L3CS/?O0@P2BR0@P0@P2BR3CS0@P1AQ1AQ1AQ,9I0=M1>N'4D+5F1;L'1B'1C"-;!*7$.$*&+/&*+"'((,-".+%-,#"%$#!!,+'/+*=98%-&
|
||||
\ No newline at end of file
|
||||
diff --git a/host_applications/linux/apps/hello_pi/hello_wayland/Makefile b/host_applications/linux/apps/hello_pi/hello_wayland/Makefile
|
||||
new file mode 100644
|
||||
index 0000000..c9ddf23
|
||||
--- /dev/null
|
||||
+++ b/host_applications/linux/apps/hello_pi/hello_wayland/Makefile
|
||||
@@ -0,0 +1,5 @@
|
||||
+OBJS=triangle.o
|
||||
+BIN=hello_wayland.bin
|
||||
+LDFLAGS+=-lwayland-client -lwayland-egl
|
||||
+
|
||||
+include ../Makefile.include
|
||||
diff --git a/host_applications/linux/apps/hello_pi/hello_wayland/cube_texture_and_coords.h b/host_applications/linux/apps/hello_pi/hello_wayland/cube_texture_and_coords.h
|
||||
new file mode 100644
|
||||
index 0000000..663e23b
|
||||
--- /dev/null
|
||||
+++ b/host_applications/linux/apps/hello_pi/hello_wayland/cube_texture_and_coords.h
|
||||
@@ -0,0 +1,100 @@
|
||||
+/*
|
||||
+Copyright (c) 2012, Broadcom Europe Ltd
|
||||
+All rights reserved.
|
||||
+
|
||||
+Redistribution and use in source and binary forms, with or without
|
||||
+modification, are permitted provided that the following conditions are met:
|
||||
+ * Redistributions of source code must retain the above copyright
|
||||
+ notice, this list of conditions and the following disclaimer.
|
||||
+ * Redistributions in binary form must reproduce the above copyright
|
||||
+ notice, this list of conditions and the following disclaimer in the
|
||||
+ documentation and/or other materials provided with the distribution.
|
||||
+ * Neither the name of the copyright holder nor the
|
||||
+ names of its contributors may be used to endorse or promote products
|
||||
+ derived from this software without specific prior written permission.
|
||||
+
|
||||
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
+*/
|
||||
+
|
||||
+// Spatial coordinates for the cube
|
||||
+
|
||||
+static const GLbyte quadx[6*4*3] = {
|
||||
+ /* FRONT */
|
||||
+ -10, -10, 10,
|
||||
+ 10, -10, 10,
|
||||
+ -10, 10, 10,
|
||||
+ 10, 10, 10,
|
||||
+
|
||||
+ /* BACK */
|
||||
+ -10, -10, -10,
|
||||
+ -10, 10, -10,
|
||||
+ 10, -10, -10,
|
||||
+ 10, 10, -10,
|
||||
+
|
||||
+ /* LEFT */
|
||||
+ -10, -10, 10,
|
||||
+ -10, 10, 10,
|
||||
+ -10, -10, -10,
|
||||
+ -10, 10, -10,
|
||||
+
|
||||
+ /* RIGHT */
|
||||
+ 10, -10, -10,
|
||||
+ 10, 10, -10,
|
||||
+ 10, -10, 10,
|
||||
+ 10, 10, 10,
|
||||
+
|
||||
+ /* TOP */
|
||||
+ -10, 10, 10,
|
||||
+ 10, 10, 10,
|
||||
+ -10, 10, -10,
|
||||
+ 10, 10, -10,
|
||||
+
|
||||
+ /* BOTTOM */
|
||||
+ -10, -10, 10,
|
||||
+ -10, -10, -10,
|
||||
+ 10, -10, 10,
|
||||
+ 10, -10, -10,
|
||||
+};
|
||||
+
|
||||
+/** Texture coordinates for the quad. */
|
||||
+static const GLfloat texCoords[6 * 4 * 2] = {
|
||||
+ 0.f, 0.f,
|
||||
+ 1.f, 0.f,
|
||||
+ 0.f, 1.f,
|
||||
+ 1.f, 1.f,
|
||||
+
|
||||
+ 0.f, 0.f,
|
||||
+ 1.f, 0.f,
|
||||
+ 0.f, 1.f,
|
||||
+ 1.f, 1.f,
|
||||
+
|
||||
+ 0.f, 0.f,
|
||||
+ 1.f, 0.f,
|
||||
+ 0.f, 1.f,
|
||||
+ 1.f, 1.f,
|
||||
+
|
||||
+ 0.f, 0.f,
|
||||
+ 1.f, 0.f,
|
||||
+ 0.f, 1.f,
|
||||
+ 1.f, 1.f,
|
||||
+
|
||||
+ 0.f, 0.f,
|
||||
+ 1.f, 0.f,
|
||||
+ 0.f, 1.f,
|
||||
+ 1.f, 1.f,
|
||||
+
|
||||
+ 0.f, 0.f,
|
||||
+ 1.f, 0.f,
|
||||
+ 0.f, 1.f,
|
||||
+ 1.f, 1.f,
|
||||
+};
|
||||
+
|
||||
diff --git a/host_applications/linux/apps/hello_pi/hello_wayland/triangle.c b/host_applications/linux/apps/hello_pi/hello_wayland/triangle.c
|
||||
new file mode 100644
|
||||
index 0000000..1a7bfc4
|
||||
--- /dev/null
|
||||
+++ b/host_applications/linux/apps/hello_pi/hello_wayland/triangle.c
|
||||
@@ -0,0 +1,666 @@
|
||||
+/*
|
||||
+Copyright (c) 2012, Broadcom Europe Ltd
|
||||
+All rights reserved.
|
||||
+
|
||||
+Redistribution and use in source and binary forms, with or without
|
||||
+modification, are permitted provided that the following conditions are met:
|
||||
+ * Redistributions of source code must retain the above copyright
|
||||
+ notice, this list of conditions and the following disclaimer.
|
||||
+ * Redistributions in binary form must reproduce the above copyright
|
||||
+ notice, this list of conditions and the following disclaimer in the
|
||||
+ documentation and/or other materials provided with the distribution.
|
||||
+ * Neither the name of the copyright holder nor the
|
||||
+ names of its contributors may be used to endorse or promote products
|
||||
+ derived from this software without specific prior written permission.
|
||||
+
|
||||
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
+*/
|
||||
+
|
||||
+// A rotating cube rendered with OpenGL|ES. Three images used as textures on the cube faces.
|
||||
+
|
||||
+#define _GNU_SOURCE
|
||||
+
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
+#include <math.h>
|
||||
+#include <assert.h>
|
||||
+#include <unistd.h>
|
||||
+#include <sys/socket.h>
|
||||
+#include <sys/un.h>
|
||||
+
|
||||
+#include <wayland-egl.h>
|
||||
+#include <wayland-client.h>
|
||||
+
|
||||
+#include "GLES/gl.h"
|
||||
+#include "EGL/egl.h"
|
||||
+#include "EGL/eglext.h"
|
||||
+
|
||||
+#include "cube_texture_and_coords.h"
|
||||
+
|
||||
+#define PATH "./"
|
||||
+
|
||||
+#define IMAGE_SIZE 128
|
||||
+
|
||||
+#ifndef M_PI
|
||||
+ #define M_PI 3.141592654
|
||||
+#endif
|
||||
+
|
||||
+
|
||||
+typedef struct
|
||||
+{
|
||||
+ uint32_t screen_width;
|
||||
+ uint32_t screen_height;
|
||||
+// OpenGL|ES objects
|
||||
+ EGLDisplay display;
|
||||
+ EGLSurface surface;
|
||||
+ EGLContext context;
|
||||
+ GLuint tex[6];
|
||||
+// model rotation vector and direction
|
||||
+ GLfloat rot_angle_x_inc;
|
||||
+ GLfloat rot_angle_y_inc;
|
||||
+ GLfloat rot_angle_z_inc;
|
||||
+// current model rotation angles
|
||||
+ GLfloat rot_angle_x;
|
||||
+ GLfloat rot_angle_y;
|
||||
+ GLfloat rot_angle_z;
|
||||
+// current distance from camera
|
||||
+ GLfloat distance;
|
||||
+ GLfloat distance_inc;
|
||||
+// pointers to texture buffers
|
||||
+ char *tex_buf1;
|
||||
+ char *tex_buf2;
|
||||
+ char *tex_buf3;
|
||||
+ struct wl_display *wl_display;
|
||||
+ struct wl_registry *wl_registry;
|
||||
+ struct wl_shell *wl_shell;
|
||||
+ struct wl_shell_surface *wl_shell_surface;
|
||||
+ struct wl_compositor *wl_compositor;
|
||||
+ struct wl_surface *wl_surface;
|
||||
+ struct wl_callback *wl_callback;
|
||||
+ struct wl_egl_window *wl_egl_window;
|
||||
+ int needs_update;
|
||||
+ int ellapsed_frames;
|
||||
+ int kill_compositor;
|
||||
+ int single_frame;
|
||||
+ int terminate_abruptly;
|
||||
+} CUBE_STATE_T;
|
||||
+
|
||||
+static void init_ogl(CUBE_STATE_T *state);
|
||||
+static void init_model_proj(CUBE_STATE_T *state);
|
||||
+static void reset_model(CUBE_STATE_T *state);
|
||||
+static GLfloat inc_and_wrap_angle(GLfloat angle, GLfloat angle_inc);
|
||||
+static GLfloat inc_and_clip_distance(GLfloat distance, GLfloat distance_inc);
|
||||
+static void redraw_scene(CUBE_STATE_T *state);
|
||||
+static void update_model(CUBE_STATE_T *state);
|
||||
+static void init_textures(CUBE_STATE_T *state);
|
||||
+static void load_tex_images(CUBE_STATE_T *state);
|
||||
+static void exit_func(CUBE_STATE_T *state);
|
||||
+
|
||||
+static void
|
||||
+registry_handle_global(void *data, struct wl_registry *registry,
|
||||
+ uint32_t name, const char *interface, uint32_t version)
|
||||
+{
|
||||
+ CUBE_STATE_T *state = data;
|
||||
+
|
||||
+ if (strcmp(interface, "wl_compositor") == 0) {
|
||||
+ state->wl_compositor =
|
||||
+ wl_registry_bind(registry, name,
|
||||
+ &wl_compositor_interface, 1);
|
||||
+ } else if (strcmp(interface, "wl_shell") == 0) {
|
||||
+ state->wl_shell = wl_registry_bind(registry, name,
|
||||
+ &wl_shell_interface, 1);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+registry_handle_global_remove(void *data, struct wl_registry *registry,
|
||||
+ uint32_t name)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
+static const struct wl_registry_listener registry_listener = {
|
||||
+ registry_handle_global,
|
||||
+ registry_handle_global_remove
|
||||
+};
|
||||
+
|
||||
+/***********************************************************
|
||||
+ * Name: init_ogl
|
||||
+ *
|
||||
+ * Arguments:
|
||||
+ * CUBE_STATE_T *state - holds OGLES model info
|
||||
+ *
|
||||
+ * Description: Sets the display, OpenGL|ES context and screen stuff
|
||||
+ *
|
||||
+ * Returns: void
|
||||
+ *
|
||||
+ ***********************************************************/
|
||||
+static void init_ogl(CUBE_STATE_T *state)
|
||||
+{
|
||||
+ EGLBoolean result;
|
||||
+ EGLint num_config;
|
||||
+
|
||||
+ static const EGLint attribute_list[] =
|
||||
+ {
|
||||
+ EGL_RED_SIZE, 8,
|
||||
+ EGL_GREEN_SIZE, 8,
|
||||
+ EGL_BLUE_SIZE, 8,
|
||||
+ EGL_ALPHA_SIZE, 8,
|
||||
+ EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
|
||||
+ EGL_NONE
|
||||
+ };
|
||||
+
|
||||
+ EGLConfig config;
|
||||
+
|
||||
+ state->wl_display = wl_display_connect(NULL);
|
||||
+
|
||||
+ state->wl_registry = wl_display_get_registry(state->wl_display);
|
||||
+ wl_registry_add_listener(state->wl_registry, ®istry_listener, state);
|
||||
+
|
||||
+ wl_display_dispatch(state->wl_display);
|
||||
+
|
||||
+ // get an EGL display connection
|
||||
+ state->display = eglGetDisplay(state->wl_display);
|
||||
+ assert(state->display!=EGL_NO_DISPLAY);
|
||||
+
|
||||
+ // initialize the EGL display connection
|
||||
+ result = eglInitialize(state->display, NULL, NULL);
|
||||
+ assert(EGL_FALSE != result);
|
||||
+
|
||||
+ // get an appropriate EGL frame buffer configuration
|
||||
+ result = eglChooseConfig(state->display, attribute_list, &config, 1, &num_config);
|
||||
+ assert(EGL_FALSE != result);
|
||||
+
|
||||
+ // create an EGL rendering context
|
||||
+ state->context = eglCreateContext(state->display, config, EGL_NO_CONTEXT, NULL);
|
||||
+ assert(state->context!=EGL_NO_CONTEXT);
|
||||
+
|
||||
+ // create an EGL window surface
|
||||
+ state->screen_width = 1024;
|
||||
+ state->screen_height = 860;
|
||||
+
|
||||
+ state->wl_surface = wl_compositor_create_surface(state->wl_compositor);
|
||||
+ state->wl_shell_surface = wl_shell_get_shell_surface(state->wl_shell, state->wl_surface);
|
||||
+
|
||||
+ wl_shell_surface_set_toplevel(state->wl_shell_surface);
|
||||
+ wl_shell_surface_set_title(state->wl_shell_surface, "triangle.c");
|
||||
+
|
||||
+ state->wl_egl_window = wl_egl_window_create(state->wl_surface, state->screen_width, state->screen_height);
|
||||
+
|
||||
+ state->surface = eglCreateWindowSurface( state->display, config, state->wl_egl_window, NULL );
|
||||
+ assert(state->surface != EGL_NO_SURFACE);
|
||||
+
|
||||
+ // connect the context to the surface
|
||||
+ result = eglMakeCurrent(state->display, state->surface, state->surface, state->context);
|
||||
+ assert(EGL_FALSE != result);
|
||||
+
|
||||
+ // Set background color and clear buffers
|
||||
+ glClearColor(0.15f, 0.25f, 0.35f, 1.0f);
|
||||
+
|
||||
+ // Enable back face culling.
|
||||
+ glEnable(GL_CULL_FACE);
|
||||
+
|
||||
+ glMatrixMode(GL_MODELVIEW);
|
||||
+}
|
||||
+
|
||||
+/***********************************************************
|
||||
+ * Name: init_model_proj
|
||||
+ *
|
||||
+ * Arguments:
|
||||
+ * CUBE_STATE_T *state - holds OGLES model info
|
||||
+ *
|
||||
+ * Description: Sets the OpenGL|ES model to default values
|
||||
+ *
|
||||
+ * Returns: void
|
||||
+ *
|
||||
+ ***********************************************************/
|
||||
+static void init_model_proj(CUBE_STATE_T *state)
|
||||
+{
|
||||
+ float nearp = 1.0f;
|
||||
+ float farp = 500.0f;
|
||||
+ float hht;
|
||||
+ float hwd;
|
||||
+
|
||||
+ glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST );
|
||||
+
|
||||
+ glViewport(0, 0, (GLsizei)state->screen_width, (GLsizei)state->screen_height);
|
||||
+
|
||||
+ glMatrixMode(GL_PROJECTION);
|
||||
+ glLoadIdentity();
|
||||
+
|
||||
+ hht = nearp * (float)tan(45.0 / 2.0 / 180.0 * M_PI);
|
||||
+ hwd = hht * (float)state->screen_width / (float)state->screen_height;
|
||||
+
|
||||
+ glFrustumf(-hwd, hwd, -hht, hht, nearp, farp);
|
||||
+
|
||||
+ glEnableClientState( GL_VERTEX_ARRAY );
|
||||
+ glVertexPointer( 3, GL_BYTE, 0, quadx );
|
||||
+
|
||||
+ reset_model(state);
|
||||
+}
|
||||
+
|
||||
+/***********************************************************
|
||||
+ * Name: reset_model
|
||||
+ *
|
||||
+ * Arguments:
|
||||
+ * CUBE_STATE_T *state - holds OGLES model info
|
||||
+ *
|
||||
+ * Description: Resets the Model projection and rotation direction
|
||||
+ *
|
||||
+ * Returns: void
|
||||
+ *
|
||||
+ ***********************************************************/
|
||||
+static void reset_model(CUBE_STATE_T *state)
|
||||
+{
|
||||
+ // reset model position
|
||||
+ glMatrixMode(GL_MODELVIEW);
|
||||
+ glLoadIdentity();
|
||||
+ glTranslatef(0.f, 0.f, -50.f);
|
||||
+
|
||||
+ // reset model rotation
|
||||
+ state->rot_angle_x = 45.f; state->rot_angle_y = 30.f; state->rot_angle_z = 0.f;
|
||||
+ state->rot_angle_x_inc = 0.5f; state->rot_angle_y_inc = 0.5f; state->rot_angle_z_inc = 0.f;
|
||||
+ state->distance = 40.f;
|
||||
+}
|
||||
+
|
||||
+/***********************************************************
|
||||
+ * Name: update_model
|
||||
+ *
|
||||
+ * Arguments:
|
||||
+ * CUBE_STATE_T *state - holds OGLES model info
|
||||
+ *
|
||||
+ * Description: Updates model projection to current position/rotation
|
||||
+ *
|
||||
+ * Returns: void
|
||||
+ *
|
||||
+ ***********************************************************/
|
||||
+static void update_model(CUBE_STATE_T *state)
|
||||
+{
|
||||
+ // update position
|
||||
+ state->rot_angle_x = inc_and_wrap_angle(state->rot_angle_x, state->rot_angle_x_inc);
|
||||
+ state->rot_angle_y = inc_and_wrap_angle(state->rot_angle_y, state->rot_angle_y_inc);
|
||||
+ state->rot_angle_z = inc_and_wrap_angle(state->rot_angle_z, state->rot_angle_z_inc);
|
||||
+ state->distance = inc_and_clip_distance(state->distance, state->distance_inc);
|
||||
+
|
||||
+ glLoadIdentity();
|
||||
+ // move camera back to see the cube
|
||||
+ glTranslatef(0.f, 0.f, -state->distance);
|
||||
+
|
||||
+ // Rotate model to new position
|
||||
+ glRotatef(state->rot_angle_x, 1.f, 0.f, 0.f);
|
||||
+ glRotatef(state->rot_angle_y, 0.f, 1.f, 0.f);
|
||||
+ glRotatef(state->rot_angle_z, 0.f, 0.f, 1.f);
|
||||
+}
|
||||
+
|
||||
+/***********************************************************
|
||||
+ * Name: inc_and_wrap_angle
|
||||
+ *
|
||||
+ * Arguments:
|
||||
+ * GLfloat angle current angle
|
||||
+ * GLfloat angle_inc angle increment
|
||||
+ *
|
||||
+ * Description: Increments or decrements angle by angle_inc degrees
|
||||
+ * Wraps to 0 at 360 deg.
|
||||
+ *
|
||||
+ * Returns: new value of angle
|
||||
+ *
|
||||
+ ***********************************************************/
|
||||
+static GLfloat inc_and_wrap_angle(GLfloat angle, GLfloat angle_inc)
|
||||
+{
|
||||
+ angle += angle_inc;
|
||||
+
|
||||
+ if (angle >= 360.0)
|
||||
+ angle -= 360.f;
|
||||
+ else if (angle <=0)
|
||||
+ angle += 360.f;
|
||||
+
|
||||
+ return angle;
|
||||
+}
|
||||
+
|
||||
+/***********************************************************
|
||||
+ * Name: inc_and_clip_distance
|
||||
+ *
|
||||
+ * Arguments:
|
||||
+ * GLfloat distance current distance
|
||||
+ * GLfloat distance_inc distance increment
|
||||
+ *
|
||||
+ * Description: Increments or decrements distance by distance_inc units
|
||||
+ * Clips to range
|
||||
+ *
|
||||
+ * Returns: new value of angle
|
||||
+ *
|
||||
+ ***********************************************************/
|
||||
+static GLfloat inc_and_clip_distance(GLfloat distance, GLfloat distance_inc)
|
||||
+{
|
||||
+ distance += distance_inc;
|
||||
+
|
||||
+ if (distance >= 120.0f)
|
||||
+ distance = 120.f;
|
||||
+ else if (distance <= 40.0f)
|
||||
+ distance = 40.0f;
|
||||
+
|
||||
+ return distance;
|
||||
+}
|
||||
+
|
||||
+static pid_t get_server_pid(CUBE_STATE_T *state)
|
||||
+{
|
||||
+ struct ucred ucred;
|
||||
+ socklen_t len;
|
||||
+ int fd;
|
||||
+
|
||||
+ fd = wl_display_get_fd(state->wl_display);
|
||||
+ len = sizeof ucred;
|
||||
+ getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &ucred, &len);
|
||||
+
|
||||
+ return ucred.pid;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+frame(void *data, struct wl_callback *callback, uint32_t time)
|
||||
+{
|
||||
+ CUBE_STATE_T *state = (CUBE_STATE_T *) data;
|
||||
+
|
||||
+ state->needs_update = 1;
|
||||
+}
|
||||
+
|
||||
+static const struct wl_callback_listener frame_listener = {
|
||||
+ frame
|
||||
+};
|
||||
+
|
||||
+static void
|
||||
+update(CUBE_STATE_T *state)
|
||||
+{
|
||||
+ if (!state->single_frame || state->ellapsed_frames == 0) {
|
||||
+ update_model(state);
|
||||
+ redraw_scene(state);
|
||||
+ }
|
||||
+
|
||||
+ state->wl_callback = wl_surface_frame(state->wl_surface);
|
||||
+ wl_callback_add_listener(state->wl_callback, &frame_listener, state);
|
||||
+
|
||||
+ if (state->ellapsed_frames == 100) {
|
||||
+ if (state->kill_compositor) {
|
||||
+ fprintf(stderr, "reached frame 100, killing compositor\n");
|
||||
+ pid_t pid = get_server_pid(state);
|
||||
+ kill(pid, SIGTERM);
|
||||
+ } else if (state->terminate_abruptly) {
|
||||
+ fprintf(stderr, "reached frame 100, terminating right away\n");
|
||||
+ exit_func(state);
|
||||
+ exit(0);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (!state->single_frame || state->ellapsed_frames == 0)
|
||||
+ eglSwapBuffers(state->display, state->surface);
|
||||
+ else {
|
||||
+ wl_surface_damage(state->wl_surface, 0, 0, state->screen_width,
|
||||
+ state->screen_height);
|
||||
+ wl_surface_commit(state->wl_surface);
|
||||
+ }
|
||||
+
|
||||
+ state->ellapsed_frames++;
|
||||
+}
|
||||
+
|
||||
+/***********************************************************
|
||||
+ * Name: redraw_scene
|
||||
+ *
|
||||
+ * Arguments:
|
||||
+ * CUBE_STATE_T *state - holds OGLES model info
|
||||
+ *
|
||||
+ * Description: Draws the model and calls eglSwapBuffers
|
||||
+ * to render to screen
|
||||
+ *
|
||||
+ * Returns: void
|
||||
+ *
|
||||
+ ***********************************************************/
|
||||
+static void redraw_scene(CUBE_STATE_T *state)
|
||||
+{
|
||||
+ // Start with a clear screen
|
||||
+ glClear( GL_COLOR_BUFFER_BIT );
|
||||
+
|
||||
+ // Draw first (front) face:
|
||||
+ // Bind texture surface to current vertices
|
||||
+ glBindTexture(GL_TEXTURE_2D, state->tex[0]);
|
||||
+
|
||||
+ // Need to rotate textures - do this by rotating each cube face
|
||||
+ glRotatef(270.f, 0.f, 0.f, 1.f ); // front face normal along z axis
|
||||
+
|
||||
+ // draw first 4 vertices
|
||||
+ glDrawArrays( GL_TRIANGLE_STRIP, 0, 4);
|
||||
+
|
||||
+ // same pattern for other 5 faces - rotation chosen to make image orientation 'nice'
|
||||
+ glBindTexture(GL_TEXTURE_2D, state->tex[1]);
|
||||
+ glRotatef(90.f, 0.f, 0.f, 1.f ); // back face normal along z axis
|
||||
+ glDrawArrays( GL_TRIANGLE_STRIP, 4, 4);
|
||||
+
|
||||
+ glBindTexture(GL_TEXTURE_2D, state->tex[2]);
|
||||
+ glRotatef(90.f, 1.f, 0.f, 0.f ); // left face normal along x axis
|
||||
+ glDrawArrays( GL_TRIANGLE_STRIP, 8, 4);
|
||||
+
|
||||
+ glBindTexture(GL_TEXTURE_2D, state->tex[3]);
|
||||
+ glRotatef(90.f, 1.f, 0.f, 0.f ); // right face normal along x axis
|
||||
+ glDrawArrays( GL_TRIANGLE_STRIP, 12, 4);
|
||||
+
|
||||
+ glBindTexture(GL_TEXTURE_2D, state->tex[4]);
|
||||
+ glRotatef(270.f, 0.f, 1.f, 0.f ); // top face normal along y axis
|
||||
+ glDrawArrays( GL_TRIANGLE_STRIP, 16, 4);
|
||||
+
|
||||
+ glBindTexture(GL_TEXTURE_2D, state->tex[5]);
|
||||
+ glRotatef(90.f, 0.f, 1.f, 0.f ); // bottom face normal along y axis
|
||||
+ glDrawArrays( GL_TRIANGLE_STRIP, 20, 4);
|
||||
+}
|
||||
+
|
||||
+/***********************************************************
|
||||
+ * Name: init_textures
|
||||
+ *
|
||||
+ * Arguments:
|
||||
+ * CUBE_STATE_T *state - holds OGLES model info
|
||||
+ *
|
||||
+ * Description: Initialise OGL|ES texture surfaces to use image
|
||||
+ * buffers
|
||||
+ *
|
||||
+ * Returns: void
|
||||
+ *
|
||||
+ ***********************************************************/
|
||||
+static void init_textures(CUBE_STATE_T *state)
|
||||
+{
|
||||
+ // load three texture buffers but use them on six OGL|ES texture surfaces
|
||||
+ load_tex_images(state);
|
||||
+ glGenTextures(6, &state->tex[0]);
|
||||
+
|
||||
+ // setup first texture
|
||||
+ glBindTexture(GL_TEXTURE_2D, state->tex[0]);
|
||||
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, IMAGE_SIZE, IMAGE_SIZE, 0,
|
||||
+ GL_RGB, GL_UNSIGNED_BYTE, state->tex_buf1);
|
||||
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, (GLfloat)GL_NEAREST);
|
||||
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, (GLfloat)GL_NEAREST);
|
||||
+
|
||||
+ // setup second texture - reuse first image
|
||||
+ glBindTexture(GL_TEXTURE_2D, state->tex[1]);
|
||||
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, IMAGE_SIZE, IMAGE_SIZE, 0,
|
||||
+ GL_RGB, GL_UNSIGNED_BYTE, state->tex_buf1);
|
||||
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, (GLfloat)GL_NEAREST);
|
||||
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, (GLfloat)GL_NEAREST);
|
||||
+
|
||||
+ // third texture
|
||||
+ glBindTexture(GL_TEXTURE_2D, state->tex[2]);
|
||||
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, IMAGE_SIZE, IMAGE_SIZE, 0,
|
||||
+ GL_RGB, GL_UNSIGNED_BYTE, state->tex_buf2);
|
||||
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, (GLfloat)GL_NEAREST);
|
||||
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, (GLfloat)GL_NEAREST);
|
||||
+
|
||||
+ // fourth texture - reuse second image
|
||||
+ glBindTexture(GL_TEXTURE_2D, state->tex[3]);
|
||||
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, IMAGE_SIZE, IMAGE_SIZE, 0,
|
||||
+ GL_RGB, GL_UNSIGNED_BYTE, state->tex_buf2);
|
||||
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, (GLfloat)GL_NEAREST);
|
||||
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, (GLfloat)GL_NEAREST);
|
||||
+
|
||||
+ //fifth texture
|
||||
+ glBindTexture(GL_TEXTURE_2D, state->tex[4]);
|
||||
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, IMAGE_SIZE, IMAGE_SIZE, 0,
|
||||
+ GL_RGB, GL_UNSIGNED_BYTE, state->tex_buf3);
|
||||
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, (GLfloat)GL_NEAREST);
|
||||
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, (GLfloat)GL_NEAREST);
|
||||
+
|
||||
+ // sixth texture - reuse third image
|
||||
+ glBindTexture(GL_TEXTURE_2D, state->tex[5]);
|
||||
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, IMAGE_SIZE, IMAGE_SIZE, 0,
|
||||
+ GL_RGB, GL_UNSIGNED_BYTE, state->tex_buf3);
|
||||
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, (GLfloat)GL_NEAREST);
|
||||
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, (GLfloat)GL_NEAREST);
|
||||
+
|
||||
+ // setup overall texture environment
|
||||
+ glTexCoordPointer(2, GL_FLOAT, 0, texCoords);
|
||||
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
+
|
||||
+ glEnable(GL_TEXTURE_2D);
|
||||
+}
|
||||
+
|
||||
+/***********************************************************
|
||||
+ * Name: load_tex_images
|
||||
+ *
|
||||
+ * Arguments:
|
||||
+ * void
|
||||
+ *
|
||||
+ * Description: Loads three raw images to use as textures on faces
|
||||
+ *
|
||||
+ * Returns: void
|
||||
+ *
|
||||
+ ***********************************************************/
|
||||
+static void load_tex_images(CUBE_STATE_T *state)
|
||||
+{
|
||||
+ FILE *tex_file1 = NULL, *tex_file2=NULL, *tex_file3 = NULL;
|
||||
+ int bytes_read, image_sz = IMAGE_SIZE*IMAGE_SIZE*3;
|
||||
+
|
||||
+ state->tex_buf1 = malloc(image_sz);
|
||||
+ state->tex_buf2 = malloc(image_sz);
|
||||
+ state->tex_buf3 = malloc(image_sz);
|
||||
+
|
||||
+ tex_file1 = fopen(PATH "Lucca_128_128.raw", "rb");
|
||||
+ if (tex_file1 && state->tex_buf1)
|
||||
+ {
|
||||
+ bytes_read=fread(state->tex_buf1, 1, image_sz, tex_file1);
|
||||
+ assert(bytes_read == image_sz); // some problem with file?
|
||||
+ fclose(tex_file1);
|
||||
+ }
|
||||
+
|
||||
+ tex_file2 = fopen(PATH "Djenne_128_128.raw", "rb");
|
||||
+ if (tex_file2 && state->tex_buf2)
|
||||
+ {
|
||||
+ bytes_read=fread(state->tex_buf2, 1, image_sz, tex_file2);
|
||||
+ assert(bytes_read == image_sz); // some problem with file?
|
||||
+ fclose(tex_file2);
|
||||
+ }
|
||||
+
|
||||
+ tex_file3 = fopen(PATH "Gaudi_128_128.raw", "rb");
|
||||
+ if (tex_file3 && state->tex_buf3)
|
||||
+ {
|
||||
+ bytes_read=fread(state->tex_buf3, 1, image_sz, tex_file3);
|
||||
+ assert(bytes_read == image_sz); // some problem with file?
|
||||
+ fclose(tex_file3);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+//------------------------------------------------------------------------------
|
||||
+
|
||||
+static void exit_func(CUBE_STATE_T *state)
|
||||
+{
|
||||
+ // clear screen
|
||||
+ glClear( GL_COLOR_BUFFER_BIT );
|
||||
+ eglSwapBuffers(state->display, state->surface);
|
||||
+
|
||||
+ // Release OpenGL resources
|
||||
+ eglMakeCurrent( state->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT );
|
||||
+
|
||||
+ wl_egl_window_destroy(state->wl_egl_window);
|
||||
+ wl_shell_surface_destroy(state->wl_shell_surface);
|
||||
+ wl_surface_destroy(state->wl_surface);
|
||||
+
|
||||
+ eglDestroySurface( state->display, state->surface );
|
||||
+ eglDestroyContext( state->display, state->context );
|
||||
+ eglTerminate( state->display );
|
||||
+
|
||||
+ wl_display_flush(state->wl_display);
|
||||
+
|
||||
+ // release texture buffers
|
||||
+ free(state->tex_buf1);
|
||||
+ free(state->tex_buf2);
|
||||
+ free(state->tex_buf3);
|
||||
+
|
||||
+ printf("\ncube closed\n");
|
||||
+} // exit_func()
|
||||
+
|
||||
+static int running = 1;
|
||||
+
|
||||
+static void
|
||||
+signal_int(int signum)
|
||||
+{
|
||||
+ running = 0;
|
||||
+}
|
||||
+
|
||||
+//==============================================================================
|
||||
+
|
||||
+int main (int argc, char *argv[])
|
||||
+{
|
||||
+ struct sigaction sigint;
|
||||
+ CUBE_STATE_T state = {0,};
|
||||
+ int ret = 0;
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 0; i < argc; i++) {
|
||||
+ if (strcmp(argv[i], "--kill-compositor") == 0)
|
||||
+ state.kill_compositor = 1;
|
||||
+ if (strcmp(argv[i], "--single-frame") == 0)
|
||||
+ state.single_frame = 1;
|
||||
+ if (strcmp(argv[i], "--terminate-abruptly") == 0)
|
||||
+ state.terminate_abruptly = 1;
|
||||
+ else if (strcmp(argv[i], "--help") == 0 ||
|
||||
+ strcmp(argv[i], "-h") == 0) {
|
||||
+ printf("Usage: hello_wayland.bin [OPTION]\n\n");
|
||||
+ printf("\t--kill-compositor\tkill the Wayland compositor after 100 frames\n");
|
||||
+ printf("\t-h, --help\t\tshow this text\n");
|
||||
+ printf("\t--single-frame\t\tupdate the display only once\n");
|
||||
+ printf("\t--terminate-abruptly\texit right after rendering the 100th frame\n");
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // Start OGLES
|
||||
+ init_ogl(&state);
|
||||
+
|
||||
+ // Setup the model world
|
||||
+ init_model_proj(&state);
|
||||
+
|
||||
+ // initialise the OGLES texture(s)
|
||||
+ init_textures(&state);
|
||||
+
|
||||
+ sigint.sa_handler = signal_int;
|
||||
+ sigemptyset(&sigint.sa_mask);
|
||||
+ sigint.sa_flags = SA_RESETHAND;
|
||||
+ sigaction(SIGINT, &sigint, NULL);
|
||||
+
|
||||
+ state.needs_update = 1;
|
||||
+ while (running && ret != -1) {
|
||||
+ if (state.needs_update) {
|
||||
+ update(&state);
|
||||
+ state.needs_update = 0;
|
||||
+ }
|
||||
+
|
||||
+ ret = wl_display_dispatch(state.wl_display);
|
||||
+ }
|
||||
+
|
||||
+ exit_func(&state);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
diff --git a/host_applications/linux/apps/hello_pi/rebuild.sh b/host_applications/linux/apps/hello_pi/rebuild.sh
|
||||
index fa4539e..37120ac 100755
|
||||
--- a/host_applications/linux/apps/hello_pi/rebuild.sh
|
||||
+++ b/host_applications/linux/apps/hello_pi/rebuild.sh
|
||||
@@ -13,6 +13,7 @@ make -C hello_jpeg clean
|
||||
make -C hello_videocube clean
|
||||
make -C hello_teapot clean
|
||||
make -C hello_fft clean
|
||||
+make -C hello_wayland clean
|
||||
|
||||
make -C libs/ilclient
|
||||
make -C libs/vgfont
|
||||
@@ -29,4 +30,4 @@ make -C hello_jpeg
|
||||
make -C hello_videocube
|
||||
make -C hello_teapot
|
||||
make -C hello_fft
|
||||
-
|
||||
+make -C hello_wayland
|
||||
--
|
||||
2.7.0
|
||||
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
From 071771f1c2eb73c1f9083abb3a9f3a7712e20cdf Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Mon, 10 Aug 2015 02:38:27 -0700
|
||||
Subject: [PATCH 11/16] wayland-egl: Add bcm_host to dependencies
|
||||
|
||||
It uses headers like vcos_platform_types.h but does not
|
||||
depend on module which should add the required include paths
|
||||
lets add the dependency on bcm_host module which should do it
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
interface/khronos/wayland-egl/wayland-egl.pc.in | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/interface/khronos/wayland-egl/wayland-egl.pc.in b/interface/khronos/wayland-egl/wayland-egl.pc.in
|
||||
index 8bafc15..fd259c9 100644
|
||||
--- a/interface/khronos/wayland-egl/wayland-egl.pc.in
|
||||
+++ b/interface/khronos/wayland-egl/wayland-egl.pc.in
|
||||
@@ -6,5 +6,6 @@ includedir=${prefix}/include
|
||||
Name: wayland-egl
|
||||
Description: VideoCore wayland-egl library
|
||||
Version: @PROJECT_APIVER@
|
||||
+Requires: bcm_host
|
||||
Libs: -L${libdir} -lwayland-egl
|
||||
Cflags: -I${includedir}
|
||||
--
|
||||
2.7.0
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
From fb577f53f9a91745557194b0422504e2cc93a637 Mon Sep 17 00:00:00 2001
|
||||
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
|
||||
Date: Sat, 24 Jan 2015 22:07:19 +0100
|
||||
Subject: [PATCH 12/16] interface: remove faulty assert() to make weston happy
|
||||
at runtime
|
||||
|
||||
This was removed after a discussion on IRC with the weston guys
|
||||
('daniels' on irc.freenode.net/#wayland).
|
||||
|
||||
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
|
||||
---
|
||||
interface/vmcs_host/vc_vchi_dispmanx.c | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/interface/vmcs_host/vc_vchi_dispmanx.c b/interface/vmcs_host/vc_vchi_dispmanx.c
|
||||
index 1d24b6e..e2e7ccc 100755
|
||||
--- a/interface/vmcs_host/vc_vchi_dispmanx.c
|
||||
+++ b/interface/vmcs_host/vc_vchi_dispmanx.c
|
||||
@@ -1304,7 +1304,6 @@ static void *dispmanx_notify_func( void *arg ) {
|
||||
// Decrement the use count - the corresponding "use" is in vc_dispmanx_update_submit.
|
||||
vchi_service_release(dispmanx_client.notify_handle[0]);
|
||||
if (dispmanx_client.update_callback ) {
|
||||
- vcos_assert( dispmanx_client.pending_update_handle == handle);
|
||||
dispmanx_client.update_callback(handle, dispmanx_client.update_callback_param);
|
||||
}
|
||||
} else {
|
||||
--
|
||||
2.7.0
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
From 2d91c1fded75b3207743e058b0d5ca9eb98dce58 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Sat, 6 Feb 2016 11:10:47 -0800
|
||||
Subject: [PATCH 13/16] zero-out wl buffers in egl_surface_free
|
||||
|
||||
origins from buildroot
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
interface/khronos/egl/egl_client_surface.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/interface/khronos/egl/egl_client_surface.c b/interface/khronos/egl/egl_client_surface.c
|
||||
index 49cf7e5..512c83b 100644
|
||||
--- a/interface/khronos/egl/egl_client_surface.c
|
||||
+++ b/interface/khronos/egl/egl_client_surface.c
|
||||
@@ -690,11 +690,13 @@ void egl_surface_free(EGL_SURFACE_T *surface)
|
||||
if (surface->back_wl_buffer) {
|
||||
wl_buffer_destroy(surface->back_wl_buffer->wl_buffer);
|
||||
free(surface->back_wl_buffer);
|
||||
+ surface->back_wl_buffer = 0;
|
||||
}
|
||||
|
||||
if (surface->front_wl_buffer) {
|
||||
wl_buffer_destroy(surface->front_wl_buffer->wl_buffer);
|
||||
free(surface->front_wl_buffer);
|
||||
+ surface->front_wl_buffer = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
--
|
||||
2.7.0
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
From 2c1574b2e867bb5dad028784642a9ad88df6b16c Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Sat, 6 Feb 2016 11:11:41 -0800
|
||||
Subject: [PATCH 14/16] initialize front back wayland buffers
|
||||
|
||||
origins from metrological wayland support
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
interface/khronos/egl/egl_client_surface.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/interface/khronos/egl/egl_client_surface.c b/interface/khronos/egl/egl_client_surface.c
|
||||
index 512c83b..a429724 100644
|
||||
--- a/interface/khronos/egl/egl_client_surface.c
|
||||
+++ b/interface/khronos/egl/egl_client_surface.c
|
||||
@@ -401,11 +401,14 @@ EGL_SURFACE_T *egl_surface_create(
|
||||
#ifdef BUILD_WAYLAND
|
||||
if (type == WINDOW && wl_display) {
|
||||
surface->wl_egl_window = (struct wl_egl_window*)win;
|
||||
+ surface->front_wl_buffer = NULL;
|
||||
surface->back_wl_buffer = allocate_wl_buffer(
|
||||
surface->wl_egl_window, color);
|
||||
resource = surface->back_wl_buffer->resource;
|
||||
} else {
|
||||
surface->wl_egl_window = NULL;
|
||||
+ surface->front_wl_buffer = NULL;
|
||||
+ surface->back_wl_buffer = NULL;
|
||||
resource = DISPMANX_NO_HANDLE;
|
||||
}
|
||||
#endif
|
||||
--
|
||||
2.7.0
|
||||
|
||||
@@ -25,12 +25,25 @@ SRC_URI = "\
|
||||
file://0005-user-vcsm-Fix-build-with-clang.patch \
|
||||
file://0006-Fix-enum-type-conversion-warnings.patch \
|
||||
file://0007-vcos_platform_types-Dont-use-extern-inline-with-clan.patch \
|
||||
file://0008-Allow-applications-to-set-next-resource-handle.patch \
|
||||
file://0009-wayland-Add-support-for-the-Wayland-winsys.patch \
|
||||
file://0010-wayland-Add-Wayland-example.patch \
|
||||
file://0011-wayland-egl-Add-bcm_host-to-dependencies.patch \
|
||||
file://0012-interface-remove-faulty-assert-to-make-weston-happy-.patch \
|
||||
file://0013-zero-out-wl-buffers-in-egl_surface_free.patch \
|
||||
file://0014-initialize-front-back-wayland-buffers.patch \
|
||||
"
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
inherit cmake pkgconfig
|
||||
|
||||
EXTRA_OECMAKE = "-DCMAKE_BUILD_TYPE=Release -DCMAKE_EXE_LINKER_FLAGS='-Wl,--no-as-needed'"
|
||||
EXTRA_OECMAKE = "-DCMAKE_BUILD_TYPE=Release -DCMAKE_EXE_LINKER_FLAGS='-Wl,--no-as-needed' \
|
||||
"
|
||||
|
||||
PACKAGECONFIG ?= "${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'wayland', '', d)}"
|
||||
|
||||
PACKAGECONFIG[wayland] = "-DBUILD_WAYLAND=TRUE,,wayland,"
|
||||
|
||||
CFLAGS_append = " -fPIC"
|
||||
|
||||
do_install_append () {
|
||||
@@ -45,6 +58,7 @@ do_install_append () {
|
||||
# to force the .so files into the runtime package (and keep them
|
||||
# out of -dev package).
|
||||
FILES_SOLIBSDEV = ""
|
||||
INSANE_SKIP_${PN} += "dev-so"
|
||||
|
||||
FILES_${PN} += " \
|
||||
${libdir}/*.so \
|
||||
|
||||
Reference in new issue
Block a user