aboutsummaryrefslogtreecommitdiff
path: root/x11-drivers
diff options
context:
space:
mode:
Diffstat (limited to 'x11-drivers')
-rw-r--r--x11-drivers/xf86-video-intel/Makefile2
-rw-r--r--x11-drivers/xf86-video-intel/files/patch-src__sna__sna_accel.c62
-rw-r--r--x11-drivers/xf86-video-intel/files/patch-src_compat-api.h43
-rw-r--r--x11-drivers/xf86-video-intel/files/patch-src_sna_fb_fbpict.c28
-rw-r--r--x11-drivers/xf86-video-intel/files/patch-src_sna_kgem.c20
-rw-r--r--x11-drivers/xf86-video-intel/files/patch-src_sna_sna__composite.c43
-rw-r--r--x11-drivers/xf86-video-intel/files/patch-src_sna_sna__driver.c10
-rw-r--r--x11-drivers/xf86-video-intel/files/patch-src_sna_sna__trapezoids.c111
-rw-r--r--x11-drivers/xf86-video-intel/files/patch-src_sna_sna__video.c82
-rw-r--r--x11-drivers/xf86-video-intel/files/patch-src_sna_sna__video.h10
-rw-r--r--x11-drivers/xf86-video-intel/files/patch-src_sna_sna__video__overlay.c101
-rw-r--r--x11-drivers/xf86-video-intel/files/patch-src_sna_sna__video__sprite.c114
-rw-r--r--x11-drivers/xf86-video-intel/files/patch-src_sna_sna__video__textured.c105
13 files changed, 715 insertions, 16 deletions
diff --git a/x11-drivers/xf86-video-intel/Makefile b/x11-drivers/xf86-video-intel/Makefile
index 06b792b22981..a47c24e9d9dc 100644
--- a/x11-drivers/xf86-video-intel/Makefile
+++ b/x11-drivers/xf86-video-intel/Makefile
@@ -3,7 +3,7 @@
PORTNAME= xf86-video-intel
PORTVERSION= 2.21.15
-PORTREVISION= 7
+PORTREVISION= 8
CATEGORIES= x11-drivers
MAINTAINER= x11@FreeBSD.org
diff --git a/x11-drivers/xf86-video-intel/files/patch-src__sna__sna_accel.c b/x11-drivers/xf86-video-intel/files/patch-src__sna__sna_accel.c
index dc14a5c5c6d4..9578842f0af4 100644
--- a/x11-drivers/xf86-video-intel/files/patch-src__sna__sna_accel.c
+++ b/x11-drivers/xf86-video-intel/files/patch-src__sna__sna_accel.c
@@ -1,6 +1,58 @@
---- src/sna/sna_accel.c.orig 2014-10-28 00:26:56.720761613 +0100
-+++ src/sna/sna_accel.c 2014-10-28 00:28:12.783756153 +0100
-@@ -14830,7 +14830,7 @@
+--- src/sna/sna_accel.c.orig 2013-08-20 20:26:26 UTC
++++ src/sna/sna_accel.c
+@@ -3797,6 +3797,7 @@ static bool must_check sna_gc_move_to_cp
+ sgc->priv = gc->pCompositeClip;
+ gc->pCompositeClip = region;
+
++#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,16,99,901,0)
+ if (gc->clientClipType == CT_PIXMAP) {
+ PixmapPtr clip = gc->clientClip;
+ gc->clientClip = region_from_bitmap(gc->pScreen, clip);
+@@ -3804,7 +3805,9 @@ static bool must_check sna_gc_move_to_cp
+ gc->clientClipType = gc->clientClip ? CT_REGION : CT_NONE;
+ changes |= GCClipMask;
+ } else
++#else
+ changes &= ~GCClipMask;
++#endif
+
+ if (changes || drawable->serialNumber != sgc->serial) {
+ gc->serialNumber = sgc->serial;
+@@ -5562,6 +5565,15 @@ static inline bool box_equal(const BoxRe
+ return *(const uint64_t *)a == *(const uint64_t *)b;
+ }
+
++static inline bool has_clip(GCPtr gc)
++{
++#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,16,99,901,0)
++ return gc->clientClipType != CT_NONE;
++#else
++ return gc->clientClip != NULL;
++#endif
++}
++
+ static RegionPtr
+ sna_do_copy(DrawablePtr src, DrawablePtr dst, GCPtr gc,
+ int sx, int sy,
+@@ -5628,7 +5640,7 @@ sna_do_copy(DrawablePtr src, DrawablePtr
+
+ /* Compute source clip region */
+ if (src->type == DRAWABLE_PIXMAP) {
+- if (src == dst && gc->clientClipType == CT_NONE) {
++ if (src == dst && !has_clip(gc)) {
+ DBG(("%s: pixmap -- using gc clip\n", __FUNCTION__));
+ clip = gc->pCompositeClip;
+ } else {
+@@ -14391,7 +14403,7 @@ sna_validate_gc(GCPtr gc, unsigned long
+
+ if (changes & (GCClipMask|GCSubwindowMode) ||
+ drawable->serialNumber != (gc->serialNumber & DRAWABLE_SERIAL_BITS) ||
+- (gc->clientClipType != CT_NONE && (changes & (GCClipXOrigin | GCClipYOrigin))))
++ (has_clip(gc) && (changes & (GCClipXOrigin | GCClipYOrigin))))
+ miComputeCompositeClip(gc, drawable);
+
+ sna_gc(gc)->changes |= changes;
+@@ -14830,7 +14842,7 @@ static bool has_offload_slaves(struct sn
{
#if HAS_PIXMAP_SHARING
ScreenPtr screen = sna->scrn->pScreen;
@@ -9,7 +61,7 @@
xorg_list_for_each_entry(dirty, &screen->pixmap_dirty_list, ent) {
assert(dirty->src == sna->front);
-@@ -14987,7 +14987,7 @@
+@@ -14987,7 +14999,7 @@ static void sna_accel_post_damage(struct
{
#if HAS_PIXMAP_SHARING
ScreenPtr screen = sna->scrn->pScreen;
@@ -18,7 +70,7 @@
bool flush = false;
xorg_list_for_each_entry(dirty, &screen->pixmap_dirty_list, ent) {
-@@ -15216,7 +15216,7 @@
+@@ -15216,7 +15228,7 @@ migrate_dirty_tracking(PixmapPtr old_fro
{
#if HAS_PIXMAP_SHARING
ScreenPtr screen = old_front->drawable.pScreen;
diff --git a/x11-drivers/xf86-video-intel/files/patch-src_compat-api.h b/x11-drivers/xf86-video-intel/files/patch-src_compat-api.h
new file mode 100644
index 000000000000..638141f515c3
--- /dev/null
+++ b/x11-drivers/xf86-video-intel/files/patch-src_compat-api.h
@@ -0,0 +1,43 @@
+--- src/compat-api.h.orig 2013-05-21 10:15:11 UTC
++++ src/compat-api.h
+@@ -158,4 +158,40 @@ static inline void FreePixmap(PixmapPtr
+ if ((d)->pScreen->SourceValidate) (d)->pScreen->SourceValidate(d, x, y, w, h)
+ #endif
+
++#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,14,99,2,0)
++#define DamageUnregister(d, dd) DamageUnregister(dd)
++#endif
++
++#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,16,99,1,0)
++
++#define XORG_XV_VERSION 2
++#define ddStopVideo_ARGS XvPortPtr port, DrawablePtr draw
++#define ddSetPortAttribute_ARGS XvPortPtr port, Atom attribute, INT32 value
++#define ddGetPortAttribute_ARGS XvPortPtr port, Atom attribute, INT32 *value
++#define ddQueryBestSize_ARGS XvPortPtr port, CARD8 motion, CARD16 vid_w, CARD16 vid_h, CARD16 drw_w, CARD16 drw_h, unsigned int *p_w, unsigned int *p_h
++#define ddPutImage_ARGS DrawablePtr draw, XvPortPtr port, GCPtr gc, INT16 src_x, INT16 src_y, CARD16 src_w, CARD16 src_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h, XvImagePtr format, unsigned char *buf, Bool sync, CARD16 width, CARD16 height
++#define ddQueryImageAttributes_ARGS XvPortPtr port, XvImagePtr format, unsigned short *w, unsigned short *h, int *pitches, int *offsets
++
++#else
++
++#define XORG_XV_VERSION 1
++#define ddStopVideo_ARGS ClientPtr client, XvPortPtr port, DrawablePtr draw
++#define ddSetPortAttribute_ARGS ClientPtr client, XvPortPtr port, Atom attribute, INT32 value
++#define ddGetPortAttribute_ARGS ClientPtr client, XvPortPtr port, Atom attribute, INT32 *value
++#define ddQueryBestSize_ARGS ClientPtr client, XvPortPtr port, CARD8 motion, CARD16 vid_w, CARD16 vid_h, CARD16 drw_w, CARD16 drw_h, unsigned int *p_w, unsigned int *p_h
++#define ddPutImage_ARGS ClientPtr client, DrawablePtr draw, XvPortPtr port, GCPtr gc, INT16 src_x, INT16 src_y, CARD16 src_w, CARD16 src_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h, XvImagePtr format, unsigned char *buf, Bool sync, CARD16 width, CARD16 height
++#define ddQueryImageAttributes_ARGS ClientPtr client, XvPortPtr port, XvImagePtr format, unsigned short *w, unsigned short *h, int *pitches, int *offsets
++
++#endif
++
++#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,16,99,1,0)
++#include <mi.h>
++#define miHandleExposures(pSrcDrawable, pDstDrawable, \
++ pGC, srcx, srcy, width, height, \
++ dstx, dsty, plane) \
++ miHandleExposures(pSrcDrawable, pDstDrawable, \
++ pGC, srcx, srcy, width, height, \
++ dstx, dsty)
++#endif
++
+ #endif
diff --git a/x11-drivers/xf86-video-intel/files/patch-src_sna_fb_fbpict.c b/x11-drivers/xf86-video-intel/files/patch-src_sna_fb_fbpict.c
new file mode 100644
index 000000000000..6b7e767503dc
--- /dev/null
+++ b/x11-drivers/xf86-video-intel/files/patch-src_sna_fb_fbpict.c
@@ -0,0 +1,28 @@
+--- src/sna/fb/fbpict.c.orig 2013-03-27 11:58:09 UTC
++++ src/sna/fb/fbpict.c
+@@ -156,6 +156,16 @@ create_conical_gradient_image(PictGradie
+ gradient->nstops);
+ }
+
++static inline bool
++picture_has_clip(PicturePtr p)
++{
++#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,16,99,1,0)
++ return p->clientClip;
++#else
++ return p->clientClipType != CT_NONE;
++#endif
++}
++
+ static pixman_image_t *
+ create_bits_picture(PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
+ {
+@@ -180,7 +190,7 @@ create_bits_picture(PicturePtr pict, Boo
+ * only set the clip region for pictures with drawables
+ */
+ if (has_clip) {
+- if (pict->clientClipType != CT_NONE)
++ if (picture_has_clip(pict))
+ pixman_image_set_has_client_clip(image, TRUE);
+
+ if (*xoff || *yoff)
diff --git a/x11-drivers/xf86-video-intel/files/patch-src_sna_kgem.c b/x11-drivers/xf86-video-intel/files/patch-src_sna_kgem.c
index 39f3729e83be..60a8c3440743 100644
--- a/x11-drivers/xf86-video-intel/files/patch-src_sna_kgem.c
+++ b/x11-drivers/xf86-video-intel/files/patch-src_sna_kgem.c
@@ -1,5 +1,5 @@
---- src/sna/kgem.c.orig 2013-08-04 11:10:59.000000000 +0200
-+++ src/sna/kgem.c 2013-08-14 11:59:14.787060294 +0200
+--- src/sna/kgem.c.orig 2013-08-20 20:26:26 UTC
++++ src/sna/kgem.c
@@ -25,6 +25,7 @@
*
*/
@@ -8,7 +8,7 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-@@ -1890,7 +1891,8 @@
+@@ -1873,7 +1874,8 @@ static void kgem_bo_move_to_snoop(struct
static struct kgem_bo *
search_snoop_cache(struct kgem *kgem, unsigned int num_pages, unsigned flags)
{
@@ -18,7 +18,7 @@
DBG(("%s: num_pages=%d, flags=%x\n", __FUNCTION__, num_pages, flags));
-@@ -2104,7 +2106,8 @@
+@@ -2087,7 +2089,8 @@ static bool kgem_retire__buffers(struct
static bool kgem_retire__flushing(struct kgem *kgem)
{
@@ -28,7 +28,7 @@
bool retired = false;
list_for_each_entry_safe(bo, next, &kgem->flushing, request) {
-@@ -2309,7 +2312,8 @@
+@@ -2292,7 +2295,8 @@ bool __kgem_ring_is_idle(struct kgem *kg
static void kgem_commit(struct kgem *kgem)
{
struct kgem_request *rq = kgem->next_request;
@@ -38,7 +38,7 @@
list_for_each_entry_safe(bo, next, &rq->buffers, request) {
assert(next->request.prev == &bo->request);
-@@ -2390,7 +2394,8 @@
+@@ -2373,7 +2377,8 @@ static void kgem_close_inactive(struct k
static void kgem_finish_buffers(struct kgem *kgem)
{
@@ -48,7 +48,7 @@
list_for_each_entry_safe(bo, next, &kgem->batch_buffers, base.list) {
DBG(("%s: buffer handle=%d, used=%d, exec?=%d, write=%d, mmapped=%s\n",
-@@ -3252,7 +3257,8 @@
+@@ -3254,7 +3259,8 @@ void kgem_cleanup_cache(struct kgem *kge
static struct kgem_bo *
search_linear_cache(struct kgem *kgem, unsigned int num_pages, unsigned flags)
{
@@ -58,7 +58,7 @@
bool use_active = (flags & CREATE_INACTIVE) == 0;
struct list *cache;
-@@ -3855,7 +3861,7 @@
+@@ -3867,7 +3873,7 @@ struct kgem_bo *kgem_create_2d(struct kg
uint32_t flags)
{
struct list *cache;
@@ -67,7 +67,7 @@
uint32_t pitch, tiled_height, size;
uint32_t handle;
int i, bucket, retry;
-@@ -5302,7 +5308,7 @@
+@@ -5337,7 +5343,7 @@ void kgem_bo_sync__gtt(struct kgem *kgem
void kgem_clear_dirty(struct kgem *kgem)
{
struct list * const buffers = &kgem->next_request->buffers;
@@ -76,7 +76,7 @@
list_for_each_entry(bo, buffers, request) {
if (!bo->gpu_dirty)
-@@ -5578,7 +5584,7 @@
+@@ -5613,7 +5619,7 @@ struct kgem_bo *kgem_create_buffer(struc
uint32_t size, uint32_t flags,
void **ret)
{
diff --git a/x11-drivers/xf86-video-intel/files/patch-src_sna_sna__composite.c b/x11-drivers/xf86-video-intel/files/patch-src_sna_sna__composite.c
new file mode 100644
index 000000000000..06ea9a1a52d7
--- /dev/null
+++ b/x11-drivers/xf86-video-intel/files/patch-src_sna_sna__composite.c
@@ -0,0 +1,43 @@
+--- src/sna/sna_composite.c.orig 2013-08-14 11:59:36 UTC
++++ src/sna/sna_composite.c
+@@ -122,11 +122,21 @@ clip_to_dst(pixman_region16_t *region,
+ }
+
+ static inline bool
++picture_has_clip(PicturePtr p)
++{
++#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,16,99,1,0)
++ return p->clientClip;
++#else
++ return p->clientClipType != CT_NONE;
++#endif
++}
++
++static inline bool
+ clip_to_src(RegionPtr region, PicturePtr p, int dx, int dy)
+ {
+ bool result;
+
+- if (p->clientClipType == CT_NONE)
++ if (!picture_has_clip(p))
+ return true;
+
+ pixman_region_translate(p->clientClip,
+@@ -220,7 +230,7 @@ sna_compute_composite_region(RegionPtr r
+ __FUNCTION__,
+ src->pDrawable ? src->pDrawable->width : 0,
+ src->pDrawable ? src->pDrawable->height : 0,
+- src->clientClipType,
++ picture_has_clip(src),
+ region->extents.x1, region->extents.y1,
+ region->extents.x2, region->extents.y2));
+
+@@ -287,7 +297,7 @@ trim_extents(BoxPtr extents, const Pictu
+ static void
+ _trim_source_extents(BoxPtr extents, const PicturePtr p, int dx, int dy)
+ {
+- if (p->clientClipType != CT_NONE)
++ if (picture_has_clip(p))
+ trim_extents(extents, p, dx, dy);
+ }
+
diff --git a/x11-drivers/xf86-video-intel/files/patch-src_sna_sna__driver.c b/x11-drivers/xf86-video-intel/files/patch-src_sna_sna__driver.c
new file mode 100644
index 000000000000..9f831101fbb4
--- /dev/null
+++ b/x11-drivers/xf86-video-intel/files/patch-src_sna_sna__driver.c
@@ -0,0 +1,10 @@
+--- src/sna/sna_driver.c.orig 2015-03-05 09:44:44 UTC
++++ src/sna/sna_driver.c
+@@ -769,6 +769,7 @@ static Bool sna_late_close_screen(CLOSE_
+ DBG(("%s\n", __FUNCTION__));
+
+ sna_accel_close(sna);
++ sna_video_close(sna);
+
+ depths = screen->allowedDepths;
+ for (d = 0; d < screen->numDepths; d++)
diff --git a/x11-drivers/xf86-video-intel/files/patch-src_sna_sna__trapezoids.c b/x11-drivers/xf86-video-intel/files/patch-src_sna_sna__trapezoids.c
new file mode 100644
index 000000000000..3e41f74c61bf
--- /dev/null
+++ b/x11-drivers/xf86-video-intel/files/patch-src_sna_sna__trapezoids.c
@@ -0,0 +1,111 @@
+From 48a33fc379b17eed195875222ad773c911d9dff1 Mon Sep 17 00:00:00 2001
+From: Chris Wilson <chris@chris-wilson.co.uk>
+Date: Tue, 2 Sep 2014 19:08:36 +0100
+Subject: sna/trapezoids: Use the corrected trapezoid origin for aligned boxes
+
+The rule for the origin of the CompositeTrapezoids routine is the
+upper-left corner of the first trapezoid. Care must be taken in case the
+trapezoid edge is upside down to consider the upper vertex.
+
+Reported-by: "Jasper St. Pierre" <jstpierre@mecheye.net>
+Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+
+
+--- src/sna/sna_trapezoids.c.orig 2013-08-20 22:26:26.000000000 +0200
++++ src/sna/sna_trapezoids.c 2015-04-12 16:40:02.382938000 +0200
+@@ -2690,13 +2690,16 @@
+ BoxRec stack_boxes[64], *boxes;
+ pixman_region16_t region, clip;
+ struct sna_composite_op tmp;
++ int16_t dst_x, dst_y;
+ bool ret = true;
+ int dx, dy, n, num_boxes;
+
+ if (NO_ALIGNED_BOXES)
+ return false;
+
+- DBG(("%s\n", __FUNCTION__));
++ DBG(("%s: pixmap=%ld, nboxes=%d, dx=(%d, %d)\n", __FUNCTION__,
++ get_drawable_pixmap(dst->pDrawable)->drawable.serialNumber,
++ ntrap, dst->pDrawable->x, dst->pDrawable->y));
+
+ boxes = stack_boxes;
+ if (ntrap > (int)ARRAY_SIZE(stack_boxes)) {
+@@ -2738,19 +2741,20 @@
+ if (num_boxes == 0)
+ goto free_boxes;
+
+- DBG(("%s: extents (%d, %d), (%d, %d) offset of (%d, %d)\n",
++ trapezoid_origin(&traps[0].left, &dst_x, &dst_y);
++
++ DBG(("%s: extents (%d, %d), (%d, %d) offset of (%d, %d), origin (%d, %d)\n",
+ __FUNCTION__,
+ region.extents.x1, region.extents.y1,
+ region.extents.x2, region.extents.y2,
+ region.extents.x1 - boxes[0].x1,
+- region.extents.y1 - boxes[0].y1));
+-
+- src_x += region.extents.x1 - boxes[0].x1;
+- src_y += region.extents.y1 - boxes[0].y1;
++ region.extents.y1 - boxes[0].y1,
++ dst_x, dst_y));
+
+ if (!sna_compute_composite_region(&clip,
+ src, NULL, dst,
+- src_x, src_y,
++ src_x + region.extents.x1 - dst_x - dx,
++ src_y + region.extents.y1 - dst_y - dy,
+ 0, 0,
+ region.extents.x1 - dx, region.extents.y1 - dy,
+ region.extents.x2 - region.extents.x1,
+@@ -2760,9 +2764,18 @@
+ goto done;
+ }
+
++ DBG(("%s: clipped extents (%d, %d), (%d, %d); now offset by (%d, %d), orgin (%d, %d)\n",
++ __FUNCTION__,
++ clip.extents.x1, clip.extents.y1,
++ clip.extents.x2, clip.extents.y2,
++ clip.extents.x1 - boxes[0].x1,
++ clip.extents.y1 - boxes[0].y1,
++ dst_x, dst_y));
++
+ if (force_fallback ||
+ !sna->render.composite(sna, op, src, NULL, dst,
+- src_x, src_y,
++ src_x + clip.extents.x1 - dst_x,
++ src_y + clip.extents.y1 - dst_y,
+ 0, 0,
+ clip.extents.x1, clip.extents.y1,
+ clip.extents.x2 - clip.extents.x1,
+@@ -2796,6 +2809,8 @@
+ }
+
+ DBG(("%s: fbComposite()\n", __FUNCTION__));
++ src_x -= dst_x - dx;
++ src_y -= dst_y - dy;
+ if (maskFormat) {
+ pixman_region_init_rects(&region, boxes, num_boxes);
+ RegionIntersect(&region, &region, &clip);
+@@ -2804,8 +2819,8 @@
+ count = REGION_NUM_RECTS(&region);
+ for (i = 0; i < count; i++) {
+ fbComposite(op, src, NULL, dst,
+- src_x + b[i].x1 - boxes[0].x1,
+- src_y + b[i].y1 - boxes[0].y1,
++ src_x + b[i].x1,
++ src_y + b[i].y1,
+ 0, 0,
+ b[i].x1, b[i].y1,
+ b[i].x2 - b[i].x1, b[i].y2 - b[i].y1);
+@@ -2819,8 +2834,8 @@
+ count = REGION_NUM_RECTS(&region);
+ for (i = 0; i < count; i++) {
+ fbComposite(op, src, NULL, dst,
+- src_x + b[i].x1 - boxes[0].x1,
+- src_y + b[i].y1 - boxes[0].y1,
++ src_x + b[i].x1,
++ src_y + b[i].y1,
+ 0, 0,
+ b[i].x1, b[i].y1,
+ b[i].x2 - b[i].x1, b[i].y2 - b[i].y1);
diff --git a/x11-drivers/xf86-video-intel/files/patch-src_sna_sna__video.c b/x11-drivers/xf86-video-intel/files/patch-src_sna_sna__video.c
new file mode 100644
index 000000000000..9f75bf5f3e2f
--- /dev/null
+++ b/x11-drivers/xf86-video-intel/files/patch-src_sna_sna__video.c
@@ -0,0 +1,82 @@
+--- src/sna/sna_video.c.orig 2015-03-05 09:45:32 UTC
++++ src/sna/sna_video.c
+@@ -68,6 +68,7 @@
+ #else
+ static inline void sna_video_xvmc_setup(struct sna *sna, ScreenPtr ptr)
+ {
++ DBG(("%s: XvMC not compiled in\n"));
+ }
+ #endif
+
+@@ -620,6 +621,7 @@ sna_xv_fixup_formats(ScreenPtr screen, X
+ return count;
+ }
+
++#if XORG_XV_VERSION < 2
+ static int
+ sna_xv_query_adaptors(ScreenPtr screen,
+ XvAdaptorPtr *adaptors,
+@@ -636,20 +638,10 @@ static Bool
+ sna_xv_close_screen(CLOSE_SCREEN_ARGS_DECL)
+ {
+ struct sna *sna = to_sna_from_screen(screen);
+- int i;
+-
+- for (i = 0; i < sna->xv.num_adaptors; i++) {
+- free(sna->xv.adaptors[i].pPorts->devPriv.ptr);
+- free(sna->xv.adaptors[i].pPorts);
+- free(sna->xv.adaptors[i].pEncodings);
+- }
+- free(sna->xv.adaptors);
+-
+- sna->xv.adaptors = NULL;
+- sna->xv.num_adaptors = 0;
+-
++ sna_video_close(sna);
+ return TRUE;
+ }
++#endif
+
+ void sna_video_init(struct sna *sna, ScreenPtr screen)
+ {
+@@ -671,8 +663,10 @@ void sna_video_init(struct sna *sna, Scr
+ return;
+
+ xv = to_xv(screen);
++#if XORG_XV_VERSION < 2
+ xv->ddCloseScreen = sna_xv_close_screen;
+ xv->ddQueryAdaptors = sna_xv_query_adaptors;
++#endif
+
+ sna_video_textured_setup(sna, screen);
+ sna_video_sprite_setup(sna, screen);
+@@ -698,7 +692,28 @@ void sna_video_destroy_window(WindowPtr
+ XvPortPtr port;
+
+ port = sna_window_get_port(win);
+- if (port)
++ if (port) {
++#if XORG_XV_VERSION < 2
+ port->pAdaptor->ddStopVideo(NULL, port, &win->drawable);
++#else
++ port->pAdaptor->ddStopVideo(port, &win->drawable);
++#endif
++ }
+ assert(sna_window_get_port(win) == NULL);
+ }
++
++void sna_video_close(struct sna *sna)
++{
++ int i;
++
++ for (i = 0; i < sna->xv.num_adaptors; i++) {
++ free(sna->xv.adaptors[i].pPorts->devPriv.ptr);
++ free(sna->xv.adaptors[i].pPorts);
++ free(sna->xv.adaptors[i].pEncodings);
++ }
++ free(sna->xv.adaptors);
++
++ sna->xv.adaptors = NULL;
++ sna->xv.num_adaptors = 0;
++}
++
diff --git a/x11-drivers/xf86-video-intel/files/patch-src_sna_sna__video.h b/x11-drivers/xf86-video-intel/files/patch-src_sna_sna__video.h
new file mode 100644
index 000000000000..dd4b3e0b8a17
--- /dev/null
+++ b/x11-drivers/xf86-video-intel/files/patch-src_sna_sna__video.h
@@ -0,0 +1,10 @@
+--- src/sna/sna_video.h.orig 2015-03-05 09:53:01 UTC
++++ src/sna/sna_video.h
+@@ -129,6 +129,7 @@ void sna_video_overlay_setup(struct sna
+ void sna_video_sprite_setup(struct sna *sna, ScreenPtr screen);
+ void sna_video_textured_setup(struct sna *sna, ScreenPtr screen);
+ void sna_video_destroy_window(WindowPtr win);
++void sna_video_close(struct sna *sna);
+
+ XvAdaptorPtr sna_xv_adaptor_alloc(struct sna *sna);
+ int sna_xv_fixup_formats(ScreenPtr screen,
diff --git a/x11-drivers/xf86-video-intel/files/patch-src_sna_sna__video__overlay.c b/x11-drivers/xf86-video-intel/files/patch-src_sna_sna__video__overlay.c
new file mode 100644
index 000000000000..e44f6186e0f0
--- /dev/null
+++ b/x11-drivers/xf86-video-intel/files/patch-src_sna_sna__video__overlay.c
@@ -0,0 +1,101 @@
+--- src/sna/sna_video_overlay.c.orig 2015-03-05 09:54:32 UTC
++++ src/sna/sna_video_overlay.c
+@@ -121,9 +121,7 @@ static bool sna_video_overlay_update_att
+ return drmIoctl(video->sna->kgem.fd, DRM_IOCTL_I915_OVERLAY_ATTRS, &attrs) == 0;
+ }
+
+-static int sna_video_overlay_stop(ClientPtr client,
+- XvPortPtr port,
+- DrawablePtr draw)
++static int sna_video_overlay_stop(ddStopVideo_ARGS)
+ {
+ struct sna_video *video = port->devPriv.ptr;
+ struct sna *sna = video->sna;
+@@ -148,10 +146,7 @@ static int sna_video_overlay_stop(Client
+ }
+
+ static int
+-sna_video_overlay_set_attribute(ClientPtr client,
+- XvPortPtr port,
+- Atom attribute,
+- INT32 value)
++sna_video_overlay_set_attribute(ddSetPortAttribute_ARGS)
+ {
+ struct sna_video *video = port->devPriv.ptr;
+ struct sna *sna = video->sna;
+@@ -270,12 +265,7 @@ sna_video_overlay_get_attribute(ClientPt
+ }
+
+ static int
+-sna_video_overlay_best_size(ClientPtr client,
+- XvPortPtr port,
+- CARD8 motion,
+- CARD16 vid_w, CARD16 vid_h,
+- CARD16 drw_w, CARD16 drw_h,
+- unsigned int *p_w, unsigned int *p_h)
++sna_video_overlay_best_size(ddQueryBestSize_ARGS)
+ {
+ struct sna_video *video = port->devPriv.ptr;
+ struct sna *sna = video->sna;
+@@ -464,18 +454,7 @@ sna_video_overlay_show(struct sna *sna,
+ }
+
+ static int
+-sna_video_overlay_put_image(ClientPtr client,
+- DrawablePtr draw,
+- XvPortPtr port,
+- GCPtr gc,
+- INT16 src_x, INT16 src_y,
+- CARD16 src_w, CARD16 src_h,
+- INT16 drw_x, INT16 drw_y,
+- CARD16 drw_w, CARD16 drw_h,
+- XvImagePtr format,
+- unsigned char *buf,
+- Bool sync,
+- CARD16 width, CARD16 height)
++sna_video_overlay_put_image(ddPutImage_ARGS)
+ {
+ struct sna_video *video = port->devPriv.ptr;
+ struct sna *sna = video->sna;
+@@ -604,18 +583,16 @@ invisible:
+ /*
+ * If the video isn't visible on any CRTC, turn it off
+ */
++#if XORG_XV_VERSION < 2
+ sna_video_overlay_stop(client, port, draw);
++#else
++ sna_video_overlay_stop(port, draw);
++#endif
+ return Success;
+ }
+
+ static int
+-sna_video_overlay_query(ClientPtr client,
+- XvPortPtr port,
+- XvImagePtr format,
+- unsigned short *w,
+- unsigned short *h,
+- int *pitches,
+- int *offsets)
++sna_video_overlay_query(ddQueryImageAttributes_ARGS)
+ {
+ struct sna_video *video = port->devPriv.ptr;
+ struct sna_video_frame frame;
+@@ -771,8 +748,10 @@ void sna_video_overlay_setup(struct sna
+ adaptor->pAttributes = (XvAttributeRec *)Attributes;
+ adaptor->nImages = ARRAY_SIZE(Images);
+ adaptor->pImages = (XvImageRec *)Images;
++#if XORG_XV_VERSION < 2
+ adaptor->ddAllocatePort = sna_xv_alloc_port;
+ adaptor->ddFreePort = sna_xv_free_port;
++#endif
+ adaptor->ddPutVideo = NULL;
+ adaptor->ddPutStill = NULL;
+ adaptor->ddGetVideo = NULL;
+@@ -843,4 +822,6 @@ void sna_video_overlay_setup(struct sna
+ }
+
+ sna_video_overlay_update_attrs(video);
++
++ DBG(("%s: '%s' initialized %d ports\n", __FUNCTION__, adaptor->name, adaptor->nPorts));
+ }
diff --git a/x11-drivers/xf86-video-intel/files/patch-src_sna_sna__video__sprite.c b/x11-drivers/xf86-video-intel/files/patch-src_sna_sna__video__sprite.c
new file mode 100644
index 000000000000..ffde2de15e57
--- /dev/null
+++ b/x11-drivers/xf86-video-intel/files/patch-src_sna_sna__video__sprite.c
@@ -0,0 +1,114 @@
+--- src/sna/sna_video_sprite.c.orig 2015-03-05 10:02:08 UTC
++++ src/sna/sna_video_sprite.c
+@@ -56,9 +56,7 @@ static const XvAttributeRec attribs[] =
+ { XvSettable | XvGettable, 0, 0xffffff, (char *)"XV_COLORKEY" },
+ };
+
+-static int sna_video_sprite_stop(ClientPtr client,
+- XvPortPtr port,
+- DrawablePtr draw)
++static int sna_video_sprite_stop(ddStopVideo_ARGS)
+ {
+ struct sna_video *video = port->devPriv.ptr;
+ struct drm_mode_set_plane s;
+@@ -82,10 +80,7 @@ static int sna_video_sprite_stop(ClientP
+ return Success;
+ }
+
+-static int sna_video_sprite_set_attr(ClientPtr client,
+- XvPortPtr port,
+- Atom attribute,
+- INT32 value)
++static int sna_video_sprite_set_attr(ddSetPortAttribute_ARGS)
+ {
+ struct sna_video *video = port->devPriv.ptr;
+
+@@ -104,10 +99,7 @@ static int sna_video_sprite_set_attr(Cli
+ return Success;
+ }
+
+-static int sna_video_sprite_get_attr(ClientPtr client,
+- XvPortPtr port,
+- Atom attribute,
+- INT32 *value)
++static int sna_video_sprite_get_attr(ddGetPortAttribute_ARGS)
+ {
+ struct sna_video *video = port->devPriv.ptr;
+
+@@ -121,13 +113,7 @@ static int sna_video_sprite_get_attr(Cli
+ return Success;
+ }
+
+-static int sna_video_sprite_best_size(ClientPtr client,
+- XvPortPtr port,
+- CARD8 motion,
+- CARD16 vid_w, CARD16 vid_h,
+- CARD16 drw_w, CARD16 drw_h,
+- unsigned int *p_w,
+- unsigned int *p_h)
++static int sna_video_sprite_best_size(ddQueryBestSize_ARGS)
+ {
+ struct sna_video *video = port->devPriv.ptr;
+ struct sna *sna = video->sna;
+@@ -310,18 +296,7 @@ sna_video_sprite_show(struct sna *sna,
+ return true;
+ }
+
+-static int sna_video_sprite_put_image(ClientPtr client,
+- DrawablePtr draw,
+- XvPortPtr port,
+- GCPtr gc,
+- INT16 src_x, INT16 src_y,
+- CARD16 src_w, CARD16 src_h,
+- INT16 drw_x, INT16 drw_y,
+- CARD16 drw_w, CARD16 drw_h,
+- XvImagePtr format,
+- unsigned char *buf,
+- Bool sync,
+- CARD16 width, CARD16 height)
++static int sna_video_sprite_put_image(ddPutImage_ARGS)
+ {
+ struct sna_video *video = port->devPriv.ptr;
+ struct sna *sna = video->sna;
+@@ -430,16 +405,14 @@ static int sna_video_sprite_put_image(Cl
+
+ invisible:
+ /* If the video isn't visible on any CRTC, turn it off */
++#if XORG_XV_VERSION < 2
+ return sna_video_sprite_stop(client, port, draw);
++#else
++ return sna_video_sprite_stop(port, draw);
++#endif
+ }
+
+-static int sna_video_sprite_query(ClientPtr client,
+- XvPortPtr port,
+- XvImagePtr format,
+- unsigned short *w,
+- unsigned short *h,
+- int *pitches,
+- int *offsets)
++static int sna_video_sprite_query(ddQueryImageAttributes_ARGS)
+ {
+ struct sna_video *video = port->devPriv.ptr;
+ struct sna_video_frame frame;
+@@ -548,8 +521,10 @@ void sna_video_sprite_setup(struct sna *
+ if (sna->kgem.gen == 071)
+ adaptor->nImages = 4;
+
++#if XORG_XV_VERSION < 2
+ adaptor->ddAllocatePort = sna_xv_alloc_port;
+ adaptor->ddFreePort = sna_xv_free_port;
++#endif
+ adaptor->ddPutVideo = NULL;
+ adaptor->ddPutStill = NULL;
+ adaptor->ddGetVideo = NULL;
+@@ -593,6 +568,8 @@ void sna_video_sprite_setup(struct sna *
+
+ xvColorKey = MAKE_ATOM("XV_COLORKEY");
+ xvAlwaysOnTop = MAKE_ATOM("XV_ALWAYS_ON_TOP");
++
++ DBG(("%s: '%s' initialized %d ports\n", __FUNCTION__, adaptor->name, adaptor->nPorts));
+ }
+ #else
+ void sna_video_sprite_setup(struct sna *sna, ScreenPtr screen)
diff --git a/x11-drivers/xf86-video-intel/files/patch-src_sna_sna__video__textured.c b/x11-drivers/xf86-video-intel/files/patch-src_sna_sna__video__textured.c
new file mode 100644
index 000000000000..c80ec1e5b1a6
--- /dev/null
+++ b/x11-drivers/xf86-video-intel/files/patch-src_sna_sna__video__textured.c
@@ -0,0 +1,105 @@
+--- src/sna/sna_video_textured.c.orig 2015-03-05 10:08:42 UTC
++++ src/sna/sna_video_textured.c
+@@ -56,9 +56,7 @@ static const XvImageRec Images[] = {
+ XVMC_YUV,
+ };
+
+-static int sna_video_textured_stop(ClientPtr client,
+- XvPortPtr port,
+- DrawablePtr draw)
++static int sna_video_textured_stop(ddStopVideo_ARGS)
+ {
+ struct sna_video *video = port->devPriv.ptr;
+
+@@ -71,10 +69,7 @@ static int sna_video_textured_stop(Clien
+ }
+
+ static int
+-sna_video_textured_set_attribute(ClientPtr client,
+- XvPortPtr port,
+- Atom attribute,
+- INT32 value)
++sna_video_textured_set_attribute(ddSetPortAttribute_ARGS)
+ {
+ struct sna_video *video = port->devPriv.ptr;
+
+@@ -100,10 +95,7 @@ sna_video_textured_set_attribute(ClientP
+ }
+
+ static int
+-sna_video_textured_get_attribute(ClientPtr client,
+- XvPortPtr port,
+- Atom attribute,
+- INT32 *value)
++sna_video_textured_get_attribute(ddGetPortAttribute_ARGS)
+ {
+ struct sna_video *video = port->devPriv.ptr;
+
+@@ -120,13 +112,7 @@ sna_video_textured_get_attribute(ClientP
+ }
+
+ static int
+-sna_video_textured_best_size(ClientPtr client,
+- XvPortPtr port,
+- CARD8 motion,
+- CARD16 vid_w, CARD16 vid_h,
+- CARD16 drw_w, CARD16 drw_h,
+- unsigned int *p_w,
+- unsigned int *p_h)
++sna_video_textured_best_size(ddQueryBestSize_ARGS)
+ {
+ if (vid_w > (drw_w << 1))
+ drw_w = vid_w >> 1;
+@@ -153,18 +139,7 @@ sna_video_textured_best_size(ClientPtr c
+ * compositing. It's a new argument to the function in the 1.1 server.
+ */
+ static int
+-sna_video_textured_put_image(ClientPtr client,
+- DrawablePtr draw,
+- XvPortPtr port,
+- GCPtr gc,
+- INT16 src_x, INT16 src_y,
+- CARD16 src_w, CARD16 src_h,
+- INT16 drw_x, INT16 drw_y,
+- CARD16 drw_w, CARD16 drw_h,
+- XvImagePtr format,
+- unsigned char *buf,
+- Bool sync,
+- CARD16 width, CARD16 height)
++sna_video_textured_put_image(ddPutImage_ARGS)
+ {
+ struct sna_video *video = port->devPriv.ptr;
+ struct sna *sna = video->sna;
+@@ -269,13 +244,7 @@ sna_video_textured_put_image(ClientPtr c
+ }
+
+ static int
+-sna_video_textured_query(ClientPtr client,
+- XvPortPtr port,
+- XvImagePtr format,
+- unsigned short *w,
+- unsigned short *h,
+- int *pitches,
+- int *offsets)
++sna_video_textured_query(ddQueryImageAttributes_ARGS)
+ {
+ int size, tmp;
+
+@@ -384,8 +353,10 @@ void sna_video_textured_setup(struct sna
+ adaptor->pAttributes = (XvAttributeRec *)Attributes;
+ adaptor->nImages = ARRAY_SIZE(Images);
+ adaptor->pImages = (XvImageRec *)Images;
++#if XORG_XV_VERSION < 2
+ adaptor->ddAllocatePort = sna_xv_alloc_port;
+ adaptor->ddFreePort = sna_xv_free_port;
++#endif
+ adaptor->ddPutVideo = NULL;
+ adaptor->ddPutStill = NULL;
+ adaptor->ddGetVideo = NULL;
+@@ -426,4 +397,6 @@ void sna_video_textured_setup(struct sna
+ xvBrightness = MAKE_ATOM("XV_BRIGHTNESS");
+ xvContrast = MAKE_ATOM("XV_CONTRAST");
+ xvSyncToVblank = MAKE_ATOM("XV_SYNC_TO_VBLANK");
++
++ DBG(("%s: '%s' initialized %d ports\n", __FUNCTION__, adaptor->name, adaptor->nPorts));
+ }