]> git.draconx.ca Git - gentoo-draconx.git/blob - x11-drivers/xf86-video-intel/files/0001-Revert-Xv-fixup-XvMC-on-i915.patch
xf86-video-intel: Bump to 2.11.0 with revert fixing Xv corruption.
[gentoo-draconx.git] / x11-drivers / xf86-video-intel / files / 0001-Revert-Xv-fixup-XvMC-on-i915.patch
1 From eca670dc31eb1793297b524760c057b80da194a9 Mon Sep 17 00:00:00 2001
2 From: Nick Bowler <nbowler@elliptictech.com>
3 Date: Mon, 5 Apr 2010 08:38:58 -0400
4 Subject: [PATCH] Revert "Xv: fixup XvMC on i915"
5
6 This reverts commit cb06aa32d433f54affe87da2cf964f0308d3c258.
7
8 Conflicts:
9
10         src/i830_video.c
11 ---
12  src/i830_video.c |   67 +++++++++++++++++++++++++++++------------------------
13  1 files changed, 37 insertions(+), 30 deletions(-)
14
15 diff --git a/src/i830_video.c b/src/i830_video.c
16 index db72863..1def5e1 100644
17 --- a/src/i830_video.c
18 +++ b/src/i830_video.c
19 @@ -267,7 +267,7 @@ static void drmmode_overlay_off(ScrnInfoPtr scrn)
20  static Bool
21  drmmode_overlay_put_image(ScrnInfoPtr scrn, xf86CrtcPtr crtc,
22                           int id, short width, short height,
23 -                         int dstPitch, int dstPitch2,
24 +                         int dstPitch,
25                           BoxPtr dstBox, short src_w, short src_h, short drw_w,
26                           short drw_h)
27  {
28 @@ -282,7 +282,7 @@ drmmode_overlay_put_image(ScrnInfoPtr scrn, xf86CrtcPtr crtc,
29  
30         request.bo_handle = adaptor_priv->buf->handle;
31         if (planar) {
32 -               request.stride_Y = dstPitch2;
33 +               request.stride_Y = dstPitch * 2;
34                 request.stride_UV = dstPitch;
35         } else {
36                 request.stride_Y = dstPitch;
37 @@ -959,12 +959,12 @@ static void i830_memcpy_plane(unsigned char *dst, unsigned char *src,
38  
39  static void
40  I830CopyPlanarData(intel_adaptor_private *adaptor_priv,
41 -                  unsigned char *buf, int srcPitch, int srcPitch2,
42 -                  int dstPitch, int dstPitch2,
43 -                  int srcH, int top, int left,
44 +                  unsigned char *buf, int srcPitch,
45 +                  int srcPitch2, int dstPitch, int srcH, int top, int left,
46                    int h, int w, int id)
47  {
48         unsigned char *src1, *src2, *src3, *dst_base, *dst1, *dst2, *dst3;
49 +       int dstPitch2 = dstPitch << 1;
50  
51  #if 0
52         ErrorF("I830CopyPlanarData: srcPitch %d, srcPitch %d, dstPitch %d\n"
53 @@ -1181,7 +1181,7 @@ static int xvmc_passthrough(int id)
54  static Bool
55  i830_display_overlay(ScrnInfoPtr scrn, xf86CrtcPtr crtc,
56                      int id, short width, short height,
57 -                    int dstPitch, int dstPitch2,
58 +                    int dstPitch,
59                      BoxPtr dstBox, short src_w, short src_h, short drw_w,
60                      short drw_h)
61  {
62 @@ -1214,7 +1214,7 @@ i830_display_overlay(ScrnInfoPtr scrn, xf86CrtcPtr crtc,
63         }
64  
65         return drmmode_overlay_put_image(scrn, crtc, id, width, height,
66 -                                        dstPitch, dstPitch2, dstBox,
67 +                                        dstPitch, dstBox,
68                                          src_w, src_h, drw_w, drw_h);
69  }
70  
71 @@ -1362,33 +1362,28 @@ i830_setup_dst_params(ScrnInfoPtr scrn, intel_adaptor_private *adaptor_priv, sho
72                 if (IS_I965G(intel))
73                         pitchAlignMask = 255;
74                 else
75 -                       pitchAlignMask = 255;
76 +                       pitchAlignMask = 63;
77         }
78  
79 -#if INTEL_XVMC
80 -       /* for i915 xvmc, hw requires 1kb aligned surfaces */
81 -       if ((id == FOURCC_XVMC) && IS_I915(intel))
82 -               pitchAlignMask = 0x3ff;
83 -#endif
84 -
85         /* Determine the desired destination pitch (representing the chroma's pitch,
86          * in the planar case.
87          */
88 -       if (is_planar_fourcc(id)) {
89 +       switch (id) {
90 +       case FOURCC_YV12:
91 +       case FOURCC_I420:
92                 if (adaptor_priv->rotation & (RR_Rotate_90 | RR_Rotate_270)) {
93                         *dstPitch =
94                             ((height / 2) + pitchAlignMask) & ~pitchAlignMask;
95 -                       *dstPitch2 =
96 -                           (height + pitchAlignMask) & ~pitchAlignMask;
97                         *size = *dstPitch * width * 3;
98                 } else {
99                         *dstPitch =
100                             ((width / 2) + pitchAlignMask) & ~pitchAlignMask;
101 -                       *dstPitch2 =
102 -                           (width + pitchAlignMask) & ~pitchAlignMask;
103                         *size = *dstPitch * height * 3;
104                 }
105 -       } else {
106 +               break;
107 +       case FOURCC_UYVY:
108 +       case FOURCC_YUY2:
109 +
110                 if (adaptor_priv->rotation & (RR_Rotate_90 | RR_Rotate_270)) {
111                         *dstPitch =
112                             ((height << 1) + pitchAlignMask) & ~pitchAlignMask;
113 @@ -1398,7 +1393,18 @@ i830_setup_dst_params(ScrnInfoPtr scrn, intel_adaptor_private *adaptor_priv, sho
114                             ((width << 1) + pitchAlignMask) & ~pitchAlignMask;
115                         *size = *dstPitch * height;
116                 }
117 -               *dstPitch2 = 0;
118 +               break;
119 +#ifdef INTEL_XVMC
120 +       case FOURCC_XVMC:
121 +               *dstPitch = ((width / 2) + pitchAlignMask) & ~pitchAlignMask;
122 +               *dstPitch2 = (width + pitchAlignMask) & ~pitchAlignMask;
123 +               *size = 0;
124 +               break;
125 +#endif
126 +       default:
127 +               *dstPitch = 0;
128 +               *size = 0;
129 +               break;
130         }
131  #if 0
132         ErrorF("srcPitch: %d, dstPitch: %d, size: %d\n", srcPitch, *dstPitch,
133 @@ -1409,12 +1415,12 @@ i830_setup_dst_params(ScrnInfoPtr scrn, intel_adaptor_private *adaptor_priv, sho
134  
135         if (adaptor_priv->rotation & (RR_Rotate_90 | RR_Rotate_270)) {
136                 adaptor_priv->UBufOffset =
137 -                   adaptor_priv->YBufOffset + (*dstPitch2 * width);
138 +                   adaptor_priv->YBufOffset + (*dstPitch * 2 * width);
139                 adaptor_priv->VBufOffset =
140                     adaptor_priv->UBufOffset + (*dstPitch * width / 2);
141         } else {
142                 adaptor_priv->UBufOffset =
143 -                   adaptor_priv->YBufOffset + (*dstPitch2 * height);
144 +                   adaptor_priv->YBufOffset + (*dstPitch * 2 * height);
145                 adaptor_priv->VBufOffset =
146                     adaptor_priv->UBufOffset + (*dstPitch * height / 2);
147         }
148 @@ -1445,8 +1451,7 @@ i830_copy_video_data(ScrnInfoPtr scrn, intel_adaptor_private *adaptor_priv,
149         /* copy data */
150         if (is_planar_fourcc(id)) {
151                 I830CopyPlanarData(adaptor_priv, buf, srcPitch, srcPitch2,
152 -                                  *dstPitch, *dstPitch2,
153 -                                  height, top, left, nlines,
154 +                                  *dstPitch, height, top, left, nlines,
155                                    npixels, id);
156         } else {
157                 I830CopyPackedData(adaptor_priv, buf, srcPitch, *dstPitch, top, left,
158 @@ -1483,7 +1488,8 @@ I830PutImageTextured(ScrnInfoPtr scrn,
159         intel_screen_private *intel = intel_get_screen_private(scrn);
160         intel_adaptor_private *adaptor_priv = (intel_adaptor_private *) data;
161         PixmapPtr pixmap = get_drawable_pixmap(drawable);
162 -       int dstPitch, dstPitch2;
163 +       int dstPitch;
164 +       int dstPitch2 = 0;
165         BoxRec dstBox;
166         xf86CrtcPtr crtc;
167         int top, left, npixels, nlines;
168 @@ -1509,8 +1515,8 @@ I830PutImageTextured(ScrnInfoPtr scrn,
169                 int size;
170                 i830_free_video_buffers(adaptor_priv);
171  
172 -               i830_setup_dst_params(scrn, adaptor_priv, width, height,
173 -                               &dstPitch, &dstPitch2, &size, id);
174 +               i830_setup_dst_params(scrn, adaptor_priv, width, height, &dstPitch,
175 +                               &dstPitch2, &size, id);
176  
177                 if (IS_I915G(intel) || IS_I915GM(intel)) {
178                         /* XXX: i915 is not support and needs some
179 @@ -1540,7 +1546,8 @@ I830PutImageTextured(ScrnInfoPtr scrn,
180                                          drw_w, drw_h, pixmap);
181         } else {
182                 I915DisplayVideoTextured(scrn, adaptor_priv, id, clipBoxes,
183 -                                        width, height, dstPitch, dstPitch2,
184 +                                        width, height, dstPitch,
185 +                                        dstPitch2,
186                                          src_w, src_h, drw_w, drw_h,
187                                          pixmap);
188         }
189 @@ -1608,7 +1615,7 @@ I830PutImageOverlay(ScrnInfoPtr scrn,
190                 return BadAlloc;
191  
192         if (!i830_display_overlay
193 -           (scrn, crtc, id, width, height, dstPitch, dstPitch2,
194 +           (scrn, crtc, id, width, height, dstPitch,
195              &dstBox, src_w, src_h, drw_w, drw_h))
196                 return BadAlloc;
197  
198 -- 
199 1.7.0.4
200