void-packages/srcpkgs/xf86-video-intel/patches/0003-uxa-Remove-hook-for-Co...

255 lines
6.8 KiB
Diff

From b669f171adece9df7f0c340c664b70e94118a55e Mon Sep 17 00:00:00 2001
From: Chris Wilson <chris@chris-wilson.co.uk>
Date: Fri, 23 Mar 2012 14:56:06 +0000
Subject: [PATCH 3/5] uxa: Remove hook for CompositeRectangles
It was broken and not flushing damage correctly. With the
improvements made to the kernel, it is no longer a significant advantage
per se and not worth its additional complexity.
Reported-by: Tilman Sauerbeck <tilman@code-monkey.de>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=32547
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
uxa/uxa-priv.h | 1 -
uxa/uxa-render.c | 189 ------------------------------------------------------
uxa/uxa.c | 4 --
3 files changed, 194 deletions(-)
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(&region,
- num_rects, rects,
- dst->pDrawable->x, dst->pDrawable->y))
- goto fallback;
-
- if (!pixman_region_intersect(&region, &region, dst->pCompositeClip)) {
- pixman_region_fini(&region);
- return;
- }
-
- pixman_region_translate(&region, dst_x, dst_y);
- boxes = pixman_region_rectangles(&region, &num_boxes);
- extents = pixman_region_extents (&region);
-
- 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(&region, -dst_x, -dst_y);
- DamageRegionAppend(dst->pDrawable, &region);
-
- pixman_region_fini(&region);
- return;
-
-err_src:
- FreePicture(src, 0);
-err_region:
- pixman_region_fini(&region);
-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;
--
1.7.10