glamor: Eliminate separate 'large' pixmap private structure
Just embed the large elements in the regular pixmap private and collapse the union to a single struct. Signed-off-by: Keith Packard <keithp@keithp.com> Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
parent
9ef5cbf8ab
commit
020fcc5828
|
@ -72,10 +72,10 @@ glamor_set_pixmap_type(PixmapPtr pixmap, glamor_pixmap_type_t type)
|
||||||
glamor_set_pixmap_private(pixmap, pixmap_priv);
|
glamor_set_pixmap_private(pixmap, pixmap_priv);
|
||||||
}
|
}
|
||||||
pixmap_priv->type = type;
|
pixmap_priv->type = type;
|
||||||
pixmap_priv->base.box.x1 = 0;
|
pixmap_priv->box.x1 = 0;
|
||||||
pixmap_priv->base.box.x2 = pixmap->drawable.width;
|
pixmap_priv->box.x2 = pixmap->drawable.width;
|
||||||
pixmap_priv->base.box.y1 = 0;
|
pixmap_priv->box.y1 = 0;
|
||||||
pixmap_priv->base.box.y2 = pixmap->drawable.height;
|
pixmap_priv->box.y2 = pixmap->drawable.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
_X_EXPORT void
|
_X_EXPORT void
|
||||||
|
@ -90,7 +90,7 @@ glamor_set_pixmap_texture(PixmapPtr pixmap, unsigned int tex)
|
||||||
glamor_priv = glamor_get_screen_private(screen);
|
glamor_priv = glamor_get_screen_private(screen);
|
||||||
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||||
|
|
||||||
if (pixmap_priv->base.fbo) {
|
if (pixmap_priv->fbo) {
|
||||||
fbo = glamor_pixmap_detach_fbo(pixmap_priv);
|
fbo = glamor_pixmap_detach_fbo(pixmap_priv);
|
||||||
glamor_destroy_fbo(glamor_priv, fbo);
|
glamor_destroy_fbo(glamor_priv, fbo);
|
||||||
}
|
}
|
||||||
|
@ -116,10 +116,10 @@ glamor_set_screen_pixmap(PixmapPtr screen_pixmap, PixmapPtr *back_pixmap)
|
||||||
|
|
||||||
glamor_priv = glamor_get_screen_private(screen_pixmap->drawable.pScreen);
|
glamor_priv = glamor_get_screen_private(screen_pixmap->drawable.pScreen);
|
||||||
pixmap_priv = glamor_get_pixmap_private(screen_pixmap);
|
pixmap_priv = glamor_get_pixmap_private(screen_pixmap);
|
||||||
glamor_priv->screen_fbo = pixmap_priv->base.fbo->fb;
|
glamor_priv->screen_fbo = pixmap_priv->fbo->fb;
|
||||||
|
|
||||||
pixmap_priv->base.fbo->width = screen_pixmap->drawable.width;
|
pixmap_priv->fbo->width = screen_pixmap->drawable.width;
|
||||||
pixmap_priv->base.fbo->height = screen_pixmap->drawable.height;
|
pixmap_priv->fbo->height = screen_pixmap->drawable.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t
|
uint32_t
|
||||||
|
@ -130,7 +130,7 @@ glamor_get_pixmap_texture(PixmapPtr pixmap)
|
||||||
if (pixmap_priv->type != GLAMOR_TEXTURE_ONLY)
|
if (pixmap_priv->type != GLAMOR_TEXTURE_ONLY)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return pixmap_priv->base.fbo->tex;
|
return pixmap_priv->fbo->tex;
|
||||||
}
|
}
|
||||||
|
|
||||||
PixmapPtr
|
PixmapPtr
|
||||||
|
@ -173,20 +173,20 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
|
||||||
|
|
||||||
if (usage == GLAMOR_CREATE_PIXMAP_NO_TEXTURE) {
|
if (usage == GLAMOR_CREATE_PIXMAP_NO_TEXTURE) {
|
||||||
pixmap_priv->type = GLAMOR_TEXTURE_ONLY;
|
pixmap_priv->type = GLAMOR_TEXTURE_ONLY;
|
||||||
pixmap_priv->base.box.x1 = 0;
|
pixmap_priv->box.x1 = 0;
|
||||||
pixmap_priv->base.box.y1 = 0;
|
pixmap_priv->box.y1 = 0;
|
||||||
pixmap_priv->base.box.x2 = w;
|
pixmap_priv->box.x2 = w;
|
||||||
pixmap_priv->base.box.y2 = h;
|
pixmap_priv->box.y2 = h;
|
||||||
return pixmap;
|
return pixmap;
|
||||||
}
|
}
|
||||||
else if (usage == GLAMOR_CREATE_NO_LARGE ||
|
else if (usage == GLAMOR_CREATE_NO_LARGE ||
|
||||||
glamor_check_fbo_size(glamor_priv, w, h))
|
glamor_check_fbo_size(glamor_priv, w, h))
|
||||||
{
|
{
|
||||||
pixmap_priv->type = type;
|
pixmap_priv->type = type;
|
||||||
pixmap_priv->base.box.x1 = 0;
|
pixmap_priv->box.x1 = 0;
|
||||||
pixmap_priv->base.box.y1 = 0;
|
pixmap_priv->box.y1 = 0;
|
||||||
pixmap_priv->base.box.x2 = w;
|
pixmap_priv->box.x2 = w;
|
||||||
pixmap_priv->base.box.y2 = h;
|
pixmap_priv->box.y2 = h;
|
||||||
fbo = glamor_create_fbo(glamor_priv, w, h, format, usage);
|
fbo = glamor_create_fbo(glamor_priv, w, h, format, usage);
|
||||||
} else {
|
} else {
|
||||||
int tile_size = glamor_priv->max_fbo_size;
|
int tile_size = glamor_priv->max_fbo_size;
|
||||||
|
@ -639,7 +639,7 @@ glamor_fd_from_pixmap(ScreenPtr screen,
|
||||||
return -1;
|
return -1;
|
||||||
return glamor_egl_dri3_fd_name_from_tex(screen,
|
return glamor_egl_dri3_fd_name_from_tex(screen,
|
||||||
pixmap,
|
pixmap,
|
||||||
pixmap_priv->base.fbo->tex,
|
pixmap_priv->fbo->tex,
|
||||||
FALSE, stride, size);
|
FALSE, stride, size);
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -664,7 +664,7 @@ glamor_name_from_pixmap(PixmapPtr pixmap, CARD16 *stride, CARD32 *size)
|
||||||
return -1;
|
return -1;
|
||||||
return glamor_egl_dri3_fd_name_from_tex(pixmap->drawable.pScreen,
|
return glamor_egl_dri3_fd_name_from_tex(pixmap->drawable.pScreen,
|
||||||
pixmap,
|
pixmap,
|
||||||
pixmap_priv->base.fbo->tex,
|
pixmap_priv->fbo->tex,
|
||||||
TRUE, stride, size);
|
TRUE, stride, size);
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -43,9 +43,9 @@ glamor_get_drawable_location(const DrawablePtr drawable)
|
||||||
glamor_screen_private *glamor_priv =
|
glamor_screen_private *glamor_priv =
|
||||||
glamor_get_screen_private(drawable->pScreen);
|
glamor_get_screen_private(drawable->pScreen);
|
||||||
if (pixmap_priv == NULL ||
|
if (pixmap_priv == NULL ||
|
||||||
pixmap_priv->base.gl_fbo == GLAMOR_FBO_UNATTACHED)
|
pixmap_priv->gl_fbo == GLAMOR_FBO_UNATTACHED)
|
||||||
return 'm';
|
return 'm';
|
||||||
if (pixmap_priv->base.fbo->fb == glamor_priv->screen_fbo)
|
if (pixmap_priv->fbo->fb == glamor_priv->screen_fbo)
|
||||||
return 's';
|
return 's';
|
||||||
else
|
else
|
||||||
return 'f';
|
return 'f';
|
||||||
|
|
|
@ -189,7 +189,7 @@ glamor_dash_setup(DrawablePtr drawable, GCPtr gc)
|
||||||
/* Set the dash pattern as texture 1 */
|
/* Set the dash pattern as texture 1 */
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE1);
|
glActiveTexture(GL_TEXTURE1);
|
||||||
glBindTexture(GL_TEXTURE_2D, dash_priv->base.fbo->tex);
|
glBindTexture(GL_TEXTURE_2D, dash_priv->fbo->tex);
|
||||||
glUniform1i(prog->dash_uniform, 1);
|
glUniform1i(prog->dash_uniform, 1);
|
||||||
glUniform1f(prog->dash_length_uniform, dash_pixmap->drawable.width);
|
glUniform1f(prog->dash_length_uniform, dash_pixmap->drawable.width);
|
||||||
|
|
||||||
|
|
|
@ -239,7 +239,6 @@ glamor_egl_create_textured_screen(ScreenPtr screen, int handle, int stride)
|
||||||
"Failed to create textured screen.");
|
"Failed to create textured screen.");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
glamor_set_screen_pixmap(screen_pixmap, NULL);
|
glamor_set_screen_pixmap(screen_pixmap, NULL);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -272,7 +271,7 @@ glamor_egl_set_pixmap_image(PixmapPtr pixmap, EGLImageKHR image)
|
||||||
glamor_get_pixmap_private(pixmap);
|
glamor_get_pixmap_private(pixmap);
|
||||||
EGLImageKHR old;
|
EGLImageKHR old;
|
||||||
|
|
||||||
old = pixmap_priv->base.image;
|
old = pixmap_priv->image;
|
||||||
if (old) {
|
if (old) {
|
||||||
ScreenPtr screen = pixmap->drawable.pScreen;
|
ScreenPtr screen = pixmap->drawable.pScreen;
|
||||||
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
|
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
|
||||||
|
@ -280,7 +279,7 @@ glamor_egl_set_pixmap_image(PixmapPtr pixmap, EGLImageKHR image)
|
||||||
|
|
||||||
eglDestroyImageKHR(glamor_egl->display, old);
|
eglDestroyImageKHR(glamor_egl->display, old);
|
||||||
}
|
}
|
||||||
pixmap_priv->base.image = image;
|
pixmap_priv->image = image;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
|
@ -420,7 +419,7 @@ glamor_egl_dri3_fd_name_from_tex(ScreenPtr screen,
|
||||||
|
|
||||||
glamor_make_current(glamor_priv);
|
glamor_make_current(glamor_priv);
|
||||||
|
|
||||||
image = pixmap_priv->base.image;
|
image = pixmap_priv->image;
|
||||||
if (!image) {
|
if (!image) {
|
||||||
image = eglCreateImageKHR(glamor_egl->display,
|
image = eglCreateImageKHR(glamor_egl->display,
|
||||||
glamor_egl->context,
|
glamor_egl->context,
|
||||||
|
@ -536,7 +535,7 @@ glamor_egl_destroy_pixmap_image(PixmapPtr pixmap)
|
||||||
struct glamor_pixmap_private *pixmap_priv =
|
struct glamor_pixmap_private *pixmap_priv =
|
||||||
glamor_get_pixmap_private(pixmap);
|
glamor_get_pixmap_private(pixmap);
|
||||||
|
|
||||||
if (pixmap_priv && pixmap_priv->base.image) {
|
if (pixmap_priv && pixmap_priv->image) {
|
||||||
ScrnInfoPtr scrn = xf86ScreenToScrn(pixmap->drawable.pScreen);
|
ScrnInfoPtr scrn = xf86ScreenToScrn(pixmap->drawable.pScreen);
|
||||||
struct glamor_egl_screen_private *glamor_egl =
|
struct glamor_egl_screen_private *glamor_egl =
|
||||||
glamor_egl_get_screen_private(scrn);
|
glamor_egl_get_screen_private(scrn);
|
||||||
|
@ -545,8 +544,8 @@ glamor_egl_destroy_pixmap_image(PixmapPtr pixmap)
|
||||||
* a texture. we must call glFlush to make sure the
|
* a texture. we must call glFlush to make sure the
|
||||||
* operation on that texture has been done.*/
|
* operation on that texture has been done.*/
|
||||||
glamor_block_handler(pixmap->drawable.pScreen);
|
glamor_block_handler(pixmap->drawable.pScreen);
|
||||||
eglDestroyImageKHR(glamor_egl->display, pixmap_priv->base.image);
|
eglDestroyImageKHR(glamor_egl->display, pixmap_priv->image);
|
||||||
pixmap_priv->base.image = NULL;
|
pixmap_priv->image = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -561,13 +560,12 @@ glamor_egl_exchange_buffers(PixmapPtr front, PixmapPtr back)
|
||||||
|
|
||||||
glamor_pixmap_exchange_fbos(front, back);
|
glamor_pixmap_exchange_fbos(front, back);
|
||||||
|
|
||||||
temp = back_priv->base.image;
|
temp = back_priv->image;
|
||||||
back_priv->base.image = front_priv->base.image;
|
back_priv->image = front_priv->image;
|
||||||
front_priv->base.image = temp;
|
front_priv->image = temp;
|
||||||
|
|
||||||
glamor_set_pixmap_type(front, GLAMOR_TEXTURE_DRM);
|
glamor_set_pixmap_type(front, GLAMOR_TEXTURE_DRM);
|
||||||
glamor_set_pixmap_type(back, GLAMOR_TEXTURE_DRM);
|
glamor_set_pixmap_type(back, GLAMOR_TEXTURE_DRM);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -589,8 +587,8 @@ glamor_egl_close_screen(ScreenPtr screen)
|
||||||
screen_pixmap = screen->GetScreenPixmap(screen);
|
screen_pixmap = screen->GetScreenPixmap(screen);
|
||||||
pixmap_priv = glamor_get_pixmap_private(screen_pixmap);
|
pixmap_priv = glamor_get_pixmap_private(screen_pixmap);
|
||||||
|
|
||||||
eglDestroyImageKHR(glamor_egl->display, pixmap_priv->base.image);
|
eglDestroyImageKHR(glamor_egl->display, pixmap_priv->image);
|
||||||
pixmap_priv->base.image = NULL;
|
pixmap_priv->image = NULL;
|
||||||
|
|
||||||
screen->CloseScreen = glamor_egl->saved_close_screen;
|
screen->CloseScreen = glamor_egl->saved_close_screen;
|
||||||
|
|
||||||
|
|
|
@ -368,9 +368,9 @@ _glamor_create_fbo_array(glamor_screen_private *glamor_priv,
|
||||||
glamor_pixmap_fbo **fbo_array;
|
glamor_pixmap_fbo **fbo_array;
|
||||||
BoxPtr box_array;
|
BoxPtr box_array;
|
||||||
int i, j;
|
int i, j;
|
||||||
glamor_pixmap_private_large_t *priv;
|
glamor_pixmap_private *priv;
|
||||||
|
|
||||||
priv = &pixmap_priv->large;
|
priv = pixmap_priv;
|
||||||
|
|
||||||
block_wcnt = (w + block_w - 1) / block_w;
|
block_wcnt = (w + block_w - 1) / block_w;
|
||||||
block_hcnt = (h + block_h - 1) / block_h;
|
block_hcnt = (h + block_h - 1) / block_h;
|
||||||
|
@ -407,7 +407,7 @@ _glamor_create_fbo_array(glamor_screen_private *glamor_priv,
|
||||||
format,
|
format,
|
||||||
GLAMOR_CREATE_PIXMAP_FIXUP);
|
GLAMOR_CREATE_PIXMAP_FIXUP);
|
||||||
else
|
else
|
||||||
fbo_array[i * block_wcnt + j] = priv->base.fbo;
|
fbo_array[i * block_wcnt + j] = priv->fbo;
|
||||||
if (fbo_array[i * block_wcnt + j] == NULL)
|
if (fbo_array[i * block_wcnt + j] == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
@ -437,8 +437,8 @@ glamor_create_fbo_array(glamor_screen_private *glamor_priv,
|
||||||
int block_w, int block_h,
|
int block_w, int block_h,
|
||||||
glamor_pixmap_private *pixmap_priv)
|
glamor_pixmap_private *pixmap_priv)
|
||||||
{
|
{
|
||||||
pixmap_priv->large.block_w = block_w;
|
pixmap_priv->block_w = block_w;
|
||||||
pixmap_priv->large.block_h = block_h;
|
pixmap_priv->block_h = block_h;
|
||||||
return _glamor_create_fbo_array(glamor_priv, w, h, format, flag,
|
return _glamor_create_fbo_array(glamor_priv, w, h, format, flag,
|
||||||
block_w, block_h, pixmap_priv, 0);
|
block_w, block_h, pixmap_priv, 0);
|
||||||
}
|
}
|
||||||
|
@ -451,11 +451,11 @@ glamor_pixmap_detach_fbo(glamor_pixmap_private *pixmap_priv)
|
||||||
if (pixmap_priv == NULL)
|
if (pixmap_priv == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
fbo = pixmap_priv->base.fbo;
|
fbo = pixmap_priv->fbo;
|
||||||
if (fbo == NULL)
|
if (fbo == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
pixmap_priv->base.fbo = NULL;
|
pixmap_priv->fbo = NULL;
|
||||||
return fbo;
|
return fbo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -467,21 +467,21 @@ glamor_pixmap_attach_fbo(PixmapPtr pixmap, glamor_pixmap_fbo *fbo)
|
||||||
|
|
||||||
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||||
|
|
||||||
if (pixmap_priv->base.fbo)
|
if (pixmap_priv->fbo)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pixmap_priv->base.fbo = fbo;
|
pixmap_priv->fbo = fbo;
|
||||||
|
|
||||||
switch (pixmap_priv->type) {
|
switch (pixmap_priv->type) {
|
||||||
case GLAMOR_TEXTURE_LARGE:
|
case GLAMOR_TEXTURE_LARGE:
|
||||||
case GLAMOR_TEXTURE_ONLY:
|
case GLAMOR_TEXTURE_ONLY:
|
||||||
case GLAMOR_TEXTURE_DRM:
|
case GLAMOR_TEXTURE_DRM:
|
||||||
pixmap_priv->base.gl_fbo = GLAMOR_FBO_NORMAL;
|
pixmap_priv->gl_fbo = GLAMOR_FBO_NORMAL;
|
||||||
if (fbo->tex != 0)
|
if (fbo->tex != 0)
|
||||||
pixmap_priv->base.gl_tex = 1;
|
pixmap_priv->gl_tex = 1;
|
||||||
else {
|
else {
|
||||||
/* XXX For the Xephyr only, may be broken now. */
|
/* XXX For the Xephyr only, may be broken now. */
|
||||||
pixmap_priv->base.gl_tex = 0;
|
pixmap_priv->gl_tex = 0;
|
||||||
}
|
}
|
||||||
pixmap->devPrivate.ptr = NULL;
|
pixmap->devPrivate.ptr = NULL;
|
||||||
break;
|
break;
|
||||||
|
@ -498,7 +498,7 @@ glamor_pixmap_destroy_fbo(glamor_screen_private *glamor_priv,
|
||||||
|
|
||||||
if (priv->type == GLAMOR_TEXTURE_LARGE) {
|
if (priv->type == GLAMOR_TEXTURE_LARGE) {
|
||||||
int i;
|
int i;
|
||||||
glamor_pixmap_private_large_t *large = &priv->large;
|
glamor_pixmap_private *large = priv;
|
||||||
|
|
||||||
for (i = 0; i < large->block_wcnt * large->block_hcnt; i++)
|
for (i = 0; i < large->block_wcnt * large->block_hcnt; i++)
|
||||||
glamor_destroy_fbo(glamor_priv, large->fbo_array[i]);
|
glamor_destroy_fbo(glamor_priv, large->fbo_array[i]);
|
||||||
|
@ -520,7 +520,7 @@ glamor_pixmap_ensure_fbo(PixmapPtr pixmap, GLenum format, int flag)
|
||||||
|
|
||||||
glamor_priv = glamor_get_screen_private(pixmap->drawable.pScreen);
|
glamor_priv = glamor_get_screen_private(pixmap->drawable.pScreen);
|
||||||
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||||
if (pixmap_priv->base.fbo == NULL) {
|
if (pixmap_priv->fbo == NULL) {
|
||||||
|
|
||||||
fbo = glamor_create_fbo(glamor_priv, pixmap->drawable.width,
|
fbo = glamor_create_fbo(glamor_priv, pixmap->drawable.width,
|
||||||
pixmap->drawable.height, format, flag);
|
pixmap->drawable.height, format, flag);
|
||||||
|
@ -531,13 +531,13 @@ glamor_pixmap_ensure_fbo(PixmapPtr pixmap, GLenum format, int flag)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* We do have a fbo, but it may lack of fb or tex. */
|
/* We do have a fbo, but it may lack of fb or tex. */
|
||||||
if (!pixmap_priv->base.fbo->tex)
|
if (!pixmap_priv->fbo->tex)
|
||||||
pixmap_priv->base.fbo->tex =
|
pixmap_priv->fbo->tex =
|
||||||
_glamor_create_tex(glamor_priv, pixmap->drawable.width,
|
_glamor_create_tex(glamor_priv, pixmap->drawable.width,
|
||||||
pixmap->drawable.height, format);
|
pixmap->drawable.height, format);
|
||||||
|
|
||||||
if (flag != GLAMOR_CREATE_FBO_NO_FBO && pixmap_priv->base.fbo->fb == 0)
|
if (flag != GLAMOR_CREATE_FBO_NO_FBO && pixmap_priv->fbo->fb == 0)
|
||||||
if (glamor_pixmap_ensure_fb(glamor_priv, pixmap_priv->base.fbo) != 0)
|
if (glamor_pixmap_ensure_fb(glamor_priv, pixmap_priv->fbo) != 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -552,7 +552,7 @@ glamor_pixmap_exchange_fbos(PixmapPtr front, PixmapPtr back)
|
||||||
|
|
||||||
front_priv = glamor_get_pixmap_private(front);
|
front_priv = glamor_get_pixmap_private(front);
|
||||||
back_priv = glamor_get_pixmap_private(back);
|
back_priv = glamor_get_pixmap_private(back);
|
||||||
temp_fbo = front_priv->base.fbo;
|
temp_fbo = front_priv->fbo;
|
||||||
front_priv->base.fbo = back_priv->base.fbo;
|
front_priv->fbo = back_priv->fbo;
|
||||||
back_priv->base.fbo = temp_fbo;
|
back_priv->fbo = temp_fbo;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
#include "glamor_priv.h"
|
#include "glamor_priv.h"
|
||||||
|
|
||||||
static inline glamor_pixmap_private_large_t *
|
static inline glamor_pixmap_private *
|
||||||
__glamor_large(glamor_pixmap_private *pixmap_priv) {
|
__glamor_large(glamor_pixmap_private *pixmap_priv) {
|
||||||
assert(pixmap_priv->type == GLAMOR_TEXTURE_LARGE);
|
assert(pixmap_priv->type == GLAMOR_TEXTURE_LARGE);
|
||||||
return &pixmap_priv->large;
|
return pixmap_priv;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -185,7 +185,7 @@ glamor_compute_clipped_regions_ext(PixmapPtr pixmap,
|
||||||
small_box.y2 = block_h;
|
small_box.y2 = block_h;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
glamor_pixmap_private_large_t *priv = __glamor_large(pixmap_priv);
|
glamor_pixmap_private *priv = __glamor_large(pixmap_priv);
|
||||||
|
|
||||||
clipped_regions = __glamor_compute_clipped_regions(priv->block_w,
|
clipped_regions = __glamor_compute_clipped_regions(priv->block_w,
|
||||||
priv->block_h,
|
priv->block_h,
|
||||||
|
@ -352,7 +352,7 @@ _glamor_compute_clipped_regions(PixmapPtr pixmap,
|
||||||
int right_shift = 0;
|
int right_shift = 0;
|
||||||
int down_shift = 0;
|
int down_shift = 0;
|
||||||
int x_center_shift = 0, y_center_shift = 0;
|
int x_center_shift = 0, y_center_shift = 0;
|
||||||
glamor_pixmap_private_large_t *priv;
|
glamor_pixmap_private *priv;
|
||||||
|
|
||||||
DEBUGRegionPrint(region);
|
DEBUGRegionPrint(region);
|
||||||
if (pixmap_priv->type != GLAMOR_TEXTURE_LARGE) {
|
if (pixmap_priv->type != GLAMOR_TEXTURE_LARGE) {
|
||||||
|
@ -763,7 +763,7 @@ glamor_merge_clipped_regions(PixmapPtr pixmap,
|
||||||
int overlap;
|
int overlap;
|
||||||
int i;
|
int i;
|
||||||
int pixmap_width, pixmap_height;
|
int pixmap_width, pixmap_height;
|
||||||
glamor_pixmap_private_large_t *priv;
|
glamor_pixmap_private *priv;
|
||||||
|
|
||||||
priv = __glamor_large(pixmap_priv);
|
priv = __glamor_large(pixmap_priv);
|
||||||
pixmap_width = pixmap->drawable.width;
|
pixmap_width = pixmap->drawable.width;
|
||||||
|
@ -858,7 +858,7 @@ glamor_merge_clipped_regions(PixmapPtr pixmap,
|
||||||
RegionDestroy(clipped_regions[i].region);
|
RegionDestroy(clipped_regions[i].region);
|
||||||
RegionDestroy(temp_region);
|
RegionDestroy(temp_region);
|
||||||
priv->box = temp_box;
|
priv->box = temp_box;
|
||||||
priv->base.fbo = glamor_pixmap_detach_fbo(temp_priv);
|
priv->fbo = glamor_pixmap_detach_fbo(temp_priv);
|
||||||
DEBUGF("priv box x1 %d y1 %d x2 %d y2 %d \n",
|
DEBUGF("priv box x1 %d y1 %d x2 %d y2 %d \n",
|
||||||
priv->box.x1, priv->box.y1, priv->box.x2, priv->box.y2);
|
priv->box.x1, priv->box.y1, priv->box.x2, priv->box.y2);
|
||||||
glamor_destroy_pixmap(temp_pixmap);
|
glamor_destroy_pixmap(temp_pixmap);
|
||||||
|
@ -1335,8 +1335,8 @@ glamor_composite_largepixmap_region(CARD8 op,
|
||||||
null_mask = 0;
|
null_mask = 0;
|
||||||
if (need_clean_mask_fbo) {
|
if (need_clean_mask_fbo) {
|
||||||
assert(is_normal_mask_fbo == 0);
|
assert(is_normal_mask_fbo == 0);
|
||||||
glamor_destroy_fbo(glamor_priv, mask_pixmap_priv->base.fbo);
|
glamor_destroy_fbo(glamor_priv, mask_pixmap_priv->fbo);
|
||||||
mask_pixmap_priv->base.fbo = NULL;
|
mask_pixmap_priv->fbo = NULL;
|
||||||
need_clean_mask_fbo = 0;
|
need_clean_mask_fbo = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1364,8 +1364,8 @@ glamor_composite_largepixmap_region(CARD8 op,
|
||||||
null_source = 0;
|
null_source = 0;
|
||||||
if (need_clean_source_fbo) {
|
if (need_clean_source_fbo) {
|
||||||
assert(is_normal_source_fbo == 0);
|
assert(is_normal_source_fbo == 0);
|
||||||
glamor_destroy_fbo(glamor_priv, source_pixmap_priv->base.fbo);
|
glamor_destroy_fbo(glamor_priv, source_pixmap_priv->fbo);
|
||||||
source_pixmap_priv->base.fbo = NULL;
|
source_pixmap_priv->fbo = NULL;
|
||||||
need_clean_source_fbo = 0;
|
need_clean_source_fbo = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1426,8 +1426,8 @@ glamor_composite_largepixmap_region(CARD8 op,
|
||||||
if (null_mask)
|
if (null_mask)
|
||||||
null_mask = 0;
|
null_mask = 0;
|
||||||
if (need_clean_mask_fbo) {
|
if (need_clean_mask_fbo) {
|
||||||
glamor_destroy_fbo(glamor_priv, mask_pixmap_priv->base.fbo);
|
glamor_destroy_fbo(glamor_priv, mask_pixmap_priv->fbo);
|
||||||
mask_pixmap_priv->base.fbo = NULL;
|
mask_pixmap_priv->fbo = NULL;
|
||||||
need_clean_mask_fbo = 0;
|
need_clean_mask_fbo = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,8 +70,8 @@ glamor_create_picture(PicturePtr picture)
|
||||||
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
pixmap_priv->base.is_picture = 1;
|
pixmap_priv->is_picture = 1;
|
||||||
pixmap_priv->base.picture = picture;
|
pixmap_priv->picture = picture;
|
||||||
|
|
||||||
return miCreatePicture(picture);
|
return miCreatePicture(picture);
|
||||||
}
|
}
|
||||||
|
@ -89,8 +89,8 @@ glamor_destroy_picture(PicturePtr picture)
|
||||||
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||||
|
|
||||||
if (pixmap_priv) {
|
if (pixmap_priv) {
|
||||||
pixmap_priv->base.is_picture = 0;
|
pixmap_priv->is_picture = 0;
|
||||||
pixmap_priv->base.picture = NULL;
|
pixmap_priv->picture = NULL;
|
||||||
}
|
}
|
||||||
miDestroyPicture(picture);
|
miDestroyPicture(picture);
|
||||||
}
|
}
|
||||||
|
@ -99,5 +99,5 @@ void
|
||||||
glamor_picture_format_fixup(PicturePtr picture,
|
glamor_picture_format_fixup(PicturePtr picture,
|
||||||
glamor_pixmap_private *pixmap_priv)
|
glamor_pixmap_private *pixmap_priv)
|
||||||
{
|
{
|
||||||
pixmap_priv->base.picture = picture;
|
pixmap_priv->picture = picture;
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ glamor_set_destination_pixmap_priv_nc(glamor_screen_private *glamor_priv,
|
||||||
int w, h;
|
int w, h;
|
||||||
|
|
||||||
PIXMAP_PRIV_GET_ACTUAL_SIZE(pixmap, pixmap_priv, w, h);
|
PIXMAP_PRIV_GET_ACTUAL_SIZE(pixmap, pixmap_priv, w, h);
|
||||||
glamor_set_destination_pixmap_fbo(glamor_priv, pixmap_priv->base.fbo, 0, 0, w, h);
|
glamor_set_destination_pixmap_fbo(glamor_priv, pixmap_priv->fbo, 0, 0, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -478,7 +478,7 @@ glamor_get_tex_format_type_from_pixmap(PixmapPtr pixmap,
|
||||||
|
|
||||||
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||||
if (GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv))
|
if (GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv))
|
||||||
pict_format = pixmap_priv->base.picture->format;
|
pict_format = pixmap_priv->picture->format;
|
||||||
else
|
else
|
||||||
pict_format = format_for_depth(pixmap->drawable.depth);
|
pict_format = format_for_depth(pixmap->drawable.depth);
|
||||||
|
|
||||||
|
@ -804,13 +804,13 @@ _glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, GLenum format,
|
||||||
) {
|
) {
|
||||||
int fbo_x_off, fbo_y_off;
|
int fbo_x_off, fbo_y_off;
|
||||||
|
|
||||||
assert(pixmap_priv->base.fbo->tex);
|
assert(pixmap_priv->fbo->tex);
|
||||||
pixmap_priv_get_fbo_off(pixmap_priv, &fbo_x_off, &fbo_y_off);
|
pixmap_priv_get_fbo_off(pixmap_priv, &fbo_x_off, &fbo_y_off);
|
||||||
|
|
||||||
assert(x + fbo_x_off >= 0 && y + fbo_y_off >= 0);
|
assert(x + fbo_x_off >= 0 && y + fbo_y_off >= 0);
|
||||||
assert(x + fbo_x_off + w <= pixmap_priv->base.fbo->width);
|
assert(x + fbo_x_off + w <= pixmap_priv->fbo->width);
|
||||||
assert(y + fbo_y_off + h <= pixmap_priv->base.fbo->height);
|
assert(y + fbo_y_off + h <= pixmap_priv->fbo->height);
|
||||||
__glamor_upload_pixmap_to_texture(pixmap, &pixmap_priv->base.fbo->tex,
|
__glamor_upload_pixmap_to_texture(pixmap, &pixmap_priv->fbo->tex,
|
||||||
format, type,
|
format, type,
|
||||||
x + fbo_x_off, y + fbo_y_off, w, h,
|
x + fbo_x_off, y + fbo_y_off, w, h,
|
||||||
bits, pbo);
|
bits, pbo);
|
||||||
|
@ -874,17 +874,17 @@ glamor_pixmap_upload_prepare(PixmapPtr pixmap, GLenum format, int no_alpha,
|
||||||
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||||
glamor_priv = glamor_get_screen_private(pixmap->drawable.pScreen);
|
glamor_priv = glamor_get_screen_private(pixmap->drawable.pScreen);
|
||||||
|
|
||||||
if (pixmap_priv->base.gl_fbo != GLAMOR_FBO_UNATTACHED)
|
if (pixmap_priv->gl_fbo != GLAMOR_FBO_UNATTACHED)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (pixmap_priv->base.fbo
|
if (pixmap_priv->fbo
|
||||||
&& (pixmap_priv->base.fbo->width < pixmap->drawable.width
|
&& (pixmap_priv->fbo->width < pixmap->drawable.width
|
||||||
|| pixmap_priv->base.fbo->height < pixmap->drawable.height)) {
|
|| pixmap_priv->fbo->height < pixmap->drawable.height)) {
|
||||||
fbo = glamor_pixmap_detach_fbo(pixmap_priv);
|
fbo = glamor_pixmap_detach_fbo(pixmap_priv);
|
||||||
glamor_destroy_fbo(glamor_priv, fbo);
|
glamor_destroy_fbo(glamor_priv, fbo);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pixmap_priv->base.fbo && pixmap_priv->base.fbo->fb)
|
if (pixmap_priv->fbo && pixmap_priv->fbo->fb)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!(no_alpha || (revert == REVERT_NORMAL)
|
if (!(no_alpha || (revert == REVERT_NORMAL)
|
||||||
|
@ -895,8 +895,8 @@ glamor_pixmap_upload_prepare(PixmapPtr pixmap, GLenum format, int no_alpha,
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((flag == GLAMOR_CREATE_FBO_NO_FBO
|
if ((flag == GLAMOR_CREATE_FBO_NO_FBO
|
||||||
&& pixmap_priv->base.fbo && pixmap_priv->base.fbo->tex)
|
&& pixmap_priv->fbo && pixmap_priv->fbo->tex)
|
||||||
|| (flag == 0 && pixmap_priv->base.fbo && pixmap_priv->base.fbo->fb))
|
|| (flag == 0 && pixmap_priv->fbo && pixmap_priv->fbo->fb))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP)
|
if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP)
|
||||||
|
@ -980,8 +980,8 @@ glamor_upload_sub_pixmap_to_texture(PixmapPtr pixmap, int x, int y, int w,
|
||||||
clipped_regions =
|
clipped_regions =
|
||||||
glamor_compute_clipped_regions_ext(pixmap, ®ion,
|
glamor_compute_clipped_regions_ext(pixmap, ®ion,
|
||||||
&n_region,
|
&n_region,
|
||||||
pixmap_priv->large.block_w,
|
pixmap_priv->block_w,
|
||||||
pixmap_priv->large.block_h,
|
pixmap_priv->block_h,
|
||||||
0,
|
0,
|
||||||
0);
|
0);
|
||||||
DEBUGF("prepare upload %dx%d to a large pixmap %p\n", w, h, pixmap);
|
DEBUGF("prepare upload %dx%d to a large pixmap %p\n", w, h, pixmap);
|
||||||
|
@ -1052,10 +1052,10 @@ glamor_upload_pixmap_to_texture(PixmapPtr pixmap)
|
||||||
|
|
||||||
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||||
|
|
||||||
if ((pixmap_priv->base.fbo)
|
if ((pixmap_priv->fbo)
|
||||||
&& (pixmap_priv->base.fbo->pbo_valid)) {
|
&& (pixmap_priv->fbo->pbo_valid)) {
|
||||||
data = NULL;
|
data = NULL;
|
||||||
pbo = pixmap_priv->base.fbo->pbo;
|
pbo = pixmap_priv->fbo->pbo;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
data = pixmap->devPrivate.ptr;
|
data = pixmap->devPrivate.ptr;
|
||||||
|
@ -1126,7 +1126,7 @@ glamor_es2_pixmap_read_prepare(PixmapPtr source, int x, int y, int w, int h,
|
||||||
glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
|
glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
glBindTexture(GL_TEXTURE_2D, source_priv->base.fbo->tex);
|
glBindTexture(GL_TEXTURE_2D, source_priv->fbo->tex);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ glamor_prep_pixmap_box(PixmapPtr pixmap, glamor_access_t access, BoxPtr box)
|
||||||
* we'll assume that it's directly mapped
|
* we'll assume that it's directly mapped
|
||||||
* by a lower level driver
|
* by a lower level driver
|
||||||
*/
|
*/
|
||||||
if (!priv->base.prepared)
|
if (!priv->prepared)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
/* In X, multiple Drawables can be stored in the same Pixmap (such as
|
/* In X, multiple Drawables can be stored in the same Pixmap (such as
|
||||||
|
@ -65,28 +65,28 @@ glamor_prep_pixmap_box(PixmapPtr pixmap, glamor_access_t access, BoxPtr box)
|
||||||
* As a result, when doing a series of mappings for a fallback, we may
|
* As a result, when doing a series of mappings for a fallback, we may
|
||||||
* need to add more boxes to the set of data we've downloaded, as we go.
|
* need to add more boxes to the set of data we've downloaded, as we go.
|
||||||
*/
|
*/
|
||||||
RegionSubtract(®ion, ®ion, &priv->base.prepare_region);
|
RegionSubtract(®ion, ®ion, &priv->prepare_region);
|
||||||
if (!RegionNotEmpty(®ion))
|
if (!RegionNotEmpty(®ion))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if (access == GLAMOR_ACCESS_RW)
|
if (access == GLAMOR_ACCESS_RW)
|
||||||
FatalError("attempt to remap buffer as writable");
|
FatalError("attempt to remap buffer as writable");
|
||||||
|
|
||||||
if (priv->base.pbo) {
|
if (priv->pbo) {
|
||||||
glBindBuffer(GL_PIXEL_PACK_BUFFER, priv->base.pbo);
|
glBindBuffer(GL_PIXEL_PACK_BUFFER, priv->pbo);
|
||||||
glUnmapBuffer(GL_PIXEL_PACK_BUFFER);
|
glUnmapBuffer(GL_PIXEL_PACK_BUFFER);
|
||||||
pixmap->devPrivate.ptr = NULL;
|
pixmap->devPrivate.ptr = NULL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
RegionInit(&priv->base.prepare_region, box, 1);
|
RegionInit(&priv->prepare_region, box, 1);
|
||||||
|
|
||||||
if (glamor_priv->has_rw_pbo) {
|
if (glamor_priv->has_rw_pbo) {
|
||||||
if (priv->base.pbo == 0)
|
if (priv->pbo == 0)
|
||||||
glGenBuffers(1, &priv->base.pbo);
|
glGenBuffers(1, &priv->pbo);
|
||||||
|
|
||||||
gl_usage = GL_STREAM_READ;
|
gl_usage = GL_STREAM_READ;
|
||||||
|
|
||||||
glBindBuffer(GL_PIXEL_PACK_BUFFER, priv->base.pbo);
|
glBindBuffer(GL_PIXEL_PACK_BUFFER, priv->pbo);
|
||||||
glBufferData(GL_PIXEL_PACK_BUFFER,
|
glBufferData(GL_PIXEL_PACK_BUFFER,
|
||||||
pixmap->devKind * pixmap->drawable.height, NULL,
|
pixmap->devKind * pixmap->drawable.height, NULL,
|
||||||
gl_usage);
|
gl_usage);
|
||||||
|
@ -96,7 +96,7 @@ glamor_prep_pixmap_box(PixmapPtr pixmap, glamor_access_t access, BoxPtr box)
|
||||||
if (!pixmap->devPrivate.ptr)
|
if (!pixmap->devPrivate.ptr)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
priv->base.map_access = access;
|
priv->map_access = access;
|
||||||
}
|
}
|
||||||
|
|
||||||
glamor_download_boxes(pixmap, RegionRects(®ion), RegionNumRects(®ion),
|
glamor_download_boxes(pixmap, RegionRects(®ion), RegionNumRects(®ion),
|
||||||
|
@ -105,7 +105,7 @@ glamor_prep_pixmap_box(PixmapPtr pixmap, glamor_access_t access, BoxPtr box)
|
||||||
RegionUninit(®ion);
|
RegionUninit(®ion);
|
||||||
|
|
||||||
if (glamor_priv->has_rw_pbo) {
|
if (glamor_priv->has_rw_pbo) {
|
||||||
if (priv->base.map_access == GLAMOR_ACCESS_RW)
|
if (priv->map_access == GLAMOR_ACCESS_RW)
|
||||||
gl_access = GL_READ_WRITE;
|
gl_access = GL_READ_WRITE;
|
||||||
else
|
else
|
||||||
gl_access = GL_READ_ONLY;
|
gl_access = GL_READ_ONLY;
|
||||||
|
@ -114,7 +114,7 @@ glamor_prep_pixmap_box(PixmapPtr pixmap, glamor_access_t access, BoxPtr box)
|
||||||
glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
|
glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->base.prepared = TRUE;
|
priv->prepared = TRUE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,34 +133,34 @@ glamor_fini_pixmap(PixmapPtr pixmap)
|
||||||
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(priv))
|
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(priv))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!priv->base.prepared)
|
if (!priv->prepared)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (glamor_priv->has_rw_pbo) {
|
if (glamor_priv->has_rw_pbo) {
|
||||||
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, priv->base.pbo);
|
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, priv->pbo);
|
||||||
glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER);
|
glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER);
|
||||||
pixmap->devPrivate.ptr = NULL;
|
pixmap->devPrivate.ptr = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->base.map_access == GLAMOR_ACCESS_RW) {
|
if (priv->map_access == GLAMOR_ACCESS_RW) {
|
||||||
glamor_upload_boxes(pixmap,
|
glamor_upload_boxes(pixmap,
|
||||||
RegionRects(&priv->base.prepare_region),
|
RegionRects(&priv->prepare_region),
|
||||||
RegionNumRects(&priv->base.prepare_region),
|
RegionNumRects(&priv->prepare_region),
|
||||||
0, 0, 0, 0, pixmap->devPrivate.ptr, pixmap->devKind);
|
0, 0, 0, 0, pixmap->devPrivate.ptr, pixmap->devKind);
|
||||||
}
|
}
|
||||||
|
|
||||||
RegionUninit(&priv->base.prepare_region);
|
RegionUninit(&priv->prepare_region);
|
||||||
|
|
||||||
if (glamor_priv->has_rw_pbo) {
|
if (glamor_priv->has_rw_pbo) {
|
||||||
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
||||||
glDeleteBuffers(1, &priv->base.pbo);
|
glDeleteBuffers(1, &priv->pbo);
|
||||||
priv->base.pbo = 0;
|
priv->pbo = 0;
|
||||||
} else {
|
} else {
|
||||||
free(pixmap->devPrivate.ptr);
|
free(pixmap->devPrivate.ptr);
|
||||||
pixmap->devPrivate.ptr = NULL;
|
pixmap->devPrivate.ptr = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->base.prepared = FALSE;
|
priv->prepared = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
|
|
|
@ -377,6 +377,14 @@ typedef struct glamor_pixmap_fbo {
|
||||||
* @is_picture: The drawable is attached to a picture.
|
* @is_picture: The drawable is attached to a picture.
|
||||||
* @pict_format: the corresponding picture's format.
|
* @pict_format: the corresponding picture's format.
|
||||||
* @pixmap: The corresponding pixmap's pointer.
|
* @pixmap: The corresponding pixmap's pointer.
|
||||||
|
* @box: current fbo's coords in the whole pixmap.
|
||||||
|
* @block_w: block width of this large pixmap.
|
||||||
|
* @block_h: block height of this large pixmap.
|
||||||
|
* @block_wcnt: block count in one block row.
|
||||||
|
* @block_hcnt: block count in one block column.
|
||||||
|
* @nbox: total block count.
|
||||||
|
* @box_array: contains each block's corresponding box.
|
||||||
|
* @fbo_array: contains each block's fbo pointer.
|
||||||
*
|
*
|
||||||
* For GLAMOR_TEXTURE_LARGE, nbox should larger than 1.
|
* For GLAMOR_TEXTURE_LARGE, nbox should larger than 1.
|
||||||
* And the box and fbo will both have nbox elements.
|
* And the box and fbo will both have nbox elements.
|
||||||
|
@ -426,9 +434,6 @@ typedef struct glamor_pixmap_fbo {
|
||||||
* to the box and fbo elements. Thus the inner routines
|
* to the box and fbo elements. Thus the inner routines
|
||||||
* can handle it as normal, only the coords calculation need
|
* can handle it as normal, only the coords calculation need
|
||||||
* to aware of it's large pixmap.
|
* to aware of it's large pixmap.
|
||||||
*
|
|
||||||
* Currently, we haven't implemented the atlas pixmap.
|
|
||||||
*
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
typedef struct glamor_pixmap_clipped_regions {
|
typedef struct glamor_pixmap_clipped_regions {
|
||||||
|
@ -436,7 +441,7 @@ typedef struct glamor_pixmap_clipped_regions {
|
||||||
RegionPtr region;
|
RegionPtr region;
|
||||||
} glamor_pixmap_clipped_regions;
|
} glamor_pixmap_clipped_regions;
|
||||||
|
|
||||||
typedef struct glamor_pixmap_private_base {
|
typedef struct glamor_pixmap_private {
|
||||||
glamor_pixmap_type_t type;
|
glamor_pixmap_type_t type;
|
||||||
enum glamor_fbo_state gl_fbo;
|
enum glamor_fbo_state gl_fbo;
|
||||||
/**
|
/**
|
||||||
|
@ -457,26 +462,6 @@ typedef struct glamor_pixmap_private_base {
|
||||||
#if GLAMOR_HAS_GBM
|
#if GLAMOR_HAS_GBM
|
||||||
EGLImageKHR image;
|
EGLImageKHR image;
|
||||||
#endif
|
#endif
|
||||||
} glamor_pixmap_private_base_t;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @base.fbo: current fbo.
|
|
||||||
* @box: current fbo's coords in the whole pixmap.
|
|
||||||
* @block_w: block width of this large pixmap.
|
|
||||||
* @block_h: block height of this large pixmap.
|
|
||||||
* @block_wcnt: block count in one block row.
|
|
||||||
* @block_hcnt: block count in one block column.
|
|
||||||
* @nbox: total block count.
|
|
||||||
* @box_array: contains each block's corresponding box.
|
|
||||||
* @fbo_array: contains each block's fbo pointer.
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
typedef struct glamor_pixmap_private_large {
|
|
||||||
union {
|
|
||||||
glamor_pixmap_type_t type;
|
|
||||||
glamor_pixmap_private_base_t base;
|
|
||||||
};
|
|
||||||
BoxRec box;
|
|
||||||
int block_w;
|
int block_w;
|
||||||
int block_h;
|
int block_h;
|
||||||
int block_wcnt;
|
int block_wcnt;
|
||||||
|
@ -484,22 +469,19 @@ typedef struct glamor_pixmap_private_large {
|
||||||
int nbox;
|
int nbox;
|
||||||
BoxPtr box_array;
|
BoxPtr box_array;
|
||||||
glamor_pixmap_fbo **fbo_array;
|
glamor_pixmap_fbo **fbo_array;
|
||||||
} glamor_pixmap_private_large_t;
|
|
||||||
|
|
||||||
typedef struct glamor_pixmap_private {
|
|
||||||
union {
|
|
||||||
glamor_pixmap_type_t type;
|
|
||||||
glamor_pixmap_private_base_t base;
|
|
||||||
glamor_pixmap_private_large_t large;
|
|
||||||
};
|
|
||||||
} glamor_pixmap_private;
|
} glamor_pixmap_private;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @base.fbo: current fbo.
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
glamor_set_pixmap_fbo_current(glamor_pixmap_private *priv, int idx)
|
glamor_set_pixmap_fbo_current(glamor_pixmap_private *priv, int idx)
|
||||||
{
|
{
|
||||||
if (priv->type == GLAMOR_TEXTURE_LARGE) {
|
if (priv->type == GLAMOR_TEXTURE_LARGE) {
|
||||||
priv->large.base.fbo = priv->large.fbo_array[idx];
|
priv->fbo = priv->fbo_array[idx];
|
||||||
priv->large.box = priv->large.box_array[idx];
|
priv->box = priv->box_array[idx];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -507,33 +489,33 @@ static inline glamor_pixmap_fbo *
|
||||||
glamor_pixmap_fbo_at(glamor_pixmap_private *priv, int x, int y)
|
glamor_pixmap_fbo_at(glamor_pixmap_private *priv, int x, int y)
|
||||||
{
|
{
|
||||||
if (priv->type == GLAMOR_TEXTURE_LARGE) {
|
if (priv->type == GLAMOR_TEXTURE_LARGE) {
|
||||||
assert(x < priv->large.block_wcnt);
|
assert(x < priv->block_wcnt);
|
||||||
assert(y < priv->large.block_hcnt);
|
assert(y < priv->block_hcnt);
|
||||||
return priv->large.fbo_array[y * priv->large.block_wcnt + x];
|
return priv->fbo_array[y * priv->block_wcnt + x];
|
||||||
}
|
}
|
||||||
assert (x == 0);
|
assert (x == 0);
|
||||||
assert (y == 0);
|
assert (y == 0);
|
||||||
return priv->base.fbo;
|
return priv->fbo;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline BoxPtr
|
static inline BoxPtr
|
||||||
glamor_pixmap_box_at(glamor_pixmap_private *priv, int x, int y)
|
glamor_pixmap_box_at(glamor_pixmap_private *priv, int x, int y)
|
||||||
{
|
{
|
||||||
if (priv->type == GLAMOR_TEXTURE_LARGE) {
|
if (priv->type == GLAMOR_TEXTURE_LARGE) {
|
||||||
assert(x < priv->large.block_wcnt);
|
assert(x < priv->block_wcnt);
|
||||||
assert(y < priv->large.block_hcnt);
|
assert(y < priv->block_hcnt);
|
||||||
return &priv->large.box_array[y * priv->large.block_wcnt + x];
|
return &priv->box_array[y * priv->block_wcnt + x];
|
||||||
}
|
}
|
||||||
assert (x == 0);
|
assert (x == 0);
|
||||||
assert (y == 0);
|
assert (y == 0);
|
||||||
return &priv->base.box;
|
return &priv->box;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
glamor_pixmap_wcnt(glamor_pixmap_private *priv)
|
glamor_pixmap_wcnt(glamor_pixmap_private *priv)
|
||||||
{
|
{
|
||||||
if (priv->type == GLAMOR_TEXTURE_LARGE)
|
if (priv->type == GLAMOR_TEXTURE_LARGE)
|
||||||
return priv->large.block_wcnt;
|
return priv->block_wcnt;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -541,7 +523,7 @@ static inline int
|
||||||
glamor_pixmap_hcnt(glamor_pixmap_private *priv)
|
glamor_pixmap_hcnt(glamor_pixmap_private *priv)
|
||||||
{
|
{
|
||||||
if (priv->type == GLAMOR_TEXTURE_LARGE)
|
if (priv->type == GLAMOR_TEXTURE_LARGE)
|
||||||
return priv->large.block_hcnt;
|
return priv->block_hcnt;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -615,7 +597,7 @@ glamor_pixmap_drm_only(PixmapPtr pixmap)
|
||||||
{
|
{
|
||||||
glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap);
|
glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap);
|
||||||
|
|
||||||
return priv && priv->base.type == GLAMOR_DRM_ONLY;
|
return priv && priv->type == GLAMOR_DRM_ONLY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -626,7 +608,7 @@ glamor_pixmap_is_memory(PixmapPtr pixmap)
|
||||||
{
|
{
|
||||||
glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap);
|
glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap);
|
||||||
|
|
||||||
return !priv || priv->base.type == GLAMOR_TEXTURE_LARGE;
|
return !priv || priv->type == GLAMOR_TEXTURE_LARGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -637,7 +619,7 @@ glamor_pixmap_is_large(PixmapPtr pixmap)
|
||||||
{
|
{
|
||||||
glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap);
|
glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap);
|
||||||
|
|
||||||
return priv && priv->base.type == GLAMOR_TEXTURE_LARGE;
|
return priv && priv->type == GLAMOR_TEXTURE_LARGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -648,7 +630,7 @@ glamor_pixmap_has_fbo(PixmapPtr pixmap)
|
||||||
{
|
{
|
||||||
glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap);
|
glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap);
|
||||||
|
|
||||||
return priv && priv->base.gl_fbo == GLAMOR_FBO_NORMAL;
|
return priv && priv->gl_fbo == GLAMOR_FBO_NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void glamor_set_pixmap_private(PixmapPtr pixmap, glamor_pixmap_private *priv);
|
void glamor_set_pixmap_private(PixmapPtr pixmap, glamor_pixmap_private *priv);
|
||||||
|
|
|
@ -491,7 +491,7 @@ glamor_set_composite_texture(glamor_screen_private *glamor_priv, int unit,
|
||||||
|
|
||||||
glamor_make_current(glamor_priv);
|
glamor_make_current(glamor_priv);
|
||||||
glActiveTexture(GL_TEXTURE0 + unit);
|
glActiveTexture(GL_TEXTURE0 + unit);
|
||||||
glBindTexture(GL_TEXTURE_2D, pixmap_priv->base.fbo->tex);
|
glBindTexture(GL_TEXTURE_2D, pixmap_priv->fbo->tex);
|
||||||
repeat_type = picture->repeatType;
|
repeat_type = picture->repeatType;
|
||||||
switch (picture->repeatType) {
|
switch (picture->repeatType) {
|
||||||
case RepeatNone:
|
case RepeatNone:
|
||||||
|
@ -933,7 +933,7 @@ glamor_composite_choose_shader(CARD8 op,
|
||||||
* Does it need special handle? */
|
* Does it need special handle? */
|
||||||
glamor_fallback("source == dest\n");
|
glamor_fallback("source == dest\n");
|
||||||
}
|
}
|
||||||
if (source_pixmap_priv->base.gl_fbo == GLAMOR_FBO_UNATTACHED) {
|
if (source_pixmap_priv->gl_fbo == GLAMOR_FBO_UNATTACHED) {
|
||||||
#ifdef GLAMOR_PIXMAP_DYNAMIC_UPLOAD
|
#ifdef GLAMOR_PIXMAP_DYNAMIC_UPLOAD
|
||||||
source_status = GLAMOR_UPLOAD_PENDING;
|
source_status = GLAMOR_UPLOAD_PENDING;
|
||||||
#else
|
#else
|
||||||
|
@ -949,7 +949,7 @@ glamor_composite_choose_shader(CARD8 op,
|
||||||
glamor_fallback("mask == dest\n");
|
glamor_fallback("mask == dest\n");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
if (mask_pixmap_priv->base.gl_fbo == GLAMOR_FBO_UNATTACHED) {
|
if (mask_pixmap_priv->gl_fbo == GLAMOR_FBO_UNATTACHED) {
|
||||||
#ifdef GLAMOR_PIXMAP_DYNAMIC_UPLOAD
|
#ifdef GLAMOR_PIXMAP_DYNAMIC_UPLOAD
|
||||||
mask_status = GLAMOR_UPLOAD_PENDING;
|
mask_status = GLAMOR_UPLOAD_PENDING;
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -173,7 +173,7 @@ glamor_set_texture(PixmapPtr pixmap,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
glBindTexture(GL_TEXTURE_2D, texture_priv->base.fbo->tex);
|
glBindTexture(GL_TEXTURE_2D, texture_priv->fbo->tex);
|
||||||
|
|
||||||
glUniform2f(offset_uniform, off_x, off_y);
|
glUniform2f(offset_uniform, off_x, off_y);
|
||||||
glUniform2f(size_uniform, texture->drawable.width, texture->drawable.height);
|
glUniform2f(size_uniform, texture->drawable.width, texture->drawable.height);
|
||||||
|
|
|
@ -51,15 +51,15 @@
|
||||||
|
|
||||||
#define pixmap_priv_get_scale(_pixmap_priv_, _pxscale_, _pyscale_) \
|
#define pixmap_priv_get_scale(_pixmap_priv_, _pxscale_, _pyscale_) \
|
||||||
do { \
|
do { \
|
||||||
*(_pxscale_) = 1.0 / (_pixmap_priv_)->base.fbo->width; \
|
*(_pxscale_) = 1.0 / (_pixmap_priv_)->fbo->width; \
|
||||||
*(_pyscale_) = 1.0 / (_pixmap_priv_)->base.fbo->height; \
|
*(_pyscale_) = 1.0 / (_pixmap_priv_)->fbo->height; \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
#define PIXMAP_PRIV_GET_ACTUAL_SIZE(pixmap, priv, w, h) \
|
#define PIXMAP_PRIV_GET_ACTUAL_SIZE(pixmap, priv, w, h) \
|
||||||
do { \
|
do { \
|
||||||
if (_X_UNLIKELY(priv->type == GLAMOR_TEXTURE_LARGE)) { \
|
if (_X_UNLIKELY(priv->type == GLAMOR_TEXTURE_LARGE)) { \
|
||||||
w = priv->large.box.x2 - priv->large.box.x1; \
|
w = priv->box.x2 - priv->box.x1; \
|
||||||
h = priv->large.box.y2 - priv->large.box.y1; \
|
h = priv->box.y2 - priv->box.y1; \
|
||||||
} else { \
|
} else { \
|
||||||
w = (pixmap)->drawable.width; \
|
w = (pixmap)->drawable.width; \
|
||||||
h = (pixmap)->drawable.height; \
|
h = (pixmap)->drawable.height; \
|
||||||
|
@ -70,17 +70,17 @@
|
||||||
do { \
|
do { \
|
||||||
int actual_w, actual_h; \
|
int actual_w, actual_h; \
|
||||||
PIXMAP_PRIV_GET_ACTUAL_SIZE(pixmap, priv, actual_w, actual_h); \
|
PIXMAP_PRIV_GET_ACTUAL_SIZE(pixmap, priv, actual_w, actual_h); \
|
||||||
wh[0] = (float)priv->base.fbo->width / actual_w; \
|
wh[0] = (float)priv->fbo->width / actual_w; \
|
||||||
wh[1] = (float)priv->base.fbo->height / actual_h; \
|
wh[1] = (float)priv->fbo->height / actual_h; \
|
||||||
wh[2] = 1.0 / priv->base.fbo->width; \
|
wh[2] = 1.0 / priv->fbo->width; \
|
||||||
wh[3] = 1.0 / priv->base.fbo->height; \
|
wh[3] = 1.0 / priv->fbo->height; \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
#define pixmap_priv_get_fbo_off(_priv_, _xoff_, _yoff_) \
|
#define pixmap_priv_get_fbo_off(_priv_, _xoff_, _yoff_) \
|
||||||
do { \
|
do { \
|
||||||
if (_X_UNLIKELY(_priv_ && (_priv_)->type == GLAMOR_TEXTURE_LARGE)) { \
|
if (_X_UNLIKELY(_priv_ && (_priv_)->type == GLAMOR_TEXTURE_LARGE)) { \
|
||||||
*(_xoff_) = - (_priv_)->large.box.x1; \
|
*(_xoff_) = - (_priv_)->box.x1; \
|
||||||
*(_yoff_) = - (_priv_)->large.box.y1; \
|
*(_yoff_) = - (_priv_)->box.y1; \
|
||||||
} else { \
|
} else { \
|
||||||
*(_xoff_) = 0; \
|
*(_xoff_) = 0; \
|
||||||
*(_yoff_) = 0; \
|
*(_yoff_) = 0; \
|
||||||
|
@ -204,9 +204,9 @@
|
||||||
DEBUGF("c %f d %f oddx %d oddy %d \n", \
|
DEBUGF("c %f d %f oddx %d oddy %d \n", \
|
||||||
c, d, odd_x, odd_y); \
|
c, d, odd_x, odd_y); \
|
||||||
DEBUGF("x2 %d x1 %d fbo->width %d \n", priv->box.x2, \
|
DEBUGF("x2 %d x1 %d fbo->width %d \n", priv->box.x2, \
|
||||||
priv->box.x1, priv->base.fbo->width); \
|
priv->box.x1, priv->fbo->width); \
|
||||||
DEBUGF("y2 %d y1 %d fbo->height %d \n", priv->box.y2, \
|
DEBUGF("y2 %d y1 %d fbo->height %d \n", priv->box.y2, \
|
||||||
priv->box.y1, priv->base.fbo->height); \
|
priv->box.y1, priv->fbo->height); \
|
||||||
_glamor_repeat_reflect_fixup(tx1, _x1_, c, odd_x, \
|
_glamor_repeat_reflect_fixup(tx1, _x1_, c, odd_x, \
|
||||||
(pixmap)->drawable.width, \
|
(pixmap)->drawable.width, \
|
||||||
priv->box.x1, priv->box.x2); \
|
priv->box.x1, priv->box.x2); \
|
||||||
|
@ -425,16 +425,16 @@
|
||||||
glamor_transform_point(matrix, tx4, ty4, _x1_, _y2_); \
|
glamor_transform_point(matrix, tx4, ty4, _x1_, _y2_); \
|
||||||
DEBUGF("transformed %f %f %f %f %f %f %f %f\n", \
|
DEBUGF("transformed %f %f %f %f %f %f %f %f\n", \
|
||||||
tx1, ty1, tx2, ty2, tx3, ty3, tx4, ty4); \
|
tx1, ty1, tx2, ty2, tx3, ty3, tx4, ty4); \
|
||||||
glamor_get_repeat_transform_coords(pixmap, (&priv->large), repeat_type, \
|
glamor_get_repeat_transform_coords(pixmap, priv, repeat_type, \
|
||||||
ttx1, tty1, \
|
ttx1, tty1, \
|
||||||
tx1, ty1); \
|
tx1, ty1); \
|
||||||
glamor_get_repeat_transform_coords(pixmap, (&priv->large), repeat_type, \
|
glamor_get_repeat_transform_coords(pixmap, priv, repeat_type, \
|
||||||
ttx2, tty2, \
|
ttx2, tty2, \
|
||||||
tx2, ty2); \
|
tx2, ty2); \
|
||||||
glamor_get_repeat_transform_coords(pixmap, (&priv->large), repeat_type, \
|
glamor_get_repeat_transform_coords(pixmap, priv, repeat_type, \
|
||||||
ttx3, tty3, \
|
ttx3, tty3, \
|
||||||
tx3, ty3); \
|
tx3, ty3); \
|
||||||
glamor_get_repeat_transform_coords(pixmap, (&priv->large), repeat_type, \
|
glamor_get_repeat_transform_coords(pixmap, priv, repeat_type, \
|
||||||
ttx4, tty4, \
|
ttx4, tty4, \
|
||||||
tx4, ty4); \
|
tx4, ty4); \
|
||||||
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, \
|
||||||
|
@ -526,12 +526,12 @@
|
||||||
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; \
|
||||||
if (repeat_type == RepeatPad) { \
|
if (repeat_type == RepeatPad) { \
|
||||||
tx1 = _x1_ - priv->large.box.x1; \
|
tx1 = _x1_ - priv->box.x1; \
|
||||||
ty1 = _y1_ - priv->large.box.y1; \
|
ty1 = _y1_ - priv->box.y1; \
|
||||||
tx2 = tx1 + ((_x2_) - (_x1_)); \
|
tx2 = tx1 + ((_x2_) - (_x1_)); \
|
||||||
ty2 = ty1 + ((_y2_) - (_y1_)); \
|
ty2 = ty1 + ((_y2_) - (_y1_)); \
|
||||||
} else { \
|
} else { \
|
||||||
glamor_get_repeat_coords(pixmap, (&priv->large), repeat_type, \
|
glamor_get_repeat_coords(pixmap, priv, repeat_type, \
|
||||||
tx1, ty1, tx2, ty2, \
|
tx1, ty1, tx2, ty2, \
|
||||||
_x1_, _y1_, _x2_, _y2_); \
|
_x1_, _y1_, _x2_, _y2_); \
|
||||||
} \
|
} \
|
||||||
|
@ -756,9 +756,9 @@ glamor_translate_boxes(BoxPtr boxes, int nbox, int dx, int dy)
|
||||||
|| _depth_ == 30 \
|
|| _depth_ == 30 \
|
||||||
|| _depth_ == 32)
|
|| _depth_ == 32)
|
||||||
|
|
||||||
#define GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv) (pixmap_priv && pixmap_priv->base.is_picture == 1)
|
#define GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv) (pixmap_priv && pixmap_priv->is_picture == 1)
|
||||||
#define GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv) (pixmap_priv && pixmap_priv->base.gl_fbo == GLAMOR_FBO_NORMAL)
|
#define GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv) (pixmap_priv && pixmap_priv->gl_fbo == GLAMOR_FBO_NORMAL)
|
||||||
#define GLAMOR_PIXMAP_PRIV_HAS_FBO_DOWNLOADED(pixmap_priv) (pixmap_priv && (pixmap_priv->base.gl_fbo == GLAMOR_FBO_DOWNLOADED))
|
#define GLAMOR_PIXMAP_PRIV_HAS_FBO_DOWNLOADED(pixmap_priv) (pixmap_priv && (pixmap_priv->gl_fbo == GLAMOR_FBO_DOWNLOADED))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Borrow from uxa.
|
* Borrow from uxa.
|
||||||
|
@ -811,7 +811,7 @@ format_for_pixmap(PixmapPtr pixmap)
|
||||||
|
|
||||||
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||||
if (GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv))
|
if (GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv))
|
||||||
pict_format = pixmap_priv->base.picture->format;
|
pict_format = pixmap_priv->picture->format;
|
||||||
else
|
else
|
||||||
pict_format = format_for_depth((pixmap)->drawable.depth);
|
pict_format = format_for_depth((pixmap)->drawable.depth);
|
||||||
|
|
||||||
|
|
|
@ -79,16 +79,16 @@ glamor_set_window_pixmap(WindowPtr win, PixmapPtr pPixmap)
|
||||||
|
|
||||||
pixmap_priv = glamor_get_pixmap_private(old);
|
pixmap_priv = glamor_get_pixmap_private(old);
|
||||||
if (GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv) &&
|
if (GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv) &&
|
||||||
pixmap_priv->base.picture->pDrawable == (DrawablePtr) win) {
|
pixmap_priv->picture->pDrawable == (DrawablePtr) win) {
|
||||||
pic = pixmap_priv->base.picture;
|
pic = pixmap_priv->picture;
|
||||||
pixmap_priv->base.is_picture = 0;
|
pixmap_priv->is_picture = 0;
|
||||||
pixmap_priv->base.picture = NULL;
|
pixmap_priv->picture = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pixmap_priv = glamor_get_pixmap_private(pPixmap);
|
pixmap_priv = glamor_get_pixmap_private(pPixmap);
|
||||||
if (pixmap_priv) {
|
if (pixmap_priv) {
|
||||||
pixmap_priv->base.is_picture = ! !pic;
|
pixmap_priv->is_picture = ! !pic;
|
||||||
pixmap_priv->base.picture = pic;
|
pixmap_priv->picture = pic;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -306,21 +306,21 @@ glamor_xv_render(glamor_port_private *port_priv)
|
||||||
glUniform4f(uloc, vco[0], vco[1], vco[2], 0);
|
glUniform4f(uloc, vco[0], vco[1], vco[2], 0);
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
glBindTexture(GL_TEXTURE_2D, src_pixmap_priv[0]->base.fbo->tex);
|
glBindTexture(GL_TEXTURE_2D, src_pixmap_priv[0]->fbo->tex);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE1);
|
glActiveTexture(GL_TEXTURE1);
|
||||||
glBindTexture(GL_TEXTURE_2D, src_pixmap_priv[1]->base.fbo->tex);
|
glBindTexture(GL_TEXTURE_2D, src_pixmap_priv[1]->fbo->tex);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE2);
|
glActiveTexture(GL_TEXTURE2);
|
||||||
glBindTexture(GL_TEXTURE_2D, src_pixmap_priv[2]->base.fbo->tex);
|
glBindTexture(GL_TEXTURE_2D, src_pixmap_priv[2]->fbo->tex);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||||
|
|
Loading…
Reference in New Issue