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