aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/glamor/glamor_largepixmap.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-09-21 18:11:28 +0200
committermarha <marha@users.sourceforge.net>2014-09-21 18:11:28 +0200
commit438af0c7d4bf60b408b259c88205ff2193195466 (patch)
tree46fd6465cb7431f64a3cb475a40587a261983af4 /xorg-server/glamor/glamor_largepixmap.c
parentd0f70707dde032e662dbd5bc70df6ac915403abe (diff)
downloadvcxsrv-438af0c7d4bf60b408b259c88205ff2193195466.tar.gz
vcxsrv-438af0c7d4bf60b408b259c88205ff2193195466.tar.bz2
vcxsrv-438af0c7d4bf60b408b259c88205ff2193195466.zip
libxtrans xkeyboard-config xserver mesa plink glproto git update 21 Sep 2014
plink revision 10233 xserver commit 28337cb14e4347e1dd7936c5393a22e042866687 xkeyboard-config commit 48e1c0b351b6711edc0f167cbb81e4424b75291a glproto commit bd3d751e1eb17efb39f65093271bb4ac071aa9e0 libxtrans commit fb7f198c88e97d22c8c89e76e9cd06b2b2720a96 mesa commit 4eb2bbefd2bf0359aff7ebbb8e931a1c7833606f
Diffstat (limited to 'xorg-server/glamor/glamor_largepixmap.c')
-rw-r--r--xorg-server/glamor/glamor_largepixmap.c96
1 files changed, 58 insertions, 38 deletions
diff --git a/xorg-server/glamor/glamor_largepixmap.c b/xorg-server/glamor/glamor_largepixmap.c
index 5a4bec571..9b2458453 100644
--- a/xorg-server/glamor/glamor_largepixmap.c
+++ b/xorg-server/glamor/glamor_largepixmap.c
@@ -2,6 +2,12 @@
#include "glamor_priv.h"
+static inline glamor_pixmap_private_large_t *
+__glamor_large(glamor_pixmap_private *pixmap_priv) {
+ assert(pixmap_priv->type == GLAMOR_TEXTURE_LARGE);
+ return &pixmap_priv->large;
+}
+
/**
* Clip the boxes regards to each pixmap's block array.
*
@@ -154,9 +160,9 @@ glamor_compute_clipped_regions_ext(glamor_pixmap_private *pixmap_priv,
*result_regions;
int i, j, x, y, k, inner_n_regions;
int width, height;
- glamor_pixmap_private_large_t *priv;
-
- priv = &pixmap_priv->large;
+ BoxPtr box_array;
+ BoxRec small_box;
+ int block_w, block_h;
DEBUGF("ext called \n");
@@ -170,14 +176,16 @@ glamor_compute_clipped_regions_ext(glamor_pixmap_private *pixmap_priv,
clipped_regions[0].block_idx = 0;
RegionCopy(clipped_regions[0].region, region);
*n_region = 1;
- priv->block_w = priv->base.pixmap->drawable.width;
- priv->block_h = priv->base.pixmap->drawable.height;
- priv->box_array = &priv->box;
- priv->box.x1 = priv->box.y1 = 0;
- priv->box.x2 = priv->block_w;
- priv->box.y2 = priv->block_h;
+ block_w = pixmap_priv->base.pixmap->drawable.width;
+ block_h = pixmap_priv->base.pixmap->drawable.height;
+ box_array = &small_box;
+ small_box.x1 = small_box.y1 = 0;
+ small_box.x2 = block_w;
+ small_box.y2 = block_h;
}
else {
+ glamor_pixmap_private_large_t *priv = __glamor_large(pixmap_priv);
+
clipped_regions = __glamor_compute_clipped_regions(priv->block_w,
priv->block_h,
priv->block_wcnt,
@@ -193,20 +201,23 @@ glamor_compute_clipped_regions_ext(glamor_pixmap_private *pixmap_priv,
*n_region = 0;
return NULL;
}
+ block_w = priv->block_w;
+ block_h = priv->block_h;
+ box_array = priv->box_array;
}
- if (inner_block_w >= priv->block_w && inner_block_h >= priv->block_h)
+ if (inner_block_w >= block_w && inner_block_h >= block_h)
return clipped_regions;
result_regions = calloc(*n_region
- * ((priv->block_w + inner_block_w - 1) /
+ * ((block_w + inner_block_w - 1) /
inner_block_w)
- * ((priv->block_h + inner_block_h - 1) /
+ * ((block_h + inner_block_h - 1) /
inner_block_h), sizeof(*result_regions));
k = 0;
for (i = 0; i < *n_region; i++) {
- x = priv->box_array[clipped_regions[i].block_idx].x1;
- y = priv->box_array[clipped_regions[i].block_idx].y1;
- width = priv->box_array[clipped_regions[i].block_idx].x2 - x;
- height = priv->box_array[clipped_regions[i].block_idx].y2 - y;
+ x = box_array[clipped_regions[i].block_idx].x1;
+ y = box_array[clipped_regions[i].block_idx].y1;
+ width = box_array[clipped_regions[i].block_idx].x2 - x;
+ height = box_array[clipped_regions[i].block_idx].y2 - y;
inner_regions = __glamor_compute_clipped_regions(inner_block_w,
inner_block_h,
0, x, y,
@@ -343,8 +354,6 @@ _glamor_compute_clipped_regions(glamor_pixmap_private *pixmap_priv,
int x_center_shift = 0, y_center_shift = 0;
glamor_pixmap_private_large_t *priv;
- priv = &pixmap_priv->large;
-
DEBUGRegionPrint(region);
if (pixmap_priv->type != GLAMOR_TEXTURE_LARGE) {
clipped_regions = calloc(1, sizeof(*clipped_regions));
@@ -355,6 +364,8 @@ _glamor_compute_clipped_regions(glamor_pixmap_private *pixmap_priv,
return clipped_regions;
}
+ priv = __glamor_large(pixmap_priv);
+
pixmap_width = priv->base.pixmap->drawable.width;
pixmap_height = priv->base.pixmap->drawable.height;
if (repeat_type == 0 || repeat_type == RepeatPad) {
@@ -751,7 +762,7 @@ glamor_merge_clipped_regions(glamor_pixmap_private *pixmap_priv,
int pixmap_width, pixmap_height;
glamor_pixmap_private_large_t *priv;
- priv = &pixmap_priv->large;
+ priv = __glamor_large(pixmap_priv);
pixmap_width = priv->base.pixmap->drawable.width;
pixmap_height = priv->base.pixmap->drawable.height;
@@ -970,7 +981,7 @@ _glamor_process_transformed_clipped_region(glamor_pixmap_private *priv,
need_clean_fbo);
}
else {
- SET_PIXMAP_FBO_CURRENT(priv, clipped_regions[0].block_idx);
+ glamor_set_pixmap_fbo_current(priv, clipped_regions[0].block_idx);
if (repeat_type == RepeatReflect || repeat_type == RepeatNormal) {
/* The required source areas are in one region,
* we need to shift the corresponding box's coords to proper position,
@@ -985,15 +996,15 @@ _glamor_process_transformed_clipped_region(glamor_pixmap_private *priv,
shift_y = (temp_box->y1 - rem) / priv->base.pixmap->drawable.height;
if (shift_x != 0) {
- priv->large.box.x1 +=
+ __glamor_large(priv)->box.x1 +=
shift_x * priv->base.pixmap->drawable.width;
- priv->large.box.x2 +=
+ __glamor_large(priv)->box.x2 +=
shift_x * priv->base.pixmap->drawable.width;
}
if (shift_y != 0) {
- priv->large.box.y1 +=
+ __glamor_large(priv)->box.y1 +=
shift_y * priv->base.pixmap->drawable.height;
- priv->large.box.y2 +=
+ __glamor_large(priv)->box.y2 +=
shift_y * priv->base.pixmap->drawable.height;
}
}
@@ -1028,6 +1039,7 @@ glamor_composite_largepixmap_region(CARD8 op,
int is_normal_source_fbo = 0;
int is_normal_mask_fbo = 0;
int fixed_block_width, fixed_block_height;
+ int dest_block_width, dest_block_height;
int null_source, null_mask;
glamor_pixmap_private *need_free_source_pixmap_priv = NULL;
glamor_pixmap_private *need_free_mask_pixmap_priv = NULL;
@@ -1044,8 +1056,16 @@ glamor_composite_largepixmap_region(CARD8 op,
else
mask_repeat_type = RepeatNone;
- fixed_block_width = dest_pixmap_priv->large.block_w;
- fixed_block_height = dest_pixmap_priv->large.block_h;
+ if (dest_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
+ dest_block_width = __glamor_large(dest_pixmap_priv)->block_w;
+ dest_block_height = __glamor_large(dest_pixmap_priv)->block_h;
+ } else {
+ dest_block_width = dest_pixmap_priv->base.pixmap->drawable.width;
+ dest_block_height = dest_pixmap_priv->base.pixmap->drawable.height;
+ }
+ fixed_block_width = dest_block_width;
+ fixed_block_height = dest_block_height;
+
/* If we got an totally out-of-box region for a source or mask
* region without repeat, we need to set it as null_source and
* give it a solid color (0,0,0,0). */
@@ -1071,8 +1091,8 @@ glamor_composite_largepixmap_region(CARD8 op,
int source_transformed_block_width, source_transformed_block_height;
if (!glamor_get_transform_block_size(source->transform,
- source_pixmap_priv->large.block_w,
- source_pixmap_priv->large.block_h,
+ __glamor_large(source_pixmap_priv)->block_w,
+ __glamor_large(source_pixmap_priv)->block_h,
&source_transformed_block_width,
&source_transformed_block_height))
{
@@ -1093,8 +1113,8 @@ glamor_composite_largepixmap_region(CARD8 op,
int mask_transformed_block_width, mask_transformed_block_height;
if (!glamor_get_transform_block_size(mask->transform,
- mask_pixmap_priv->large.block_w,
- mask_pixmap_priv->large.block_h,
+ __glamor_large(mask_pixmap_priv)->block_w,
+ __glamor_large(mask_pixmap_priv)->block_h,
&mask_transformed_block_width,
&mask_transformed_block_height)) {
DEBUGF("mask block size less than 1, fallback.\n");
@@ -1111,8 +1131,8 @@ glamor_composite_largepixmap_region(CARD8 op,
/*compute the correct block width and height whose transformed source/mask
*region can fit into one texture.*/
- if (force_clip || fixed_block_width < dest_pixmap_priv->large.block_w
- || fixed_block_height < dest_pixmap_priv->large.block_h)
+ if (force_clip || fixed_block_width < dest_block_width
+ || fixed_block_height < dest_block_height)
clipped_dest_regions =
glamor_compute_clipped_regions_ext(dest_pixmap_priv, region,
&n_dest_regions,
@@ -1140,7 +1160,7 @@ glamor_composite_largepixmap_region(CARD8 op,
DEBUGF("dest region %d idx %d\n", i,
clipped_dest_regions[i].block_idx);
DEBUGRegionPrint(clipped_dest_regions[i].region);
- SET_PIXMAP_FBO_CURRENT(dest_pixmap_priv,
+ glamor_set_pixmap_fbo_current(dest_pixmap_priv,
clipped_dest_regions[i].block_idx);
if (source_pixmap_priv &&
source_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
@@ -1180,7 +1200,7 @@ glamor_composite_largepixmap_region(CARD8 op,
DEBUGF("source clipped result %d region: \n", n_source_regions);
for (j = 0; j < n_source_regions; j++) {
if (is_normal_source_fbo)
- SET_PIXMAP_FBO_CURRENT(source_pixmap_priv,
+ glamor_set_pixmap_fbo_current(source_pixmap_priv,
clipped_source_regions[j].block_idx);
if (mask_pixmap_priv &&
@@ -1267,12 +1287,12 @@ glamor_composite_largepixmap_region(CARD8 op,
clipped_mask_regions[k].block_idx);
DEBUGRegionPrint(clipped_mask_regions[k].region);
if (is_normal_mask_fbo) {
- SET_PIXMAP_FBO_CURRENT(mask_pixmap_priv,
+ glamor_set_pixmap_fbo_current(mask_pixmap_priv,
clipped_mask_regions[k].
block_idx);
DEBUGF("mask fbo off %d %d \n",
- mask_pixmap_priv->large.box.x1,
- mask_pixmap_priv->large.box.y1);
+ __glamor_large(mask_pixmap_priv)->box.x1,
+ __glamor_large(mask_pixmap_priv)->box.y1);
DEBUGF("start composite mask hasn't transform.\n");
RegionTranslate(clipped_mask_regions[k].region,
x_dest - x_mask +
@@ -1378,7 +1398,7 @@ glamor_composite_largepixmap_region(CARD8 op,
clipped_mask_regions[k].block_idx);
DEBUGRegionPrint(clipped_mask_regions[k].region);
if (is_normal_mask_fbo) {
- SET_PIXMAP_FBO_CURRENT(mask_pixmap_priv,
+ glamor_set_pixmap_fbo_current(mask_pixmap_priv,
clipped_mask_regions[k].
block_idx);
RegionTranslate(clipped_mask_regions[k].region,