From: Sangjin Kim Date: Mon, 4 Mar 2013 02:46:24 +0000 (+0900) Subject: Sync-up with latest release source code. X-Git-Tag: TizenStudio_2.0_p2.3~931^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=007e8bfc18c32a878387a1f6ecd55150c6ac1c6d;p=sdk%2Femulator%2Fqemu.git Sync-up with latest release source code. Signed-off-by: Sangjin Kim --- diff --git a/tizen/src/hw/gloffscreen_common.c b/tizen/src/hw/gloffscreen_common.c index e2fee96..433c78e 100644 --- a/tizen/src/hw/gloffscreen_common.c +++ b/tizen/src/hw/gloffscreen_common.c @@ -304,6 +304,8 @@ int glo_flags_get_from_glx(const int *fbConfig, int assumeBooleans) { case GLX_ACCUM_BLUE_SIZE: case GLX_ACCUM_ALPHA_SIZE: break; + default: + break; } // go to next @@ -473,6 +475,8 @@ int glo_get_glx_from_flags(int formatFlags, int glxEnum) { case GLX_MAX_PBUFFER_HEIGHT: case GLX_MAX_PBUFFER_PIXELS: return 0; + default: + return 0; } return 0; } diff --git a/tizen/src/hw/gloffscreen_test.c b/tizen/src/hw/gloffscreen_test.c index 525447a..67ce8f2 100644 --- a/tizen/src/hw/gloffscreen_test.c +++ b/tizen/src/hw/gloffscreen_test.c @@ -69,13 +69,15 @@ #define TX (32) #define TY (32) +#define CHECK_SUCCESS 0 +#define CHECK_FAIL 1 int gl_acceleration_capability_check (void) { - int test_failure = 0; + //int test_failure = 0; GloContext *context; GloSurface *surface; - unsigned char *datain = (unsigned char *)malloc(4*TX*TY); - unsigned char *datain_flip = (unsigned char *)malloc(4*TX*TY); // flipped input data (for GL) - unsigned char *dataout = (unsigned char *)malloc(4*TX*TY); + unsigned char *datain; + unsigned char *datain_flip; + unsigned char *dataout; unsigned char *p; int x,y; const int bufferAttributes[] = { @@ -96,9 +98,13 @@ int gl_acceleration_capability_check (void) { // test failed. return 1; } -*/ - memset(datain_flip, 0, TX*TY*4); +*/ + datain = (unsigned char *)malloc(4*TX*TY); + datain_flip = (unsigned char *)malloc(4*TX*TY); + memset(datain, 0, TX*TY*4); + memset(datain_flip, 0, TX*TY*4); + p = datain; for (y=0;ypixmap, surface->image, 0, 0, AllPlanes); } else { - img = XGetImage(glo.dpy, surface->pixmap, 0, 0, surface->width, surface->height, AllPlanes, ZPixmap); + XGetImage(glo.dpy, surface->pixmap, 0, 0, surface->width, surface->height, AllPlanes, ZPixmap); } } @@ -526,7 +522,7 @@ static int glo_can_readback(void) { unsigned char *datain = (unsigned char *)g_malloc(4*TX*TY); unsigned char *datain_flip = (unsigned char *)g_malloc(4*TX*TY); // flipped input data (for GL) - unsigned char *dataout = (unsigned char *)g_malloc(4*TX*TY); + unsigned char *dataout; unsigned char *p; int x,y; @@ -560,11 +556,17 @@ static int glo_can_readback(void) { } context = glo_context_create(bufferFlags, 0); - if (context == NULL) + if (context == NULL) { + g_free(datain); + g_free(datain_flip); return 1; + } surface = glo_surface_create(TX, TY, context); - if (surface == NULL) + if (surface == NULL) { + g_free(datain); + g_free(datain_flip); return 1; + } glo_surface_makecurrent(surface); @@ -579,6 +581,7 @@ static int glo_can_readback(void) { glDrawPixels(TX,TY,glFormat, glType, datain_flip); glFlush(); + dataout = (unsigned char *)g_malloc(4*TX*TY); memset(dataout, 0, bpp*TX*TY); glo_surface_getcontents(surface, TX*4, bpp*8, dataout); @@ -586,8 +589,16 @@ static int glo_can_readback(void) { glo_surface_destroy(surface); glo_context_destroy(context); - if (memcmp(datain, dataout, bpp*TX*TY)==0) + if (memcmp(datain, dataout, bpp*TX*TY)==0) { + g_free(datain); + g_free(datain_flip); + g_free(dataout); return 1; + } + + g_free(datain); + g_free(datain_flip); + g_free(dataout); return 0; } diff --git a/tizen/src/hw/opengl_exec.c b/tizen/src/hw/opengl_exec.c index 5b28351..43c1f35 100644 --- a/tizen/src/hw/opengl_exec.c +++ b/tizen/src/hw/opengl_exec.c @@ -609,7 +609,8 @@ static void bind_qsurface(GLState *state, { qsurface->glstate = state; - QTAILQ_INSERT_HEAD(&state->qsurfaces, qsurface, next); + if ( qsurface->type == SURFACE_WINDOW ) + QTAILQ_INSERT_HEAD(&state->qsurfaces, qsurface, next); state->current_qsurface = qsurface; } @@ -620,7 +621,8 @@ static void unbind_qsurface(GLState *state, { qsurface->glstate = NULL; - QTAILQ_REMOVE(&state->qsurfaces, qsurface, next); + if ( qsurface->type == SURFACE_WINDOW ) + QTAILQ_REMOVE(&state->qsurfaces, qsurface, next); if ( state->current_qsurface == qsurface ) state->current_qsurface = NULL; @@ -962,13 +964,6 @@ static void destroy_gl_state(GLState *state) { int i; - /* XXX:Current limitation is that each surface is binded to one - * context, thus not support sharing surface between contexts. If guest - * does this, deleting surface in one context make trouble to other - * context. Leave the work until the uninitialization. Need clean the code - * and decouple the context and surface in future. - */ -#if 0 QGloSurface *qsurface, *tmp; QTAILQ_FOREACH_SAFE(qsurface, &state->qsurfaces, next, tmp) { @@ -976,7 +971,6 @@ static void destroy_gl_state(GLState *state) QTAILQ_REMOVE(&state->qsurfaces, qsurface, next); g_free(qsurface); } -#endif if (state->context) glo_context_destroy(state->context); @@ -1125,9 +1119,11 @@ GLState *_create_context(ProcessState *process, int fake_ctxt, int fake_shareLis GLState *get_glstate_for_fake_ctxt(ProcessState *process, int fake_ctxt) { int i; - for (i = 0; i < process->nb_states; i++) + for (i = 0; i < process->nb_states; i++) { if (process->glstates[i]->fake_ctxt == fake_ctxt) return process->glstates[i]; + } + return 0; } @@ -1144,9 +1140,12 @@ void gl_disconnect(ProcessState *process) if (process->cmdbuf) g_free(process->cmdbuf); - for (i = 0; &processes[i] != process; i ++); - memmove(&processes[i], &processes[i + 1], - (MAX_HANDLED_PROCESS - 1 - i) * sizeof(ProcessState)); + for (i = 0; &processes[i] != process; i ++) { + ; // do nothing + } + + memmove(&processes[i], &processes[i + 1], + (MAX_HANDLED_PROCESS - 1 - i) * sizeof(ProcessState)); } static const int beginend_allowed[GL_N_CALLS] = { @@ -1171,7 +1170,7 @@ ProcessStruct *vmgl_get_process(pid_t pid) * process->current_state contains info on which of the guests contexts is * current. */ - for (i = 0; i < MAX_HANDLED_PROCESS; i ++) + for (i = 0; i < MAX_HANDLED_PROCESS; i ++) { if (processes[i].p.process_id == pid) { process = &processes[i]; break; @@ -1183,6 +1182,7 @@ ProcessStruct *vmgl_get_process(pid_t pid) process->current_state = &process->default_state; break; } + } if (process == NULL) { DEBUGF( "Too many processes !\n"); @@ -1244,7 +1244,10 @@ static const char *opengl_strtok(const char *s, int *n, char **saveptr, char *pr } start = s; - for (; *n && *s && !strchr(delim, *s); s++, (*n)--); + for (; *n && *s && !strchr(delim, *s); s++, (*n)--) { + ; // do nothing + } + if (*n > 0) s++, (*n)--; @@ -1303,7 +1306,10 @@ static char *do_eglShaderPatch(const char *source, int length, int *patched_len) if (!strncmp(p, "lowp", 4) || !strncmp(p, "mediump", 7) || !strncmp(p, "highp", 5)) { continue; } else if (!strncmp(p, "precision", 9)) { - while ((p = opengl_strtok(0, &length, &saveptr, p)) && !strchr(p, ';')); + while ((p = opengl_strtok(0, &length, &saveptr, p)) && !strchr(p, ';')) { + // do nothing + ; + } } else { if (!strncmp(p, "gl_MaxVertexUniformVectors", 26)) { p = "(gl_MaxVertexUniformComponents / 4)"; @@ -1330,15 +1336,23 @@ static char *do_eglShaderPatch(const char *source, int length, int *patched_len) patched[*patched_len] = 0; /* check that we don't leave dummy preprocessor lines */ for (sp = patched; *sp;) { - for (; *sp == ' ' || *sp == '\t'; sp++); + for (; *sp == ' ' || *sp == '\t'; sp++) { + ; // do nothing + } if (!strncmp(sp, "#define", 7)) { - for (p = sp + 7; *p == ' ' || *p == '\t'; p++); + for (p = sp + 7; *p == ' ' || *p == '\t'; p++) { + ; // do nothing + } if (*p == '\n' || *p == '\r' || *p == '/') { memset(sp, 0x20, 7); } } - for (; *sp && *sp != '\n' && *sp != '\r'; sp++); - for (; *sp == '\n' || *sp == '\r'; sp++); + for (; *sp && *sp != '\n' && *sp != '\r'; sp++) { + ; // do nothing + } + for (; *sp == '\n' || *sp == '\r'; sp++) { + ; // do nothing + } } return patched; } @@ -1360,8 +1374,9 @@ shadersrc_gles_to_gl(GLsizei count, const char** string, char **s, const GLint* if(string[i]) { s[i] = do_eglShaderPatch(string[i], len, &l[i]); if(!s[i]) { - while(i) + while(i) { free(s[--i]); + } free(l); free(s); @@ -1709,6 +1724,8 @@ int do_function_call(ProcessState *process, int func_number, unsigned long *args glstate->context); qsurface->client_drawable = client_drawable; qsurface->ref = 1; + qsurface->type = SURFACE_WINDOW; + qsurface->status = SURFACE_ACTIVE; bind_qsurface(glstate, qsurface); // DEBUGF( " --Client drawable not found, create new surface: %16x %16lx\n", (unsigned int)qsurface, (unsigned long int)client_drawable); @@ -2478,8 +2495,10 @@ int do_function_call(ProcessState *process, int func_number, unsigned long *args ptr_func_glShaderSource(args[0], args[1], tab_prog_new, tab_length_new); - for (i = 0; i < args[1]; i++) + for (i = 0; i < args[1]; i++) { free(tab_prog_new[i]); + } + free(tab_prog_new); free(tab_length_new);