[-]
[+]
|
Changed |
_service:tar_git:libhybris.spec
|
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309125345.8.gb6decfa.tar.bz2/libhybris/hybris/include/GLES3/gl3.h
^
|
@@ -1,1205 +0,0 @@
-#ifndef __gl3_h_
-#define __gl3_h_ 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
-** Copyright (c) 2013-2016 The Khronos Group Inc.
-**
-** Permission is hereby granted, free of charge, to any person obtaining a
-** copy of this software and/or associated documentation files (the
-** "Materials"), to deal in the Materials without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Materials, and to
-** permit persons to whom the Materials are furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be included
-** in all copies or substantial portions of the Materials.
-**
-** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
-*/
-/*
-** This header is generated from the Khronos OpenGL / OpenGL ES XML
-** API Registry. The current version of the Registry, generator scripts
-** used to make the header, and the header can be found at
-** http://www.opengl.org/registry/
-**
-** Khronos $Revision: 32749 $ on $Date: 2016-04-28 09:03:03 -0700 (Thu, 28 Apr 2016) $
-*/
-
-#include <GLES3/gl3platform.h>
-
-#ifndef GL_APIENTRYP
-#define GL_APIENTRYP GL_APIENTRY*
-#endif
-
-/* Generated on date 20160428 */
-
-/* Generated C header for:
- * API: gles2
- * Profile: common
- * Versions considered: 2\.[0-9]|3\.0
- * Versions emitted: .*
- * Default extensions included: None
- * Additional extensions included: _nomatch_^
- * Extensions removed: _nomatch_^
- */
-
-#ifndef GL_ES_VERSION_2_0
-#define GL_ES_VERSION_2_0 1
-#include <KHR/khrplatform.h>
-typedef khronos_int8_t GLbyte;
-typedef khronos_float_t GLclampf;
-typedef khronos_int32_t GLfixed;
-typedef short GLshort;
-typedef unsigned short GLushort;
-typedef void GLvoid;
-typedef struct __GLsync *GLsync;
-typedef khronos_int64_t GLint64;
-typedef khronos_uint64_t GLuint64;
-typedef unsigned int GLenum;
-typedef unsigned int GLuint;
-typedef char GLchar;
-typedef khronos_float_t GLfloat;
-typedef khronos_ssize_t GLsizeiptr;
-typedef khronos_intptr_t GLintptr;
-typedef unsigned int GLbitfield;
-typedef int GLint;
-typedef unsigned char GLboolean;
-typedef int GLsizei;
-typedef khronos_uint8_t GLubyte;
-#define GL_DEPTH_BUFFER_BIT 0x00000100
-#define GL_STENCIL_BUFFER_BIT 0x00000400
-#define GL_COLOR_BUFFER_BIT 0x00004000
-#define GL_FALSE 0
-#define GL_TRUE 1
-#define GL_POINTS 0x0000
-#define GL_LINES 0x0001
-#define GL_LINE_LOOP 0x0002
-#define GL_LINE_STRIP 0x0003
-#define GL_TRIANGLES 0x0004
-#define GL_TRIANGLE_STRIP 0x0005
-#define GL_TRIANGLE_FAN 0x0006
-#define GL_ZERO 0
-#define GL_ONE 1
-#define GL_SRC_COLOR 0x0300
-#define GL_ONE_MINUS_SRC_COLOR 0x0301
-#define GL_SRC_ALPHA 0x0302
-#define GL_ONE_MINUS_SRC_ALPHA 0x0303
-#define GL_DST_ALPHA 0x0304
-#define GL_ONE_MINUS_DST_ALPHA 0x0305
-#define GL_DST_COLOR 0x0306
-#define GL_ONE_MINUS_DST_COLOR 0x0307
-#define GL_SRC_ALPHA_SATURATE 0x0308
-#define GL_FUNC_ADD 0x8006
-#define GL_BLEND_EQUATION 0x8009
-#define GL_BLEND_EQUATION_RGB 0x8009
-#define GL_BLEND_EQUATION_ALPHA 0x883D
-#define GL_FUNC_SUBTRACT 0x800A
-#define GL_FUNC_REVERSE_SUBTRACT 0x800B
-#define GL_BLEND_DST_RGB 0x80C8
-#define GL_BLEND_SRC_RGB 0x80C9
-#define GL_BLEND_DST_ALPHA 0x80CA
-#define GL_BLEND_SRC_ALPHA 0x80CB
-#define GL_CONSTANT_COLOR 0x8001
-#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
-#define GL_CONSTANT_ALPHA 0x8003
-#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
-#define GL_BLEND_COLOR 0x8005
-#define GL_ARRAY_BUFFER 0x8892
-#define GL_ELEMENT_ARRAY_BUFFER 0x8893
-#define GL_ARRAY_BUFFER_BINDING 0x8894
-#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
-#define GL_STREAM_DRAW 0x88E0
-#define GL_STATIC_DRAW 0x88E4
-#define GL_DYNAMIC_DRAW 0x88E8
-#define GL_BUFFER_SIZE 0x8764
-#define GL_BUFFER_USAGE 0x8765
-#define GL_CURRENT_VERTEX_ATTRIB 0x8626
-#define GL_FRONT 0x0404
-#define GL_BACK 0x0405
-#define GL_FRONT_AND_BACK 0x0408
-#define GL_TEXTURE_2D 0x0DE1
-#define GL_CULL_FACE 0x0B44
-#define GL_BLEND 0x0BE2
-#define GL_DITHER 0x0BD0
-#define GL_STENCIL_TEST 0x0B90
-#define GL_DEPTH_TEST 0x0B71
-#define GL_SCISSOR_TEST 0x0C11
-#define GL_POLYGON_OFFSET_FILL 0x8037
-#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
-#define GL_SAMPLE_COVERAGE 0x80A0
-#define GL_NO_ERROR 0
-#define GL_INVALID_ENUM 0x0500
-#define GL_INVALID_VALUE 0x0501
-#define GL_INVALID_OPERATION 0x0502
-#define GL_OUT_OF_MEMORY 0x0505
-#define GL_CW 0x0900
-#define GL_CCW 0x0901
-#define GL_LINE_WIDTH 0x0B21
-#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
-#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
-#define GL_CULL_FACE_MODE 0x0B45
-#define GL_FRONT_FACE 0x0B46
-#define GL_DEPTH_RANGE 0x0B70
-#define GL_DEPTH_WRITEMASK 0x0B72
-#define GL_DEPTH_CLEAR_VALUE 0x0B73
-#define GL_DEPTH_FUNC 0x0B74
-#define GL_STENCIL_CLEAR_VALUE 0x0B91
-#define GL_STENCIL_FUNC 0x0B92
-#define GL_STENCIL_FAIL 0x0B94
-#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
-#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
-#define GL_STENCIL_REF 0x0B97
-#define GL_STENCIL_VALUE_MASK 0x0B93
-#define GL_STENCIL_WRITEMASK 0x0B98
-#define GL_STENCIL_BACK_FUNC 0x8800
-#define GL_STENCIL_BACK_FAIL 0x8801
-#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802
-#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803
-#define GL_STENCIL_BACK_REF 0x8CA3
-#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4
-#define GL_STENCIL_BACK_WRITEMASK 0x8CA5
-#define GL_VIEWPORT 0x0BA2
-#define GL_SCISSOR_BOX 0x0C10
-#define GL_COLOR_CLEAR_VALUE 0x0C22
-#define GL_COLOR_WRITEMASK 0x0C23
-#define GL_UNPACK_ALIGNMENT 0x0CF5
-#define GL_PACK_ALIGNMENT 0x0D05
-#define GL_MAX_TEXTURE_SIZE 0x0D33
-#define GL_MAX_VIEWPORT_DIMS 0x0D3A
-#define GL_SUBPIXEL_BITS 0x0D50
-#define GL_RED_BITS 0x0D52
-#define GL_GREEN_BITS 0x0D53
-#define GL_BLUE_BITS 0x0D54
-#define GL_ALPHA_BITS 0x0D55
-#define GL_DEPTH_BITS 0x0D56
-#define GL_STENCIL_BITS 0x0D57
-#define GL_POLYGON_OFFSET_UNITS 0x2A00
-#define GL_POLYGON_OFFSET_FACTOR 0x8038
-#define GL_TEXTURE_BINDING_2D 0x8069
-#define GL_SAMPLE_BUFFERS 0x80A8
-#define GL_SAMPLES 0x80A9
-#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
-#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
-#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
-#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
-#define GL_DONT_CARE 0x1100
-#define GL_FASTEST 0x1101
-#define GL_NICEST 0x1102
-#define GL_GENERATE_MIPMAP_HINT 0x8192
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309125345.8.gb6decfa.tar.bz2/libhybris/hybris/include/GLES3/gl32.h
^
|
@@ -1,1817 +0,0 @@
-#ifndef __gl32_h_
-#define __gl32_h_ 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
-** Copyright (c) 2013-2016 The Khronos Group Inc.
-**
-** Permission is hereby granted, free of charge, to any person obtaining a
-** copy of this software and/or associated documentation files (the
-** "Materials"), to deal in the Materials without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Materials, and to
-** permit persons to whom the Materials are furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be included
-** in all copies or substantial portions of the Materials.
-**
-** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
-*/
-/*
-** This header is generated from the Khronos OpenGL / OpenGL ES XML
-** API Registry. The current version of the Registry, generator scripts
-** used to make the header, and the header can be found at
-** http://www.opengl.org/registry/
-**
-** Khronos $Revision$ on $Date$
-*/
-
-#include <GLES3/gl3platform.h>
-
-#ifndef GL_APIENTRYP
-#define GL_APIENTRYP GL_APIENTRY*
-#endif
-
-/* Generated on date 20160428 */
-
-/* Generated C header for:
- * API: gles2
- * Profile: common
- * Versions considered: 2\.[0-9]|3\.[012]
- * Versions emitted: .*
- * Default extensions included: None
- * Additional extensions included: _nomatch_^
- * Extensions removed: _nomatch_^
- */
-
-#ifndef GL_ES_VERSION_2_0
-#define GL_ES_VERSION_2_0 1
-#include <KHR/khrplatform.h>
-typedef khronos_int8_t GLbyte;
-typedef khronos_float_t GLclampf;
-typedef khronos_int32_t GLfixed;
-typedef short GLshort;
-typedef unsigned short GLushort;
-typedef void GLvoid;
-typedef struct __GLsync *GLsync;
-typedef khronos_int64_t GLint64;
-typedef khronos_uint64_t GLuint64;
-typedef unsigned int GLenum;
-typedef unsigned int GLuint;
-typedef char GLchar;
-typedef khronos_float_t GLfloat;
-typedef khronos_ssize_t GLsizeiptr;
-typedef khronos_intptr_t GLintptr;
-typedef unsigned int GLbitfield;
-typedef int GLint;
-typedef unsigned char GLboolean;
-typedef int GLsizei;
-typedef khronos_uint8_t GLubyte;
-#define GL_DEPTH_BUFFER_BIT 0x00000100
-#define GL_STENCIL_BUFFER_BIT 0x00000400
-#define GL_COLOR_BUFFER_BIT 0x00004000
-#define GL_FALSE 0
-#define GL_TRUE 1
-#define GL_POINTS 0x0000
-#define GL_LINES 0x0001
-#define GL_LINE_LOOP 0x0002
-#define GL_LINE_STRIP 0x0003
-#define GL_TRIANGLES 0x0004
-#define GL_TRIANGLE_STRIP 0x0005
-#define GL_TRIANGLE_FAN 0x0006
-#define GL_ZERO 0
-#define GL_ONE 1
-#define GL_SRC_COLOR 0x0300
-#define GL_ONE_MINUS_SRC_COLOR 0x0301
-#define GL_SRC_ALPHA 0x0302
-#define GL_ONE_MINUS_SRC_ALPHA 0x0303
-#define GL_DST_ALPHA 0x0304
-#define GL_ONE_MINUS_DST_ALPHA 0x0305
-#define GL_DST_COLOR 0x0306
-#define GL_ONE_MINUS_DST_COLOR 0x0307
-#define GL_SRC_ALPHA_SATURATE 0x0308
-#define GL_FUNC_ADD 0x8006
-#define GL_BLEND_EQUATION 0x8009
-#define GL_BLEND_EQUATION_RGB 0x8009
-#define GL_BLEND_EQUATION_ALPHA 0x883D
-#define GL_FUNC_SUBTRACT 0x800A
-#define GL_FUNC_REVERSE_SUBTRACT 0x800B
-#define GL_BLEND_DST_RGB 0x80C8
-#define GL_BLEND_SRC_RGB 0x80C9
-#define GL_BLEND_DST_ALPHA 0x80CA
-#define GL_BLEND_SRC_ALPHA 0x80CB
-#define GL_CONSTANT_COLOR 0x8001
-#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
-#define GL_CONSTANT_ALPHA 0x8003
-#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
-#define GL_BLEND_COLOR 0x8005
-#define GL_ARRAY_BUFFER 0x8892
-#define GL_ELEMENT_ARRAY_BUFFER 0x8893
-#define GL_ARRAY_BUFFER_BINDING 0x8894
-#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
-#define GL_STREAM_DRAW 0x88E0
-#define GL_STATIC_DRAW 0x88E4
-#define GL_DYNAMIC_DRAW 0x88E8
-#define GL_BUFFER_SIZE 0x8764
-#define GL_BUFFER_USAGE 0x8765
-#define GL_CURRENT_VERTEX_ATTRIB 0x8626
-#define GL_FRONT 0x0404
-#define GL_BACK 0x0405
-#define GL_FRONT_AND_BACK 0x0408
-#define GL_TEXTURE_2D 0x0DE1
-#define GL_CULL_FACE 0x0B44
-#define GL_BLEND 0x0BE2
-#define GL_DITHER 0x0BD0
-#define GL_STENCIL_TEST 0x0B90
-#define GL_DEPTH_TEST 0x0B71
-#define GL_SCISSOR_TEST 0x0C11
-#define GL_POLYGON_OFFSET_FILL 0x8037
-#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
-#define GL_SAMPLE_COVERAGE 0x80A0
-#define GL_NO_ERROR 0
-#define GL_INVALID_ENUM 0x0500
-#define GL_INVALID_VALUE 0x0501
-#define GL_INVALID_OPERATION 0x0502
-#define GL_OUT_OF_MEMORY 0x0505
-#define GL_CW 0x0900
-#define GL_CCW 0x0901
-#define GL_LINE_WIDTH 0x0B21
-#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
-#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
-#define GL_CULL_FACE_MODE 0x0B45
-#define GL_FRONT_FACE 0x0B46
-#define GL_DEPTH_RANGE 0x0B70
-#define GL_DEPTH_WRITEMASK 0x0B72
-#define GL_DEPTH_CLEAR_VALUE 0x0B73
-#define GL_DEPTH_FUNC 0x0B74
-#define GL_STENCIL_CLEAR_VALUE 0x0B91
-#define GL_STENCIL_FUNC 0x0B92
-#define GL_STENCIL_FAIL 0x0B94
-#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
-#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
-#define GL_STENCIL_REF 0x0B97
-#define GL_STENCIL_VALUE_MASK 0x0B93
-#define GL_STENCIL_WRITEMASK 0x0B98
-#define GL_STENCIL_BACK_FUNC 0x8800
-#define GL_STENCIL_BACK_FAIL 0x8801
-#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802
-#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803
-#define GL_STENCIL_BACK_REF 0x8CA3
-#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4
-#define GL_STENCIL_BACK_WRITEMASK 0x8CA5
-#define GL_VIEWPORT 0x0BA2
-#define GL_SCISSOR_BOX 0x0C10
-#define GL_COLOR_CLEAR_VALUE 0x0C22
-#define GL_COLOR_WRITEMASK 0x0C23
-#define GL_UNPACK_ALIGNMENT 0x0CF5
-#define GL_PACK_ALIGNMENT 0x0D05
-#define GL_MAX_TEXTURE_SIZE 0x0D33
-#define GL_MAX_VIEWPORT_DIMS 0x0D3A
-#define GL_SUBPIXEL_BITS 0x0D50
-#define GL_RED_BITS 0x0D52
-#define GL_GREEN_BITS 0x0D53
-#define GL_BLUE_BITS 0x0D54
-#define GL_ALPHA_BITS 0x0D55
-#define GL_DEPTH_BITS 0x0D56
-#define GL_STENCIL_BITS 0x0D57
-#define GL_POLYGON_OFFSET_UNITS 0x2A00
-#define GL_POLYGON_OFFSET_FACTOR 0x8038
-#define GL_TEXTURE_BINDING_2D 0x8069
-#define GL_SAMPLE_BUFFERS 0x80A8
-#define GL_SAMPLES 0x80A9
-#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
-#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
-#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
-#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
-#define GL_DONT_CARE 0x1100
-#define GL_FASTEST 0x1101
-#define GL_NICEST 0x1102
-#define GL_GENERATE_MIPMAP_HINT 0x8192
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309125345.8.gb6decfa.tar.bz2/libhybris/hybris/include/GLES3/gl3ext.h
^
|
@@ -1,24 +0,0 @@
-#ifndef __gl3ext_h_
-#define __gl3ext_h_
-
-/* $Revision: 17809 $ on $Date:: 2012-05-14 08:03:36 -0700 #$ */
-
-/*
- * This document is licensed under the SGI Free Software B License Version
- * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
- */
-
-/* OpenGL ES 3 Extensions
- *
- * After an OES extension's interactions with OpenGl ES 3.0 have been documented,
- * its tokens and function definitions should be added to this file in a manner
- * that does not conflict with gl2ext.h or gl3.h.
- *
- * Tokens and function definitions for extensions that have become standard
- * features in OpenGL ES 3.0 will not be added to this file.
- *
- * Applications using OpenGL-ES-2-only extensions should include gl2ext.h
- */
-
-#endif /* __gl3ext_h_ */
-
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309125345.8.gb6decfa.tar.bz2/libhybris/hybris/tests/test_camera.cpp
^
|
@@ -1,506 +0,0 @@
-/*
- * Copyright (C) 2012 Canonical 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.
- *
- */
-
-#include "config.h"
-
-#include <wayland-client.h>
-#include <wayland-server.h>
-#include <wayland-client-protocol.h>
-#include <wayland-egl.h>
-
-#include <hybris/camera/camera_compatibility_layer.h>
-#include <hybris/camera/camera_compatibility_layer_capabilities.h>
-
-#include <hybris/input/input_stack_compatibility_layer.h>
-#include <hybris/input/input_stack_compatibility_layer_codes_key.h>
-#include <hybris/input/input_stack_compatibility_layer_flags_key.h>
-#include <hybris/input/input_stack_compatibility_layer_flags_motion.h>
-
-#include <EGL/egl.h>
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
-#include <assert.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <limits.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-
-#include "test_common.h"
-
-int shot_counter = 1;
-int32_t current_zoom_level = 1;
-bool new_camera_frame_available = true;
-
-static GLuint gProgram;
-static GLuint gaPositionHandle, gaTexHandle, gsTextureHandle, gmTexMatrix;
-
-EffectMode next_effect()
-{
- static EffectMode current_effect = EFFECT_MODE_NONE;
-
- EffectMode next = current_effect;
-
- switch (current_effect) {
- case EFFECT_MODE_NONE:
- next = EFFECT_MODE_MONO;
- break;
- case EFFECT_MODE_MONO:
- next = EFFECT_MODE_NEGATIVE;
- break;
- case EFFECT_MODE_NEGATIVE:
- next = EFFECT_MODE_SOLARIZE;
- break;
- case EFFECT_MODE_SOLARIZE:
- next = EFFECT_MODE_SEPIA;
- break;
- case EFFECT_MODE_SEPIA:
- next = EFFECT_MODE_POSTERIZE;
- break;
- case EFFECT_MODE_POSTERIZE:
- next = EFFECT_MODE_WHITEBOARD;
- break;
- case EFFECT_MODE_WHITEBOARD:
- next = EFFECT_MODE_BLACKBOARD;
- break;
- case EFFECT_MODE_BLACKBOARD:
- next = EFFECT_MODE_AQUA;
- break;
- case EFFECT_MODE_AQUA:
- next = EFFECT_MODE_NONE;
- break;
- }
-
- current_effect = next;
- return next;
-}
-
-void error_msg_cb(void* context)
-{
- printf("%s \n", __PRETTY_FUNCTION__);
-}
-
-void shutter_msg_cb(void* context)
-{
- printf("%s \n", __PRETTY_FUNCTION__);
-}
-
-void zoom_msg_cb(void* context, int32_t new_zoom_level)
-{
- printf("%s \n", __PRETTY_FUNCTION__);
-
- current_zoom_level = new_zoom_level;
-}
-
-void autofocus_msg_cb(void* context)
-{
- printf("%s \n", __PRETTY_FUNCTION__);
-}
-
-void raw_data_cb(void* data, uint32_t data_size, void* context)
-{
- printf("%s: %d \n", __PRETTY_FUNCTION__, data_size);
-}
-
-void jpeg_data_cb(void* data, uint32_t data_size, void* context)
-{
- printf("%s: %d \n", __PRETTY_FUNCTION__, data_size);
-
- char fn[256];
- sprintf(fn, "/tmp/shot_%d.jpeg", shot_counter);
- int fd = open(fn, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
- if(fd < 0)
- return;
- TEMP_FAILURE_RETRY(write(fd, data, data_size));
- close(fd);
- shot_counter++;
-
- struct CameraControl* cc = (struct CameraControl*) context;
- android_camera_start_preview(cc);
-}
-
-void size_cb(void* ctx, int width, int height)
-{
- printf("Supported size: [%d,%d]\n", width, height);
-}
-
-void preview_texture_needs_update_cb(void* ctx)
-{
- new_camera_frame_available = true;
-}
-
-void on_new_input_event(struct Event* event, void* context)
-{
- assert(context);
-
- if (event->type == KEY_EVENT_TYPE && event->action == ISCL_KEY_EVENT_ACTION_UP) {
- printf("We have got a key event: %d \n", event->details.key.key_code);
-
- struct CameraControl* cc = (struct CameraControl*) context;
-
- switch(event->details.key.key_code) {
- case ISCL_KEYCODE_VOLUME_UP:
- printf("\tZooming in now.\n");
- android_camera_start_zoom(cc, current_zoom_level+1);
- break;
- case ISCL_KEYCODE_VOLUME_DOWN:
- printf("\tZooming out now.\n");
- android_camera_start_zoom(cc, current_zoom_level-1);
- break;
- case ISCL_KEYCODE_POWER:
- printf("\tTaking a photo now.\n");
- android_camera_take_snapshot(cc);
- break;
- case ISCL_KEYCODE_HEADSETHOOK:
- printf("\tSwitching effect.\n");
- android_camera_set_effect_mode(cc, next_effect());
-
- }
- } else if (event->type == MOTION_EVENT_TYPE &&
- event->details.motion.pointer_count == 1) {
- if ((event->action & ISCL_MOTION_EVENT_ACTION_MASK) == ISCL_MOTION_EVENT_ACTION_UP) {
- printf("\tMotion event(Action up): (%f, %f) \n",
- event->details.motion.pointer_coordinates[0].x,
- event->details.motion.pointer_coordinates[0].y);
- }
-
- if ((event->action & ISCL_MOTION_EVENT_ACTION_MASK) == ISCL_MOTION_EVENT_ACTION_DOWN) {
- printf("\tMotion event(Action down): (%f, %f) \n",
- event->details.motion.pointer_coordinates[0].x,
- event->details.motion.pointer_coordinates[0].y);
- }
- }
-}
-
-static const char* vertex_shader()
-{
- return
- "#extension GL_OES_EGL_image_external : require \n"
- "attribute vec4 a_position; \n"
- "attribute vec2 a_texCoord; \n"
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309125345.8.gb6decfa.tar.bz2/libhybris/hybris/tests/test_common.cpp
^
|
@@ -1,462 +0,0 @@
-/*
- * Copyright (C) 2020 Matti Lehtimäki <matti.lehtimaki@gmail.com>
- * Copyright (C) 2018 TheKit <nekit1000@gmail.com>
- * Copyright (c) 2012 Carsten Munk <carsten.munk@gmail.com>
- *
- * 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.
- *
- */
-
-#include "test_common.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <cutils/log.h>
-#include <sync/sync.h>
-
-#include "test_common.h"
-
-#if USE_HWCOMPOSER
-
-#include "logging.h"
-
-inline static uint32_t interpreted_version(hw_device_t *hwc_device)
-{
- uint32_t version = hwc_device->version;
-
- if ((version & 0xffff0000) == 0) {
- // Assume header version is always 1
- uint32_t header_version = 1;
-
- // Legacy version encoding
- version = (version << 16) | header_version;
- }
- return version;
-}
-
-#if HAS_HWCOMPOSER2_HEADERS
-
-hwc2_compat_device_t* hwcDevice;
-
-HWComposer2::HWComposer2(unsigned int width, unsigned int height,
- unsigned int format, hwc2_compat_display_t* display,
- hwc2_compat_layer_t *layer)
- : HWComposer(width, height, format)
-{
- this->layer = layer;
- this->hwcDisplay = display;
-}
-
-void HWComposer2::present(HWComposerNativeWindowBuffer *buffer)
-{
- uint32_t numTypes = 0;
- uint32_t numRequests = 0;
-
- hwc2_error_t error = hwc2_compat_display_validate(hwcDisplay, &numTypes,
- &numRequests);
-
- if (error != HWC2_ERROR_NONE && error != HWC2_ERROR_HAS_CHANGES) {
- HYBRIS_ERROR("prepare: validate failed for display %lu: %s (%d)", displayId,
- to_string(static_cast<HWC2::Error>(error)).c_str(), error);
- return;
- }
-
- if (numTypes || numRequests) {
- HYBRIS_ERROR("prepare: validate required changes for display %lu: %s (%d)",
- displayId, to_string(static_cast<HWC2::Error>(error)).c_str(),
- error);
- return;
- }
-
- error = hwc2_compat_display_accept_changes(hwcDisplay);
- if (error != HWC2_ERROR_NONE) {
- HYBRIS_ERROR("prepare: acceptChanges failed: %s",
- to_string(static_cast<HWC2::Error>(error)).c_str());
- return;
- }
-
- hwc2_compat_display_set_client_target(hwcDisplay, /* slot */0, buffer,
- getFenceBufferFd(buffer),
- HAL_DATASPACE_UNKNOWN);
-
- int presentFence;
- hwc2_compat_display_present(hwcDisplay, &presentFence);
-
- if (error != HWC2_ERROR_NONE) {
- HYBRIS_ERROR("presentAndGetReleaseFences: failed for display %lu: %s (%d)",
- displayId,
- to_string(static_cast<HWC2::Error>(error)).c_str(), error);
- return;
- }
-
- hwc2_compat_out_fences_t* fences;
- error = hwc2_compat_display_get_release_fences(
- hwcDisplay, &fences);
-
- if (error != HWC2_ERROR_NONE) {
- HYBRIS_ERROR("presentAndGetReleaseFences: Failed to get release fences "
- "for display %lu: %s (%d)",
- displayId, to_string(static_cast<HWC2::Error>(error)).c_str(),
- error);
- return;
- }
-
- int fenceFd = hwc2_compat_out_fences_get_fence(fences, layer);
- if (fenceFd != -1)
- setFenceBufferFd(buffer, fenceFd);
-
- hwc2_compat_out_fences_destroy(fences);
-
- if (lastPresentFence != -1) {
- sync_wait(lastPresentFence, -1);
- close(lastPresentFence);
- }
- lastPresentFence = presentFence;
-}
-
-void onVsyncReceived(HWC2EventListener* listener, int32_t sequenceId,
- hwc2_display_t display, int64_t timestamp)
-{
-}
-
-void onHotplugReceived(HWC2EventListener* listener, int32_t sequenceId,
- hwc2_display_t display, bool connected,
- bool primaryDisplay)
-{
- HYBRIS_INFO("onHotplugReceived(%d, %" PRIu64 ", %s, %s)",
- sequenceId, display,
- connected ? "connected" : "disconnected",
- primaryDisplay ? "primary" : "external");
-
- hwc2_compat_device_on_hotplug(hwcDevice, display, connected);
-}
-
-void onRefreshReceived(HWC2EventListener* listener,
- int32_t sequenceId, hwc2_display_t display)
-{
-}
-
-HWC2EventListener eventListener = {
- &onVsyncReceived,
- &onHotplugReceived,
- &onRefreshReceived
-};
-
-HWComposer *create_hwcomposer2_window()
-{
- int composerSequenceId = 0;
-
- hwcDevice = hwc2_compat_device_new(false);
- assert(hwcDevice);
-
- hwc2_compat_device_register_callback(hwcDevice, &eventListener,
- composerSequenceId);
-
- hwc2_compat_display_t* hwcDisplay;
- for (int i = 0; i < 5 * 1000; ++i) {
- /* Wait at most 5s for hotplug events */
- if ((hwcDisplay = hwc2_compat_device_get_display_by_id(hwcDevice, 0)))
- break;
- usleep(1000);
- }
- assert(hwcDisplay);
-
- hwc2_compat_display_set_power_mode(hwcDisplay, HWC2_POWER_MODE_ON);
-
- HWC2DisplayConfig* config = hwc2_compat_display_get_active_config(hwcDisplay);
-
- printf("width: %i height: %i\n", config->width, config->height);
-
- hwc2_compat_layer_t* layer = hwc2_compat_display_create_layer(hwcDisplay);
-
- hwc2_compat_layer_set_composition_type(layer, HWC2_COMPOSITION_CLIENT);
- hwc2_compat_layer_set_blend_mode(layer, HWC2_BLEND_MODE_NONE);
- hwc2_compat_layer_set_source_crop(layer, 0.0f, 0.0f, config->width,
- config->height);
- hwc2_compat_layer_set_display_frame(layer, 0, 0, config->width,
- config->height);
- hwc2_compat_layer_set_visible_region(layer, 0, 0, config->width,
- config->height);
-
- HWComposer2 *win = new HWComposer2(config->width, config->height,
- HAL_PIXEL_FORMAT_RGBA_8888, hwcDisplay,
- layer);
- return win;
-}
-#endif
-
-// Hwcomposer 1
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309125345.8.gb6decfa.tar.bz2/libhybris/hybris/tests/test_common.h
^
|
@@ -1,100 +0,0 @@
-/*
- * Copyright (C) 2020 Matti Lehtimäki <matti.lehtimaki@gmail.com>
- * Copyright (C) 2018 TheKit <nekit1000@gmail.com>
- * Copyright (c) 2012 Carsten Munk <carsten.munk@gmail.com>
- *
- * 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 __LIBHYBRIS_TEST_COMMON_H
-#define __LIBHYBRIS_TEST_COMMON_H
-
-#include <EGL/egl.h>
-
-#ifdef GL_ES_VERSION_3_0
-#include <GLES3/gl3.h>
-#include <GLES3/gl3ext.h>
-#else
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-#endif
-
-#if USE_HWCOMPOSER
-
-#include <hwcomposer_window.h>
-#if HAS_HWCOMPOSER2_HEADERS
-
-#include <hybris/hwc2/hwc2_compatibility_layer.h>
-#endif
-
-#ifdef __cplusplus
-
-class HWComposer : public HWComposerNativeWindow
-{
-public:
- HWComposer(unsigned int width, unsigned int height, unsigned int format)
- : HWComposerNativeWindow(width, height, format)
- {
- }
-
-protected:
- virtual void present(HWComposerNativeWindowBuffer *buffer) = 0;
-};
-
-#if HAS_HWCOMPOSER2_HEADERS
-
-// Hwcomposer 2
-class HWComposer2 : public HWComposer
-{
-private:
- hwc2_compat_layer_t *layer;
- hwc2_compat_display_t *hwcDisplay;
- int lastPresentFence = -1;
-protected:
- void present(HWComposerNativeWindowBuffer *buffer);
-
-public:
- HWComposer2(unsigned int width, unsigned int height, unsigned int format,
- hwc2_compat_display_t *display, hwc2_compat_layer_t *layer);
-};
-
-#endif
-
-#include <hwcomposer_window.h>
-#include <hardware/hardware.h>
-#include <hardware/hwcomposer.h>
-
-// Hwcomposer 1
-class HWComposer1 : public HWComposer
-{
-private:
- hwc_layer_1_t *fblayer;
- hwc_composer_device_1_t *hwcdevice;
- hwc_display_contents_1_t **mlist;
-protected:
- void present(HWComposerNativeWindowBuffer *buffer);
-
-public:
- HWComposer1(unsigned int width, unsigned int height, unsigned int format,
- hwc_composer_device_1_t *device, hwc_display_contents_1_t **mList, hwc_layer_1_t *layer);
-};
-
-HWComposer *create_hwcomposer_window();
-
-#endif
-
-#endif // USE_HWCOMPOSER
-
-GLuint create_program(const char* pVertexSource, const char* pFragmentSource);
-
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309125345.8.gb6decfa.tar.bz2/libhybris/hybris/tests/test_glesv2.cpp
^
|
@@ -1,183 +0,0 @@
-/*
- * Copyright (c) 2012 Carsten Munk <carsten.munk@gmail.com>
- *
- * 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.
- *
- */
-
-#include <EGL/egl.h>
-#include <GLES2/gl2.h>
-#include <assert.h>
-#include <stdio.h>
-#include <math.h>
-#include <stddef.h>
-#include <stdlib.h>
-
-#include "test_common.h"
-
-const char vertex_src [] =
-" \
- attribute vec4 position; \
- varying mediump vec2 pos; \
- uniform vec4 offset; \
- \
- void main() \
- { \
- gl_Position = position + offset; \
- pos = position.xy; \
- } \
-";
-
-
-const char fragment_src [] =
-" \
- varying mediump vec2 pos; \
- uniform mediump float phase; \
- \
- void main() \
- { \
- gl_FragColor = vec4( 1., 0.9, 0.7, 1.0 ) * \
- cos( 30.*sqrt(pos.x*pos.x + 1.5*pos.y*pos.y) \
- + atan(pos.y,pos.x) - phase ); \
- } \
-";
-
-
-GLfloat norm_x = 0.0;
-GLfloat norm_y = 0.0;
-GLfloat offset_x = 0.0;
-GLfloat offset_y = 0.0;
-GLfloat p1_pos_x = 0.0;
-GLfloat p1_pos_y = 0.0;
-
-GLint phase_loc;
-GLint offset_loc;
-GLint position_loc;
-
-const float vertexArray[] = {
- 0.0, 1.0, 0.0,
- -1., 0.0, 0.0,
- 0.0, -1.0, 0.0,
- 1., 0.0, 0.0,
- 0.0, 1., 0.0
-};
-
-
-int main(int argc, char **argv)
-{
- EGLDisplay display;
- EGLConfig ecfg;
- EGLint num_config;
- EGLint attr[] = { // some attributes to set up our egl-interface
- EGL_BUFFER_SIZE, 32,
- EGL_RENDERABLE_TYPE,
- EGL_OPENGL_ES2_BIT,
- EGL_NONE
- };
- EGLSurface surface;
- EGLint ctxattr[] = {
- EGL_CONTEXT_CLIENT_VERSION, 2,
- EGL_NONE
- };
- EGLContext context;
-
- EGLBoolean rv;
-
- HWComposer *win = create_hwcomposer_window();
-
- if (!win) {
- printf("Failed to create native window\n");
- return 1;
- }
-
- display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- assert(eglGetError() == EGL_SUCCESS);
- assert(display != EGL_NO_DISPLAY);
-
- rv = eglInitialize(display, 0, 0);
- assert(eglGetError() == EGL_SUCCESS);
- assert(rv == EGL_TRUE);
-
- eglChooseConfig((EGLDisplay) display, attr, &ecfg, 1, &num_config);
- assert(eglGetError() == EGL_SUCCESS);
- assert(rv == EGL_TRUE);
-
- surface = eglCreateWindowSurface((EGLDisplay) display, ecfg,
- (EGLNativeWindowType) static_cast<ANativeWindow *> (win), NULL);
- assert(eglGetError() == EGL_SUCCESS);
- assert(surface != EGL_NO_SURFACE);
-
- context = eglCreateContext((EGLDisplay) display, ecfg, EGL_NO_CONTEXT, ctxattr);
- assert(eglGetError() == EGL_SUCCESS);
- assert(context != EGL_NO_CONTEXT);
-
- assert(eglMakeCurrent((EGLDisplay) display, surface, surface, context) == EGL_TRUE);
-
- const char *version = (const char *)glGetString(GL_VERSION);
- assert(version);
- printf("%s\n",version);
-
- GLuint shaderProgram = create_program(vertex_src, fragment_src);
- glUseProgram ( shaderProgram ); // and select it for usage
-
- //// now get the locations (kind of handle) of the shaders variables
- position_loc = glGetAttribLocation ( shaderProgram , "position" );
- phase_loc = glGetUniformLocation ( shaderProgram , "phase" );
- offset_loc = glGetUniformLocation ( shaderProgram , "offset" );
- if ( position_loc < 0 || phase_loc < 0 || offset_loc < 0 ) {
- return 1;
- }
-
- //glViewport ( 0 , 0 , 800, 600); // commented out so it uses the initial window dimensions
- glClearColor ( 1. , 1. , 1. , 1.); // background color
- float phase = 0;
- int frames = -1;
- if(argc == 2) {
- frames = atoi(argv[1]);
- }
- if(frames < 0) {
- frames = 30 * 60;
- }
-
- int i;
- for (i = 0; i < frames; ++i) {
- if(i % 60 == 0) printf("frame:%i\n", i);
- glClear(GL_COLOR_BUFFER_BIT);
- glUniform1f ( phase_loc , phase ); // write the value of phase to the shaders phase
- phase = fmodf ( phase + 0.5f , 2.f * 3.141f ); // and update the local variable
-
- glUniform4f ( offset_loc , offset_x , offset_y , 0.0 , 0.0 );
-
- glVertexAttribPointer ( position_loc, 3, GL_FLOAT, GL_FALSE, 0, vertexArray );
- glEnableVertexAttribArray ( position_loc );
- glDrawArrays ( GL_TRIANGLE_STRIP, 0, 5 );
-
- eglSwapBuffers ( (EGLDisplay) display, surface ); // get the rendered buffer to the screen
- }
-
- printf("stop\n");
-
-#if 0
-(*egldestroycontext)((EGLDisplay) display, context);
- printf("destroyed context\n");
-
- (*egldestroysurface)((EGLDisplay) display, surface);
- printf("destroyed surface\n");
- (*eglterminate)((EGLDisplay) display);
- printf("terminated\n");
- android_dlclose(baz);
-#endif
- return 0;
-}
-
-// vim:ts=4:sw=4:noexpandtab
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309125345.8.gb6decfa.tar.bz2/libhybris/hybris/tests/test_glesv3.cpp
^
|
@@ -1,174 +0,0 @@
-/*
- * Copyright (C) 2020 Matti Lehtimäki <matti.lehtimaki@gmail.com>
- * Copyright (c) 2017 Franz-Josef Haider <f_haider@gmx.at>
- * Copyright (c) 2012 Carsten Munk <carsten.munk@gmail.com>
- *
- * 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.
- *
- */
-
-#include <EGL/egl.h>
-#include <GLES3/gl3.h>
-#include <assert.h>
-#include <stdio.h>
-#include <math.h>
-#include <stddef.h>
-#include <stdlib.h>
-
-#include "test_common.h"
-
-const char vertex_src [] =
-"#version 300 es \n"
-"in vec4 position; \n"
-"out mediump vec2 pos; \n"
-"uniform vec4 offset; \n"
-" \n"
-"void main() \n"
-"{ \n"
-" gl_Position = position + offset; \n"
-" gl_Position.x += float(gl_InstanceID) * 0.5; \n"
-" gl_Position.y += float(gl_InstanceID) * 0.5; \n"
-" pos = position.xy; \n"
-"} \n";
-
-const char fragment_src [] =
-"#version 300 es \n"
-"in mediump vec2 pos; \n"
-"uniform mediump float phase; \n"
-"out mediump vec4 fragColor; \n"
-" \n"
-"void main() \n"
-"{ \n"
-" fragColor = vec4( 1., 0.9, 0.7, 1.0 ) * \n"
-" cos( 30.*sqrt(pos.x*pos.x + 1.5*pos.y*pos.y) \n"
-" + atan(pos.y,pos.x) - phase ); \n"
-"} \n";
-
-
-GLfloat norm_x = 0.0;
-GLfloat norm_y = 0.0;
-GLfloat offset_x = -0.5;
-GLfloat offset_y = -0.5;
-GLfloat p1_pos_x = 0.0;
-GLfloat p1_pos_y = 0.0;
-
-GLint phase_loc;
-GLint offset_loc;
-GLint position_loc;
-
-const float vertexArray[] = {
- 0.0, 0.5, 0.0,
- -0.5, 0.0, 0.0,
- 0.0, -0.5, 0.0,
- 0.5, 0.0, 0.0,
- 0.0, 0.5, 0.0
-};
-
-int main(int argc, char **argv)
-{
- EGLDisplay display;
- EGLConfig ecfg;
- EGLint num_config;
- EGLint attr[] = { // some attributes to set up our egl-interface
- EGL_BUFFER_SIZE, 32,
- EGL_RENDERABLE_TYPE,
- EGL_OPENGL_ES3_BIT,
- EGL_NONE
- };
- EGLSurface surface;
- EGLint ctxattr[] = {
- EGL_CONTEXT_CLIENT_VERSION, 3,
- EGL_NONE
- };
- EGLContext context;
-
- EGLBoolean rv;
-
- HWComposer *win = create_hwcomposer_window();
-
- if (!win) {
- printf("Failed to create native window\n");
- return 1;
- }
-
- display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- assert(eglGetError() == EGL_SUCCESS);
- assert(display != EGL_NO_DISPLAY);
-
- rv = eglInitialize(display, 0, 0);
- assert(eglGetError() == EGL_SUCCESS);
- assert(rv == EGL_TRUE);
-
- eglChooseConfig((EGLDisplay) display, attr, &ecfg, 1, &num_config);
- assert(eglGetError() == EGL_SUCCESS);
- assert(rv == EGL_TRUE);
-
- surface = eglCreateWindowSurface((EGLDisplay) display, ecfg,
- (EGLNativeWindowType) static_cast<ANativeWindow *> (win), NULL);
- assert(eglGetError() == EGL_SUCCESS);
- assert(surface != EGL_NO_SURFACE);
-
- context = eglCreateContext((EGLDisplay) display, ecfg, EGL_NO_CONTEXT, ctxattr);
- assert(eglGetError() == EGL_SUCCESS);
- assert(context != EGL_NO_CONTEXT);
-
- assert(eglMakeCurrent((EGLDisplay) display, surface, surface, context) == EGL_TRUE);
-
- const char *version = (const char *)glGetString(GL_VERSION);
- assert(version);
- printf("%s\n",version);
-
- GLuint shaderProgram = create_program(vertex_src, fragment_src);
- glUseProgram(shaderProgram); // and select it for usage
-
- //// now get the locations (kind of handle) of the shaders variables
- position_loc = glGetAttribLocation(shaderProgram, "position");
- phase_loc = glGetUniformLocation(shaderProgram, "phase");
- offset_loc = glGetUniformLocation(shaderProgram, "offset");
-
- if (position_loc < 0 || phase_loc < 0 || offset_loc < 0) {
- return 1;
- }
-
- glClearColor (1., 1., 1., 1.); // background color
- float phase = 0;
- int frames = -1;
- if (argc == 2) {
- frames = atoi(argv[1]);
- }
- if (frames < 0) {
- frames = 30 * 60;
- }
-
- int i;
- for (i = 0; i < frames; ++i) {
- if (i % 60 == 0) printf("frame:%i\n", i);
- glClear(GL_COLOR_BUFFER_BIT);
- glUniform1f(phase_loc, phase); // write the value of phase to the shaders phase
- phase = fmodf(phase + 0.5f, 2.f * 3.141f); // and update the local variable
-
- glUniform4f(offset_loc, offset_x, offset_y, 0.0, 0.0);
-
- glVertexAttribPointer(position_loc, 3, GL_FLOAT, GL_FALSE, 0, vertexArray);
- glEnableVertexAttribArray(position_loc);
- glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 5, 3);
-
- eglSwapBuffers((EGLDisplay) display, surface); // get the rendered buffer to the screen
- }
-
- printf("stop\n");
-
- return 0;
-}
-
-// vim:ts=4:sw=4:noexpandtab
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309125345.8.gb6decfa.tar.bz2/libhybris/hybris/tests/test_media.cpp
^
|
@@ -1,299 +0,0 @@
-/*
- * Copyright (C) 2013 Canonical 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.
- *
- * Authored by: Jim Hodapp <jim.hodapp@canonical.com>
- * Ricardo Salveti de Araujo <ricardo.salveti@canonical.com>
- */
-
-#include <hybris/media/media_compatibility_layer.h>
-#include <hybris/surface_flinger/surface_flinger_compatibility_layer.h>
-
-#include <EGL/egl.h>
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
-#include <assert.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdbool.h>
-#include <limits.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-
-#include "test_common.h"
-
-enum {
- OK = 0,
- NO_ERROR = 0,
-};
-
-static float DestWidth = 0.0, DestHeight = 0.0;
-// Actual video dimmensions
-static int Width = 0, Height = 0;
-
-static GLuint gProgram;
-static GLuint gaPositionHandle, gaTexHandle, gsTextureHandle, gmTexMatrix;
-
-static GLfloat positionCoordinates[8];
-
-struct MediaPlayerWrapper *player = NULL;
-
-void calculate_position_coordinates()
-{
- // Assuming cropping output for now
- float x = 1, y = 1;
-
- // Black borders
- x = (float) (Width / DestWidth);
- y = (float) (Height / DestHeight);
-
- // Make the larger side be 1
- if (x > y) {
- y /= x;
- x = 1;
- } else {
- x /= y;
- y = 1;
- }
-
- positionCoordinates[0] = -x;
- positionCoordinates[1] = y;
- positionCoordinates[2] = -x;
- positionCoordinates[3] = -y;
- positionCoordinates[4] = x;
- positionCoordinates[5] = -y;
- positionCoordinates[6] = x;
- positionCoordinates[7] = y;
-}
-
-struct ClientWithSurface
-{
- struct SfClient* client;
- struct SfSurface* surface;
-};
-
-struct ClientWithSurface client_with_surface(bool setup_surface_with_egl)
-{
- struct ClientWithSurface cs;
-
- cs.client = sf_client_create();
-
- if (!cs.client) {
- printf("Problem creating client ... aborting now.");
- return cs;
- }
-
- static const size_t primary_display = 0;
-
- DestWidth = sf_get_display_width(primary_display);
- DestHeight = sf_get_display_height(primary_display);
- printf("Primary display width: %f, height: %f\n", DestWidth, DestHeight);
-
- SfSurfaceCreationParameters params = {
- 0,
- 0,
- (int)DestWidth,
- (int)DestHeight,
- -1, //PIXEL_FORMAT_RGBA_8888,
- 15000,
- 0.5f,
- setup_surface_with_egl, // Do not associate surface with egl, will be done by camera HAL
- "MediaCompatLayerTestSurface"
- };
-
- cs.surface = sf_surface_create(cs.client, ¶ms);
-
- if (!cs.surface) {
- printf("Problem creating surface ... aborting now.");
- return cs;
- }
-
- sf_surface_make_current(cs.surface);
-
- return cs;
-}
-
-static const char *vertex_shader()
-{
- return
- "attribute vec4 a_position; \n"
- "attribute vec2 a_texCoord; \n"
- "uniform mat4 m_texMatrix; \n"
- "varying vec2 v_texCoord; \n"
- "varying float topDown; \n"
- "void main() \n"
- "{ \n"
- " gl_Position = a_position; \n"
- " v_texCoord = (m_texMatrix * vec4(a_texCoord, 0.0, 1.0)).xy;\n"
- "} \n";
-}
-
-static const char *fragment_shader()
-{
- return
- "#extension GL_OES_EGL_image_external : require \n"
- "precision mediump float; \n"
- "varying vec2 v_texCoord; \n"
- "uniform samplerExternalOES s_texture; \n"
- "void main() \n"
- "{ \n"
- " gl_FragColor = texture2D( s_texture, v_texCoord );\n"
- "} \n";
-}
-
-static int setup_video_texture(struct ClientWithSurface *cs, GLuint *preview_texture_id)
-{
- assert(cs != NULL);
- assert(preview_texture_id != NULL);
-
- sf_surface_make_current(cs->surface);
-
- glGenTextures(1, preview_texture_id);
- glClearColor(0, 0, 0, 0);
- glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-
- android_media_set_preview_texture(player, *preview_texture_id);
-
- return 0;
-}
-
-void set_video_size_cb(int height, int width, void *context)
-{
- printf("Video height: %d, width: %d\n", height, width);
- printf("Video dest height: %f, width: %f\n", DestHeight, DestWidth);
-
- Height = height;
- Width = width;
-}
-
-void media_prepared_cb(void *context)
-{
- printf("Media is prepared for playback.\n");
-}
-
-int main(int argc, char **argv)
-{
- if (argc < 2) {
- printf("Usage: test_media <video_to_play>\n");
- return EXIT_FAILURE;
- }
-
- player = android_media_new_player();
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309125345.8.gb6decfa.tar.bz2/libhybris/hybris/tests/test_recorder.cpp
^
|
@@ -1,417 +0,0 @@
-/*
- * Copyright (C) 2013 Canonical 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.
- *
- * Authored by: Jim Hodapp <jim.hodapp@canonical.com>
- * Guenter Schwann <guenter.schwann@canonical.com>
- * Ricardo Salveti de Araujo <ricardo.salveti@canonical.com>
- */
-
-#include <hybris/camera/camera_compatibility_layer.h>
-#include <hybris/camera/camera_compatibility_layer_capabilities.h>
-
-#include <hybris/media/recorder_compatibility_layer.h>
-
-#include <hybris/input/input_stack_compatibility_layer.h>
-#include <hybris/input/input_stack_compatibility_layer_codes_key.h>
-#include <hybris/input/input_stack_compatibility_layer_flags_key.h>
-
-#include <hybris/surface_flinger/surface_flinger_compatibility_layer.h>
-
-#include <EGL/egl.h>
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
-#include <assert.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdbool.h>
-#include <limits.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-
-#include "test_common.h"
-
-int shot_counter = 1;
-int32_t current_zoom_level = 1;
-bool new_camera_frame_available = true;
-struct MediaRecorderWrapper *mr = 0;
-GLuint preview_texture_id = 0;
-
-static GLuint gProgram;
-static GLuint gaPositionHandle, gaTexHandle, gsTextureHandle, gmTexMatrix;
-
-void error_msg_cb(void* context)
-{
- printf("%s \n", __PRETTY_FUNCTION__);
-}
-
-void shutter_msg_cb(void* context)
-{
- printf("%s \n", __PRETTY_FUNCTION__);
-}
-
-void zoom_msg_cb(void* context, int32_t new_zoom_level)
-{
- printf("%s \n", __PRETTY_FUNCTION__);
-
- current_zoom_level = new_zoom_level;
-}
-
-void autofocus_msg_cb(void* context)
-{
- printf("%s \n", __PRETTY_FUNCTION__);
-}
-
-void raw_data_cb(void* data, uint32_t data_size, void* context)
-{
- printf("%s: %d \n", __PRETTY_FUNCTION__, data_size);
-}
-
-void jpeg_data_cb(void* data, uint32_t data_size, void* context)
-{
- printf("%s: %d \n", __PRETTY_FUNCTION__, data_size);
- struct CameraControl* cc = (struct CameraControl*) context;
- android_camera_start_preview(cc);
-}
-
-void size_cb(void* ctx, int width, int height)
-{
- printf("Supported size: [%d,%d]\n", width, height);
-}
-
-void preview_texture_needs_update_cb(void* ctx)
-{
- new_camera_frame_available = true;
-}
-
-void on_new_input_event(struct Event* event, void* context)
-{
- assert(context);
-
- if (event->type == KEY_EVENT_TYPE && event->action == ISCL_KEY_EVENT_ACTION_UP) {
- printf("We have got a key event: %d \n", event->details.key.key_code);
-
- struct CameraControl* cc = (struct CameraControl*) context;
-
- int ret;
- switch (event->details.key.key_code) {
- case ISCL_KEYCODE_VOLUME_UP:
- printf("Starting video recording\n");
-
- android_camera_unlock(cc);
-
- ret = android_recorder_setCamera(mr, cc);
- if (ret < 0) {
- printf("android_recorder_setCamera() failed\n");
- return;
- }
- //state initial / idle
- ret = android_recorder_setAudioSource(mr, ANDROID_AUDIO_SOURCE_CAMCORDER);
- if (ret < 0) {
- printf("android_recorder_setAudioSource() failed\n");
- return;
- }
- ret = android_recorder_setVideoSource(mr, ANDROID_VIDEO_SOURCE_CAMERA);
- if (ret < 0) {
- printf("android_recorder_setVideoSource() failed\n");
- return;
- }
- //state initialized
- ret = android_recorder_setOutputFormat(mr, ANDROID_OUTPUT_FORMAT_MPEG_4);
- if (ret < 0) {
- printf("android_recorder_setOutputFormat() failed\n");
- return;
- }
- //state DataSourceConfigured
- ret = android_recorder_setAudioEncoder(mr, ANDROID_AUDIO_ENCODER_AAC);
- if (ret < 0) {
- printf("android_recorder_setAudioEncoder() failed\n");
- return;
- }
- ret = android_recorder_setVideoEncoder(mr, ANDROID_VIDEO_ENCODER_H264);
- if (ret < 0) {
- printf("android_recorder_setVideoEncoder() failed\n");
- return;
- }
-
- int fd;
- fd = open("/tmp/test_video_recorder.avi", O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
- if (fd < 0) {
- printf("Could not open file for video recording\n");
- printf("FD: %i\n", fd);
- return;
- }
- ret = android_recorder_setOutputFile(mr, fd);
- if (ret < 0) {
- printf("android_recorder_setOutputFile() failed\n");
- return;
- }
-
- ret = android_recorder_setVideoSize(mr, 1280, 720);
- if (ret < 0) {
- printf("android_recorder_setVideoSize() failed\n");
- return;
- }
- ret = android_recorder_setVideoFrameRate(mr, 30);
- if (ret < 0) {
- printf("android_recorder_setVideoFrameRate() failed\n");
- return;
- }
-
- ret = android_recorder_prepare(mr);
- if (ret < 0) {
- printf("android_recorder_prepare() failed\n");
- return;
- }
- //state prepared
- ret = android_recorder_start(mr);
- if (ret < 0) {
- printf("android_recorder_start() failed\n");
- return;
- }
- break;
- case ISCL_KEYCODE_VOLUME_DOWN:
- printf("Stoping video recording\n");
- ret = android_recorder_stop(mr);
-
- printf("Stoping video recording returned\n");
- if (ret < 0) {
- printf("android_recorder_stop() failed\n");
- return;
- }
- printf("Stopped video recording\n");
- ret = android_recorder_reset(mr);
- if (ret < 0) {
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309125345.8.gb6decfa.tar.bz2/libhybris/hybris/tests/test_sf.cpp
^
|
@@ -1,180 +0,0 @@
-/*
- * Copyright (C) 2013 Canonical 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.
- *
- * Authored by: Thomas Voss <thomas.voss@canonical.com>
- * Ricardo Salveti de Araujo <ricardo.salveti@canonical.com>
- */
-
-#include <android-config.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <limits.h>
-
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
-#include <hybris/surface_flinger/surface_flinger_compatibility_layer.h>
-#include "test_common.h"
-
-struct SfSurface* sf_surface_create(struct SfClient* client, SfSurfaceCreationParameters* params);
-EGLSurface sf_surface_get_egl_surface(struct SfSurface*);
-void sf_surface_make_current(struct SfSurface* surface);
-
-void sf_surface_move_to(struct SfSurface* surface, int x, int y);
-void sf_surface_set_layer(struct SfSurface* surface, int layer);
-void sf_surface_set_alpha(struct SfSurface* surface, float alpha);
-
-double rotation_increment = 0.01;
-
-/* animation state variables */
-GLfloat rotation_angle = 0.0f;
-
-static GLuint gProgram;
-static GLuint gvPositionHandle, gvColorHandle;
-static GLuint rotation_uniform;
-static GLint num_vertex = 3;
-static const GLfloat triangle[] = {
- -0.125f, -0.125f, 0.0f, 0.5f,
- 0.0f, 0.125f, 0.0f, 0.5f,
- 0.125f, -0.125f, 0.0f, 0.5f };
-static const GLfloat color_triangle[] = {
- 0.0f, 0.0f, 1.0f, 1.0f,
- 0.0f, 1.0f, 0.0f, 1.0f,
- 1.0f, 0.0f, 0.0f, 0.0f };
-const GLfloat * vertex_data;
-const GLfloat * color_data;
-static const char gVertexShader[] =
- "attribute vec4 vPosition;\n"
- "attribute vec4 vColor;\n"
- "uniform float angle;\n"
- "varying vec4 colorinfo;\n"
- "void main() {\n"
- " mat3 rot_z = mat3( vec3( cos(angle), sin(angle), 0.0),\n"
- " vec3(-sin(angle), cos(angle), 0.0),\n"
- " vec3( 0.0, 0.0, 1.0));\n"
- " gl_Position = vec4(rot_z * vPosition.xyz, 1.0);\n"
- " colorinfo = vColor;\n"
- "}\n";
-
-static const char gFragmentShader[] = "precision mediump float;\n"
- "varying vec4 colorinfo;\n"
- "void main() {\n"
- " gl_FragColor = colorinfo;\n"
- "}\n";
-
-/* util functions */
-int setupGraphics()
-{
- vertex_data = triangle;
- color_data = color_triangle;
-
- gProgram = create_program(gVertexShader, gFragmentShader);
- if (!gProgram) {
- printf("error making program\n");
- return 0;
- }
-
- gvPositionHandle = glGetAttribLocation(gProgram, "vPosition");
- gvColorHandle = glGetAttribLocation(gProgram, "vColor");
-
- rotation_uniform = glGetUniformLocation(gProgram, "angle");
-
- return 1;
-}
-
-void hw_render(EGLDisplay displ, EGLSurface surface)
-{
- glUseProgram(gProgram);
-
- glClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
-
- glUniform1fv(rotation_uniform,1, &rotation_angle);
-
- glVertexAttribPointer(gvColorHandle, num_vertex, GL_FLOAT, GL_FALSE, sizeof(GLfloat)*4, color_data);
- glVertexAttribPointer(gvPositionHandle, num_vertex, GL_FLOAT, GL_FALSE, 0, vertex_data);
- glEnableVertexAttribArray(gvPositionHandle);
- glEnableVertexAttribArray(gvColorHandle);
-
- glDrawArrays(GL_TRIANGLE_STRIP, 0, num_vertex);
- glDisableVertexAttribArray(gvPositionHandle);
- glDisableVertexAttribArray(gvColorHandle);
-
- eglSwapBuffers(displ, surface);
-}
-
-void hw_step()
-{
- rotation_angle += rotation_increment;
- return;
-}
-
-int main(int argc, char** argv)
-{
- struct SfClient* sf_client = sf_client_create();
-
- if (!sf_client) {
- printf("Problem creating client ... aborting now.");
- return 1;
- }
-
- int x = getenv("X") ? atoi(getenv("X")) : 200;
- int y = getenv("Y") ? atoi(getenv("Y")) : 200;
-
- int w = getenv("W") ? atoi(getenv("W")) : 500;
- int h = getenv("H") ? atoi(getenv("H")) : 500;
-
- float opacity = getenv("O") ? atof(getenv("O")) : 0.5;
- rotation_increment = getenv("RI") ? atof(getenv("RI")) : 0.01;
-
- SfSurfaceCreationParameters params = {
- x,
- y,
- w,
- h,
- -1, // PIXEL_FORMAT_RGBA_8888,
- INT_MAX,
- opacity,
- 1,
- "A test surface"
- };
-
- struct SfSurface* sf_surface = sf_surface_create(sf_client, ¶ms);
-
- if (!sf_surface) {
- printf("Problem creating surface ... aborting now.");
- return 1;
- }
-
- sf_surface_make_current(sf_surface);
-
- EGLDisplay disp = sf_client_get_egl_display(sf_client);
- EGLSurface surface = sf_surface_get_egl_surface(sf_surface);
-
- setupGraphics();
-
- printf("Turning off screen\n");
- sf_blank(0);
-
- sleep(1);
-
- printf("Turning on screen\n");
- sf_unblank(0);
-
- for (;;) {
- hw_render(disp, surface);
- hw_step();
- }
-}
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309132944.5.g9e81253.tar.bz2/libhybris/compat/hwc2/hwc2_compatibility_layer.cpp
^
|
@@ -214,11 +214,7 @@
android::sp<android::Fence> presentFence;
HWC2::Error error = display->self->present(&presentFence);
- if (presentFence != NULL) {
- *outPresentFence = presentFence->dup();
- } else {
- *outPresentFence = -1;
- }
+ *outPresentFence = presentFence->dup();
return static_cast<hwc2_error_t>(error);
}
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309132944.5.g9e81253.tar.bz2/libhybris/compat/hwc2/tests/direct_hwc2_test.cpp
^
|
@@ -240,6 +240,7 @@
EGLBoolean rv;
+ int err;
int composerSequenceId = 0;
hwcDevice = hwc2_compat_device_new(false);
@@ -289,7 +290,7 @@
assert(eglGetError() == EGL_SUCCESS);
assert(rv == EGL_TRUE);
- rv = eglChooseConfig((EGLDisplay) display, attr, &ecfg, 1, &num_config);
+ eglChooseConfig((EGLDisplay) display, attr, &ecfg, 1, &num_config);
assert(eglGetError() == EGL_SUCCESS);
assert(rv == EGL_TRUE);
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309132944.5.g9e81253.tar.bz2/libhybris/hybris/common/hooks.c
^
|
@@ -257,7 +257,6 @@
fret = syscall(SYS_futex , &cond->value,
pshared ? FUTEX_WAKE : FUTEX_WAKE_PRIVATE, counter,
NULL, NULL, NULL);
- (void)fret;
LOGD("futex based pthread_cond_*, value %d, counter %d, ret %d",
cond->value, counter, fret);
return 0;
@@ -1574,14 +1573,14 @@
static int _hybris_hook_fseek(FILE *fp, long offset, int whence)
{
- TRACE_HOOK("fp %p offset %ld whence %d", fp, offset, whence);
+ TRACE_HOOK("fp %p offset %jd whence %d", fp, offset, whence);
return fseek(_get_actual_fp(fp), offset, whence);
}
static int _hybris_hook_fseeko(FILE *fp, off_t offset, int whence)
{
- TRACE_HOOK("fp %p offset %ld whence %d", fp, offset, whence);
+ TRACE_HOOK("fp %p offset %jd whence %d", fp, offset, whence);
return fseeko(_get_actual_fp(fp), offset, whence);
}
@@ -1593,6 +1592,7 @@
fpos_t my_fpos;
my_fpos.__pos = *pos;
memset(&my_fpos.__state, 0, sizeof(mbstate_t));
+ mbsinit(&my_fpos.__state);
return fsetpos(_get_actual_fp(fp), &my_fpos);
}
@@ -2363,7 +2363,7 @@
static void* _hybris_hook_mmap(void *addr, size_t len, int prot,
int flags, int fd, off_t offset)
{
- TRACE_HOOK("addr %p len %zu prot %i flags %i fd %i offset %ld",
+ TRACE_HOOK("addr %p len %zu prot %i flags %i fd %i offset %jd",
addr, len, prot, flags, fd, offset);
return mmap(addr, len, prot, flags, fd, offset);
@@ -2553,7 +2553,7 @@
{
TRACE("addr %p info %p", addr, info);
- return (void *)_android_dladdr(addr, info);
+ return _android_dladdr(addr, info);
}
static int _hybris_hook_dlclose(void *handle)
@@ -2586,7 +2586,7 @@
void _hybris_hook_android_get_LD_LIBRARY_PATH(char* buffer, size_t buffer_size)
{
- TRACE("buffer %p, buffer_size %zu\n", buffer, buffer_size);
+ TRACE("buffer %p, buffer_size %zu\n", buffer_size);
_android_get_LD_LIBRARY_PATH(buffer, buffer_size);
}
@@ -2600,7 +2600,7 @@
void* _hybris_hook_android_dlopen_ext(const char* filename, int flag, const void* extinfo)
{
- TRACE("filename %s, flag %d, extinfo %p", filename, flag, extinfo);
+ TRACE("filename %s, flag %d, extinfo %s", filename, flag, extinfo);
return _android_dlopen_ext(filename, flag, extinfo);
}
@@ -2609,7 +2609,7 @@
{
TRACE("target %d", target);
- _android_set_application_target_sdk_version(target);
+ android_set_application_target_sdk_version(target);
}
uint32_t _hybris_hook_android_get_application_target_sdk_version()
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309132944.5.g9e81253.tar.bz2/libhybris/hybris/common/jb/linker.c
^
|
@@ -1373,14 +1373,14 @@
if(sym != 0) {
sym_name = (char *)(strtab + symtab[sym].st_name);
INFO("HYBRIS: '%s' checking hooks for sym '%s'\n", si->name, sym_name);
- sym_addr = (unsigned)_get_hooked_symbol(sym_name, si->name);
- if (sym_addr != 0) {
+ sym_addr = _get_hooked_symbol(sym_name, si->name);
+ if (sym_addr != NULL) {
INFO("HYBRIS: '%s' hooked symbol %s to %x\n", si->name,
sym_name, sym_addr);
} else {
s = _do_lookup(si, sym_name, &base);
}
- if(sym_addr == 0) {
+ if(sym_addr == NULL)
if(s == NULL) {
/* We only allow an undefined symbol if this is a weak
reference.. */
@@ -1448,8 +1448,7 @@
}
#endif
sym_addr = (unsigned)(s->st_value + base);
- }
- }
+ }
COUNT_RELOC(RELOC_SYMBOL);
} else {
s = NULL;
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309132944.5.g9e81253.tar.bz2/libhybris/hybris/common/jb/linker_debug.h
^
|
@@ -67,12 +67,11 @@
extern int format_fd(int, const char *, ...);
#define _PRINTVF(v,f,x...) \
do { \
- if (debug_verbosity > (v)) { \
+ if (debug_verbosity > (v)) \
if (debug_stdout) \
format_fd(1, x); \
else \
format_log(5-(v),"linker",x); \
- } \
} while (0)
#else /* !LINKER_DEBUG */
#define _PRINTVF(v,f,x...) do {} while(0)
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309132944.5.g9e81253.tar.bz2/libhybris/hybris/configure.ac
^
|
@@ -74,19 +74,15 @@
AC_ARG_ENABLE(ubuntu-camera-headers,
[ --enable-ubuntu-camera-headers Enable Ubuntu camera headers (default=disabled)],
- [ubuntu_camera_headers=$enableval],
- [ubuntu_camera_headers="no"])
-AM_CONDITIONAL( [WANT_UBUNTU_CAMERA_HEADERS], [test x"$ubuntu_camera_headers" = x"yes"])
-
-WANT_WAYLAND_EGL="no"
+ [ubuntu-camera-headers=$enableval],
+ [ubuntu-camera-headers="no"])
+AM_CONDITIONAL( [WANT_UBUNTU_CAMERA_HEADERS], [test x"$ubuntu-camera-headers" = x"yes"])
AC_ARG_ENABLE(wayland,
[ --enable-wayland Enable wayland support (default=disabled)],
[wayland=$enableval
PKG_CHECK_MODULES(WAYLAND_CLIENT, wayland-client,, exit)
PKG_CHECK_MODULES(WAYLAND_SERVER, wayland-server,, exit)
- PKG_CHECK_MODULES(WAYLAND_EGL, [wayland-egl >= 1.15], , [WANT_WAYLAND_EGL="yes"])
- AC_DEFINE(WANT_WAYLAND_EGL, [], [We use internal Wayland EGL support])
WAYLAND_PREFIX=`$PKG_CONFIG --variable=prefix wayland-client`
AC_PATH_PROG([WAYLAND_SCANNER], [wayland-scanner],, [${WAYLAND_PREFIX}/bin$PATH_SEPARATOR$PATH])
@@ -94,7 +90,6 @@
],
[wayland="no"])
AM_CONDITIONAL( [WANT_WAYLAND], [test x"$wayland" = x"yes"])
-AM_CONDITIONAL( [WANT_WAYLAND_EGL], [test x"$WANT_WAYLAND_EGL" = x"yes"])
AC_ARG_ENABLE(wayland_serverside_buffers,
[ --enable-wayland_serverside_buffers Enable serverside buffer allocation for wayland (default=enabled)],
@@ -312,7 +307,7 @@
tests/Makefile
])
-AM_COND_IF([WANT_WAYLAND_EGL], [AC_CONFIG_FILES([egl/platforms/common/wayland-egl.pc])])
+AM_COND_IF([WANT_WAYLAND], [AC_CONFIG_FILES([egl/platforms/common/wayland-egl.pc])])
AC_OUTPUT
echo
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309132944.5.g9e81253.tar.bz2/libhybris/hybris/egl/egl.c
^
|
@@ -44,15 +44,50 @@
static void *_hybris_libgles2 = NULL;
static int _egl_context_client_version = 1;
+static EGLint (*_eglGetError)(void) = NULL;
+
static EGLDisplay (*_eglGetDisplay)(EGLNativeDisplayType display_id) = NULL;
+static EGLBoolean (*_eglInitialize)(EGLDisplay dpy, EGLint *major, EGLint *minor) = NULL;
static EGLBoolean (*_eglTerminate)(EGLDisplay dpy) = NULL;
static const char * (*_eglQueryString)(EGLDisplay dpy, EGLint name) = NULL;
+static EGLBoolean (*_eglGetConfigs)(EGLDisplay dpy, EGLConfig *configs,
+ EGLint config_size, EGLint *num_config) = NULL;
+static EGLBoolean (*_eglChooseConfig)(EGLDisplay dpy, const EGLint *attrib_list,
+ EGLConfig *configs, EGLint config_size,
+ EGLint *num_config) = NULL;
+static EGLBoolean (*_eglGetConfigAttrib)(EGLDisplay dpy, EGLConfig config,
+ EGLint attribute, EGLint *value) = NULL;
+
static EGLSurface (*_eglCreateWindowSurface)(EGLDisplay dpy, EGLConfig config,
EGLNativeWindowType win,
const EGLint *attrib_list) = NULL;
+static EGLSurface (*_eglCreatePbufferSurface)(EGLDisplay dpy, EGLConfig config,
+ const EGLint *attrib_list) = NULL;
+static EGLSurface (*_eglCreatePixmapSurface)(EGLDisplay dpy, EGLConfig config,
+ EGLNativePixmapType pixmap,
+ const EGLint *attrib_list) = NULL;
static EGLBoolean (*_eglDestroySurface)(EGLDisplay dpy, EGLSurface surface) = NULL;
+static EGLBoolean (*_eglQuerySurface)(EGLDisplay dpy, EGLSurface surface,
+ EGLint attribute, EGLint *value) = NULL;
+
+static EGLBoolean (*_eglBindAPI)(EGLenum api) = NULL;
+static EGLenum (*_eglQueryAPI)(void) = NULL;
+
+static EGLBoolean (*_eglWaitClient)(void) = NULL;
+
+static EGLBoolean (*_eglReleaseThread)(void) = NULL;
+
+static EGLSurface (*_eglCreatePbufferFromClientBuffer)(
+ EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer,
+ EGLConfig config, const EGLint *attrib_list) = NULL;
+
+static EGLBoolean (*_eglSurfaceAttrib)(EGLDisplay dpy, EGLSurface surface,
+ EGLint attribute, EGLint value) = NULL;
+static EGLBoolean (*_eglBindTexImage)(EGLDisplay dpy, EGLSurface surface, EGLint buffer) = NULL;
+static EGLBoolean (*_eglReleaseTexImage)(EGLDisplay dpy, EGLSurface surface, EGLint buffer) = NULL;
+
static EGLBoolean (*_eglSwapInterval)(EGLDisplay dpy, EGLint interval) = NULL;
@@ -60,10 +95,21 @@
static EGLContext (*_eglCreateContext)(EGLDisplay dpy, EGLConfig config,
EGLContext share_context,
const EGLint *attrib_list) = NULL;
+static EGLBoolean (*_eglDestroyContext)(EGLDisplay dpy, EGLContext ctx) = NULL;
+static EGLBoolean (*_eglMakeCurrent)(EGLDisplay dpy, EGLSurface draw,
+ EGLSurface read, EGLContext ctx) = NULL;
+static EGLContext (*_eglGetCurrentContext)(void) = NULL;
static EGLSurface (*_eglGetCurrentSurface)(EGLint readdraw) = NULL;
+static EGLDisplay (*_eglGetCurrentDisplay)(void) = NULL;
+static EGLBoolean (*_eglQueryContext)(EGLDisplay dpy, EGLContext ctx,
+ EGLint attribute, EGLint *value) = NULL;
+static EGLBoolean (*_eglWaitGL)(void) = NULL;
+static EGLBoolean (*_eglWaitNative)(EGLint engine) = NULL;
static EGLBoolean (*_eglSwapBuffers)(EGLDisplay dpy, EGLSurface surface) = NULL;
+static EGLBoolean (*_eglCopyBuffers)(EGLDisplay dpy, EGLSurface surface,
+ EGLNativePixmapType target) = NULL;
static EGLImageKHR (*_eglCreateImageKHR)(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list) = NULL;
@@ -379,12 +425,14 @@
ret = _hybris_libgles1 ? dlsym(_hybris_libgles1, procname) : NULL;
break;
case 2: // OpenGL ES 2.0 API
- case 3: // OpenGL ES 3.x API, backwards compatible with OpenGL ES 2.0 so we implement in same library
if (_hybris_libgles2 == NULL) {
_hybris_libgles2 = (void *) dlopen(getenv("HYBRIS_LIBGLESV2") ?: "libGLESv2.so.2", RTLD_LAZY);
}
ret = _hybris_libgles2 ? dlsym(_hybris_libgles2, procname) : NULL;
break;
+ case 3: // OpenGL ES 3.x API
+ // TODO: Load from libGLESv3.so once we have OpenGL ES 3.0/3.1 support
+ break;
default:
HYBRIS_WARN("Unknown EGL context client version: %d", _egl_context_client_version);
break;
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309132944.5.g9e81253.tar.bz2/libhybris/hybris/egl/platforms/common/Makefile.am
^
|
@@ -11,11 +11,10 @@
pkgconfig_DATA = hybris-egl-platform.pc
if WANT_WAYLAND
-if WANT_WAYLAND_EGL
lib_LTLIBRARIES += libwayland-egl.la
pkgconfig_DATA += wayland-egl.pc
-endif
+
libhybris_eglplatformcommon_la_SOURCES += \
server_wlegl.cpp \
@@ -36,7 +35,6 @@
%-client-protocol.h : %.xml
$(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@
-if WANT_WAYLAND_EGL
libwayland_egl_la_SOURCES = wayland-egl.c
libwayland_egl_la_CFLAGS = -I. -I$(top_srcdir)/include $(ANDROID_HEADERS_CFLAGS) $(WAYLAND_CLIENT_CFLAGS) $(WAYLAND_SERVER_CFLAGS)
@@ -58,7 +56,6 @@
-version-info "1":"0"
endif
-endif
libhybris_eglplatformcommon_la_CFLAGS = -I$(top_srcdir)/include $(ANDROID_HEADERS_CFLAGS) -I$(top_srcdir)/egl -I$(top_srcdir)/common/
if WANT_WAYLAND
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309132944.5.g9e81253.tar.bz2/libhybris/hybris/egl/platforms/common/eglplatformcommon.cpp
^
|
@@ -50,7 +50,6 @@
static int cnt = 0;
void *vaddr;
int ret = hybris_gralloc_lock(buf->handle, buf->usage, 0, 0, buf->width, buf->height, &vaddr);
- (void)ret;
TRACE("buf:%p gralloc lock returns %i", buf, ret);
TRACE("buf:%p lock to vaddr %p", buf, vaddr);
char b[1024];
@@ -66,8 +65,8 @@
int fd = ::open(b, O_WRONLY|O_CREAT, S_IRWXU);
if(fd < 0)
return;
- if (::write(fd, vaddr, buf->stride * buf->height * bytes_pp) < 0)
- TRACE("dump buffer to file failed with error %i", errno);
+
+ ::write(fd, vaddr, buf->stride * buf->height * bytes_pp);
::close(fd);
hybris_gralloc_unlock(buf->handle);
}
@@ -187,7 +186,7 @@
buffer_handle_t _handle;
int _stride;
- ret = hybris_gralloc_allocate(width, height, format, usage, &_handle, (uint32_t*)&_stride);
+ hybris_gralloc_allocate(width, height, format, usage, &_handle, (uint32_t*)&_stride);
if (ret == 0)
{
@@ -282,11 +281,11 @@
return (__eglMustCastToProperFunctionPointerType)eglplatformcommon_eglQueryWaylandBufferWL;
}
else
- if (strcmp(procname, "eglHybrisAcquireNativeBufferWL") == 0)
- {
- return (__eglMustCastToProperFunctionPointerType) eglplatformcommon_eglHybrisAcquireNativeBufferWL;
- }
- else
+ if (strcmp(procname, "eglHybrisAcquireNativeBufferWL") == 0)
+ {
+ return (__eglMustCastToProperFunctionPointerType) eglplatformcommon_eglHybrisAcquireNativeBufferWL;
+ }
+ else
#endif
if (strcmp(procname, "eglHybrisCreateNativeBuffer") == 0)
{
@@ -337,7 +336,13 @@
{
const char *ret = (*real_eglQueryString)(dpy, name);
static char eglextensionsbuf[2048];
- snprintf(eglextensionsbuf, 2046, "%sEGL_HYBRIS_native_buffer2 EGL_HYBRIS_WL_acquire_native_buffer EGL_WL_bind_wayland_display", ret ? ret : "");
+ snprintf(eglextensionsbuf, 2046, "%sEGL_HYBRIS_native_buffer2 EGL_HYBRIS_WL_acquire_native_buffer %s", ret ? ret : "",
+#ifdef WANT_WAYLAND
+ "EGL_WL_bind_wayland_display "
+#else
+ ""
+#endif
+ );
ret = eglextensionsbuf;
return ret;
}
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309132944.5.g9e81253.tar.bz2/libhybris/hybris/egl/platforms/common/server_wlegl.cpp
^
|
@@ -53,6 +53,7 @@
int32_t num_fds,
struct wl_array *ints)
{
+ server_wlegl *wlegl = server_wlegl_from(resource);
server_wlegl_handle *handle;
if (num_fds < 0) {
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309132944.5.g9e81253.tar.bz2/libhybris/hybris/egl/platforms/common/wayland-egl-priv.h
^
|
@@ -14,10 +14,8 @@
#include <wayland-client.h>
-#define WL_EGL_WINDOW_VERSION 3
-
struct wl_egl_window {
- const intptr_t version;
+ struct wl_surface *surface;
int width;
int height;
@@ -27,11 +25,9 @@
int attached_width;
int attached_height;
- void *driver_private;
+ void *nativewindow;
void (*resize_callback)(struct wl_egl_window *, void *);
- void (*destroy_window_callback)(void *);
-
- struct wl_surface *surface;
+ void (*free_callback)(struct wl_egl_window *, void *);
};
#ifdef __cplusplus
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309132944.5.g9e81253.tar.bz2/libhybris/hybris/egl/platforms/common/wayland-egl.c
^
|
@@ -29,15 +29,13 @@
if (!egl_window)
return NULL;
- intptr_t *version = (intptr_t *)&egl_window->version;
- *version = WL_EGL_WINDOW_VERSION;
egl_window->surface = surface;
egl_window->resize_callback = NULL;
- egl_window->destroy_window_callback = NULL;
+ egl_window->free_callback = NULL;
wl_egl_window_resize(egl_window, width, height, 0, 0);
egl_window->attached_width = 0;
egl_window->attached_height = 0;
- egl_window->driver_private = 0;
+ egl_window->nativewindow = 0;
return egl_window;
@@ -46,8 +44,8 @@
WL_EGL_EXPORT void
wl_egl_window_destroy(struct wl_egl_window *egl_window)
{
- if (egl_window->destroy_window_callback)
- egl_window->destroy_window_callback(egl_window->driver_private);
+ if (egl_window->free_callback)
+ egl_window->free_callback(egl_window, NULL);
free(egl_window);
}
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309132944.5.g9e81253.tar.bz2/libhybris/hybris/egl/platforms/fbdev/fbdev_window.cpp
^
|
@@ -510,7 +510,7 @@
{
destroyBuffers();
- for(int i = 0; i < m_bufferCount; i++)
+ for(unsigned int i = 0; i < m_bufferCount; i++)
{
FbDevNativeWindowBuffer *fbnb = new FbDevNativeWindowBuffer(hybris_gralloc_fbdev_width(),
hybris_gralloc_fbdev_height(), hybris_gralloc_fbdev_format(), m_usage|GRALLOC_USAGE_HW_FB);
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309132944.5.g9e81253.tar.bz2/libhybris/hybris/egl/platforms/fbdev/fbdev_window.h
^
|
@@ -74,9 +74,9 @@
void reallocateBuffers();
private:
- int m_usage;
- int m_bufFormat;
- int m_bufferCount;
+ unsigned int m_usage;
+ unsigned int m_bufFormat;
+ unsigned int m_bufferCount;
int m_freeBufs;
bool m_allocateBuffers;
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309132944.5.g9e81253.tar.bz2/libhybris/hybris/egl/platforms/hwcomposer/hwcomposer_window.cpp
^
|
@@ -91,6 +91,9 @@
static_cast<_BufferFenceAccessor *>(buf)->set(fd);
}
+static pthread_cond_t _cond = PTHREAD_COND_INITIALIZER;
+static pthread_mutex_t _mutex = PTHREAD_MUTEX_INITIALIZER;
+
HWComposerNativeWindowBuffer::HWComposerNativeWindowBuffer(unsigned int width,
unsigned int height,
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309132944.5.g9e81253.tar.bz2/libhybris/hybris/egl/platforms/wayland/eglplatform_wayland.cpp
^
|
@@ -207,7 +207,7 @@
{
struct wl_egl_window *eglwin = (struct wl_egl_window *) win;
- return ((WaylandNativeWindow *) eglwin->driver_private)->postBuffer((ANativeWindowBuffer *) buffer);
+ return ((WaylandNativeWindow *) eglwin->nativewindow)->postBuffer((ANativeWindowBuffer *) buffer);
}
/**
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309132944.5.g9e81253.tar.bz2/libhybris/hybris/egl/platforms/wayland/wayland_window.cpp
^
|
@@ -98,12 +98,12 @@
void WaylandNativeWindow::resize_callback(struct wl_egl_window *egl_window, void *)
{
TRACE("%dx%d",egl_window->width,egl_window->height);
- ((WaylandNativeWindow *) egl_window->driver_private)->resize(egl_window->width, egl_window->height);
+ ((WaylandNativeWindow *) egl_window->nativewindow)->resize(egl_window->width, egl_window->height);
}
-void WaylandNativeWindow::destroy_window_callback(void *data)
+void WaylandNativeWindow::free_callback(struct wl_egl_window *egl_window, void *)
{
- WaylandNativeWindow *native = (WaylandNativeWindow*)data;
+ WaylandNativeWindow *native = (WaylandNativeWindow*)egl_window->nativewindow;
native->lock();
native->m_window = 0;
@@ -133,25 +133,21 @@
WaylandNativeWindow::sync_callback
};
-
-#if WAYLAND_VERSION_MAJOR == 0 || (WAYLAND_VERSION_MAJOR == 1 && WAYLAND_VERSION_MINOR < 6)
int
-WaylandNativeWindow::wl_display_roundtrip_queue(struct wl_display *display,
- struct wl_event_queue *queue)
+WaylandNativeWindow::wayland_roundtrip(WaylandNativeWindow *display)
{
struct wl_callback *callback;
int done = 0, ret = 0;
- wl_display_dispatch_queue_pending(display, queue);
+ wl_display_dispatch_queue_pending(display->m_display, display->wl_queue);
- callback = wl_display_sync(display);
+ callback = wl_display_sync(display->m_display);
wl_callback_add_listener(callback, &sync_listener, &done);
- wl_proxy_set_queue((struct wl_proxy *) callback, queue);
+ wl_proxy_set_queue((struct wl_proxy *) callback, display->wl_queue);
while (ret >= 0 && !done)
- ret = wl_display_dispatch_queue(display, queue);
+ ret = wl_display_dispatch_queue(display->m_display, display->wl_queue);
return ret;
}
-#endif
static void check_fatal_error(struct wl_display *display)
{
@@ -184,16 +180,18 @@
WaylandNativeWindow::WaylandNativeWindow(struct wl_egl_window *window, struct wl_display *display, android_wlegl *wlegl)
: m_android_wlegl(wlegl)
{
+ int wayland_ok;
+
HYBRIS_TRACE_BEGIN("wayland-platform", "create_window", "");
this->m_window = window;
- this->m_window->driver_private = (void *) this;
+ this->m_window->nativewindow = (void *) this;
this->m_display = display;
this->m_width = window->width;
this->m_height = window->height;
this->m_defaultWidth = window->width;
this->m_defaultHeight = window->height;
this->m_window->resize_callback = resize_callback;
- this->m_window->destroy_window_callback = destroy_window_callback;
+ this->m_window->free_callback = free_callback;
this->frame_callback = NULL;
this->wl_queue = wl_display_create_queue(display);
this->m_format = 1;
@@ -217,14 +215,15 @@
WaylandNativeWindow::~WaylandNativeWindow()
{
+ std::list<WaylandNativeWindowBuffer *>::iterator it = m_bufList.begin();
destroyBuffers();
if (frame_callback)
wl_callback_destroy(frame_callback);
wl_event_queue_destroy(wl_queue);
if (m_window) {
- m_window->driver_private = NULL;
+ m_window->nativewindow = NULL;
m_window->resize_callback = NULL;
- m_window->destroy_window_callback = NULL;
+ m_window->free_callback = NULL;
}
}
@@ -402,7 +401,6 @@
int WaylandNativeWindow::lockBuffer(BaseNativeWindowBuffer* buffer){
WaylandNativeWindowBuffer *wnb = (WaylandNativeWindowBuffer*) buffer;
- (void)wnb;
HYBRIS_TRACE_BEGIN("wayland-platform", "lockBuffer", "-%p", wnb);
HYBRIS_TRACE_END("wayland-platform", "lockBuffer", "-%p", wnb);
return NO_ERROR;
@@ -576,6 +574,7 @@
int WaylandNativeWindow::queueBuffer(BaseNativeWindowBuffer* buffer, int fenceFd)
{
WaylandNativeWindowBuffer *wnb = (WaylandNativeWindowBuffer*) buffer;
+ int ret = 0;
HYBRIS_TRACE_BEGIN("wayland-platform", "queueBuffer", "-%p", wnb);
lock();
@@ -757,7 +756,7 @@
#ifndef HYBRIS_NO_SERVER_SIDE_BUFFERS
wnb = new ServerWaylandBuffer(m_width, m_height, m_format, m_usage, m_android_wlegl, wl_queue);
- wl_display_roundtrip_queue(m_display, wl_queue);
+ wayland_roundtrip(this);
#else
wnb = new ClientWaylandBuffer(m_width, m_height, m_format, m_usage);
#endif
@@ -772,17 +771,19 @@
int WaylandNativeWindow::setBufferCount(int cnt) {
+ int start = 0;
+
TRACE("cnt:%d", cnt);
- if ((int)m_bufList.size() == cnt)
+ if (m_bufList.size() == cnt)
return NO_ERROR;
lock();
- if ((int)m_bufList.size() > cnt) {
+ if (m_bufList.size() > cnt) {
/* Decreasing buffer count, remove from beginning */
std::list<WaylandNativeWindowBuffer*>::iterator it = m_bufList.begin();
- for (int i = 0; i <= (int)m_bufList.size() - cnt; i++ )
+ for (int i = 0; i <= m_bufList.size() - cnt; i++ )
{
destroyBuffer(*it);
++it;
@@ -791,8 +792,8 @@
} else {
/* Increasing buffer count, start from current size */
- for (int i = (int)m_bufList.size(); i < cnt; i++)
- (void)addBuffer();
+ for (int i = m_bufList.size(); i < cnt; i++)
+ WaylandNativeWindowBuffer *unused = addBuffer();
}
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309132944.5.g9e81253.tar.bz2/libhybris/hybris/egl/platforms/wayland/wayland_window.h
^
|
@@ -161,7 +161,7 @@
static void registry_handle_global(void *data, struct wl_registry *registry, uint32_t name,
const char *interface, uint32_t version);
static void resize_callback(struct wl_egl_window *egl_window, void *);
- static void destroy_window_callback(void *data);
+ static void free_callback(struct wl_egl_window *egl_window, void *);
struct wl_event_queue *wl_queue;
protected:
@@ -199,9 +199,9 @@
struct wl_egl_window *m_window;
struct wl_display *m_display;
WaylandNativeWindowBuffer *m_lastBuffer;
- int m_width;
- int m_height;
- int m_format;
+ unsigned int m_width;
+ unsigned int m_height;
+ unsigned int m_format;
unsigned int m_defaultWidth;
unsigned int m_defaultHeight;
unsigned int m_usage;
@@ -213,10 +213,7 @@
EGLint *m_damage_rects, m_damage_n_rects;
struct wl_callback *frame_callback;
int m_swap_interval;
-#if WAYLAND_VERSION_MAJOR == 0 || (WAYLAND_VERSION_MAJOR == 1 && WAYLAND_VERSION_MINOR < 6)
- static int wl_roundtrip_queue(struct wl_display *display,
- struct wl_event_queue *queue);
-#endif
+ static int wayland_roundtrip(WaylandNativeWindow *display);
};
#endif
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309132944.5.g9e81253.tar.bz2/libhybris/hybris/egl/ws.c
^
|
@@ -21,10 +21,6 @@
#include <assert.h>
#include <stdio.h>
#include <sys/auxv.h>
-#include <pthread.h>
-#include <string.h>
-
-pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
static struct ws_module *ws = NULL;
@@ -32,12 +28,6 @@
{
if (ws == NULL)
{
- pthread_mutex_lock(&mutex);
- if (ws != NULL) {
- pthread_mutex_unlock(&mutex);
- return;
- }
-
char ws_name[2048];
char *egl_platform;
@@ -51,10 +41,6 @@
if (egl_platform == NULL)
egl_platform = DEFAULT_EGL_PLATFORM;
- // The env variables may be defined yet empty
- if (!strcmp(egl_platform, ""))
- egl_platform = DEFAULT_EGL_PLATFORM;
-
const char *eglplatform_dir = PKGLIBDIR;
const char *user_eglplatform_dir = getauxval(AT_SECURE)
? NULL
@@ -73,8 +59,6 @@
ws = dlsym(wsmod, "ws_module_info");
assert(ws != NULL);
ws->init_module(&hybris_egl_interface);
-
- pthread_mutex_unlock(&mutex);
}
}
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309132944.5.g9e81253.tar.bz2/libhybris/hybris/glesv2/glesv2.c
^
|
@@ -1,7 +1,5 @@
/*
* Copyright (c) 2012 Carsten Munk <carsten.munk@gmail.com>
- * Copyright (C) 2017 Bhushan Shah <bshah@kde.org>
- * Copyright (C) 2020 Matti Lehtimäki <matti.lehtimaki@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,392 +16,1038 @@
*/
#define GL_GLEXT_PROTOTYPES
-#include <GLES3/gl32.h>
-#include <GLES3/gl3ext.h>
-
+#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
-
#include <dlfcn.h>
#include <stddef.h>
#include <stdlib.h>
+#include <stdio.h>
#include <hybris/common/binding.h>
#include "../egl/ws.h"
-// Android always uses libGLESv2.so for both OpenGL ES 2.0 and OpenGL ES 3.x
-HYBRIS_LIBRARY_INITIALIZE(glesv2, getenv("LIBGLESV2") ? getenv("LIBGLESV2") : "libGLESv2.so");
-
-HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv2, glActiveTexture, GLenum);
-HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv2, glAttachShader, GLuint, GLuint);
-HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv2, glBindAttribLocation, GLuint, GLuint, const GLchar *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv2, glBindBuffer, GLenum, GLuint);
-HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv2, glBindFramebuffer, GLenum, GLuint);
-HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv2, glBindRenderbuffer, GLenum, GLuint);
-HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv2, glBindTexture, GLenum, GLuint);
-HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv2, glBlendColor, GLfloat, GLfloat, GLfloat, GLfloat);
-HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv2, glBlendEquation, GLenum);
-HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv2, glBlendEquationSeparate, GLenum, GLenum);
-HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv2, glBlendFunc, GLenum, GLenum);
-HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv2, glBlendFuncSeparate, GLenum, GLenum, GLenum, GLenum);
-HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv2, glBufferData, GLenum, GLsizeiptr, const void *, GLenum);
-HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv2, glBufferSubData, GLenum, GLintptr, GLsizeiptr, const void *);
-HYBRIS_IMPLEMENT_FUNCTION1(glesv2, GLenum, glCheckFramebufferStatus, GLenum);
-HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv2, glClear, GLbitfield);
-HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv2, glClearColor, GLfloat, GLfloat, GLfloat, GLfloat);
-HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv2, glClearDepthf, GLfloat);
-HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv2, glClearStencil, GLint);
-HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv2, glColorMask, GLboolean, GLboolean, GLboolean, GLboolean);
-HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv2, glCompileShader, GLuint);
-HYBRIS_IMPLEMENT_VOID_FUNCTION8(glesv2, glCompressedTexImage2D, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const void *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION9(glesv2, glCompressedTexSubImage2D, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const void *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION8(glesv2, glCopyTexImage2D, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint);
-HYBRIS_IMPLEMENT_VOID_FUNCTION8(glesv2, glCopyTexSubImage2D, GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
-HYBRIS_IMPLEMENT_FUNCTION0(glesv2, GLuint, glCreateProgram);
-HYBRIS_IMPLEMENT_FUNCTION1(glesv2, GLuint, glCreateShader, GLenum);
-HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv2, glCullFace, GLenum);
-HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv2, glDeleteBuffers, GLsizei, const GLuint *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv2, glDeleteFramebuffers, GLsizei, const GLuint *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv2, glDeleteProgram, GLuint);
-HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv2, glDeleteRenderbuffers, GLsizei, const GLuint *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv2, glDeleteShader, GLuint);
-HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv2, glDeleteTextures, GLsizei, const GLuint *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv2, glDepthFunc, GLenum);
-HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv2, glDepthMask, GLboolean);
-HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv2, glDepthRangef, GLfloat, GLfloat);
-HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv2, glDetachShader, GLuint, GLuint);
-HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv2, glDisable, GLenum);
-HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv2, glDisableVertexAttribArray, GLuint);
-HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv2, glDrawArrays, GLenum, GLint, GLsizei);
-HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv2, glDrawElements, GLenum, GLsizei, GLenum, const void *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv2, glEnable, GLenum);
-HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv2, glEnableVertexAttribArray, GLuint);
-HYBRIS_IMPLEMENT_VOID_FUNCTION0(glesv2, glFinish);
-HYBRIS_IMPLEMENT_VOID_FUNCTION0(glesv2, glFlush);
-HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv2, glFramebufferRenderbuffer, GLenum, GLenum, GLenum, GLuint);
-HYBRIS_IMPLEMENT_VOID_FUNCTION5(glesv2, glFramebufferTexture2D, GLenum, GLenum, GLenum, GLuint, GLint);
-HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv2, glFrontFace, GLenum);
-HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv2, glGenBuffers, GLsizei, GLuint *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv2, glGenerateMipmap, GLenum);
-HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv2, glGenFramebuffers, GLsizei, GLuint *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv2, glGenRenderbuffers, GLsizei, GLuint *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv2, glGenTextures, GLsizei, GLuint *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION7(glesv2, glGetActiveAttrib, GLuint, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLchar *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION7(glesv2, glGetActiveUniform, GLuint, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLchar *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv2, glGetAttachedShaders, GLuint, GLsizei, GLsizei *, GLuint *);
-HYBRIS_IMPLEMENT_FUNCTION2(glesv2, GLint, glGetAttribLocation, GLuint, const GLchar *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv2, glGetBooleanv, GLenum, GLboolean *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv2, glGetBufferParameteriv, GLenum, GLenum, GLint *);
-HYBRIS_IMPLEMENT_FUNCTION0(glesv2, GLenum, glGetError);
-HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv2, glGetFloatv, GLenum, GLfloat *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv2, glGetFramebufferAttachmentParameteriv, GLenum, GLenum, GLenum, GLint *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv2, glGetIntegerv, GLenum, GLint *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv2, glGetProgramiv, GLuint, GLenum, GLint *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv2, glGetProgramInfoLog, GLuint, GLsizei, GLsizei *, GLchar *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv2, glGetRenderbufferParameteriv, GLenum, GLenum, GLint *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv2, glGetShaderiv, GLuint, GLenum, GLint *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv2, glGetShaderInfoLog, GLuint, GLsizei, GLsizei *, GLchar *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv2, glGetShaderPrecisionFormat, GLenum, GLenum, GLint *, GLint *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv2, glGetShaderSource, GLuint, GLsizei, GLsizei *, GLchar *);
-HYBRIS_IMPLEMENT_FUNCTION1(glesv2, const GLubyte *, glGetString, GLenum);
-HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv2, glGetTexParameterfv, GLenum, GLenum, GLfloat *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv2, glGetTexParameteriv, GLenum, GLenum, GLint *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv2, glGetUniformfv, GLuint, GLint, GLfloat *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv2, glGetUniformiv, GLuint, GLint, GLint *);
-HYBRIS_IMPLEMENT_FUNCTION2(glesv2, GLint, glGetUniformLocation, GLuint, const GLchar *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv2, glGetVertexAttribfv, GLuint, GLenum, GLfloat *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv2, glGetVertexAttribiv, GLuint, GLenum, GLint *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv2, glGetVertexAttribPointerv, GLuint, GLenum, void **);
-HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv2, glHint, GLenum, GLenum);
-HYBRIS_IMPLEMENT_FUNCTION1(glesv2, GLboolean, glIsBuffer, GLuint);
-HYBRIS_IMPLEMENT_FUNCTION1(glesv2, GLboolean, glIsEnabled, GLenum);
-HYBRIS_IMPLEMENT_FUNCTION1(glesv2, GLboolean, glIsFramebuffer, GLuint);
-HYBRIS_IMPLEMENT_FUNCTION1(glesv2, GLboolean, glIsProgram, GLuint);
-HYBRIS_IMPLEMENT_FUNCTION1(glesv2, GLboolean, glIsRenderbuffer, GLuint);
-HYBRIS_IMPLEMENT_FUNCTION1(glesv2, GLboolean, glIsShader, GLuint);
-HYBRIS_IMPLEMENT_FUNCTION1(glesv2, GLboolean, glIsTexture, GLuint);
-HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv2, glLineWidth, GLfloat);
-HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv2, glLinkProgram, GLuint);
-HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv2, glPixelStorei, GLenum, GLint);
-HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv2, glPolygonOffset, GLfloat, GLfloat);
-HYBRIS_IMPLEMENT_VOID_FUNCTION7(glesv2, glReadPixels, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, void *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION0(glesv2, glReleaseShaderCompiler);
-HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv2, glRenderbufferStorage, GLenum, GLenum, GLsizei, GLsizei);
-HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv2, glSampleCoverage, GLfloat, GLboolean);
-HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv2, glScissor, GLint, GLint, GLsizei, GLsizei);
-HYBRIS_IMPLEMENT_VOID_FUNCTION5(glesv2, glShaderBinary, GLsizei, const GLuint *, GLenum, const void *, GLsizei);
-HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv2, glShaderSource, GLuint, GLsizei, const GLchar *const *, const GLint *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv2, glStencilFunc, GLenum, GLint, GLuint);
-HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv2, glStencilFuncSeparate, GLenum, GLenum, GLint, GLuint);
-HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv2, glStencilMask, GLuint);
-HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv2, glStencilMaskSeparate, GLenum, GLuint);
-HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv2, glStencilOp, GLenum, GLenum, GLenum);
-HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv2, glStencilOpSeparate, GLenum, GLenum, GLenum, GLenum);
-HYBRIS_IMPLEMENT_VOID_FUNCTION9(glesv2, glTexImage2D, GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const void *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv2, glTexParameterf, GLenum, GLenum, GLfloat);
-HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv2, glTexParameterfv, GLenum, GLenum, const GLfloat *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv2, glTexParameteri, GLenum, GLenum, GLint);
-HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv2, glTexParameteriv, GLenum, GLenum, const GLint *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION9(glesv2, glTexSubImage2D, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const void *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv2, glUniform1f, GLint, GLfloat);
-HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv2, glUniform1fv, GLint, GLsizei, const GLfloat *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv2, glUniform1i, GLint, GLint);
-HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv2, glUniform1iv, GLint, GLsizei, const GLint *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv2, glUniform2f, GLint, GLfloat, GLfloat);
-HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv2, glUniform2fv, GLint, GLsizei, const GLfloat *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv2, glUniform2i, GLint, GLint, GLint);
-HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv2, glUniform2iv, GLint, GLsizei, const GLint *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv2, glUniform3f, GLint, GLfloat, GLfloat, GLfloat);
-HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv2, glUniform3fv, GLint, GLsizei, const GLfloat *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv2, glUniform3i, GLint, GLint, GLint, GLint);
-HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv2, glUniform3iv, GLint, GLsizei, const GLint *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION5(glesv2, glUniform4f, GLint, GLfloat, GLfloat, GLfloat, GLfloat);
-HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv2, glUniform4fv, GLint, GLsizei, const GLfloat *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION5(glesv2, glUniform4i, GLint, GLint, GLint, GLint, GLint);
-HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv2, glUniform4iv, GLint, GLsizei, const GLint *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv2, glUniformMatrix2fv, GLint, GLsizei, GLboolean, const GLfloat *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv2, glUniformMatrix3fv, GLint, GLsizei, GLboolean, const GLfloat *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv2, glUniformMatrix4fv, GLint, GLsizei, GLboolean, const GLfloat *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv2, glUseProgram, GLuint);
-HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv2, glValidateProgram, GLuint);
-HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv2, glVertexAttrib1f, GLuint, GLfloat);
-HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv2, glVertexAttrib1fv, GLuint, const GLfloat *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv2, glVertexAttrib2f, GLuint, GLfloat, GLfloat);
-HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv2, glVertexAttrib2fv, GLuint, const GLfloat *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv2, glVertexAttrib3f, GLuint, GLfloat, GLfloat, GLfloat);
-HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv2, glVertexAttrib3fv, GLuint, const GLfloat *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION5(glesv2, glVertexAttrib4f, GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
-HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv2, glVertexAttrib4fv, GLuint, const GLfloat *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION6(glesv2, glVertexAttribPointer, GLuint, GLint, GLenum, GLboolean, GLsizei, const void *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv2, glViewport, GLint, GLint, GLsizei, GLsizei);
-HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv2, glReadBuffer, GLenum);
-HYBRIS_IMPLEMENT_VOID_FUNCTION6(glesv2, glDrawRangeElements, GLenum, GLuint, GLuint, GLsizei, GLenum, const void *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION10(glesv2, glTexImage3D, GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const void *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION11(glesv2, glTexSubImage3D, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const void *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION9(glesv2, glCopyTexSubImage3D, GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
-HYBRIS_IMPLEMENT_VOID_FUNCTION9(glesv2, glCompressedTexImage3D, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const void *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION11(glesv2, glCompressedTexSubImage3D, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const void *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv2, glGenQueries, GLsizei, GLuint *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv2, glDeleteQueries, GLsizei, const GLuint *);
-HYBRIS_IMPLEMENT_FUNCTION1(glesv2, GLboolean, glIsQuery, GLuint);
-HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv2, glBeginQuery, GLenum, GLuint);
-HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv2, glEndQuery, GLenum);
-HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv2, glGetQueryiv, GLenum, GLenum, GLint *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv2, glGetQueryObjectuiv, GLuint, GLenum, GLuint *);
-HYBRIS_IMPLEMENT_FUNCTION1(glesv2, GLboolean, glUnmapBuffer, GLenum);
-HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv2, glGetBufferPointerv, GLenum, GLenum, void **);
-HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv2, glDrawBuffers, GLsizei, const GLenum *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv2, glUniformMatrix2x3fv, GLint, GLsizei, GLboolean, const GLfloat *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv2, glUniformMatrix3x2fv, GLint, GLsizei, GLboolean, const GLfloat *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv2, glUniformMatrix2x4fv, GLint, GLsizei, GLboolean, const GLfloat *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv2, glUniformMatrix4x2fv, GLint, GLsizei, GLboolean, const GLfloat *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv2, glUniformMatrix3x4fv, GLint, GLsizei, GLboolean, const GLfloat *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv2, glUniformMatrix4x3fv, GLint, GLsizei, GLboolean, const GLfloat *);
-HYBRIS_IMPLEMENT_VOID_FUNCTION10(glesv2, glBlitFramebuffer, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum);
-HYBRIS_IMPLEMENT_VOID_FUNCTION5(glesv2, glRenderbufferStorageMultisample, GLenum, GLsizei, GLenum, GLsizei, GLsizei);
-HYBRIS_IMPLEMENT_VOID_FUNCTION5(glesv2, glFramebufferTextureLayer, GLenum, GLenum, GLuint, GLint, GLint);
-HYBRIS_IMPLEMENT_FUNCTION4(glesv2, void *, glMapBufferRange, GLenum, GLintptr, GLsizeiptr, GLbitfield);
-HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv2, glFlushMappedBufferRange, GLenum, GLintptr, GLsizeiptr);
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309132944.5.g9e81253.tar.bz2/libhybris/hybris/gralloc/gralloc.c
^
|
@@ -84,8 +84,7 @@
if (version == -1) {
if (hw_get_module(GRALLOC_HARDWARE_MODULE_ID, (const struct hw_module_t **)&gralloc_hardware_module) == 0) {
#if HAS_GRALLOC1_HEADER
- uint8_t majorVersion = (gralloc_hardware_module->module_api_version >> 8) & 0xFF;
- if ((majorVersion == 1) && (gralloc1_open(gralloc_hardware_module, &gralloc1_device) == 0) && (gralloc1_device != NULL)) {
+ if ((gralloc1_open(gralloc_hardware_module, &gralloc1_device) == 0) && (gralloc1_device != NULL)) {
// success
gralloc1_init();
version = 1;
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309132944.5.g9e81253.tar.bz2/libhybris/hybris/include/Makefile.am
^
|
@@ -18,14 +18,6 @@
GLES2/gl2ext.h \
GLES2/gl2platform.h
-gles3includedir = $(includedir)/GLES3
-gles3include_HEADERS = \
- GLES3/gl3.h \
- GLES3/gl31.h \
- GLES3/gl32.h \
- GLES3/gl3ext.h \
- GLES3/gl3platform.h
-
khrincludedir = $(includedir)/KHR
khrinclude_HEADERS = \
KHR/khrplatform.h
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309132944.5.g9e81253.tar.bz2/libhybris/hybris/opencl/opencl.c
^
|
@@ -30,12 +30,115 @@
static void *opencl_handle = NULL;
+/* Platform API */
+static cl_int (*_clGetPlatformIDs)(cl_uint, cl_platform_id *, cl_uint *) = NULL;
+
+static cl_int (*_clGetPlatformInfo)(cl_platform_id, cl_platform_info, size_t, void *, size_t *) = NULL;
+
+/* Device APIs */
+static cl_int (*_clGetDeviceIDs)(cl_platform_id, cl_device_type, cl_uint, cl_device_id *, cl_uint *) = NULL;
+
+static cl_int (*_clGetDeviceInfo)(cl_device_id, cl_device_info, size_t, void *, size_t *) = NULL;
+
+static cl_int (*_clCreateSubDevices)(cl_device_id, const cl_device_partition_property *, cl_uint, cl_device_id *, cl_uint *) = NULL;
+
+static cl_int (*_clRetainDevice)(cl_device_id) = NULL;
+
+static cl_int (*_clReleaseDevice)(cl_device_id) = NULL;
+
+static cl_int (*_clSetDefaultDeviceCommandQueue)(cl_context, cl_device_id, cl_command_queue) = NULL;
+
+static cl_int (*_clGetDeviceAndHostTimer)(cl_device_id, cl_ulong*, cl_ulong*) = NULL;
+
+static cl_int (*_clGetHostTimer)(cl_device_id, cl_ulong *) = NULL;
+
+/* Context APIs */
static cl_context (*_clCreateContext)(const cl_context_properties *, cl_uint, const cl_device_id *, void (CL_CALLBACK *)(const char *, const void *, size_t, void *), void *, cl_int *) = NULL;
static cl_context (*_clCreateContextFromType)(const cl_context_properties *, cl_device_type, void (CL_CALLBACK *)(const char *, const void *, size_t, void *), void *, cl_int *) = NULL;
+static cl_int (*_clRetainContext)(cl_context) = NULL;
+
+static cl_int (*_clReleaseContext)(cl_context) = NULL;
+
+static cl_int (*_clGetContextInfo)(cl_context, cl_context_info, size_t, void *, size_t *) = NULL;
+
+/* Command Queue APIs */
+
+static cl_command_queue (*_clCreateCommandQueueWithProperties)(cl_context, cl_device_id, const cl_queue_properties *, cl_int *) = NULL;
+
+static cl_int (*_clRetainCommandQueue)(cl_command_queue) = NULL;
+
+static cl_int (*_clReleaseCommandQueue)(cl_command_queue) = NULL;
+
+static cl_int (*_clGetCommandQueueInfo)(cl_command_queue, cl_command_queue_info, size_t, void *, size_t *) = NULL;
+
+#ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS
+#warning CL_USE_DEPRECATED_OPENCL_1_0_APIS is defined. These APIs are unsupported and untested in OpenCL 1.1!
+/*
+ * WARNING:
+ * This API introduces mutable state into the OpenCL implementation. It has been REMOVED
+ * to better facilitate thread safety. The 1.0 API is not thread safe. It is not tested by the
+ * OpenCL 1.1 conformance test, and consequently may not work or may not work dependably.
+ * It is likely to be non-performant. Use of this API is not advised. Use at your own risk.
+ *
+ * Software developers previously relying on this API are instructed to set the command queue
+ * properties when creating the queue, instead.
+ */
+static cl_int clSetCommandQueueProperty(cl_command_queue, cl_command_queue_properties, cl_bool, cl_command_queue_properties *);
+#endif /* CL_USE_DEPRECATED_OPENCL_1_0_APIS */
+
+/* Memory Object APIs */
+static cl_mem (*_clCreateBuffer)(cl_context, cl_mem_flags, size_t, void *, cl_int *) = NULL;
+
+static cl_mem (*_clCreateSubBuffer)(cl_mem, cl_mem_flags, cl_buffer_create_type, const void *, cl_int *) = NULL;
+
+static cl_mem (*_clCreateImage)(cl_context, cl_mem_flags, const cl_image_format *, const cl_image_desc *, void *, cl_int *) = NULL;
+
+static cl_mem (*_clCreatePipe)(cl_context, cl_mem_flags, cl_uint, cl_uint, const cl_pipe_properties *, cl_int *) = NULL;
+
+static cl_int (*_clRetainMemObject)(cl_mem) = NULL;
+
+static cl_int (*_clReleaseMemObject)(cl_mem) = NULL;
+
+static cl_int (*_clGetSupportedImageFormats)(cl_context, cl_mem_flags, cl_mem_object_type, cl_uint, cl_image_format *, cl_uint *) = NULL;
+
+static cl_int (*_clGetMemObjectInfo)(cl_mem, cl_mem_info, size_t, void *, size_t *) = NULL;
+
+static cl_int (*_clGetImageInfo)(cl_mem, cl_image_info, size_t, void *, size_t *) = NULL;
+
+static cl_int (*_clGetPipeInfo)(cl_mem, cl_pipe_info, size_t, void *, size_t *) = NULL;
+
static cl_int (*_clSetMemObjectDestructorCallback)( cl_mem, void (CL_CALLBACK *)(cl_mem, void *), void *) = NULL;
+/* SVM Allocation APIs */
+static void * (*_clSVMAlloc)(cl_context, cl_svm_mem_flags, size_t, cl_uint) = NULL;
+
+static void (*_clSVMFree)(cl_context, void *) = NULL;
+
+/* Sampler APIs */
+
+static cl_sampler (*_clCreateSamplerWithProperties)(cl_context, const cl_sampler_properties *, cl_int *) = NULL;
+
+static cl_int (*_clRetainSampler)(cl_sampler) = NULL;
+
+static cl_int (*_clReleaseSampler)(cl_sampler) = NULL;
+
+static cl_int (*_clGetSamplerInfo)(cl_sampler, cl_sampler_info, size_t, void *, size_t *) = NULL;
+
+/* Program Object APIs */
+static cl_program (*_clCreateProgramWithSource)(cl_context, cl_uint, const char **, const size_t *, cl_int *) = NULL;
+
+static cl_program (*_clCreateProgramWithBinary)(cl_context, cl_uint, const cl_device_id *, const size_t *, const unsigned char **, cl_int *, cl_int *) = NULL;
+
+static cl_program (*_clCreateProgramWithBuiltInKernels)(cl_context, cl_uint, const cl_device_id *, const char *, cl_int *) = NULL;
+
+static cl_program (*_clCreateProgramWithIL)(cl_context, const void*, size_t, cl_int*) = NULL;
+
+static cl_int (*_clRetainProgram)(cl_program) = NULL;
+
+static cl_int (*_clReleaseProgram)(cl_program) = NULL;
+
static cl_int (*_clBuildProgram)(cl_program, cl_uint, const cl_device_id *, const char *, void (CL_CALLBACK *)(cl_program, void *), void *) = NULL;
static cl_int (*_clCompileProgram)(cl_program, cl_uint, const cl_device_id *, const char *, cl_uint, const cl_program *, const char **, void (CL_CALLBACK *)(cl_program, void *), void *) = NULL;
@@ -44,23 +147,268 @@
static cl_int (*_clSetProgramReleaseCallback)(cl_program, void (CL_CALLBACK *)(cl_program, void *), void *) = NULL;
+static cl_int (*_clSetProgramSpecializationConstant)(cl_program, cl_uint, size_t, const void*) = NULL;
+
+
+static cl_int (*_clUnloadPlatformCompiler)(cl_platform_id) = NULL;
+
+static cl_int (*_clGetProgramInfo)(cl_program, cl_program_info, size_t, void *, size_t *) = NULL;
+
+static cl_int (*_clGetProgramBuildInfo)(cl_program, cl_device_id, cl_program_build_info, size_t, void *, size_t *) = NULL;
+
+/* Kernel Object APIs */
+static cl_kernel (*_clCreateKernel)(cl_program, const char *, cl_int *) = NULL;
+
+static cl_int (*_clCreateKernelsInProgram)(cl_program, cl_uint, cl_kernel *, cl_uint *) = NULL;
+
+static cl_kernel (*_clCloneKernel)(cl_kernel, cl_int*) = NULL;
+
+static cl_int (*_clRetainKernel)(cl_kernel) = NULL;
+
+static cl_int (*_clReleaseKernel)(cl_kernel) = NULL;
+
+static cl_int (*_clSetKernelArg)(cl_kernel, cl_uint, size_t, const void *) = NULL;
+
+static cl_int (*_clSetKernelArgSVMPointer)(cl_kernel, cl_uint, const void *) = NULL;
+
+static cl_int (*_clSetKernelExecInfo)(cl_kernel, cl_kernel_exec_info, size_t, const void *) = NULL;
+
+static cl_int (*_clGetKernelInfo)(cl_kernel, cl_kernel_info, size_t, void *, size_t *) = NULL;
+
+static cl_int (*_clGetKernelArgInfo)(cl_kernel, cl_uint, cl_kernel_arg_info, size_t, void *, size_t *) = NULL;
+
+
+static cl_int (*_clGetKernelWorkGroupInfo)(cl_kernel, cl_device_id, cl_kernel_work_group_info, size_t, void *, size_t *) = NULL;
+
+static cl_int (*_clGetKernelSubGroupInfo)(cl_kernel, cl_device_id, cl_kernel_sub_group_info, size_t, const void*, size_t, void*, size_t*) = NULL;
+
+/* Event Object APIs */
+static cl_int (*_clWaitForEvents)(cl_uint, const cl_event *) = NULL;
+
+static cl_int (*_clGetEventInfo)(cl_event, cl_event_info, size_t, void *, size_t *) = NULL;
+
+static cl_event (*_clCreateUserEvent)(cl_context, cl_int *) = NULL;
+
+static cl_int (*_clRetainEvent)(cl_event) = NULL;
+
+static cl_int (*_clReleaseEvent)(cl_event) = NULL;
+
+static cl_int (*_clSetUserEventStatus)(cl_event, cl_int) = NULL;
+
static cl_int (*_clSetEventCallback)( cl_event, cl_int, void (CL_CALLBACK *)(cl_event, cl_int, void *), void *) = NULL;
+/* Profiling APIs */
+static cl_int (*_clGetEventProfilingInfo)(cl_event, cl_profiling_info, size_t, void *, size_t *) = NULL;
+
+/* Flush and Finish APIs */
+static cl_int (*_clFlush)(cl_command_queue) = NULL;
+
+static cl_int (*_clFinish)(cl_command_queue) = NULL;
+
+/* Enqueued Commands APIs */
+static cl_int (*_clEnqueueReadBuffer)(cl_command_queue, cl_mem, cl_bool, size_t, size_t, void *, cl_uint, const cl_event *, cl_event *) = NULL;
+
+static cl_int (*_clEnqueueReadBufferRect)(cl_command_queue, cl_mem, cl_bool, const size_t *, const size_t *, const size_t *, size_t, size_t, size_t, size_t, void *, cl_uint, const cl_event *, cl_event *) = NULL;
+
+static cl_int (*_clEnqueueWriteBuffer)(cl_command_queue, cl_mem, cl_bool, size_t, size_t, const void *, cl_uint, const cl_event *, cl_event *) = NULL;
+
+static cl_int (*_clEnqueueWriteBufferRect)(cl_command_queue, cl_mem, cl_bool, const size_t *, const size_t *, const size_t *, size_t, size_t, size_t, size_t, const void *, cl_uint, const cl_event *, cl_event *) = NULL;
+
+static cl_int (*_clEnqueueFillBuffer)(cl_command_queue, cl_mem, const void *, size_t, size_t, size_t, cl_uint, const cl_event *, cl_event *) = NULL;
+
+static cl_int (*_clEnqueueCopyBuffer)(cl_command_queue, cl_mem, cl_mem, size_t, size_t, size_t, cl_uint, const cl_event *, cl_event *) = NULL;
+
+static cl_int (*_clEnqueueCopyBufferRect)(cl_command_queue, cl_mem, cl_mem, const size_t *, const size_t *, const size_t *, size_t, size_t, size_t, size_t, cl_uint, const cl_event *, cl_event *) = NULL;
+
+static cl_int (*_clEnqueueReadImage)(cl_command_queue, cl_mem, cl_bool, const size_t *, const size_t *, size_t, size_t, void *, cl_uint, const cl_event *, cl_event *) = NULL;
+
+static cl_int (*_clEnqueueWriteImage)(cl_command_queue, cl_mem, cl_bool, const size_t *, const size_t *, size_t, size_t, const void *, cl_uint, const cl_event *, cl_event *) = NULL;
+
+static cl_int (*_clEnqueueFillImage)(cl_command_queue, cl_mem, const void *, const size_t *, const size_t *, cl_uint, const cl_event *, cl_event *) = NULL;
+
+static cl_int (*_clEnqueueCopyImage)(cl_command_queue, cl_mem, cl_mem, const size_t *, const size_t *, const size_t *, cl_uint, const cl_event *, cl_event *) = NULL;
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309132944.5.g9e81253.tar.bz2/libhybris/hybris/properties/Makefile.am
^
|
@@ -12,7 +12,7 @@
libandroid_properties_la_CFLAGS += -I$(top_srcdir)/include
libandroid_properties_la_LDFLAGS = \
- $(top_builddir)/common/libhybris-common.la \
+ $(top_srcdir)/common/libhybris-common.la \
-version-info "1":"0":"0"
pkgconfigdir = $(libdir)/pkgconfig
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309132944.5.g9e81253.tar.bz2/libhybris/hybris/properties/hybris_properties.c
^
|
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2018 Jolla Ltd. <franz.haider@jolla.com>
- * Copyright (c) 2020 UBports foundation <marius@ubports.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,18 +22,12 @@
#include <hybris/common/binding.h>
static void *libcutils = NULL;
-static int own_impl = 0;
// These may point to the libhybris implementation or to the bionic implementation, depending on the linker being used.
static int (*bionic_property_list)(void (*propfn)(const char *key, const char *value, void *cookie), void *cookie) = NULL;
static int (*bionic_property_get)(const char *key, char *value, const char *default_value) = NULL;
static int (*bionic_property_set)(const char *key, const char *value) = NULL;
-// Private implementations as fallback
-extern int my_property_list(void (*propfn)(const char *key, const char *value, void *cookie), void *cookie);
-extern int my_property_get(const char *key, char *value, const char *default_value);
-extern int my_property_set(const char *key, const char *value);
-
static void unload_libcutils(void)
{
if (libcutils) {
@@ -50,7 +43,7 @@
static void ensure_bionic_properties_initialized(void)
{
- if (!libcutils && !own_impl) {
+ if (!libcutils) {
libcutils = android_dlopen("libcutils.so", RTLD_LAZY);
if (libcutils) {
PROPERTY_DLSYM(property_get);
@@ -58,8 +51,8 @@
PROPERTY_DLSYM(property_list);
atexit(unload_libcutils);
} else {
- own_impl = 1;
- fprintf(stderr, "failed to load bionic libc.so, falling back own property implementation\n");
+ fprintf(stderr, "failed to load bionic libc.so\n");
+ abort();
}
}
}
@@ -68,28 +61,20 @@
{
ensure_bionic_properties_initialized();
- if (!own_impl)
- return bionic_property_list(propfn, cookie);
- else
- return my_property_list(propfn, cookie);
+ return bionic_property_list(propfn, cookie);
}
int property_get(const char *key, char *value, const char *default_value)
{
ensure_bionic_properties_initialized();
- if (!own_impl)
- return bionic_property_get(key, value, default_value);
- else
- return my_property_get(key, value, default_value);
+ return bionic_property_get(key, value, default_value);
}
int property_set(const char *key, const char *value)
{
ensure_bionic_properties_initialized();
- if (!own_impl)
- return bionic_property_set(key, value);
- else
- return my_property_set(key, value);
+ return bionic_property_set(key, value);
}
+
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309132944.5.g9e81253.tar.bz2/libhybris/hybris/tests/Makefile.am
^
|
@@ -3,7 +3,6 @@
test_egl \
test_egl_configs \
test_glesv2 \
- test_glesv3 \
test_sf \
test_sensors \
test_input \
@@ -15,6 +14,7 @@
test_gps \
test_opencl \
test_wifi \
+ test_hwc2 \
test_hwcomposer \
test_nfc
@@ -26,29 +26,11 @@
$(top_builddir)/common/libhybris-common.la \
$(top_builddir)/hardware/libhardware.la
-test_egl_SOURCES = test_egl.cpp
+test_egl_SOURCES = test_egl.c
test_egl_CFLAGS = \
-I$(top_srcdir)/include \
$(ANDROID_HEADERS_CFLAGS) \
-I$(top_srcdir)/egl/platforms/common
-test_egl_CXXFLAGS = \
- -I$(top_srcdir)/include \
- $(ANDROID_HEADERS_CFLAGS) \
- -I$(top_srcdir)/common \
- -I$(top_srcdir)/egl/platforms/common \
- -I$(top_srcdir)/egl/platforms/hwcomposer \
- -I$(top_srcdir)/libsync \
- -std=gnu++11
-if WANT_MESA
-test_egl_CXXFLAGS += -DLIBHYBRIS_WANTS_MESA_X11_HEADERS
-endif
-if HAS_HWCOMPOSER2_HEADERS
-test_egl_CXXFLAGS += \
- -DHAS_HWCOMPOSER2_HEADERS=1
-else
-test_egl_CXXFLAGS += \
- -DHAS_HWCOMPOSER2_HEADERS=0
-endif
if WANT_MESA
test_egl_CFLAGS += -DLIBHYBRIS_WANTS_MESA_X11_HEADERS
@@ -65,77 +47,27 @@
$(top_builddir)/common/libhybris-common.la \
$(top_builddir)/egl/libEGL.la
-test_glesv2_SOURCES = test_glesv2.cpp test_common.cpp
-test_glesv2_CXXFLAGS = \
+test_glesv2_SOURCES = test_glesv2.c
+test_glesv2_CFLAGS = \
-I$(top_srcdir)/include \
- $(ANDROID_HEADERS_CFLAGS) \
- -I$(top_srcdir)/common \
- -I$(top_srcdir)/egl/platforms/common \
- -I$(top_srcdir)/egl/platforms/hwcomposer \
- -I$(top_srcdir)/libsync \
- -std=gnu++11 \
- -DUSE_HWCOMPOSER=1
+ $(ANDROID_HEADERS_CFLAGS)
if WANT_MESA
-test_glesv2_CXXFLAGS += -DLIBHYBRIS_WANTS_MESA_X11_HEADERS
+test_glesv2_CFLAGS += -DLIBHYBRIS_WANTS_MESA_X11_HEADERS
endif
test_glesv2_LDADD = \
-lm \
$(top_builddir)/common/libhybris-common.la \
- $(top_builddir)/egl/platforms/hwcomposer/libhybris-hwcomposerwindow.la \
- $(top_builddir)/egl/platforms/common/libhybris-eglplatformcommon.la \
$(top_builddir)/egl/libEGL.la \
- $(top_builddir)/glesv2/libGLESv2.la \
- $(top_builddir)/libsync/libsync.la
-if HAS_HWCOMPOSER2_HEADERS
-test_glesv2_CXXFLAGS += \
- -DHAS_HWCOMPOSER2_HEADERS=1
-test_glesv2_LDADD += \
- $(top_builddir)/hwc2/libhwc2.la
-else
-test_glesv2_CXXFLAGS += \
- -DHAS_HWCOMPOSER2_HEADERS=0
-endif
+ $(top_builddir)/glesv2/libGLESv2.la
-test_glesv3_SOURCES = test_glesv3.cpp test_common.cpp
-test_glesv3_CXXFLAGS = \
- -I$(top_srcdir)/include \
- $(ANDROID_HEADERS_CFLAGS) \
- -I$(top_srcdir)/common \
- -I$(top_srcdir)/egl/platforms/common \
- -I$(top_srcdir)/egl/platforms/hwcomposer \
- -I$(top_srcdir)/libsync \
- -std=gnu++11 \
- -DUSE_HWCOMPOSER=1
-if WANT_MESA
-test_glesv3_CXXFLAGS += -DLIBHYBRIS_WANTS_MESA_X11_HEADERS
-endif
-test_glesv3_LDADD = \
- -lm \
- $(top_builddir)/common/libhybris-common.la \
- $(top_builddir)/egl/platforms/hwcomposer/libhybris-hwcomposerwindow.la \
- $(top_builddir)/egl/platforms/common/libhybris-eglplatformcommon.la \
- $(top_builddir)/egl/libEGL.la \
- $(top_builddir)/glesv2/libGLESv2.la \
- $(top_builddir)/libsync/libsync.la
-if HAS_HWCOMPOSER2_HEADERS
-test_glesv3_CXXFLAGS += \
- -DHAS_HWCOMPOSER2_HEADERS=1
-test_glesv3_LDADD += \
- $(top_builddir)/hwc2/libhwc2.la
-else
-test_glesv3_CXXFLAGS += \
- -DHAS_HWCOMPOSER2_HEADERS=0
-endif
-
-test_hwcomposer_SOURCES = test_hwcomposer.cpp test_common.cpp
+test_hwcomposer_SOURCES = test_hwcomposer.cpp
test_hwcomposer_CXXFLAGS = \
-I$(top_srcdir)/include \
$(ANDROID_HEADERS_CFLAGS) \
-I$(top_srcdir)/common \
-I$(top_srcdir)/egl/platforms/common \
-I$(top_srcdir)/egl/platforms/hwcomposer \
- -I$(top_srcdir)/libsync \
- -DUSE_HWCOMPOSER=1
+ -I$(top_srcdir)/libsync
if WANT_MESA
test_hwcomposer_CXXFLAGS += -DLIBHYBRIS_WANTS_MESA_X11_HEADERS
@@ -148,16 +80,6 @@
$(top_builddir)/glesv2/libGLESv2.la \
$(top_builddir)/hardware/libhardware.la
-if HAS_HWCOMPOSER2_HEADERS
-test_hwcomposer_CXXFLAGS += \
- -DHAS_HWCOMPOSER2_HEADERS=1
-test_hwcomposer_LDADD += \
- $(top_builddir)/hwc2/libhwc2.la
-else
-test_hwcomposer_CXXFLAGS += \
- -DHAS_HWCOMPOSER2_HEADERS=0
-endif
-
if HAS_ANDROID_4_2_0
test_hwcomposer_LDADD += \
@@ -196,8 +118,8 @@
$(top_builddir)/common/libhybris-common.la \
$(top_builddir)/ui/libui.la
-test_sf_SOURCES = test_sf.cpp test_common.cpp
-test_sf_CXXFLAGS = \
+test_sf_SOURCES = test_sf.c
+test_sf_CFLAGS = \
-I$(top_srcdir)/include \
$(ANDROID_HEADERS_CFLAGS)
test_sf_LDADD = \
@@ -214,23 +136,10 @@
$(top_builddir)/common/libhybris-common.la \
$(top_builddir)/input/libis.la
-test_camera_SOURCES = test_camera.cpp test_common.cpp
-test_camera_CXXFLAGS = \
+test_camera_SOURCES = test_camera.c
+test_camera_CFLAGS = \
-I$(top_srcdir)/include \
- $(ANDROID_HEADERS_CFLAGS) \
- -I$(top_srcdir)/common \
- -I$(top_srcdir)/egl/platforms/common \
- -I$(top_srcdir)/egl/platforms/hwcomposer \
- -I$(top_srcdir)/libsync \
- -std=gnu++11
-if HAS_HWCOMPOSER2_HEADERS
-test_camera_CXXFLAGS += \
- -DHAS_HWCOMPOSER2_HEADERS=1
-else
-test_camera_CXXFLAGS += \
- -DHAS_HWCOMPOSER2_HEADERS=0
-endif
-if WANT_WAYLAND_EGL
+ $(ANDROID_HEADERS_CFLAGS)
test_camera_LDADD = \
$(top_builddir)/common/libhybris-common.la \
$(top_builddir)/egl/libEGL.la \
@@ -239,29 +148,10 @@
$(top_builddir)/input/libis.la \
$(top_builddir)/egl/platforms/common/libwayland-egl.la \
$(WAYLAND_CLIENT_LIBS)
-else
-test_camera_LDADD = \
- $(top_builddir)/common/libhybris-common.la \
- $(top_builddir)/egl/libEGL.la \
- $(top_builddir)/glesv2/libGLESv2.la \
- $(top_builddir)/camera/libcamera.la \
- $(top_builddir)/input/libis.la \
- $(WAYLAND_EGL_LIBS)
- $(WAYLAND_CLIENT_LIBS)
|
[-]
[+]
|
Added |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309132944.5.g9e81253.tar.bz2/libhybris/hybris/tests/test_camera.c
^
|
@@ -0,0 +1,574 @@
+/*
+ * Copyright (C) 2012 Canonical 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.
+ *
+ */
+
+#include "config.h"
+
+#include <wayland-client.h>
+#include <wayland-server.h>
+#include <wayland-client-protocol.h>
+#include <wayland-egl.h>
+
+#include <hybris/camera/camera_compatibility_layer.h>
+#include <hybris/camera/camera_compatibility_layer_capabilities.h>
+
+#include <hybris/input/input_stack_compatibility_layer.h>
+#include <hybris/input/input_stack_compatibility_layer_codes_key.h>
+#include <hybris/input/input_stack_compatibility_layer_flags_key.h>
+#include <hybris/input/input_stack_compatibility_layer_flags_motion.h>
+
+#include <EGL/egl.h>
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+
+#include <assert.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <limits.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+int shot_counter = 1;
+int32_t current_zoom_level = 1;
+bool new_camera_frame_available = true;
+
+static GLuint gProgram;
+static GLuint gaPositionHandle, gaTexHandle, gsTextureHandle, gmTexMatrix;
+
+EffectMode next_effect()
+{
+ static EffectMode current_effect = EFFECT_MODE_NONE;
+
+ EffectMode next = current_effect;
+
+ switch (current_effect) {
+ case EFFECT_MODE_NONE:
+ next = EFFECT_MODE_MONO;
+ break;
+ case EFFECT_MODE_MONO:
+ next = EFFECT_MODE_NEGATIVE;
+ break;
+ case EFFECT_MODE_NEGATIVE:
+ next = EFFECT_MODE_SOLARIZE;
+ break;
+ case EFFECT_MODE_SOLARIZE:
+ next = EFFECT_MODE_SEPIA;
+ break;
+ case EFFECT_MODE_SEPIA:
+ next = EFFECT_MODE_POSTERIZE;
+ break;
+ case EFFECT_MODE_POSTERIZE:
+ next = EFFECT_MODE_WHITEBOARD;
+ break;
+ case EFFECT_MODE_WHITEBOARD:
+ next = EFFECT_MODE_BLACKBOARD;
+ break;
+ case EFFECT_MODE_BLACKBOARD:
+ next = EFFECT_MODE_AQUA;
+ break;
+ case EFFECT_MODE_AQUA:
+ next = EFFECT_MODE_NONE;
+ break;
+ }
+
+ current_effect = next;
+ return next;
+}
+
+void error_msg_cb(void* context)
+{
+ printf("%s \n", __PRETTY_FUNCTION__);
+}
+
+void shutter_msg_cb(void* context)
+{
+ printf("%s \n", __PRETTY_FUNCTION__);
+}
+
+void zoom_msg_cb(void* context, int32_t new_zoom_level)
+{
+ printf("%s \n", __PRETTY_FUNCTION__);
+
+ current_zoom_level = new_zoom_level;
+}
+
+void autofocus_msg_cb(void* context)
+{
+ printf("%s \n", __PRETTY_FUNCTION__);
+}
+
+void raw_data_cb(void* data, uint32_t data_size, void* context)
+{
+ printf("%s: %d \n", __PRETTY_FUNCTION__, data_size);
+}
+
+void jpeg_data_cb(void* data, uint32_t data_size, void* context)
+{
+ printf("%s: %d \n", __PRETTY_FUNCTION__, data_size);
+
+ char fn[256];
+ sprintf(fn, "/tmp/shot_%d.jpeg", shot_counter);
+ int fd = open(fn, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
+ if(fd < 0)
+ return;
+ TEMP_FAILURE_RETRY(write(fd, data, data_size));
+ close(fd);
+ shot_counter++;
+
+ struct CameraControl* cc = (struct CameraControl*) context;
+ android_camera_start_preview(cc);
+}
+
+void size_cb(void* ctx, int width, int height)
+{
+ printf("Supported size: [%d,%d]\n", width, height);
+}
+
+void preview_texture_needs_update_cb(void* ctx)
+{
+ new_camera_frame_available = true;
+}
+
+void on_new_input_event(struct Event* event, void* context)
+{
+ assert(context);
+
+ if (event->type == KEY_EVENT_TYPE && event->action == ISCL_KEY_EVENT_ACTION_UP) {
+ printf("We have got a key event: %d \n", event->details.key.key_code);
+
+ struct CameraControl* cc = (struct CameraControl*) context;
+
+ switch(event->details.key.key_code) {
+ case ISCL_KEYCODE_VOLUME_UP:
+ printf("\tZooming in now.\n");
+ android_camera_start_zoom(cc, current_zoom_level+1);
+ break;
+ case ISCL_KEYCODE_VOLUME_DOWN:
+ printf("\tZooming out now.\n");
+ android_camera_start_zoom(cc, current_zoom_level-1);
+ break;
+ case ISCL_KEYCODE_POWER:
+ printf("\tTaking a photo now.\n");
+ android_camera_take_snapshot(cc);
+ break;
+ case ISCL_KEYCODE_HEADSETHOOK:
+ printf("\tSwitching effect.\n");
+ android_camera_set_effect_mode(cc, next_effect());
+
+ }
+ } else if (event->type == MOTION_EVENT_TYPE &&
+ event->details.motion.pointer_count == 1) {
+ if ((event->action & ISCL_MOTION_EVENT_ACTION_MASK) == ISCL_MOTION_EVENT_ACTION_UP) {
+ printf("\tMotion event(Action up): (%f, %f) \n",
+ event->details.motion.pointer_coordinates[0].x,
+ event->details.motion.pointer_coordinates[0].y);
+ }
+
+ if ((event->action & ISCL_MOTION_EVENT_ACTION_MASK) == ISCL_MOTION_EVENT_ACTION_DOWN) {
+ printf("\tMotion event(Action down): (%f, %f) \n",
+ event->details.motion.pointer_coordinates[0].x,
+ event->details.motion.pointer_coordinates[0].y);
+ }
+ }
+}
+
+static const char* vertex_shader()
+{
+ return
+ "#extension GL_OES_EGL_image_external : require \n"
+ "attribute vec4 a_position; \n"
+ "attribute vec2 a_texCoord; \n"
+ "uniform mat4 m_texMatrix; \n"
+ "varying vec2 v_texCoord; \n"
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309132944.5.g9e81253.tar.bz2/libhybris/hybris/tests/test_egl.c
^
|
(renamed from libhybris/hybris/tests/test_egl.cpp)
|
[-]
[+]
|
Added |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309132944.5.g9e81253.tar.bz2/libhybris/hybris/tests/test_glesv2.c
^
|
@@ -0,0 +1,190 @@
+/*
+ * Copyright (c) 2012 Carsten Munk <carsten.munk@gmail.com>
+ *
+ * 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.
+ *
+ */
+
+#include <EGL/egl.h>
+#include <GLES2/gl2.h>
+#include <assert.h>
+#include <stdio.h>
+#include <math.h>
+#include <stddef.h>
+#include <stdlib.h>
+
+const char vertex_src [] =
+" \
+ attribute vec4 position; \
+ varying mediump vec2 pos; \
+ uniform vec4 offset; \
+ \
+ void main() \
+ { \
+ gl_Position = position + offset; \
+ pos = position.xy; \
+ } \
+";
+
+
+const char fragment_src [] =
+" \
+ varying mediump vec2 pos; \
+ uniform mediump float phase; \
+ \
+ void main() \
+ { \
+ gl_FragColor = vec4( 1., 0.9, 0.7, 1.0 ) * \
+ cos( 30.*sqrt(pos.x*pos.x + 1.5*pos.y*pos.y) \
+ + atan(pos.y,pos.x) - phase ); \
+ } \
+";
+
+GLuint load_shader(const char *shader_source, GLenum type)
+{
+ GLuint shader = glCreateShader(type);
+
+ glShaderSource(shader, 1, &shader_source, NULL);
+ glCompileShader(shader);
+
+ return shader;
+}
+
+
+GLfloat norm_x = 0.0;
+GLfloat norm_y = 0.0;
+GLfloat offset_x = 0.0;
+GLfloat offset_y = 0.0;
+GLfloat p1_pos_x = 0.0;
+GLfloat p1_pos_y = 0.0;
+
+GLint phase_loc;
+GLint offset_loc;
+GLint position_loc;
+
+const float vertexArray[] = {
+ 0.0, 1.0, 0.0,
+ -1., 0.0, 0.0,
+ 0.0, -1.0, 0.0,
+ 1., 0.0, 0.0,
+ 0.0, 1., 0.0
+};
+
+
+int main(int argc, char **argv)
+{
+ EGLDisplay display;
+ EGLConfig ecfg;
+ EGLint num_config;
+ EGLint attr[] = { // some attributes to set up our egl-interface
+ EGL_BUFFER_SIZE, 32,
+ EGL_RENDERABLE_TYPE,
+ EGL_OPENGL_ES2_BIT,
+ EGL_NONE
+ };
+ EGLSurface surface;
+ EGLint ctxattr[] = {
+ EGL_CONTEXT_CLIENT_VERSION, 2,
+ EGL_NONE
+ };
+ EGLContext context;
+
+ EGLBoolean rv;
+
+ display = eglGetDisplay(NULL);
+ assert(eglGetError() == EGL_SUCCESS);
+ assert(display != EGL_NO_DISPLAY);
+
+ rv = eglInitialize(display, 0, 0);
+ assert(eglGetError() == EGL_SUCCESS);
+ assert(rv == EGL_TRUE);
+
+ eglChooseConfig((EGLDisplay) display, attr, &ecfg, 1, &num_config);
+ assert(eglGetError() == EGL_SUCCESS);
+ assert(rv == EGL_TRUE);
+
+ surface = eglCreateWindowSurface((EGLDisplay) display, ecfg, (EGLNativeWindowType)NULL, NULL);
+ assert(eglGetError() == EGL_SUCCESS);
+ assert(surface != EGL_NO_SURFACE);
+
+ context = eglCreateContext((EGLDisplay) display, ecfg, EGL_NO_CONTEXT, ctxattr);
+ assert(eglGetError() == EGL_SUCCESS);
+ assert(context != EGL_NO_CONTEXT);
+
+ assert(eglMakeCurrent((EGLDisplay) display, surface, surface, context) == EGL_TRUE);
+
+ const char *version = (const char *)glGetString(GL_VERSION);
+ assert(version);
+ printf("%s\n",version);
+
+
+ GLuint vertexShader = load_shader ( vertex_src , GL_VERTEX_SHADER ); // load vertex shader
+ GLuint fragmentShader = load_shader ( fragment_src , GL_FRAGMENT_SHADER ); // load fragment shader
+
+ GLuint shaderProgram = glCreateProgram (); // create program object
+ glAttachShader ( shaderProgram, vertexShader ); // and attach both...
+ glAttachShader ( shaderProgram, fragmentShader ); // ... shaders to it
+
+ glLinkProgram ( shaderProgram ); // link the program
+ glUseProgram ( shaderProgram ); // and select it for usage
+
+ //// now get the locations (kind of handle) of the shaders variables
+ position_loc = glGetAttribLocation ( shaderProgram , "position" );
+ phase_loc = glGetUniformLocation ( shaderProgram , "phase" );
+ offset_loc = glGetUniformLocation ( shaderProgram , "offset" );
+ if ( position_loc < 0 || phase_loc < 0 || offset_loc < 0 ) {
+ return 1;
+ }
+
+ //glViewport ( 0 , 0 , 800, 600); // commented out so it uses the initial window dimensions
+ glClearColor ( 1. , 1. , 1. , 1.); // background color
+ float phase = 0;
+ int frames = -1;
+ if(argc == 2) {
+ frames = atoi(argv[1]);
+ }
+ if(frames < 0) {
+ frames = 30 * 60;
+ }
+
+ int i;
+ for (i = 0; i < frames; ++i) {
+ if(i % 60 == 0) printf("frame:%i\n", i);
+ glClear(GL_COLOR_BUFFER_BIT);
+ glUniform1f ( phase_loc , phase ); // write the value of phase to the shaders phase
+ phase = fmodf ( phase + 0.5f , 2.f * 3.141f ); // and update the local variable
+
+ glUniform4f ( offset_loc , offset_x , offset_y , 0.0 , 0.0 );
+
+ glVertexAttribPointer ( position_loc, 3, GL_FLOAT, GL_FALSE, 0, vertexArray );
+ glEnableVertexAttribArray ( position_loc );
+ glDrawArrays ( GL_TRIANGLE_STRIP, 0, 5 );
+
+ eglSwapBuffers ( (EGLDisplay) display, surface ); // get the rendered buffer to the screen
+ }
+
+ printf("stop\n");
+
+#if 0
+(*egldestroycontext)((EGLDisplay) display, context);
+ printf("destroyed context\n");
+
+ (*egldestroysurface)((EGLDisplay) display, surface);
+ printf("destroyed surface\n");
+ (*eglterminate)((EGLDisplay) display);
+ printf("terminated\n");
+ android_dlclose(baz);
+#endif
+}
+
+// vim:ts=4:sw=4:noexpandtab
|
[-]
[+]
|
Added |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309132944.5.g9e81253.tar.bz2/libhybris/hybris/tests/test_hwc2.cpp
^
|
@@ -0,0 +1,358 @@
+/*
+ * Copyright (C) 2018 TheKit <nekit1000@gmail.com>
+ * Copyright (c) 2012 Carsten Munk <carsten.munk@gmail.com>
+ *
+ * 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.
+ *
+ */
+
+#if HAS_HWCOMPOSER2_HEADERS
+
+#include <assert.h>
+#include <stdio.h>
+#include <math.h>
+#include <mutex>
+
+#include <EGL/egl.h>
+#include <GLES2/gl2.h>
+#include <cutils/log.h>
+#include <sync/sync.h>
+
+#include <hwcomposer_window.h>
+
+#include <hybris/hwc2/hwc2_compatibility_layer.h>
+#include "logging.h"
+
+const char vertex_src [] =
+" \
+ attribute vec4 position; \
+ varying mediump vec2 pos; \
+ uniform vec4 offset; \
+ \
+ void main() \
+ { \
+ gl_Position = position + offset; \
+ pos = position.xy; \
+ } \
+";
+
+
+const char fragment_src [] =
+" \
+ varying mediump vec2 pos; \
+ uniform mediump float phase; \
+ \
+ void main() \
+ { \
+ gl_FragColor = vec4( 1., 0.9, 0.7, 1.0 ) * \
+ cos( 30.*sqrt(pos.x*pos.x + 1.5*pos.y*pos.y) \
+ + atan(pos.y,pos.x) - phase ); \
+ } \
+";
+
+GLuint load_shader(const char *shader_source, GLenum type)
+{
+ GLuint shader = glCreateShader(type);
+
+ glShaderSource(shader, 1, &shader_source, NULL);
+ glCompileShader(shader);
+
+ return shader;
+}
+
+
+GLfloat norm_x = 0.0;
+GLfloat norm_y = 0.0;
+GLfloat offset_x = 0.0;
+GLfloat offset_y = 0.0;
+GLfloat p1_pos_x = 0.0;
+GLfloat p1_pos_y = 0.0;
+
+GLint phase_loc;
+GLint offset_loc;
+GLint position_loc;
+
+const float vertexArray[] = {
+ 0.0, 1.0, 0.0,
+ -1., 0.0, 0.0,
+ 0.0, -1.0, 0.0,
+ 1., 0.0, 0.0,
+ 0.0, 1., 0.0
+};
+
+hwc2_compat_device_t* hwcDevice;
+
+class HWComposer : public HWComposerNativeWindow
+{
+ private:
+ hwc2_compat_layer_t *layer;
+ hwc2_compat_display_t *hwcDisplay;
+ int lastPresentFence = -1;
+ protected:
+ void present(HWComposerNativeWindowBuffer *buffer);
+
+ public:
+
+ HWComposer(unsigned int width, unsigned int height, unsigned int format,
+ hwc2_compat_display_t *display, hwc2_compat_layer_t *layer);
+ void set();
+};
+
+HWComposer::HWComposer(unsigned int width, unsigned int height,
+ unsigned int format, hwc2_compat_display_t* display,
+ hwc2_compat_layer_t *layer) :
+ HWComposerNativeWindow(width, height, format)
+{
+ this->layer = layer;
+ this->hwcDisplay = display;
+}
+
+void HWComposer::present(HWComposerNativeWindowBuffer *buffer)
+{
+ uint32_t numTypes = 0;
+ uint32_t numRequests = 0;
+ hwc2_display_t displayId = 0;
+
+ hwc2_error_t error = hwc2_compat_display_validate(hwcDisplay, &numTypes,
+ &numRequests);
+
+ if (error != HWC2_ERROR_NONE && error != HWC2_ERROR_HAS_CHANGES) {
+ HYBRIS_ERROR("prepare: validate failed for display %lu: %s (%d)", displayId,
+ to_string(static_cast<HWC2::Error>(error)).c_str(), error);
+ return;
+ }
+
+ if (numTypes || numRequests) {
+ HYBRIS_ERROR("prepare: validate required changes for display %lu: %s (%d)",
+ displayId, to_string(static_cast<HWC2::Error>(error)).c_str(),
+ error);
+ return;
+ }
+
+ error = hwc2_compat_display_accept_changes(hwcDisplay);
+ if (error != HWC2_ERROR_NONE) {
+ HYBRIS_ERROR("prepare: acceptChanges failed: %s",
+ to_string(static_cast<HWC2::Error>(error)).c_str());
+ return;
+ }
+
+ hwc2_compat_display_set_client_target(hwcDisplay, /* slot */0, buffer,
+ getFenceBufferFd(buffer),
+ HAL_DATASPACE_UNKNOWN);
+
+ int presentFence;
+ hwc2_compat_display_present(hwcDisplay, &presentFence);
+
+ if (error != HWC2_ERROR_NONE) {
+ HYBRIS_ERROR("presentAndGetReleaseFences: failed for display %lu: %s (%d)",
+ displayId,
+ to_string(static_cast<HWC2::Error>(error)).c_str(), error);
+ return;
+ }
+
+ hwc2_compat_out_fences_t* fences;
+ error = hwc2_compat_display_get_release_fences(
+ hwcDisplay, &fences);
+
+ if (error != HWC2_ERROR_NONE) {
+ HYBRIS_ERROR("presentAndGetReleaseFences: Failed to get release fences "
+ "for display %lu: %s (%d)",
+ displayId, to_string(static_cast<HWC2::Error>(error)).c_str(),
+ error);
+ return;
+ }
+
+ int fenceFd = hwc2_compat_out_fences_get_fence(fences, layer);
+ if (fenceFd != -1)
+ setFenceBufferFd(buffer, fenceFd);
+
+ hwc2_compat_out_fences_destroy(fences);
+
+ if (lastPresentFence != -1) {
+ sync_wait(lastPresentFence, -1);
+ close(lastPresentFence);
+ }
+ lastPresentFence = presentFence;
+}
+
+void onVsyncReceived(HWC2EventListener* listener, int32_t sequenceId,
+ hwc2_display_t display, int64_t timestamp)
+{
+}
+
+void onHotplugReceived(HWC2EventListener* listener, int32_t sequenceId,
+ hwc2_display_t display, bool connected,
+ bool primaryDisplay)
+{
+ HYBRIS_INFO("onHotplugReceived(%d, %" PRIu64 ", %s, %s)",
+ sequenceId, display,
+ connected ?
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309132944.5.g9e81253.tar.bz2/libhybris/hybris/tests/test_hwcomposer.cpp
^
|
@@ -26,9 +26,11 @@
#include <stdio.h>
#include <math.h>
#include <stddef.h>
+#include <hwcomposer_window.h>
+#include <hardware/hardware.h>
+#include <hardware/hwcomposer.h>
#include <malloc.h>
-
-#include "test_common.h"
+#include <sync/sync.h>
const char vertex_src [] =
" \
@@ -57,6 +59,16 @@
} \
";
+GLuint load_shader(const char *shader_source, GLenum type)
+{
+ GLuint shader = glCreateShader(type);
+
+ glShaderSource(shader, 1, &shader_source, NULL);
+ glCompileShader(shader);
+
+ return shader;
+}
+
GLfloat norm_x = 0.0;
GLfloat norm_y = 0.0;
@@ -77,6 +89,64 @@
0.0, 1., 0.0
};
+
+class HWComposer : public HWComposerNativeWindow
+{
+ private:
+ hwc_layer_1_t *fblayer;
+ hwc_composer_device_1_t *hwcdevice;
+ hwc_display_contents_1_t **mlist;
+ protected:
+ void present(HWComposerNativeWindowBuffer *buffer);
+
+ public:
+
+ HWComposer(unsigned int width, unsigned int height, unsigned int format, hwc_composer_device_1_t *device, hwc_display_contents_1_t **mList, hwc_layer_1_t *layer);
+ void set();
+};
+
+HWComposer::HWComposer(unsigned int width, unsigned int height, unsigned int format, hwc_composer_device_1_t *device, hwc_display_contents_1_t **mList, hwc_layer_1_t *layer) : HWComposerNativeWindow(width, height, format)
+{
+ fblayer = layer;
+ hwcdevice = device;
+ mlist = mList;
+}
+
+void HWComposer::present(HWComposerNativeWindowBuffer *buffer)
+{
+ int oldretire = mlist[0]->retireFenceFd;
+ mlist[0]->retireFenceFd = -1;
+ fblayer->handle = buffer->handle;
+ fblayer->acquireFenceFd = getFenceBufferFd(buffer);
+ fblayer->releaseFenceFd = -1;
+ int err = hwcdevice->prepare(hwcdevice, HWC_NUM_DISPLAY_TYPES, mlist);
+ assert(err == 0);
+
+ err = hwcdevice->set(hwcdevice, HWC_NUM_DISPLAY_TYPES, mlist);
+ // in android surfaceflinger ignores the return value as not all display types may be supported
+ setFenceBufferFd(buffer, fblayer->releaseFenceFd);
+
+ if (oldretire != -1)
+ {
+ sync_wait(oldretire, -1);
+ close(oldretire);
+ }
+}
+
+inline static uint32_t interpreted_version(hw_device_t *hwc_device)
+{
+ uint32_t version = hwc_device->version;
+
+ if ((version & 0xffff0000) == 0) {
+ // Assume header version is always 1
+ uint32_t header_version = 1;
+
+ // Legacy version encoding
+ version = (version << 16) | header_version;
+ }
+ return version;
+}
+
int main(int argc, char **argv)
{
EGLDisplay display;
@@ -97,7 +167,134 @@
EGLBoolean rv;
- HWComposer *win = create_hwcomposer_window();
+ int err;
+
+ hw_module_t const* module = NULL;
+ err = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &module);
+ assert(err == 0);
+ framebuffer_device_t* fbDev = NULL;
+ framebuffer_open(module, &fbDev);
+
+ hw_module_t *hwcModule = 0;
+ hwc_composer_device_1_t *hwcDevicePtr = 0;
+
+ err = hw_get_module(HWC_HARDWARE_MODULE_ID, (const hw_module_t **) &hwcModule);
+ assert(err == 0);
+
+ err = hwc_open_1(hwcModule, &hwcDevicePtr);
+ assert(err == 0);
+
+ hw_device_t *hwcDevice = &hwcDevicePtr->common;
+
+ uint32_t hwc_version = interpreted_version(hwcDevice);
+
+#ifdef HWC_DEVICE_API_VERSION_1_4
+ if (hwc_version == HWC_DEVICE_API_VERSION_1_4) {
+ hwcDevicePtr->setPowerMode(hwcDevicePtr, 0, HWC_POWER_MODE_NORMAL);
+ } else
+#endif
+#ifdef HWC_DEVICE_API_VERSION_1_5
+ if (hwc_version == HWC_DEVICE_API_VERSION_1_5) {
+ hwcDevicePtr->setPowerMode(hwcDevicePtr, 0, HWC_POWER_MODE_NORMAL);
+ } else
+#endif
+ hwcDevicePtr->blank(hwcDevicePtr, 0, 0);
+
+ uint32_t configs[5];
+ size_t numConfigs = 5;
+
+ err = hwcDevicePtr->getDisplayConfigs(hwcDevicePtr, 0, configs, &numConfigs);
+ assert (err == 0);
+
+ int32_t attr_values[2];
+ uint32_t attributes[] = { HWC_DISPLAY_WIDTH, HWC_DISPLAY_HEIGHT, HWC_DISPLAY_NO_ATTRIBUTE };
+
+ hwcDevicePtr->getDisplayAttributes(hwcDevicePtr, 0,
+ configs[0], attributes, attr_values);
+
+ printf("width: %i height: %i\n", attr_values[0], attr_values[1]);
+
+ size_t size = sizeof(hwc_display_contents_1_t) + 2 * sizeof(hwc_layer_1_t);
+ hwc_display_contents_1_t *list = (hwc_display_contents_1_t *) malloc(size);
+ hwc_display_contents_1_t **mList = (hwc_display_contents_1_t **) malloc(HWC_NUM_DISPLAY_TYPES * sizeof(hwc_display_contents_1_t *));
+ const hwc_rect_t r = { 0, 0, attr_values[0], attr_values[1] };
+
+ int counter = 0;
+ for (; counter < HWC_NUM_DISPLAY_TYPES; counter++)
+ mList[counter] = NULL;
+
+ // Assign the layer list only to the first display,
+ // otherwise HWC might freeze if others are disconnected
+ mList[0] = list;
+
+ hwc_layer_1_t *layer = &list->hwLayers[0];
+ memset(layer, 0, sizeof(hwc_layer_1_t));
+ layer->compositionType = HWC_FRAMEBUFFER;
+ layer->hints = 0;
+ layer->flags = 0;
+ layer->handle = 0;
+ layer->transform = 0;
+ layer->blending = HWC_BLENDING_NONE;
+#ifdef HWC_DEVICE_API_VERSION_1_3
+ layer->sourceCropf.top = 0.0f;
+ layer->sourceCropf.left = 0.0f;
+ layer->sourceCropf.bottom = (float) attr_values[1];
+ layer->sourceCropf.right = (float) attr_values[0];
+#else
+ layer->sourceCrop = r;
+#endif
+ layer->displayFrame = r;
+ layer->visibleRegionScreen.numRects = 1;
+ layer->visibleRegionScreen.rects = &layer->displayFrame;
+ layer->acquireFenceFd = -1;
+ layer->releaseFenceFd = -1;
+#if (ANDROID_VERSION_MAJOR >= 4) && (ANDROID_VERSION_MINOR >= 3) || (ANDROID_VERSION_MAJOR >= 5)
+ // We've observed that qualcomm chipsets enters into compositionType == 6
+ // (HWC_BLIT), an undocumented composition type which gives us rendering
+ // glitches and warnings in logcat. By setting the planarAlpha to non-
+ // opaque, we attempt to force the HWC into using HWC_FRAMEBUFFER for this
+ // layer so the HWC_FRAMEBUFFER_TARGET layer actually gets used.
+ bool tryToForceGLES = getenv("QPA_HWC_FORCE_GLES") != NULL;
+ layer->planeAlpha = tryToForceGLES ? 1 : 255;
+#endif
+#ifdef HWC_DEVICE_API_VERSION_1_5
+ layer->surfaceDamage.numRects = 0;
+#endif
+
+ layer = &list->hwLayers[1];
+ memset(layer, 0, sizeof(hwc_layer_1_t));
+ layer->compositionType = HWC_FRAMEBUFFER_TARGET;
+ layer->hints = 0;
+ layer->flags = 0;
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309132944.5.g9e81253.tar.bz2/libhybris/hybris/tests/test_input.c
^
|
@@ -79,5 +79,4 @@
android_input_stack_stop();
android_input_stack_shutdown();
- return 0;
}
|
[-]
[+]
|
Added |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309132944.5.g9e81253.tar.bz2/libhybris/hybris/tests/test_media.c
^
|
@@ -0,0 +1,370 @@
+/*
+ * Copyright (C) 2013 Canonical 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.
+ *
+ * Authored by: Jim Hodapp <jim.hodapp@canonical.com>
+ * Ricardo Salveti de Araujo <ricardo.salveti@canonical.com>
+ */
+
+#include <hybris/media/media_compatibility_layer.h>
+#include <hybris/surface_flinger/surface_flinger_compatibility_layer.h>
+
+#include <EGL/egl.h>
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdbool.h>
+#include <limits.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+enum {
+ OK = 0,
+ NO_ERROR = 0,
+};
+
+static float DestWidth = 0.0, DestHeight = 0.0;
+// Actual video dimmensions
+static int Width = 0, Height = 0;
+
+static GLuint gProgram;
+static GLuint gaPositionHandle, gaTexHandle, gsTextureHandle, gmTexMatrix;
+
+static GLfloat positionCoordinates[8];
+
+struct MediaPlayerWrapper *player = NULL;
+
+void calculate_position_coordinates()
+{
+ // Assuming cropping output for now
+ float x = 1, y = 1;
+
+ // Black borders
+ x = (float) (Width / DestWidth);
+ y = (float) (Height / DestHeight);
+
+ // Make the larger side be 1
+ if (x > y) {
+ y /= x;
+ x = 1;
+ } else {
+ x /= y;
+ y = 1;
+ }
+
+ positionCoordinates[0] = -x;
+ positionCoordinates[1] = y;
+ positionCoordinates[2] = -x;
+ positionCoordinates[3] = -y;
+ positionCoordinates[4] = x;
+ positionCoordinates[5] = -y;
+ positionCoordinates[6] = x;
+ positionCoordinates[7] = y;
+}
+
+struct ClientWithSurface
+{
+ struct SfClient* client;
+ struct SfSurface* surface;
+};
+
+struct ClientWithSurface client_with_surface(bool setup_surface_with_egl)
+{
+ struct ClientWithSurface cs;
+
+ cs.client = sf_client_create();
+
+ if (!cs.client) {
+ printf("Problem creating client ... aborting now.");
+ return cs;
+ }
+
+ static const size_t primary_display = 0;
+
+ DestWidth = sf_get_display_width(primary_display);
+ DestHeight = sf_get_display_height(primary_display);
+ printf("Primary display width: %f, height: %f\n", DestWidth, DestHeight);
+
+ SfSurfaceCreationParameters params = {
+ 0,
+ 0,
+ DestWidth,
+ DestHeight,
+ -1, //PIXEL_FORMAT_RGBA_8888,
+ 15000,
+ 0.5f,
+ setup_surface_with_egl, // Do not associate surface with egl, will be done by camera HAL
+ "MediaCompatLayerTestSurface"
+ };
+
+ cs.surface = sf_surface_create(cs.client, ¶ms);
+
+ if (!cs.surface) {
+ printf("Problem creating surface ... aborting now.");
+ return cs;
+ }
+
+ sf_surface_make_current(cs.surface);
+
+ return cs;
+}
+
+static const char *vertex_shader()
+{
+ return
+ "attribute vec4 a_position; \n"
+ "attribute vec2 a_texCoord; \n"
+ "uniform mat4 m_texMatrix; \n"
+ "varying vec2 v_texCoord; \n"
+ "varying float topDown; \n"
+ "void main() \n"
+ "{ \n"
+ " gl_Position = a_position; \n"
+ " v_texCoord = (m_texMatrix * vec4(a_texCoord, 0.0, 1.0)).xy;\n"
+ "} \n";
+}
+
+static const char *fragment_shader()
+{
+ return
+ "#extension GL_OES_EGL_image_external : require \n"
+ "precision mediump float; \n"
+ "varying vec2 v_texCoord; \n"
+ "uniform samplerExternalOES s_texture; \n"
+ "void main() \n"
+ "{ \n"
+ " gl_FragColor = texture2D( s_texture, v_texCoord );\n"
+ "} \n";
+}
+
+static GLuint loadShader(GLenum shaderType, const char* pSource)
+{
+ GLuint shader = glCreateShader(shaderType);
+
+ if (shader) {
+ glShaderSource(shader, 1, &pSource, NULL);
+ glCompileShader(shader);
+ GLint compiled = 0;
+ glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled);
+
+ if (!compiled) {
+ GLint infoLen = 0;
+ glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
+ if (infoLen) {
+ char* buf = (char*) malloc(infoLen);
+ if (buf) {
+ glGetShaderInfoLog(shader, infoLen, NULL, buf);
+ fprintf(stderr, "Could not compile shader %d:\n%s\n",
+ shaderType, buf);
+ free(buf);
+ }
+ glDeleteShader(shader);
+ shader = 0;
+ }
+ }
+ } else {
+ printf("Error, during shader creation: %i\n", glGetError());
+ }
+
+ return shader;
+}
+
+static GLuint create_program(const char* pVertexSource, const char* pFragmentSource)
+{
+ GLuint vertexShader = loadShader(GL_VERTEX_SHADER, pVertexSource);
+ if (!vertexShader) {
+ printf("vertex shader not compiled\n");
+ return 0;
+ }
+
+ GLuint pixelShader = loadShader(GL_FRAGMENT_SHADER, pFragmentSource);
+ if (!pixelShader) {
+ printf("frag shader not compiled\n");
|
[-]
[+]
|
Added |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309132944.5.g9e81253.tar.bz2/libhybris/hybris/tests/test_recorder.c
^
|
@@ -0,0 +1,486 @@
+/*
+ * Copyright (C) 2013 Canonical 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.
+ *
+ * Authored by: Jim Hodapp <jim.hodapp@canonical.com>
+ * Guenter Schwann <guenter.schwann@canonical.com>
+ * Ricardo Salveti de Araujo <ricardo.salveti@canonical.com>
+ */
+
+#include <hybris/camera/camera_compatibility_layer.h>
+#include <hybris/camera/camera_compatibility_layer_capabilities.h>
+
+#include <hybris/media/recorder_compatibility_layer.h>
+
+#include <hybris/input/input_stack_compatibility_layer.h>
+#include <hybris/input/input_stack_compatibility_layer_codes_key.h>
+#include <hybris/input/input_stack_compatibility_layer_flags_key.h>
+
+#include <hybris/surface_flinger/surface_flinger_compatibility_layer.h>
+
+#include <EGL/egl.h>
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdbool.h>
+#include <limits.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+int shot_counter = 1;
+int32_t current_zoom_level = 1;
+bool new_camera_frame_available = true;
+struct MediaRecorderWrapper *mr = 0;
+GLuint preview_texture_id = 0;
+
+static GLuint gProgram;
+static GLuint gaPositionHandle, gaTexHandle, gsTextureHandle, gmTexMatrix;
+
+void error_msg_cb(void* context)
+{
+ printf("%s \n", __PRETTY_FUNCTION__);
+}
+
+void shutter_msg_cb(void* context)
+{
+ printf("%s \n", __PRETTY_FUNCTION__);
+}
+
+void zoom_msg_cb(void* context, int32_t new_zoom_level)
+{
+ printf("%s \n", __PRETTY_FUNCTION__);
+
+ current_zoom_level = new_zoom_level;
+}
+
+void autofocus_msg_cb(void* context)
+{
+ printf("%s \n", __PRETTY_FUNCTION__);
+}
+
+void raw_data_cb(void* data, uint32_t data_size, void* context)
+{
+ printf("%s: %d \n", __PRETTY_FUNCTION__, data_size);
+}
+
+void jpeg_data_cb(void* data, uint32_t data_size, void* context)
+{
+ printf("%s: %d \n", __PRETTY_FUNCTION__, data_size);
+ struct CameraControl* cc = (struct CameraControl*) context;
+ android_camera_start_preview(cc);
+}
+
+void size_cb(void* ctx, int width, int height)
+{
+ printf("Supported size: [%d,%d]\n", width, height);
+}
+
+void preview_texture_needs_update_cb(void* ctx)
+{
+ new_camera_frame_available = true;
+}
+
+void on_new_input_event(struct Event* event, void* context)
+{
+ assert(context);
+
+ if (event->type == KEY_EVENT_TYPE && event->action == ISCL_KEY_EVENT_ACTION_UP) {
+ printf("We have got a key event: %d \n", event->details.key.key_code);
+
+ struct CameraControl* cc = (struct CameraControl*) context;
+
+ int ret;
+ switch (event->details.key.key_code) {
+ case ISCL_KEYCODE_VOLUME_UP:
+ printf("Starting video recording\n");
+
+ android_camera_unlock(cc);
+
+ ret = android_recorder_setCamera(mr, cc);
+ if (ret < 0) {
+ printf("android_recorder_setCamera() failed\n");
+ return;
+ }
+ //state initial / idle
+ ret = android_recorder_setAudioSource(mr, ANDROID_AUDIO_SOURCE_CAMCORDER);
+ if (ret < 0) {
+ printf("android_recorder_setAudioSource() failed\n");
+ return;
+ }
+ ret = android_recorder_setVideoSource(mr, ANDROID_VIDEO_SOURCE_CAMERA);
+ if (ret < 0) {
+ printf("android_recorder_setVideoSource() failed\n");
+ return;
+ }
+ //state initialized
+ ret = android_recorder_setOutputFormat(mr, ANDROID_OUTPUT_FORMAT_MPEG_4);
+ if (ret < 0) {
+ printf("android_recorder_setOutputFormat() failed\n");
+ return;
+ }
+ //state DataSourceConfigured
+ ret = android_recorder_setAudioEncoder(mr, ANDROID_AUDIO_ENCODER_AAC);
+ if (ret < 0) {
+ printf("android_recorder_setAudioEncoder() failed\n");
+ return;
+ }
+ ret = android_recorder_setVideoEncoder(mr, ANDROID_VIDEO_ENCODER_H264);
+ if (ret < 0) {
+ printf("android_recorder_setVideoEncoder() failed\n");
+ return;
+ }
+
+ int fd;
+ fd = open("/tmp/test_video_recorder.avi", O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
+ if (fd < 0) {
+ printf("Could not open file for video recording\n");
+ printf("FD: %i\n", fd);
+ return;
+ }
+ ret = android_recorder_setOutputFile(mr, fd);
+ if (ret < 0) {
+ printf("android_recorder_setOutputFile() failed\n");
+ return;
+ }
+
+ ret = android_recorder_setVideoSize(mr, 1280, 720);
+ if (ret < 0) {
+ printf("android_recorder_setVideoSize() failed\n");
+ return;
+ }
+ ret = android_recorder_setVideoFrameRate(mr, 30);
+ if (ret < 0) {
+ printf("android_recorder_setVideoFrameRate() failed\n");
+ return;
+ }
+
+ ret = android_recorder_prepare(mr);
+ if (ret < 0) {
+ printf("android_recorder_prepare() failed\n");
+ return;
+ }
+ //state prepared
+ ret = android_recorder_start(mr);
+ if (ret < 0) {
+ printf("android_recorder_start() failed\n");
+ return;
+ }
+ break;
+ case ISCL_KEYCODE_VOLUME_DOWN:
+ printf("Stoping video recording\n");
+ ret = android_recorder_stop(mr);
+
+ printf("Stoping video recording returned\n");
+ if (ret < 0) {
+ printf("android_recorder_stop() failed\n");
+ return;
+ }
+ printf("Stopped video recording\n");
+ ret = android_recorder_reset(mr);
+ if (ret < 0) {
+ printf("android_recorder_reset() failed\n");
+ return;
|
[-]
[+]
|
Added |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309132944.5.g9e81253.tar.bz2/libhybris/hybris/tests/test_sf.c
^
|
@@ -0,0 +1,251 @@
+/*
+ * Copyright (C) 2013 Canonical 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.
+ *
+ * Authored by: Thomas Voss <thomas.voss@canonical.com>
+ * Ricardo Salveti de Araujo <ricardo.salveti@canonical.com>
+ */
+
+#include <android-config.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <limits.h>
+
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+
+#include <hybris/surface_flinger/surface_flinger_compatibility_layer.h>
+
+struct SfSurface* sf_surface_create(struct SfClient* client, SfSurfaceCreationParameters* params);
+EGLSurface sf_surface_get_egl_surface(struct SfSurface*);
+void sf_surface_make_current(struct SfSurface* surface);
+
+void sf_surface_move_to(struct SfSurface* surface, int x, int y);
+void sf_surface_set_layer(struct SfSurface* surface, int layer);
+void sf_surface_set_alpha(struct SfSurface* surface, float alpha);
+
+double rotation_increment = 0.01;
+
+/* animation state variables */
+GLfloat rotation_angle = 0.0f;
+
+static GLuint gProgram;
+static GLuint gvPositionHandle, gvColorHandle;
+static GLuint rotation_uniform;
+static GLint num_vertex = 3;
+static const GLfloat triangle[] = {
+ -0.125f, -0.125f, 0.0f, 0.5f,
+ 0.0f, 0.125f, 0.0f, 0.5f,
+ 0.125f, -0.125f, 0.0f, 0.5f };
+static const GLfloat color_triangle[] = {
+ 0.0f, 0.0f, 1.0f, 1.0f,
+ 0.0f, 1.0f, 0.0f, 1.0f,
+ 1.0f, 0.0f, 0.0f, 0.0f };
+const GLfloat * vertex_data;
+const GLfloat * color_data;
+static const char gVertexShader[] =
+ "attribute vec4 vPosition;\n"
+ "attribute vec4 vColor;\n"
+ "uniform float angle;\n"
+ "varying vec4 colorinfo;\n"
+ "void main() {\n"
+ " mat3 rot_z = mat3( vec3( cos(angle), sin(angle), 0.0),\n"
+ " vec3(-sin(angle), cos(angle), 0.0),\n"
+ " vec3( 0.0, 0.0, 1.0));\n"
+ " gl_Position = vec4(rot_z * vPosition.xyz, 1.0);\n"
+ " colorinfo = vColor;\n"
+ "}\n";
+
+static const char gFragmentShader[] = "precision mediump float;\n"
+ "varying vec4 colorinfo;\n"
+ "void main() {\n"
+ " gl_FragColor = colorinfo;\n"
+ "}\n";
+
+/* util functions */
+GLuint loadShader(GLenum shaderType, const char* pSource)
+{
+ GLuint shader = glCreateShader(shaderType);
+ if (shader) {
+ glShaderSource(shader, 1, &pSource, NULL);
+ glCompileShader(shader);
+ GLint compiled = 0;
+ glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled);
+
+ if (!compiled) {
+ GLint infoLen = 0;
+ glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
+ if (infoLen) {
+ char* buf = (char*) malloc(infoLen);
+ if (buf) {
+ glGetShaderInfoLog(shader, infoLen, NULL, buf);
+ fprintf(stderr, "Could not compile shader %d:\n%s\n",
+ shaderType, buf);
+ free(buf);
+ }
+ glDeleteShader(shader);
+ shader = 0;
+ }
+ }
+ } else {
+ printf("Error, during shader creation: %i\n", glGetError());
+ }
+
+ return shader;
+}
+
+GLuint createProgram(const char* pVertexSource, const char* pFragmentSource)
+{
+ GLuint vertexShader = loadShader(GL_VERTEX_SHADER, pVertexSource);
+ if (!vertexShader) {
+ printf("vertex shader not compiled\n");
+ return 0;
+ }
+
+ GLuint pixelShader = loadShader(GL_FRAGMENT_SHADER, pFragmentSource);
+ if (!pixelShader) {
+ printf("frag shader not compiled\n");
+ return 0;
+ }
+
+ GLuint program = glCreateProgram();
+ if (program) {
+ glAttachShader(program, vertexShader);
+ glAttachShader(program, pixelShader);
+ glLinkProgram(program);
+ GLint linkStatus = GL_FALSE;
+ glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);
+
+ if (linkStatus != GL_TRUE) {
+ GLint bufLength = 0;
+ glGetProgramiv(program, GL_INFO_LOG_LENGTH, &bufLength);
+ if (bufLength) {
+ char* buf = (char*) malloc(bufLength);
+ if (buf) {
+ glGetProgramInfoLog(program, bufLength, NULL, buf);
+ fprintf(stderr, "Could not link program:\n%s\n", buf);
+ free(buf);
+ }
+ }
+ glDeleteProgram(program);
+ program = 0;
+ }
+ }
+
+ return program;
+}
+
+int setupGraphics()
+{
+ vertex_data = triangle;
+ color_data = color_triangle;
+
+ gProgram = createProgram(gVertexShader, gFragmentShader);
+ if (!gProgram) {
+ printf("error making program\n");
+ return 0;
+ }
+
+ gvPositionHandle = glGetAttribLocation(gProgram, "vPosition");
+ gvColorHandle = glGetAttribLocation(gProgram, "vColor");
+
+ rotation_uniform = glGetUniformLocation(gProgram, "angle");
+
+ return 1;
+}
+
+void hw_render(EGLDisplay displ, EGLSurface surface)
+{
+ glUseProgram(gProgram);
+
+ glClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
+
+ glUniform1fv(rotation_uniform,1, &rotation_angle);
+
+ glVertexAttribPointer(gvColorHandle, num_vertex, GL_FLOAT, GL_FALSE, sizeof(GLfloat)*4, color_data);
+ glVertexAttribPointer(gvPositionHandle, num_vertex, GL_FLOAT, GL_FALSE, 0, vertex_data);
+ glEnableVertexAttribArray(gvPositionHandle);
+ glEnableVertexAttribArray(gvColorHandle);
+
+ glDrawArrays(GL_TRIANGLE_STRIP, 0, num_vertex);
+ glDisableVertexAttribArray(gvPositionHandle);
+ glDisableVertexAttribArray(gvColorHandle);
+
+ eglSwapBuffers(displ, surface);
+}
+
+void hw_step()
+{
+ rotation_angle += rotation_increment;
+ return;
+}
+
+int main(int argc, char** argv)
+{
+ struct SfClient* sf_client = sf_client_create();
+
+ if (!sf_client) {
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.32+test_hwcomposer.20210309132944.5.g9e81253.tar.bz2/libhybris/hybris/tests/test_wifi.c
^
|
@@ -20,7 +20,6 @@
#include <android-config.h>
-int is_wifi_driver_loaded();
int wifi_load_driver();
int wifi_unload_driver();
|