Fixed some compilation warning/error or error checking.

There is one compilation error ,cast int to pointer, when built without
libgbm, reported by Gaetan Nadon.
And some error checking after memory allocation, reported by Seth Arnold.
There are still some similar issues in the largepixmap implementation.
They are relatively more complicate due to the heavy usage of RegionXXX
APIs which may allocate implicitly. Will fix them in the future.

Signed-off-by: Zhigang Gong <zhigang.gong@intel.com>
Tested-by: Gaetan Nadon <memsize@videotron.ca>
This commit is contained in:
Zhigang Gong 2013-11-19 15:16:57 +08:00 committed by Eric Anholt
parent a5321ea431
commit 06ba3fdfd6
2 changed files with 11 additions and 6 deletions

View File

@ -68,11 +68,14 @@ glamor_compile_glsl_prog(glamor_gl_dispatch * dispatch, GLenum type,
dispatch->glGetShaderiv(prog, GL_INFO_LOG_LENGTH, &size);
info = malloc(size);
dispatch->glGetShaderInfoLog(prog, size, NULL, info);
ErrorF("Failed to compile %s: %s\n",
type == GL_FRAGMENT_SHADER ? "FS" : "VS", info);
ErrorF("Program source:\n%s", source);
if (info) {
dispatch->glGetShaderInfoLog(prog, size, NULL, info);
ErrorF("Failed to compile %s: %s\n",
type == GL_FRAGMENT_SHADER ? "FS" : "VS", info);
ErrorF("Program source:\n%s", source);
free(info);
} else
ErrorF("Failed to get shader compilation info.\n");
FatalError("GLSL compile failure\n");
}

View File

@ -500,6 +500,8 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
glamor_identify(0);
glamor_egl = calloc(sizeof(*glamor_egl), 1);
if (glamor_egl == NULL)
return FALSE;
if (xf86GlamorEGLPrivateIndex == -1)
xf86GlamorEGLPrivateIndex =
xf86AllocateScrnInfoPrivateIndex();
@ -514,7 +516,7 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
}
glamor_egl->display = eglGetDisplay(glamor_egl->gbm);
#else
glamor_egl->display = eglGetDisplay((EGLNativeDisplayType)fd);
glamor_egl->display = eglGetDisplay((EGLNativeDisplayType)(intptr_t)fd);
#endif
glamor_egl->has_gem = glamor_egl_check_has_gem(fd);