summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhigang Gong <zhigang.gong@linux.intel.com>2012-05-15 10:42:41 +0800
committerZhigang Gong <zhigang.gong@linux.intel.com>2012-05-15 10:42:41 +0800
commit59b18f837483329564192f5ac0b23834c21e2f7a (patch)
tree4851625e4d7e61ba066d1b4ac6cdfb6eea0f1f9a
parent9b4cd897c20eeba5ccbbc2fea2ace6e993580497 (diff)
Added strict warning flags to CFLAGS.
We miss the strict warning flags for a long time, now add it back. This commit also fixed most of the warnings after enable the strict flags. Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
-rw-r--r--src/Makefile.am2
-rw-r--r--src/glamor.c5
-rw-r--r--src/glamor.h3
-rw-r--r--src/glamor_egl.c19
-rw-r--r--src/glamor_fbo.c8
-rw-r--r--src/glamor_pixmap.c12
-rw-r--r--src/glamor_render.c2
-rw-r--r--src/glamor_utils.h2
-rw-r--r--src/glapi.h6
9 files changed, 30 insertions, 29 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index c7e3000..8e334b1 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -15,7 +15,7 @@ instdir = $(moduledir)
INCLUDES = \
$(XORG_INCS)
-AM_CFLAGS = $(XORG_CFLAGS) $(DIX_CFLAGS) $(LIBDRM_CFLAGS)
+AM_CFLAGS = $(CWARNFLAGS) $(XORG_CFLAGS) $(DIX_CFLAGS) $(LIBDRM_CFLAGS)
libglamor_la_LDFLAGS = -avoid-version
diff --git a/src/glamor.c b/src/glamor.c
index 691f758..6b6fa0b 100644
--- a/src/glamor.c
+++ b/src/glamor.c
@@ -465,12 +465,11 @@ glamor_close_screen(int idx, ScreenPtr screen)
glamor_screen_private *glamor_priv;
PixmapPtr screen_pixmap;
int flags;
-
- glamor_priv = glamor_get_screen_private(screen);
- flags = glamor_priv->flags;
#ifdef RENDER
PictureScreenPtr ps = GetPictureScreenIfSet(screen);
#endif
+ glamor_priv = glamor_get_screen_private(screen);
+ flags = glamor_priv->flags;
glamor_glyphs_fini(screen);
screen->CloseScreen = glamor_priv->saved_procs.close_screen;
if (flags & GLAMOR_USE_SCREEN) {
diff --git a/src/glamor.h b/src/glamor.h
index da45acc..c2db86a 100644
--- a/src/glamor.h
+++ b/src/glamor.h
@@ -157,6 +157,9 @@ extern _X_EXPORT void glamor_egl_restore_context(ScreenPtr screen);
* */
extern _X_EXPORT void glamor_egl_exchange_buffers(PixmapPtr front, PixmapPtr back);
+extern _X_EXPORT void glamor_pixmap_exchange_fbos(PixmapPtr front, PixmapPtr back);
+
+
#ifdef GLAMOR_FOR_XORG
#define GLAMOR_EGL_MODULE_NAME "glamoregl"
diff --git a/src/glamor_egl.c b/src/glamor_egl.c
index 35bcc9e..07acf1a 100644
--- a/src/glamor_egl.c
+++ b/src/glamor_egl.c
@@ -91,7 +91,8 @@ struct glamor_egl_screen_private {
struct gbm_device *gbm;
#endif
int has_gem;
- void *gl_context, *old_context;
+ void *glamor_context;
+ void *current_context;
int gl_context_depth;
PFNEGLCREATEIMAGEKHRPROC egl_create_image_khr;
@@ -121,10 +122,9 @@ glamor_egl_make_current(ScreenPtr screen)
if (glamor_egl->gl_context_depth++)
return;
- GET_CURRENT_CONTEXT(current);
- glamor_egl->old_context = current;
+ GET_CURRENT_CONTEXT(glamor_egl->current_context);
- if (glamor_egl->gl_context != current) {
+ if (glamor_egl->glamor_context != glamor_egl->current_context) {
eglMakeCurrent(glamor_egl->display, EGL_NO_SURFACE,
EGL_NO_SURFACE, EGL_NO_CONTEXT);
if (!eglMakeCurrent(glamor_egl->display,
@@ -145,9 +145,9 @@ glamor_egl_restore_context(ScreenPtr screen)
if (--glamor_egl->gl_context_depth)
return;
- if (glamor_egl->old_context &&
- glamor_egl->gl_context != glamor_egl->old_context)
- SET_CURRENT_CONTEXT(glamor_egl->old_context);
+ if (glamor_egl->current_context &&
+ glamor_egl->glamor_context != glamor_egl->current_context)
+ SET_CURRENT_CONTEXT(glamor_egl->current_context);
}
#else
#define glamor_egl_make_current(x)
@@ -255,7 +255,7 @@ glamor_egl_create_textured_screen_ext(ScreenPtr screen,
return TRUE;
}
-Bool
+static Bool
glamor_egl_check_has_gem(int fd)
{
struct drm_gem_flink flink;
@@ -548,8 +548,7 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
return FALSE;
}
#ifdef GLX_USE_SHARED_DISPATCH
- GET_CURRENT_CONTEXT(current);
- glamor_egl->gl_context = current;
+ GET_CURRENT_CONTEXT(glamor_egl->glamor_context);
#endif
glamor_egl->saved_free_screen = scrn->FreeScreen;
scrn->FreeScreen = glamor_egl_free_screen;
diff --git a/src/glamor_fbo.c b/src/glamor_fbo.c
index d80771a..546fe7b 100644
--- a/src/glamor_fbo.c
+++ b/src/glamor_fbo.c
@@ -92,7 +92,7 @@ inline static int cache_hbucket(int size)
return order;
}
-glamor_pixmap_fbo *
+static glamor_pixmap_fbo *
glamor_pixmap_fbo_cache_get(glamor_screen_private *glamor_priv,
int w, int h, GLenum format, int flag)
{
@@ -380,7 +380,7 @@ glamor_destroy_fbo(glamor_pixmap_fbo *fbo)
}
-glamor_pixmap_fbo *
+static glamor_pixmap_fbo *
glamor_create_tex_obj(glamor_screen_private *glamor_priv,
int w, int h, GLenum format, int flag)
{
@@ -422,7 +422,7 @@ glamor_create_tex_obj(glamor_screen_private *glamor_priv,
return fbo;
}
-void
+static void
glamor_destroy_tex_obj(glamor_pixmap_fbo * tex_obj)
{
assert(tex_obj->fb == 0);
@@ -430,7 +430,7 @@ glamor_destroy_tex_obj(glamor_pixmap_fbo * tex_obj)
glamor_pixmap_fbo_cache_put(tex_obj);
}
-int
+static int
_glamor_create_tex(glamor_screen_private *glamor_priv,
int w, int h, GLenum format)
{
diff --git a/src/glamor_pixmap.c b/src/glamor_pixmap.c
index 9b40b66..3f268d9 100644
--- a/src/glamor_pixmap.c
+++ b/src/glamor_pixmap.c
@@ -185,7 +185,7 @@ glamor_set_alu(struct glamor_gl_dispatch *dispatch, unsigned char alu)
return TRUE;
}
-void *
+static void *
_glamor_color_convert_a1_a8(void *src_bits, void *dst_bits, int w, int h, int stride, int revert)
{
PictFormatShort dst_format, src_format;
@@ -269,7 +269,7 @@ _glamor_color_convert_a1_a8(void *src_bits, void *dst_bits, int w, int h, int st
(*dst) = ((a) << (a_shift)) | ((r) << (b_shift)) | ((g) << (g_shift)) | ((b) << (r_shift)); \
}
-void *
+static void *
_glamor_color_revert_x2b10g10r10(void *src_bits, void *dst_bits, int w, int h, int stride, int no_alpha, int revert, int swap_rb)
{
int x,y;
@@ -306,7 +306,7 @@ _glamor_color_revert_x2b10g10r10(void *src_bits, void *dst_bits, int w, int h, i
}
-void *
+static void *
_glamor_color_revert_x1b5g5r5(void *src_bits, void *dst_bits, int w, int h, int stride, int no_alpha, int revert, int swap_rb)
{
int x,y;
@@ -360,7 +360,7 @@ _glamor_color_revert_x1b5g5r5(void *src_bits, void *dst_bits, int w, int h, int
*
*/
-void *
+static void *
glamor_color_convert_to_bits(void *src_bits, void *dst_bits, int w, int h, int stride, int no_alpha, int revert, int swap_rb)
{
if (revert == REVERT_DOWNLOADING_A1 || revert == REVERT_UPLOADING_A1) {
@@ -917,8 +917,8 @@ glamor_download_sub_pixmap_to_cpu(PixmapPtr pixmap, int x, int y, int w, int h,
read = dispatch->glMapBuffer(GL_PIXEL_PACK_BUFFER,
GL_READ_ONLY);
for (yy = 0; yy < pixmap->drawable.height; yy++)
- memcpy(data + yy * stride,
- read + (h - yy - 1) * stride, stride);
+ memcpy((char*)data + yy * stride,
+ (char*)read + (h - yy - 1) * stride, stride);
dispatch->glUnmapBuffer(GL_PIXEL_PACK_BUFFER);
dispatch->glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
dispatch->glDeleteBuffers(1, &temp_pbo);
diff --git a/src/glamor_render.c b/src/glamor_render.c
index b729e98..a17b6fd 100644
--- a/src/glamor_render.c
+++ b/src/glamor_render.c
@@ -961,11 +961,11 @@ glamor_composite_with_shader(CARD8 op,
PictFormatShort saved_source_format = 0;
float src_matrix[9], mask_matrix[9];
GLfloat source_solid_color[4], mask_solid_color[4];
- dest_pixmap_priv = glamor_get_pixmap_private(dest_pixmap);
int vert_stride = 4;
int nrect_max;
Bool ret = FALSE;
+ dest_pixmap_priv = glamor_get_pixmap_private(dest_pixmap);
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(dest_pixmap_priv)) {
glamor_fallback("dest has no fbo.\n");
goto fail;
diff --git a/src/glamor_utils.h b/src/glamor_utils.h
index 9d32e6e..5cd37de 100644
--- a/src/glamor_utils.h
+++ b/src/glamor_utils.h
@@ -886,9 +886,9 @@ static inline void _glamor_compare_pixmaps(PixmapPtr pixmap1, PixmapPtr pixmap2,
int little_endian = 0;
unsigned char *p_test;
int bpp = pixmap1->drawable.depth == 8 ? 1 : 4;
+ int stride = pixmap1->devKind;
assert(pixmap1->devKind == pixmap2->devKind);
- int stride = pixmap1->devKind;
ErrorF("stride:%d, width:%d, height:%d\n", stride, w, h);
diff --git a/src/glapi.h b/src/glapi.h
index da521aa..d510dac 100644
--- a/src/glapi.h
+++ b/src/glapi.h
@@ -79,7 +79,7 @@ extern const struct _glapi_table *_glapi_Dispatch;
extern const void *_glapi_Context;
# define GET_DISPATCH() _glapi_tls_Dispatch
-# define GET_CURRENT_CONTEXT(C) struct gl_context *C = (struct gl_context *) _glapi_tls_Context
+# define GET_CURRENT_CONTEXT(C) C = (typeof(C)) _glapi_tls_Context
# define SET_CURRENT_CONTEXT(C) _glapi_tls_Context = (void*)C
#else
@@ -92,7 +92,7 @@ extern void *_glapi_Context;
# define GET_DISPATCH() \
(likely(_glapi_Dispatch) ? _glapi_Dispatch : _glapi_get_dispatch())
-# define GET_CURRENT_CONTEXT(C) struct gl_context *C = (struct gl_context *) \
+# define GET_CURRENT_CONTEXT(C) C = (typeof(C)) \
(likely(_glapi_Context) ? _glapi_Context : _glapi_get_context())
@@ -104,7 +104,7 @@ extern void *_glapi_Context;
# else
# define GET_DISPATCH() _glapi_Dispatch
-# define GET_CURRENT_CONTEXT(C) struct gl_context *C = (struct gl_context *) _glapi_Context
+# define GET_CURRENT_CONTEXT(C) C = (typeof(C)) _glapi_Context
# define SET_CURRENT_CONTEXT(C) _glapi_Context = (void*)C
# endif