Silence compilation warnings.

After increase to gcc4.7, it reports more warnings, now
fix them.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Tested-by: Junyan He<junyan.he@linux.intel.com>
This commit is contained in:
Zhigang Gong 2012-08-08 20:11:43 +08:00 committed by Eric Anholt
parent 50614451ad
commit b8f0a21882
17 changed files with 281 additions and 338 deletions

View File

@ -392,14 +392,12 @@ _glamor_copy_n_to_n(DrawablePtr src,
Bool upsidedown, Pixel bitplane, Bool upsidedown, Pixel bitplane,
void *closure, Bool fallback) void *closure, Bool fallback)
{ {
glamor_access_t dst_access;
PixmapPtr dst_pixmap, src_pixmap; PixmapPtr dst_pixmap, src_pixmap;
glamor_pixmap_private *dst_pixmap_priv, *src_pixmap_priv; glamor_pixmap_private *dst_pixmap_priv, *src_pixmap_priv;
glamor_screen_private *glamor_priv; glamor_screen_private *glamor_priv;
glamor_gl_dispatch *dispatch; glamor_gl_dispatch *dispatch;
BoxPtr extent; BoxPtr extent;
RegionRec region; RegionRec region;
ScreenPtr screen;
int src_x_off, src_y_off, dst_x_off, dst_y_off; int src_x_off, src_y_off, dst_x_off, dst_y_off;
Bool ok = FALSE; Bool ok = FALSE;
int force_clip = 0; int force_clip = 0;
@ -410,7 +408,6 @@ _glamor_copy_n_to_n(DrawablePtr src,
dst_pixmap_priv = glamor_get_pixmap_private(dst_pixmap); dst_pixmap_priv = glamor_get_pixmap_private(dst_pixmap);
src_pixmap = glamor_get_drawable_pixmap(src); src_pixmap = glamor_get_drawable_pixmap(src);
src_pixmap_priv = glamor_get_pixmap_private(src_pixmap); src_pixmap_priv = glamor_get_pixmap_private(src_pixmap);
screen = dst_pixmap->drawable.pScreen;
glamor_priv = glamor_get_screen_private(dst->pScreen); glamor_priv = glamor_get_screen_private(dst->pScreen);
@ -612,11 +609,6 @@ fall_back:
glamor_get_drawable_location(src), glamor_get_drawable_location(src),
glamor_get_drawable_location(dst)); glamor_get_drawable_location(dst));
if (gc && gc->alu != GXcopy)
dst_access = GLAMOR_ACCESS_RW;
else
dst_access = GLAMOR_ACCESS_WO;
if (glamor_prepare_access(dst, GLAMOR_ACCESS_RW)) { if (glamor_prepare_access(dst, GLAMOR_ACCESS_RW)) {
if (dst == src if (dst == src
|| glamor_prepare_access(src, GLAMOR_ACCESS_RO)) { || glamor_prepare_access(src, GLAMOR_ACCESS_RO)) {

View File

@ -33,15 +33,12 @@ _glamor_copy_plane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
int srcx, int srcy, int w, int h, int dstx, int dsty, int srcx, int srcy, int w, int h, int dstx, int dsty,
unsigned long bitPlane, RegionPtr *pRegion, Bool fallback) unsigned long bitPlane, RegionPtr *pRegion, Bool fallback)
{ {
glamor_screen_private *glamor_priv;
if (!fallback if (!fallback
&& glamor_ddx_fallback_check_gc(pGC) && glamor_ddx_fallback_check_gc(pGC)
&& glamor_ddx_fallback_check_pixmap(pSrc) && glamor_ddx_fallback_check_pixmap(pSrc)
&& glamor_ddx_fallback_check_pixmap(pDst)) && glamor_ddx_fallback_check_pixmap(pDst))
goto fail; goto fail;
glamor_priv = glamor_get_screen_private(pDst->pScreen);
glamor_prepare_access(pDst, GLAMOR_ACCESS_RW); glamor_prepare_access(pDst, GLAMOR_ACCESS_RW);
glamor_prepare_access(pSrc, GLAMOR_ACCESS_RO); glamor_prepare_access(pSrc, GLAMOR_ACCESS_RO);
*pRegion = fbCopyPlane(pSrc, pDst, pGC, srcx, srcy, w, h, *pRegion = fbCopyPlane(pSrc, pDst, pGC, srcx, srcy, w, h,

View File

@ -566,15 +566,13 @@ glamor_bitmap_to_region(PixmapPtr pixmap)
/* Borrow from cairo. */ /* Borrow from cairo. */
Bool Bool
glamor_gl_has_extension(char *extension) glamor_gl_has_extension(const char *extension)
{ {
const char *gl_extensions; const char *pext;
char *pext;
int ext_len; int ext_len;
ext_len = strlen(extension); ext_len = strlen(extension);
gl_extensions = (const char *) glGetString(GL_EXTENSIONS); pext = (const char*)glGetString(GL_EXTENSIONS);
pext = (char *) gl_extensions;
if (pext == NULL || extension == NULL) if (pext == NULL || extension == NULL)
return FALSE; return FALSE;

View File

@ -335,8 +335,6 @@ _glamor_egl_destroy_pixmap_image(PixmapPtr pixmap)
} }
} }
extern void glamor_pixmap_exchange_fbos(PixmapPtr front, PixmapPtr back);
_X_EXPORT void _X_EXPORT void
glamor_egl_exchange_buffers(PixmapPtr front, PixmapPtr back) glamor_egl_exchange_buffers(PixmapPtr front, PixmapPtr back)
{ {
@ -399,16 +397,13 @@ static Bool
glamor_egl_has_extension(struct glamor_egl_screen_private *glamor_egl, glamor_egl_has_extension(struct glamor_egl_screen_private *glamor_egl,
const char *extension) const char *extension)
{ {
const char *egl_extensions; const char *pext;
char *pext;
int ext_len; int ext_len;
ext_len = strlen(extension);
egl_extensions = ext_len = strlen(extension);
pext =
(const char *) eglQueryString(glamor_egl->display, (const char *) eglQueryString(glamor_egl->display,
EGL_EXTENSIONS); EGL_EXTENSIONS);
pext = (char *) egl_extensions;
if (pext == NULL || extension == NULL) if (pext == NULL || extension == NULL)
return FALSE; return FALSE;
while ((pext = strstr(pext, extension)) != NULL) { while ((pext = strstr(pext, extension)) != NULL) {

View File

@ -31,10 +31,10 @@
#include "config.h" #include "config.h"
#endif #endif
#define GLAMOR_FOR_XORG
#include "glamor.h"
#include <xf86Module.h>
#include <xorg-server.h> #include <xorg-server.h>
#define GLAMOR_FOR_XORG
#include <xf86Module.h>
#include "glamor.h"
static XF86ModuleVersionInfo VersRec = { static XF86ModuleVersionInfo VersRec = {
GLAMOR_EGL_MODULE_NAME, GLAMOR_EGL_MODULE_NAME,

View File

@ -258,7 +258,6 @@ glamor_fbo_expire(glamor_screen_private *glamor_priv)
struct xorg_list *cache; struct xorg_list *cache;
glamor_pixmap_fbo *fbo_entry, *tmp; glamor_pixmap_fbo *fbo_entry, *tmp;
int i,j,k; int i,j,k;
int empty_cache = TRUE;
for(i = 0; i < CACHE_FORMAT_COUNT; i++) for(i = 0; i < CACHE_FORMAT_COUNT; i++)
for(j = 0; j < CACHE_BUCKET_WCOUNT; j++) for(j = 0; j < CACHE_BUCKET_WCOUNT; j++)
@ -266,7 +265,6 @@ glamor_fbo_expire(glamor_screen_private *glamor_priv)
cache = &glamor_priv->fbo_cache[i][j][k]; cache = &glamor_priv->fbo_cache[i][j][k];
xorg_list_for_each_entry_safe_reverse(fbo_entry, tmp, cache, list) { xorg_list_for_each_entry_safe_reverse(fbo_entry, tmp, cache, list) {
if (GLAMOR_TICK_AFTER(fbo_entry->expire, glamor_priv->tick)) { if (GLAMOR_TICK_AFTER(fbo_entry->expire, glamor_priv->tick)) {
empty_cache = FALSE;
break; break;
} }

View File

@ -36,11 +36,8 @@ _glamor_fill_spans(DrawablePtr drawable,
BoxPtr pbox; BoxPtr pbox;
int x1, x2, y; int x1, x2, y;
RegionPtr pClip = fbGetCompositeClip(gc); RegionPtr pClip = fbGetCompositeClip(gc);
glamor_screen_private *glamor_priv;
Bool ret = FALSE; Bool ret = FALSE;
glamor_priv = glamor_get_screen_private(drawable->pScreen);
if (gc->fillStyle != FillSolid && gc->fillStyle != FillTiled) if (gc->fillStyle != FillSolid && gc->fillStyle != FillTiled)
goto fail; goto fail;

View File

@ -222,7 +222,7 @@ get_mask_cache(struct glamor_glyph_mask_cache *maskcache, int blocks)
{ {
int free_cleared_bit, idx = -1; int free_cleared_bit, idx = -1;
int retry_cnt = 0; int retry_cnt = 0;
unsigned int bits_mask; unsigned int bits_mask = 0;
if (maskcache->free_bitmap == 0) if (maskcache->free_bitmap == 0)
return NULL; return NULL;
@ -514,20 +514,20 @@ glamor_glyph_priv_get_edge_map(GlyphPtr glyph, struct glamor_glyph *priv,
PicturePtr glyph_picture) PicturePtr glyph_picture)
{ {
PixmapPtr glyph_pixmap = (PixmapPtr) glyph_picture->pDrawable; PixmapPtr glyph_pixmap = (PixmapPtr) glyph_picture->pDrawable;
struct glamor_pixmap_private *pixmap_priv;
int j; int j;
unsigned long long left_x1_map, left_x2_map, right_x1_map, right_x2_map; unsigned long long left_x1_map = 0, left_x2_map = 0;
unsigned long long right_x1_map = 0, right_x2_map = 0;
int bitsPerPixel; int bitsPerPixel;
int stride; int stride;
void *bits; void *bits;
int width; int width;
unsigned int left_x1_data, left_x2_data, right_x1_data, right_x2_data; unsigned int left_x1_data = 0, left_x2_data = 0;
unsigned int right_x1_data = 0, right_x2_data = 0;
bitsPerPixel = glyph_pixmap->drawable.bitsPerPixel; bitsPerPixel = glyph_pixmap->drawable.bitsPerPixel;
stride = glyph_pixmap->devKind; stride = glyph_pixmap->devKind;
bits = glyph_pixmap->devPrivate.ptr; bits = glyph_pixmap->devPrivate.ptr;
width = glyph->info.width; width = glyph->info.width;
pixmap_priv = glamor_get_pixmap_private(glyph_pixmap);
if (glyph_pixmap->drawable.width < 2 if (glyph_pixmap->drawable.width < 2
|| !(glyph_pixmap->drawable.depth == 8 || !(glyph_pixmap->drawable.depth == 8
@ -662,12 +662,6 @@ glyph_new_fixed_list(struct glamor_glyph_list *fixed_list,
fixed_list->list[list_cnt - 1].len = cur_pos - n_off; fixed_list->list[list_cnt - 1].len = cur_pos - n_off;
} else } else
fixed_list->list[0].len = cur_pos - *head_pos - n_off; fixed_list->list[0].len = cur_pos - *head_pos - n_off;
while(list_cnt--) {
DEBUGF("new fixed list type %d entry len %d x %d y %d"
"head_pos %d pos %d list %d has %d glyphs.\n",
fixed_list->type, fixed_list->nlist,
cur_x, cur_y, *head_pos, cur_pos, i, fixed_list->list[i++].len);
}
(*fixed_cnt)++; (*fixed_cnt)++;
} }
@ -712,9 +706,9 @@ glamor_glyphs_intersect(int nlist, GlyphListPtr list, GlyphPtr * glyphs,
Bool first = TRUE, first_list = TRUE; Bool first = TRUE, first_list = TRUE;
Bool need_free_list_region = FALSE; Bool need_free_list_region = FALSE;
Bool need_free_fixed_list = FALSE; Bool need_free_fixed_list = FALSE;
struct glamor_glyph *priv; struct glamor_glyph *priv = NULL;
Bool in_non_intersected_list = -1; Bool in_non_intersected_list = -1;
GlyphListPtr head_list, saved_list; GlyphListPtr head_list;
int head_x, head_y, head_pos; int head_x, head_y, head_pos;
int fixed_cnt = 0; int fixed_cnt = 0;
GlyphPtr *head_glyphs; GlyphPtr *head_glyphs;
@ -732,9 +726,10 @@ glamor_glyphs_intersect(int nlist, GlyphListPtr list, GlyphPtr * glyphs,
extents = pixman_region_extents(&current_region); extents = pixman_region_extents(&current_region);
saved_list = list;
x = 0; x = 0;
y = 0; y = 0;
x1 = x2 = y1 = y2 = 0;
n = 0;
extents->x1 = 0; extents->x1 = 0;
extents->y1 = 0; extents->y1 = 0;
extents->x2 = 0; extents->x2 = 0;
@ -743,10 +738,10 @@ glamor_glyphs_intersect(int nlist, GlyphListPtr list, GlyphPtr * glyphs,
head_list = list; head_list = list;
DEBUGF("has %d lists.\n", nlist); DEBUGF("has %d lists.\n", nlist);
while (nlist--) { while (nlist--) {
BoxRec left_box, right_box; BoxRec left_box, right_box = {0};
Bool has_left_edge_box = FALSE, has_right_edge_box = FALSE; Bool has_left_edge_box = FALSE, has_right_edge_box = FALSE;
Bool left_to_right; Bool left_to_right;
struct glamor_glyph *left_priv, *right_priv; struct glamor_glyph *left_priv = NULL, *right_priv = NULL;
x += list->xOff; x += list->xOff;
y += list->yOff; y += list->yOff;
@ -1146,7 +1141,7 @@ glamor_glyph_cache(glamor_screen_private *glamor, GlyphPtr glyph, int *out_x,
*out_y = priv->y; *out_y = priv->y;
return cache->picture; return cache->picture;
} }
typedef void (*glyphs_flush)(void * arg); typedef void (*glyphs_flush_func)(void * arg);
struct glyphs_flush_dst_arg { struct glyphs_flush_dst_arg {
CARD8 op; CARD8 op;
PicturePtr src; PicturePtr src;
@ -1223,7 +1218,7 @@ glamor_buffer_glyph(glamor_screen_private *glamor_priv,
int x_glyph, int y_glyph, int x_glyph, int y_glyph,
int dx, int dy, int w, int h, int dx, int dy, int w, int h,
int glyphs_dst_mode, int glyphs_dst_mode,
glyphs_flush glyphs_flush, void *flush_arg) glyphs_flush_func glyphs_flush, void *flush_arg)
{ {
ScreenPtr screen = glamor_priv->screen; ScreenPtr screen = glamor_priv->screen;
glamor_composite_rect_t *rect; glamor_composite_rect_t *rect;
@ -1327,7 +1322,7 @@ glamor_buffer_glyph_clip(glamor_screen_private *glamor_priv,
int glyph_dx, int glyph_dy, int glyph_dx, int glyph_dy,
int width, int height, int width, int height,
int glyphs_mode, int glyphs_mode,
glyphs_flush flush_func, glyphs_flush_func flush_func,
void *arg void *arg
) )
{ {
@ -1490,24 +1485,24 @@ retry:
glyph = *glyphs++; glyph = *glyphs++;
if (glyph->info.width > 0 if (glyph->info.width > 0
&& glyph->info.height > 0) { && glyph->info.height > 0) {
glyphs_flush flush_func; glyphs_flush_func flush_func;
void *arg; void *temp_arg;
if (need_free_mask) { if (need_free_mask) {
if (pmask_buffer->count) if (pmask_buffer->count)
flush_func = (glyphs_flush)glamor_glyphs_flush_mask; flush_func = (glyphs_flush_func)glamor_glyphs_flush_mask;
else else
flush_func = NULL; flush_func = NULL;
arg = pmask_arg; temp_arg = pmask_arg;
} else { } else {
/* If we are using global mask cache, then we need to /* If we are using global mask cache, then we need to
* flush dst instead of mask. As some dst depends on the * flush dst instead of mask. As some dst depends on the
* previous mask result. Just flush mask can't get all previous's * previous mask result. Just flush mask can't get all previous's
* overlapped glyphs.*/ * overlapped glyphs.*/
if (dst_buffer.count || mask_buffer.count) if (dst_buffer.count || mask_buffer.count)
flush_func = (glyphs_flush)glamor_glyphs_flush_dst; flush_func = (glyphs_flush_func)glamor_glyphs_flush_dst;
else else
flush_func = NULL; flush_func = NULL;
arg = &dst_arg; temp_arg = &dst_arg;
} }
glamor_buffer_glyph(glamor_priv, pmask_buffer, glamor_buffer_glyph(glamor_priv, pmask_buffer,
mask_format->format, mask_format->format,
@ -1516,7 +1511,7 @@ retry:
glyph->info.width, glyph->info.height, glyph->info.width, glyph->info.height,
glyphs_dst_mode, glyphs_dst_mode,
flush_func, flush_func,
(void*)arg); (void*)temp_arg);
} }
x += glyph->info.xOff; x += glyph->info.xOff;
y += glyph->info.yOff; y += glyph->info.yOff;
@ -1538,7 +1533,7 @@ retry:
glamor_destroy_pixmap(mask_pixmap); glamor_destroy_pixmap(mask_pixmap);
} else { } else {
struct glamor_glyph priv; struct glamor_glyph priv;
glyphs_flush flush_func; glyphs_flush_func flush_func;
BoxPtr rects; BoxPtr rects;
int nrect; int nrect;
@ -1570,7 +1565,7 @@ retry:
y += dst->pDrawable->y; y += dst->pDrawable->y;
if (dst_buffer.count || mask_buffer.count) if (dst_buffer.count || mask_buffer.count)
flush_func = (glyphs_flush)glamor_glyphs_flush_dst; flush_func = (glyphs_flush_func)glamor_glyphs_flush_dst;
else else
flush_func = NULL; flush_func = NULL;
@ -1633,10 +1628,10 @@ glamor_glyphs_to_dst(CARD8 op,
if (glyph->info.width > 0 if (glyph->info.width > 0
&& glyph->info.height > 0) { && glyph->info.height > 0) {
glyphs_flush flush_func; glyphs_flush_func flush_func;
if (dst_buffer.count || mask_buffer.count) if (dst_buffer.count || mask_buffer.count)
flush_func = (glyphs_flush)glamor_glyphs_flush_dst; flush_func = (glyphs_flush_func)glamor_glyphs_flush_dst;
else else
flush_func = NULL; flush_func = NULL;
glamor_buffer_glyph_clip(glamor_priv, glamor_buffer_glyph_clip(glamor_priv,

View File

@ -51,36 +51,36 @@ _glamor_create_getcolor_fs_program(ScreenPtr screen, int stops_count, int use_ar
char *gradient_fs = NULL; char *gradient_fs = NULL;
GLint fs_getcolor_prog; GLint fs_getcolor_prog;
const char *gradient_fs_getcolor = #define gradient_fs_getcolor\
GLAMOR_DEFAULT_PRECISION GLAMOR_DEFAULT_PRECISION\
"uniform int n_stop;\n" "uniform int n_stop;\n"\
"uniform float stops[%d];\n" "uniform float stops[%d];\n"\
"uniform vec4 stop_colors[%d];\n" "uniform vec4 stop_colors[%d];\n"\
"vec4 get_color(float stop_len)\n" "vec4 get_color(float stop_len)\n"\
"{\n" "{\n"\
" int i = 0;\n" " int i = 0;\n"\
" float new_alpha; \n" " float new_alpha; \n"\
" vec4 gradient_color;\n" " vec4 gradient_color;\n"\
" float percentage; \n" " float percentage; \n"\
" for(i = 0; i < n_stop - 1; i++) {\n" " for(i = 0; i < n_stop - 1; i++) {\n"\
" if(stop_len < stops[i])\n" " if(stop_len < stops[i])\n"\
" break; \n" " break; \n"\
" }\n"\
" \n"\
" if(stops[i] - stops[i-1] > 2.0)\n"\
" percentage = 0.0;\n" /*For comply with pixman, walker->stepper overflow.*/\
" else if(stops[i] - stops[i-1] < 0.000001)\n"\
" percentage = 0.0;\n"\
" else \n"\
" percentage = (stop_len - stops[i-1])/(stops[i] - stops[i-1]);\n"\
" new_alpha = percentage * stop_colors[i].a + \n"\
" (1.0-percentage) * stop_colors[i-1].a; \n"\
" gradient_color = vec4((percentage * stop_colors[i].rgb \n"\
" + (1.0-percentage) * stop_colors[i-1].rgb)*new_alpha, \n"\
" new_alpha);\n"\
" \n"\
" return gradient_color;\n"\
"}\n" "}\n"
" \n"
" if(stops[i] - stops[i-1] > 2.0)\n"
" percentage = 0.0;\n" //For comply with pixman, walker->stepper overflow.
" else if(stops[i] - stops[i-1] < 0.000001)\n"
" percentage = 0.0;\n"
" else \n"
" percentage = (stop_len - stops[i-1])/(stops[i] - stops[i-1]);\n"
" new_alpha = percentage * stop_colors[i].a + \n"
" (1.0-percentage) * stop_colors[i-1].a; \n"
" gradient_color = vec4((percentage * stop_colors[i].rgb \n"
" + (1.0-percentage) * stop_colors[i-1].rgb)*new_alpha, \n"
" new_alpha);\n"
" \n"
" return gradient_color;\n"
"}\n";
/* Because the array access for shader is very slow, the performance is very low /* Because the array access for shader is very slow, the performance is very low
if use array. So use global uniform to replace for it if the number of n_stops is small.*/ if use array. So use global uniform to replace for it if the number of n_stops is small.*/
@ -238,111 +238,111 @@ _glamor_create_radial_gradient_program(ScreenPtr screen, int stops_count, int dy
* radius associated to it is negative (or it falls outside the valid t range) * radius associated to it is negative (or it falls outside the valid t range)
*/ */
const char *gradient_fs_template = #define gradient_radial_fs_template\
GLAMOR_DEFAULT_PRECISION GLAMOR_DEFAULT_PRECISION\
"uniform mat3 transform_mat;\n" "uniform mat3 transform_mat;\n"\
"uniform int repeat_type;\n" "uniform int repeat_type;\n"\
"uniform float A_value;\n" "uniform float A_value;\n"\
"uniform vec2 c1;\n" "uniform vec2 c1;\n"\
"uniform float r1;\n" "uniform float r1;\n"\
"uniform vec2 c2;\n" "uniform vec2 c2;\n"\
"uniform float r2;\n" "uniform float r2;\n"\
"varying vec2 source_texture;\n" "varying vec2 source_texture;\n"\
"\n" "\n"\
"vec4 get_color(float stop_len);\n" "vec4 get_color(float stop_len);\n"\
"\n" "\n"\
"int t_invalid;\n" "int t_invalid;\n"\
"\n" "\n"\
"float get_stop_len()\n" "float get_stop_len()\n"\
"{\n" "{\n"\
" float t = 0.0;\n" " float t = 0.0;\n"\
" float sqrt_value;\n" " float sqrt_value;\n"\
" int revserse = 0;\n" " int revserse = 0;\n"\
" t_invalid = 0;\n" " t_invalid = 0;\n"\
" \n" " \n"\
" vec3 tmp = vec3(source_texture.x, source_texture.y, 1.0);\n" " vec3 tmp = vec3(source_texture.x, source_texture.y, 1.0);\n"\
" vec3 source_texture_trans = transform_mat * tmp;\n" " vec3 source_texture_trans = transform_mat * tmp;\n"\
" source_texture_trans.xy = source_texture_trans.xy/source_texture_trans.z;\n" " source_texture_trans.xy = source_texture_trans.xy/source_texture_trans.z;\n"\
" float B_value = (source_texture_trans.x - c1.x) * (c2.x - c1.x)\n" " float B_value = (source_texture_trans.x - c1.x) * (c2.x - c1.x)\n"\
" + (source_texture_trans.y - c1.y) * (c2.y - c1.y)\n" " + (source_texture_trans.y - c1.y) * (c2.y - c1.y)\n"\
" + r1 * (r2 - r1);\n" " + r1 * (r2 - r1);\n"\
" float C_value = (source_texture_trans.x - c1.x) * (source_texture_trans.x - c1.x)\n" " float C_value = (source_texture_trans.x - c1.x) * (source_texture_trans.x - c1.x)\n"\
" + (source_texture_trans.y - c1.y) * (source_texture_trans.y - c1.y)\n" " + (source_texture_trans.y - c1.y) * (source_texture_trans.y - c1.y)\n"\
" - r1*r1;\n" " - r1*r1;\n"\
" if(abs(A_value) < 0.00001) {\n" " if(abs(A_value) < 0.00001) {\n"\
" if(B_value == 0.0) {\n" " if(B_value == 0.0) {\n"\
" t_invalid = 1;\n" " t_invalid = 1;\n"\
" return t;\n" " return t;\n"\
" }\n"\
" t = 0.5 * C_value / B_value;"\
" } else {\n"\
" sqrt_value = B_value * B_value - A_value * C_value;\n"\
" if(sqrt_value < 0.0) {\n"\
" t_invalid = 1;\n"\
" return t;\n"\
" }\n"\
" sqrt_value = sqrt(sqrt_value);\n"\
" t = (B_value + sqrt_value) / A_value;\n"\
" }\n"\
" if(repeat_type == %d) {\n" /* RepeatNone case. */\
" if((t <= 0.0) || (t > 1.0))\n"\
/* try another if first one invalid*/\
" t = (B_value - sqrt_value) / A_value;\n"\
" \n"\
" if((t <= 0.0) || (t > 1.0)) {\n" /*still invalid, return.*/\
" t_invalid = 1;\n"\
" return t;\n"\
" }\n"\
" } else {\n"\
" if(t * (r2 - r1) <= -1.0 * r1)\n"\
/* try another if first one invalid*/\
" t = (B_value - sqrt_value) / A_value;\n"\
" \n"\
" if(t * (r2 -r1) <= -1.0 * r1) {\n" /*still invalid, return.*/\
" t_invalid = 1;\n"\
" return t;\n"\
" }\n"\
" }\n"\
" \n"\
" if(repeat_type == %d){\n" /* repeat normal*/\
" while(t > 1.0) \n"\
" t = t - 1.0; \n"\
" while(t < 0.0) \n"\
" t = t + 1.0; \n"\
" }\n"\
" \n"\
" if(repeat_type == %d) {\n" /* repeat reflect*/\
" while(t > 1.0) {\n"\
" t = t - 1.0; \n"\
" if(revserse == 0)\n"\
" revserse = 1;\n"\
" else\n"\
" revserse = 0;\n"\
" }\n"\
" while(t < 0.0) {\n"\
" t = t + 1.0; \n"\
" if(revserse == 0)\n"\
" revserse = 1;\n"\
" else\n"\
" revserse = 0;\n"\
" }\n"\
" if(revserse == 1) {\n"\
" t = 1.0 - t; \n"\
" }\n"\
" }\n"\
" \n"\
" return t;\n"\
"}\n"\
"\n"\
"void main()\n"\
"{\n"\
" float stop_len = get_stop_len();\n"\
" if(t_invalid == 1) {\n"\
" gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n"\
" } else {\n"\
" gl_FragColor = get_color(stop_len);\n"\
" }\n"\
"}\n" "}\n"
" t = 0.5 * C_value / B_value;"
" } else {\n"
" sqrt_value = B_value * B_value - A_value * C_value;\n"
" if(sqrt_value < 0.0) {\n"
" t_invalid = 1;\n"
" return t;\n"
" }\n"
" sqrt_value = sqrt(sqrt_value);\n"
" t = (B_value + sqrt_value) / A_value;\n"
" }\n"
" if(repeat_type == %d) {\n" // RepeatNone case.
" if((t <= 0.0) || (t > 1.0))\n"
// try another if first one invalid
" t = (B_value - sqrt_value) / A_value;\n"
" \n"
" if((t <= 0.0) || (t > 1.0)) {\n" //still invalid, return.
" t_invalid = 1;\n"
" return t;\n"
" }\n"
" } else {\n"
" if(t * (r2 - r1) <= -1.0 * r1)\n"
// try another if first one invalid
" t = (B_value - sqrt_value) / A_value;\n"
" \n"
" if(t * (r2 -r1) <= -1.0 * r1) {\n" //still invalid, return.
" t_invalid = 1;\n"
" return t;\n"
" }\n"
" }\n"
" \n"
" if(repeat_type == %d){\n" // repeat normal
" while(t > 1.0) \n"
" t = t - 1.0; \n"
" while(t < 0.0) \n"
" t = t + 1.0; \n"
" }\n"
" \n"
" if(repeat_type == %d) {\n" // repeat reflect
" while(t > 1.0) {\n"
" t = t - 1.0; \n"
" if(revserse == 0)\n"
" revserse = 1;\n"
" else\n"
" revserse = 0;\n"
" }\n"
" while(t < 0.0) {\n"
" t = t + 1.0; \n"
" if(revserse == 0)\n"
" revserse = 1;\n"
" else\n"
" revserse = 0;\n"
" }\n"
" if(revserse == 1) {\n"
" t = 1.0 - t; \n"
" }\n"
" }\n"
" \n"
" return t;\n"
"}\n"
"\n"
"void main()\n"
"{\n"
" float stop_len = get_stop_len();\n"
" if(t_invalid == 1) {\n"
" gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n"
" } else {\n"
" gl_FragColor = get_color(stop_len);\n"
" }\n"
"}\n";
glamor_priv = glamor_get_screen_private(screen); glamor_priv = glamor_get_screen_private(screen);
@ -376,7 +376,7 @@ _glamor_create_radial_gradient_program(ScreenPtr screen, int stops_count, int dy
GL_VERTEX_SHADER, gradient_vs); GL_VERTEX_SHADER, gradient_vs);
XNFasprintf(&gradient_fs, XNFasprintf(&gradient_fs,
gradient_fs_template, gradient_radial_fs_template,
PIXMAN_REPEAT_NONE, PIXMAN_REPEAT_NORMAL, PIXMAN_REPEAT_REFLECT); PIXMAN_REPEAT_NONE, PIXMAN_REPEAT_NORMAL, PIXMAN_REPEAT_REFLECT);
fs_main_prog = glamor_compile_glsl_prog(dispatch, fs_main_prog = glamor_compile_glsl_prog(dispatch,
@ -486,89 +486,88 @@ _glamor_create_linear_gradient_program(ScreenPtr screen, int stops_count, int dy
* before and after it. Use the interpolation fomula to compute RGBA. * before and after it. Use the interpolation fomula to compute RGBA.
*/ */
const char *gradient_fs_template = #define gradient_fs_template \
GLAMOR_DEFAULT_PRECISION GLAMOR_DEFAULT_PRECISION\
"uniform mat3 transform_mat;\n" "uniform mat3 transform_mat;\n"\
"uniform int repeat_type;\n" "uniform int repeat_type;\n"\
"uniform int hor_ver;\n" "uniform int hor_ver;\n"\
"uniform float pt_slope;\n" "uniform float pt_slope;\n"\
"uniform float cos_val;\n" "uniform float cos_val;\n"\
"uniform float p1_distance;\n" "uniform float p1_distance;\n"\
"uniform float pt_distance;\n" "uniform float pt_distance;\n"\
"varying vec2 source_texture;\n" "varying vec2 source_texture;\n"\
"\n" "\n"\
"vec4 get_color(float stop_len);\n" "vec4 get_color(float stop_len);\n"\
"\n" "\n"\
"float get_stop_len()\n" "float get_stop_len()\n"\
"{\n" "{\n"\
" vec3 tmp = vec3(source_texture.x, source_texture.y, 1.0);\n" " vec3 tmp = vec3(source_texture.x, source_texture.y, 1.0);\n"\
" float len_percentage;\n" " float len_percentage;\n"\
" float distance;\n" " float distance;\n"\
" float _p1_distance;\n" " float _p1_distance;\n"\
" float _pt_distance;\n" " float _pt_distance;\n"\
" float y_dist;\n" " float y_dist;\n"\
" float stop_after;\n" " float stop_after;\n"\
" float stop_before;\n" " float stop_before;\n"\
" vec4 stop_color_before;\n" " vec4 stop_color_before;\n"\
" vec4 stop_color_after;\n" " vec4 stop_color_after;\n"\
" float new_alpha; \n" " float new_alpha; \n"\
" int revserse = 0;\n" " int revserse = 0;\n"\
" vec4 gradient_color;\n" " vec4 gradient_color;\n"\
" float percentage; \n" " float percentage; \n"\
" vec3 source_texture_trans = transform_mat * tmp;\n" " vec3 source_texture_trans = transform_mat * tmp;\n"\
" \n" " \n"\
" if(hor_ver == 0) { \n" //Normal case. " if(hor_ver == 0) { \n" /*Normal case.*/\
" y_dist = source_texture_trans.y - source_texture_trans.x*pt_slope;\n" " y_dist = source_texture_trans.y - source_texture_trans.x*pt_slope;\n"\
" distance = y_dist * cos_val;\n" " distance = y_dist * cos_val;\n"\
" _p1_distance = p1_distance * source_texture_trans.z;\n" " _p1_distance = p1_distance * source_texture_trans.z;\n"\
" _pt_distance = pt_distance * source_texture_trans.z;\n" " _pt_distance = pt_distance * source_texture_trans.z;\n"\
" \n" " \n"\
" } else if (hor_ver == 1) {\n"//horizontal case. " } else if (hor_ver == 1) {\n"/*horizontal case.*/\
" distance = source_texture_trans.x;\n" " distance = source_texture_trans.x;\n"\
" _p1_distance = p1_distance * source_texture_trans.z;\n" " _p1_distance = p1_distance * source_texture_trans.z;\n"\
" _pt_distance = pt_distance * source_texture_trans.z;\n" " _pt_distance = pt_distance * source_texture_trans.z;\n"\
" } \n"\
" \n"\
" distance = distance - _p1_distance; \n"\
" \n"\
" if(repeat_type == %d){\n" /* repeat normal*/\
" while(distance > _pt_distance) \n"\
" distance = distance - (_pt_distance); \n"\
" while(distance < 0.0) \n"\
" distance = distance + (_pt_distance); \n"\
" }\n"\
" \n"\
" if(repeat_type == %d) {\n" /* repeat reflect*/\
" while(distance > _pt_distance) {\n"\
" distance = distance - (_pt_distance); \n"\
" if(revserse == 0)\n"\
" revserse = 1;\n"\
" else\n"\
" revserse = 0;\n"\
" }\n"\
" while(distance < 0.0) {\n"\
" distance = distance + (_pt_distance); \n"\
" if(revserse == 0)\n"\
" revserse = 1;\n"\
" else\n"\
" revserse = 0;\n"\
" }\n"\
" if(revserse == 1) {\n"\
" distance = (_pt_distance) - distance; \n"\
" }\n"\
" }\n"\
" \n"\
" len_percentage = distance/(_pt_distance);\n"\
" \n"\
" return len_percentage;\n"\
"}\n"\
"\n"\
"void main()\n"\
"{\n"\
" float stop_len = get_stop_len();\n"\
" gl_FragColor = get_color(stop_len);\n"\
"}\n" "}\n"
" \n"
" distance = distance - _p1_distance; \n"
" \n"
" if(repeat_type == %d){\n" // repeat normal
" while(distance > _pt_distance) \n"
" distance = distance - (_pt_distance); \n"
" while(distance < 0.0) \n"
" distance = distance + (_pt_distance); \n"
" }\n"
" \n"
" if(repeat_type == %d) {\n" // repeat reflect
" while(distance > _pt_distance) {\n"
" distance = distance - (_pt_distance); \n"
" if(revserse == 0)\n"
" revserse = 1;\n"
" else\n"
" revserse = 0;\n"
" }\n"
" while(distance < 0.0) {\n"
" distance = distance + (_pt_distance); \n"
" if(revserse == 0)\n"
" revserse = 1;\n"
" else\n"
" revserse = 0;\n"
" }\n"
" if(revserse == 1) {\n"
" distance = (_pt_distance) - distance; \n"
" }\n"
" }\n"
" \n"
" len_percentage = distance/(_pt_distance);\n"
" \n"
" return len_percentage;\n"
"}\n"
"\n"
"void main()\n"
"{\n"
" float stop_len = get_stop_len();\n"
" gl_FragColor = get_color(stop_len);\n"
"}\n";
glamor_priv = glamor_get_screen_private(screen); glamor_priv = glamor_get_screen_private(screen);

View File

@ -73,13 +73,10 @@ glamor_create_picture(PicturePtr picture)
{ {
PixmapPtr pixmap; PixmapPtr pixmap;
glamor_pixmap_private *pixmap_priv; glamor_pixmap_private *pixmap_priv;
glamor_screen_private *glamor_priv;
if (!picture || !picture->pDrawable) if (!picture || !picture->pDrawable)
return 0; return 0;
glamor_priv =
glamor_get_screen_private(picture->pDrawable->pScreen);
pixmap = glamor_get_drawable_pixmap(picture->pDrawable); pixmap = glamor_get_drawable_pixmap(picture->pDrawable);
pixmap_priv = glamor_get_pixmap_private(pixmap); pixmap_priv = glamor_get_pixmap_private(pixmap);
if (!pixmap_priv) { if (!pixmap_priv) {
@ -112,13 +109,10 @@ glamor_destroy_picture(PicturePtr picture)
{ {
PixmapPtr pixmap; PixmapPtr pixmap;
glamor_pixmap_private *pixmap_priv; glamor_pixmap_private *pixmap_priv;
glamor_screen_private *glamor_priv;
if (!picture || !picture->pDrawable) if (!picture || !picture->pDrawable)
return; return;
glamor_priv =
glamor_get_screen_private(picture->pDrawable->pScreen);
pixmap = glamor_get_drawable_pixmap(picture->pDrawable); pixmap = glamor_get_drawable_pixmap(picture->pDrawable);
pixmap_priv = glamor_get_pixmap_private(pixmap); pixmap_priv = glamor_get_pixmap_private(pixmap);

View File

@ -926,7 +926,6 @@ _glamor_download_sub_pixmap_to_cpu(PixmapPtr pixmap, GLenum format,
glamor_pixmap_private *pixmap_priv; glamor_pixmap_private *pixmap_priv;
GLenum gl_access = 0, gl_usage = 0; GLenum gl_access = 0, gl_usage = 0;
void *data, *read; void *data, *read;
ScreenPtr screen;
glamor_screen_private *glamor_priv = glamor_screen_private *glamor_priv =
glamor_get_screen_private(pixmap->drawable.pScreen); glamor_get_screen_private(pixmap->drawable.pScreen);
glamor_gl_dispatch *dispatch; glamor_gl_dispatch *dispatch;
@ -936,7 +935,6 @@ _glamor_download_sub_pixmap_to_cpu(PixmapPtr pixmap, GLenum format,
int fbo_x_off, fbo_y_off; int fbo_x_off, fbo_y_off;
data = bits; data = bits;
screen = pixmap->drawable.pScreen;
pixmap_priv = glamor_get_pixmap_private(pixmap); pixmap_priv = glamor_get_pixmap_private(pixmap);
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
return NULL; return NULL;
@ -1193,13 +1191,11 @@ glamor_download_pixmap_to_cpu(PixmapPtr pixmap, glamor_access_t access)
glamor_get_pixmap_private(pixmap); glamor_get_pixmap_private(pixmap);
unsigned int stride; unsigned int stride;
void *data = NULL, *dst; void *data = NULL, *dst;
ScreenPtr screen;
glamor_screen_private *glamor_priv = glamor_screen_private *glamor_priv =
glamor_get_screen_private(pixmap->drawable.pScreen); glamor_get_screen_private(pixmap->drawable.pScreen);
glamor_gl_dispatch *dispatch; glamor_gl_dispatch *dispatch;
int pbo = 0; int pbo = 0;
screen = pixmap->drawable.pScreen;
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
return TRUE; return TRUE;
@ -1259,7 +1255,6 @@ glamor_download_pixmap_to_cpu(PixmapPtr pixmap, glamor_access_t access)
Bool Bool
glamor_fixup_pixmap_priv(ScreenPtr screen, glamor_pixmap_private *pixmap_priv) glamor_fixup_pixmap_priv(ScreenPtr screen, glamor_pixmap_private *pixmap_priv)
{ {
glamor_screen_private *glamor_priv;
glamor_pixmap_fbo *old_fbo; glamor_pixmap_fbo *old_fbo;
glamor_pixmap_fbo *new_fbo = NULL; glamor_pixmap_fbo *new_fbo = NULL;
PixmapPtr scratch = NULL; PixmapPtr scratch = NULL;
@ -1274,7 +1269,6 @@ glamor_fixup_pixmap_priv(ScreenPtr screen, glamor_pixmap_private *pixmap_priv)
return TRUE; return TRUE;
old_fbo = pixmap_priv->base.fbo; old_fbo = pixmap_priv->base.fbo;
glamor_priv = pixmap_priv->base.glamor_priv;
if (!old_fbo) if (!old_fbo)
return FALSE; return FALSE;

View File

@ -43,9 +43,6 @@ _glamor_poly_fill_rect(DrawablePtr drawable,
register BoxPtr pbox; register BoxPtr pbox;
RegionPtr pClip = fbGetCompositeClip(gc); RegionPtr pClip = fbGetCompositeClip(gc);
Bool ret = FALSE; Bool ret = FALSE;
glamor_screen_private *glamor_priv;
glamor_priv = glamor_get_screen_private(drawable->pScreen);
xorg = drawable->x; xorg = drawable->x;
yorg = drawable->y; yorg = drawable->y;

View File

@ -45,7 +45,6 @@ _glamor_poly_lines(DrawablePtr drawable, GCPtr gc, int mode, int n,
xRectangle *rects; xRectangle *rects;
int x1, x2, y1, y2; int x1, x2, y1, y2;
int i; int i;
glamor_screen_private *glamor_priv;
/* Don't try to do wide lines or non-solid fill style. */ /* Don't try to do wide lines or non-solid fill style. */
if (gc->lineWidth != 0) { if (gc->lineWidth != 0) {
@ -105,7 +104,6 @@ _glamor_poly_lines(DrawablePtr drawable, GCPtr gc, int mode, int n,
&& glamor_ddx_fallback_check_gc(gc)) && glamor_ddx_fallback_check_gc(gc))
return FALSE; return FALSE;
glamor_priv = glamor_get_screen_private(drawable->pScreen);
if (gc->lineWidth == 0) { if (gc->lineWidth == 0) {
if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW)) { if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW)) {
if (glamor_prepare_access_gc(gc)) { if (glamor_prepare_access_gc(gc)) {

View File

@ -549,9 +549,6 @@ extern int glamor_debug_level;
/* glamor.c */ /* glamor.c */
PixmapPtr glamor_get_drawable_pixmap(DrawablePtr drawable); PixmapPtr glamor_get_drawable_pixmap(DrawablePtr drawable);
PixmapPtr glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
unsigned int usage);
Bool glamor_destroy_pixmap(PixmapPtr pixmap); Bool glamor_destroy_pixmap(PixmapPtr pixmap);
glamor_pixmap_fbo* glamor_pixmap_detach_fbo(glamor_pixmap_private *pixmap_priv); glamor_pixmap_fbo* glamor_pixmap_detach_fbo(glamor_pixmap_private *pixmap_priv);
@ -568,16 +565,12 @@ void glamor_init_pixmap_fbo(ScreenPtr screen);
void glamor_fini_pixmap_fbo(ScreenPtr screen); void glamor_fini_pixmap_fbo(ScreenPtr screen);
Bool glamor_pixmap_fbo_fixup(ScreenPtr screen, PixmapPtr pixmap); Bool glamor_pixmap_fbo_fixup(ScreenPtr screen, PixmapPtr pixmap);
void glamor_fbo_expire(glamor_screen_private *glamor_priv); void glamor_fbo_expire(glamor_screen_private *glamor_priv);
void glamor_init_pixmap_fbo(ScreenPtr screen);
void glamor_fini_pixmap_fbo(ScreenPtr screen);
glamor_pixmap_fbo * glamor_pixmap_fbo *
glamor_create_fbo_array(glamor_screen_private *glamor_priv, glamor_create_fbo_array(glamor_screen_private *glamor_priv,
int w, int h, GLenum format, int flag, int w, int h, GLenum format, int flag,
int block_w, int block_h, glamor_pixmap_private *); int block_w, int block_h, glamor_pixmap_private *);
Bool glamor_fixup_pixmap_priv(ScreenPtr screen, glamor_pixmap_private *pixmap_priv);
/* glamor_copyarea.c */ /* glamor_copyarea.c */
RegionPtr RegionPtr
glamor_copy_area(DrawablePtr src, DrawablePtr dst, GCPtr gc, glamor_copy_area(DrawablePtr src, DrawablePtr dst, GCPtr gc,
@ -603,7 +596,6 @@ void glamor_fini_finish_access_shaders(ScreenPtr screen);
const Bool glamor_get_drawable_location(const DrawablePtr drawable); const Bool glamor_get_drawable_location(const DrawablePtr drawable);
void glamor_get_drawable_deltas(DrawablePtr drawable, PixmapPtr pixmap, void glamor_get_drawable_deltas(DrawablePtr drawable, PixmapPtr pixmap,
int *x, int *y); int *x, int *y);
Bool glamor_create_gc(GCPtr gc);
Bool glamor_stipple(PixmapPtr pixmap, PixmapPtr stipple, Bool glamor_stipple(PixmapPtr pixmap, PixmapPtr stipple,
int x, int y, int width, int height, int x, int y, int width, int height,
unsigned char alu, unsigned long planemask, unsigned char alu, unsigned long planemask,
@ -636,7 +628,7 @@ Bool glamor_set_alu(struct glamor_gl_dispatch *dispatch,
Bool glamor_set_planemask(PixmapPtr pixmap, unsigned long planemask); Bool glamor_set_planemask(PixmapPtr pixmap, unsigned long planemask);
Bool glamor_change_window_attributes(WindowPtr pWin, unsigned long mask); Bool glamor_change_window_attributes(WindowPtr pWin, unsigned long mask);
RegionPtr glamor_bitmap_to_region(PixmapPtr pixmap); RegionPtr glamor_bitmap_to_region(PixmapPtr pixmap);
Bool glamor_gl_has_extension(char *extension); Bool glamor_gl_has_extension(const char *extension);
int glamor_gl_get_version(void); int glamor_gl_get_version(void);
#define GLAMOR_GL_VERSION_ENCODE(major, minor) ( \ #define GLAMOR_GL_VERSION_ENCODE(major, minor) ( \
@ -683,7 +675,6 @@ void glamor_glyphs(CARD8 op,
INT16 ySrc, int nlist, GlyphListPtr list, INT16 ySrc, int nlist, GlyphListPtr list,
GlyphPtr * glyphs); GlyphPtr * glyphs);
void glamor_glyph_unrealize(ScreenPtr screen, GlyphPtr glyph);
/* glamor_setspans.c */ /* glamor_setspans.c */
void glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src, void glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src,
DDXPointPtr points, int *widths, int n, int sorted); DDXPointPtr points, int *widths, int n, int sorted);
@ -947,9 +938,6 @@ void glamor_finish_access_picture(PicturePtr picture, glamor_access_t access);
void glamor_destroy_picture(PicturePtr picture); void glamor_destroy_picture(PicturePtr picture);
enum glamor_pixmap_status
glamor_upload_picture_to_texture(PicturePtr picture);
/* fixup a fbo to the exact size as the pixmap. */ /* fixup a fbo to the exact size as the pixmap. */
Bool Bool
glamor_fixup_pixmap_priv(ScreenPtr screen, glamor_pixmap_private *pixmap_priv); glamor_fixup_pixmap_priv(ScreenPtr screen, glamor_pixmap_private *pixmap_priv);

View File

@ -43,6 +43,7 @@
//#define DEBUGRegionPrint(x) do {} while (0) //#define DEBUGRegionPrint(x) do {} while (0)
#define DEBUGRegionPrint RegionPrint #define DEBUGRegionPrint RegionPrint
#endif #endif
static struct blendinfo composite_op_info[] = { static struct blendinfo composite_op_info[] = {
[PictOpClear] = {0, 0, GL_ZERO, GL_ZERO}, [PictOpClear] = {0, 0, GL_ZERO, GL_ZERO},
[PictOpSrc] = {0, 0, GL_ONE, GL_ZERO}, [PictOpSrc] = {0, 0, GL_ONE, GL_ZERO},
@ -1715,7 +1716,7 @@ _glamor_composite(CARD8 op,
glamor_get_screen_private(screen); glamor_get_screen_private(screen);
Bool ret = TRUE; Bool ret = TRUE;
RegionRec region; RegionRec region;
BoxPtr box, extent; BoxPtr extent;
int nbox, ok = FALSE; int nbox, ok = FALSE;
PixmapPtr sub_dest_pixmap = NULL; PixmapPtr sub_dest_pixmap = NULL;
PixmapPtr sub_source_pixmap = NULL; PixmapPtr sub_source_pixmap = NULL;
@ -1778,7 +1779,6 @@ _glamor_composite(CARD8 op,
goto done; goto done;
} }
box = REGION_RECTS(&region);
nbox = REGION_NUM_RECTS(&region); nbox = REGION_NUM_RECTS(&region);
DEBUGF("first clipped when compositing.\n"); DEBUGF("first clipped when compositing.\n");
DEBUGRegionPrint(&region); DEBUGRegionPrint(&region);
@ -1833,6 +1833,7 @@ _glamor_composite(CARD8 op,
x_dest, y_dest); x_dest, y_dest);
REGION_UNINIT(dest->pDrawable->pScreen, &region); REGION_UNINIT(dest->pDrawable->pScreen, &region);
if (ok) if (ok)
goto done; goto done;
fail: fail:
@ -1886,7 +1887,7 @@ fail:
GET_SUB_PICTURE(source, GLAMOR_ACCESS_RO); GET_SUB_PICTURE(source, GLAMOR_ACCESS_RO);
if (mask && mask->pDrawable && !mask->transform) if (mask && mask->pDrawable && !mask->transform)
GET_SUB_PICTURE(mask, GLAMOR_ACCESS_RO); GET_SUB_PICTURE(mask, GLAMOR_ACCESS_RO);
full_fallback:
if (glamor_prepare_access_picture(dest, GLAMOR_ACCESS_RW)) { if (glamor_prepare_access_picture(dest, GLAMOR_ACCESS_RW)) {
if (source_pixmap == dest_pixmap || glamor_prepare_access_picture if (source_pixmap == dest_pixmap || glamor_prepare_access_picture
(source, GLAMOR_ACCESS_RO)) { (source, GLAMOR_ACCESS_RO)) {

View File

@ -81,11 +81,15 @@ _glamor_lines_crossfixedY (xLineFixed *l, xLineFixed *r)
xFixed dy2 = r->p2.y - r->p1.y; xFixed dy2 = r->p2.y - r->p1.y;
xFixed_32_32 tmp = (xFixed_32_32) dy2 * dy1; xFixed_32_32 tmp = (xFixed_32_32) dy2 * dy1;
xFixed_32_32 dividend1 = (tmp >> 32) * (l->p1.x - r->p1.x); xFixed_32_32 dividend1 = (tmp >> 32) * (l->p1.x - r->p1.x);
xFixed_32_32 dividend2;
xFixed_32_32 dividend3;
xFixed_32_32 divisor;
tmp = (xFixed_32_32) dx1 * dy2; tmp = (xFixed_32_32) dx1 * dy2;
xFixed_32_32 dividend2 = (tmp >> 32) * l->p1.y; dividend2 = (tmp >> 32) * l->p1.y;
tmp = (xFixed_32_32) dy1 * dx2; tmp = (xFixed_32_32) dy1 * dx2;
xFixed_32_32 dividend3 = (tmp >> 32) * r->p1.y; dividend3 = (tmp >> 32) * r->p1.y;
xFixed_32_32 divisor = ((xFixed_32_32) dx1 * (xFixed_32_32) dy2 divisor = ((xFixed_32_32) dx1 * (xFixed_32_32) dy2
- (xFixed_32_32) dy1 * (xFixed_32_32) dx2) >> 32; - (xFixed_32_32) dy1 * (xFixed_32_32) dx2) >> 32;
if (divisor) if (divisor)
@ -1363,7 +1367,6 @@ _glamor_generate_trapezoid_with_shader(ScreenPtr screen, PicturePtr picture,
glamor_pixmap_private *pixmap_priv; glamor_pixmap_private *pixmap_priv;
PixmapPtr pixmap = NULL; PixmapPtr pixmap = NULL;
GLint trapezoid_prog; GLint trapezoid_prog;
float width, height;
GLfloat xscale, yscale; GLfloat xscale, yscale;
float left_slope, right_slope; float left_slope, right_slope;
xTrapezoid *ptrap; xTrapezoid *ptrap;
@ -1399,9 +1402,6 @@ _glamor_generate_trapezoid_with_shader(ScreenPtr screen, PicturePtr picture,
pixmap_priv_get_dest_scale(pixmap_priv, (&xscale), (&yscale)); pixmap_priv_get_dest_scale(pixmap_priv, (&xscale), (&yscale));
width = (float)(bounds->x2 - bounds->x1);
height = (float)(bounds->y2 - bounds->y1);
dispatch->glBindBuffer(GL_ARRAY_BUFFER, 0); dispatch->glBindBuffer(GL_ARRAY_BUFFER, 0);
dispatch->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); dispatch->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
@ -1604,11 +1604,11 @@ glamor_create_mask_picture(ScreenPtr screen,
static int static int
_glamor_trapezoid_bounds (int ntrap, xTrapezoid *traps, BoxPtr box) _glamor_trapezoid_bounds (int ntrap, xTrapezoid *traps, BoxPtr box)
{ {
int has_large_trapezoid = 0;
box->y1 = MAXSHORT; box->y1 = MAXSHORT;
box->y2 = MINSHORT; box->y2 = MINSHORT;
box->x1 = MAXSHORT; box->x1 = MAXSHORT;
box->x2 = MINSHORT; box->x2 = MINSHORT;
int has_large_trapezoid = 0;
for (; ntrap; ntrap--, traps++) { for (; ntrap; ntrap--, traps++) {
INT16 x1, y1, x2, y2; INT16 x1, y1, x2, y2;

View File

@ -41,10 +41,10 @@
#define pixmap_priv_get_dest_scale(_pixmap_priv_, _pxscale_, _pyscale_) \ #define pixmap_priv_get_dest_scale(_pixmap_priv_, _pxscale_, _pyscale_) \
do { \ do { \
int w,h; \ int _w_,_h_; \
PIXMAP_PRIV_GET_ACTUAL_SIZE(_pixmap_priv_, w, h); \ PIXMAP_PRIV_GET_ACTUAL_SIZE(_pixmap_priv_, _w_, _h_); \
*(_pxscale_) = 1.0 / w; \ *(_pxscale_) = 1.0 / _w_; \
*(_pyscale_) = 1.0 / h; \ *(_pyscale_) = 1.0 / _h_; \
} while(0) } while(0)
#define pixmap_priv_get_scale(_pixmap_priv_, _pxscale_, _pyscale_) \ #define pixmap_priv_get_scale(_pixmap_priv_, _pxscale_, _pyscale_) \
@ -302,14 +302,14 @@
#define glamor_transform_point(matrix, tx, ty, x, y) \ #define glamor_transform_point(matrix, tx, ty, x, y) \
do { \ do { \
int i; \ int _i_; \
float result[4]; \ float _result_[4]; \
for (i = 0; i < 3; i++) { \ for (_i_ = 0; _i_ < 3; _i_++) { \
result[i] = (matrix)[i * 3] * (x) + (matrix)[i * 3 + 1] * (y) \ _result_[_i_] = (matrix)[_i_ * 3] * (x) + (matrix)[_i_ * 3 + 1] * (y) \
+ (matrix)[i * 3 + 2]; \ + (matrix)[_i_ * 3 + 2]; \
} \ } \
tx = result[0] / result[2]; \ tx = _result_[0] / _result_[2]; \
ty = result[1] / result[2]; \ ty = _result_[1] / _result_[2]; \
} while(0) } while(0)
#define _glamor_set_normalize_tpoint(xscale, yscale, _tx_, _ty_, \ #define _glamor_set_normalize_tpoint(xscale, yscale, _tx_, _ty_, \
@ -734,10 +734,10 @@
#define glamor_set_const_ext(params, nparam, vertices, nverts, stride) \ #define glamor_set_const_ext(params, nparam, vertices, nverts, stride) \
do { \ do { \
int i = 0, j = 0; \ int _i_ = 0, _j_ = 0; \
for(; i < nverts; i++) { \ for(; _i_ < nverts; _i_++) { \
for(j = 0; j < nparam; j++) { \ for(_j_ = 0; _j_ < nparam; _j_++) { \
vertices[stride*i + j] = params[j]; \ vertices[stride*_i_ + _j_] = params[_j_]; \
} \ } \
} \ } \
} while(0) } while(0)