diff --git a/src/i830_render.c b/src/i830_render.c
index 3f3d2ef..c12e87b 100644
--- a/src/i830_render.c
+++ b/src/i830_render.c
@@ -563,8 +563,7 @@ i830_prepare_composite(int op, PicturePtr source_picture,
intel->s8_blendctl = blendctl;
}
- if(intel_pixmap_is_dirty(source) ||
- (mask && intel_pixmap_is_dirty(mask)))
+ if (intel_pixmap_is_dirty(source) || intel_pixmap_is_dirty(mask))
intel_batch_emit_flush(scrn);
intel->needs_render_state_emit = TRUE;
diff --git a/src/i915_render.c b/src/i915_render.c
index 87d2336..2f67fe3 100644
--- a/src/i915_render.c
+++ b/src/i915_render.c
@@ -763,7 +763,6 @@ i915_prepare_composite(int op, PicturePtr source_picture,
if (!intel_get_aperture_space(scrn, bo_table, ARRAY_SIZE(bo_table)))
return FALSE;
- intel->needs_render_ca_pass = FALSE;
if (mask_picture != NULL && mask_picture->componentAlpha &&
PICT_FORMAT_RGB(mask_picture->format)) {
/* Check if it's component alpha that relies on a source alpha
@@ -771,12 +770,8 @@ i915_prepare_composite(int op, PicturePtr source_picture,
* into the single source value that we get to blend with.
*/
if (i915_blend_op[op].src_alpha &&
- (i915_blend_op[op].src_blend != BLENDFACT_ZERO)) {
- if (op != PictOpOver)
- return FALSE;
-
- intel->needs_render_ca_pass = TRUE;
- }
+ (i915_blend_op[op].src_blend != BLENDFACT_ZERO))
+ return FALSE;
}
intel->transform[0] = NULL;
@@ -816,11 +811,7 @@ i915_prepare_composite(int op, PicturePtr source_picture,
intel->i915_render_state.op = op;
- /* BUF_INFO is an implicit flush */
- if (dest != intel->render_current_dest)
- intel_batch_do_flush(scrn);
- else if((source && intel_pixmap_is_dirty(source)) ||
- (mask && intel_pixmap_is_dirty(mask)))
+ if (intel_pixmap_is_dirty(source) || intel_pixmap_is_dirty(mask))
intel_batch_emit_flush(scrn);
intel->needs_render_state_emit = TRUE;
@@ -1020,11 +1011,9 @@ static void i915_emit_composite_setup(ScrnInfoPtr scrn)
* XXX However for reasons unfathomed, correct rendering in KDE requires
* at least a MI_FLUSH | INHIBIT_RENDER_CACHE_FLUSH here.
*/
- if (1 || dest != intel->render_current_dest) {
+ if (1) {
uint32_t tiling_bits;
- intel_batch_do_flush(scrn);
-
if (intel_pixmap_tiled(dest)) {
tiling_bits = BUF_3D_TILED_SURFACE;
if (intel_get_pixmap_private(dest)->tiling
@@ -1050,8 +1039,6 @@ static void i915_emit_composite_setup(ScrnInfoPtr scrn)
DRAW_XMAX(dest->drawable.width - 1));
/* yorig, xorig (relate to color buffer?) */
OUT_BATCH(0x00000000);
-
- intel->render_current_dest = dest;
}
{
@@ -1074,18 +1061,12 @@ static void i915_emit_composite_setup(ScrnInfoPtr scrn)
t++;
}
- if (intel->needs_render_ca_pass) {
- OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 | I1_LOAD_S(2) | 0);
- OUT_BATCH(ss2);
- } else {
- OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 | I1_LOAD_S(2) | I1_LOAD_S(6) | 1);
- OUT_BATCH(ss2);
- OUT_BATCH(i915_get_blend_cntl(op, mask_picture, dest_picture->format));
- }
+ OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 | I1_LOAD_S(2) | I1_LOAD_S(6) | 1);
+ OUT_BATCH(ss2);
+ OUT_BATCH(i915_get_blend_cntl(op, mask_picture, dest_picture->format));
}
- if (! intel->needs_render_ca_pass)
- i915_composite_emit_shader(intel, op);
+ i915_composite_emit_shader(intel, op);
}
void
@@ -1130,14 +1111,6 @@ i915_composite(PixmapPtr dest, int srcX, int srcY, int maskX, int maskY,
}
if (intel->prim_offset == 0) {
- if (intel->needs_render_ca_pass) {
- OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 | I1_LOAD_S(6) | 0);
- OUT_BATCH(i915_get_blend_cntl(PictOpOutReverse,
- intel->render_mask_picture,
- intel->render_dest_picture->format));
- i915_composite_emit_shader(intel, PictOpOutReverse);
- }
-
intel->prim_offset = intel->batch_used;
OUT_BATCH(PRIM3D_RECTLIST | PRIM3D_INDIRECT_SEQUENTIAL);
OUT_BATCH(intel->vertex_index);
@@ -1162,16 +1135,6 @@ i915_vertex_flush(intel_screen_private *intel)
intel->batch_ptr[intel->prim_offset] |= intel->vertex_count;
intel->prim_offset = 0;
- if (intel->needs_render_ca_pass) {
- OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 | I1_LOAD_S(6) | 0);
- OUT_BATCH(i915_get_blend_cntl(PictOpAdd,
- intel->render_mask_picture,
- intel->render_dest_picture->format));
- i915_composite_emit_shader(intel, PictOpAdd);
- OUT_BATCH(PRIM3D_RECTLIST | PRIM3D_INDIRECT_SEQUENTIAL | intel->vertex_count);
- OUT_BATCH(intel->vertex_index);
- }
-
intel->vertex_index += intel->vertex_count;
intel->vertex_count = 0;
}
@@ -1180,6 +1143,5 @@ void
i915_batch_commit_notify(intel_screen_private *intel)
{
intel->needs_render_state_emit = TRUE;
- intel->render_current_dest = NULL;
intel->last_floats_per_vertex = 0;
}
diff --git a/src/i965_render.c b/src/i965_render.c
index 8907139..b981ecc 100644
--- a/src/i965_render.c
+++ b/src/i965_render.c
@@ -2035,8 +2035,7 @@ i965_prepare_composite(int op, PicturePtr source_picture,
}
/* Flush any pending writes prior to relocating the textures. */
- if (intel_pixmap_is_dirty(source) ||
- (mask && intel_pixmap_is_dirty(mask)))
+ if (intel_pixmap_is_dirty(source) || intel_pixmap_is_dirty(mask))
intel_batch_emit_flush(scrn);
composite_op->op = op;
diff --git a/src/intel.h b/src/intel.h
index 69f7c72..9098994 100644
--- a/src/intel.h
+++ b/src/intel.h
@@ -82,12 +82,12 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
struct intel_pixmap {
dri_bo *bo;
- struct list flush, batch, in_flight;
+ struct list batch;
uint16_t stride;
uint8_t tiling;
int8_t busy :2;
- int8_t batch_write :1;
+ int8_t dirty :1;
int8_t offscreen :1;
int8_t pinned :1;
};
@@ -121,7 +121,7 @@ static inline void intel_set_pixmap_private(PixmapPtr pixmap, struct intel_pixma
static inline Bool intel_pixmap_is_dirty(PixmapPtr pixmap)
{
- return !list_is_empty(&intel_get_pixmap_private(pixmap)->flush);
+ return pixmap && intel_get_pixmap_private(pixmap)->dirty;
}
static inline Bool intel_pixmap_tiled(PixmapPtr pixmap)
@@ -188,8 +188,6 @@ typedef struct intel_screen_private {
/** Ending batch_used that was verified by intel_start_batch_atomic() */
int batch_atomic_limit;
struct list batch_pixmaps;
- struct list flush_pixmaps;
- struct list in_flight;
drm_intel_bo *wa_scratch_bo;
OsTimerPtr cache_expire;
@@ -271,13 +269,11 @@ typedef struct intel_screen_private {
PicturePtr render_source_picture, render_mask_picture, render_dest_picture;
CARD32 render_source_solid;
CARD32 render_mask_solid;
- PixmapPtr render_current_dest;
Bool render_source_is_solid;
Bool render_mask_is_solid;
Bool needs_3d_invariant;
Bool needs_render_state_emit;
Bool needs_render_vertex_emit;
- Bool needs_render_ca_pass;
/* i830 render accel state */
uint32_t render_dest_format;
diff --git a/src/intel_batchbuffer.c b/src/intel_batchbuffer.c
index 2b8fbb6..2719c38 100644
--- a/src/intel_batchbuffer.c
+++ b/src/intel_batchbuffer.c
@@ -114,29 +114,15 @@ void intel_batch_teardown(ScrnInfoPtr scrn)
while (!list_is_empty(&intel->batch_pixmaps))
list_del(intel->batch_pixmaps.next);
-
- while (!list_is_empty(&intel->flush_pixmaps))
- list_del(intel->flush_pixmaps.next);
-
- while (!list_is_empty(&intel->in_flight)) {
- struct intel_pixmap *entry;
-
- entry = list_first_entry(&intel->in_flight,
- struct intel_pixmap,
- in_flight);
-
- dri_bo_unreference(entry->bo);
- list_del(&entry->in_flight);
- free(entry);
- }
}
-void intel_batch_do_flush(ScrnInfoPtr scrn)
+static void intel_batch_do_flush(ScrnInfoPtr scrn)
{
intel_screen_private *intel = intel_get_screen_private(scrn);
+ struct intel_pixmap *priv;
- while (!list_is_empty(&intel->flush_pixmaps))
- list_del(intel->flush_pixmaps.next);
+ list_for_each_entry(priv, &intel->batch_pixmaps, batch)
+ priv->dirty = 0;
}
static void intel_emit_post_sync_nonzero_flush(ScrnInfoPtr scrn)
@@ -280,25 +266,10 @@ void intel_batch_submit(ScrnInfoPtr scrn)
batch);
entry->busy = -1;
- entry->batch_write = 0;
+ entry->dirty = 0;
list_del(&entry->batch);
}
- while (!list_is_empty(&intel->flush_pixmaps))
- list_del(intel->flush_pixmaps.next);
-
- while (!list_is_empty(&intel->in_flight)) {
- struct intel_pixmap *entry;
-
- entry = list_first_entry(&intel->in_flight,
- struct intel_pixmap,
- in_flight);
-
- dri_bo_unreference(entry->bo);
- list_del(&entry->in_flight);
- free(entry);
- }
-
if (intel->debug_flush & DEBUG_FLUSH_WAIT)
drm_intel_bo_wait_rendering(intel->batch_bo);
diff --git a/src/intel_batchbuffer.h b/src/intel_batchbuffer.h
index f5f118e..b2bb390 100644
--- a/src/intel_batchbuffer.h
+++ b/src/intel_batchbuffer.h
@@ -36,7 +36,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
void intel_batch_init(ScrnInfoPtr scrn);
void intel_batch_teardown(ScrnInfoPtr scrn);
void intel_batch_emit_flush(ScrnInfoPtr scrn);
-void intel_batch_do_flush(ScrnInfoPtr scrn);
void intel_batch_submit(ScrnInfoPtr scrn);
static inline int intel_batch_space(intel_screen_private *intel)
@@ -132,10 +131,8 @@ intel_batch_mark_pixmap_domains(intel_screen_private *intel,
if (list_is_empty(&priv->batch))
list_add(&priv->batch, &intel->batch_pixmaps);
- if (write_domain && list_is_empty(&priv->flush))
- list_add(&priv->flush, &intel->flush_pixmaps);
- priv->batch_write |= write_domain != 0;
+ priv->dirty |= write_domain != 0;
priv->busy = 1;
intel->needs_flush |= write_domain != 0;
diff --git a/src/intel_dri.c b/src/intel_dri.c
index f6f0c86..a5ed545 100644
--- a/src/intel_dri.c
+++ b/src/intel_dri.c
@@ -553,7 +553,8 @@ I830DRI2CopyRegion(DrawablePtr drawable, RegionPtr pRegion,
ValidateGC(dst, gc);
/* Wait for the scanline to be outside the region to be copied */
- if (pixmap_is_scanout(get_drawable_pixmap(dst)) &&
+ if (scrn->vtSema &&
+ pixmap_is_scanout(get_drawable_pixmap(dst)) &&
intel->swapbuffers_wait && INTEL_INFO(intel)->gen < 60) {
BoxPtr box;
BoxRec crtcbox;
diff --git a/src/intel_driver.c b/src/intel_driver.c
index e2e43fa..4265de8 100644
--- a/src/intel_driver.c
+++ b/src/intel_driver.c
@@ -402,8 +402,6 @@ static int intel_init_bufmgr(intel_screen_private *intel)
drm_intel_bufmgr_gem_enable_fenced_relocs(intel->bufmgr);
list_init(&intel->batch_pixmaps);
- list_init(&intel->flush_pixmaps);
- list_init(&intel->in_flight);
if ((INTEL_INFO(intel)->gen == 60)) {
intel->wa_scratch_bo =
@@ -1013,13 +1011,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr screen, int argc, char **argv)
"Hardware cursor initialization failed\n");
}
- /* Must force it before EnterVT, so we are in control of VT and
- * later memory should be bound when allocating, e.g rotate_mem */
- scrn->vtSema = TRUE;
-
- if (!I830EnterVT(scrnIndex, 0))
- return FALSE;
-
intel->BlockHandler = screen->BlockHandler;
screen->BlockHandler = I830BlockHandler;
@@ -1092,7 +1083,11 @@ I830ScreenInit(int scrnIndex, ScreenPtr screen, int argc, char **argv)
I830UeventInit(scrn);
#endif
- return TRUE;
+ /* Must force it before EnterVT, so we are in control of VT and
+ * later memory should be bound when allocating, e.g rotate_mem */
+ scrn->vtSema = TRUE;
+
+ return I830EnterVT(scrnIndex, 0);
}
static void i830AdjustFrame(int scrnIndex, int x, int y, int flags)
diff --git a/src/intel_driver.h b/src/intel_driver.h
index e9d6d9e..98973e5 100644
--- a/src/intel_driver.h
+++ b/src/intel_driver.h
@@ -190,6 +190,7 @@
#define PCI_CHIP_IVYBRIDGE_D_GT1 0x0152
#define PCI_CHIP_IVYBRIDGE_D_GT2 0x0162
#define PCI_CHIP_IVYBRIDGE_S_GT1 0x015a
+#define PCI_CHIP_IVYBRIDGE_S_GT2 0x016a
#endif
diff --git a/src/intel_module.c b/src/intel_module.c
index 2c0e5cc..c6f94f5 100644
--- a/src/intel_module.c
+++ b/src/intel_module.c
@@ -142,6 +142,7 @@ static const SymTabRec _intel_chipsets[] = {
{PCI_CHIP_IVYBRIDGE_D_GT1, "Ivybridge Desktop (GT1)" },
{PCI_CHIP_IVYBRIDGE_D_GT2, "Ivybridge Desktop (GT2)" },
{PCI_CHIP_IVYBRIDGE_S_GT1, "Ivybridge Server" },
+ {PCI_CHIP_IVYBRIDGE_S_GT2, "Ivybridge Server (GT2)" },
{-1, NULL}
};
#define NUM_CHIPSETS (sizeof(_intel_chipsets) / sizeof(_intel_chipsets[0]))
@@ -210,6 +211,7 @@ static const struct pci_id_match intel_device_match[] = {
INTEL_DEVICE_MATCH (PCI_CHIP_IVYBRIDGE_D_GT1, &intel_ivybridge_info ),
INTEL_DEVICE_MATCH (PCI_CHIP_IVYBRIDGE_D_GT2, &intel_ivybridge_info ),
INTEL_DEVICE_MATCH (PCI_CHIP_IVYBRIDGE_S_GT1, &intel_ivybridge_info ),
+ INTEL_DEVICE_MATCH (PCI_CHIP_IVYBRIDGE_S_GT2, &intel_ivybridge_info ),
{ 0, 0, 0 },
};
diff --git a/src/intel_uxa.c b/src/intel_uxa.c
index ed4f375..0b1a369 100644
--- a/src/intel_uxa.c
+++ b/src/intel_uxa.c
@@ -628,12 +628,9 @@ dri_bo *intel_get_pixmap_bo(PixmapPtr pixmap)
void intel_set_pixmap_bo(PixmapPtr pixmap, dri_bo * bo)
{
- ScrnInfoPtr scrn = xf86Screens[pixmap->drawable.pScreen->myNum];
- intel_screen_private *intel = intel_get_screen_private(scrn);
struct intel_pixmap *priv;
priv = intel_get_pixmap_private(pixmap);
-
if (priv == NULL && bo == NULL)
return;
@@ -641,19 +638,11 @@ void intel_set_pixmap_bo(PixmapPtr pixmap, dri_bo * bo)
if (priv->bo == bo)
return;
- if (list_is_empty(&priv->batch)) {
- dri_bo_unreference(priv->bo);
- } else if (!drm_intel_bo_is_reusable(priv->bo)) {
- dri_bo_unreference(priv->bo);
- list_del(&priv->batch);
- list_del(&priv->flush);
- } else {
- list_add(&priv->in_flight, &intel->in_flight);
- priv = NULL;
- }
+ dri_bo_unreference(priv->bo);
+ list_del(&priv->batch);
- if (intel->render_current_dest == pixmap)
- intel->render_current_dest = NULL;
+ free(priv);
+ priv = NULL;
}
if (bo != NULL) {
@@ -661,14 +650,11 @@ void intel_set_pixmap_bo(PixmapPtr pixmap, dri_bo * bo)
uint32_t swizzle_mode;
int ret;
- if (priv == NULL) {
- priv = calloc(1, sizeof (struct intel_pixmap));
- if (priv == NULL)
- goto BAIL;
+ priv = calloc(1, sizeof (struct intel_pixmap));
+ if (priv == NULL)
+ goto BAIL;
- list_init(&priv->batch);
- list_init(&priv->flush);
- }
+ list_init(&priv->batch);
dri_bo_reference(bo);
priv->bo = bo;
@@ -683,11 +669,6 @@ void intel_set_pixmap_bo(PixmapPtr pixmap, dri_bo * bo)
priv->tiling = tiling;
priv->busy = -1;
priv->offscreen = 1;
- } else {
- if (priv != NULL) {
- free(priv);
- priv = NULL;
- }
}
BAIL:
@@ -717,8 +698,7 @@ static Bool intel_uxa_prepare_access(PixmapPtr pixmap, uxa_access_t access)
/* When falling back to swrast, flush all pending operations */
intel_glamor_flush(intel);
- if (!list_is_empty(&priv->batch) &&
- (access == UXA_ACCESS_RW || priv->batch_write))
+ if (access == UXA_ACCESS_RW || priv->dirty)
intel_batch_submit(scrn);
assert(bo->size <= intel->max_gtt_map_size);
@@ -1088,45 +1068,6 @@ intel_uxa_create_pixmap(ScreenPtr screen, int w, int h, int depth,
if (size > intel->max_bo_size || stride >= KB(32))
goto fallback_pixmap;
- /* Perform a preliminary search for an in-flight bo */
- if (usage != UXA_CREATE_PIXMAP_FOR_MAP) {
- int aligned_h;
-
- if (tiling == I915_TILING_X)
- aligned_h = ALIGN(h, 8);
- else if (tiling == I915_TILING_Y)
- aligned_h = ALIGN(h, 32);
- else
- aligned_h = ALIGN(h, 2);
-
- list_for_each_entry(priv, &intel->in_flight, in_flight) {
- if (priv->tiling != tiling)
- continue;
-
- if (tiling == I915_TILING_NONE) {
- if (priv->bo->size < size)
- continue;
-
- priv->stride = stride;
- } else {
- if (priv->stride < stride ||
- priv->bo->size < priv->stride * aligned_h)
- continue;
-
- stride = priv->stride;
- }
-
- list_del(&priv->in_flight);
- intel_set_pixmap_private(pixmap, priv);
-
- screen->ModifyPixmapHeader(pixmap, w, h, 0, 0, stride, NULL);
-
- if (!intel_glamor_create_textured_pixmap(pixmap))
- goto fallback_glamor;
- return pixmap;
- }
- }
-
priv = calloc(1, sizeof (struct intel_pixmap));
if (priv == NULL)
goto fallback_pixmap;
@@ -1151,7 +1092,6 @@ intel_uxa_create_pixmap(ScreenPtr screen, int w, int h, int depth,
priv->offscreen = 1;
list_init(&priv->batch);
- list_init(&priv->flush);
intel_set_pixmap_private(pixmap, priv);
screen->ModifyPixmapHeader(pixmap, w, h, 0, 0, stride, NULL);
@@ -1311,7 +1251,6 @@ Bool intel_uxa_init(ScreenPtr screen)
intel->uxa_driver->uxa_major = 1;
intel->uxa_driver->uxa_minor = 0;
- intel->render_current_dest = NULL;
intel->prim_offset = 0;
intel->vertex_count = 0;
intel->vertex_offset = 0;
diff --git a/src/intel_video.c b/src/intel_video.c
index 25f6483..0834bb2 100644
--- a/src/intel_video.c
+++ b/src/intel_video.c
@@ -1285,7 +1285,7 @@ intel_wait_for_scanline(ScrnInfoPtr scrn, PixmapPtr pixmap,
int y1, y2;
pipe = -1;
- if (pixmap_is_scanout(pixmap))
+ if (scrn->vtSema && pixmap_is_scanout(pixmap))
pipe = intel_crtc_to_pipe(crtc);
if (pipe < 0)
return;
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 676125d..3e4f17f 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -1993,6 +1993,10 @@ sna_covering_crtc(ScrnInfoPtr scrn,
int best_coverage, c;
BoxRec best_crtc_box;
+ /* If we do not own the VT, we do not own the CRTC either */
+ if (!scrn->vtSema)
+ return NULL;
+
DBG(("%s for box=(%d, %d), (%d, %d)\n",
__FUNCTION__, box->x1, box->y1, box->x2, box->y2));
diff --git a/uxa/uxa-glyphs.c b/uxa/uxa-glyphs.c
index 6172f2f..921b99c 100644
--- a/uxa/uxa-glyphs.c
+++ b/uxa/uxa-glyphs.c
@@ -663,190 +663,6 @@ uxa_glyph_cache(ScreenPtr screen, GlyphPtr glyph, int *out_x, int *out_y)
return cache->picture;
}
-static int
-uxa_glyphs_to_dst(CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- INT16 src_x, INT16 src_y,
- INT16 xDst, INT16 yDst,
- int nlist, GlyphListPtr list, GlyphPtr * glyphs,
- BoxPtr extents)
-{
- ScreenPtr screen = pDst->pDrawable->pScreen;
- uxa_screen_t *uxa_screen = uxa_get_screen(screen);
- PixmapPtr src_pixmap, dst_pixmap;
- PicturePtr localSrc, glyph_atlas;
- int x, y, n;
- BoxRec box;
-
- if (uxa_screen->info->check_composite_texture &&
- uxa_screen->info->check_composite_texture(screen, pSrc)) {
- if (pSrc->pDrawable) {
- int src_off_x, src_off_y;
-
- src_pixmap = uxa_get_offscreen_pixmap(pSrc->pDrawable, &src_off_x, &src_off_y);
- if (src_pixmap == NULL)
- return -1;
-
- src_x += pSrc->pDrawable->x + src_off_x;
- src_y += pSrc->pDrawable->y + src_off_y;
- } else {
- src_pixmap = NULL;
- }
- localSrc = pSrc;
- } else {
- int width, height;
-
- if (extents == NULL) {
- uxa_glyph_extents(nlist, list, glyphs, &box);
- extents = &box;
- }
-
- width = extents->x2 - extents->x1;
- height = extents->y2 - extents->y1;
- if (width == 0 || height == 0)
- return 0;
-
- if (pSrc->pDrawable) {
- int src_off_x, src_off_y;
-
- src_off_x = extents->x1 - xDst;
- src_off_y = extents->y1 - yDst;
- localSrc = uxa_acquire_drawable(screen, pSrc,
- src_x + src_off_x, src_y + src_off_y,
- width, height,
- &src_x, &src_y);
- if (uxa_screen->info->check_composite_texture &&
- !uxa_screen->info->check_composite_texture(screen, localSrc)) {
- if (localSrc != pSrc)
- FreePicture(localSrc, 0);
- return -1;
- }
-
- src_pixmap = uxa_get_offscreen_pixmap(localSrc->pDrawable, &src_off_x, &src_off_y);
- if (src_pixmap == NULL) {
- if (localSrc != pSrc)
- FreePicture(localSrc, 0);
- return -1;
- }
-
- src_x += localSrc->pDrawable->x + src_off_x;
- src_y += localSrc->pDrawable->y + src_off_y;
- } else {
- localSrc = uxa_acquire_pattern(screen, pSrc,
- PICT_a8r8g8b8, x, y, width, height);
- if (!localSrc)
- return 1;
-
- src_pixmap = uxa_get_drawable_pixmap(localSrc->pDrawable);
- if (src_pixmap == NULL) {
- FreePicture(localSrc, 0);
- return -1;
- }
-
- src_x = src_y = 0;
- }
- }
-
- dst_pixmap = uxa_get_offscreen_pixmap(pDst->pDrawable, &x, &y);
- x += xDst + pDst->pDrawable->x - list->xOff;
- y += yDst + pDst->pDrawable->y - list->yOff;
-
- glyph_atlas = NULL;
- while (nlist--) {
- x += list->xOff;
- y += list->yOff;
- n = list->len;
- while (n--) {
- GlyphPtr glyph = *glyphs++;
- PicturePtr this_atlas;
- int mask_x, mask_y, nrect;
- struct uxa_glyph *priv;
- BoxPtr rects;
-
- if (glyph->info.width == 0 || glyph->info.height == 0)
- goto next_glyph;
-
- priv = uxa_glyph_get_private(glyph);
- if (priv != NULL) {
- mask_x = priv->x;
- mask_y = priv->y;
- this_atlas = priv->cache->picture;
- } else {
- if (glyph_atlas) {
- uxa_screen->info->done_composite(dst_pixmap);
- glyph_atlas = NULL;
- }
- this_atlas = uxa_glyph_cache(screen, glyph, &mask_x, &mask_y);
- if (this_atlas == NULL) {
- /* no cache for this glyph */
- this_atlas = GlyphPicture(glyph)[screen->myNum];
- mask_x = mask_y = 0;
- }
- }
-
- if (this_atlas != glyph_atlas) {
- PixmapPtr mask_pixmap;
-
- if (glyph_atlas)
- uxa_screen->info->done_composite(dst_pixmap);
-
- mask_pixmap =
- uxa_get_drawable_pixmap(this_atlas->pDrawable);
- if (!uxa_pixmap_is_offscreen(mask_pixmap) ||
- !uxa_screen->info->prepare_composite(op,
- localSrc, this_atlas, pDst,
- src_pixmap, mask_pixmap, dst_pixmap))
- return -1;
-
- glyph_atlas = this_atlas;
- }
-
- rects = REGION_RECTS(pDst->pCompositeClip);
- nrect = REGION_NUM_RECTS(pDst->pCompositeClip);
- while (nrect--) {
- int x1 = x - glyph->info.x, dx = 0;
- int y1 = y - glyph->info.y, dy = 0;
- int x2 = x1 + glyph->info.width;
- int y2 = y1 + glyph->info.height;
-
- if (rects->y1 >= y2)
- break;
-
- if (x1 < rects->x1)
- dx = rects->x1 - x1, x1 = rects->x1;
- if (x2 > rects->x2)
- x2 = rects->x2;
- if (y1 < rects->y1)
- dy = rects->y1 - y1, y1 = rects->y1;
- if (y2 > rects->y2)
- y2 = rects->y2;
-
- if (x1 < x2 && y1 < y2) {
- uxa_screen->info->composite(dst_pixmap,
- x1 + src_x, y1 + src_y,
- dx + mask_x, dy + mask_y,
- x1, y1,
- x2 - x1, y2 - y1);
- }
- rects++;
- }
-
-next_glyph:
- x += glyph->info.xOff;
- y += glyph->info.yOff;
- }
- list++;
- }
- if (glyph_atlas)
- uxa_screen->info->done_composite(dst_pixmap);
-
- if (localSrc != pSrc)
- FreePicture(localSrc, 0);
-
- return 0;
-}
-
static void
uxa_clear_pixmap(ScreenPtr screen,
uxa_screen_t *uxa_screen,
@@ -894,37 +710,30 @@ uxa_glyphs_via_mask(CARD8 op,
PicturePtr pDst,
PictFormatPtr maskFormat,
INT16 xSrc, INT16 ySrc,
- INT16 xDst, INT16 yDst,
- int nlist, GlyphListPtr list, GlyphPtr * glyphs,
- BoxPtr extents)
+ int nlist, GlyphListPtr list, GlyphPtr * glyphs)
{
ScreenPtr screen = pDst->pDrawable->pScreen;
uxa_screen_t *uxa_screen = uxa_get_screen(screen);
CARD32 component_alpha;
PixmapPtr pixmap;
PicturePtr glyph_atlas, mask;
+ int xDst = list->xOff, yDst = list->yOff;
int x, y, width, height;
int dst_off_x, dst_off_y;
int n, error;
BoxRec box;
- if (!extents) {
- uxa_glyph_extents(nlist, list, glyphs, &box);
+ uxa_glyph_extents(nlist, list, glyphs, &box);
+ if (box.x2 <= box.x1 || box.y2 <= box.y1)
+ return 0;
- if (box.x2 <= box.x1 || box.y2 <= box.y1)
- return 0;
+ dst_off_x = box.x1;
+ dst_off_y = box.y1;
- extents = &box;
- dst_off_x = box.x1;
- dst_off_y = box.y1;
- } else {
- dst_off_x = dst_off_y = 0;
- }
-
- width = extents->x2 - extents->x1;
- height = extents->y2 - extents->y1;
- x = -extents->x1;
- y = -extents->y1;
+ width = box.x2 - box.x1;
+ height = box.y2 - box.y1;
+ x = -box.x1;
+ y = -box.y1;
if (maskFormat->depth == 1) {
PictFormatPtr a8Format =
@@ -1003,8 +812,10 @@ uxa_glyphs_via_mask(CARD8 op,
if (!uxa_pixmap_is_offscreen(src_pixmap) ||
!uxa_screen->info->prepare_composite(PictOpAdd,
this_atlas, NULL, mask,
- src_pixmap, NULL, pixmap))
+ src_pixmap, NULL, pixmap)) {
+ FreePicture(mask, 0);
return -1;
+ }
glyph_atlas = this_atlas;
}
@@ -1061,11 +872,6 @@ uxa_glyphs(CARD8 op,
{
ScreenPtr screen = pDst->pDrawable->pScreen;
uxa_screen_t *uxa_screen = uxa_get_screen(screen);
- int xDst = list->xOff, yDst = list->yOff;
- BoxRec extents = { 0, 0, 0, 0 };
- Bool have_extents = FALSE;
- int width, height, ret;
- PicturePtr localDst = pDst;
if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
int ok;
@@ -1128,112 +934,12 @@ fallback:
}
}
- if (!maskFormat &&
- uxa_screen->info->check_composite_target &&
- !uxa_screen->info->check_composite_target(uxa_get_drawable_pixmap(pDst->pDrawable))) {
- int depth = pDst->pDrawable->depth;
- PixmapPtr pixmap;
- int x, y, error;
- GCPtr gc;
-
- pixmap = uxa_get_drawable_pixmap(pDst->pDrawable);
- if (uxa_screen->info->check_copy &&
- !uxa_screen->info->check_copy(pixmap, pixmap, GXcopy, FB_ALLONES))
- goto fallback;
-
- uxa_glyph_extents(nlist, list, glyphs, &extents);
-
- /* clip against dst bounds */
- if (extents.x1 < 0)
- extents.x1 = 0;
- if (extents.y1 < 0)
- extents.y1 = 0;
- if (extents.x2 > pDst->pDrawable->width)
- extents.x2 = pDst->pDrawable->width;
- if (extents.y2 > pDst->pDrawable->height)
- extents.y2 = pDst->pDrawable->height;
-
- if (extents.x2 <= extents.x1 || extents.y2 <= extents.y1)
- return;
- width = extents.x2 - extents.x1;
- height = extents.y2 - extents.y1;
- x = -extents.x1;
- y = -extents.y1;
- have_extents = TRUE;
-
- xDst += x;
- yDst += y;
-
- pixmap = screen->CreatePixmap(screen,
- width, height, depth,
- CREATE_PIXMAP_USAGE_SCRATCH);
- if (!pixmap)
- return;
-
- if (!uxa_pixmap_is_offscreen(pixmap)) {
- screen->DestroyPixmap(pixmap);
- goto fallback;
- }
-
- gc = GetScratchGC(depth, screen);
- if (!gc) {
- screen->DestroyPixmap(pixmap);
- return;
- }
-
- ValidateGC(&pixmap->drawable, gc);
- gc->ops->CopyArea(pDst->pDrawable, &pixmap->drawable, gc,
- extents.x1, extents.y1,
- width, height,
- 0, 0);
- FreeScratchGC(gc);
-
- localDst = CreatePicture(0, &pixmap->drawable,
- PictureMatchFormat(screen, depth, pDst->format),
- 0, 0, serverClient, &error);
- screen->DestroyPixmap(pixmap);
-
- if (!localDst)
- return;
-
- ValidatePicture(localDst);
- }
-
- if (maskFormat) {
- ret = uxa_glyphs_via_mask(op,
- pSrc, localDst, maskFormat,
- xSrc, ySrc,
- xDst, yDst,
- nlist, list, glyphs,
- have_extents ? &extents : NULL);
- } else {
- ret = uxa_glyphs_to_dst(op,
- pSrc, localDst,
- xSrc, ySrc,
- xDst, yDst,
- nlist, list, glyphs,
- have_extents ? &extents : NULL);
- }
- if (ret) {
- if (localDst != pDst)
- FreePicture(localDst, 0);
-
+ if (!maskFormat)
goto fallback;
- }
- if (localDst != pDst) {
- GCPtr gc;
-
- gc = GetScratchGC(pDst->pDrawable->depth, screen);
- if (gc) {
- ValidateGC(pDst->pDrawable, gc);
- gc->ops->CopyArea(localDst->pDrawable, pDst->pDrawable, gc,
- 0, 0,
- width, height,
- extents.x1, extents.y1);
- FreeScratchGC(gc);
- }
-
- FreePicture(localDst, 0);
- }
+ if (uxa_glyphs_via_mask(op,
+ pSrc, pDst, maskFormat,
+ xSrc, ySrc,
+ nlist, list, glyphs))
+ goto fallback;
}
diff --git a/uxa/uxa-priv.h b/uxa/uxa-priv.h
index 0de45f5..b24ec4f 100644
--- a/uxa/uxa-priv.h
+++ b/uxa/uxa-priv.h
@@ -123,7 +123,6 @@ typedef struct {
BitmapToRegionProcPtr SavedBitmapToRegion;
#ifdef RENDER
CompositeProcPtr SavedComposite;
- CompositeRectsProcPtr SavedCompositeRects;
TrianglesProcPtr SavedTriangles;
GlyphsProcPtr SavedGlyphs;
TrapezoidsProcPtr SavedTrapezoids;
diff --git a/uxa/uxa-render.c b/uxa/uxa-render.c
index 877b286..1e88c5d 100644
--- a/uxa/uxa-render.c
+++ b/uxa/uxa-render.c
@@ -947,195 +947,6 @@ uxa_acquire_mask(ScreenPtr screen,
out_x, out_y);
}
-static Bool
-_pixman_region_init_rectangles(pixman_region16_t *region,
- int num_rects,
- xRectangle *rects,
- int tx, int ty)
-{
- pixman_box16_t stack_boxes[64], *boxes = stack_boxes;
- pixman_bool_t ret;
- int i;
-
- if (num_rects > sizeof(stack_boxes) / sizeof(stack_boxes[0])) {
- boxes = malloc(sizeof(pixman_box16_t) * num_rects);
- if (boxes == NULL)
- return FALSE;
- }
-
- for (i = 0; i < num_rects; i++) {
- boxes[i].x1 = rects[i].x + tx;
- boxes[i].y1 = rects[i].y + ty;
- boxes[i].x2 = rects[i].x + tx + rects[i].width;
- boxes[i].y2 = rects[i].y + ty + rects[i].height;
- }
-
- ret = pixman_region_init_rects(region, boxes, num_rects);
-
- if (boxes != stack_boxes)
- free(boxes);
-
- return ret;
-}
-
-void
-uxa_solid_rects (CARD8 op,
- PicturePtr dst,
- xRenderColor *color,
- int num_rects,
- xRectangle *rects)
-{
- ScreenPtr screen = dst->pDrawable->pScreen;
- uxa_screen_t *uxa_screen = uxa_get_screen(screen);
- PixmapPtr dst_pixmap, src_pixmap = NULL;
- pixman_region16_t region;
- pixman_box16_t *boxes, *extents;
- PicturePtr src;
- int dst_x, dst_y;
- int num_boxes;
-
- if (!pixman_region_not_empty(dst->pCompositeClip))
- return;
-
- if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
- int ok;
-
- uxa_picture_prepare_access(dst, UXA_GLAMOR_ACCESS_RW);
- ok = glamor_composite_rects_nf(op, dst, color,
- num_rects, rects);
- uxa_picture_finish_access(dst, UXA_GLAMOR_ACCESS_RW);
-
- if (!ok)
- goto fallback;
-
- return;
- }
-
- if (dst->alphaMap)
- goto fallback;
-
- dst_pixmap = uxa_get_offscreen_pixmap(dst->pDrawable, &dst_x, &dst_y);
- if (!dst_pixmap)
- goto fallback;
-
- if (!_pixman_region_init_rectangles(®ion,
- num_rects, rects,
- dst->pDrawable->x, dst->pDrawable->y))
- goto fallback;
-
- if (!pixman_region_intersect(®ion, ®ion, dst->pCompositeClip)) {
- pixman_region_fini(®ion);
- return;
- }
-
- pixman_region_translate(®ion, dst_x, dst_y);
- boxes = pixman_region_rectangles(®ion, &num_boxes);
- extents = pixman_region_extents (®ion);
-
- if (op == PictOpClear)
- color->red = color->green = color->blue = color->alpha = 0;
- if (color->alpha >= 0xff00 && op == PictOpOver) {
- color->alpha = 0xffff;
- op = PictOpSrc;
- }
-
- /* Using GEM, the relocation costs outweigh the advantages of the blitter */
- if (num_boxes == 1 && (op == PictOpSrc || op == PictOpClear)) {
- CARD32 pixel;
-
-try_solid:
- if (uxa_screen->info->check_solid &&
- !uxa_screen->info->check_solid(&dst_pixmap->drawable, GXcopy, FB_ALLONES))
- goto err_region;
-
- if (!uxa_get_pixel_from_rgba(&pixel,
- color->red,
- color->green,
- color->blue,
- color->alpha,
- dst->format))
- goto err_region;
-
- if (!uxa_screen->info->prepare_solid(dst_pixmap, GXcopy, FB_ALLONES, pixel))
- goto err_region;
-
- while (num_boxes--) {
- uxa_screen->info->solid(dst_pixmap,
- boxes->x1, boxes->y1,
- boxes->x2, boxes->y2);
- boxes++;
- }
-
- uxa_screen->info->done_solid(dst_pixmap);
- } else {
- int error;
-
- src = CreateSolidPicture(0, color, &error);
- if (!src)
- goto err_region;
-
- if (!uxa_screen->info->check_composite(op, src, NULL, dst,
- extents->x2 - extents->x1,
- extents->y2 - extents->y1)) {
- if (op == PictOpSrc || op == PictOpClear) {
- FreePicture(src, 0);
- goto try_solid;
- }
-
- goto err_src;
- }
-
- if (!uxa_screen->info->check_composite_texture ||
- !uxa_screen->info->check_composite_texture(screen, src)) {
- PicturePtr solid;
- int src_off_x, src_off_y;
-
- solid = uxa_acquire_solid(screen, src->pSourcePict);
- if (!solid)
- goto err_src;
- FreePicture(src, 0);
-
- src = solid;
- src_pixmap = uxa_get_offscreen_pixmap(src->pDrawable,
- &src_off_x, &src_off_y);
- if (!src_pixmap)
- goto err_src;
- }
-
- if (!uxa_screen->info->prepare_composite(op, src, NULL, dst, src_pixmap, NULL, dst_pixmap))
- goto err_src;
-
- while (num_boxes--) {
- uxa_screen->info->composite(dst_pixmap,
- 0, 0, 0, 0,
- boxes->x1,
- boxes->y1,
- boxes->x2 - boxes->x1,
- boxes->y2 - boxes->y1);
- boxes++;
- }
-
- uxa_screen->info->done_composite(dst_pixmap);
- FreePicture(src, 0);
- }
-
- /* XXX xserver-1.8: CompositeRects is not tracked by Damage, so we must
- * manually append the damaged regions ourselves.
- */
- pixman_region_translate(®ion, -dst_x, -dst_y);
- DamageRegionAppend(dst->pDrawable, ®ion);
-
- pixman_region_fini(®ion);
- return;
-
-err_src:
- FreePicture(src, 0);
-err_region:
- pixman_region_fini(®ion);
-fallback:
- uxa_screen->SavedCompositeRects(op, dst, color, num_rects, rects);
-}
-
static int
uxa_try_driver_composite(CARD8 op,
PicturePtr pSrc,
diff --git a/uxa/uxa.c b/uxa/uxa.c
index eb2ae03..b4a1da6 100644
--- a/uxa/uxa.c
+++ b/uxa/uxa.c
@@ -407,7 +407,6 @@ static Bool uxa_close_screen(int i, ScreenPtr pScreen)
#ifdef RENDER
if (ps) {
ps->Composite = uxa_screen->SavedComposite;
- ps->CompositeRects = uxa_screen->SavedCompositeRects;
ps->Glyphs = uxa_screen->SavedGlyphs;
ps->Trapezoids = uxa_screen->SavedTrapezoids;
ps->AddTraps = uxa_screen->SavedAddTraps;
@@ -536,9 +535,6 @@ Bool uxa_driver_init(ScreenPtr screen, uxa_driver_t * uxa_driver)
uxa_screen->SavedComposite = ps->Composite;
ps->Composite = uxa_composite;
- uxa_screen->SavedCompositeRects = ps->CompositeRects;
- ps->CompositeRects = uxa_solid_rects;
-
uxa_screen->SavedGlyphs = ps->Glyphs;
ps->Glyphs = uxa_glyphs;