+++ /dev/null
-############################################################
-# Makefile for GLES 2.x test application
-# Created by yigl - 090113
-############################################################
-
-############################################################
-# configuration
-############################################################
-
-NULL =
-
-TOOLCHAIN_PREFIX =
-
-# Application name
-
-BIN_NAME = tpl-test
-
-# Debugging mode: yes, no
-DEBUG_MODE = yes
-
-# Project path
-INSTALL_DIR = /usr/bin
-
-# WS_NULL, WS_X11
-NATIVE_WIN = WS_WL
-#NATIVE_WIN = WS_NULL
-
-# Defines
-DEFS =
-
-# Required packages
-REQ_PKGS =
-
-# LDFLAGS
-LDFLAGS = -lm -lrt -lpthread -ltpl-egl # -lEGL -lGLESv2
-
-SUPPORT_LIBPNG=0
-ifeq ($(SUPPORT_LIBPNG), 1)
-REQ_PKGS += libpng
-endif
-
-# Hostname
-HOST_NAME = `uname -n`
-
-
-# Checks GLES core
-#ifeq ($(GLES_CORE), C110_SGX540)
-# DEFS += -DGLES_C110_SGX540
-# REQ_PKGS += opengl-es-20
-#endif
-REQ_PKGS += gles20
-
-# Checks window system
-ifeq ($(NATIVE_WIN), WS_NULL)
- DEFS += -DWS_NULL
- REQ_PKGS +=
- C_SRCS += \
- src/gfx_native_wnd_null.c \
- $(NULL)
-endif
-
-ifeq ($(NATIVE_WIN), WS_X11)
- DEFS += -DWS_X11
-REQ_PKGS += x11 xext libdrm libtbm libudev
- C_HEADERS+= \
- src/gfx_util_x11.h \
- src/gfx_egl_x11.h \
- src/gfx_data_00.h \
- src/gfx_data_01.h \
- src/gfx_data_02.h \
- $(NULL)
- C_SRCS += \
- src/gfx_native_wnd_x11.c \
- src/gfx_util_x11.c \
- src/gfx_egl_x11.c \
- src/gfx_test_gles_horizontal_tearing_with_xevent.c \
- src/gfx_test_gles_inconsistent_rendering.c \
- src/gfx_test_gles_inconsistent_rendering_with_xevent.c \
- src/gfx_test_gles_measure_perf_with_xevent.c \
- src/gfx_test_egl_client_pixmap_basic.c \
- src/gfx_test_egl_client_pixmap_glReadPixels.c \
- src/gfx_test_egl_pixmap_surface_pixmap.c \
- src/gfx_test_egl_pixmap_surface_x11_n_gles_rendering.c \
- src/gfx_test_egl_pixmap_surface_glReadPixels.c \
- src/gfx_test_egl_pixmap_surface_pixmap_eglimage.c \
- src/gfx_test_egl_window_surface_resize_x11_window.c \
- src/gfx_test_egl_window_surface_transparency.c \
- src/gfx_test_egl_EGL_texture_from_pixmap.c \
- src/gfx_test_eglimg_texture_from_pixmap.c \
- src/gfx_test_eglimg_texture_from_pixmap_many_imgs.c \
- src/gfx_test_eglimg_texture_from_pixmap_width.c \
- src/gfx_test_eglimg_texture_from_pixmap_multi_thread.c \
- src/gfx_test_eglimg_texture_from_pixmap_multi_thread2.c \
- src/gfx_test_gles_wagonwheel_effect.c \
- src/gfx_test_eglimg_rgb_yuv_texture.c\
- src/gfx_test_eglimg_rgb_yuv_texture_format.c\
- $(NULL)
-endif
-
-
-ifeq ($(NATIVE_WIN), WS_WL)
- DEFS += -DWS_WL
-REQ_PKGS += wayland wayland-client wayland-egl wayland-drm libdrm libtbm libudev
- C_HEADERS+= \
-# src/gfx_util_x11.h \
- src/gfx_egl_x11.h \
- src/gfx_data_00.h \
- src/gfx_data_01.h \
- src/gfx_data_02.h \
- $(NULL)
- C_SRCS += \
- # src/gfx_native_wnd_wayland.c \
- src/gfx_util_wayland.c \
- src/gfx_egl_x11.c \
- src/gfx_test_gles_inconsistent_rendering.c \
- src/gfx_test_egl_window_surface_transparency.c \
- $(NULL)
-endif
-
-############################################################
-# build tools
-############################################################
-
-CPP = $(TOOLCHAIN_PREFIX)cpp
-CC = $(TOOLCHAIN_PREFIX)gcc
-CXX = $(TOOLCHAIN_PREFIX)g++
-LD = $(TOOLCHAIN_PREFIX)ld
-
-############################################################
-# tool flags
-############################################################
-
-CPP_FLAGS = \
- -fPIC \
- -Wall \
- -I$(PWD)/src \
- $(DEFS) \
- -DBLD_HOST_NAME=\"$(HOST_NAME)\" \
- -I/usr/include/libdrm/ `pkg-config --cflags $(REQ_PKGS)` \
- $(NULL)
-
-ifeq ($(SUPPORT_LIBPNG), 1)
-CPP_FLAGS += -DSUPPORT_LIBPNG
-endif
-
-CFLAGS = \
- $(CPP_FLAGS) \
- $(NULL)
-
-CXXFLAGS = \
- $(CPP_FLAGS) \
- $(NULL)
-
-ifeq ($(DEBUG_MODE), yes)
- CFLAGS += -g -DGFX_ENABLE_LOG=1
- CXXFLAGS += -g -DGFX_ENABLE_LOG=1
-else
-# CFLAGS += -O2
-# CXXFLAGS += -O2
- CFLAGS += -g
- CXXFLAGS += -g
-endif
-
-############################################################
-# library path and libs
-############################################################
-
-LDFLAGS += \
- `pkg-config --libs $(REQ_PKGS)` -lwayland-client -ludev -ltbm -lwayland-egl -ldrm\
- $(NULL)
-
-############################################################
-# sources
-############################################################
-
-#C_HEADERS += \
- src/gfx_platform.h \
- src/gfx_util.h \
- src/gfx_list.h \
- src/gfx_egl.h \
- src/gfx_test.h \
- $(NULL)
-C_HEADERS += src/tpl_test_util.h #src/gfx_egl.h
-C_SRCS += \
- src/main.c src/tpl_test_surface.c src/tpl_test_display.c src/tpl_test_object.c src/tpl_test_buffer.c
- #src/gfx_util.c src/gfx_test_eglimg_map_render_basic.c src/main.c
- #src/gfx_list.c \
- src/gfx_egl_common.c \
- src/gfx_test_egl_memory.c \
- src/gfx_test_gles_ext_basic.c \
- src/gfx_test_egl_color_buffer_preservation.c \
- src/gfx_test_gles_tex_mapping.c \
- src/gfx_test_gles_tex_mapping_type.c \
- src/gfx_test_gles_tex_render_basic.c \
- src/gfx_test_gles_tex_render_many_objs.c \
- src/gfx_test_gles_tex_update_basic.c \
- src/gfx_test_gles_tex_update_non_multiple_of_32.c \
- src/gfx_test_eglimg_map_render_basic.c \
- src/gfx_test_eglimg_map_render_many_objs.c \
- src/gfx_test_eglimg_map_update_basic.c \
- src/gfx_test_eglimg_map_update_non_multiple_of_32.c \
- src/gfx_test_eglimg_map_update_width.c \
- src/gfx_test_eglimg_map_n_client_pixmap_render_basic.c \
- src/gfx_test_gles_stencil_operation.c \
- src/gfx_test_gles_GL_TRIANGLES.c \
- src/gfx_test_gles_landscape.c \
- src/gfx_test_gles_texture_width.c \
- src/gfx_test_gles_horizontal_tearing.c \
- src/gfx_test_gles_measure_perf_alpha_blending.c \
- src/gfx_test_gles_measure_perf_pixel_fillrate.c \
- src/gfx_test_gles_measure_perf_texel_fillrate.c \
- src/gfx_test_gles_fbo_basic.c \
- src/gfx_test_gles_frag_shader_basic.c \
- src/gfx_test_gles_tex_render_tga.c \
- src/gfx_test_gles_binary_shader_basic.c \
- src/gfx_test_gles_binary_program_basic.c \
- src/gfx_test_gles_fbo_multisample.c \
- src/gfx_test_eglimg_map_render_2d.c \
- src/gfx_test_egl_pbuffer_basic.c \
- src/gfx_test_gles_cube_tex_render_basic.c \
- src/gfx_test_gles_cube_tex_render_fbo.c \
- src/gfx_test_egl_swap_buffer_with_damage.c \
- src/gfx_test_gles_qcom_tile_partial_rendering.c \
- src/main.c \
- $(NULL)
-
-CXX_SRCS += \
- $(NULL)
-
-OBJS = \
- $(CXX_SRCS:%.cpp=%.o) \
- $(C_SRCS:%.c=%.o) \
- $(NULL)
-
-############################################################
-# targets and rules
-############################################################
-
-all: $(BIN_NAME)
-
-$(BIN_NAME): $(OBJS) $(C_HEADERS)
- $(CC) $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS)
-
-%.o: %.c
- $(CC) $(CFLAGS) -c $< -o $@
-
-%.o: %.cpp
- $(CXX) $(CXXFLAGS) -c $< -o $@
-
-install: $(BIN_NAME)
- cp -va $(BIN_NAME) $(INSTALL_DIR)
-
-clean:
- find . -name "*.o" -exec rm -vf {} \;
- find . -name "*~" -exec rm -vf {} \;
- rm -vf $(BIN_NAME)
+++ /dev/null
-Name: tpl-test
-Summary: test for tpl
-Version: 0.0.1
-Release: 01
-Group: System/X Hardware Support
-License: Samsung
-Source0: %{name}-%{version}.tar.gz
-BuildRequires: pkgconfig(libdrm)
-BuildRequires: pkgconfig(libudev)
-BuildRequires: pkgconfig(libtbm)
-BuildRequires: pkgconfig(gbm)
-BuildRequires: pkgconfig(wayland-client)
-BuildRequires: libwayland-egl-devel
-BuildRequires: libtpl-egl-devel
-%description
-The Simple Test Cases
-
-
-%prep
-%setup -q
-
-%build
-export LDFLAGS="${LDFLAGS} -rdynamic"
-make
-
-%install
-mkdir -p %{buildroot}/opt/usr/tpl-test
-cp -arp ./tpl-test %{buildroot}/opt/usr/tpl-test
-
-%files
-%manifest tpl-test.manifest
-%defattr(-,root,root,-)
-/opt/usr/tpl-test/*
+++ /dev/null
-#include <stdio.h>
-#include <stdlib.h>
-#include <memory.h>
-#include <math.h>
-#include <unistd.h>
-
-#include "tpl_test_util.h"
-
-#include <wayland-client.h>
-#include <wayland-egl.h>
-#include <tbm_surface.h>
-
-
-typedef struct _ProgOption ProgOption;
-
-typedef struct _ProgOption {
- int egl_r;
- int egl_g;
- int egl_b;
- int egl_a;
- int egl_d;
- int egl_s;
- int egl_preserved;
- int egl_swap_interval;
- int wnd_x;
- int wnd_y;
- int wnd_w;
- int wnd_h;
- int frames;
- int tc_num;
- int fps;
- bool all;
- bool show_names;
-};
-
-ProgOption g_option = {
- 8, 8, 8, 8,
- 24,
- 0,
- 0,
- 1,
- 0, 0,
- 1920, 1080,
- 1000,
- 0,
- 300,
- false,
- false
-};
-
-/* log related */
-#ifdef TPL_ENABLE_LOG
-bool
-__LOG( const char *func, int line, const char *fmt, ... )
-{
- char buff[NUM_ERR_STR] = { (char)0, };
- char str[NUM_ERR_STR] = { (char)0, };
- va_list args;
-
- va_start( args, fmt );
- vsprintf( buff, fmt, args );
- va_end( args );
-
- sprintf( str, "[tpl_test] %s[%d] %s", func, line, buff );
- printf( "ddk:[tpl_test] %s[%d] %s\n", func, line, buff );
- __tpl_test_log_display_msg( str );
-
- return true;
-}
-
-void
-__LOG_BEGIN( const char *func )
-{
- char str[NUM_ERR_STR] = { (char)0, };
- sprintf( str, "[tpl_test][B] %s", func );
- printf( "ddk:[tpl_test][B] %s\n", func );
- __tpl_test_log_display_msg( str );
-}
-
-void
-__LOG_END( const char *func )
-{
- char str[NUM_ERR_STR] = { (char)0, };
- sprintf( str, "[tpl_test][E] %s", func );
- printf( "ddk:[tpl_test][E] %s\n", func );
- __tpl_test_log_display_msg( str );
-}
-
-bool
-__tpl_test_log_display_msg( const char *msg )
-{
- fprintf( DEFAULT_LOG_STREAM, "%s\n", msg );
- fflush( DEFAULT_LOG_STREAM );
- return 1;
-}
-
-bool
-__LOG_ERR( const char *func, int line, const char *fmt, ... )
-{
- char buff[NUM_ERR_STR] = { (char)0, };
- char str[NUM_ERR_STR] = { (char)0, };
- va_list args;
-
- va_start( args, fmt );
- vsprintf( buff, fmt, args );
- va_end( args );
-
- sprintf( str, "[tpl_test] %s[%d] %s", func, line, buff );
-
- __tpl_test_log_display_msg( str );
-
- return true;
-}
-
-#endif /* TPL_ENABLE_LOG */
-
-/* wayland native related */
-registry_handle_global(void *data, struct wl_registry *registry, uint32_t id,
- const char *interface, uint32_t version)
-{
- TPLNativeWnd *that = (TPLNativeWnd *)(data);
-
- if (strcmp(interface, "wl_compositor") == 0) {
- that->compositor = wl_registry_bind(registry, id, &wl_compositor_interface, 1);
- } else if (strcmp(interface, "wl_shell") == 0) {
- that->shell = wl_registry_bind(registry, id, &wl_shell_interface, 1);
- } else if (strcmp(interface, "wl_output") == 0) {
- /*struct my_output *my_output = new struct my_output;
- memset(my_output, 0, sizeof(*my_output));
- my_output->output = wl_registry_bind(registry,id, &wl_output_interface, 2);*/
- }
-}
-
-void
-registry_handle_global_remove(void *data, struct wl_registry *registry,
- uint32_t name)
-{
-}
-
-const struct wl_registry_listener registry_listener_ = {
- registry_handle_global,
- registry_handle_global_remove
-};
-
-shell_surface_handle_ping(void *data, struct wl_shell_surface *shell_surface,
- uint32_t serial)
-{
- wl_shell_surface_pong(shell_surface, serial);
-}
-
-void
-shell_surface_handle_popup_done(void *data,
- struct wl_shell_surface *shell_surface)
-{
-}
-
-void
-shell_surface_handle_configure(void *data,
- struct wl_shell_surface *shell_surface, uint32_t edges, int32_t width,
- int32_t height)
-{
- TPLNativeWnd *that = (TPLNativeWnd *)(data);
- that->width = width;
- that->height = height;
- wl_egl_window_resize(that->wnd, width, height, 0, 0);
-}
-
-
-const struct wl_shell_surface_listener shell_surface_listener_ = {
- shell_surface_handle_ping,
- shell_surface_handle_configure,
- shell_surface_handle_popup_done
-};
-/* wayland native end */
-
-/* tpl_test related */
-TPLNativeWnd *
-tpl_test_native_wnd_create( void )
-{
- TPLNativeWnd *wnd = NULL;
-
- TPL_RSM_MALLOC( wnd, TPLNativeWnd );
-
- //wnd->dpy = (NativeDisplayType)NULL;
- wnd->dpy = (void *)NULL;
- wnd->screen = 0;
- //wnd->root = (NativeWindowType)NULL;
- wnd->root = (void *)NULL;
- //wnd->wnd = (NativeWindowType)NULL;
- wnd->wnd = (void *)NULL;
- wnd->x = 0;
- wnd->y = 0;
- wnd->width = 0;
- wnd->height = 0;
- wnd->depth = 0;
- tpl_display_t *tpl_display = NULL;
- tpl_surface_t *tpl_surf = NULL;
- tpl_buffer_t *tpl_buf = NULL;
-finish:
- return wnd;
-}
-
-bool
-tpl_test_native_wnd_initialize( TPLNativeWnd *wnd, int x, int y, int width,
- int height )
-{
- bool res = false;
-
- TPL_CHK_PARAM( !wnd );
- TPL_CHK_PARAM( x < 0 );
- TPL_CHK_PARAM( y < 0 );
- TPL_CHK_PARAM( width <= 0 );
- TPL_CHK_PARAM( height <= 0 );
-
- //wnd->dpy = (NativeDisplayType)wl_display_connect(NULL);
- wnd->dpy = (void *)wl_display_connect(NULL);
- if ( !wnd->dpy ) {
- __log_err( "wl_display_connect() is failed.");
- return res;
- }
-
- wnd->registry = wl_display_get_registry(wnd->dpy);
-
- wl_registry_add_listener(wnd->registry, ®istry_listener_, wnd);
-
- wl_display_roundtrip(wnd->dpy);
-
- wnd->x = x;
- wnd->y = y;
- wnd->width = width;
- wnd->height = height;
- wnd->depth = 32;
-
- wnd->surface = wl_compositor_create_surface(wnd->compositor);
- wnd->wnd = wl_egl_window_create(wnd->surface, wnd->width, wnd->height);
-
- wnd->shell_surface = wl_shell_get_shell_surface(wnd->shell, wnd->surface);
-
- wl_shell_surface_set_toplevel(wnd->shell_surface);
- if (wnd->shell_surface) {
- wl_shell_surface_add_listener(wnd->shell_surface, &shell_surface_listener_,
- wnd);
- }
-
- wl_shell_surface_set_title(wnd->shell_surface, "tpl_testtest");
-
- res = true;
-finish:
- return res;
-}
-
-bool
-tpl_test_native_wnd_finalize( TPLNativeWnd *wnd )
-{
- bool res = false;
-
- TPL_CHK_PARAM( !wnd );
- TPL_CHK_PARAM( !wnd->dpy );
-
- wl_egl_window_destroy(wnd->wnd);
- if (wnd->shell_surface)
- wl_shell_surface_destroy(wnd->shell_surface);
- if (wnd->surface)
- wl_surface_destroy(wnd->surface);
- if (wnd->shell)
- wl_shell_destroy(wnd->shell);
-
- if (wnd->compositor)
- wl_compositor_destroy(wnd->compositor);
-
- wl_registry_destroy(wnd->registry);
- wl_display_flush(wnd->dpy);
- wl_display_disconnect(wnd->dpy);
- //XCloseDisplay( (Display*)wnd->dpy );
-
- res = true;
-finish:
- return res;
-}
-
-bool
-tpl_test_finalize( TPLNativeWnd *wnd )
-{
- bool res = true;
-
- TPL_CHK_PARAM( !wnd );
-
- if (NULL != wnd->tpl_display) {
- tpl_object_unreference((tpl_object_t *)wnd->tpl_display);
- }
- if (NULL != wnd->tpl_surf) {
- tpl_object_unreference((tpl_object_t *)wnd->tpl_surf);
- }
-
- res = true;
-finish:
- return res;
-}
-
-
-void
-tpl_test_native_wnd_release( TPLNativeWnd *wnd )
-{
- TPL_CHK_PARAM( !wnd );
-
- TPL_RSM_FREE( wnd );
-finish:
- return;
-}
-
-void init_option()
-{
- g_option.egl_r = 8;
- g_option.egl_r = 8;
- g_option.egl_g = 8;
- g_option.egl_b = 8;
- g_option.egl_a = 8;
- g_option.egl_d = 24;
- g_option.egl_s = 0;
- g_option.egl_preserved = 0;
- g_option.egl_swap_interval = 1;
- g_option.wnd_x = 0;
- g_option.wnd_y = 0;
- g_option.wnd_w = 1920;
- g_option.wnd_h = 1080;
- g_option.frames = 10000;
- g_option.tc_num = 0;
- g_option.fps = 300;
- g_option.all = true;
- g_option.show_names = false;
-}
-static void
-print_usage( char *name )
-{
- fprintf( stderr, "\n" );
- fprintf( stderr, "Usage: %s [OPTION]...\n", name );
- fprintf( stderr, "\n" );
- fprintf( stderr, "TPL test program for the libtpl-egl\n");
- fprintf( stderr, " Build: " BLD_HOST_NAME " %s %s\n", __DATE__, __TIME__ );
- fprintf( stderr, "\n" );
- fprintf( stderr, "Options:\n" );
-
- fprintf( stderr, " -w Set width size of the window default: %d\n",
- g_option.wnd_w );
- fprintf( stderr, " -h Set height size of the window default: %d\n",
- g_option.wnd_h );
-
- fprintf( stderr, " -t Specify the test case number default: %d\n",
- g_option.tc_num );
- fprintf( stderr, " -a Run all test cases default: %s\n",
- g_option.all ? "true" : "false" );
- fprintf( stderr, " -l Show TC name default: %s\n",
- g_option.show_names ? "true" : "false" );
- fprintf( stderr, "\n" );
- exit( 1 );
-}
-
-static void
-check_option( int argc, char **argv )
-{
- int c;
- char *opt_str = NULL;
-
- while ( (c = getopt(argc, argv, "alc:d:s:p:x:y:w:h:f:t:F:i:")) != EOF ) {
- switch ( c ) {
- case 'c':
- opt_str = optarg;
- if ( strcmp(opt_str, "888") == 0 ) {
- g_option.egl_r = 8;
- g_option.egl_g = 8;
- g_option.egl_b = 8;
- g_option.egl_a = 0;
- } else if ( strcmp(opt_str, "8888") == 0 ) {
- g_option.egl_r = 8;
- g_option.egl_g = 8;
- g_option.egl_b = 8;
- g_option.egl_a = 8;
- } else if ( strcmp(opt_str, "565") == 0 ) {
- g_option.egl_r = 5;
- g_option.egl_g = 6;
- g_option.egl_b = 5;
- g_option.egl_a = 0;
- }
- break;
- case 'd':
- g_option.egl_d = atol( optarg );
- break;
- case 's':
- g_option.egl_s = atol( optarg );
- break;
- case 'p':
- g_option.egl_preserved = atol( optarg );
- break;
- case 'i':
- g_option.egl_swap_interval = atol( optarg );
- break;
- case 'x':
- g_option.wnd_x = atol( optarg );
- break;
- case 'y':
- g_option.wnd_y = atol( optarg );
- break;
- case 'w':
- g_option.wnd_w = atol( optarg );
- break;
- case 'h':
- g_option.wnd_h = atol( optarg );
- break;
- case 'f':
- g_option.frames = atol( optarg );
- break;
- case 't':
- g_option.tc_num = atol( optarg );
- g_option.all = false;
- break;
- case 'F':
- g_option.fps = atol( optarg );
- break;
- case 'a':
- g_option.all = true;
- break;
- case 'l':
- g_option.show_names = true;
- break;
- default:
- print_usage( argv[0] );
- break;
- }
- }
-
-}
-
-int tpl_test_log_level = 5;
-
-int
-main( int argc, char **argv )
-{
- TPLNativeWnd *wnd = NULL;
- bool res = false;
- int i = 0;
- int k = 0;
- int total_num_test = ( sizeof(tpl_test) / sizeof(TPLTest) ) - 1;
- int tc_num = 0;
- char *log_env;
- char *env;
-
- init_option();
- check_option( argc, argv );
-
- log_env = getenv("TPL_TEST_LOG_LEVEL");
- if (log_env != NULL) {
- tpl_test_log_level = atoi(log_env);
- }
-
- LOG("INFO", LOG_LEVEL_LOW, "tpl_test_log_level = %d", tpl_test_log_level);
-
- env = getenv("TEST_SLEEP");
- if (env && !strcmp(env, "yes")) {
- while (k < 20) {
- usleep(1000 * 1000);
- printf("sleep %d\n", k++);
- }
- }
-
- if ( g_option.show_names ) {
- printf( "-------------------------------------------------\n" );
- printf( " number of test cass: %d \n", total_num_test );
- printf( "-------------------------------------------------\n" );
- while ( tpl_test[i].name ) {
- printf( " [%2d] %s\n", i, tpl_test[i].name );
- i++;
- }
- printf( "-------------------------------------------------\n" );
-
- goto finish;
- }
-
- wnd = tpl_test_native_wnd_create();
- if ( !wnd ) goto finish;
-
- res = tpl_test_native_wnd_initialize( wnd,
- g_option.wnd_x,
- g_option.wnd_y,
- g_option.wnd_w,
- g_option.wnd_h );
- if ( !res ) goto finish;
-
- printf( "-------------------tpl test begin!!!-----------------------------------\n");
-
- if ( g_option.all ) {
- i = 0;
-
- while ( tpl_test[i].name ) {
- printf( "[%4d] %-50s", i, tpl_test[i].name );
-
- if ( tpl_test[i].run ) {
- if (true == tpl_test[i].run( wnd ))
- printf("[PASS]\n");
- else
- printf("[FAIL]\n");
- }
- i++;
- }
- } else {
- tc_num = g_option.tc_num;
-
- if ( tc_num < 0 || tc_num > total_num_test - 1 ) goto finish;
-
- //printf( "----------------------------------------------\n\n" );
- if ( tpl_test[tc_num].name ) printf( "[%4d] %-50s", tc_num,
- tpl_test[tc_num].name );
- else printf( "[%4d] No test name\n", tc_num );
-
- if ( tpl_test[tc_num].run ) {
- if (true == tpl_test[tc_num].run( wnd ))
- printf("[PASS]\n");
- else
- printf("[FAIL]\n");
- }
- //printf( "\n----------------------------------------------\n\n" );
- }
-
- printf("-------------------tpl test end!!!-------------------------------------\n");
-
-finish:
- if ( wnd ) {
- tpl_test_native_wnd_finalize( wnd );
- tpl_test_native_wnd_release( wnd );
- tpl_test_finalize( wnd );
- }
-
-
- return 0;
-}
-
+++ /dev/null
-#ifndef __TPL_BUF_TEST__
-#define __TPL_BUF_TEST__
-
-#include "tpl_test_util.h"
-
-
-bool tpl_buffer_map_unmap_test(TPLNativeWnd *wnd )
-{
- TPL_CHK_PARAM( !wnd );
- bool ret = true;
- LOG("INFO", LOG_LEVEL_LOW , "-------begin:%s-------", __func__);
-
- //1.tpl_display_get
- wnd->tpl_display = NULL;
- wnd->tpl_display = tpl_display_get(TPL_BACKEND_WAYLAND, (tpl_handle_t)wnd->dpy);
- if (wnd->tpl_display == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_display_get");
- ret = false;
- goto finish;
- }
-
- //2.tpl_surface_create
- wnd->tpl_surf = NULL;
- wnd->tpl_surf = tpl_surface_create(wnd->tpl_display , (tpl_handle_t)wnd->wnd,
- TPL_SURFACE_TYPE_WINDOW, TPL_FORMAT_ARGB8888);
- if (wnd->tpl_surf == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_surface_create");
- ret = false;
- goto finish;
- }
-
- //3.begin frame
- tpl_surface_begin_frame(wnd->tpl_surf);
-
- //4.get buffer
- wnd->tpl_buf = NULL;
- wnd->tpl_buf = tpl_surface_get_buffer(wnd->tpl_surf, NULL);
- if (wnd->tpl_buf == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_surface_get_buffer");
- ret = false;
- goto finish;
- }
-
- //5.buffer map
- void *ptr = NULL;
- //int size = tpl_buf->width * tpl_buf->height * tpl_buf->depth;
- int size = wnd->width * wnd->height ;
- LOG("INFO", LOG_LEVEL_LOW , "width=%d,height=%d,size=%d\n", wnd->width ,
- wnd->height , size);
- ptr = tpl_buffer_map(wnd->tpl_buf, size);
- if (ptr == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_buffer_map");
- ret = false;
- goto finish;
- }
-
- //5.buffer unmap
- tpl_buffer_unmap(wnd->tpl_buf, ptr, size);
-
-
-finish:
- if (true == ret)
- LOG("PASS", LOG_LEVEL_HIGH , "Pass:%s", __func__);
- else
- LOG("FAIL", LOG_LEVEL_HIGH , "Failed:%s", __func__);
- return ret;
-
-
-}
-
-bool tpl_buffer_lock_unlock_test(TPLNativeWnd *wnd )
-{
- TPL_CHK_PARAM( !wnd );
- bool ret = true;
- LOG("INFO", LOG_LEVEL_LOW , "-------begin:%s-------", __func__);
-
- //1.tpl_display_get
- wnd->tpl_display = NULL;
- wnd->tpl_display = tpl_display_get(TPL_BACKEND_WAYLAND, (tpl_handle_t)wnd->dpy);
- if (wnd->tpl_display == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_display_get");
- ret = false;
- goto finish;
- }
-
- //2.tpl_surface_create
- wnd->tpl_surf = NULL;
- wnd->tpl_surf = tpl_surface_create(wnd->tpl_display, (tpl_handle_t)wnd->wnd,
- TPL_SURFACE_TYPE_WINDOW, TPL_FORMAT_ARGB8888);
- if (wnd->tpl_surf == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_surface_create");
- ret = false;
- goto finish;
- }
-
- //3.begin frame
- tpl_surface_begin_frame(wnd->tpl_surf);
-
- //4.get buffer
- wnd->tpl_buf = NULL;
- wnd->tpl_buf = tpl_surface_get_buffer(wnd->tpl_surf, NULL);
- if (wnd->tpl_buf == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_surface_get_buffer");
- ret = false;
- goto finish;
- }
-
- //5.buffer lock
- tpl_bool_t result = false;
- result = tpl_buffer_lock(wnd->tpl_buf, TPL_LOCK_USAGE_GPU_READ);
- if (result == true) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_buffer_lock");
- ret = false;
- goto finish;
- }
- tpl_buffer_unlock(wnd->tpl_buf);
-
- //TPL_LOCK_USAGE_GPU_WRITE
- result = tpl_buffer_lock(wnd->tpl_buf, TPL_LOCK_USAGE_GPU_WRITE);
- if (result == true) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_buffer_lock");
- ret = false;
- goto finish;
- }
- tpl_buffer_unlock(wnd->tpl_buf);
-
- //TPL_LOCK_USAGE_CPU_READ
- result = tpl_buffer_lock(wnd->tpl_buf, TPL_LOCK_USAGE_CPU_READ);
- if (result == true) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_buffer_lock");
- ret = false;
- goto finish;
- }
- tpl_buffer_unlock(wnd->tpl_buf);
-
- //TPL_LOCK_USAGE_CPU_WRITE
- result = tpl_buffer_lock(wnd->tpl_buf, TPL_LOCK_USAGE_CPU_WRITE);
- if (result == true) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_buffer_lock");
- ret = false;
- goto finish;
- }
- tpl_buffer_unlock(wnd->tpl_buf);
-
-
-finish:
- if (true == ret)
- LOG("PASS", LOG_LEVEL_HIGH , "Pass:%s", __func__);
- else
- LOG("FAIL", LOG_LEVEL_HIGH , "Failed:%s", __func__);
- return ret;
-
-
-}
-
-
-bool tpl_buffer_get_arg_test(TPLNativeWnd *wnd )
-{
- TPL_CHK_PARAM( !wnd );
- bool ret = true;
- LOG("INFO", LOG_LEVEL_LOW , "-------begin:%s-------", __func__);
-
- //1.tpl_display_get
- wnd->tpl_display = NULL;
- wnd->tpl_display = tpl_display_get(TPL_BACKEND_WAYLAND, (tpl_handle_t)wnd->dpy);
- if (wnd->tpl_display == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_display_get");
- ret = false;
- goto finish;
- }
-
- //2.tpl_surface_create
- wnd->tpl_surf = NULL;
- wnd->tpl_surf = tpl_surface_create(wnd->tpl_display, (tpl_handle_t)wnd->wnd,
- TPL_SURFACE_TYPE_WINDOW, TPL_FORMAT_ARGB8888);
- if (wnd->tpl_surf == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_surface_create");
- ret = false;
- goto finish;
- }
-
- //3.begin frame
- tpl_surface_begin_frame(wnd->tpl_surf);
-
- //4.get buffer
- wnd->tpl_buf = NULL;
- wnd->tpl_buf = tpl_surface_get_buffer(wnd->tpl_surf, NULL);
- if (wnd->tpl_buf == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_surface_get_buffer");
- ret = false;
- goto finish;
- }
-
- //tpl_buffer_get_key
- unsigned int key = 0;
- key = tpl_buffer_get_key(wnd->tpl_buf);
- if (key == 0) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_buffer_get_key");
- ret = false;
- goto finish;
- }
-
- //tpl_buffer_get_fd
- int fd = -1;
- fd = tpl_buffer_get_fd(wnd->tpl_buf);
- if (fd == -1) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_buffer_get_fd");
- ret = false;
- goto finish;
- }
-
- //tpl_buffer_get_age
- int age = -1;
- age = tpl_buffer_get_age(wnd->tpl_buf);
- if (age == 0) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_buffer_get_age");
- ret = false;
- goto finish;
- }
-
- //tpl_buffer_get_surface
- tpl_surface_t *test_surf = NULL;
- test_surf = tpl_buffer_get_surface(wnd->tpl_buf);
- if (test_surf == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_buffer_get_surface");
- ret = false;
- goto finish;
- }
-
- //tpl_buffer_get_size
- int width = 0, heigh = 0;
- tpl_buffer_get_size(wnd->tpl_buf, &width, &heigh);
- if ((width == 0) || (heigh == 0)) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_buffer_get_size");
- ret = false;
- goto finish;
- }
-
- //tpl_buffer_get_depth
- int depth = 0;
- depth = tpl_buffer_get_depth(wnd->tpl_buf);
- if (depth == 0) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_buffer_get_depth");
- ret = false;
- goto finish;
- }
- //tpl_buffer_get_pitch
- int pitch = 0;
- pitch = tpl_buffer_get_fd(wnd->tpl_buf);
- if (pitch == 0) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_buffer_get_fd");
- ret = false;
- goto finish;
- }
-
-
-finish:
- if (true == ret)
- LOG("PASS", LOG_LEVEL_HIGH , "Pass:%s", __func__);
- else
- LOG("FAIL", LOG_LEVEL_HIGH , "Failed:%s", __func__);
- return ret;
-
-
-}
-
-
-bool tpl_buffer_create_native_buffer_test(TPLNativeWnd *wnd )
-{
- TPL_CHK_PARAM( !wnd );
- bool ret = true;
- LOG("INFO", LOG_LEVEL_LOW , "-------begin:%s---", __func__);
-
- //1.tpl_display_get
- wnd->tpl_display = NULL;
- wnd->tpl_display = tpl_display_get(TPL_BACKEND_WAYLAND, (tpl_handle_t)wnd->dpy);
- if (wnd->tpl_display == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_display_get");
- ret = false;
- goto finish;
- }
-
- //2.tpl_surface_create
- wnd->tpl_surf = NULL;
- wnd->tpl_surf = tpl_surface_create(wnd->tpl_display, (tpl_handle_t)wnd->wnd,
- TPL_SURFACE_TYPE_WINDOW, TPL_FORMAT_ARGB8888);
- if (wnd->tpl_surf == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_surface_create");
- ret = false;
- goto finish;
- }
-
- //3.begin frame
- tpl_surface_begin_frame(wnd->tpl_surf);
-
- //4.get buffer
- wnd->tpl_buf = NULL;
- wnd->tpl_buf = tpl_surface_get_buffer(wnd->tpl_surf, NULL);
- if (wnd->tpl_buf == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_surface_get_buffer");
- ret = false;
- goto finish;
- }
-
- //create native buffer
- void *native_buffer = NULL;
- native_buffer = tpl_buffer_create_native_buffer(wnd->tpl_buf);
- if (native_buffer == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_buffer_create_native_buffer");
- ret = false;
- goto finish;
- }
-
-finish:
- if (true == ret)
- LOG("PASS", LOG_LEVEL_HIGH , "Pass:%s", __func__);
- else
- LOG("FAIL", LOG_LEVEL_HIGH , "Failed:%s", __func__);
- return ret;
-}
-
-
-bool tpl_buffer_abnormal_test(TPLNativeWnd *wnd )
-{
- TPL_CHK_PARAM( !wnd );
- bool ret = true;
- LOG("INFO", LOG_LEVEL_LOW , "-------begin:%s-------", __func__);
-
- //1.tpl_display_get
- wnd->tpl_display = NULL;
- wnd->tpl_display = tpl_display_get(TPL_BACKEND_WAYLAND, (tpl_handle_t)wnd->dpy);
- if (wnd->tpl_display == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_display_get");
- ret = false;
- goto finish;
- }
-
- //2.tpl_surface_create
- wnd->tpl_surf = NULL;
- wnd->tpl_surf = tpl_surface_create(wnd->tpl_display, (tpl_handle_t)wnd->wnd,
- TPL_SURFACE_TYPE_WINDOW, TPL_FORMAT_ARGB8888);
- if (wnd->tpl_surf == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_surface_create");
- ret = false;
- goto finish;
- }
-
- //3.begin frame
- tpl_surface_begin_frame(wnd->tpl_surf);
-
- //4.get buffer
- wnd->tpl_buf = NULL;
- wnd->tpl_buf = tpl_surface_get_buffer(wnd->tpl_surf, NULL);
- if (wnd->tpl_buf == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_surface_get_buffer");
- ret = false;
- goto finish;
- }
-
- //abnormal test
-
- tpl_buffer_lock(wnd->tpl_buf, TPL_LOCK_USAGE_INVALID);
- int test_width = 0, test_heigh = 0;
- tpl_buffer_map(NULL, 0);
- tpl_buffer_unmap(NULL, NULL, 0);
- tpl_buffer_lock(NULL, TPL_LOCK_USAGE_INVALID);
- tpl_buffer_unlock(NULL);
- tpl_buffer_get_key(NULL);
- tpl_buffer_get_fd(NULL);
- tpl_buffer_get_age(NULL);
- tpl_buffer_get_surface(NULL);
- tpl_buffer_get_size(NULL, &test_width, &test_heigh);
- tpl_buffer_get_depth(NULL);
- tpl_buffer_get_pitch(NULL);
- tpl_buffer_create_native_buffer(NULL);
-
-finish:
- if (true == ret)
- LOG("PASS", LOG_LEVEL_HIGH , "Pass:%s", __func__);
- else
- LOG("FAIL", LOG_LEVEL_HIGH , "Failed:%s", __func__);
- return ret;
-
-
-}
-
-
-bool tpl_buffer_stress_test(TPLNativeWnd *wnd )
-{
- TPL_CHK_PARAM( !wnd );
- bool ret = true;
- int index = 0;
- int size = 0;
- LOG("INFO", LOG_LEVEL_LOW , "-------begin:%s-------", __func__);
-
- //1.tpl_display _get
- wnd->tpl_display = NULL;
- wnd->tpl_display = tpl_display_get(TPL_BACKEND_WAYLAND, (tpl_handle_t)wnd->dpy);
- if (wnd->tpl_display == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_display_get");
- ret = false;
- goto finish;
- }
-
- //2.tpl_surface_create
- wnd->tpl_surf = NULL;
- wnd->tpl_surf = tpl_surface_create(wnd->tpl_display , (tpl_handle_t)wnd->wnd,
- TPL_SURFACE_TYPE_WINDOW, TPL_FORMAT_ARGB8888);
- if (wnd->tpl_surf == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_surface_create");
- ret = false;
- goto finish;
- }
-
- tpl_buffer_t *buf_array[STRESS_NUM] = {0};
- for (index = 0; index < STRESS_NUM; index++) {
- tpl_surface_begin_frame(wnd->tpl_surf);
- buf_array[index] = tpl_surface_get_buffer(wnd->tpl_surf, NULL);
- if (buf_array[index] == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_surface_get_buffer");
- ret = false;
- goto finish;
- }
-
- void *ptr = NULL;
- size = wnd->width * wnd->height ;
- ptr = tpl_buffer_map(buf_array[index], size);
- if (ptr == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_buffer_map");
- ret = false;
- goto finish;
- }
- //6.write
- int *p = NULL;
- int j = 0;
- for (j = 0; j < size; j++) {
- p = (int *) ptr;
- if (index % 2 == 0)
- *(p + j) = 0xFF00;
- else
- *(p + j) = 0x00FF;
- }
-
- tpl_surface_end_frame(wnd->tpl_surf);
-
- tpl_surface_post(wnd->tpl_surf);
- usleep(500 * 1000); //0.5s
- }
-
-finish:
- if (true == ret)
- LOG("PASS", LOG_LEVEL_HIGH , "Pass:%s", __func__);
- else
- LOG("FAIL", LOG_LEVEL_HIGH , "Failed:%s", __func__);
- return ret;
-}
-
-
-#endif
-
-
+++ /dev/null
-#ifndef __TPL_DISPLAY_TEST__
-#define __TPL_DISPLAY_TEST__
-
-#include "tpl_test_util.h"
-
-
-bool tpl_display_get_test (TPLNativeWnd *wnd)
-{
- TPL_CHK_PARAM( !wnd );
- LOG("INFO", LOG_LEVEL_LOW , "-------begin:%s-------", __func__);
- bool ret = true;
- wnd->tpl_display = NULL;
- wnd->tpl_display = tpl_display_get(TPL_BACKEND_WAYLAND, (tpl_handle_t)wnd->dpy);
- if (wnd->tpl_display == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_display_get");
- ret = false;
- goto finish;
- }
-finish:
- if (true == ret)
- LOG("PASS", LOG_LEVEL_HIGH , "Pass:%s", __func__);
- else
- LOG("FAIL", LOG_LEVEL_HIGH , "Failed:%s", __func__);
- return ret;
-}
-
-
-bool tpl_display_bind_client_display_test(TPLNativeWnd *wnd)
-{
- TPL_CHK_PARAM( !wnd );
- LOG("INFO", LOG_LEVEL_LOW , "-------begin:%s---", __func__);
- bool ret = true;
- wnd->tpl_display = NULL;
- wnd->tpl_display = tpl_display_get(TPL_BACKEND_WAYLAND, (tpl_handle_t)wnd->dpy);
- if (wnd->tpl_display == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_display_get");
- ret = false;
- goto finish;
- }
-
- // bind display handle
- tpl_bool_t result = false;
- result = tpl_display_bind_client_display_handle(wnd->tpl_display,
- (tpl_handle_t)wnd->dpy);
- if (result == false) {
- LOG("ERRO", LOG_LEVEL_HIGH , " failed:tpl_display_bind_client_display_handle");
- ret = false;
- goto finish;
- }
-
- // unbind display handle
- result = false;
- result = tpl_display_unbind_client_display_handle(wnd->tpl_display,
- (tpl_handle_t)wnd->dpy);
- if (result == false) {
- LOG("ERRO", LOG_LEVEL_HIGH ,
- " failed:tpl_display_unbind_client_display_handle");
- ret = false;
- goto finish;
- }
-
-finish:
- if (true == ret)
- LOG("PASS", LOG_LEVEL_HIGH , "Pass:%s", __func__);
- else
- LOG("FAIL", LOG_LEVEL_HIGH , "Failed:%s", __func__);
- return ret;
-}
-
-
-bool tpl_display_get_arg_test (TPLNativeWnd *wnd)
-{
- TPL_CHK_PARAM( !wnd );
- LOG("INFO", LOG_LEVEL_LOW , "-------begin:%s-------", __func__);
- bool ret = true;
- wnd->tpl_display = NULL;
- wnd->tpl_display = tpl_display_get(TPL_BACKEND_WAYLAND, (tpl_handle_t)wnd->dpy);
- if (wnd->tpl_display == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_display_get");
- ret = false;
- goto finish;
- }
-
- //tpl_display_get_backend_type
- tpl_backend_type_t backend_type = tpl_display_get_backend_type(
- wnd->tpl_display);
- if (backend_type != TPL_BACKEND_WAYLAND) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_display_get_backend_type");
- ret = false;
- goto finish;
- }
-
- //tpl_display_get_native_handle
- tpl_handle_t test_handle = NULL;
- test_handle = tpl_display_get_native_handle(wnd->tpl_display);
- if (test_handle == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_display_get_native_handle");
- ret = false;
- goto finish;
- }
-
-finish:
- if (true == ret)
- LOG("PASS", LOG_LEVEL_HIGH , "Pass:%s", __func__);
- else
- LOG("FAIL", LOG_LEVEL_HIGH , "Failed:%s", __func__);
- return ret;
-}
-
-
-bool tpl_display_query_config_test (TPLNativeWnd *wnd)
-{
- TPL_CHK_PARAM( !wnd );
- LOG("INFO", LOG_LEVEL_LOW , "-------begin:%s-------", __func__);
- bool ret = true;
- wnd->tpl_display = NULL;
- wnd->tpl_display = tpl_display_get(TPL_BACKEND_WAYLAND, (tpl_handle_t)wnd->dpy);
- if (wnd->tpl_display == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_display_get");
- ret = false;
- goto finish;
- }
- //query config
- tpl_bool_t result = false;
- result = tpl_display_query_config(wnd->tpl_display,
- TPL_SURFACE_TYPE_WINDOW,
- 8,
- 8,
- 8,
- 8,
- 32,
- NULL,
- NULL);
- if (result == false ) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_display_query_config");
- ret = false;
- goto finish;
- }
-
- result = tpl_display_query_config(wnd->tpl_display,
- TPL_SURFACE_TYPE_WINDOW,
- 8,
- 8,
- 8,
- 8,
- 24,
- NULL,
- NULL);
- if (result == false ) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_display_query_config");
- ret = false;
- goto finish;
- }
-
- result = tpl_display_query_config(wnd->tpl_display,
- TPL_SURFACE_TYPE_WINDOW,
- 0,
- 8,
- 8,
- 8,
- 24,
- NULL,
- NULL);
- if (result != false ) { //unmatched case
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_display_query_config");
- ret = false;
- goto finish;
- }
-
-finish:
- if (true == ret)
- LOG("PASS", LOG_LEVEL_HIGH , "Pass:%s", __func__);
- else
- LOG("FAIL", LOG_LEVEL_HIGH , "Failed:%s", __func__);
- return ret;
-}
-
-bool tpl_display_filter_config_test (TPLNativeWnd *wnd)
-{
- TPL_CHK_PARAM( !wnd );
- LOG("INFO", LOG_LEVEL_LOW , "-------begin:%s-------", __func__);
- bool ret = true;
- wnd->tpl_display = NULL;
- wnd->tpl_display = tpl_display_get(TPL_BACKEND_WAYLAND, (tpl_handle_t)wnd->dpy);
- if (wnd->tpl_display == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_display_get");
- ret = false;
- goto finish;
- }
-
- //filt config
- tpl_bool_t result = false;
- int test_visual_id = GBM_FORMAT_ARGB8888;
- result = tpl_display_filter_config(wnd->tpl_display, &test_visual_id, 0);
- if (result == false ) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_display_filter_config");
- ret = false;
- goto finish;
- }
-
- //filt config, unmatched case
- result = tpl_display_filter_config(wnd->tpl_display, &test_visual_id, 8);
- if (result != false ) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_display_filter_config");
- ret = false;
- goto finish;
- }
- test_visual_id = GBM_FORMAT_XRGB8888;
- result = tpl_display_filter_config(wnd->tpl_display, &test_visual_id, 0);
- if (result != false ) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_display_filter_config");
- ret = false;
- goto finish;
- }
-
-
-finish:
- if (true == ret)
- LOG("PASS", LOG_LEVEL_HIGH , "Pass:%s", __func__);
- else
- LOG("FAIL", LOG_LEVEL_HIGH , "Failed:%s", __func__);
- return ret;
-}
-
-
-bool tpl_display_abnormal_test (TPLNativeWnd *wnd)
-{
- TPL_CHK_PARAM( !wnd );
- LOG("INFO", LOG_LEVEL_LOW , "-------begin:%s-------", __func__);
- bool ret = true;
- wnd->tpl_display = NULL;
- wnd->tpl_display = tpl_display_get(TPL_BACKEND_WAYLAND, (tpl_handle_t)wnd->dpy);
- if (wnd->tpl_display == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_display_get");
- ret = false;
- goto finish;
- }
-
- //abnormal test
- wnd->tpl_display = tpl_display_get(TPL_BACKEND_WAYLAND, NULL);
- if (wnd->tpl_display != NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "abnormal test failed:tpl_display_get");
- ret = false;
- goto finish;
- }
-
-
- //abnormal test
- tpl_display_bind_client_display_handle(NULL, NULL);
- tpl_display_unbind_client_display_handle(NULL, NULL);
- tpl_display_get_backend_type(NULL);
- tpl_display_get_native_handle(NULL);
- tpl_display_filter_config(NULL, NULL, 0);
- tpl_display_query_config(NULL, TPL_SURFACE_TYPE_PIXMAP, 0, 8, 8, 8, 24, NULL,
- NULL);
-
-
-finish:
- if (true == ret)
- LOG("PASS", LOG_LEVEL_HIGH , "Pass:%s", __func__);
- else
- LOG("FAIL", LOG_LEVEL_HIGH , "Failed:%s", __func__);
- return ret;
-}
-
-
-#endif
-
+++ /dev/null
-#ifndef __TPL_OBJECT_TEST__
-#define __TPL_OBJECT_TEST__
-
-#include "tpl_test_util.h"
-
-
-bool tpl_object_get_type_test(TPLNativeWnd *wnd )
-{
- TPL_CHK_PARAM( !wnd );
- bool ret = true;
- LOG("INFO", LOG_LEVEL_LOW , "-------begin:%s-------", __func__);
-
- //1.tpl_display_get
- wnd->tpl_display = NULL;
- wnd->tpl_display = tpl_display_get(TPL_BACKEND_WAYLAND, (tpl_handle_t)wnd->dpy);
- if (wnd->tpl_display == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_display_get");
- ret = false;
- goto finish;
- }
-
- //2.tpl_surface_create
- wnd->tpl_surf = NULL;
- wnd->tpl_surf = tpl_surface_create(wnd->tpl_display, (tpl_handle_t)wnd->wnd,
- TPL_SURFACE_TYPE_WINDOW, TPL_FORMAT_ARGB8888);
- if (wnd->tpl_surf == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_surface_create");
- ret = false;
- goto finish;
- }
-
- //3.begin frame
- tpl_surface_begin_frame(wnd->tpl_surf);
-
- //4.get buffer
- wnd->tpl_buf = NULL;
- wnd->tpl_buf = tpl_surface_get_buffer(wnd->tpl_surf, NULL);
- if (wnd->tpl_buf == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_surface_get_buffer");
- ret = false;
- goto finish;
- }
-
- //tpl_object_get_type:DISPLAY
- int obj_type = -1;
- obj_type = tpl_object_get_type((tpl_object_t *)wnd->tpl_display);
- if (obj_type != TPL_OBJECT_DISPLAY) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_object_get_type");
- ret = false;
- goto finish;
- }
-
- //tpl_object_get_type:SURFACE
- obj_type = -1;
- obj_type = tpl_object_get_type((tpl_object_t *)wnd->tpl_surf);
- if (obj_type != TPL_OBJECT_SURFACE) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_object_get_type");
- ret = false;
- goto finish;
- }
-
-finish:
- if (true == ret)
- LOG("PASS", LOG_LEVEL_HIGH , "Pass:%s", __func__);
- else
- LOG("FAIL", LOG_LEVEL_HIGH , "Failed:%s", __func__);
- return ret;
-
-
-}
-
-
-bool tpl_object_userdata_test(TPLNativeWnd *wnd )
-{
- TPL_CHK_PARAM( !wnd );
- bool ret = true;
- LOG("INFO", LOG_LEVEL_LOW , "-------begin:%s-------", __func__);
-
- //1.tpl_display_get
- wnd->tpl_display = NULL;
- wnd->tpl_display = tpl_display_get(TPL_BACKEND_WAYLAND, (tpl_handle_t)wnd->dpy);
- if (wnd->tpl_display == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_display_get");
- ret = false;
- goto finish;
- }
-
- //2. set userdate
- tpl_object_set_user_data((tpl_object_t *)wnd->tpl_display, (void *)wnd->dpy,
- NULL);
-
- //3.get userdate
- void *get_dpy = NULL;
- get_dpy = (void *)tpl_object_get_user_data((tpl_object_t *)wnd->tpl_display);
- if (get_dpy == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_object_get_user_data");
- ret = false;
- goto finish;
- }
-
-
-finish:
- if (true == ret)
- LOG("PASS", LOG_LEVEL_HIGH , "Pass:%s", __func__);
- else
- LOG("FAIL", LOG_LEVEL_HIGH , "Failed:%s", __func__);
- return ret;
-
-
-}
-
-bool tpl_object_reference_test(TPLNativeWnd *wnd )
-{
- TPL_CHK_PARAM( !wnd );
- bool ret = true;
- LOG("INFO", LOG_LEVEL_LOW , "-------begin:%s-------", __func__);
-
- //1.tpl_display_get
- wnd->tpl_display = NULL;
- wnd->tpl_display = tpl_display_get(TPL_BACKEND_WAYLAND, (tpl_handle_t)wnd->dpy);
- if (wnd->tpl_display == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_display_get");
- ret = false;
- goto finish;
- }
-
- //2. tpl_object_reference
- tpl_object_reference((tpl_object_t *)wnd->tpl_display);
-
- //3.tpl_object_get_reference
- int ref_count = -1;
- ref_count = tpl_object_get_reference((tpl_object_t *)wnd->tpl_display);
- if (ref_count == -1) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_object_get_reference");
- ret = false;
- goto finish;
- }
-
- //4.tpl_object_unreference
- int unref_count = -1;
- unref_count = tpl_object_unreference((tpl_object_t *)wnd->tpl_display);
- if (unref_count != ref_count - 1) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_object_unreference");
- ret = false;
- goto finish;
- }
-
-finish:
- if (true == ret)
- LOG("PASS", LOG_LEVEL_HIGH , "Pass:%s", __func__);
- else
- LOG("FAIL", LOG_LEVEL_HIGH , "Failed:%s", __func__);
- return ret;
-
-
-}
-
-bool tpl_object_abnormal_test(TPLNativeWnd *wnd )
-{
- TPL_CHK_PARAM( !wnd );
- bool ret = true;
- LOG("INFO", LOG_LEVEL_LOW , "-------begin:%s-------", __func__);
-
-
- //abnormal test
- tpl_object_get_type(NULL);
- tpl_object_set_user_data(NULL, NULL, NULL);
- tpl_object_get_user_data(NULL);
- tpl_object_reference(NULL);
- tpl_object_get_reference(NULL);
- tpl_object_unreference(NULL);
-
-
-finish:
- if (true == ret)
- LOG("PASS", LOG_LEVEL_HIGH , "Pass:%s", __func__);
- else
- LOG("FAIL", LOG_LEVEL_HIGH , "Failed:%s", __func__);
- return ret;
-
-
-}
-
-
-
-
-#endif
-
-
+++ /dev/null
-#ifndef __TPL_SURF_TEST__
-#define __TPL_SURF_TEST__
-
-#include "tpl_test_util.h"
-
-
-bool tpl_surface_create_test(TPLNativeWnd *wnd)
-{
- TPL_CHK_PARAM( !wnd );
- LOG("INFO", LOG_LEVEL_LOW , "-------begin:%s-------", __func__);
- bool ret = true;
- wnd->tpl_display = NULL;
- //1.tpl_display_get
- wnd->tpl_display = tpl_display_get(TPL_BACKEND_WAYLAND, (tpl_handle_t)wnd->dpy);
- if (wnd->tpl_display == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_display_get");
- ret = false;
- goto finish;
- }
- //2.tpl_surface_create
- tpl_surface_t *tpl_surf = NULL;
- tpl_surf = tpl_surface_create(wnd->tpl_display, (tpl_handle_t)wnd->wnd,
- TPL_SURFACE_TYPE_WINDOW, TPL_FORMAT_ARGB8888);
- if (tpl_surf == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_surface_create");
- ret = false;
- goto finish;
- }
-
-finish:
- if (true == ret)
- LOG("PASS", LOG_LEVEL_HIGH , "Pass:%s", __func__);
- else
- LOG("FAIL", LOG_LEVEL_HIGH , "Failed:%s", __func__);
- return ret;
-}
-
-bool tpl_surface_get_arg_test(TPLNativeWnd *wnd)
-{
- TPL_CHK_PARAM( !wnd );
- LOG("INFO", LOG_LEVEL_LOW , "-------begin:%s-------", __func__);
- bool ret = true;
- wnd->tpl_display = NULL;
- //1.tpl_display_get
- wnd->tpl_display = tpl_display_get(TPL_BACKEND_WAYLAND, (tpl_handle_t)wnd->dpy);
- if (wnd->tpl_display == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_display_get");
- ret = false;
- goto finish;
- }
- //2.tpl_surface_create
- tpl_surface_t *tpl_surf = NULL;
- tpl_surf = tpl_surface_create(wnd->tpl_display, (tpl_handle_t)wnd->wnd,
- TPL_SURFACE_TYPE_WINDOW, TPL_FORMAT_ARGB8888);
- if (tpl_surf == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_surface_create");
- ret = false;
- goto finish;
- }
-
- //tpl_surface_get_display test
- tpl_display_t *test_dpy = tpl_surface_get_display(tpl_surf);
- if (test_dpy == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_surface_get_display");
- ret = false;
- goto finish;
- }
- //tpl_surface_get_native_handle
- tpl_handle_t test_handle = tpl_surface_get_native_handle(tpl_surf);
- if (test_handle == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_surface_get_native_handle");
- ret = false;
- goto finish;
- }
- //tpl_surface_get_type test
- tpl_surface_type_t test_type = tpl_surface_get_type(tpl_surf);
- if (test_type != TPL_SURFACE_TYPE_WINDOW) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_surface_get_type");
- ret = false;
- goto finish;
- }
-
-finish:
- if (true == ret)
- LOG("PASS", LOG_LEVEL_HIGH , "Pass:%s", __func__);
- else
- LOG("FAIL", LOG_LEVEL_HIGH , "Failed:%s", __func__);
- return ret;
-}
-
-bool tpl_surface_frame_test(TPLNativeWnd *wnd)
-{
- TPL_CHK_PARAM( !wnd );
- LOG("INFO", LOG_LEVEL_LOW , "-------begin:%s-------", __func__);
- bool ret = true;
- wnd->tpl_display = NULL;
- //1.tpl_display_get
- wnd->tpl_display = tpl_display_get(TPL_BACKEND_WAYLAND, (tpl_handle_t)wnd->dpy);
- if (wnd->tpl_display == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_display_get");
- ret = false;
- goto finish;
- }
- //2.tpl_surface_create
- tpl_surface_t *tpl_surf = NULL;
- tpl_surf = tpl_surface_create(wnd->tpl_display, (tpl_handle_t)wnd->wnd,
- TPL_SURFACE_TYPE_WINDOW, TPL_FORMAT_ARGB8888);
- if (tpl_surf == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_surface_create");
- ret = false;
- goto finish;
- }
-
- //3.begin frame
- tpl_surface_begin_frame(tpl_surf);
-
- //4.tpl_surface_validate_frame
- tpl_bool_t isvalid = tpl_surface_validate_frame(tpl_surf);
-
- //5. end frame
- tpl_surface_end_frame(tpl_surf);
-
-
-finish:
- if (true == ret)
- LOG("PASS", LOG_LEVEL_HIGH , "Pass:%s", __func__);
- else
- LOG("FAIL", LOG_LEVEL_HIGH , "Failed:%s", __func__);
-
- return ret;
-}
-
-
-bool tpl_surface_get_buffer_test(TPLNativeWnd *wnd )
-{
- TPL_CHK_PARAM( !wnd );
- bool ret = true;
- LOG("INFO", LOG_LEVEL_LOW , "-------begin:%s-------", __func__);
-
- //1.tpl_display_get
- wnd->tpl_display = NULL;
- wnd->tpl_display = tpl_display_get(TPL_BACKEND_WAYLAND, (tpl_handle_t)wnd->dpy);
- if (wnd->tpl_display == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_display_get");
- ret = false;
- goto finish;
- }
-
- //2.tpl_surface_create
- tpl_surface_t *tpl_surf = NULL;
- tpl_surf = tpl_surface_create(wnd->tpl_display, (tpl_handle_t)wnd->wnd,
- TPL_SURFACE_TYPE_WINDOW, TPL_FORMAT_ARGB8888);
- if (tpl_surf == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_surface_create");
- ret = false;
- goto finish;
- }
-
- //3.begin frame
- tpl_surface_begin_frame(tpl_surf);
-
- //4.get buffer
- wnd->tpl_buf = NULL;
- wnd->tpl_buf = tpl_surface_get_buffer(tpl_surf, NULL);
- if (wnd->tpl_buf == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_surface_get_buffer");
- ret = false;
- goto finish;
- }
-
- //4.get buffer reset
- tpl_buffer_t *tpl_buf_r = NULL;
- tpl_bool_t reset;
- tpl_buf_r = tpl_surface_get_buffer(tpl_surf, &reset);
- if (tpl_buf_r == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_surface_get_buffer");
- ret = false;
- goto finish;
- }
-
-finish:
- if (true == ret)
- LOG("PASS", LOG_LEVEL_HIGH , "Pass:%s", __func__);
- else
- LOG("FAIL", LOG_LEVEL_HIGH , "Failed:%s", __func__);
- return ret;
-
-
-}
-
-
-
-
-bool tpl_surface_post_test(TPLNativeWnd *wnd )
-{
- TPL_CHK_PARAM( !wnd );
- bool ret = true;
- LOG("INFO", LOG_LEVEL_LOW , "-------begin:%s-------", __func__);
-
- //1.tpl_display_get
- wnd->tpl_display = NULL;
- wnd->tpl_display = tpl_display_get(TPL_BACKEND_WAYLAND, (tpl_handle_t)wnd->dpy);
- if (wnd->tpl_display == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_display_get");
- ret = false;
- goto finish;
- }
-
- //2.tpl_surface_create
- tpl_surface_t *tpl_surf = NULL;
- tpl_surf = tpl_surface_create(wnd->tpl_display, (tpl_handle_t)wnd->wnd,
- TPL_SURFACE_TYPE_WINDOW, TPL_FORMAT_ARGB8888);
- if (tpl_surf == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_surface_create");
- ret = false;
- goto finish;
- }
-
- //3.begin frame
- tpl_surface_begin_frame(tpl_surf);
-
- //4.get buffer
- wnd->tpl_buf = NULL;
- wnd->tpl_buf = tpl_surface_get_buffer(tpl_surf, NULL);
- if (wnd->tpl_buf == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_surface_get_buffer");
- ret = false;
- goto finish;
- }
-
- //5.buffer map
- void *ptr = NULL;
- //int size = tpl_buf->width * tpl_buf->height * tpl_buf->depth;
- int size = wnd->width * wnd->height ;
- LOG("INFO", LOG_LEVEL_LOW , "width=%d,height=%d,size=%d", wnd->width ,
- wnd->height , size);
- ptr = tpl_buffer_map(wnd->tpl_buf, size);
- if (ptr == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_buffer_map");
- ret = false;
- goto finish;
- }
-
- //6.write
- int *p = NULL;
- int j = 0;
- for (j = 0; j < size; j++) {
- p = (int *) ptr;
- *(p + j) = 0xFF00;
- }
- LOG("INFO", LOG_LEVEL_LOW , "succ:write completed!");
-
- //7.end frame
- tpl_surface_end_frame(tpl_surf);
-
- //8.set post interval
- int interval_set = 2;
- tpl_surface_set_post_interval(tpl_surf, interval_set);
-
- //9. get post interval;
- int interval_get = tpl_surface_get_post_interval(tpl_surf);
-
- if (interval_get != interval_set) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_surface_get_post_interval");
- ret = false;
- goto finish;
- }
-
- //10.post
- tpl_surface_post(tpl_surf);
-
- LOG("INFO", LOG_LEVEL_LOW , "After posted!!!");
-
- int k = 1;
- while (k <= 10) {
- usleep(1000 * 1000);
- LOG("INFO", LOG_LEVEL_LOW , "sleep %d ...", k);
- //printf("%d ",k);
- k++;
- }
-
-finish:
- if (true == ret)
- LOG("PASS", LOG_LEVEL_HIGH , "Pass:%s", __func__);
- else
- LOG("FAIL", LOG_LEVEL_HIGH , "Failed:%s", __func__);
- return ret;
-
-
-}
-
-
-bool tpl_surface_abnormal_test(TPLNativeWnd *wnd)
-{
- TPL_CHK_PARAM( !wnd );
- LOG("INFO", LOG_LEVEL_LOW , "-------begin:%s-------", __func__);
- bool ret = true;
- wnd->tpl_surf = NULL;
-
- //1.tpl_display_get
- wnd->tpl_display = NULL;
- wnd->tpl_display = tpl_display_get(TPL_BACKEND_WAYLAND, (tpl_handle_t)wnd->dpy);
- if (wnd->tpl_display == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_display_get");
- ret = false;
- goto finish;
- }
-
- //abnormal test
- wnd->tpl_surf = NULL;
- wnd->tpl_surf = tpl_surface_create(NULL, NULL, TPL_SURFACE_TYPE_WINDOW,
- TPL_FORMAT_ARGB8888);
- wnd->tpl_surf = tpl_surface_create(wnd->tpl_display, (tpl_handle_t)wnd->wnd, 10,
- TPL_FORMAT_ARGB8888);
- wnd->tpl_surf = tpl_surface_create(wnd->tpl_display, (tpl_handle_t)wnd->wnd,
- TPL_SURFACE_TYPE_WINDOW, TPL_FORMAT_INVALID);
- /* if(tpl_surf != NULL)
- {
- LOG("ERRO", LOG_LEVEL_HIGH , "abnormal test failed:%s",__func__);
- ret = false;
- goto finish;
- }
- */
- //abnormal test
- int width = 0, height = 0;
- tpl_surface_get_display(NULL);
- tpl_surface_get_native_handle(NULL);
- tpl_surface_get_type(NULL);
- tpl_surface_get_size(NULL, &width, &height);
- tpl_surface_get_buffer(NULL, NULL);
- tpl_surface_set_post_interval(NULL, 2);
- tpl_surface_get_post_interval(NULL);
- tpl_surface_post(NULL);
- tpl_surface_begin_frame(NULL);
- tpl_surface_validate_frame(NULL);
- tpl_surface_end_frame(NULL);
-
-finish:
- if (true == ret)
- LOG("PASS", LOG_LEVEL_HIGH , "Pass:%s", __func__);
- else
- LOG("FAIL", LOG_LEVEL_HIGH , "Failed:%s", __func__);
- return ret;
-}
-
-
-
-bool tpl_surface_stress_test(TPLNativeWnd *wnd )
-{
- TPL_CHK_PARAM( !wnd );
- bool ret = true;
- int index = 0;
- LOG("INFO", LOG_LEVEL_LOW , "-------begin:%s-------", __func__);
-
- //1.tpl_display _get
- wnd->tpl_display = NULL;
- wnd->tpl_display = tpl_display_get(TPL_BACKEND_WAYLAND, (tpl_handle_t)wnd->dpy);
- if (wnd->tpl_display == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_display_get");
- ret = false;
- goto finish;
- }
-
- //2.tpl_surface_create
- wnd->tpl_surf = NULL;
- wnd->tpl_surf = tpl_surface_create(wnd->tpl_display , (tpl_handle_t)wnd->wnd,
- TPL_SURFACE_TYPE_WINDOW, TPL_FORMAT_ARGB8888);
- if (wnd->tpl_surf == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_surface_create");
- ret = false;
- goto finish;
- }
-
- //3.begin frame
- tpl_surface_begin_frame(wnd->tpl_surf);
-
- //4.get buffer
- wnd->tpl_buf = NULL;
- wnd->tpl_buf = tpl_surface_get_buffer(wnd->tpl_surf, NULL);
- if (wnd->tpl_buf == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_surface_get_buffer");
- ret = false;
- goto finish;
- }
-
- tpl_buffer_t *surf_array[STRESS_NUM] = {0};
- tpl_buffer_t *buf_array[STRESS_NUM] = {0};
- for (index = 0; index < STRESS_NUM; index++) {
- surf_array[index] = tpl_surface_create(wnd->tpl_display ,
- (tpl_handle_t)wnd->wnd, TPL_SURFACE_TYPE_WINDOW, TPL_FORMAT_ARGB8888);
- if (wnd->tpl_surf == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_surface_create");
- ret = false;
- goto finish;
- }
-
- buf_array[index] = tpl_surface_get_buffer(wnd->tpl_surf, NULL);
- if (buf_array[index] == NULL) {
- LOG("ERRO", LOG_LEVEL_HIGH , "failed:tpl_surface_get_buffer");
- ret = false;
- goto finish;
- }
- }
-
-
-finish:
- for (index = 0; index < STRESS_NUM; index++) {
- if (surf_array[index] != NULL) {
- tpl_object_unreference((tpl_object_t *)surf_array[index]);
- surf_array[index] = NULL;
- }
-
- }
- if (true == ret)
- LOG("PASS", LOG_LEVEL_HIGH , "Pass:%s", __func__);
- else
- LOG("FAIL", LOG_LEVEL_HIGH , "Failed:%s", __func__);
-
- return ret;
-
-}
-
-#endif
-
-
+++ /dev/null
-#ifndef __TPL_UTIL__
-#define __TPL_UTIL__
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <memory.h>
-#include <math.h>
-//#include <GLES2/gl2.h>
-//#include <GLES2/gl2ext.h>
-//#include <EGL/egl.h>
-//#include <EGL/eglext.h>
-#include <wayland-client.h>
-#include <wayland-egl.h>
-#include <tbm_surface.h>
-#include <gbm.h>
-
-
-//for tpl test:
-#include <tpl.h>
-//#include <tpl_internal.h>
-
-#define STRESS_NUM 100
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct _TPLNativeWnd TPLNativeWnd;
-
-
-struct _TPLNativeWnd {
- void *dpy;
- struct wl_registry *registry;
- struct wl_compositor *compositor;
- struct wl_shell *shell;
- int screen;
-
- void *root;
- void *wnd;
- struct wl_surface *surface;
- struct wl_shell_surface *shell_surface;
- int x;
- int y;
- int width;
- int height;
- int depth;
- tpl_display_t *tpl_display;
- tpl_surface_t *tpl_surf;
- tpl_buffer_t *tpl_buf;
-};
-
-typedef struct _TPLTest TPLTest;
-
-struct _TPLTest {
- char *name;
- bool (*run) (TPLNativeWnd *);
-};
-
-extern int tpl_test_log_level;
-#define minLevel tpl_test_log_level
-#define LOG_LEVEL_LOW 1
-#define LOG_LEVEL_MID 2
-#define LOG_LEVEL_HIGH 3
-
-#define LOG(type,level, format, ...) \
- do { \
- if(level>=minLevel) fprintf(stderr, "[%s|%22s:%3d] " format "\n", \
- type, __FILE__, __LINE__, ##__VA_ARGS__ ); \
- } while (0)
-
-#define LONGLOG(type,level, format, ...) \
- do { \
- if(level>=minLevel) fprintf(stderr, "[%s|%s@%s:%d] " format "\n", \
- type, __func__, __FILE__, __LINE__, ##__VA_ARGS__ ); \
- } while (0)
-
-
-
-
-/* for tpl test */
-bool tpl_buffer_map_unmap_test(TPLNativeWnd *wnd );
-bool tpl_buffer_lock_unlock_test(TPLNativeWnd *wnd );
-bool tpl_buffer_get_arg_test(TPLNativeWnd *wnd );
-bool tpl_buffer_create_native_buffer_test(TPLNativeWnd *wnd );
-
-bool tpl_display_get_test (TPLNativeWnd *wnd);
-bool tpl_display_bind_client_display_test(TPLNativeWnd *wnd);
-bool tpl_display_get_arg_test (TPLNativeWnd *wnd);
-bool tpl_display_query_config_test (TPLNativeWnd *wnd);
-bool tpl_display_filter_config_test (TPLNativeWnd *wnd);
-
-bool tpl_object_get_type_test(TPLNativeWnd *wnd );
-bool tpl_object_userdata_test(TPLNativeWnd *wnd );
-bool tpl_object_reference_test(TPLNativeWnd *wnd );
-
-bool tpl_surface_create_test(TPLNativeWnd *wnd);
-bool tpl_surface_get_arg_test(TPLNativeWnd *wnd);
-bool tpl_surface_frame_test(TPLNativeWnd *wnd);
-bool tpl_surface_get_buffer_test(TPLNativeWnd *wnd );
-bool tpl_surface_post_test(TPLNativeWnd *wnd );
-
-bool tpl_surface_abnormal_test(TPLNativeWnd *wnd);
-bool tpl_object_abnormal_test(TPLNativeWnd *wnd);
-bool tpl_display_abnormal_test(TPLNativeWnd *wnd);
-bool tpl_buffer_abnormal_test(TPLNativeWnd *wnd);
-
-bool tpl_surface_stress_test(TPLNativeWnd *wnd );
-bool tpl_buffer_stress_test(TPLNativeWnd *wnd );
-
-static TPLTest tpl_test[] = {
- { "Check TPL buffer map and unmap", tpl_buffer_map_unmap_test },
- { "Check TPL buffer lock and unlock", tpl_buffer_lock_unlock_test },
- { "Check TPL buffer get args", tpl_buffer_get_arg_test },
- { "TPL buffer create native buffer test", tpl_buffer_create_native_buffer_test },
- { "TPL buffer stress test", tpl_buffer_stress_test },
-
- { "TPL display get test", tpl_display_get_test },
- //{ "Check TPL display bind client display",tpl_display_bind_client_display_test },/*5*/
- { "Check TPL display get args", tpl_display_get_arg_test },
- { "TPL display query config test", tpl_display_query_config_test },
- { "TPL display filter config test", tpl_display_filter_config_test },
-
- { "Check TPL object get types", tpl_object_get_type_test },
- { "Check TPL object set and get userdate", tpl_object_userdata_test },
- { "Check TPL object reference and unreference", tpl_object_reference_test },
-
- { "Check TPL surface create", tpl_surface_create_test },
- { "Check TPL surface get args", tpl_surface_get_arg_test },
- { "Check TPL surface frame operation" , tpl_surface_frame_test },
- { "TPL surface get buffer test", tpl_surface_get_buffer_test }, /*15*/
- { "TPL surface post test", tpl_surface_post_test },
- { "TPL surface stress test", tpl_surface_stress_test },
- /*
- { "TPL surface abnormal test",tpl_surface_abnormal_test },
- { "TPL object abnormal test",tpl_object_abnormal_test },
- { "TPL display abnormal test",tpl_display_abnormal_test },
- { "TPL buffer abnormal test",tpl_buffer_abnormal_test },
- */
- { NULL, NULL }
-
-};
-
-#define TPL_RESOURCE_BIN_SHADER_VTX_01 "data/01_vtx.bin"
-#define TPL_RESOURCE_BIN_SHADER_FRAG_01 "data/01_frag.bin"
-#define TPL_RESOURCE_BIN_PROGRAM_01 "data/01_program.bin"
-#define TPL_RESOURCE_TGA_UNCOMP_FILE_01 "data/sample_01_uncomp.tga"
-#define TPL_RESOURCE_TGA_COMP_FILE_02 "data/sample_02_comp.tga"
-
-
-/*-----------------------------------------------------------------
- * time
- *-----------------------------------------------------------------*/
-#define HAVE_MONOTONIC_CLOCK 1
-#define __SEC_TO_USEC( sec ) ((sec) * 1000000)
-#define __USEC_TO_SEC( usec ) ((float)(usec) * 1.0e-6f)
-#define __MSEC_TO_SEC( usec ) ((float)(usec) * 1.0e-3f)
-long int tpl_test_util_get_systime( void );
-void tpl_test_util_init_fps( long int *s_time );
-float tpl_test_util_get_fps( long int s_time, int frame );
-
-/*-----------------------------------------------------------------
- * performance measurement
- *-----------------------------------------------------------------*/
-#define TPL_MEASURE_PERF 1
-
-#if TPL_MEASURE_PERF
-# include <sys/times.h>
-
-typedef struct _GfxUtilTimer GfxUtilTimer;
-
-#define USE_GETTIME 1
-struct _GfxUtilTimer {
- bool is_begin;
- bool is_measured;
- char func[1024];
- int line;
- char msg[1024];
-#if USE_GETTIME
- long int begin_t;
- long int end_t;
-#else
- clock_t begin_tiks;
- clock_t end_tiks;
- struct tms begin_buf;
- struct tms end_buf;
-#endif
-};
-
-# define __TPL_TIMER_GLOBAL_BEGIN( timer, msg ) \
- tpl_test_util_timer_begin( timer, __func__, __LINE__, msg );
-# define __TPL_TIMER_GLOBAL_END( timer, msg ) \
- tpl_test_util_timer_end( timer, __func__, __LINE__, msg );
-
-# define __TPL_TIMER_BEGIN( msg ) \
- GfxUtilTimer __timer = { false, 0, 0 }; \
- tpl_test_util_timer_begin( &__timer, __func__, __LINE__, msg );
-# define __TPL_TIMER_END( msg ) \
- tpl_test_util_timer_end( &__timer, __func__, __LINE__, msg );
-
-void tpl_test_util_timer_list_display( void );
-void tpl_test_util_timer_release( GfxUtilTimer *timer );
-GfxUtilTimer *tpl_test_util_timer_copy( GfxUtilTimer *src, const char *func,
- int line, const char *msg );
-void tpl_test_util_timer_list_clear( void );
-void tpl_test_util_timer_begin( GfxUtilTimer *timer, const char *func,
- int line, const char *msg );
-void tpl_test_util_timer_end( GfxUtilTimer *timer, const char *func, int line,
- const char *msg );
-#else
-# define __TPL_TIMER_GLOBAL_BEGIN( ... ) { ; }
-# define __TPL_TIMER_GLOBAL_END( ... ) { ; }
-# define __TPL_TIMER_BEGIN( ... ) { ; }
-# define __TPL_TIMER_END( ... ) { ; }
-# define tpl_test_util_timer_list_display( ... ) { ; }
-# define tpl_test_util_timer_list_clear( ... ) { ; }
-#endif
-
-
-/*-----------------------------------------------------------------
- * log
- *-----------------------------------------------------------------*/
-
-#define TPL_ENABLE_LOG 1
-
-
-
-
-#define NUM_ERR_STR 512 /* length of the error logging string */
-#define DEFAULT_LOG_STREAM stderr
-
-#define __log_err(fmt, args...) __LOG_ERR(__func__, __LINE__, fmt, ##args)
-bool __LOG_ERR( const char *func, int line, const char *fmt, ... );
-bool __tpl_test_log_display_msg( const char *msg );
-
-
-
-#if TPL_ENABLE_LOG
-# define __log(fmt, args...) __LOG(__func__, __LINE__, fmt, ##args)
-# define __log_begin( ... ) __LOG_BEGIN(__func__);
-# define __log_end( ... ) __LOG_END(__func__);
-bool __LOG( const char *func, int line, const char *fmt, ... );
-void __LOG_BEGIN( const char *func );
-void __LOG_END( const char *func );
-#else
-# define __log( ... ) { ; }
-# define __log_begin( ... ) { ; }
-# define __log_end( ... ) { ; }
-# define __LOG( ... ) { ; }
-# define __LOG_BEGIN( ... ) { ; }
-# define __LOG_END( ... ) { ; }
-#endif
-
-
-/*-----------------------------------------------------------------
- * validation
- *-----------------------------------------------------------------*/
-#define TPL_RSM_MALLOC( obj, type ) \
- { \
- obj = (type*)malloc( sizeof(type) ); \
- if( !obj ) \
- { \
- __log_err( "failed to allocate memory" ); \
- goto finish; \
- } \
- }
-
-#define TPL_RSM_FREE( obj ) \
- { \
- free( obj ); \
- }
-
-#define TPL_RSM_MEMCPY( dst, src, type, num ) \
- { \
- memcpy( dst, src, sizeof(type) * num ); \
- }
-
-#define TPL_CHK_PARAM( exp ) \
- { \
- if( exp ) \
- { \
- __log_err( "invalid input parameter. '"#exp"' is true" ); \
- goto finish; \
- } \
- }
-
-/*-----------------------------------------------------------------
- * math and misc
- *-----------------------------------------------------------------*/
-#define PI 3.1415926535897932384626433832795f
-
-#define FLOAT_TO_FIXED(x) (long)((x)*65536.0f)
-
-typedef struct _GfxMatrix GfxMatrix_t;
-
-struct _GfxMatrix {
- //GLfloat m[4][4];
-};
-
-typedef enum {
- TPL_TEX_COLOR_BLACK,
- TPL_TEX_COLOR_WHITE,
- TPL_TEX_COLOR_GREY,
- TPL_TEX_COLOR_RED,
- TPL_TEX_COLOR_GREEN,
- TPL_TEX_COLOR_BLUE,
- TPL_TEX_COLOR_RGB,
- TPL_TEX_COLOR_RGB2,
- TPL_TEX_COLOR_RGBA_TRANSLUCENCE,
- TPL_TEX_COLOR_RGBA_4444,
- TPL_TEX_COLOR_RGBA_5551,
-} GfxTexColor;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __TPL_UTIL__ */
+++ /dev/null
-<manifest>
- <request>
- <domain name="_"/>
- </request>
-</manifest>