glamor: Remove screen private and pixmap ptrs from pixmap private and fbo
There's no reason to waste memory storing redundant copies of the same pointer all over the system; just pass in pointers as necessary to each function. 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
1eb954c383
commit
af687396f1
|
@ -64,16 +64,12 @@ _X_EXPORT void
|
||||||
glamor_set_pixmap_type(PixmapPtr pixmap, glamor_pixmap_type_t type)
|
glamor_set_pixmap_type(PixmapPtr pixmap, glamor_pixmap_type_t type)
|
||||||
{
|
{
|
||||||
glamor_pixmap_private *pixmap_priv;
|
glamor_pixmap_private *pixmap_priv;
|
||||||
glamor_screen_private *glamor_priv =
|
|
||||||
glamor_get_screen_private(pixmap->drawable.pScreen);
|
|
||||||
|
|
||||||
pixmap_priv = dixLookupPrivate(&pixmap->devPrivates,
|
pixmap_priv = dixLookupPrivate(&pixmap->devPrivates,
|
||||||
&glamor_pixmap_private_key);
|
&glamor_pixmap_private_key);
|
||||||
if (pixmap_priv == NULL) {
|
if (pixmap_priv == NULL) {
|
||||||
pixmap_priv = calloc(sizeof(*pixmap_priv), 1);
|
pixmap_priv = calloc(sizeof(*pixmap_priv), 1);
|
||||||
glamor_set_pixmap_private(pixmap, pixmap_priv);
|
glamor_set_pixmap_private(pixmap, pixmap_priv);
|
||||||
pixmap_priv->base.pixmap = pixmap;
|
|
||||||
pixmap_priv->base.glamor_priv = glamor_priv;
|
|
||||||
}
|
}
|
||||||
pixmap_priv->type = type;
|
pixmap_priv->type = type;
|
||||||
pixmap_priv->base.box.x1 = 0;
|
pixmap_priv->base.box.x1 = 0;
|
||||||
|
@ -96,7 +92,7 @@ glamor_set_pixmap_texture(PixmapPtr pixmap, unsigned int tex)
|
||||||
|
|
||||||
if (pixmap_priv->base.fbo) {
|
if (pixmap_priv->base.fbo) {
|
||||||
fbo = glamor_pixmap_detach_fbo(pixmap_priv);
|
fbo = glamor_pixmap_detach_fbo(pixmap_priv);
|
||||||
glamor_destroy_fbo(fbo);
|
glamor_destroy_fbo(glamor_priv, fbo);
|
||||||
}
|
}
|
||||||
|
|
||||||
format = gl_iformat_for_pixmap(pixmap);
|
format = gl_iformat_for_pixmap(pixmap);
|
||||||
|
@ -170,9 +166,6 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
|
||||||
}
|
}
|
||||||
glamor_set_pixmap_private(pixmap, pixmap_priv);
|
glamor_set_pixmap_private(pixmap, pixmap_priv);
|
||||||
|
|
||||||
pixmap_priv->base.pixmap = pixmap;
|
|
||||||
pixmap_priv->base.glamor_priv = glamor_priv;
|
|
||||||
|
|
||||||
format = gl_iformat_for_pixmap(pixmap);
|
format = gl_iformat_for_pixmap(pixmap);
|
||||||
|
|
||||||
pitch = (((w * pixmap->drawable.bitsPerPixel + 7) / 8) + 3) & ~3;
|
pitch = (((w * pixmap->drawable.bitsPerPixel + 7) / 8) + 3) & ~3;
|
||||||
|
@ -557,8 +550,8 @@ glamor_set_pixmap_private(PixmapPtr pixmap, glamor_pixmap_private *priv)
|
||||||
else {
|
else {
|
||||||
if (old_priv == NULL)
|
if (old_priv == NULL)
|
||||||
return;
|
return;
|
||||||
|
glamor_pixmap_destroy_fbo(glamor_get_screen_private(pixmap->drawable.pScreen),
|
||||||
glamor_pixmap_destroy_fbo(old_priv);
|
old_priv);
|
||||||
free(old_priv);
|
free(old_priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -254,7 +254,7 @@ glamor_composite_rectangles(CARD8 op,
|
||||||
goto done;
|
goto done;
|
||||||
if (glamor_composite_clipped_region(op, source,
|
if (glamor_composite_clipped_region(op, source,
|
||||||
NULL, dst,
|
NULL, dst,
|
||||||
NULL, NULL, priv,
|
NULL, NULL, pixmap,
|
||||||
®ion, 0, 0, 0, 0, 0, 0))
|
®ion, 0, 0, 0, 0, 0, 0))
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,9 +112,10 @@ glamor_pixmap_fbo_cache_get(glamor_screen_private *glamor_priv,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
glamor_purge_fbo(glamor_pixmap_fbo *fbo)
|
glamor_purge_fbo(glamor_screen_private *glamor_priv,
|
||||||
|
glamor_pixmap_fbo *fbo)
|
||||||
{
|
{
|
||||||
glamor_make_current(fbo->glamor_priv);
|
glamor_make_current(glamor_priv);
|
||||||
|
|
||||||
if (fbo->fb)
|
if (fbo->fb)
|
||||||
glDeleteFramebuffers(1, &fbo->fb);
|
glDeleteFramebuffers(1, &fbo->fb);
|
||||||
|
@ -127,7 +128,8 @@ glamor_purge_fbo(glamor_pixmap_fbo *fbo)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
glamor_pixmap_fbo_cache_put(glamor_pixmap_fbo *fbo)
|
glamor_pixmap_fbo_cache_put(glamor_screen_private *glamor_priv,
|
||||||
|
glamor_pixmap_fbo *fbo)
|
||||||
{
|
{
|
||||||
struct xorg_list *cache;
|
struct xorg_list *cache;
|
||||||
int n_format;
|
int n_format;
|
||||||
|
@ -139,32 +141,33 @@ glamor_pixmap_fbo_cache_put(glamor_pixmap_fbo *fbo)
|
||||||
n_format = cache_format(fbo->format);
|
n_format = cache_format(fbo->format);
|
||||||
|
|
||||||
if (fbo->fb == 0 || fbo->external || n_format == -1
|
if (fbo->fb == 0 || fbo->external || n_format == -1
|
||||||
|| fbo->glamor_priv->fbo_cache_watermark >= FBO_CACHE_THRESHOLD) {
|
|| glamor_priv->fbo_cache_watermark >= FBO_CACHE_THRESHOLD) {
|
||||||
fbo->glamor_priv->tick += GLAMOR_CACHE_EXPIRE_MAX;
|
glamor_priv->tick += GLAMOR_CACHE_EXPIRE_MAX;
|
||||||
glamor_fbo_expire(fbo->glamor_priv);
|
glamor_fbo_expire(glamor_priv);
|
||||||
glamor_purge_fbo(fbo);
|
glamor_purge_fbo(glamor_priv, fbo);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cache = &fbo->glamor_priv->fbo_cache[n_format]
|
cache = &glamor_priv->fbo_cache[n_format]
|
||||||
[cache_wbucket(fbo->width)]
|
[cache_wbucket(fbo->width)]
|
||||||
[cache_hbucket(fbo->height)];
|
[cache_hbucket(fbo->height)];
|
||||||
DEBUGF
|
DEBUGF
|
||||||
("Put cache entry %p to cache %p w %d h %d format %x fbo %d tex %d \n",
|
("Put cache entry %p to cache %p w %d h %d format %x fbo %d tex %d \n",
|
||||||
fbo, cache, fbo->width, fbo->height, fbo->format, fbo->fb, fbo->tex);
|
fbo, cache, fbo->width, fbo->height, fbo->format, fbo->fb, fbo->tex);
|
||||||
|
|
||||||
fbo->glamor_priv->fbo_cache_watermark += fbo->width * fbo->height;
|
glamor_priv->fbo_cache_watermark += fbo->width * fbo->height;
|
||||||
xorg_list_add(&fbo->list, cache);
|
xorg_list_add(&fbo->list, cache);
|
||||||
fbo->expire = fbo->glamor_priv->tick + GLAMOR_CACHE_EXPIRE_MAX;
|
fbo->expire = glamor_priv->tick + GLAMOR_CACHE_EXPIRE_MAX;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
glamor_pixmap_ensure_fb(glamor_pixmap_fbo *fbo)
|
glamor_pixmap_ensure_fb(glamor_screen_private *glamor_priv,
|
||||||
|
glamor_pixmap_fbo *fbo)
|
||||||
{
|
{
|
||||||
int status, err = 0;
|
int status, err = 0;
|
||||||
|
|
||||||
glamor_make_current(fbo->glamor_priv);
|
glamor_make_current(glamor_priv);
|
||||||
|
|
||||||
if (fbo->fb == 0)
|
if (fbo->fb == 0)
|
||||||
glGenFramebuffers(1, &fbo->fb);
|
glGenFramebuffers(1, &fbo->fb);
|
||||||
|
@ -224,11 +227,10 @@ glamor_create_fbo_from_tex(glamor_screen_private *glamor_priv,
|
||||||
fbo->height = h;
|
fbo->height = h;
|
||||||
fbo->external = FALSE;
|
fbo->external = FALSE;
|
||||||
fbo->format = format;
|
fbo->format = format;
|
||||||
fbo->glamor_priv = glamor_priv;
|
|
||||||
|
|
||||||
if (flag != GLAMOR_CREATE_FBO_NO_FBO) {
|
if (flag != GLAMOR_CREATE_FBO_NO_FBO) {
|
||||||
if (glamor_pixmap_ensure_fb(fbo) != 0) {
|
if (glamor_pixmap_ensure_fb(glamor_priv, fbo) != 0) {
|
||||||
glamor_purge_fbo(fbo);
|
glamor_purge_fbo(glamor_priv, fbo);
|
||||||
fbo = NULL;
|
fbo = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -258,7 +260,7 @@ glamor_fbo_expire(glamor_screen_private *glamor_priv)
|
||||||
xorg_list_del(&fbo_entry->list);
|
xorg_list_del(&fbo_entry->list);
|
||||||
DEBUGF("cache %p fbo %p expired %d current %d \n", cache,
|
DEBUGF("cache %p fbo %p expired %d current %d \n", cache,
|
||||||
fbo_entry, fbo_entry->expire, glamor_priv->tick);
|
fbo_entry, fbo_entry->expire, glamor_priv->tick);
|
||||||
glamor_purge_fbo(fbo_entry);
|
glamor_purge_fbo(glamor_priv, fbo_entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -295,16 +297,17 @@ glamor_fini_pixmap_fbo(ScreenPtr screen)
|
||||||
xorg_list_for_each_entry_safe_reverse(fbo_entry, tmp, cache,
|
xorg_list_for_each_entry_safe_reverse(fbo_entry, tmp, cache,
|
||||||
list) {
|
list) {
|
||||||
xorg_list_del(&fbo_entry->list);
|
xorg_list_del(&fbo_entry->list);
|
||||||
glamor_purge_fbo(fbo_entry);
|
glamor_purge_fbo(glamor_priv, fbo_entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
glamor_destroy_fbo(glamor_pixmap_fbo *fbo)
|
glamor_destroy_fbo(glamor_screen_private *glamor_priv,
|
||||||
|
glamor_pixmap_fbo *fbo)
|
||||||
{
|
{
|
||||||
xorg_list_del(&fbo->list);
|
xorg_list_del(&fbo->list);
|
||||||
glamor_pixmap_fbo_cache_put(fbo);
|
glamor_pixmap_fbo_cache_put(glamor_priv, fbo);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -420,7 +423,7 @@ _glamor_create_fbo_array(glamor_screen_private *glamor_priv,
|
||||||
cleanup:
|
cleanup:
|
||||||
for (i = 0; i < block_wcnt * block_hcnt; i++)
|
for (i = 0; i < block_wcnt * block_hcnt; i++)
|
||||||
if ((fbo_array)[i])
|
if ((fbo_array)[i])
|
||||||
glamor_destroy_fbo((fbo_array)[i]);
|
glamor_destroy_fbo(glamor_priv, (fbo_array)[i]);
|
||||||
free(box_array);
|
free(box_array);
|
||||||
free(fbo_array);
|
free(fbo_array);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -488,7 +491,8 @@ glamor_pixmap_attach_fbo(PixmapPtr pixmap, glamor_pixmap_fbo *fbo)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
glamor_pixmap_destroy_fbo(glamor_pixmap_private *priv)
|
glamor_pixmap_destroy_fbo(glamor_screen_private *glamor_priv,
|
||||||
|
glamor_pixmap_private *priv)
|
||||||
{
|
{
|
||||||
glamor_pixmap_fbo *fbo;
|
glamor_pixmap_fbo *fbo;
|
||||||
|
|
||||||
|
@ -497,13 +501,13 @@ glamor_pixmap_destroy_fbo(glamor_pixmap_private *priv)
|
||||||
glamor_pixmap_private_large_t *large = &priv->large;
|
glamor_pixmap_private_large_t *large = &priv->large;
|
||||||
|
|
||||||
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(large->fbo_array[i]);
|
glamor_destroy_fbo(glamor_priv, large->fbo_array[i]);
|
||||||
free(large->fbo_array);
|
free(large->fbo_array);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fbo = glamor_pixmap_detach_fbo(priv);
|
fbo = glamor_pixmap_detach_fbo(priv);
|
||||||
if (fbo)
|
if (fbo)
|
||||||
glamor_destroy_fbo(fbo);
|
glamor_destroy_fbo(glamor_priv, fbo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -533,7 +537,7 @@ glamor_pixmap_ensure_fbo(PixmapPtr pixmap, GLenum format, int flag)
|
||||||
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->base.fbo->fb == 0)
|
||||||
if (glamor_pixmap_ensure_fb(pixmap_priv->base.fbo) != 0)
|
if (glamor_pixmap_ensure_fb(glamor_priv, pixmap_priv->base.fbo) != 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -682,9 +682,9 @@ _glamor_gradient_set_pixmap_destination(ScreenPtr screen,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
glamor_set_destination_pixmap_priv_nc(pixmap_priv);
|
glamor_set_destination_pixmap_priv_nc(glamor_priv, pixmap, pixmap_priv);
|
||||||
|
|
||||||
pixmap_priv_get_dest_scale(pixmap_priv, xscale, yscale);
|
pixmap_priv_get_dest_scale(pixmap, pixmap_priv, xscale, yscale);
|
||||||
|
|
||||||
DEBUGF("xscale = %f, yscale = %f,"
|
DEBUGF("xscale = %f, yscale = %f,"
|
||||||
" x_source = %d, y_source = %d, width = %d, height = %d\n",
|
" x_source = %d, y_source = %d, width = %d, height = %d\n",
|
||||||
|
|
|
@ -150,12 +150,13 @@ __glamor_compute_clipped_regions(int block_w,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
glamor_pixmap_clipped_regions *
|
glamor_pixmap_clipped_regions *
|
||||||
glamor_compute_clipped_regions_ext(glamor_pixmap_private *pixmap_priv,
|
glamor_compute_clipped_regions_ext(PixmapPtr pixmap,
|
||||||
RegionPtr region,
|
RegionPtr region,
|
||||||
int *n_region,
|
int *n_region,
|
||||||
int inner_block_w, int inner_block_h,
|
int inner_block_w, int inner_block_h,
|
||||||
int reverse, int upsidedown)
|
int reverse, int upsidedown)
|
||||||
{
|
{
|
||||||
|
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||||
glamor_pixmap_clipped_regions *clipped_regions, *inner_regions,
|
glamor_pixmap_clipped_regions *clipped_regions, *inner_regions,
|
||||||
*result_regions;
|
*result_regions;
|
||||||
int i, j, x, y, k, inner_n_regions;
|
int i, j, x, y, k, inner_n_regions;
|
||||||
|
@ -176,8 +177,8 @@ glamor_compute_clipped_regions_ext(glamor_pixmap_private *pixmap_priv,
|
||||||
clipped_regions[0].block_idx = 0;
|
clipped_regions[0].block_idx = 0;
|
||||||
RegionCopy(clipped_regions[0].region, region);
|
RegionCopy(clipped_regions[0].region, region);
|
||||||
*n_region = 1;
|
*n_region = 1;
|
||||||
block_w = pixmap_priv->base.pixmap->drawable.width;
|
block_w = pixmap->drawable.width;
|
||||||
block_h = pixmap_priv->base.pixmap->drawable.height;
|
block_h = pixmap->drawable.height;
|
||||||
box_array = &small_box;
|
box_array = &small_box;
|
||||||
small_box.x1 = small_box.y1 = 0;
|
small_box.x1 = small_box.y1 = 0;
|
||||||
small_box.x2 = block_w;
|
small_box.x2 = block_w;
|
||||||
|
@ -190,10 +191,8 @@ glamor_compute_clipped_regions_ext(glamor_pixmap_private *pixmap_priv,
|
||||||
priv->block_h,
|
priv->block_h,
|
||||||
priv->block_wcnt,
|
priv->block_wcnt,
|
||||||
0, 0,
|
0, 0,
|
||||||
priv->base.pixmap->
|
pixmap->drawable.width,
|
||||||
drawable.width,
|
pixmap->drawable.height,
|
||||||
priv->base.pixmap->
|
|
||||||
drawable.height,
|
|
||||||
region, n_region,
|
region, n_region,
|
||||||
reverse, upsidedown);
|
reverse, upsidedown);
|
||||||
|
|
||||||
|
@ -336,7 +335,8 @@ _glamor_largepixmap_reflect_fixup(short *xy1, short *xy2, int wh)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static glamor_pixmap_clipped_regions *
|
static glamor_pixmap_clipped_regions *
|
||||||
_glamor_compute_clipped_regions(glamor_pixmap_private *pixmap_priv,
|
_glamor_compute_clipped_regions(PixmapPtr pixmap,
|
||||||
|
glamor_pixmap_private *pixmap_priv,
|
||||||
RegionPtr region, int *n_region,
|
RegionPtr region, int *n_region,
|
||||||
int repeat_type, int is_transform,
|
int repeat_type, int is_transform,
|
||||||
int reverse, int upsidedown)
|
int reverse, int upsidedown)
|
||||||
|
@ -366,8 +366,8 @@ _glamor_compute_clipped_regions(glamor_pixmap_private *pixmap_priv,
|
||||||
|
|
||||||
priv = __glamor_large(pixmap_priv);
|
priv = __glamor_large(pixmap_priv);
|
||||||
|
|
||||||
pixmap_width = priv->base.pixmap->drawable.width;
|
pixmap_width = pixmap->drawable.width;
|
||||||
pixmap_height = priv->base.pixmap->drawable.height;
|
pixmap_height = pixmap->drawable.height;
|
||||||
if (repeat_type == 0 || repeat_type == RepeatPad) {
|
if (repeat_type == 0 || repeat_type == RepeatPad) {
|
||||||
RegionPtr saved_region = NULL;
|
RegionPtr saved_region = NULL;
|
||||||
|
|
||||||
|
@ -385,10 +385,8 @@ _glamor_compute_clipped_regions(glamor_pixmap_private *pixmap_priv,
|
||||||
priv->block_h,
|
priv->block_h,
|
||||||
priv->block_wcnt,
|
priv->block_wcnt,
|
||||||
0, 0,
|
0, 0,
|
||||||
priv->base.pixmap->
|
pixmap->drawable.width,
|
||||||
drawable.width,
|
pixmap->drawable.height,
|
||||||
priv->base.pixmap->
|
|
||||||
drawable.height,
|
|
||||||
region, n_region,
|
region, n_region,
|
||||||
reverse, upsidedown);
|
reverse, upsidedown);
|
||||||
if (saved_region)
|
if (saved_region)
|
||||||
|
@ -670,11 +668,13 @@ _glamor_compute_clipped_regions(glamor_pixmap_private *pixmap_priv,
|
||||||
}
|
}
|
||||||
|
|
||||||
glamor_pixmap_clipped_regions *
|
glamor_pixmap_clipped_regions *
|
||||||
glamor_compute_clipped_regions(glamor_pixmap_private *priv, RegionPtr region,
|
glamor_compute_clipped_regions(PixmapPtr pixmap,
|
||||||
|
RegionPtr region,
|
||||||
int *n_region, int repeat_type,
|
int *n_region, int repeat_type,
|
||||||
int reverse, int upsidedown)
|
int reverse, int upsidedown)
|
||||||
{
|
{
|
||||||
return _glamor_compute_clipped_regions(priv, region, n_region, repeat_type,
|
glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap);
|
||||||
|
return _glamor_compute_clipped_regions(pixmap, priv, region, n_region, repeat_type,
|
||||||
0, reverse, upsidedown);
|
0, reverse, upsidedown);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -682,12 +682,13 @@ glamor_compute_clipped_regions(glamor_pixmap_private *priv, RegionPtr region,
|
||||||
* by default. Or just use region32 for repeat cases?
|
* by default. Or just use region32 for repeat cases?
|
||||||
**/
|
**/
|
||||||
glamor_pixmap_clipped_regions *
|
glamor_pixmap_clipped_regions *
|
||||||
glamor_compute_transform_clipped_regions(glamor_pixmap_private *priv,
|
glamor_compute_transform_clipped_regions(PixmapPtr pixmap,
|
||||||
struct pixman_transform *transform,
|
struct pixman_transform *transform,
|
||||||
RegionPtr region, int *n_region,
|
RegionPtr region, int *n_region,
|
||||||
int dx, int dy, int repeat_type,
|
int dx, int dy, int repeat_type,
|
||||||
int reverse, int upsidedown)
|
int reverse, int upsidedown)
|
||||||
{
|
{
|
||||||
|
glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap);
|
||||||
BoxPtr temp_extent;
|
BoxPtr temp_extent;
|
||||||
struct pixman_box32 temp_box;
|
struct pixman_box32 temp_box;
|
||||||
struct pixman_box16 short_box;
|
struct pixman_box16 short_box;
|
||||||
|
@ -714,8 +715,8 @@ glamor_compute_transform_clipped_regions(glamor_pixmap_private *priv,
|
||||||
temp_box.x1 = 0;
|
temp_box.x1 = 0;
|
||||||
if (temp_box.y1 < 0)
|
if (temp_box.y1 < 0)
|
||||||
temp_box.y1 = 0;
|
temp_box.y1 = 0;
|
||||||
temp_box.x2 = MIN(temp_box.x2, priv->base.pixmap->drawable.width);
|
temp_box.x2 = MIN(temp_box.x2, pixmap->drawable.width);
|
||||||
temp_box.y2 = MIN(temp_box.y2, priv->base.pixmap->drawable.height);
|
temp_box.y2 = MIN(temp_box.y2, pixmap->drawable.height);
|
||||||
}
|
}
|
||||||
/* Now copy back the box32 to a box16 box. */
|
/* Now copy back the box32 to a box16 box. */
|
||||||
short_box.x1 = temp_box.x1;
|
short_box.x1 = temp_box.x1;
|
||||||
|
@ -725,7 +726,8 @@ glamor_compute_transform_clipped_regions(glamor_pixmap_private *priv,
|
||||||
RegionInitBoxes(temp_region, &short_box, 1);
|
RegionInitBoxes(temp_region, &short_box, 1);
|
||||||
DEBUGF("copy to temp source region \n");
|
DEBUGF("copy to temp source region \n");
|
||||||
DEBUGRegionPrint(temp_region);
|
DEBUGRegionPrint(temp_region);
|
||||||
ret = _glamor_compute_clipped_regions(priv,
|
ret = _glamor_compute_clipped_regions(pixmap,
|
||||||
|
priv,
|
||||||
temp_region,
|
temp_region,
|
||||||
n_region,
|
n_region,
|
||||||
repeat_type, 1, reverse, upsidedown);
|
repeat_type, 1, reverse, upsidedown);
|
||||||
|
@ -747,7 +749,8 @@ glamor_compute_transform_clipped_regions(glamor_pixmap_private *priv,
|
||||||
* if the clipped result cross the region boundary.
|
* if the clipped result cross the region boundary.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
glamor_merge_clipped_regions(glamor_pixmap_private *pixmap_priv,
|
glamor_merge_clipped_regions(PixmapPtr pixmap,
|
||||||
|
glamor_pixmap_private *pixmap_priv,
|
||||||
int repeat_type,
|
int repeat_type,
|
||||||
glamor_pixmap_clipped_regions *clipped_regions,
|
glamor_pixmap_clipped_regions *clipped_regions,
|
||||||
int *n_regions, int *need_clean_fbo)
|
int *n_regions, int *need_clean_fbo)
|
||||||
|
@ -763,8 +766,8 @@ glamor_merge_clipped_regions(glamor_pixmap_private *pixmap_priv,
|
||||||
glamor_pixmap_private_large_t *priv;
|
glamor_pixmap_private_large_t *priv;
|
||||||
|
|
||||||
priv = __glamor_large(pixmap_priv);
|
priv = __glamor_large(pixmap_priv);
|
||||||
pixmap_width = priv->base.pixmap->drawable.width;
|
pixmap_width = pixmap->drawable.width;
|
||||||
pixmap_height = priv->base.pixmap->drawable.height;
|
pixmap_height =pixmap->drawable.height;
|
||||||
|
|
||||||
temp_region = RegionCreate(NULL, 4);
|
temp_region = RegionCreate(NULL, 4);
|
||||||
for (i = 0; i < *n_regions; i++) {
|
for (i = 0; i < *n_regions; i++) {
|
||||||
|
@ -784,10 +787,10 @@ glamor_merge_clipped_regions(glamor_pixmap_private *pixmap_priv,
|
||||||
DEBUGF("%d %d %d %d \n", temp_box.x1, temp_box.y1, temp_box.x2,
|
DEBUGF("%d %d %d %d \n", temp_box.x1, temp_box.y1, temp_box.x2,
|
||||||
temp_box.y2);
|
temp_box.y2);
|
||||||
temp_pixmap =
|
temp_pixmap =
|
||||||
glamor_create_pixmap(priv->base.pixmap->drawable.pScreen,
|
glamor_create_pixmap(pixmap->drawable.pScreen,
|
||||||
temp_box.x2 - temp_box.x1,
|
temp_box.x2 - temp_box.x1,
|
||||||
temp_box.y2 - temp_box.y1,
|
temp_box.y2 - temp_box.y1,
|
||||||
priv->base.pixmap->drawable.depth,
|
pixmap->drawable.depth,
|
||||||
GLAMOR_CREATE_PIXMAP_FIXUP);
|
GLAMOR_CREATE_PIXMAP_FIXUP);
|
||||||
if (temp_pixmap == NULL) {
|
if (temp_pixmap == NULL) {
|
||||||
assert(0);
|
assert(0);
|
||||||
|
@ -808,7 +811,7 @@ glamor_merge_clipped_regions(glamor_pixmap_private *pixmap_priv,
|
||||||
copy_box.y2 = temp_extent->y2 - temp_extent->y1;
|
copy_box.y2 = temp_extent->y2 - temp_extent->y1;
|
||||||
dx = temp_extent->x1;
|
dx = temp_extent->x1;
|
||||||
dy = temp_extent->y1;
|
dy = temp_extent->y1;
|
||||||
glamor_copy(&priv->base.pixmap->drawable,
|
glamor_copy(&pixmap->drawable,
|
||||||
&temp_pixmap->drawable,
|
&temp_pixmap->drawable,
|
||||||
NULL, ©_box, 1, dx, dy, 0, 0, 0, NULL);
|
NULL, ©_box, 1, dx, dy, 0, 0, 0, NULL);
|
||||||
// glamor_solid(temp_pixmap, 0, 0, temp_pixmap->drawable.width,
|
// glamor_solid(temp_pixmap, 0, 0, temp_pixmap->drawable.width,
|
||||||
|
@ -840,7 +843,7 @@ glamor_merge_clipped_regions(glamor_pixmap_private *pixmap_priv,
|
||||||
copy_box.x1, copy_box.y1, copy_box.x2,
|
copy_box.x1, copy_box.y1, copy_box.x2,
|
||||||
copy_box.y2, dx, dy);
|
copy_box.y2, dx, dy);
|
||||||
|
|
||||||
glamor_copy(&priv->base.pixmap->drawable,
|
glamor_copy(&pixmap->drawable,
|
||||||
&temp_pixmap->drawable,
|
&temp_pixmap->drawable,
|
||||||
NULL, ©_box, 1, dx, dy, 0, 0, 0, NULL);
|
NULL, ©_box, 1, dx, dy, 0, 0, 0, NULL);
|
||||||
|
|
||||||
|
@ -966,7 +969,8 @@ glamor_get_transform_extent_from_box(struct pixman_box32 *box,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_glamor_process_transformed_clipped_region(glamor_pixmap_private *priv,
|
_glamor_process_transformed_clipped_region(PixmapPtr pixmap,
|
||||||
|
glamor_pixmap_private *priv,
|
||||||
int repeat_type,
|
int repeat_type,
|
||||||
glamor_pixmap_clipped_regions *
|
glamor_pixmap_clipped_regions *
|
||||||
clipped_regions, int *n_regions,
|
clipped_regions, int *n_regions,
|
||||||
|
@ -976,7 +980,7 @@ _glamor_process_transformed_clipped_region(glamor_pixmap_private *priv,
|
||||||
|
|
||||||
if (*n_regions != 1) {
|
if (*n_regions != 1) {
|
||||||
/* Merge all source regions into one region. */
|
/* Merge all source regions into one region. */
|
||||||
glamor_merge_clipped_regions(priv, repeat_type,
|
glamor_merge_clipped_regions(pixmap, priv, repeat_type,
|
||||||
clipped_regions, n_regions,
|
clipped_regions, n_regions,
|
||||||
need_clean_fbo);
|
need_clean_fbo);
|
||||||
}
|
}
|
||||||
|
@ -990,22 +994,22 @@ _glamor_process_transformed_clipped_region(glamor_pixmap_private *priv,
|
||||||
int rem;
|
int rem;
|
||||||
|
|
||||||
temp_box = RegionExtents(clipped_regions[0].region);
|
temp_box = RegionExtents(clipped_regions[0].region);
|
||||||
modulus(temp_box->x1, priv->base.pixmap->drawable.width, rem);
|
modulus(temp_box->x1, pixmap->drawable.width, rem);
|
||||||
shift_x = (temp_box->x1 - rem) / priv->base.pixmap->drawable.width;
|
shift_x = (temp_box->x1 - rem) / pixmap->drawable.width;
|
||||||
modulus(temp_box->y1, priv->base.pixmap->drawable.height, rem);
|
modulus(temp_box->y1, pixmap->drawable.height, rem);
|
||||||
shift_y = (temp_box->y1 - rem) / priv->base.pixmap->drawable.height;
|
shift_y = (temp_box->y1 - rem) / pixmap->drawable.height;
|
||||||
|
|
||||||
if (shift_x != 0) {
|
if (shift_x != 0) {
|
||||||
__glamor_large(priv)->box.x1 +=
|
__glamor_large(priv)->box.x1 +=
|
||||||
shift_x * priv->base.pixmap->drawable.width;
|
shift_x * pixmap->drawable.width;
|
||||||
__glamor_large(priv)->box.x2 +=
|
__glamor_large(priv)->box.x2 +=
|
||||||
shift_x * priv->base.pixmap->drawable.width;
|
shift_x * pixmap->drawable.width;
|
||||||
}
|
}
|
||||||
if (shift_y != 0) {
|
if (shift_y != 0) {
|
||||||
__glamor_large(priv)->box.y1 +=
|
__glamor_large(priv)->box.y1 +=
|
||||||
shift_y * priv->base.pixmap->drawable.height;
|
shift_y * pixmap->drawable.height;
|
||||||
__glamor_large(priv)->box.y2 +=
|
__glamor_large(priv)->box.y2 +=
|
||||||
shift_y * priv->base.pixmap->drawable.height;
|
shift_y * pixmap->drawable.height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1016,9 +1020,9 @@ glamor_composite_largepixmap_region(CARD8 op,
|
||||||
PicturePtr source,
|
PicturePtr source,
|
||||||
PicturePtr mask,
|
PicturePtr mask,
|
||||||
PicturePtr dest,
|
PicturePtr dest,
|
||||||
glamor_pixmap_private *source_pixmap_priv,
|
PixmapPtr source_pixmap,
|
||||||
glamor_pixmap_private *mask_pixmap_priv,
|
PixmapPtr mask_pixmap,
|
||||||
glamor_pixmap_private *dest_pixmap_priv,
|
PixmapPtr dest_pixmap,
|
||||||
RegionPtr region, Bool force_clip,
|
RegionPtr region, Bool force_clip,
|
||||||
INT16 x_source,
|
INT16 x_source,
|
||||||
INT16 y_source,
|
INT16 y_source,
|
||||||
|
@ -1027,6 +1031,11 @@ glamor_composite_largepixmap_region(CARD8 op,
|
||||||
INT16 x_dest, INT16 y_dest,
|
INT16 x_dest, INT16 y_dest,
|
||||||
CARD16 width, CARD16 height)
|
CARD16 width, CARD16 height)
|
||||||
{
|
{
|
||||||
|
ScreenPtr screen = dest_pixmap->drawable.pScreen;
|
||||||
|
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
|
||||||
|
glamor_pixmap_private *source_pixmap_priv = glamor_get_pixmap_private(source_pixmap);
|
||||||
|
glamor_pixmap_private *mask_pixmap_priv = glamor_get_pixmap_private(mask_pixmap);
|
||||||
|
glamor_pixmap_private *dest_pixmap_priv = glamor_get_pixmap_private(dest_pixmap);
|
||||||
glamor_pixmap_clipped_regions *clipped_dest_regions;
|
glamor_pixmap_clipped_regions *clipped_dest_regions;
|
||||||
glamor_pixmap_clipped_regions *clipped_source_regions;
|
glamor_pixmap_clipped_regions *clipped_source_regions;
|
||||||
glamor_pixmap_clipped_regions *clipped_mask_regions;
|
glamor_pixmap_clipped_regions *clipped_mask_regions;
|
||||||
|
@ -1060,8 +1069,8 @@ glamor_composite_largepixmap_region(CARD8 op,
|
||||||
dest_block_width = __glamor_large(dest_pixmap_priv)->block_w;
|
dest_block_width = __glamor_large(dest_pixmap_priv)->block_w;
|
||||||
dest_block_height = __glamor_large(dest_pixmap_priv)->block_h;
|
dest_block_height = __glamor_large(dest_pixmap_priv)->block_h;
|
||||||
} else {
|
} else {
|
||||||
dest_block_width = dest_pixmap_priv->base.pixmap->drawable.width;
|
dest_block_width = dest_pixmap->drawable.width;
|
||||||
dest_block_height = dest_pixmap_priv->base.pixmap->drawable.height;
|
dest_block_height = dest_pixmap->drawable.height;
|
||||||
}
|
}
|
||||||
fixed_block_width = dest_block_width;
|
fixed_block_width = dest_block_width;
|
||||||
fixed_block_height = dest_block_height;
|
fixed_block_height = dest_block_height;
|
||||||
|
@ -1134,12 +1143,12 @@ glamor_composite_largepixmap_region(CARD8 op,
|
||||||
if (force_clip || fixed_block_width < dest_block_width
|
if (force_clip || fixed_block_width < dest_block_width
|
||||||
|| fixed_block_height < dest_block_height)
|
|| fixed_block_height < dest_block_height)
|
||||||
clipped_dest_regions =
|
clipped_dest_regions =
|
||||||
glamor_compute_clipped_regions_ext(dest_pixmap_priv, region,
|
glamor_compute_clipped_regions_ext(dest_pixmap, region,
|
||||||
&n_dest_regions,
|
&n_dest_regions,
|
||||||
fixed_block_width,
|
fixed_block_width,
|
||||||
fixed_block_height, 0, 0);
|
fixed_block_height, 0, 0);
|
||||||
else
|
else
|
||||||
clipped_dest_regions = glamor_compute_clipped_regions(dest_pixmap_priv,
|
clipped_dest_regions = glamor_compute_clipped_regions(dest_pixmap,
|
||||||
region,
|
region,
|
||||||
&n_dest_regions,
|
&n_dest_regions,
|
||||||
0, 0, 0);
|
0, 0, 0);
|
||||||
|
@ -1168,7 +1177,7 @@ glamor_composite_largepixmap_region(CARD8 op,
|
||||||
RegionTranslate(clipped_dest_regions[i].region,
|
RegionTranslate(clipped_dest_regions[i].region,
|
||||||
x_source - x_dest, y_source - y_dest);
|
x_source - x_dest, y_source - y_dest);
|
||||||
clipped_source_regions =
|
clipped_source_regions =
|
||||||
glamor_compute_clipped_regions(source_pixmap_priv,
|
glamor_compute_clipped_regions(source_pixmap,
|
||||||
clipped_dest_regions[i].
|
clipped_dest_regions[i].
|
||||||
region, &n_source_regions,
|
region, &n_source_regions,
|
||||||
source_repeat_type, 0, 0);
|
source_repeat_type, 0, 0);
|
||||||
|
@ -1176,7 +1185,7 @@ glamor_composite_largepixmap_region(CARD8 op,
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
clipped_source_regions =
|
clipped_source_regions =
|
||||||
glamor_compute_transform_clipped_regions(source_pixmap_priv,
|
glamor_compute_transform_clipped_regions(source_pixmap,
|
||||||
source->transform,
|
source->transform,
|
||||||
clipped_dest_regions
|
clipped_dest_regions
|
||||||
[i].region,
|
[i].region,
|
||||||
|
@ -1193,7 +1202,7 @@ glamor_composite_largepixmap_region(CARD8 op,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
_glamor_process_transformed_clipped_region
|
_glamor_process_transformed_clipped_region
|
||||||
(source_pixmap_priv, source_repeat_type,
|
(source_pixmap, source_pixmap_priv, source_repeat_type,
|
||||||
clipped_source_regions, &n_source_regions,
|
clipped_source_regions, &n_source_regions,
|
||||||
&need_clean_source_fbo);
|
&need_clean_source_fbo);
|
||||||
}
|
}
|
||||||
|
@ -1214,7 +1223,7 @@ glamor_composite_largepixmap_region(CARD8 op,
|
||||||
RegionTranslate(clipped_source_regions[j].region,
|
RegionTranslate(clipped_source_regions[j].region,
|
||||||
-x_source + x_mask, -y_source + y_mask);
|
-x_source + x_mask, -y_source + y_mask);
|
||||||
clipped_mask_regions =
|
clipped_mask_regions =
|
||||||
glamor_compute_clipped_regions(mask_pixmap_priv,
|
glamor_compute_clipped_regions(mask_pixmap,
|
||||||
clipped_source_regions
|
clipped_source_regions
|
||||||
[j].region,
|
[j].region,
|
||||||
&n_mask_regions,
|
&n_mask_regions,
|
||||||
|
@ -1230,7 +1239,7 @@ glamor_composite_largepixmap_region(CARD8 op,
|
||||||
RegionTranslate(clipped_dest_regions[i].region,
|
RegionTranslate(clipped_dest_regions[i].region,
|
||||||
-x_dest + x_mask, -y_dest + y_mask);
|
-x_dest + x_mask, -y_dest + y_mask);
|
||||||
clipped_mask_regions =
|
clipped_mask_regions =
|
||||||
glamor_compute_clipped_regions(mask_pixmap_priv,
|
glamor_compute_clipped_regions(mask_pixmap,
|
||||||
clipped_dest_regions
|
clipped_dest_regions
|
||||||
[i].region,
|
[i].region,
|
||||||
&n_mask_regions,
|
&n_mask_regions,
|
||||||
|
@ -1244,14 +1253,14 @@ glamor_composite_largepixmap_region(CARD8 op,
|
||||||
if (!is_normal_source_fbo)
|
if (!is_normal_source_fbo)
|
||||||
clipped_mask_regions =
|
clipped_mask_regions =
|
||||||
glamor_compute_transform_clipped_regions
|
glamor_compute_transform_clipped_regions
|
||||||
(mask_pixmap_priv, mask->transform,
|
(mask_pixmap, mask->transform,
|
||||||
clipped_dest_regions[i].region,
|
clipped_dest_regions[i].region,
|
||||||
&n_mask_regions, x_mask - x_dest,
|
&n_mask_regions, x_mask - x_dest,
|
||||||
y_mask - y_dest, mask_repeat_type, 0, 0);
|
y_mask - y_dest, mask_repeat_type, 0, 0);
|
||||||
else
|
else
|
||||||
clipped_mask_regions =
|
clipped_mask_regions =
|
||||||
glamor_compute_transform_clipped_regions
|
glamor_compute_transform_clipped_regions
|
||||||
(mask_pixmap_priv, mask->transform,
|
(mask_pixmap, mask->transform,
|
||||||
clipped_source_regions[j].region,
|
clipped_source_regions[j].region,
|
||||||
&n_mask_regions, x_mask - x_source,
|
&n_mask_regions, x_mask - x_source,
|
||||||
y_mask - y_source, mask_repeat_type, 0, 0);
|
y_mask - y_source, mask_repeat_type, 0, 0);
|
||||||
|
@ -1263,7 +1272,7 @@ glamor_composite_largepixmap_region(CARD8 op,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
_glamor_process_transformed_clipped_region
|
_glamor_process_transformed_clipped_region
|
||||||
(mask_pixmap_priv, mask_repeat_type,
|
(mask_pixmap, mask_pixmap_priv, mask_repeat_type,
|
||||||
clipped_mask_regions, &n_mask_regions,
|
clipped_mask_regions, &n_mask_regions,
|
||||||
&need_clean_mask_fbo);
|
&need_clean_mask_fbo);
|
||||||
}
|
}
|
||||||
|
@ -1273,9 +1282,9 @@ glamor_composite_largepixmap_region(CARD8 op,
|
||||||
if (!glamor_composite_clipped_region(op, \
|
if (!glamor_composite_clipped_region(op, \
|
||||||
null_source ? NULL : source, \
|
null_source ? NULL : source, \
|
||||||
null_mask ? NULL : mask, dest, \
|
null_mask ? NULL : mask, dest, \
|
||||||
null_source ? NULL : source_pixmap_priv, \
|
null_source ? NULL : source_pixmap, \
|
||||||
null_mask ? NULL : mask_pixmap_priv, \
|
null_mask ? NULL : mask_pixmap, \
|
||||||
dest_pixmap_priv, region, \
|
dest_pixmap, region, \
|
||||||
x_source, y_source, x_mask, y_mask, \
|
x_source, y_source, x_mask, y_mask, \
|
||||||
x_dest, y_dest)) { \
|
x_dest, y_dest)) { \
|
||||||
assert(0); \
|
assert(0); \
|
||||||
|
@ -1326,7 +1335,7 @@ 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(mask_pixmap_priv->base.fbo);
|
glamor_destroy_fbo(glamor_priv, mask_pixmap_priv->base.fbo);
|
||||||
mask_pixmap_priv->base.fbo = NULL;
|
mask_pixmap_priv->base.fbo = NULL;
|
||||||
need_clean_mask_fbo = 0;
|
need_clean_mask_fbo = 0;
|
||||||
}
|
}
|
||||||
|
@ -1355,7 +1364,7 @@ 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(source_pixmap_priv->base.fbo);
|
glamor_destroy_fbo(glamor_priv, source_pixmap_priv->base.fbo);
|
||||||
source_pixmap_priv->base.fbo = NULL;
|
source_pixmap_priv->base.fbo = NULL;
|
||||||
need_clean_source_fbo = 0;
|
need_clean_source_fbo = 0;
|
||||||
}
|
}
|
||||||
|
@ -1367,7 +1376,7 @@ glamor_composite_largepixmap_region(CARD8 op,
|
||||||
RegionTranslate(clipped_dest_regions[i].region,
|
RegionTranslate(clipped_dest_regions[i].region,
|
||||||
x_mask - x_dest, y_mask - y_dest);
|
x_mask - x_dest, y_mask - y_dest);
|
||||||
clipped_mask_regions =
|
clipped_mask_regions =
|
||||||
glamor_compute_clipped_regions(mask_pixmap_priv,
|
glamor_compute_clipped_regions(mask_pixmap,
|
||||||
clipped_dest_regions[i].
|
clipped_dest_regions[i].
|
||||||
region, &n_mask_regions,
|
region, &n_mask_regions,
|
||||||
mask_repeat_type, 0, 0);
|
mask_repeat_type, 0, 0);
|
||||||
|
@ -1376,7 +1385,7 @@ glamor_composite_largepixmap_region(CARD8 op,
|
||||||
else {
|
else {
|
||||||
clipped_mask_regions =
|
clipped_mask_regions =
|
||||||
glamor_compute_transform_clipped_regions
|
glamor_compute_transform_clipped_regions
|
||||||
(mask_pixmap_priv, mask->transform,
|
(mask_pixmap, mask->transform,
|
||||||
clipped_dest_regions[i].region, &n_mask_regions,
|
clipped_dest_regions[i].region, &n_mask_regions,
|
||||||
x_mask - x_dest, y_mask - y_dest, mask_repeat_type, 0,
|
x_mask - x_dest, y_mask - y_dest, mask_repeat_type, 0,
|
||||||
0);
|
0);
|
||||||
|
@ -1388,7 +1397,7 @@ glamor_composite_largepixmap_region(CARD8 op,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
_glamor_process_transformed_clipped_region
|
_glamor_process_transformed_clipped_region
|
||||||
(mask_pixmap_priv, mask_repeat_type,
|
(mask_pixmap, mask_pixmap_priv, mask_repeat_type,
|
||||||
clipped_mask_regions, &n_mask_regions,
|
clipped_mask_regions, &n_mask_regions,
|
||||||
&need_clean_mask_fbo);
|
&need_clean_mask_fbo);
|
||||||
}
|
}
|
||||||
|
@ -1417,7 +1426,7 @@ 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(mask_pixmap_priv->base.fbo);
|
glamor_destroy_fbo(glamor_priv, mask_pixmap_priv->base.fbo);
|
||||||
mask_pixmap_priv->base.fbo = NULL;
|
mask_pixmap_priv->base.fbo = NULL;
|
||||||
need_clean_mask_fbo = 0;
|
need_clean_mask_fbo = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,31 +63,36 @@ glamor_pixmap_fini(ScreenPtr screen)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
glamor_set_destination_pixmap_fbo(glamor_pixmap_fbo *fbo, int x0, int y0,
|
glamor_set_destination_pixmap_fbo(glamor_screen_private *glamor_priv,
|
||||||
|
glamor_pixmap_fbo *fbo, int x0, int y0,
|
||||||
int width, int height)
|
int width, int height)
|
||||||
{
|
{
|
||||||
glamor_make_current(fbo->glamor_priv);
|
glamor_make_current(glamor_priv);
|
||||||
|
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, fbo->fb);
|
glBindFramebuffer(GL_FRAMEBUFFER, fbo->fb);
|
||||||
glViewport(x0, y0, width, height);
|
glViewport(x0, y0, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
glamor_set_destination_pixmap_priv_nc(glamor_pixmap_private *pixmap_priv)
|
glamor_set_destination_pixmap_priv_nc(glamor_screen_private *glamor_priv,
|
||||||
|
PixmapPtr pixmap,
|
||||||
|
glamor_pixmap_private *pixmap_priv)
|
||||||
{
|
{
|
||||||
int w, h;
|
int w, h;
|
||||||
|
|
||||||
PIXMAP_PRIV_GET_ACTUAL_SIZE(pixmap_priv, w, h);
|
PIXMAP_PRIV_GET_ACTUAL_SIZE(pixmap, pixmap_priv, w, h);
|
||||||
glamor_set_destination_pixmap_fbo(pixmap_priv->base.fbo, 0, 0, w, h);
|
glamor_set_destination_pixmap_fbo(glamor_priv, pixmap_priv->base.fbo, 0, 0, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
glamor_set_destination_pixmap_priv(glamor_pixmap_private *pixmap_priv)
|
glamor_set_destination_pixmap_priv(glamor_screen_private *glamor_priv,
|
||||||
|
PixmapPtr pixmap,
|
||||||
|
glamor_pixmap_private *pixmap_priv)
|
||||||
{
|
{
|
||||||
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
|
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
glamor_set_destination_pixmap_priv_nc(pixmap_priv);
|
glamor_set_destination_pixmap_priv_nc(glamor_priv, pixmap, pixmap_priv);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,8 +101,10 @@ glamor_set_destination_pixmap(PixmapPtr pixmap)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
|
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||||
|
ScreenPtr screen = pixmap->drawable.pScreen;
|
||||||
|
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
|
||||||
|
|
||||||
err = glamor_set_destination_pixmap_priv(pixmap_priv);
|
err = glamor_set_destination_pixmap_priv(glamor_priv, pixmap, pixmap_priv);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -810,7 +817,7 @@ _glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, GLenum format,
|
||||||
} else {
|
} else {
|
||||||
ptexcoords = texcoords_inv;
|
ptexcoords = texcoords_inv;
|
||||||
|
|
||||||
pixmap_priv_get_dest_scale(pixmap_priv, &dst_xscale, &dst_yscale);
|
pixmap_priv_get_dest_scale(pixmap, 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,
|
||||||
|
@ -825,7 +832,7 @@ _glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, GLenum format,
|
||||||
GL_FALSE, 2 * sizeof(float), ptexcoords);
|
GL_FALSE, 2 * sizeof(float), ptexcoords);
|
||||||
glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
|
glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
|
||||||
|
|
||||||
glamor_set_destination_pixmap_priv_nc(pixmap_priv);
|
glamor_set_destination_pixmap_priv_nc(glamor_priv, pixmap, pixmap_priv);
|
||||||
__glamor_upload_pixmap_to_texture(pixmap, &tex,
|
__glamor_upload_pixmap_to_texture(pixmap, &tex,
|
||||||
format, type, 0, 0, w, h, bits, pbo);
|
format, type, 0, 0, w, h, bits, pbo);
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
@ -874,7 +881,7 @@ glamor_pixmap_upload_prepare(PixmapPtr pixmap, GLenum format, int no_alpha,
|
||||||
&& (pixmap_priv->base.fbo->width < pixmap->drawable.width
|
&& (pixmap_priv->base.fbo->width < pixmap->drawable.width
|
||||||
|| pixmap_priv->base.fbo->height < pixmap->drawable.height)) {
|
|| pixmap_priv->base.fbo->height < pixmap->drawable.height)) {
|
||||||
fbo = glamor_pixmap_detach_fbo(pixmap_priv);
|
fbo = glamor_pixmap_detach_fbo(pixmap_priv);
|
||||||
glamor_destroy_fbo(fbo);
|
glamor_destroy_fbo(glamor_priv, fbo);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pixmap_priv->base.fbo && pixmap_priv->base.fbo->fb)
|
if (pixmap_priv->base.fbo && pixmap_priv->base.fbo->fb)
|
||||||
|
@ -927,6 +934,8 @@ Bool
|
||||||
glamor_upload_sub_pixmap_to_texture(PixmapPtr pixmap, int x, int y, int w,
|
glamor_upload_sub_pixmap_to_texture(PixmapPtr pixmap, int x, int y, int w,
|
||||||
int h, int stride, void *bits, int pbo)
|
int h, int stride, void *bits, int pbo)
|
||||||
{
|
{
|
||||||
|
ScreenPtr screen = pixmap->drawable.pScreen;
|
||||||
|
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
|
||||||
GLenum format, type;
|
GLenum format, type;
|
||||||
int no_alpha, revert, swap_rb;
|
int no_alpha, revert, swap_rb;
|
||||||
glamor_pixmap_private *pixmap_priv;
|
glamor_pixmap_private *pixmap_priv;
|
||||||
|
@ -944,8 +953,8 @@ glamor_upload_sub_pixmap_to_texture(PixmapPtr pixmap, int x, int y, int w,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||||
force_clip = pixmap_priv->base.glamor_priv->gl_flavor != GLAMOR_GL_DESKTOP
|
force_clip = glamor_priv->gl_flavor != GLAMOR_GL_DESKTOP
|
||||||
&& !glamor_check_fbo_size(pixmap_priv->base.glamor_priv, w, h);
|
&& !glamor_check_fbo_size(glamor_priv, w, h);
|
||||||
|
|
||||||
if (pixmap_priv->type == GLAMOR_TEXTURE_LARGE || force_clip) {
|
if (pixmap_priv->type == GLAMOR_TEXTURE_LARGE || force_clip) {
|
||||||
RegionRec region;
|
RegionRec region;
|
||||||
|
@ -965,11 +974,11 @@ glamor_upload_sub_pixmap_to_texture(PixmapPtr pixmap, int x, int y, int w,
|
||||||
RegionInitBoxes(®ion, &box, 1);
|
RegionInitBoxes(®ion, &box, 1);
|
||||||
if (!force_clip)
|
if (!force_clip)
|
||||||
clipped_regions =
|
clipped_regions =
|
||||||
glamor_compute_clipped_regions(pixmap_priv, ®ion, &n_region,
|
glamor_compute_clipped_regions(pixmap, ®ion, &n_region,
|
||||||
0, 0, 0);
|
0, 0, 0);
|
||||||
else
|
else
|
||||||
clipped_regions =
|
clipped_regions =
|
||||||
glamor_compute_clipped_regions_ext(pixmap_priv, ®ion,
|
glamor_compute_clipped_regions_ext(pixmap, ®ion,
|
||||||
&n_region,
|
&n_region,
|
||||||
pixmap_priv->large.block_w,
|
pixmap_priv->large.block_w,
|
||||||
pixmap_priv->large.block_h,
|
pixmap_priv->large.block_h,
|
||||||
|
@ -1121,7 +1130,7 @@ glamor_es2_pixmap_read_prepare(PixmapPtr source, int x, int y, int w, int h,
|
||||||
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);
|
||||||
|
|
||||||
glamor_set_destination_pixmap_fbo(temp_fbo, 0, 0, w, h);
|
glamor_set_destination_pixmap_fbo(glamor_priv, temp_fbo, 0, 0, w, h);
|
||||||
glUseProgram(glamor_priv->finish_access_prog[no_alpha]);
|
glUseProgram(glamor_priv->finish_access_prog[no_alpha]);
|
||||||
glUniform1i(glamor_priv->finish_access_revert[no_alpha], revert);
|
glUniform1i(glamor_priv->finish_access_revert[no_alpha], revert);
|
||||||
glUniform1i(glamor_priv->finish_access_swap_rb[no_alpha], swap_rb);
|
glUniform1i(glamor_priv->finish_access_swap_rb[no_alpha], swap_rb);
|
||||||
|
|
|
@ -72,7 +72,7 @@ typedef struct glamor_composite_shader {
|
||||||
union {
|
union {
|
||||||
float source_solid_color[4];
|
float source_solid_color[4];
|
||||||
struct {
|
struct {
|
||||||
struct glamor_pixmap_private *source_priv;
|
PixmapPtr source_pixmap;
|
||||||
PicturePtr source;
|
PicturePtr source;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -80,7 +80,7 @@ typedef struct glamor_composite_shader {
|
||||||
union {
|
union {
|
||||||
float mask_solid_color[4];
|
float mask_solid_color[4];
|
||||||
struct {
|
struct {
|
||||||
struct glamor_pixmap_private *mask_priv;
|
PixmapPtr mask_pixmap;
|
||||||
PicturePtr mask;
|
PicturePtr mask;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -369,7 +369,6 @@ typedef struct glamor_pixmap_fbo {
|
||||||
Bool external;
|
Bool external;
|
||||||
GLenum format;
|
GLenum format;
|
||||||
GLenum type;
|
GLenum type;
|
||||||
glamor_screen_private *glamor_priv;
|
|
||||||
} glamor_pixmap_fbo;
|
} glamor_pixmap_fbo;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -449,10 +448,8 @@ typedef struct glamor_pixmap_private_base {
|
||||||
unsigned char is_picture:1;
|
unsigned char is_picture:1;
|
||||||
unsigned char gl_tex:1;
|
unsigned char gl_tex:1;
|
||||||
glamor_pixmap_fbo *fbo;
|
glamor_pixmap_fbo *fbo;
|
||||||
PixmapPtr pixmap;
|
|
||||||
BoxRec box;
|
BoxRec box;
|
||||||
int drm_stride;
|
int drm_stride;
|
||||||
glamor_screen_private *glamor_priv;
|
|
||||||
PicturePtr picture;
|
PicturePtr picture;
|
||||||
GLuint pbo;
|
GLuint pbo;
|
||||||
RegionRec prepare_region;
|
RegionRec prepare_region;
|
||||||
|
@ -610,6 +607,9 @@ glamor_get_pixmap_private(PixmapPtr pixmap)
|
||||||
{
|
{
|
||||||
glamor_pixmap_private *priv;
|
glamor_pixmap_private *priv;
|
||||||
|
|
||||||
|
if (pixmap == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
priv = dixLookupPrivate(&pixmap->devPrivates, &glamor_pixmap_private_key);
|
priv = dixLookupPrivate(&pixmap->devPrivates, &glamor_pixmap_private_key);
|
||||||
if (!priv) {
|
if (!priv) {
|
||||||
glamor_set_pixmap_type(pixmap, GLAMOR_MEMORY);
|
glamor_set_pixmap_type(pixmap, GLAMOR_MEMORY);
|
||||||
|
@ -619,6 +619,50 @@ glamor_get_pixmap_private(PixmapPtr pixmap)
|
||||||
return priv;
|
return priv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns TRUE if pixmap has no image object
|
||||||
|
*/
|
||||||
|
static inline Bool
|
||||||
|
glamor_pixmap_drm_only(PixmapPtr pixmap)
|
||||||
|
{
|
||||||
|
glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap);
|
||||||
|
|
||||||
|
return priv && priv->base.type == GLAMOR_DRM_ONLY;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns TRUE if pixmap is plain memory (not a GL object at all)
|
||||||
|
*/
|
||||||
|
static inline Bool
|
||||||
|
glamor_pixmap_is_memory(PixmapPtr pixmap)
|
||||||
|
{
|
||||||
|
glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap);
|
||||||
|
|
||||||
|
return !priv || priv->base.type == GLAMOR_TEXTURE_LARGE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns TRUE if pixmap requires multiple textures to hold it
|
||||||
|
*/
|
||||||
|
static inline Bool
|
||||||
|
glamor_pixmap_is_large(PixmapPtr pixmap)
|
||||||
|
{
|
||||||
|
glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap);
|
||||||
|
|
||||||
|
return priv && priv->base.type == GLAMOR_TEXTURE_LARGE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns TRUE if pixmap has an FBO
|
||||||
|
*/
|
||||||
|
static inline Bool
|
||||||
|
glamor_pixmap_has_fbo(PixmapPtr pixmap)
|
||||||
|
{
|
||||||
|
glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap);
|
||||||
|
|
||||||
|
return priv && priv->base.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);
|
||||||
|
|
||||||
static inline glamor_gc_private *
|
static inline glamor_gc_private *
|
||||||
|
@ -652,9 +696,10 @@ glamor_pixmap_fbo *glamor_create_fbo_from_tex(glamor_screen_private *
|
||||||
int flag);
|
int flag);
|
||||||
glamor_pixmap_fbo *glamor_create_fbo(glamor_screen_private *glamor_priv, int w,
|
glamor_pixmap_fbo *glamor_create_fbo(glamor_screen_private *glamor_priv, int w,
|
||||||
int h, GLenum format, int flag);
|
int h, GLenum format, int flag);
|
||||||
void glamor_destroy_fbo(glamor_pixmap_fbo *fbo);
|
void glamor_destroy_fbo(glamor_screen_private *glamor_priv,
|
||||||
void glamor_pixmap_destroy_fbo(glamor_pixmap_private *priv);
|
glamor_pixmap_fbo *fbo);
|
||||||
|
void glamor_pixmap_destroy_fbo(glamor_screen_private *glamor_priv,
|
||||||
|
glamor_pixmap_private *priv);
|
||||||
void glamor_init_pixmap_fbo(ScreenPtr screen);
|
void glamor_init_pixmap_fbo(ScreenPtr screen);
|
||||||
void glamor_fini_pixmap_fbo(ScreenPtr screen);
|
void glamor_fini_pixmap_fbo(ScreenPtr screen);
|
||||||
Bool glamor_pixmap_fbo_fixup(ScreenPtr screen, PixmapPtr pixmap);
|
Bool glamor_pixmap_fbo_fixup(ScreenPtr screen, PixmapPtr pixmap);
|
||||||
|
@ -679,13 +724,13 @@ void glamor_get_color_4f_from_pixel(PixmapPtr pixmap,
|
||||||
unsigned long fg_pixel, GLfloat *color);
|
unsigned long fg_pixel, GLfloat *color);
|
||||||
|
|
||||||
int glamor_set_destination_pixmap(PixmapPtr pixmap);
|
int glamor_set_destination_pixmap(PixmapPtr pixmap);
|
||||||
int glamor_set_destination_pixmap_priv(glamor_pixmap_private *pixmap_priv);
|
int glamor_set_destination_pixmap_priv(glamor_screen_private *glamor_priv, PixmapPtr pixmap, glamor_pixmap_private *pixmap_priv);
|
||||||
void glamor_set_destination_pixmap_fbo(glamor_pixmap_fbo *, int, int, int, int);
|
void glamor_set_destination_pixmap_fbo(glamor_screen_private *glamor_priv, glamor_pixmap_fbo *, int, int, int, int);
|
||||||
|
|
||||||
/* nc means no check. caller must ensure this pixmap has valid fbo.
|
/* nc means no check. caller must ensure this pixmap has valid fbo.
|
||||||
* usually use the GLAMOR_PIXMAP_PRIV_HAS_FBO firstly.
|
* usually use the GLAMOR_PIXMAP_PRIV_HAS_FBO firstly.
|
||||||
* */
|
* */
|
||||||
void glamor_set_destination_pixmap_priv_nc(glamor_pixmap_private *pixmap_priv);
|
void glamor_set_destination_pixmap_priv_nc(glamor_screen_private *glamor_priv, PixmapPtr pixmap, glamor_pixmap_private *pixmap_priv);
|
||||||
|
|
||||||
glamor_pixmap_fbo *glamor_es2_pixmap_read_prepare(PixmapPtr source, int x,
|
glamor_pixmap_fbo *glamor_es2_pixmap_read_prepare(PixmapPtr source, int x,
|
||||||
int y, int w, int h,
|
int y, int w, int h,
|
||||||
|
@ -716,9 +761,9 @@ Bool glamor_composite_clipped_region(CARD8 op,
|
||||||
PicturePtr source,
|
PicturePtr source,
|
||||||
PicturePtr mask,
|
PicturePtr mask,
|
||||||
PicturePtr dest,
|
PicturePtr dest,
|
||||||
glamor_pixmap_private *soruce_pixmap_priv,
|
PixmapPtr source_pixmap,
|
||||||
glamor_pixmap_private *mask_pixmap_priv,
|
PixmapPtr mask_pixmap,
|
||||||
glamor_pixmap_private *dest_pixmap_priv,
|
PixmapPtr dest_pixmap,
|
||||||
RegionPtr region,
|
RegionPtr region,
|
||||||
int x_source,
|
int x_source,
|
||||||
int y_source,
|
int y_source,
|
||||||
|
@ -749,23 +794,6 @@ PicturePtr glamor_convert_gradient_picture(ScreenPtr screen,
|
||||||
int x_source,
|
int x_source,
|
||||||
int y_source, int width, int height);
|
int y_source, int width, int height);
|
||||||
|
|
||||||
Bool glamor_composite_choose_shader(CARD8 op,
|
|
||||||
PicturePtr source,
|
|
||||||
PicturePtr mask,
|
|
||||||
PicturePtr dest,
|
|
||||||
glamor_pixmap_private *source_pixmap_priv,
|
|
||||||
glamor_pixmap_private *mask_pixmap_priv,
|
|
||||||
glamor_pixmap_private *dest_pixmap_priv,
|
|
||||||
struct shader_key *s_key,
|
|
||||||
glamor_composite_shader ** shader,
|
|
||||||
struct blendinfo *op_info,
|
|
||||||
PictFormatShort *psaved_source_format);
|
|
||||||
|
|
||||||
void glamor_composite_set_shader_blend(glamor_pixmap_private *dest_priv,
|
|
||||||
struct shader_key *key,
|
|
||||||
glamor_composite_shader *shader,
|
|
||||||
struct blendinfo *op_info);
|
|
||||||
|
|
||||||
void *glamor_setup_composite_vbo(ScreenPtr screen, int n_verts);
|
void *glamor_setup_composite_vbo(ScreenPtr screen, int n_verts);
|
||||||
|
|
||||||
/* glamor_trapezoid.c */
|
/* glamor_trapezoid.c */
|
||||||
|
@ -832,19 +860,19 @@ Bool glamor_upload_sub_pixmap_to_texture(PixmapPtr pixmap, int x, int y, int w,
|
||||||
int pbo);
|
int pbo);
|
||||||
|
|
||||||
glamor_pixmap_clipped_regions *
|
glamor_pixmap_clipped_regions *
|
||||||
glamor_compute_clipped_regions(glamor_pixmap_private *priv,
|
glamor_compute_clipped_regions(PixmapPtr pixmap,
|
||||||
RegionPtr region, int *clipped_nbox,
|
RegionPtr region, int *clipped_nbox,
|
||||||
int repeat_type, int reverse,
|
int repeat_type, int reverse,
|
||||||
int upsidedown);
|
int upsidedown);
|
||||||
|
|
||||||
glamor_pixmap_clipped_regions *
|
glamor_pixmap_clipped_regions *
|
||||||
glamor_compute_clipped_regions_ext(glamor_pixmap_private *pixmap_priv,
|
glamor_compute_clipped_regions_ext(PixmapPtr pixmap,
|
||||||
RegionPtr region, int *n_region,
|
RegionPtr region, int *n_region,
|
||||||
int inner_block_w, int inner_block_h,
|
int inner_block_w, int inner_block_h,
|
||||||
int reverse, int upsidedown);
|
int reverse, int upsidedown);
|
||||||
|
|
||||||
glamor_pixmap_clipped_regions *
|
glamor_pixmap_clipped_regions *
|
||||||
glamor_compute_transform_clipped_regions(glamor_pixmap_private *priv,
|
glamor_compute_transform_clipped_regions(PixmapPtr pixmap,
|
||||||
struct pixman_transform *transform,
|
struct pixman_transform *transform,
|
||||||
RegionPtr region,
|
RegionPtr region,
|
||||||
int *n_region, int dx, int dy,
|
int *n_region, int dx, int dy,
|
||||||
|
@ -855,9 +883,9 @@ Bool glamor_composite_largepixmap_region(CARD8 op,
|
||||||
PicturePtr source,
|
PicturePtr source,
|
||||||
PicturePtr mask,
|
PicturePtr mask,
|
||||||
PicturePtr dest,
|
PicturePtr dest,
|
||||||
glamor_pixmap_private *source_pixmap_priv,
|
PixmapPtr source_pixmap,
|
||||||
glamor_pixmap_private *mask_pixmap_priv,
|
PixmapPtr mask_pixmap,
|
||||||
glamor_pixmap_private *dest_pixmap_priv,
|
PixmapPtr dest_pixmap,
|
||||||
RegionPtr region, Bool force_clip,
|
RegionPtr region, Bool force_clip,
|
||||||
INT16 x_source,
|
INT16 x_source,
|
||||||
INT16 y_source,
|
INT16 y_source,
|
||||||
|
|
|
@ -482,9 +482,10 @@ glamor_set_composite_op(ScreenPtr screen,
|
||||||
static void
|
static void
|
||||||
glamor_set_composite_texture(glamor_screen_private *glamor_priv, int unit,
|
glamor_set_composite_texture(glamor_screen_private *glamor_priv, int unit,
|
||||||
PicturePtr picture,
|
PicturePtr picture,
|
||||||
glamor_pixmap_private *pixmap_priv,
|
PixmapPtr pixmap,
|
||||||
GLuint wh_location, GLuint repeat_location)
|
GLuint wh_location, GLuint repeat_location)
|
||||||
{
|
{
|
||||||
|
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||||
float wh[4];
|
float wh[4];
|
||||||
int repeat_type;
|
int repeat_type;
|
||||||
|
|
||||||
|
@ -546,7 +547,7 @@ glamor_set_composite_texture(glamor_screen_private *glamor_priv, int unit,
|
||||||
repeat_type += RepeatFix;
|
repeat_type += RepeatFix;
|
||||||
}
|
}
|
||||||
if (repeat_type >= RepeatFix) {
|
if (repeat_type >= RepeatFix) {
|
||||||
glamor_pixmap_fbo_fix_wh_ratio(wh, pixmap_priv);
|
glamor_pixmap_fbo_fix_wh_ratio(wh, pixmap, pixmap_priv);
|
||||||
if ((wh[0] != 1.0 || wh[1] != 1.0)
|
if ((wh[0] != 1.0 || wh[1] != 1.0)
|
||||||
|| (glamor_priv->gl_flavor == GLAMOR_GL_ES2
|
|| (glamor_priv->gl_flavor == GLAMOR_GL_ES2
|
||||||
&& repeat_type == RepeatFix))
|
&& repeat_type == RepeatFix))
|
||||||
|
@ -786,7 +787,8 @@ combine_pict_format(PictFormatShort * des, const PictFormatShort src,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
glamor_set_normalize_tcoords_generic(glamor_pixmap_private *priv,
|
glamor_set_normalize_tcoords_generic(PixmapPtr pixmap,
|
||||||
|
glamor_pixmap_private *priv,
|
||||||
int repeat_type,
|
int repeat_type,
|
||||||
float *matrix,
|
float *matrix,
|
||||||
float xscale, float yscale,
|
float xscale, float yscale,
|
||||||
|
@ -804,24 +806,27 @@ glamor_set_normalize_tcoords_generic(glamor_pixmap_private *priv,
|
||||||
x2, y2,
|
x2, y2,
|
||||||
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(pixmap, priv, repeat_type,
|
||||||
xscale, yscale,
|
xscale, yscale,
|
||||||
x1, y1,
|
x1, y1,
|
||||||
x2, y2,
|
x2, y2,
|
||||||
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(pixmap, priv, repeat_type,
|
||||||
matrix, xscale,
|
matrix, xscale,
|
||||||
yscale, x1, y1, x2,
|
yscale, x1, y1, x2,
|
||||||
y2,
|
y2,
|
||||||
texcoords, stride);
|
texcoords, stride);
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
static Bool
|
||||||
glamor_composite_choose_shader(CARD8 op,
|
glamor_composite_choose_shader(CARD8 op,
|
||||||
PicturePtr source,
|
PicturePtr source,
|
||||||
PicturePtr mask,
|
PicturePtr mask,
|
||||||
PicturePtr dest,
|
PicturePtr dest,
|
||||||
|
PixmapPtr source_pixmap,
|
||||||
|
PixmapPtr mask_pixmap,
|
||||||
|
PixmapPtr dest_pixmap,
|
||||||
glamor_pixmap_private *source_pixmap_priv,
|
glamor_pixmap_private *source_pixmap_priv,
|
||||||
glamor_pixmap_private *mask_pixmap_priv,
|
glamor_pixmap_private *mask_pixmap_priv,
|
||||||
glamor_pixmap_private *dest_pixmap_priv,
|
glamor_pixmap_private *dest_pixmap_priv,
|
||||||
|
@ -831,9 +836,6 @@ glamor_composite_choose_shader(CARD8 op,
|
||||||
PictFormatShort *psaved_source_format)
|
PictFormatShort *psaved_source_format)
|
||||||
{
|
{
|
||||||
ScreenPtr screen = dest->pDrawable->pScreen;
|
ScreenPtr screen = dest->pDrawable->pScreen;
|
||||||
PixmapPtr dest_pixmap = dest_pixmap_priv->base.pixmap;
|
|
||||||
PixmapPtr source_pixmap = NULL;
|
|
||||||
PixmapPtr mask_pixmap = NULL;
|
|
||||||
enum glamor_pixmap_status source_status = GLAMOR_NONE;
|
enum glamor_pixmap_status source_status = GLAMOR_NONE;
|
||||||
enum glamor_pixmap_status mask_status = GLAMOR_NONE;
|
enum glamor_pixmap_status mask_status = GLAMOR_NONE;
|
||||||
PictFormatShort saved_source_format = 0;
|
PictFormatShort saved_source_format = 0;
|
||||||
|
@ -926,7 +928,6 @@ glamor_composite_choose_shader(CARD8 op,
|
||||||
|
|
||||||
if (key.source == SHADER_SOURCE_TEXTURE ||
|
if (key.source == SHADER_SOURCE_TEXTURE ||
|
||||||
key.source == SHADER_SOURCE_TEXTURE_ALPHA) {
|
key.source == SHADER_SOURCE_TEXTURE_ALPHA) {
|
||||||
source_pixmap = source_pixmap_priv->base.pixmap;
|
|
||||||
if (source_pixmap == dest_pixmap) {
|
if (source_pixmap == dest_pixmap) {
|
||||||
/* XXX source and the dest share the same texture.
|
/* XXX source and the dest share the same texture.
|
||||||
* Does it need special handle? */
|
* Does it need special handle? */
|
||||||
|
@ -944,7 +945,6 @@ glamor_composite_choose_shader(CARD8 op,
|
||||||
|
|
||||||
if (key.mask == SHADER_MASK_TEXTURE ||
|
if (key.mask == SHADER_MASK_TEXTURE ||
|
||||||
key.mask == SHADER_MASK_TEXTURE_ALPHA) {
|
key.mask == SHADER_MASK_TEXTURE_ALPHA) {
|
||||||
mask_pixmap = mask_pixmap_priv->base.pixmap;
|
|
||||||
if (mask_pixmap == dest_pixmap) {
|
if (mask_pixmap == dest_pixmap) {
|
||||||
glamor_fallback("mask == dest\n");
|
glamor_fallback("mask == dest\n");
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@ -1052,7 +1052,7 @@ glamor_composite_choose_shader(CARD8 op,
|
||||||
memcpy(&(*shader)->source_solid_color[0],
|
memcpy(&(*shader)->source_solid_color[0],
|
||||||
source_solid_color, 4 * sizeof(float));
|
source_solid_color, 4 * sizeof(float));
|
||||||
else {
|
else {
|
||||||
(*shader)->source_priv = source_pixmap_priv;
|
(*shader)->source_pixmap = source_pixmap;
|
||||||
(*shader)->source = source;
|
(*shader)->source = source;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1060,7 +1060,7 @@ glamor_composite_choose_shader(CARD8 op,
|
||||||
memcpy(&(*shader)->mask_solid_color[0],
|
memcpy(&(*shader)->mask_solid_color[0],
|
||||||
mask_solid_color, 4 * sizeof(float));
|
mask_solid_color, 4 * sizeof(float));
|
||||||
else {
|
else {
|
||||||
(*shader)->mask_priv = mask_pixmap_priv;
|
(*shader)->mask_pixmap = mask_pixmap;
|
||||||
(*shader)->mask = mask;
|
(*shader)->mask = mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1076,16 +1076,13 @@ glamor_composite_choose_shader(CARD8 op,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
glamor_composite_set_shader_blend(glamor_pixmap_private *dest_priv,
|
glamor_composite_set_shader_blend(glamor_screen_private *glamor_priv,
|
||||||
|
glamor_pixmap_private *dest_priv,
|
||||||
struct shader_key *key,
|
struct shader_key *key,
|
||||||
glamor_composite_shader *shader,
|
glamor_composite_shader *shader,
|
||||||
struct blendinfo *op_info)
|
struct blendinfo *op_info)
|
||||||
{
|
{
|
||||||
glamor_screen_private *glamor_priv;
|
|
||||||
|
|
||||||
glamor_priv = dest_priv->base.glamor_priv;
|
|
||||||
|
|
||||||
glamor_make_current(glamor_priv);
|
glamor_make_current(glamor_priv);
|
||||||
glUseProgram(shader->prog);
|
glUseProgram(shader->prog);
|
||||||
|
|
||||||
|
@ -1096,7 +1093,7 @@ glamor_composite_set_shader_blend(glamor_pixmap_private *dest_priv,
|
||||||
else {
|
else {
|
||||||
glamor_set_composite_texture(glamor_priv, 0,
|
glamor_set_composite_texture(glamor_priv, 0,
|
||||||
shader->source,
|
shader->source,
|
||||||
shader->source_priv, shader->source_wh,
|
shader->source_pixmap, shader->source_wh,
|
||||||
shader->source_repeat_mode);
|
shader->source_repeat_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1108,7 +1105,7 @@ glamor_composite_set_shader_blend(glamor_pixmap_private *dest_priv,
|
||||||
else {
|
else {
|
||||||
glamor_set_composite_texture(glamor_priv, 1,
|
glamor_set_composite_texture(glamor_priv, 1,
|
||||||
shader->mask,
|
shader->mask,
|
||||||
shader->mask_priv, shader->mask_wh,
|
shader->mask_pixmap, shader->mask_wh,
|
||||||
shader->mask_repeat_mode);
|
shader->mask_repeat_mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1127,6 +1124,9 @@ glamor_composite_with_shader(CARD8 op,
|
||||||
PicturePtr source,
|
PicturePtr source,
|
||||||
PicturePtr mask,
|
PicturePtr mask,
|
||||||
PicturePtr dest,
|
PicturePtr dest,
|
||||||
|
PixmapPtr source_pixmap,
|
||||||
|
PixmapPtr mask_pixmap,
|
||||||
|
PixmapPtr dest_pixmap,
|
||||||
glamor_pixmap_private *source_pixmap_priv,
|
glamor_pixmap_private *source_pixmap_priv,
|
||||||
glamor_pixmap_private *mask_pixmap_priv,
|
glamor_pixmap_private *mask_pixmap_priv,
|
||||||
glamor_pixmap_private *dest_pixmap_priv,
|
glamor_pixmap_private *dest_pixmap_priv,
|
||||||
|
@ -1134,10 +1134,7 @@ glamor_composite_with_shader(CARD8 op,
|
||||||
Bool two_pass_ca)
|
Bool two_pass_ca)
|
||||||
{
|
{
|
||||||
ScreenPtr screen = dest->pDrawable->pScreen;
|
ScreenPtr screen = dest->pDrawable->pScreen;
|
||||||
glamor_screen_private *glamor_priv = dest_pixmap_priv->base.glamor_priv;
|
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
|
||||||
PixmapPtr dest_pixmap = dest_pixmap_priv->base.pixmap;
|
|
||||||
PixmapPtr source_pixmap = NULL;
|
|
||||||
PixmapPtr mask_pixmap = NULL;
|
|
||||||
GLfloat dst_xscale, dst_yscale;
|
GLfloat dst_xscale, dst_yscale;
|
||||||
GLfloat mask_xscale = 1, mask_yscale = 1, src_xscale = 1, src_yscale = 1;
|
GLfloat mask_xscale = 1, mask_yscale = 1, src_xscale = 1, src_yscale = 1;
|
||||||
struct shader_key key, key_ca;
|
struct shader_key key, key_ca;
|
||||||
|
@ -1153,6 +1150,7 @@ glamor_composite_with_shader(CARD8 op,
|
||||||
struct blendinfo op_info, op_info_ca;
|
struct blendinfo op_info, op_info_ca;
|
||||||
|
|
||||||
if (!glamor_composite_choose_shader(op, source, mask, dest,
|
if (!glamor_composite_choose_shader(op, source, mask, dest,
|
||||||
|
source_pixmap, mask_pixmap, dest_pixmap,
|
||||||
source_pixmap_priv, mask_pixmap_priv,
|
source_pixmap_priv, mask_pixmap_priv,
|
||||||
dest_pixmap_priv,
|
dest_pixmap_priv,
|
||||||
&key, &shader, &op_info,
|
&key, &shader, &op_info,
|
||||||
|
@ -1162,6 +1160,7 @@ glamor_composite_with_shader(CARD8 op,
|
||||||
}
|
}
|
||||||
if (two_pass_ca) {
|
if (two_pass_ca) {
|
||||||
if (!glamor_composite_choose_shader(PictOpAdd, source, mask, dest,
|
if (!glamor_composite_choose_shader(PictOpAdd, source, mask, dest,
|
||||||
|
source_pixmap, mask_pixmap, dest_pixmap,
|
||||||
source_pixmap_priv,
|
source_pixmap_priv,
|
||||||
mask_pixmap_priv, dest_pixmap_priv,
|
mask_pixmap_priv, dest_pixmap_priv,
|
||||||
&key_ca, &shader_ca, &op_info_ca,
|
&key_ca, &shader_ca, &op_info_ca,
|
||||||
|
@ -1171,8 +1170,8 @@ glamor_composite_with_shader(CARD8 op,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
glamor_set_destination_pixmap_priv_nc(dest_pixmap_priv);
|
glamor_set_destination_pixmap_priv_nc(glamor_priv, dest_pixmap, dest_pixmap_priv);
|
||||||
glamor_composite_set_shader_blend(dest_pixmap_priv, &key, shader, &op_info);
|
glamor_composite_set_shader_blend(glamor_priv, dest_pixmap_priv, &key, shader, &op_info);
|
||||||
|
|
||||||
glamor_make_current(glamor_priv);
|
glamor_make_current(glamor_priv);
|
||||||
|
|
||||||
|
@ -1184,10 +1183,9 @@ glamor_composite_with_shader(CARD8 op,
|
||||||
dest_pixmap_priv = glamor_get_pixmap_private(dest_pixmap);
|
dest_pixmap_priv = glamor_get_pixmap_private(dest_pixmap);
|
||||||
glamor_get_drawable_deltas(dest->pDrawable, dest_pixmap,
|
glamor_get_drawable_deltas(dest->pDrawable, dest_pixmap,
|
||||||
&dest_x_off, &dest_y_off);
|
&dest_x_off, &dest_y_off);
|
||||||
pixmap_priv_get_dest_scale(dest_pixmap_priv, &dst_xscale, &dst_yscale);
|
pixmap_priv_get_dest_scale(dest_pixmap, dest_pixmap_priv, &dst_xscale, &dst_yscale);
|
||||||
|
|
||||||
if (glamor_priv->has_source_coords) {
|
if (glamor_priv->has_source_coords) {
|
||||||
source_pixmap = source_pixmap_priv->base.pixmap;
|
|
||||||
glamor_get_drawable_deltas(source->pDrawable,
|
glamor_get_drawable_deltas(source->pDrawable,
|
||||||
source_pixmap, &source_x_off, &source_y_off);
|
source_pixmap, &source_x_off, &source_y_off);
|
||||||
pixmap_priv_get_scale(source_pixmap_priv, &src_xscale, &src_yscale);
|
pixmap_priv_get_scale(source_pixmap_priv, &src_xscale, &src_yscale);
|
||||||
|
@ -1198,7 +1196,6 @@ glamor_composite_with_shader(CARD8 op,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (glamor_priv->has_mask_coords) {
|
if (glamor_priv->has_mask_coords) {
|
||||||
mask_pixmap = mask_pixmap_priv->base.pixmap;
|
|
||||||
glamor_get_drawable_deltas(mask->pDrawable, mask_pixmap,
|
glamor_get_drawable_deltas(mask->pDrawable, mask_pixmap,
|
||||||
&mask_x_off, &mask_y_off);
|
&mask_x_off, &mask_y_off);
|
||||||
pixmap_priv_get_scale(mask_pixmap_priv, &mask_xscale, &mask_yscale);
|
pixmap_priv_get_scale(mask_pixmap_priv, &mask_xscale, &mask_yscale);
|
||||||
|
@ -1250,7 +1247,8 @@ glamor_composite_with_shader(CARD8 op,
|
||||||
vb_stride);
|
vb_stride);
|
||||||
vertices += 2;
|
vertices += 2;
|
||||||
if (key.source != SHADER_SOURCE_SOLID) {
|
if (key.source != SHADER_SOURCE_SOLID) {
|
||||||
glamor_set_normalize_tcoords_generic(source_pixmap_priv,
|
glamor_set_normalize_tcoords_generic(source_pixmap,
|
||||||
|
source_pixmap_priv,
|
||||||
source->repeatType,
|
source->repeatType,
|
||||||
psrc_matrix, src_xscale,
|
psrc_matrix, src_xscale,
|
||||||
src_yscale, x_source,
|
src_yscale, x_source,
|
||||||
|
@ -1261,7 +1259,8 @@ glamor_composite_with_shader(CARD8 op,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key.mask != SHADER_MASK_NONE && key.mask != SHADER_MASK_SOLID) {
|
if (key.mask != SHADER_MASK_NONE && key.mask != SHADER_MASK_SOLID) {
|
||||||
glamor_set_normalize_tcoords_generic(mask_pixmap_priv,
|
glamor_set_normalize_tcoords_generic(mask_pixmap,
|
||||||
|
mask_pixmap_priv,
|
||||||
mask->repeatType,
|
mask->repeatType,
|
||||||
pmask_matrix, mask_xscale,
|
pmask_matrix, mask_xscale,
|
||||||
mask_yscale, x_mask,
|
mask_yscale, x_mask,
|
||||||
|
@ -1280,11 +1279,11 @@ glamor_composite_with_shader(CARD8 op,
|
||||||
glamor_flush_composite_rects(screen);
|
glamor_flush_composite_rects(screen);
|
||||||
nrect -= rect_processed;
|
nrect -= rect_processed;
|
||||||
if (two_pass_ca) {
|
if (two_pass_ca) {
|
||||||
glamor_composite_set_shader_blend(dest_pixmap_priv,
|
glamor_composite_set_shader_blend(glamor_priv, dest_pixmap_priv,
|
||||||
&key_ca, shader_ca, &op_info_ca);
|
&key_ca, shader_ca, &op_info_ca);
|
||||||
glamor_flush_composite_rects(screen);
|
glamor_flush_composite_rects(screen);
|
||||||
if (nrect)
|
if (nrect)
|
||||||
glamor_composite_set_shader_blend(dest_pixmap_priv,
|
glamor_composite_set_shader_blend(glamor_priv, dest_pixmap_priv,
|
||||||
&key, shader, &op_info);
|
&key, shader, &op_info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1371,17 +1370,21 @@ glamor_composite_clipped_region(CARD8 op,
|
||||||
PicturePtr source,
|
PicturePtr source,
|
||||||
PicturePtr mask,
|
PicturePtr mask,
|
||||||
PicturePtr dest,
|
PicturePtr dest,
|
||||||
glamor_pixmap_private *source_pixmap_priv,
|
PixmapPtr source_pixmap,
|
||||||
glamor_pixmap_private *mask_pixmap_priv,
|
PixmapPtr mask_pixmap,
|
||||||
glamor_pixmap_private *dest_pixmap_priv,
|
PixmapPtr dest_pixmap,
|
||||||
RegionPtr region,
|
RegionPtr region,
|
||||||
int x_source,
|
int x_source,
|
||||||
int y_source,
|
int y_source,
|
||||||
int x_mask, int y_mask, int x_dest, int y_dest)
|
int x_mask, int y_mask, int x_dest, int y_dest)
|
||||||
{
|
{
|
||||||
|
glamor_pixmap_private *source_pixmap_priv = glamor_get_pixmap_private(source_pixmap);
|
||||||
|
glamor_pixmap_private *mask_pixmap_priv = glamor_get_pixmap_private(mask_pixmap);
|
||||||
|
glamor_pixmap_private *dest_pixmap_priv = glamor_get_pixmap_private(dest_pixmap);
|
||||||
ScreenPtr screen = dest->pDrawable->pScreen;
|
ScreenPtr screen = dest->pDrawable->pScreen;
|
||||||
PixmapPtr source_pixmap = NULL, mask_pixmap = NULL;
|
|
||||||
PicturePtr temp_src = source, temp_mask = mask;
|
PicturePtr temp_src = source, temp_mask = mask;
|
||||||
|
PixmapPtr temp_src_pixmap = source_pixmap;
|
||||||
|
PixmapPtr temp_mask_pixmap = mask_pixmap;
|
||||||
glamor_pixmap_private *temp_src_priv = source_pixmap_priv;
|
glamor_pixmap_private *temp_src_priv = source_pixmap_priv;
|
||||||
glamor_pixmap_private *temp_mask_priv = mask_pixmap_priv;
|
glamor_pixmap_private *temp_mask_priv = mask_pixmap_priv;
|
||||||
int x_temp_src, y_temp_src, x_temp_mask, y_temp_mask;
|
int x_temp_src, y_temp_src, x_temp_mask, y_temp_mask;
|
||||||
|
@ -1411,12 +1414,6 @@ glamor_composite_clipped_region(CARD8 op,
|
||||||
DEBUGF("clipped (%d %d) (%d %d) (%d %d) width %d height %d \n",
|
DEBUGF("clipped (%d %d) (%d %d) (%d %d) width %d height %d \n",
|
||||||
x_source, y_source, x_mask, y_mask, x_dest, y_dest, width, height);
|
x_source, y_source, x_mask, y_mask, x_dest, y_dest, width, height);
|
||||||
|
|
||||||
if (source_pixmap_priv)
|
|
||||||
source_pixmap = source_pixmap_priv->base.pixmap;
|
|
||||||
|
|
||||||
if (mask_pixmap_priv)
|
|
||||||
mask_pixmap = mask_pixmap_priv->base.pixmap;
|
|
||||||
|
|
||||||
/* XXX is it possible source mask have non-zero drawable.x/y? */
|
/* XXX is it possible source mask have non-zero drawable.x/y? */
|
||||||
if (source
|
if (source
|
||||||
&& ((!source->pDrawable
|
&& ((!source->pDrawable
|
||||||
|
@ -1434,8 +1431,8 @@ glamor_composite_clipped_region(CARD8 op,
|
||||||
temp_src = source;
|
temp_src = source;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
temp_src_priv =
|
temp_src_pixmap = (PixmapPtr) (temp_src->pDrawable);
|
||||||
glamor_get_pixmap_private((PixmapPtr) (temp_src->pDrawable));
|
temp_src_priv = glamor_get_pixmap_private(temp_src_pixmap);
|
||||||
x_temp_src = -extent->x1 + x_dest + dest->pDrawable->x;
|
x_temp_src = -extent->x1 + x_dest + dest->pDrawable->x;
|
||||||
y_temp_src = -extent->y1 + y_dest + dest->pDrawable->y;
|
y_temp_src = -extent->y1 + y_dest + dest->pDrawable->y;
|
||||||
}
|
}
|
||||||
|
@ -1458,8 +1455,8 @@ glamor_composite_clipped_region(CARD8 op,
|
||||||
temp_mask = mask;
|
temp_mask = mask;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
temp_mask_priv =
|
temp_mask_pixmap = (PixmapPtr) (temp_mask->pDrawable);
|
||||||
glamor_get_pixmap_private((PixmapPtr) (temp_mask->pDrawable));
|
temp_mask_priv = glamor_get_pixmap_private(temp_mask_pixmap);
|
||||||
x_temp_mask = -extent->x1 + x_dest + dest->pDrawable->x;
|
x_temp_mask = -extent->x1 + x_dest + dest->pDrawable->x;
|
||||||
y_temp_mask = -extent->y1 + y_dest + dest->pDrawable->y;
|
y_temp_mask = -extent->y1 + y_dest + dest->pDrawable->y;
|
||||||
}
|
}
|
||||||
|
@ -1521,6 +1518,7 @@ glamor_composite_clipped_region(CARD8 op,
|
||||||
DEBUGF("dest %d %d \n", prect[i].x_dst, prect[i].y_dst);
|
DEBUGF("dest %d %d \n", prect[i].x_dst, prect[i].y_dst);
|
||||||
}
|
}
|
||||||
ok = glamor_composite_with_shader(op, temp_src, temp_mask, dest,
|
ok = glamor_composite_with_shader(op, temp_src, temp_mask, dest,
|
||||||
|
temp_src_pixmap, temp_mask_pixmap, dest_pixmap,
|
||||||
temp_src_priv, temp_mask_priv,
|
temp_src_priv, temp_mask_priv,
|
||||||
dest_pixmap_priv,
|
dest_pixmap_priv,
|
||||||
box_cnt, prect, two_pass_ca);
|
box_cnt, prect, two_pass_ca);
|
||||||
|
@ -1553,8 +1551,6 @@ glamor_composite(CARD8 op,
|
||||||
INT16 x_dest, INT16 y_dest, CARD16 width, CARD16 height)
|
INT16 x_dest, INT16 y_dest, CARD16 width, CARD16 height)
|
||||||
{
|
{
|
||||||
ScreenPtr screen = dest->pDrawable->pScreen;
|
ScreenPtr screen = dest->pDrawable->pScreen;
|
||||||
glamor_pixmap_private *dest_pixmap_priv;
|
|
||||||
glamor_pixmap_private *source_pixmap_priv = NULL, *mask_pixmap_priv = NULL;
|
|
||||||
PixmapPtr dest_pixmap = glamor_get_drawable_pixmap(dest->pDrawable);
|
PixmapPtr dest_pixmap = glamor_get_drawable_pixmap(dest->pDrawable);
|
||||||
PixmapPtr source_pixmap = NULL, mask_pixmap = NULL;
|
PixmapPtr source_pixmap = NULL, mask_pixmap = NULL;
|
||||||
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
|
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
|
||||||
|
@ -1563,19 +1559,15 @@ glamor_composite(CARD8 op,
|
||||||
int nbox, ok = FALSE;
|
int nbox, ok = FALSE;
|
||||||
int force_clip = 0;
|
int force_clip = 0;
|
||||||
|
|
||||||
dest_pixmap_priv = glamor_get_pixmap_private(dest_pixmap);
|
|
||||||
|
|
||||||
if (source->pDrawable) {
|
if (source->pDrawable) {
|
||||||
source_pixmap = glamor_get_drawable_pixmap(source->pDrawable);
|
source_pixmap = glamor_get_drawable_pixmap(source->pDrawable);
|
||||||
source_pixmap_priv = glamor_get_pixmap_private(source_pixmap);
|
if (glamor_pixmap_drm_only(source_pixmap))
|
||||||
if (source_pixmap_priv && source_pixmap_priv->type == GLAMOR_DRM_ONLY)
|
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mask && mask->pDrawable) {
|
if (mask && mask->pDrawable) {
|
||||||
mask_pixmap = glamor_get_drawable_pixmap(mask->pDrawable);
|
mask_pixmap = glamor_get_drawable_pixmap(mask->pDrawable);
|
||||||
mask_pixmap_priv = glamor_get_pixmap_private(mask_pixmap);
|
if (glamor_pixmap_drm_only(mask_pixmap))
|
||||||
if (mask_pixmap_priv && mask_pixmap_priv->type == GLAMOR_DRM_ONLY)
|
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1584,9 +1576,8 @@ glamor_composite(CARD8 op,
|
||||||
source_pixmap, x_source, y_source, x_mask, y_mask, x_dest, y_dest,
|
source_pixmap, x_source, y_source, x_mask, y_mask, x_dest, y_dest,
|
||||||
width, height);
|
width, height);
|
||||||
|
|
||||||
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(dest_pixmap_priv)) {
|
if (!glamor_pixmap_has_fbo(dest_pixmap))
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
|
||||||
|
|
||||||
if (op >= ARRAY_SIZE(composite_op_info))
|
if (op >= ARRAY_SIZE(composite_op_info))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@ -1636,28 +1627,28 @@ glamor_composite(CARD8 op,
|
||||||
* pixmap. */
|
* pixmap. */
|
||||||
if (!glamor_check_fbo_size(glamor_priv,
|
if (!glamor_check_fbo_size(glamor_priv,
|
||||||
extent->x2 - extent->x1, extent->y2 - extent->y1)
|
extent->x2 - extent->x1, extent->y2 - extent->y1)
|
||||||
&& (dest_pixmap_priv->type != GLAMOR_TEXTURE_LARGE)
|
&& glamor_pixmap_is_large(dest_pixmap)
|
||||||
&& ((source_pixmap_priv
|
&& ((source_pixmap
|
||||||
&& (source_pixmap_priv->type == GLAMOR_MEMORY ||
|
&& (glamor_pixmap_is_memory(source_pixmap) ||
|
||||||
source->repeatType == RepeatPad))
|
source->repeatType == RepeatPad))
|
||||||
|| (mask_pixmap_priv &&
|
|| (mask_pixmap &&
|
||||||
(mask_pixmap_priv->type == GLAMOR_MEMORY ||
|
(glamor_pixmap_is_memory(mask_pixmap) ||
|
||||||
mask->repeatType == RepeatPad))
|
mask->repeatType == RepeatPad))
|
||||||
|| (!source_pixmap_priv &&
|
|| (!source_pixmap &&
|
||||||
(source->pSourcePict->type != SourcePictTypeSolidFill))
|
(source->pSourcePict->type != SourcePictTypeSolidFill))
|
||||||
|| (!mask_pixmap_priv && mask &&
|
|| (!mask_pixmap && mask &&
|
||||||
mask->pSourcePict->type != SourcePictTypeSolidFill)))
|
mask->pSourcePict->type != SourcePictTypeSolidFill)))
|
||||||
force_clip = 1;
|
force_clip = 1;
|
||||||
|
|
||||||
if (force_clip || dest_pixmap_priv->type == GLAMOR_TEXTURE_LARGE
|
if (force_clip || glamor_pixmap_is_large(dest_pixmap)
|
||||||
|| (source_pixmap_priv
|
|| (source_pixmap
|
||||||
&& source_pixmap_priv->type == GLAMOR_TEXTURE_LARGE)
|
&& glamor_pixmap_is_large(source_pixmap))
|
||||||
|| (mask_pixmap_priv && mask_pixmap_priv->type == GLAMOR_TEXTURE_LARGE))
|
|| (mask_pixmap && glamor_pixmap_is_large(mask_pixmap)))
|
||||||
ok = glamor_composite_largepixmap_region(op,
|
ok = glamor_composite_largepixmap_region(op,
|
||||||
source, mask, dest,
|
source, mask, dest,
|
||||||
source_pixmap_priv,
|
source_pixmap,
|
||||||
mask_pixmap_priv,
|
mask_pixmap,
|
||||||
dest_pixmap_priv,
|
dest_pixmap,
|
||||||
®ion, force_clip,
|
®ion, force_clip,
|
||||||
x_source, y_source,
|
x_source, y_source,
|
||||||
x_mask, y_mask,
|
x_mask, y_mask,
|
||||||
|
@ -1665,9 +1656,9 @@ glamor_composite(CARD8 op,
|
||||||
else
|
else
|
||||||
ok = glamor_composite_clipped_region(op, source,
|
ok = glamor_composite_clipped_region(op, source,
|
||||||
mask, dest,
|
mask, dest,
|
||||||
source_pixmap_priv,
|
source_pixmap,
|
||||||
mask_pixmap_priv,
|
mask_pixmap,
|
||||||
dest_pixmap_priv,
|
dest_pixmap,
|
||||||
®ion,
|
®ion,
|
||||||
x_source, y_source,
|
x_source, y_source,
|
||||||
x_mask, y_mask, x_dest, y_dest);
|
x_mask, y_mask, x_dest, y_dest);
|
||||||
|
@ -1758,21 +1749,27 @@ glamor_composite_glyph_rects(CARD8 op,
|
||||||
if (!(glamor_is_large_picture(src)
|
if (!(glamor_is_large_picture(src)
|
||||||
|| (mask && glamor_is_large_picture(mask))
|
|| (mask && glamor_is_large_picture(mask))
|
||||||
|| glamor_is_large_picture(dst))) {
|
|| glamor_is_large_picture(dst))) {
|
||||||
|
PixmapPtr src_pixmap = NULL;
|
||||||
|
PixmapPtr mask_pixmap = NULL;
|
||||||
|
PixmapPtr dst_pixmap = NULL;
|
||||||
|
PixmapPtr temp_src_pixmap = NULL;
|
||||||
glamor_pixmap_private *src_pixmap_priv = NULL;
|
glamor_pixmap_private *src_pixmap_priv = NULL;
|
||||||
glamor_pixmap_private *mask_pixmap_priv = NULL;
|
glamor_pixmap_private *mask_pixmap_priv = NULL;
|
||||||
glamor_pixmap_private *dst_pixmap_priv;
|
glamor_pixmap_private *dst_pixmap_priv;
|
||||||
glamor_pixmap_private *temp_src_priv = NULL;
|
glamor_pixmap_private *temp_src_priv = NULL;
|
||||||
BoxRec src_extent;
|
BoxRec src_extent;
|
||||||
|
|
||||||
dst_pixmap_priv = glamor_get_pixmap_private
|
dst_pixmap = glamor_get_drawable_pixmap(dst->pDrawable);
|
||||||
(glamor_get_drawable_pixmap(dst->pDrawable));
|
dst_pixmap_priv = glamor_get_pixmap_private(dst_pixmap);
|
||||||
|
|
||||||
if (mask && mask->pDrawable)
|
if (mask && mask->pDrawable) {
|
||||||
mask_pixmap_priv = glamor_get_pixmap_private
|
mask_pixmap = glamor_get_drawable_pixmap(mask->pDrawable);
|
||||||
(glamor_get_drawable_pixmap(mask->pDrawable));
|
mask_pixmap_priv = glamor_get_pixmap_private(mask_pixmap);
|
||||||
if (src->pDrawable)
|
}
|
||||||
src_pixmap_priv = glamor_get_pixmap_private
|
if (src->pDrawable) {
|
||||||
(glamor_get_drawable_pixmap(src->pDrawable));
|
src_pixmap = glamor_get_drawable_pixmap(src->pDrawable);
|
||||||
|
src_pixmap_priv = glamor_get_pixmap_private(src_pixmap);
|
||||||
|
}
|
||||||
|
|
||||||
if (!src->pDrawable
|
if (!src->pDrawable
|
||||||
&& (src->pSourcePict->type != SourcePictTypeSolidFill)) {
|
&& (src->pSourcePict->type != SourcePictTypeSolidFill)) {
|
||||||
|
@ -1788,13 +1785,14 @@ glamor_composite_glyph_rects(CARD8 op,
|
||||||
if (!temp_src)
|
if (!temp_src)
|
||||||
goto fallback;
|
goto fallback;
|
||||||
|
|
||||||
temp_src_priv = glamor_get_pixmap_private
|
temp_src_pixmap = (PixmapPtr) (temp_src->pDrawable);
|
||||||
((PixmapPtr) (temp_src->pDrawable));
|
temp_src_priv = glamor_get_pixmap_private(temp_src_pixmap);
|
||||||
glamor_composite_src_rect_translate(nrect, rects,
|
glamor_composite_src_rect_translate(nrect, rects,
|
||||||
-src_extent.x1, -src_extent.y1);
|
-src_extent.x1, -src_extent.y1);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
temp_src = src;
|
temp_src = src;
|
||||||
|
temp_src_pixmap = src_pixmap;
|
||||||
temp_src_priv = src_pixmap_priv;
|
temp_src_priv = src_pixmap_priv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1802,6 +1800,7 @@ glamor_composite_glyph_rects(CARD8 op,
|
||||||
if (op == PictOpOver) {
|
if (op == PictOpOver) {
|
||||||
if (glamor_composite_with_shader(PictOpOutReverse,
|
if (glamor_composite_with_shader(PictOpOutReverse,
|
||||||
temp_src, mask, dst,
|
temp_src, mask, dst,
|
||||||
|
temp_src_pixmap, mask_pixmap, dst_pixmap,
|
||||||
temp_src_priv,
|
temp_src_priv,
|
||||||
mask_pixmap_priv,
|
mask_pixmap_priv,
|
||||||
dst_pixmap_priv, nrect, rects,
|
dst_pixmap_priv, nrect, rects,
|
||||||
|
@ -1811,7 +1810,9 @@ glamor_composite_glyph_rects(CARD8 op,
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (glamor_composite_with_shader
|
if (glamor_composite_with_shader
|
||||||
(op, temp_src, mask, dst, temp_src_priv, mask_pixmap_priv,
|
(op, temp_src, mask, dst,
|
||||||
|
temp_src_pixmap, mask_pixmap, dst_pixmap,
|
||||||
|
temp_src_priv, mask_pixmap_priv,
|
||||||
dst_pixmap_priv, nrect, rects, FALSE))
|
dst_pixmap_priv, nrect, rects, FALSE))
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,8 @@ glamor_set_destination_drawable(DrawablePtr drawable,
|
||||||
int *p_off_x,
|
int *p_off_x,
|
||||||
int *p_off_y)
|
int *p_off_y)
|
||||||
{
|
{
|
||||||
|
ScreenPtr screen = drawable->pScreen;
|
||||||
|
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
|
||||||
PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
|
PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
|
||||||
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
|
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||||
int off_x, off_y;
|
int off_x, off_y;
|
||||||
|
@ -95,7 +97,7 @@ glamor_set_destination_drawable(DrawablePtr drawable,
|
||||||
scale_x, (off_x + center_adjust) * scale_x - 1.0f,
|
scale_x, (off_x + center_adjust) * scale_x - 1.0f,
|
||||||
scale_y, (off_y + center_adjust) * scale_y - 1.0f);
|
scale_y, (off_y + center_adjust) * scale_y - 1.0f);
|
||||||
|
|
||||||
glamor_set_destination_pixmap_fbo(glamor_pixmap_fbo_at(pixmap_priv, box_x, box_y),
|
glamor_set_destination_pixmap_fbo(glamor_priv, glamor_pixmap_fbo_at(pixmap_priv, box_x, box_y),
|
||||||
0, 0, w, h);
|
0, 0, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,10 +41,10 @@
|
||||||
#define t_from_x_coord_y(_yscale_, _y_) (1.0 - (_y_) * (_yscale_))
|
#define t_from_x_coord_y(_yscale_, _y_) (1.0 - (_y_) * (_yscale_))
|
||||||
#define t_from_x_coord_y_inverted(_yscale_, _y_) ((_y_) * (_yscale_))
|
#define t_from_x_coord_y_inverted(_yscale_, _y_) ((_y_) * (_yscale_))
|
||||||
|
|
||||||
#define pixmap_priv_get_dest_scale(_pixmap_priv_, _pxscale_, _pyscale_) \
|
#define pixmap_priv_get_dest_scale(pixmap, _pixmap_priv_, _pxscale_, _pyscale_) \
|
||||||
do { \
|
do { \
|
||||||
int _w_,_h_; \
|
int _w_,_h_; \
|
||||||
PIXMAP_PRIV_GET_ACTUAL_SIZE(_pixmap_priv_, _w_, _h_); \
|
PIXMAP_PRIV_GET_ACTUAL_SIZE(pixmap, _pixmap_priv_, _w_, _h_); \
|
||||||
*(_pxscale_) = 1.0 / _w_; \
|
*(_pxscale_) = 1.0 / _w_; \
|
||||||
*(_pyscale_) = 1.0 / _h_; \
|
*(_pyscale_) = 1.0 / _h_; \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
@ -55,21 +55,21 @@
|
||||||
*(_pyscale_) = 1.0 / (_pixmap_priv_)->base.fbo->height; \
|
*(_pyscale_) = 1.0 / (_pixmap_priv_)->base.fbo->height; \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
#define PIXMAP_PRIV_GET_ACTUAL_SIZE(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->large.box.x2 - priv->large.box.x1; \
|
||||||
h = priv->large.box.y2 - priv->large.box.y1; \
|
h = priv->large.box.y2 - priv->large.box.y1; \
|
||||||
} else { \
|
} else { \
|
||||||
w = priv->base.pixmap->drawable.width; \
|
w = (pixmap)->drawable.width; \
|
||||||
h = priv->base.pixmap->drawable.height; \
|
h = (pixmap)->drawable.height; \
|
||||||
} \
|
} \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
#define glamor_pixmap_fbo_fix_wh_ratio(wh, priv) \
|
#define glamor_pixmap_fbo_fix_wh_ratio(wh, pixmap, priv) \
|
||||||
do { \
|
do { \
|
||||||
int actual_w, actual_h; \
|
int actual_w, actual_h; \
|
||||||
PIXMAP_PRIV_GET_ACTUAL_SIZE(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->base.fbo->width / actual_w; \
|
||||||
wh[1] = (float)priv->base.fbo->height / actual_h; \
|
wh[1] = (float)priv->base.fbo->height / actual_h; \
|
||||||
wh[2] = 1.0 / priv->base.fbo->width; \
|
wh[2] = 1.0 / priv->base.fbo->width; \
|
||||||
|
@ -189,17 +189,17 @@
|
||||||
txy = xy - bxy1; \
|
txy = xy - bxy1; \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
#define _glamor_get_reflect_transform_coords(priv, repeat_type, \
|
#define _glamor_get_reflect_transform_coords(pixmap, priv, repeat_type, \
|
||||||
tx1, ty1, \
|
tx1, ty1, \
|
||||||
_x1_, _y1_) \
|
_x1_, _y1_) \
|
||||||
do { \
|
do { \
|
||||||
int odd_x, odd_y; \
|
int odd_x, odd_y; \
|
||||||
float c, d; \
|
float c, d; \
|
||||||
fodd_repeat_mod(_x1_,priv->box.x2, \
|
fodd_repeat_mod(_x1_,priv->box.x2, \
|
||||||
priv->base.pixmap->drawable.width, \
|
(pixmap)->drawable.width, \
|
||||||
odd_x, c); \
|
odd_x, c); \
|
||||||
fodd_repeat_mod(_y1_, priv->box.y2, \
|
fodd_repeat_mod(_y1_, priv->box.y2, \
|
||||||
priv->base.pixmap->drawable.height, \
|
(pixmap)->drawable.height, \
|
||||||
odd_y, d); \
|
odd_y, d); \
|
||||||
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); \
|
||||||
|
@ -208,14 +208,14 @@
|
||||||
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->base.fbo->height); \
|
||||||
_glamor_repeat_reflect_fixup(tx1, _x1_, c, odd_x, \
|
_glamor_repeat_reflect_fixup(tx1, _x1_, c, odd_x, \
|
||||||
priv->base.pixmap->drawable.width, \
|
(pixmap)->drawable.width, \
|
||||||
priv->box.x1, priv->box.x2); \
|
priv->box.x1, priv->box.x2); \
|
||||||
_glamor_repeat_reflect_fixup(ty1, _y1_, d, odd_y, \
|
_glamor_repeat_reflect_fixup(ty1, _y1_, d, odd_y, \
|
||||||
priv->base.pixmap->drawable.height, \
|
(pixmap)->drawable.height, \
|
||||||
priv->box.y1, priv->box.y2); \
|
priv->box.y1, priv->box.y2); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
#define _glamor_get_repeat_coords(priv, repeat_type, tx1, \
|
#define _glamor_get_repeat_coords(pixmap, priv, repeat_type, tx1, \
|
||||||
ty1, tx2, ty2, \
|
ty1, tx2, ty2, \
|
||||||
_x1_, _y1_, _x2_, \
|
_x1_, _y1_, _x2_, \
|
||||||
_y2_, c, d, odd_x, odd_y) \
|
_y2_, c, d, odd_x, odd_y) \
|
||||||
|
@ -224,10 +224,10 @@
|
||||||
DEBUGF("x1 y1 %d %d\n", \
|
DEBUGF("x1 y1 %d %d\n", \
|
||||||
_x1_, _y1_ ); \
|
_x1_, _y1_ ); \
|
||||||
DEBUGF("width %d box.x1 %d \n", \
|
DEBUGF("width %d box.x1 %d \n", \
|
||||||
(priv)->base.pixmap->drawable.width, \
|
(pixmap)->drawable.width, \
|
||||||
priv->box.x1); \
|
priv->box.x1); \
|
||||||
if (odd_x) { \
|
if (odd_x) { \
|
||||||
c = (priv)->base.pixmap->drawable.width \
|
c = (pixmap)->drawable.width \
|
||||||
- c; \
|
- c; \
|
||||||
tx1 = c - priv->box.x1; \
|
tx1 = c - priv->box.x1; \
|
||||||
tx2 = tx1 - ((_x2_) - (_x1_)); \
|
tx2 = tx1 - ((_x2_) - (_x1_)); \
|
||||||
|
@ -236,7 +236,7 @@
|
||||||
tx2 = tx1 + ((_x2_) - (_x1_)); \
|
tx2 = tx1 + ((_x2_) - (_x1_)); \
|
||||||
} \
|
} \
|
||||||
if (odd_y){ \
|
if (odd_y){ \
|
||||||
d = (priv)->base.pixmap->drawable.height\
|
d = (pixmap)->drawable.height\
|
||||||
- d; \
|
- d; \
|
||||||
ty1 = d - priv->box.y1; \
|
ty1 = d - priv->box.y1; \
|
||||||
ty2 = ty1 - ((_y2_) - (_y1_)); \
|
ty2 = ty1 - ((_y2_) - (_y1_)); \
|
||||||
|
@ -253,11 +253,11 @@
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
/* _x1_ ... _y2_ may has fractional. */
|
/* _x1_ ... _y2_ may has fractional. */
|
||||||
#define glamor_get_repeat_transform_coords(priv, repeat_type, tx1, \
|
#define glamor_get_repeat_transform_coords(pixmap, priv, repeat_type, tx1, \
|
||||||
ty1, _x1_, _y1_) \
|
ty1, _x1_, _y1_) \
|
||||||
do { \
|
do { \
|
||||||
DEBUGF("width %d box.x1 %d x2 %d y1 %d y2 %d\n", \
|
DEBUGF("width %d box.x1 %d x2 %d y1 %d y2 %d\n", \
|
||||||
(priv)->base.pixmap->drawable.width, \
|
(pixmap)->drawable.width, \
|
||||||
priv->box.x1, priv->box.x2, priv->box.y1, \
|
priv->box.x1, priv->box.x2, priv->box.y1, \
|
||||||
priv->box.y2); \
|
priv->box.y2); \
|
||||||
DEBUGF("x1 %f y1 %f \n", _x1_, _y1_); \
|
DEBUGF("x1 %f y1 %f \n", _x1_, _y1_); \
|
||||||
|
@ -265,33 +265,33 @@
|
||||||
tx1 = _x1_ - priv->box.x1; \
|
tx1 = _x1_ - priv->box.x1; \
|
||||||
ty1 = _y1_ - priv->box.y1; \
|
ty1 = _y1_ - priv->box.y1; \
|
||||||
} else \
|
} else \
|
||||||
_glamor_get_reflect_transform_coords(priv, repeat_type, \
|
_glamor_get_reflect_transform_coords(pixmap, priv, repeat_type, \
|
||||||
tx1, ty1, \
|
tx1, ty1, \
|
||||||
_x1_, _y1_); \
|
_x1_, _y1_); \
|
||||||
DEBUGF("tx1 %f ty1 %f \n", tx1, ty1); \
|
DEBUGF("tx1 %f ty1 %f \n", tx1, ty1); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
/* _x1_ ... _y2_ must be integer. */
|
/* _x1_ ... _y2_ must be integer. */
|
||||||
#define glamor_get_repeat_coords(priv, repeat_type, tx1, \
|
#define glamor_get_repeat_coords(pixmap, priv, repeat_type, tx1, \
|
||||||
ty1, tx2, ty2, _x1_, _y1_, _x2_, \
|
ty1, tx2, ty2, _x1_, _y1_, _x2_, \
|
||||||
_y2_) \
|
_y2_) \
|
||||||
do { \
|
do { \
|
||||||
int c, d; \
|
int c, d; \
|
||||||
int odd_x = 0, odd_y = 0; \
|
int odd_x = 0, odd_y = 0; \
|
||||||
DEBUGF("width %d box.x1 %d x2 %d y1 %d y2 %d\n", \
|
DEBUGF("width %d box.x1 %d x2 %d y1 %d y2 %d\n", \
|
||||||
(priv)->base.pixmap->drawable.width, \
|
(pixmap)->drawable.width, \
|
||||||
priv->box.x1, priv->box.x2, \
|
priv->box.x1, priv->box.x2, \
|
||||||
priv->box.y1, priv->box.y2); \
|
priv->box.y1, priv->box.y2); \
|
||||||
modulus((_x1_), (priv)->base.pixmap->drawable.width, c); \
|
modulus((_x1_), (pixmap)->drawable.width, c); \
|
||||||
modulus((_y1_), (priv)->base.pixmap->drawable.height, d); \
|
modulus((_y1_), (pixmap)->drawable.height, d); \
|
||||||
DEBUGF("c %d d %d \n", c, d); \
|
DEBUGF("c %d d %d \n", c, d); \
|
||||||
if (repeat_type == RepeatReflect) { \
|
if (repeat_type == RepeatReflect) { \
|
||||||
odd_x = abs((_x1_ - c) \
|
odd_x = abs((_x1_ - c) \
|
||||||
/ (priv->base.pixmap->drawable.width)) & 1; \
|
/ ((pixmap)->drawable.width)) & 1; \
|
||||||
odd_y = abs((_y1_ - d) \
|
odd_y = abs((_y1_ - d) \
|
||||||
/ (priv->base.pixmap->drawable.height)) & 1; \
|
/ ((pixmap)->drawable.height)) & 1; \
|
||||||
} \
|
} \
|
||||||
_glamor_get_repeat_coords(priv, repeat_type, tx1, ty1, tx2, ty2,\
|
_glamor_get_repeat_coords(pixmap, priv, repeat_type, tx1, ty1, tx2, ty2, \
|
||||||
_x1_, _y1_, _x2_, _y2_, c, d, \
|
_x1_, _y1_, _x2_, _y2_, c, d, \
|
||||||
odd_x, odd_y); \
|
odd_x, odd_y); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
@ -317,7 +317,7 @@
|
||||||
(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) \
|
||||||
do { \
|
do { \
|
||||||
|
@ -400,7 +400,7 @@
|
||||||
texcoords+4); \
|
texcoords+4); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define glamor_set_repeat_transformed_normalize_tcoords_ext( priv, \
|
#define glamor_set_repeat_transformed_normalize_tcoords_ext(pixmap, priv, \
|
||||||
repeat_type, \
|
repeat_type, \
|
||||||
matrix, \
|
matrix, \
|
||||||
xscale, \
|
xscale, \
|
||||||
|
@ -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((&priv->large), repeat_type, \
|
glamor_get_repeat_transform_coords(pixmap, (&priv->large), repeat_type, \
|
||||||
ttx1, tty1, \
|
ttx1, tty1, \
|
||||||
tx1, ty1); \
|
tx1, ty1); \
|
||||||
glamor_get_repeat_transform_coords((&priv->large), repeat_type, \
|
glamor_get_repeat_transform_coords(pixmap, (&priv->large), repeat_type, \
|
||||||
ttx2, tty2, \
|
ttx2, tty2, \
|
||||||
tx2, ty2); \
|
tx2, ty2); \
|
||||||
glamor_get_repeat_transform_coords((&priv->large), repeat_type, \
|
glamor_get_repeat_transform_coords(pixmap, (&priv->large), repeat_type, \
|
||||||
ttx3, tty3, \
|
ttx3, tty3, \
|
||||||
tx3, ty3); \
|
tx3, ty3); \
|
||||||
glamor_get_repeat_transform_coords((&priv->large), repeat_type, \
|
glamor_get_repeat_transform_coords(pixmap, (&priv->large), 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, \
|
||||||
|
@ -450,7 +450,8 @@
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define glamor_set_repeat_transformed_normalize_tcoords( priv, \
|
#define glamor_set_repeat_transformed_normalize_tcoords( pixmap, \
|
||||||
|
priv, \
|
||||||
repeat_type, \
|
repeat_type, \
|
||||||
matrix, \
|
matrix, \
|
||||||
xscale, \
|
xscale, \
|
||||||
|
@ -459,7 +460,8 @@
|
||||||
_x2_, _y2_, \
|
_x2_, _y2_, \
|
||||||
texcoords) \
|
texcoords) \
|
||||||
do { \
|
do { \
|
||||||
glamor_set_repeat_transformed_normalize_tcoords_ext( priv, \
|
glamor_set_repeat_transformed_normalize_tcoords_ext( pixmap, \
|
||||||
|
priv, \
|
||||||
repeat_type, \
|
repeat_type, \
|
||||||
matrix, \
|
matrix, \
|
||||||
xscale, \
|
xscale, \
|
||||||
|
@ -516,7 +518,7 @@
|
||||||
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(pixmap, priv, repeat_type, \
|
||||||
xscale, yscale, \
|
xscale, yscale, \
|
||||||
_x1_, _y1_, _x2_, _y2_, \
|
_x1_, _y1_, _x2_, _y2_, \
|
||||||
vertices, stride) \
|
vertices, stride) \
|
||||||
|
@ -529,7 +531,7 @@
|
||||||
tx2 = tx1 + ((_x2_) - (_x1_)); \
|
tx2 = tx1 + ((_x2_) - (_x1_)); \
|
||||||
ty2 = ty1 + ((_y2_) - (_y1_)); \
|
ty2 = ty1 + ((_y2_) - (_y1_)); \
|
||||||
} else { \
|
} else { \
|
||||||
glamor_get_repeat_coords((&priv->large), repeat_type, \
|
glamor_get_repeat_coords(pixmap, (&priv->large), repeat_type, \
|
||||||
tx1, ty1, tx2, ty2, \
|
tx1, ty1, tx2, ty2, \
|
||||||
_x1_, _y1_, _x2_, _y2_); \
|
_x1_, _y1_, _x2_, _y2_); \
|
||||||
} \
|
} \
|
||||||
|
@ -791,10 +793,10 @@ static inline GLenum
|
||||||
gl_iformat_for_pixmap(PixmapPtr pixmap)
|
gl_iformat_for_pixmap(PixmapPtr pixmap)
|
||||||
{
|
{
|
||||||
glamor_screen_private *glamor_priv =
|
glamor_screen_private *glamor_priv =
|
||||||
glamor_get_screen_private(pixmap->drawable.pScreen);
|
glamor_get_screen_private((pixmap)->drawable.pScreen);
|
||||||
|
|
||||||
if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP &&
|
if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP &&
|
||||||
(pixmap->drawable.depth == 1 || pixmap->drawable.depth == 8)) {
|
((pixmap)->drawable.depth == 1 || (pixmap)->drawable.depth == 8)) {
|
||||||
return GL_ALPHA;
|
return GL_ALPHA;
|
||||||
} else {
|
} else {
|
||||||
return GL_RGBA;
|
return GL_RGBA;
|
||||||
|
@ -811,7 +813,7 @@ format_for_pixmap(PixmapPtr 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->base.picture->format;
|
||||||
else
|
else
|
||||||
pict_format = format_for_depth(pixmap->drawable.depth);
|
pict_format = format_for_depth((pixmap)->drawable.depth);
|
||||||
|
|
||||||
return pict_format;
|
return pict_format;
|
||||||
}
|
}
|
||||||
|
@ -967,8 +969,8 @@ static inline void
|
||||||
_glamor_dump_pixmap_bits(PixmapPtr pixmap, int x, int y, int w, int h)
|
_glamor_dump_pixmap_bits(PixmapPtr pixmap, int x, int y, int w, int h)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
unsigned char *p = pixmap->devPrivate.ptr;
|
unsigned char *p = (pixmap)->devPrivate.ptr;
|
||||||
int stride = pixmap->devKind;
|
int stride = (pixmap)->devKind;
|
||||||
|
|
||||||
p = p + y * stride + x;
|
p = p + y * stride + x;
|
||||||
|
|
||||||
|
@ -985,8 +987,8 @@ static inline void
|
||||||
_glamor_dump_pixmap_byte(PixmapPtr pixmap, int x, int y, int w, int h)
|
_glamor_dump_pixmap_byte(PixmapPtr pixmap, int x, int y, int w, int h)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
unsigned char *p = pixmap->devPrivate.ptr;
|
unsigned char *p = (pixmap)->devPrivate.ptr;
|
||||||
int stride = pixmap->devKind;
|
int stride = (pixmap)->devKind;
|
||||||
|
|
||||||
p = p + y * stride + x;
|
p = p + y * stride + x;
|
||||||
|
|
||||||
|
@ -1003,8 +1005,8 @@ static inline void
|
||||||
_glamor_dump_pixmap_sword(PixmapPtr pixmap, int x, int y, int w, int h)
|
_glamor_dump_pixmap_sword(PixmapPtr pixmap, int x, int y, int w, int h)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
unsigned short *p = pixmap->devPrivate.ptr;
|
unsigned short *p = (pixmap)->devPrivate.ptr;
|
||||||
int stride = pixmap->devKind / 2;
|
int stride = (pixmap)->devKind / 2;
|
||||||
|
|
||||||
p = p + y * stride + x;
|
p = p + y * stride + x;
|
||||||
|
|
||||||
|
@ -1021,8 +1023,8 @@ static inline void
|
||||||
_glamor_dump_pixmap_word(PixmapPtr pixmap, int x, int y, int w, int h)
|
_glamor_dump_pixmap_word(PixmapPtr pixmap, int x, int y, int w, int h)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
unsigned int *p = pixmap->devPrivate.ptr;
|
unsigned int *p = (pixmap)->devPrivate.ptr;
|
||||||
int stride = pixmap->devKind / 4;
|
int stride = (pixmap)->devKind / 4;
|
||||||
|
|
||||||
p = p + y * stride + x;
|
p = p + y * stride + x;
|
||||||
|
|
||||||
|
@ -1038,11 +1040,11 @@ _glamor_dump_pixmap_word(PixmapPtr pixmap, int x, int y, int w, int h)
|
||||||
static inline void
|
static inline void
|
||||||
glamor_dump_pixmap(PixmapPtr pixmap, int x, int y, int w, int h)
|
glamor_dump_pixmap(PixmapPtr pixmap, int x, int y, int w, int h)
|
||||||
{
|
{
|
||||||
w = ((x + w) > pixmap->drawable.width) ? (pixmap->drawable.width - x) : w;
|
w = ((x + w) > (pixmap)->drawable.width) ? ((pixmap)->drawable.width - x) : w;
|
||||||
h = ((y + h) > pixmap->drawable.height) ? (pixmap->drawable.height - y) : h;
|
h = ((y + h) > (pixmap)->drawable.height) ? ((pixmap)->drawable.height - y) : h;
|
||||||
|
|
||||||
glamor_prepare_access(&pixmap->drawable, GLAMOR_ACCESS_RO);
|
glamor_prepare_access(&(pixmap)->drawable, GLAMOR_ACCESS_RO);
|
||||||
switch (pixmap->drawable.depth) {
|
switch ((pixmap)->drawable.depth) {
|
||||||
case 8:
|
case 8:
|
||||||
_glamor_dump_pixmap_byte(pixmap, x, y, w, h);
|
_glamor_dump_pixmap_byte(pixmap, x, y, w, h);
|
||||||
break;
|
break;
|
||||||
|
@ -1059,9 +1061,9 @@ glamor_dump_pixmap(PixmapPtr pixmap, int x, int y, int w, int h)
|
||||||
_glamor_dump_pixmap_bits(pixmap, x, y, w, h);
|
_glamor_dump_pixmap_bits(pixmap, x, y, w, h);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ErrorF("dump depth %d, not implemented.\n", pixmap->drawable.depth);
|
ErrorF("dump depth %d, not implemented.\n", (pixmap)->drawable.depth);
|
||||||
}
|
}
|
||||||
glamor_finish_access(&pixmap->drawable);
|
glamor_finish_access(&(pixmap)->drawable);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
|
@ -1259,7 +1261,7 @@ glamor_compare_pictures(ScreenPtr screen,
|
||||||
GLAMOR_CREATE_PIXMAP_CPU);
|
GLAMOR_CREATE_PIXMAP_CPU);
|
||||||
|
|
||||||
pixman_pic = CreatePicture(0,
|
pixman_pic = CreatePicture(0,
|
||||||
&pixmap->drawable,
|
&(pixmap)->drawable,
|
||||||
PictureMatchFormat(screen,
|
PictureMatchFormat(screen,
|
||||||
PIXMAN_FORMAT_DEPTH
|
PIXMAN_FORMAT_DEPTH
|
||||||
(format), format), 0, 0,
|
(format), format), 0, 0,
|
||||||
|
@ -1287,7 +1289,7 @@ glamor_compare_pictures(ScreenPtr screen,
|
||||||
GLAMOR_CREATE_PIXMAP_CPU);
|
GLAMOR_CREATE_PIXMAP_CPU);
|
||||||
|
|
||||||
pixman_pic = CreatePicture(0,
|
pixman_pic = CreatePicture(0,
|
||||||
&pixmap->drawable,
|
&(pixmap)->drawable,
|
||||||
PictureMatchFormat(screen,
|
PictureMatchFormat(screen,
|
||||||
PIXMAN_FORMAT_DEPTH
|
PIXMAN_FORMAT_DEPTH
|
||||||
(format), format), 0, 0,
|
(format), format), 0, 0,
|
||||||
|
|
|
@ -241,8 +241,8 @@ glamor_xv_render(glamor_port_private *port_priv)
|
||||||
{
|
{
|
||||||
ScreenPtr screen = port_priv->pPixmap->drawable.pScreen;
|
ScreenPtr screen = port_priv->pPixmap->drawable.pScreen;
|
||||||
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
|
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
|
||||||
glamor_pixmap_private *pixmap_priv =
|
PixmapPtr pixmap = port_priv->pPixmap;
|
||||||
glamor_get_pixmap_private(port_priv->pPixmap);
|
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||||
glamor_pixmap_private *src_pixmap_priv[3];
|
glamor_pixmap_private *src_pixmap_priv[3];
|
||||||
float vertices[32], texcoords[8];
|
float vertices[32], texcoords[8];
|
||||||
BoxPtr box = REGION_RECTS(&port_priv->clip);
|
BoxPtr box = REGION_RECTS(&port_priv->clip);
|
||||||
|
@ -282,10 +282,10 @@ glamor_xv_render(glamor_port_private *port_priv)
|
||||||
off[2] = Loff * yco + Coff * (uco[2] + vco[2]) + bright;
|
off[2] = Loff * yco + Coff * (uco[2] + vco[2]) + bright;
|
||||||
gamma = 1.0;
|
gamma = 1.0;
|
||||||
|
|
||||||
pixmap_priv_get_dest_scale(pixmap_priv, &dst_xscale, &dst_yscale);
|
pixmap_priv_get_dest_scale(pixmap, pixmap_priv, &dst_xscale, &dst_yscale);
|
||||||
glamor_get_drawable_deltas(port_priv->pDraw, port_priv->pPixmap, &dst_x_off,
|
glamor_get_drawable_deltas(port_priv->pDraw, port_priv->pPixmap, &dst_x_off,
|
||||||
&dst_y_off);
|
&dst_y_off);
|
||||||
glamor_set_destination_pixmap_priv_nc(pixmap_priv);
|
glamor_set_destination_pixmap_priv_nc(glamor_priv, pixmap, pixmap_priv);
|
||||||
|
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 3; i++) {
|
||||||
if (port_priv->src_pix[i]) {
|
if (port_priv->src_pix[i]) {
|
||||||
|
|
Loading…
Reference in New Issue