glamor: Remove always-true yInverted flag.
All users of glamor had the same value set, and it complicated things for no reason. Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
parent
d71ecbb458
commit
e310387f44
|
@ -328,11 +328,6 @@ glamor_init(ScreenPtr screen, unsigned int flags)
|
|||
return FALSE;
|
||||
|
||||
glamor_priv->flags = flags;
|
||||
if (flags & GLAMOR_INVERTED_Y_AXIS) {
|
||||
glamor_priv->yInverted = TRUE;
|
||||
}
|
||||
else
|
||||
glamor_priv->yInverted = FALSE;
|
||||
|
||||
if (!dixRegisterPrivateKey(&glamor_screen_private_key, PRIVATE_SCREEN, 0)) {
|
||||
LogMessage(X_WARNING,
|
||||
|
|
|
@ -63,7 +63,7 @@ typedef enum glamor_pixmap_type {
|
|||
} glamor_pixmap_type_t;
|
||||
|
||||
#define GLAMOR_EGL_EXTERNAL_BUFFER 3
|
||||
#define GLAMOR_INVERTED_Y_AXIS 1
|
||||
#define GLAMOR_INVERTED_Y_AXIS 1 /* compat stub */
|
||||
#define GLAMOR_USE_SCREEN (1 << 1)
|
||||
#define GLAMOR_USE_PICTURE_SCREEN (1 << 2)
|
||||
#define GLAMOR_USE_EGL_SCREEN (1 << 3)
|
||||
|
@ -79,12 +79,6 @@ typedef enum glamor_pixmap_type {
|
|||
* @screen: Current screen pointer.
|
||||
* @flags: Please refer the flags description above.
|
||||
*
|
||||
* @GLAMOR_INVERTED_Y_AXIS:
|
||||
* set 1 means the GL env's origin (0,0) is at top-left.
|
||||
* EGL/DRM platform is an example need to set this bit.
|
||||
* glx platform's origin is at bottom-left thus need to
|
||||
* clear this bit.
|
||||
*
|
||||
* @GLAMOR_USE_SCREEN:
|
||||
* If running in an pre-existing X environment, and the
|
||||
* gl context is GLX, then you should set this bit and
|
||||
|
|
|
@ -699,7 +699,7 @@ _glamor_gradient_set_pixmap_destination(ScreenPtr screen,
|
|||
width),
|
||||
(INT16) (dst_picture->pDrawable->
|
||||
height),
|
||||
glamor_priv->yInverted, vertices);
|
||||
vertices);
|
||||
|
||||
if (tex_normalize) {
|
||||
glamor_set_normalize_tcoords_tri_stripe(*xscale, *yscale,
|
||||
|
@ -710,17 +710,14 @@ _glamor_gradient_set_pixmap_destination(ScreenPtr screen,
|
|||
(INT16) (dst_picture->
|
||||
pDrawable->height +
|
||||
y_source),
|
||||
glamor_priv->yInverted,
|
||||
tex_vertices);
|
||||
}
|
||||
else {
|
||||
glamor_set_tcoords_tri_strip((INT16) (dst_picture->pDrawable->width),
|
||||
(INT16) (dst_picture->pDrawable->height),
|
||||
x_source, y_source,
|
||||
glamor_set_tcoords_tri_strip(x_source, y_source,
|
||||
(INT16) (dst_picture->pDrawable->width) +
|
||||
x_source,
|
||||
(INT16) (dst_picture->pDrawable->height) +
|
||||
y_source, glamor_priv->yInverted,
|
||||
y_source,
|
||||
tex_vertices);
|
||||
}
|
||||
|
||||
|
@ -1084,13 +1081,11 @@ glamor_generate_radial_gradient_picture(ScreenPtr screen,
|
|||
r2 = (float) pixman_fixed_to_double(src_picture->pSourcePict->radial.c2.
|
||||
radius);
|
||||
|
||||
glamor_set_circle_centre(width, height, c1x, c1y, glamor_priv->yInverted,
|
||||
cxy);
|
||||
glamor_set_circle_centre(width, height, c1x, c1y, cxy);
|
||||
glUniform2fv(c1_uniform_location, 1, cxy);
|
||||
glUniform1f(r1_uniform_location, r1);
|
||||
|
||||
glamor_set_circle_centre(width, height, c2x, c2y, glamor_priv->yInverted,
|
||||
cxy);
|
||||
glamor_set_circle_centre(width, height, c2x, c2y, cxy);
|
||||
glUniform2fv(c2_uniform_location, 1, cxy);
|
||||
glUniform1f(r2_uniform_location, r2);
|
||||
|
||||
|
@ -1322,7 +1317,7 @@ glamor_generate_linear_gradient_picture(ScreenPtr screen,
|
|||
linear.p1.x),
|
||||
pixman_fixed_to_double(src_picture->pSourcePict->
|
||||
linear.p1.y),
|
||||
glamor_priv->yInverted, pt1);
|
||||
pt1);
|
||||
DEBUGF("pt1:(%f, %f) ---> (%f %f)\n",
|
||||
pixman_fixed_to_double(src_picture->pSourcePict->linear.p1.x),
|
||||
pixman_fixed_to_double(src_picture->pSourcePict->linear.p1.y),
|
||||
|
@ -1333,7 +1328,7 @@ glamor_generate_linear_gradient_picture(ScreenPtr screen,
|
|||
linear.p2.x),
|
||||
pixman_fixed_to_double(src_picture->pSourcePict->
|
||||
linear.p2.y),
|
||||
glamor_priv->yInverted, pt2);
|
||||
pt2);
|
||||
DEBUGF("pt2:(%f, %f) ---> (%f %f)\n",
|
||||
pixman_fixed_to_double(src_picture->pSourcePict->linear.p2.x),
|
||||
pixman_fixed_to_double(src_picture->pSourcePict->linear.p2.y),
|
||||
|
|
|
@ -746,11 +746,6 @@ _glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, GLenum format,
|
|||
glamor_get_screen_private(pixmap->drawable.pScreen);
|
||||
static float vertices[8];
|
||||
|
||||
static float texcoords[8] = { 0, 1,
|
||||
1, 1,
|
||||
1, 0,
|
||||
0, 0
|
||||
};
|
||||
static float texcoords_inv[8] = { 0, 0,
|
||||
1, 0,
|
||||
1, 1,
|
||||
|
@ -759,11 +754,8 @@ _glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, GLenum format,
|
|||
float *ptexcoords;
|
||||
float dst_xscale, dst_yscale;
|
||||
GLuint tex = 0;
|
||||
int need_flip;
|
||||
int need_free_bits = 0;
|
||||
|
||||
need_flip = !glamor_priv->yInverted;
|
||||
|
||||
if (bits == NULL)
|
||||
goto ready_to_upload;
|
||||
|
||||
|
@ -797,7 +789,7 @@ _glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, GLenum format,
|
|||
/* Try fast path firstly, upload the pixmap to the texture attached
|
||||
* to the fbo directly. */
|
||||
if (no_alpha == 0
|
||||
&& revert == REVERT_NONE && swap_rb == SWAP_NONE_UPLOADING && !need_flip
|
||||
&& revert == REVERT_NONE && swap_rb == SWAP_NONE_UPLOADING
|
||||
#ifdef WALKAROUND_LARGE_TEXTURE_MAP
|
||||
&& pixmap_priv->type != GLAMOR_TEXTURE_LARGE
|
||||
#endif
|
||||
|
@ -817,17 +809,14 @@ _glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, GLenum format,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
if (need_flip)
|
||||
ptexcoords = texcoords;
|
||||
else
|
||||
ptexcoords = texcoords_inv;
|
||||
ptexcoords = texcoords_inv;
|
||||
|
||||
pixmap_priv_get_dest_scale(pixmap_priv, &dst_xscale, &dst_yscale);
|
||||
glamor_set_normalize_vcoords(pixmap_priv, dst_xscale,
|
||||
dst_yscale,
|
||||
x, y,
|
||||
x + w, y + h,
|
||||
glamor_priv->yInverted, vertices);
|
||||
vertices);
|
||||
/* Slow path, we need to flip y or wire alpha to 1. */
|
||||
glamor_make_current(glamor_priv);
|
||||
glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT,
|
||||
|
@ -864,10 +853,7 @@ _glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, GLenum format,
|
|||
/*
|
||||
* Prepare to upload a pixmap to texture memory.
|
||||
* no_alpha equals 1 means the format needs to wire alpha to 1.
|
||||
* Two condtion need to setup a fbo for a pixmap
|
||||
* 1. !yInverted, we need to do flip if we are not yInverted.
|
||||
* 2. no_alpha != 0, we need to wire the alpha.
|
||||
* */
|
||||
*/
|
||||
static int
|
||||
glamor_pixmap_upload_prepare(PixmapPtr pixmap, GLenum format, int no_alpha,
|
||||
int revert, int swap_rb)
|
||||
|
@ -895,8 +881,7 @@ glamor_pixmap_upload_prepare(PixmapPtr pixmap, GLenum format, int no_alpha,
|
|||
return 0;
|
||||
|
||||
if (!(no_alpha || (revert == REVERT_NORMAL)
|
||||
|| (swap_rb != SWAP_NONE_UPLOADING)
|
||||
|| !glamor_priv->yInverted)) {
|
||||
|| (swap_rb != SWAP_NONE_UPLOADING))) {
|
||||
/* We don't need a fbo, a simple texture uploading should work. */
|
||||
|
||||
flag = GLAMOR_CREATE_FBO_NO_FBO;
|
||||
|
@ -1141,7 +1126,7 @@ glamor_es2_pixmap_read_prepare(PixmapPtr source, int x, int y, int w, int h,
|
|||
|
||||
glamor_set_normalize_vcoords((struct glamor_pixmap_private *) NULL,
|
||||
temp_xscale, temp_yscale, 0, 0, w, h,
|
||||
glamor_priv->yInverted, vertices);
|
||||
vertices);
|
||||
|
||||
glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, GL_FALSE,
|
||||
2 * sizeof(float), vertices);
|
||||
|
@ -1152,7 +1137,7 @@ glamor_es2_pixmap_read_prepare(PixmapPtr source, int x, int y, int w, int h,
|
|||
source_yscale,
|
||||
x, y,
|
||||
x + w, y + h,
|
||||
glamor_priv->yInverted, texcoords);
|
||||
texcoords);
|
||||
|
||||
glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, GL_FLOAT, GL_FALSE,
|
||||
2 * sizeof(float), texcoords);
|
||||
|
@ -1190,7 +1175,7 @@ _glamor_download_sub_pixmap_to_cpu(PixmapPtr pixmap, GLenum format,
|
|||
{
|
||||
glamor_pixmap_private *pixmap_priv;
|
||||
GLenum gl_access = 0, gl_usage = 0;
|
||||
void *data, *read;
|
||||
void *data;
|
||||
glamor_screen_private *glamor_priv =
|
||||
glamor_get_screen_private(pixmap->drawable.pScreen);
|
||||
glamor_pixmap_fbo *temp_fbo = NULL;
|
||||
|
@ -1252,46 +1237,17 @@ _glamor_download_sub_pixmap_to_cpu(PixmapPtr pixmap, GLenum format,
|
|||
|
||||
glPixelStorei(GL_PACK_ALIGNMENT, 4);
|
||||
|
||||
if (glamor_priv->has_pack_invert || glamor_priv->yInverted) {
|
||||
|
||||
if (!glamor_priv->yInverted) {
|
||||
assert(glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP);
|
||||
glPixelStorei(GL_PACK_INVERT_MESA, 1);
|
||||
}
|
||||
|
||||
if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP && data == NULL) {
|
||||
assert(pbo > 0);
|
||||
glBindBuffer(GL_PIXEL_PACK_BUFFER, pbo);
|
||||
glBufferData(GL_PIXEL_PACK_BUFFER, stride * h, NULL, gl_usage);
|
||||
}
|
||||
|
||||
glReadPixels(x + fbo_x_off, y + fbo_y_off, w, h, format, type, data);
|
||||
|
||||
if (!glamor_priv->yInverted) {
|
||||
assert(glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP);
|
||||
glPixelStorei(GL_PACK_INVERT_MESA, 0);
|
||||
}
|
||||
if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP && bits == NULL) {
|
||||
bits = glMapBuffer(GL_PIXEL_PACK_BUFFER, gl_access);
|
||||
glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
|
||||
}
|
||||
if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP && data == NULL) {
|
||||
assert(pbo > 0);
|
||||
glBindBuffer(GL_PIXEL_PACK_BUFFER, pbo);
|
||||
glBufferData(GL_PIXEL_PACK_BUFFER, stride * h, NULL, gl_usage);
|
||||
}
|
||||
else {
|
||||
unsigned int temp_pbo;
|
||||
int yy;
|
||||
|
||||
glamor_make_current(glamor_priv);
|
||||
glGenBuffers(1, &temp_pbo);
|
||||
glBindBuffer(GL_PIXEL_PACK_BUFFER, temp_pbo);
|
||||
glBufferData(GL_PIXEL_PACK_BUFFER, stride * h, NULL, GL_STREAM_READ);
|
||||
glReadPixels(x + fbo_x_off, y + fbo_y_off, w, h, format, type, 0);
|
||||
read = glMapBuffer(GL_PIXEL_PACK_BUFFER, GL_READ_ONLY);
|
||||
for (yy = 0; yy < pixmap->drawable.height; yy++)
|
||||
memcpy((char *) data + yy * stride,
|
||||
(char *) read + (h - yy - 1) * stride, stride);
|
||||
glUnmapBuffer(GL_PIXEL_PACK_BUFFER);
|
||||
glReadPixels(x + fbo_x_off, y + fbo_y_off, w, h, format, type, data);
|
||||
|
||||
if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP && bits == NULL) {
|
||||
bits = glMapBuffer(GL_PIXEL_PACK_BUFFER, gl_access);
|
||||
glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
|
||||
glDeleteBuffers(1, &temp_pbo);
|
||||
}
|
||||
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
|
@ -1461,7 +1417,6 @@ glamor_download_pixmap_to_cpu(PixmapPtr pixmap, glamor_access_t access)
|
|||
stride = pixmap->devKind;
|
||||
|
||||
if (glamor_priv->gl_flavor == GLAMOR_GL_ES2
|
||||
|| (!glamor_priv->has_pack_invert && !glamor_priv->yInverted)
|
||||
|| pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
|
||||
data = malloc(stride * pixmap->drawable.height);
|
||||
}
|
||||
|
|
|
@ -200,7 +200,6 @@ struct glamor_saved_procs {
|
|||
#define RENDER_IDEL_MAX 32
|
||||
|
||||
typedef struct glamor_screen_private {
|
||||
Bool yInverted;
|
||||
unsigned int tick;
|
||||
enum glamor_gl_flavor gl_flavor;
|
||||
int glsl_version;
|
||||
|
|
|
@ -793,30 +793,29 @@ glamor_set_normalize_tcoords_generic(glamor_pixmap_private *priv,
|
|||
float *matrix,
|
||||
float xscale, float yscale,
|
||||
int x1, int y1, int x2, int y2,
|
||||
int yInverted, float *texcoords,
|
||||
float *texcoords,
|
||||
int stride)
|
||||
{
|
||||
if (!matrix && repeat_type == RepeatNone)
|
||||
glamor_set_normalize_tcoords_ext(priv, xscale, yscale,
|
||||
x1, y1,
|
||||
x2, y2, yInverted, texcoords, stride);
|
||||
x2, y2, texcoords, stride);
|
||||
else if (matrix && repeat_type == RepeatNone)
|
||||
glamor_set_transformed_normalize_tcoords_ext(priv, matrix, xscale,
|
||||
yscale, x1, y1,
|
||||
x2, y2,
|
||||
yInverted,
|
||||
texcoords, stride);
|
||||
else if (!matrix && repeat_type != RepeatNone)
|
||||
glamor_set_repeat_normalize_tcoords_ext(priv, repeat_type,
|
||||
xscale, yscale,
|
||||
x1, y1,
|
||||
x2, y2,
|
||||
yInverted, texcoords, stride);
|
||||
texcoords, stride);
|
||||
else if (matrix && repeat_type != RepeatNone)
|
||||
glamor_set_repeat_transformed_normalize_tcoords_ext(priv, repeat_type,
|
||||
matrix, xscale,
|
||||
yscale, x1, y1, x2,
|
||||
y2, yInverted,
|
||||
y2,
|
||||
texcoords, stride);
|
||||
}
|
||||
|
||||
|
@ -1266,7 +1265,7 @@ glamor_composite_with_shader(CARD8 op,
|
|||
glamor_set_normalize_vcoords_ext(dest_pixmap_priv, dst_xscale,
|
||||
dst_yscale, x_dest, y_dest,
|
||||
x_dest + width, y_dest + height,
|
||||
glamor_priv->yInverted, vertices,
|
||||
vertices,
|
||||
vb_stride);
|
||||
vertices += 2;
|
||||
if (key.source != SHADER_SOURCE_SOLID) {
|
||||
|
@ -1276,7 +1275,6 @@ glamor_composite_with_shader(CARD8 op,
|
|||
src_yscale, x_source,
|
||||
y_source, x_source + width,
|
||||
y_source + height,
|
||||
glamor_priv->yInverted,
|
||||
vertices, vb_stride);
|
||||
vertices += 2;
|
||||
}
|
||||
|
@ -1288,7 +1286,6 @@ glamor_composite_with_shader(CARD8 op,
|
|||
mask_yscale, x_mask,
|
||||
y_mask, x_mask + width,
|
||||
y_mask + height,
|
||||
glamor_priv->yInverted,
|
||||
vertices, vb_stride);
|
||||
vertices += 2;
|
||||
}
|
||||
|
|
|
@ -908,7 +908,6 @@ _glamor_trapezoids_with_shader(CARD8 op,
|
|||
clipped_vtx_tmp[5] = clipped_vtx[(i + 2) * 2 + 1];
|
||||
glamor_set_normalize_tri_vcoords(dst_xscale, dst_yscale,
|
||||
clipped_vtx_tmp,
|
||||
glamor_priv->yInverted,
|
||||
vertices);
|
||||
DEBUGF("vertices of triangle: (%f X %f), (%f X %f), "
|
||||
"(%f X %f)\n", vertices[0], vertices[1],
|
||||
|
@ -920,14 +919,12 @@ _glamor_trapezoids_with_shader(CARD8 op,
|
|||
glamor_set_transformed_normalize_tri_tcoords
|
||||
(source_pixmap_priv, src_matrix, src_xscale,
|
||||
src_yscale, clipped_vtx_tmp,
|
||||
glamor_priv->yInverted, source_texcoords);
|
||||
source_texcoords);
|
||||
}
|
||||
else {
|
||||
glamor_set_normalize_tri_tcoords(src_xscale,
|
||||
src_yscale,
|
||||
clipped_vtx_tmp,
|
||||
glamor_priv->
|
||||
yInverted,
|
||||
source_texcoords);
|
||||
}
|
||||
|
||||
|
@ -1439,11 +1436,9 @@ _glamor_generate_trapezoid_with_shader(ScreenPtr screen, PicturePtr picture,
|
|||
miTrapezoidBounds(1, ptrap, &one_trap_bound);
|
||||
|
||||
vertices += 2;
|
||||
glamor_set_tcoords_ext((pixmap_priv->base.pixmap->drawable.width),
|
||||
(pixmap_priv->base.pixmap->drawable.height),
|
||||
(one_trap_bound.x1), (one_trap_bound.y1),
|
||||
glamor_set_tcoords_ext((one_trap_bound.x1), (one_trap_bound.y1),
|
||||
(one_trap_bound.x2), (one_trap_bound.y2),
|
||||
glamor_priv->yInverted, vertices, stride);
|
||||
vertices, stride);
|
||||
DEBUGF("tex_vertices --> leftup : %f X %f, rightup: %f X %f,"
|
||||
"rightbottom: %f X %f, leftbottom : %f X %f\n", vertices[0],
|
||||
vertices[1], vertices[1 * stride], vertices[1 * stride + 1],
|
||||
|
@ -1463,8 +1458,7 @@ _glamor_generate_trapezoid_with_shader(ScreenPtr screen, PicturePtr picture,
|
|||
one_trap_bound.y1,
|
||||
one_trap_bound.x2,
|
||||
one_trap_bound.y2,
|
||||
glamor_priv->yInverted, vertices,
|
||||
stride);
|
||||
vertices, stride);
|
||||
DEBUGF("vertices --> leftup : %f X %f, rightup: %f X %f,"
|
||||
"rightbottom: %f X %f, leftbottom : %f X %f\n", vertices[0],
|
||||
vertices[1], vertices[1 * stride], vertices[1 * stride + 1],
|
||||
|
|
|
@ -313,21 +313,17 @@
|
|||
} while(0)
|
||||
|
||||
#define _glamor_set_normalize_tpoint(xscale, yscale, _tx_, _ty_, \
|
||||
texcoord, yInverted) \
|
||||
texcoord) \
|
||||
do { \
|
||||
(texcoord)[0] = t_from_x_coord_x(xscale, _tx_); \
|
||||
if (_X_LIKELY(yInverted)) \
|
||||
(texcoord)[1] = t_from_x_coord_y_inverted(yscale, _ty_);\
|
||||
else \
|
||||
(texcoord)[1] = t_from_x_coord_y(yscale, _ty_); \
|
||||
(texcoord)[1] = t_from_x_coord_y_inverted(yscale, _ty_); \
|
||||
DEBUGF("normalized point tx %f ty %f \n", (texcoord)[0], \
|
||||
(texcoord)[1]); \
|
||||
} while(0)
|
||||
|
||||
#define glamor_set_transformed_point(priv, matrix, xscale, \
|
||||
yscale, texcoord, \
|
||||
x, y, \
|
||||
yInverted) \
|
||||
x, y) \
|
||||
do { \
|
||||
float tx, ty; \
|
||||
int fbo_x_off, fbo_y_off; \
|
||||
|
@ -339,10 +335,7 @@
|
|||
tx += fbo_x_off; \
|
||||
ty += fbo_y_off; \
|
||||
(texcoord)[0] = t_from_x_coord_x(xscale, tx); \
|
||||
if (_X_LIKELY(yInverted)) \
|
||||
(texcoord)[1] = t_from_x_coord_y_inverted(yscale, ty); \
|
||||
else \
|
||||
(texcoord)[1] = t_from_x_coord_y(yscale, ty); \
|
||||
(texcoord)[1] = t_from_x_coord_y_inverted(yscale, ty); \
|
||||
DEBUGF("normalized tx %f ty %f \n", (texcoord)[0], (texcoord)[1]); \
|
||||
} while(0)
|
||||
|
||||
|
@ -351,18 +344,14 @@
|
|||
xscale, \
|
||||
yscale, \
|
||||
vtx, \
|
||||
yInverted, \
|
||||
texcoords) \
|
||||
do { \
|
||||
glamor_set_transformed_point(priv, matrix, xscale, yscale, \
|
||||
texcoords, (vtx)[0], (vtx)[1], \
|
||||
yInverted); \
|
||||
texcoords, (vtx)[0], (vtx)[1]); \
|
||||
glamor_set_transformed_point(priv, matrix, xscale, yscale, \
|
||||
texcoords+2, (vtx)[2], (vtx)[3], \
|
||||
yInverted); \
|
||||
texcoords+2, (vtx)[2], (vtx)[3]); \
|
||||
glamor_set_transformed_point(priv, matrix, xscale, yscale, \
|
||||
texcoords+4, (vtx)[4], (vtx)[5], \
|
||||
yInverted); \
|
||||
texcoords+4, (vtx)[4], (vtx)[5]); \
|
||||
} while (0)
|
||||
|
||||
#define glamor_set_transformed_normalize_tcoords_ext( priv, \
|
||||
|
@ -370,21 +359,17 @@
|
|||
xscale, \
|
||||
yscale, \
|
||||
tx1, ty1, tx2, ty2, \
|
||||
yInverted, texcoords, \
|
||||
texcoords, \
|
||||
stride) \
|
||||
do { \
|
||||
glamor_set_transformed_point(priv, matrix, xscale, yscale, \
|
||||
texcoords, tx1, ty1, \
|
||||
yInverted); \
|
||||
texcoords, tx1, ty1); \
|
||||
glamor_set_transformed_point(priv, matrix, xscale, yscale, \
|
||||
texcoords + 1 * stride, tx2, ty1, \
|
||||
yInverted); \
|
||||
texcoords + 1 * stride, tx2, ty1); \
|
||||
glamor_set_transformed_point(priv, matrix, xscale, yscale, \
|
||||
texcoords + 2 * stride, tx2, ty2, \
|
||||
yInverted); \
|
||||
texcoords + 2 * stride, tx2, ty2); \
|
||||
glamor_set_transformed_point(priv, matrix, xscale, yscale, \
|
||||
texcoords + 3 * stride, tx1, ty2, \
|
||||
yInverted); \
|
||||
texcoords + 3 * stride, tx1, ty2); \
|
||||
} while (0)
|
||||
|
||||
#define glamor_set_transformed_normalize_tcoords( priv, \
|
||||
|
@ -392,35 +377,31 @@
|
|||
xscale, \
|
||||
yscale, \
|
||||
tx1, ty1, tx2, ty2, \
|
||||
yInverted, texcoords) \
|
||||
texcoords) \
|
||||
do { \
|
||||
glamor_set_transformed_normalize_tcoords_ext( priv, \
|
||||
matrix, \
|
||||
xscale, \
|
||||
yscale, \
|
||||
tx1, ty1, tx2, ty2, \
|
||||
yInverted, texcoords, \
|
||||
texcoords, \
|
||||
2); \
|
||||
} while (0)
|
||||
|
||||
#define glamor_set_normalize_tri_tcoords(xscale, \
|
||||
yscale, \
|
||||
vtx, \
|
||||
yInverted, \
|
||||
texcoords) \
|
||||
do { \
|
||||
_glamor_set_normalize_tpoint(xscale, yscale, \
|
||||
(vtx)[0], (vtx)[1], \
|
||||
texcoords, \
|
||||
yInverted); \
|
||||
texcoords); \
|
||||
_glamor_set_normalize_tpoint(xscale, yscale, \
|
||||
(vtx)[2], (vtx)[3], \
|
||||
texcoords+2, \
|
||||
yInverted); \
|
||||
texcoords+2); \
|
||||
_glamor_set_normalize_tpoint(xscale, yscale, \
|
||||
(vtx)[4], (vtx)[5], \
|
||||
texcoords+4, \
|
||||
yInverted); \
|
||||
texcoords+4); \
|
||||
} while (0)
|
||||
|
||||
#define glamor_set_repeat_transformed_normalize_tcoords_ext( priv, \
|
||||
|
@ -430,14 +411,13 @@
|
|||
yscale, \
|
||||
_x1_, _y1_, \
|
||||
_x2_, _y2_, \
|
||||
yInverted, \
|
||||
texcoords, \
|
||||
stride) \
|
||||
do { \
|
||||
if (_X_LIKELY(priv->type != GLAMOR_TEXTURE_LARGE)) { \
|
||||
glamor_set_transformed_normalize_tcoords_ext(priv, matrix, xscale, \
|
||||
yscale, _x1_, _y1_, \
|
||||
_x2_, _y2_, yInverted, \
|
||||
_x2_, _y2_, \
|
||||
texcoords, stride); \
|
||||
} else { \
|
||||
float tx1, ty1, tx2, ty2, tx3, ty3, tx4, ty4; \
|
||||
|
@ -464,13 +444,13 @@
|
|||
DEBUGF("repeat transformed %f %f %f %f %f %f %f %f\n", ttx1, tty1, \
|
||||
ttx2, tty2, ttx3, tty3, ttx4, tty4); \
|
||||
_glamor_set_normalize_tpoint(xscale, yscale, ttx1, tty1, \
|
||||
texcoords, yInverted); \
|
||||
texcoords); \
|
||||
_glamor_set_normalize_tpoint(xscale, yscale, ttx2, tty2, \
|
||||
texcoords + 1 * stride, yInverted); \
|
||||
texcoords + 1 * stride); \
|
||||
_glamor_set_normalize_tpoint(xscale, yscale, ttx3, tty3, \
|
||||
texcoords + 2 * stride, yInverted); \
|
||||
texcoords + 2 * stride); \
|
||||
_glamor_set_normalize_tpoint(xscale, yscale, ttx4, tty4, \
|
||||
texcoords + 3 * stride, yInverted); \
|
||||
texcoords + 3 * stride); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
@ -481,7 +461,6 @@
|
|||
yscale, \
|
||||
_x1_, _y1_, \
|
||||
_x2_, _y2_, \
|
||||
yInverted, \
|
||||
texcoords) \
|
||||
do { \
|
||||
glamor_set_repeat_transformed_normalize_tcoords_ext( priv, \
|
||||
|
@ -491,14 +470,13 @@
|
|||
yscale, \
|
||||
_x1_, _y1_, \
|
||||
_x2_, _y2_, \
|
||||
yInverted, \
|
||||
texcoords, \
|
||||
2); \
|
||||
} while (0)
|
||||
|
||||
#define _glamor_set_normalize_tcoords(xscale, yscale, tx1, \
|
||||
ty1, tx2, ty2, \
|
||||
yInverted, vertices, stride) \
|
||||
vertices, stride) \
|
||||
do { \
|
||||
/* vertices may be write-only, so we use following \
|
||||
* temporary variable. */ \
|
||||
|
@ -507,21 +485,15 @@
|
|||
(vertices)[1 * stride] = _t2_ = t_from_x_coord_x(xscale, tx2); \
|
||||
(vertices)[2 * stride] = _t2_; \
|
||||
(vertices)[3 * stride] = _t0_; \
|
||||
if (_X_LIKELY(yInverted)) { \
|
||||
(vertices)[1] = _t1_ = t_from_x_coord_y_inverted(yscale, ty1); \
|
||||
(vertices)[2 * stride + 1] = _t5_ = t_from_x_coord_y_inverted(yscale, ty2);\
|
||||
} \
|
||||
else { \
|
||||
(vertices)[1] = _t1_ = t_from_x_coord_y(yscale, ty1); \
|
||||
(vertices)[2 * stride + 1] = _t5_ = t_from_x_coord_y(yscale, ty2);\
|
||||
} \
|
||||
(vertices)[1] = _t1_ = t_from_x_coord_y_inverted(yscale, ty1); \
|
||||
(vertices)[2 * stride + 1] = _t5_ = t_from_x_coord_y_inverted(yscale, ty2); \
|
||||
(vertices)[1 * stride + 1] = _t1_; \
|
||||
(vertices)[3 * stride + 1] = _t5_; \
|
||||
} while(0)
|
||||
|
||||
#define glamor_set_normalize_tcoords_ext(priv, xscale, yscale, \
|
||||
x1, y1, x2, y2, \
|
||||
yInverted, vertices, stride) \
|
||||
vertices, stride) \
|
||||
do { \
|
||||
if (_X_UNLIKELY(priv->type == GLAMOR_TEXTURE_LARGE)) { \
|
||||
float tx1, tx2, ty1, ty2; \
|
||||
|
@ -532,26 +504,26 @@
|
|||
ty1 = y1 + fbo_y_off; \
|
||||
ty2 = y2 + fbo_y_off; \
|
||||
_glamor_set_normalize_tcoords(xscale, yscale, tx1, ty1, \
|
||||
tx2, ty2, yInverted, vertices, \
|
||||
tx2, ty2, vertices, \
|
||||
stride); \
|
||||
} else \
|
||||
_glamor_set_normalize_tcoords(xscale, yscale, x1, y1, \
|
||||
x2, y2, yInverted, vertices, stride);\
|
||||
x2, y2, vertices, stride); \
|
||||
} while(0)
|
||||
|
||||
#define glamor_set_normalize_tcoords(priv, xscale, yscale, \
|
||||
x1, y1, x2, y2, \
|
||||
yInverted, vertices) \
|
||||
vertices) \
|
||||
do { \
|
||||
glamor_set_normalize_tcoords_ext(priv, xscale, yscale, \
|
||||
x1, y1, x2, y2, \
|
||||
yInverted, vertices, 2); \
|
||||
vertices, 2); \
|
||||
} while(0)
|
||||
|
||||
#define glamor_set_repeat_normalize_tcoords_ext(priv, repeat_type, \
|
||||
xscale, yscale, \
|
||||
_x1_, _y1_, _x2_, _y2_, \
|
||||
yInverted, vertices, stride)\
|
||||
vertices, stride) \
|
||||
do { \
|
||||
if (_X_UNLIKELY(priv->type == GLAMOR_TEXTURE_LARGE)) { \
|
||||
float tx1, tx2, ty1, ty2; \
|
||||
|
@ -566,130 +538,99 @@
|
|||
_x1_, _y1_, _x2_, _y2_); \
|
||||
} \
|
||||
_glamor_set_normalize_tcoords(xscale, yscale, tx1, ty1, \
|
||||
tx2, ty2, yInverted, vertices, \
|
||||
tx2, ty2, vertices, \
|
||||
stride); \
|
||||
} else \
|
||||
_glamor_set_normalize_tcoords(xscale, yscale, _x1_, _y1_, \
|
||||
_x2_, _y2_, yInverted, vertices, \
|
||||
_x2_, _y2_, vertices, \
|
||||
stride); \
|
||||
} while(0)
|
||||
|
||||
#define glamor_set_repeat_normalize_tcoords(priv, repeat_type, \
|
||||
xscale, yscale, \
|
||||
_x1_, _y1_, _x2_, _y2_, \
|
||||
yInverted, vertices) \
|
||||
vertices) \
|
||||
do { \
|
||||
glamor_set_repeat_normalize_tcoords_ext(priv, repeat_type, \
|
||||
xscale, yscale, \
|
||||
_x1_, _y1_, _x2_, _y2_, \
|
||||
yInverted, vertices, 2); \
|
||||
vertices, 2); \
|
||||
} while(0)
|
||||
|
||||
#define glamor_set_normalize_tcoords_tri_stripe(xscale, yscale, \
|
||||
x1, y1, x2, y2, \
|
||||
yInverted, vertices) \
|
||||
vertices) \
|
||||
do { \
|
||||
(vertices)[0] = t_from_x_coord_x(xscale, x1); \
|
||||
(vertices)[2] = t_from_x_coord_x(xscale, x2); \
|
||||
(vertices)[6] = (vertices)[2]; \
|
||||
(vertices)[4] = (vertices)[0]; \
|
||||
if (_X_LIKELY(yInverted)) { \
|
||||
(vertices)[1] = t_from_x_coord_y_inverted(yscale, y1); \
|
||||
(vertices)[7] = t_from_x_coord_y_inverted(yscale, y2); \
|
||||
} \
|
||||
else { \
|
||||
(vertices)[1] = t_from_x_coord_y(yscale, y1); \
|
||||
(vertices)[7] = t_from_x_coord_y(yscale, y2); \
|
||||
} \
|
||||
(vertices)[1] = t_from_x_coord_y_inverted(yscale, y1); \
|
||||
(vertices)[7] = t_from_x_coord_y_inverted(yscale, y2); \
|
||||
(vertices)[3] = (vertices)[1]; \
|
||||
(vertices)[5] = (vertices)[7]; \
|
||||
} while(0)
|
||||
|
||||
#define glamor_set_tcoords(width, height, x1, y1, x2, y2, \
|
||||
yInverted, vertices) \
|
||||
#define glamor_set_tcoords(x1, y1, x2, y2, vertices) \
|
||||
do { \
|
||||
(vertices)[0] = (x1); \
|
||||
(vertices)[2] = (x2); \
|
||||
(vertices)[4] = (vertices)[2]; \
|
||||
(vertices)[6] = (vertices)[0]; \
|
||||
if (_X_LIKELY(yInverted)) { \
|
||||
(vertices)[1] = (y1); \
|
||||
(vertices)[5] = (y2); \
|
||||
} \
|
||||
else { \
|
||||
(vertices)[1] = height - (y2); \
|
||||
(vertices)[5] = height - (y1); \
|
||||
} \
|
||||
(vertices)[1] = (y1); \
|
||||
(vertices)[5] = (y2); \
|
||||
(vertices)[3] = (vertices)[1]; \
|
||||
(vertices)[7] = (vertices)[5]; \
|
||||
} while(0)
|
||||
|
||||
#define glamor_set_tcoords_ext(width, height, x1, y1, x2, y2, \
|
||||
yInverted, vertices, stride) \
|
||||
#define glamor_set_tcoords_ext(x1, y1, x2, y2, vertices, stride) \
|
||||
do { \
|
||||
(vertices)[0] = (x1); \
|
||||
(vertices)[1*stride] = (x2); \
|
||||
(vertices)[2*stride] = (vertices)[1*stride]; \
|
||||
(vertices)[3*stride] = (vertices)[0]; \
|
||||
if (_X_LIKELY(yInverted)) { \
|
||||
(vertices)[1] = (y1); \
|
||||
(vertices)[2*stride + 1] = (y2); \
|
||||
} \
|
||||
else { \
|
||||
(vertices)[1] = height - (y2); \
|
||||
(vertices)[2*stride + 1] = height - (y1); \
|
||||
} \
|
||||
(vertices)[1] = (y1); \
|
||||
(vertices)[2*stride + 1] = (y2); \
|
||||
(vertices)[1*stride + 1] = (vertices)[1]; \
|
||||
(vertices)[3*stride + 1] = (vertices)[2*stride + 1]; \
|
||||
} while(0)
|
||||
|
||||
#define glamor_set_normalize_one_vcoord(xscale, yscale, x, y, \
|
||||
yInverted, vertices) \
|
||||
vertices) \
|
||||
do { \
|
||||
(vertices)[0] = v_from_x_coord_x(xscale, x); \
|
||||
if (_X_LIKELY(yInverted)) { \
|
||||
(vertices)[1] = v_from_x_coord_y_inverted(yscale, y); \
|
||||
} else { \
|
||||
(vertices)[1] = v_from_x_coord_y(yscale, y); \
|
||||
} \
|
||||
(vertices)[1] = v_from_x_coord_y_inverted(yscale, y); \
|
||||
} while(0)
|
||||
|
||||
#define glamor_set_normalize_tri_vcoords(xscale, yscale, vtx, \
|
||||
yInverted, vertices) \
|
||||
vertices) \
|
||||
do { \
|
||||
glamor_set_normalize_one_vcoord(xscale, yscale, \
|
||||
(vtx)[0], (vtx)[1], \
|
||||
yInverted, vertices); \
|
||||
vertices); \
|
||||
glamor_set_normalize_one_vcoord(xscale, yscale, \
|
||||
(vtx)[2], (vtx)[3], \
|
||||
yInverted, vertices+2); \
|
||||
vertices+2); \
|
||||
glamor_set_normalize_one_vcoord(xscale, yscale, \
|
||||
(vtx)[4], (vtx)[5], \
|
||||
yInverted, vertices+4); \
|
||||
vertices+4); \
|
||||
} while(0)
|
||||
|
||||
#define glamor_set_tcoords_tri_strip(width, height, x1, y1, x2, y2, \
|
||||
yInverted, vertices) \
|
||||
#define glamor_set_tcoords_tri_strip(x1, y1, x2, y2, vertices) \
|
||||
do { \
|
||||
(vertices)[0] = (x1); \
|
||||
(vertices)[2] = (x2); \
|
||||
(vertices)[6] = (vertices)[2]; \
|
||||
(vertices)[4] = (vertices)[0]; \
|
||||
if (_X_LIKELY(yInverted)) { \
|
||||
(vertices)[1] = (y1); \
|
||||
(vertices)[7] = (y2); \
|
||||
} \
|
||||
else { \
|
||||
(vertices)[1] = height - (y2); \
|
||||
(vertices)[7] = height - (y1); \
|
||||
} \
|
||||
(vertices)[1] = (y1); \
|
||||
(vertices)[7] = (y2); \
|
||||
(vertices)[3] = (vertices)[1]; \
|
||||
(vertices)[5] = (vertices)[7]; \
|
||||
} while(0)
|
||||
|
||||
#define glamor_set_normalize_vcoords_ext(priv, xscale, yscale, \
|
||||
x1, y1, x2, y2, \
|
||||
yInverted, vertices, stride) \
|
||||
vertices, stride) \
|
||||
do { \
|
||||
int fbo_x_off, fbo_y_off; \
|
||||
/* vertices may be write-only, so we use following \
|
||||
|
@ -701,29 +642,22 @@
|
|||
x2 + fbo_x_off); \
|
||||
(vertices)[2 * stride] = _t2_; \
|
||||
(vertices)[3 * stride] = _t0_; \
|
||||
if (_X_LIKELY(yInverted)) { \
|
||||
(vertices)[1] = _t1_ = v_from_x_coord_y_inverted(yscale, \
|
||||
y1 + fbo_y_off); \
|
||||
(vertices)[2 * stride + 1] = _t5_ = \
|
||||
v_from_x_coord_y_inverted(yscale, \
|
||||
y2 + fbo_y_off); \
|
||||
} \
|
||||
else { \
|
||||
(vertices)[1] = _t1_ = v_from_x_coord_y(yscale, y1 + fbo_y_off); \
|
||||
(vertices)[2 * stride + 1] = _t5_ = v_from_x_coord_y(yscale, \
|
||||
y2 + fbo_y_off); \
|
||||
} \
|
||||
(vertices)[1] = _t1_ = v_from_x_coord_y_inverted(yscale, \
|
||||
y1 + fbo_y_off); \
|
||||
(vertices)[2 * stride + 1] = _t5_ = \
|
||||
v_from_x_coord_y_inverted(yscale, \
|
||||
y2 + fbo_y_off); \
|
||||
(vertices)[1 * stride + 1] = _t1_; \
|
||||
(vertices)[3 * stride + 1] = _t5_; \
|
||||
} while(0)
|
||||
|
||||
#define glamor_set_normalize_vcoords(priv, xscale, yscale, \
|
||||
x1, y1, x2, y2, \
|
||||
yInverted, vertices) \
|
||||
vertices) \
|
||||
do { \
|
||||
glamor_set_normalize_vcoords_ext(priv, xscale, yscale, \
|
||||
x1, y1, x2, y2, \
|
||||
yInverted, vertices, 2); \
|
||||
vertices, 2); \
|
||||
} while(0)
|
||||
|
||||
#define glamor_set_const_ext(params, nparam, vertices, nverts, stride) \
|
||||
|
@ -738,44 +672,30 @@
|
|||
|
||||
#define glamor_set_normalize_vcoords_tri_strip(xscale, yscale, \
|
||||
x1, y1, x2, y2, \
|
||||
yInverted, vertices) \
|
||||
vertices) \
|
||||
do { \
|
||||
(vertices)[0] = v_from_x_coord_x(xscale, x1); \
|
||||
(vertices)[2] = v_from_x_coord_x(xscale, x2); \
|
||||
(vertices)[6] = (vertices)[2]; \
|
||||
(vertices)[4] = (vertices)[0]; \
|
||||
if (_X_LIKELY(yInverted)) { \
|
||||
(vertices)[1] = v_from_x_coord_y_inverted(yscale, y1); \
|
||||
(vertices)[7] = v_from_x_coord_y_inverted(yscale, y2); \
|
||||
} \
|
||||
else { \
|
||||
(vertices)[1] = v_from_x_coord_y(yscale, y1); \
|
||||
(vertices)[7] = v_from_x_coord_y(yscale, y2); \
|
||||
} \
|
||||
(vertices)[1] = v_from_x_coord_y_inverted(yscale, y1); \
|
||||
(vertices)[7] = v_from_x_coord_y_inverted(yscale, y2); \
|
||||
(vertices)[3] = (vertices)[1]; \
|
||||
(vertices)[5] = (vertices)[7]; \
|
||||
} while(0)
|
||||
|
||||
#define glamor_set_normalize_pt(xscale, yscale, x, y, \
|
||||
yInverted, pt) \
|
||||
pt) \
|
||||
do { \
|
||||
(pt)[0] = t_from_x_coord_x(xscale, x); \
|
||||
if (_X_LIKELY(yInverted)) { \
|
||||
(pt)[1] = t_from_x_coord_y_inverted(yscale, y); \
|
||||
} else { \
|
||||
(pt)[1] = t_from_x_coord_y(yscale, y); \
|
||||
} \
|
||||
(pt)[1] = t_from_x_coord_y_inverted(yscale, y); \
|
||||
} while(0)
|
||||
|
||||
#define glamor_set_circle_centre(width, height, x, y, \
|
||||
yInverted, c) \
|
||||
c) \
|
||||
do { \
|
||||
(c)[0] = (float)x; \
|
||||
if (_X_LIKELY(yInverted)) { \
|
||||
(c)[1] = (float)y; \
|
||||
} else { \
|
||||
(c)[1] = (float)height - (float)y; \
|
||||
} \
|
||||
(c)[1] = (float)y; \
|
||||
} while(0)
|
||||
|
||||
inline static void
|
||||
|
|
|
@ -360,7 +360,7 @@ glamor_xv_render(glamor_port_private *port_priv)
|
|||
dsty,
|
||||
dstx + dstw,
|
||||
dsty + dsth,
|
||||
glamor_priv->yInverted, vertices);
|
||||
vertices);
|
||||
|
||||
glamor_set_normalize_tcoords(src_pixmap_priv[0],
|
||||
src_xscale[0],
|
||||
|
@ -369,7 +369,7 @@ glamor_xv_render(glamor_port_private *port_priv)
|
|||
srcy,
|
||||
srcx + srcw,
|
||||
srcy + srch,
|
||||
glamor_priv->yInverted, texcoords);
|
||||
texcoords);
|
||||
|
||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
}
|
||||
|
|
|
@ -1245,8 +1245,7 @@ ephyr_glamor_init(ScreenPtr screen)
|
|||
|
||||
glamor_init(screen,
|
||||
GLAMOR_USE_SCREEN |
|
||||
GLAMOR_USE_PICTURE_SCREEN |
|
||||
GLAMOR_INVERTED_Y_AXIS);
|
||||
GLAMOR_USE_PICTURE_SCREEN);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue