Ravenports generated: 25 Jan 2023 06:18
[ravenports.git] / bucket_7F / xorg-driver-video-intel
1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
2
3 NAMEBASE=               xorg-driver-video-intel
4 VERSION=                2.99.917.916
5 REVISION=               1
6 EPOCH=                  1
7 KEYWORDS=               x11_drivers
8 VARIANTS=               standard
9 SDESC[standard]=        X.org legacy driver for Intel graphic chipsets
10 HOMEPAGE=               https://www.x.org/
11 CONTACT=                nobody
12
13 DOWNLOAD_GROUPS=        main
14 SITES[main]=            https://gitlab.freedesktop.org/xorg/driver/xf86-video-intel/-/archive/
15 DISTFILE[1]=            31486f40f8e8f8923ca0799aea84b58799754564.tar.bz2:main
16 DF_INDEX=               1
17 SPKGS[standard]=        single
18
19 OPTIONS_AVAILABLE=      SNA UXA XVMC
20 OPTIONS_STANDARD=       SNA UXA XVMC
21 OPTGROUP_RADIO=         ACCEL
22 OPTDESCR[ACCEL]=        Default AccelMethod (if not specified in xorg.conf)
23 OPTGROUP[ACCEL]=        SNA UXA
24 OPT_ON[all]=            UXA XVMC
25
26 NOT_FOR_ARCH=           aarch64
27
28 BUILDRUN_DEPENDS=       xorg-server:single:standard
29                         libdrm:single:standard
30
31 USES=                   mesa libtool cpe autoreconf
32 XORG_COMPONENTS=        xorgproto pciaccess pixman
33
34 DISTNAME=               xf86-video-intel-31486f40f8e8f8923ca0799aea84b58799754564
35
36 LICENSE=                MIT:single
37 LICENSE_FILE=           MIT:{{WRKSRC}}/COPYING
38 LICENSE_SCHEME=         solo
39
40 CPE_PRODUCT=            xf86-video-intel
41 CPE_VENDOR=             x
42 FPC_EQUIVALENT=         x11-drivers/xf86-video-intel
43
44 MUST_CONFIGURE=         gnu
45 CONFIGURE_ARGS=         --disable-udev
46                         --disable-tools
47                         --enable-dri
48                         --enable-dri2
49                         --enable-dri3
50                         --with-builderstring="2.99.917.916"
51 CONFIGURE_ENV=          ac_cv_header_sys_sysinfo_h=no
52
53 INSTALL_TARGET=         install-strip
54
55 CFLAGS=                 -Wunused-but-set-variable
56
57 [XVMC].DESCRIPTION=                     X11 XvMC video extension support
58 [XVMC].BUILDRUN_DEPENDS_ON=             xorg-xcb-util:single:standard
59 [XVMC].CONFIGURE_ENABLE_BOTH=           xvmc
60 [XVMC].XORG_COMPONENTS_ON=              x11
61                                         xcb
62                                         xvmc
63
64 [SNA].DESCRIPTION=                      SandyBridge's New Acceleration
65 [SNA].CONFIGURE_ARGS_ON=                --with-default-accel=sna
66
67 [UXA].DESCRIPTION=                      Unified Acceleration Architecture
68 [UXA].CONFIGURE_ARGS_ON=                --with-default-accel=uxa
69
70 pre-configure:
71         # Broken by political correctness
72         ${SED} -i.PC \
73         -e 's|slave_dst|secondary_dst|g' \
74         -e 's|master_pixmap|primary_pixmap|g' \
75                 ${WRKSRC}/src/sna/sna_accel.c \
76                 ${WRKSRC}/src/uxa/intel_driver.c
77
78 pre-configure-dragonfly:
79         # Prefer to use dfly specific sigjmp_buf for less errors
80         ${REINPLACE_CMD} -e 's|jmp_buf |sigjmp_buf |g' \
81                 ${WRKSRC}/src/sna/sna.h \
82                 ${WRKSRC}/src/sna/sna_accel.c
83
84 [FILE:531:descriptions/desc.single]
85 The xf86-video-intel module is an open-source 2D graphics driver for
86 the X Window System as implemented by X.org. It supports a variety of
87 Intel graphics chipsets including:
88
89         i810/i810e/i810-dc100,i815,
90         i830M,845G,852GM,855GM,865G,
91         915G/GM,945G/GM/GME,946GZ
92         G/GM/GME/Q965,
93         G/Q33,G/Q35,G41,G/Q43,G/GM/Q45
94         PineView-M (Atom N400 series)
95         PineView-D (Atom D400/D500 series)
96         Intel(R) HD Graphics,
97         Intel(R) Iris(TM) Graphics,
98         Intel(R) Iris(TM) Pro Graphics.
99
100
101 [FILE:127:distinfo]
102 e47eb678c681d80df138e897ee27c79f9b42e3517d55b1f0684e9a70361c8218      1250745 31486f40f8e8f8923ca0799aea84b58799754564.tar.bz2
103
104
105 [FILE:324:manifests/plist.single]
106 %%ONLY-LINUX%%libexec/xf86-video-intel-backlight-helper
107 %%ONLY-LINUX%%share/polkit-1/actions/org.x.xf86-video-intel.backlight-helper.policy
108 lib/
109  libI810XvMC.so
110  libI810XvMC.so.1
111  libI810XvMC.so.1.0.0
112  libIntelXvMC.so
113  libIntelXvMC.so.1
114  libIntelXvMC.so.1.0.0
115 lib/xorg/modules/drivers/intel_drv.so
116 share/man/man4/intel.4.gz
117
118
119 [FILE:1201:patches/patch-benchmarks_dri3-swap.c]
120 dri3-swap.c:237:24: error: variable 'tmp' is uninitialized when used here [-Werror,-Wuninitialized]
121                         list_for_each_entry(tmp, &mru, link) {
122                                             ^~~
123 dri3-swap.c:117:45: note: expanded from macro 'list_for_each_entry'
124     for (pos = __container_of((head)->next, pos, member);               \
125                                             ^~~
126 dri3-swap.c:114:41: note: expanded from macro '__container_of'
127     (void *)((char *)(ptr) - ((char *)&(sample)->member - (char *)(sample)))
128                                         ^~~~~~
129 dri3-swap.c:236:22: note: initialize the variable 'tmp' to silence this warning
130                         struct buffer *tmp, *b = NULL;
131                                           ^
132                                            = NULL
133
134 --- benchmarks/dri3-swap.c.orig 2021-01-15 20:59:05 UTC
135 +++ benchmarks/dri3-swap.c
136 @@ -233,7 +233,7 @@ static void run(Display *dpy, Window win
137         clock_gettime(CLOCK_MONOTONIC, &start);
138         do {
139                 for (n = 0; n < 1000; n++) {
140 -                       struct buffer *tmp, *b = NULL;
141 +                       struct buffer *tmp = NULL, *b = NULL;
142                         list_for_each_entry(tmp, &mru, link) {
143                                 if (!tmp->busy) {
144                                         b = tmp;
145
146
147 [FILE:3970:patches/patch-hyphen]
148 Add hyphen to RANDR output names for consistency with modesetting(4x)
149
150 --- src/sna/sna_display.c.orig  2021-01-15 20:59:05 UTC
151 +++ src/sna/sna_display.c
152 @@ -467,7 +467,7 @@ static inline uint32_t fb_id(struct kgem
153  
154  unsigned sna_crtc_count_sprites(xf86CrtcPtr crtc)
155  {
156 -       struct plane *sprite;
157 +       struct plane *sprite = NULL;
158         unsigned count;
159  
160         count = 0;
161 @@ -479,7 +479,7 @@ unsigned sna_crtc_count_sprites(xf86Crtc
162  
163  static struct plane *lookup_sprite(struct sna_crtc *crtc, unsigned idx)
164  {
165 -       struct plane *sprite;
166 +       struct plane *sprite = NULL;
167  
168         list_for_each_entry(sprite, &crtc->sprites, link)
169                 if (idx-- == 0)
170 @@ -1727,7 +1727,7 @@ static bool wait_for_shadow(struct sna *
171  
172         if ((flags & MOVE_WRITE) == 0) {
173                 if ((flags & __MOVE_SCANOUT) == 0) {
174 -                       struct sna_crtc *crtc;
175 +                       struct sna_crtc *crtc = NULL;
176  
177                         list_for_each_entry(crtc, &sna->mode.shadow_crtc, shadow_link) {
178                                 if (overlap(&sna->mode.shadow_region.extents,
179 @@ -1768,7 +1768,7 @@ static bool wait_for_shadow(struct sna *
180  
181         flip_active = sna->mode.flip_active;
182         if (flip_active) {
183 -               struct sna_crtc *crtc;
184 +               struct sna_crtc *crtc = NULL;
185                 list_for_each_entry(crtc, &sna->mode.shadow_crtc, shadow_link)
186                         flip_active -= crtc->flip_pending;
187                 DBG(("%s: %d flips still pending, shadow flip_active=%d\n",
188 @@ -3263,7 +3263,7 @@ static void
189  sna_crtc_destroy(xf86CrtcPtr crtc)
190  {
191         struct sna_crtc *sna_crtc = to_sna_crtc(crtc);
192 -       struct plane *sprite, *sn;
193 +       struct plane *sprite = NULL, *sn;
194  
195         if (sna_crtc == NULL)
196                 return;
197 @@ -3652,7 +3652,7 @@ bool sna_has_sprite_format(struct sna *s
198  
199         for (i = 0; i < sna->mode.num_real_crtc; i++) {
200                 struct sna_crtc *sna_crtc = to_sna_crtc(config->crtc[i]);
201 -               struct plane *plane;
202 +               struct plane *plane = NULL;
203  
204                 list_for_each_entry(plane, &sna_crtc->sprites, link) {
205                         struct local_mode_get_plane p;
206 @@ -8639,7 +8639,7 @@ sna_mode_disable_secondary_planes(struct
207         for (c = 0; c < sna->mode.num_real_crtc; c++) {
208                 xf86CrtcPtr crtc = config->crtc[c];
209                 struct sna_crtc *sna_crtc = to_sna_crtc(crtc);
210 -               struct plane *plane;
211 +               struct plane *plane = NULL;
212  
213                 list_for_each_entry(plane, &sna_crtc->sprites, link) {
214                         struct local_mode_get_plane p;
215 @@ -8737,7 +8737,7 @@ static bool
216  sna_crtc_hide_planes(struct sna *sna, struct sna_crtc *crtc)
217  {
218         struct local_mode_set_plane s;
219 -       struct plane *plane;
220 +       struct plane *plane = NULL;
221  
222         if (crtc->primary.id == 0)
223                 return false;
224 @@ -8774,7 +8774,7 @@ void sna_mode_reset(struct sna *sna)
225  
226         for (i = 0; i < sna->mode.num_real_crtc; i++) {
227                 struct sna_crtc *sna_crtc = to_sna_crtc(config->crtc[i]);
228 -               struct plane *plane;
229 +               struct plane *plane = NULL;
230  
231                 assert(sna_crtc != NULL);
232  
233 --- src/uxa/intel_display.c.orig        2021-01-15 20:59:05 UTC
234 +++ src/uxa/intel_display.c
235 @@ -1872,7 +1872,7 @@ intel_drm_abort_one(struct intel_drm_que
236  void
237  intel_drm_abort(ScrnInfoPtr scrn, Bool (*match)(void *data, void *match_data), void *match_data)
238  {
239 -       struct intel_drm_queue *q;
240 +       struct intel_drm_queue *q = NULL;
241  
242         list_for_each_entry(q, &intel_drm_queue, list) {
243                 if (match(q->data, match_data)) {
244 @@ -1888,7 +1888,7 @@ intel_drm_abort(ScrnInfoPtr scrn, Bool (
245  void
246  intel_drm_abort_seq(ScrnInfoPtr scrn, uint32_t seq)
247  {
248 -       struct intel_drm_queue *q;
249 +       struct intel_drm_queue *q = NULL;
250  
251         list_for_each_entry(q, &intel_drm_queue, list) {
252                 if (q->seq == seq) {
253 @@ -1905,7 +1905,7 @@ intel_drm_abort_seq(ScrnInfoPtr scrn, ui
254  static void
255  intel_drm_abort_scrn(ScrnInfoPtr scrn)
256  {
257 -       struct intel_drm_queue *q, *tmp;
258 +       struct intel_drm_queue *q = NULL, *tmp;
259  
260         list_for_each_entry_safe(q, tmp, &intel_drm_queue, list) {
261                 if (q->scrn == scrn)
262 @@ -1994,7 +1994,7 @@ static void
263  intel_drm_handler(int fd, uint32_t frame, uint32_t sec, uint32_t usec, void *user_ptr)
264  {
265         uint32_t user_data = (intptr_t)user_ptr;
266 -       struct intel_drm_queue *q;
267 +       struct intel_drm_queue *q = NULL;
268  
269         list_for_each_entry(q, &intel_drm_queue, list) {
270                 if (q->seq == user_data) {
271
272
273 [FILE:774:patches/patch-prefer-iris]
274 Chase https://gitlab.freedesktop.org/mesa/mesa/-/commit/adaa3583f507
275
276 --- src/sna/sna_dri2.c.orig     2021-01-15 20:59:05 UTC
277 +++ src/sna/sna_dri2.c
278 @@ -3707,8 +3707,10 @@ static const char *dri_driver_name(struc
279                         return has_i830_dri() ? "i830" : "i915";
280                 else if (sna->kgem.gen < 040)
281                         return "i915";
282 -               else
283 +               else if (sna->kgem.gen < 0100)
284                         return "i965";
285 +               else
286 +                       return "iris";
287         }
288  
289         return s;
290 --- src/uxa/intel_dri.c.orig    2021-01-15 20:59:05 UTC
291 +++ src/uxa/intel_dri.c
292 @@ -1540,8 +1540,10 @@ static const char *dri_driver_name(intel
293                         return has_i830_dri() ? "i830" : "i915";
294                 else if (INTEL_INFO(intel)->gen < 040)
295                         return "i915";
296 -               else
297 +               else if (INTEL_INFO(intel)->gen < 0100)
298                         return "i965";
299 +               else
300 +                       return "iris";
301         }
302  
303         return s;
304
305
306 [FILE:955:patches/patch-src_intel__device.c]
307 i915 requires KMS, so FreeBSD uses suffix to distinguish drm1 and drm2 drivers.
308 drm-kmod kept the same name at the cost of conflict with in-base drm2.
309
310 --- src/intel_device.c.orig     2021-01-15 20:59:05 UTC
311 +++ src/intel_device.c
312 @@ -204,6 +204,7 @@ static inline struct intel_device *intel
313  }
314  
315  static const char *kernel_module_names[] ={
316 +       "i915kms",
317         "i915",
318         NULL,
319  };
320 @@ -424,6 +425,10 @@ static int __intel_open_device__legacy(c
321                  "pci:%04x:%02x:%02x.%d",
322                  pci->domain, pci->bus, pci->dev, pci->func);
323  
324 +#if defined(__DragonFly__)
325 +       /* assume modesetting for i915, allow multiple loads and no fbcon */
326 +       load_i915_kernel_module();
327 +#else
328         ret = drmCheckModesettingSupported(id);
329         if (ret) {
330                 if (load_i915_kernel_module() == 0)
331 @@ -433,6 +438,7 @@ static int __intel_open_device__legacy(c
332                 /* Be nice to the user and load fbcon too */
333                 (void)xf86LoadKernelModule("fbcon");
334         }
335 +#endif
336  
337         return fd_set_nonblock(drmOpen(NULL, id));
338  }
339
340
341 [FILE:8142:patches/patch-src_intel__list.h]
342 kgem.c:2864:22: error: variable 'bo' is uninitialized when used here [-Werror,-Wuninitialized]
343         list_for_each_entry(bo, &kgem->snoop, list) {
344                             ^~
345 ../../src/intel_list.h:328:45: note: expanded from macro 'list_for_each_entry'
346     for (pos = __container_of((head)->next, pos, member);               \
347                                             ^~~
348 ../../src/intel_list.h:309:41: note: expanded from macro '__container_of'
349     (void *)((char *)(ptr) - ((char *)&(sample)->member - (char *)(sample)))
350                                         ^~~~~~
351 kgem.c:2849:20: note: initialize the variable 'bo' to silence this warning
352         struct kgem_bo *bo, *first = NULL;
353                           ^
354                            = NULL
355 kgem.c:3118:27: error: variable 'bo' is uninitialized when used here [-Werror,-Wuninitialized]
356         list_for_each_entry_safe(bo, next, &kgem->flushing, request) {
357                                  ^~
358 ../../src/intel_list.h:345:45: note: expanded from macro 'list_for_each_entry_safe'
359     for (pos = __container_of((head)->next, pos, member),               \
360                                             ^~~
361 ../../src/intel_list.h:309:41: note: expanded from macro '__container_of'
362     (void *)((char *)(ptr) - ((char *)&(sample)->member - (char *)(sample)))
363                                         ^~~~~~
364 kgem.c:3115:20: note: initialize the variable 'bo' to silence this warning
365         struct kgem_bo *bo, *next;
366                           ^
367                            = NULL
368 kgem.c:3429:27: error: variable 'bo' is uninitialized when used here [-Werror,-Wuninitialized]
369         list_for_each_entry_safe(bo, next, &rq->buffers, request) {
370                                  ^~
371 ../../src/intel_list.h:345:45: note: expanded from macro 'list_for_each_entry_safe'
372     for (pos = __container_of((head)->next, pos, member),               \
373                                             ^~~
374 ../../src/intel_list.h:309:41: note: expanded from macro '__container_of'
375     (void *)((char *)(ptr) - ((char *)&(sample)->member - (char *)(sample)))
376                                         ^~~~~~
377 kgem.c:3425:20: note: initialize the variable 'bo' to silence this warning
378         struct kgem_bo *bo, *next;
379                           ^
380                            = NULL
381 kgem.c:3541:27: error: variable 'bo' is uninitialized when used here [-Werror,-Wuninitialized]
382         list_for_each_entry_safe(bo, next, &kgem->batch_buffers, base.list) {
383                                  ^~
384 ../../src/intel_list.h:345:45: note: expanded from macro 'list_for_each_entry_safe'
385     for (pos = __container_of((head)->next, pos, member),               \
386                                             ^~~
387 ../../src/intel_list.h:309:41: note: expanded from macro '__container_of'
388     (void *)((char *)(ptr) - ((char *)&(sample)->member - (char *)(sample)))
389                                         ^~~~~~
390 kgem.c:3539:24: note: initialize the variable 'bo' to silence this warning
391         struct kgem_buffer *bo, *next;
392                               ^
393                                = NULL
394 kgem.c:3930:22: error: variable 'bo' is uninitialized when used here [-Werror,-Wuninitialized]
395         list_for_each_entry(bo, list, list) {
396                             ^~
397 ../../src/intel_list.h:328:45: note: expanded from macro 'list_for_each_entry'
398     for (pos = __container_of((head)->next, pos, member);               \
399                                             ^~~
400 ../../src/intel_list.h:309:41: note: expanded from macro '__container_of'
401     (void *)((char *)(ptr) - ((char *)&(sample)->member - (char *)(sample)))
402                                         ^~~~~~
403 kgem.c:3928:20: note: initialize the variable 'bo' to silence this warning
404         struct kgem_bo *bo;
405                           ^
406                            = NULL
407 kgem.c:4670:23: error: variable 'bo' is uninitialized when used here [-Werror,-Wuninitialized]
408                 list_for_each_entry(bo, cache, vma) {
409                                     ^~
410 ../../src/intel_list.h:328:45: note: expanded from macro 'list_for_each_entry'
411     for (pos = __container_of((head)->next, pos, member);               \
412                                             ^~~
413 ../../src/intel_list.h:309:41: note: expanded from macro '__container_of'
414     (void *)((char *)(ptr) - ((char *)&(sample)->member - (char *)(sample)))
415                                         ^~~~~~
416 kgem.c:4576:20: note: initialize the variable 'bo' to silence this warning
417         struct kgem_bo *bo, *first = NULL;
418                           ^
419                            = NULL
420 kgem.c:5411:31: error: variable 'bo' is uninitialized when used here [-Werror,-Wuninitialized]
421                 list_for_each_entry_reverse(bo, &kgem->scanout, list) {
422                                             ^~
423 ../../src/intel_list.h:333:45: note: expanded from macro 'list_for_each_entry_reverse'
424     for (pos = __container_of((head)->prev, pos, member);               \
425                                             ^~~
426 ../../src/intel_list.h:309:41: note: expanded from macro '__container_of'
427     (void *)((char *)(ptr) - ((char *)&(sample)->member - (char *)(sample)))
428                                         ^~~~~~
429 kgem.c:5380:20: note: initialize the variable 'bo' to silence this warning
430         struct kgem_bo *bo;
431                           ^
432                            = NULL
433 kgem.c:7225:22: error: variable 'bo' is uninitialized when used here [-Werror,-Wuninitialized]
434         list_for_each_entry(bo, buffers, request) {
435                             ^~
436 ../../src/intel_list.h:328:45: note: expanded from macro 'list_for_each_entry'
437     for (pos = __container_of((head)->next, pos, member);               \
438                                             ^~~
439 ../../src/intel_list.h:309:41: note: expanded from macro '__container_of'
440     (void *)((char *)(ptr) - ((char *)&(sample)->member - (char *)(sample)))
441                                         ^~~~~~
442 kgem.c:7223:20: note: initialize the variable 'bo' to silence this warning
443         struct kgem_bo *bo;
444                           ^
445                            = NULL
446 kgem.c:7517:22: error: variable 'bo' is uninitialized when used here [-Werror,-Wuninitialized]
447         list_for_each_entry(bo, &kgem->batch_buffers, base.list) {
448                             ^~
449 ../../src/intel_list.h:328:45: note: expanded from macro 'list_for_each_entry'
450     for (pos = __container_of((head)->next, pos, member);               \
451                                             ^~~
452 ../../src/intel_list.h:309:41: note: expanded from macro '__container_of'
453     (void *)((char *)(ptr) - ((char *)&(sample)->member - (char *)(sample)))
454                                         ^~~~~~
455 kgem.c:7503:24: note: initialize the variable 'bo' to silence this warning
456         struct kgem_buffer *bo;
457                               ^
458                                = NULL
459
460 --- src/intel_list.h.orig       2021-01-15 20:59:05 UTC
461 +++ src/intel_list.h
462 @@ -325,12 +325,12 @@ list_is_empty(const struct list *head)
463   *
464   */
465  #define list_for_each_entry(pos, head, member)                         \
466 -    for (pos = __container_of((head)->next, pos, member);              \
467 +    for (pos = NULL, pos = __container_of((head)->next, pos, member);  \
468          &pos->member != (head);                                        \
469          pos = __container_of(pos->member.next, pos, member))
470  
471 -#define list_for_each_entry_reverse(pos, head, member)                         \
472 -    for (pos = __container_of((head)->prev, pos, member);              \
473 +#define list_for_each_entry_reverse(pos, head, member)                 \
474 +    for (pos = NULL, pos = __container_of((head)->prev, pos, member);  \
475          &pos->member != (head);                                        \
476          pos = __container_of(pos->member.prev, pos, member))
477  
478 @@ -342,7 +342,7 @@ list_is_empty(const struct list *head)
479   * See list_for_each_entry for more details.
480   */
481  #define list_for_each_entry_safe(pos, tmp, head, member)               \
482 -    for (pos = __container_of((head)->next, pos, member),              \
483 +    for (pos = NULL, pos = __container_of((head)->next, pos, member),  \
484          tmp = __container_of(pos->member.next, pos, member);           \
485          &pos->member != (head);                                        \
486          pos = tmp, tmp = __container_of(pos->member.next, tmp, member))
487
488
489 [FILE:1144:patches/patch-src_legacy_i810_i810__dri.c]
490 $NetBSD: patch-src_legacy_i810_i810__dri.c,v 1.1 2015/04/20 13:39:00 khorben Exp $
491
492 CID 1107540: Make the code safe avoiding random stack access. In
493 the first loop where there is a singleton point to pptSrc, only
494 access that singleton, no matter what.
495
496 November 2013 patch from NetBSD xsrc:
497 http://mail-index.netbsd.org/source-changes/2013/11/14/msg049188.html
498
499 --- src/legacy/i810/i810_dri.c.orig     2021-01-15 20:59:05 UTC
500 +++ src/legacy/i810/i810_dri.c
501 @@ -1104,10 +1104,17 @@ I810DRIMoveBuffers(WindowPtr pParent, DD
502             while ((pboxNext >= pbox) && (pboxBase->y1 == pboxNext->y1))
503                pboxNext--;
504             pboxTmp = pboxNext + 1;
505 -           pptTmp = pptSrc + (pboxTmp - pbox);
506 -           while (pboxTmp <= pboxBase) {
507 -              *pboxNew1++ = *pboxTmp++;
508 -              *pptNew1++ = *pptTmp++;
509 +           if (pptSrc == &ptOldOrg) {
510 +               if (pboxTmp <= pboxBase) {
511 +                 *pboxNew1++ = *pboxTmp;
512 +                 *pptNew1++ = *pptSrc;
513 +               }
514 +           } else {
515 +              pptTmp = pptSrc + (pboxTmp - pbox);
516 +              while (pboxTmp <= pboxBase) {
517 +                 *pboxNew1++ = *pboxTmp++;
518 +                 *pptNew1++ = *pptTmp++;
519 +              }
520             }
521             pboxBase = pboxNext;
522          }
523
524
525 [FILE:4511:patches/patch-src_sna_kgem.c]
526 https://gitlab.freedesktop.org/xorg/driver/xf86-video-intel/-/issues/171
527 https://gitlab.freedesktop.org/E5ten/xf86-video-intel/-/commit/a92ccaf05efe8f11b3c5cd217d48ad3cf4caa090
528
529 --- src/sna/kgem.c.orig 2021-01-15 20:59:05 UTC
530 +++ src/sna/kgem.c
531 @@ -71,7 +71,11 @@ search_snoop_cache(struct kgem *kgem, un
532  #define DBG_NO_USERPTR 0
533  #define DBG_NO_UNSYNCHRONIZED_USERPTR 0
534  #define DBG_NO_COHERENT_MMAP_GTT 0
535 +#if defined __DragonFly__
536 +#define DBG_NO_LLC 1
537 +#else
538  #define DBG_NO_LLC 0
539 +#endif
540  #define DBG_NO_SEMAPHORES 0
541  #define DBG_NO_MADV 0
542  #define DBG_NO_UPLOAD_CACHE 0
543 @@ -1189,13 +1193,18 @@ static int gem_param(struct kgem *kgem,
544  static bool test_has_execbuffer2(struct kgem *kgem)
545  {
546         struct drm_i915_gem_execbuffer2 execbuf;
547 +       int ret;
548  
549         memset(&execbuf, 0, sizeof(execbuf));
550         execbuf.buffer_count = 1;
551  
552 -       return do_ioctl(kgem->fd,
553 -                        DRM_IOCTL_I915_GEM_EXECBUFFER2,
554 -                        &execbuf) == -EFAULT;
555 +       ret = do_ioctl(kgem->fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
556 +#ifdef __FreeBSD__
557 +       /* XXX FreeBSD returns ENOENT instead of EFAULT. */
558 +       if (ret == -ENOENT)
559 +               return true;
560 +#endif
561 +       return ret == -EFAULT;
562  }
563  
564  static bool test_has_no_reloc(struct kgem *kgem)
565 @@ -2861,7 +2870,7 @@ static bool kgem_bo_move_to_cache(struct
566  static struct kgem_bo *
567  search_snoop_cache(struct kgem *kgem, unsigned int num_pages, unsigned flags)
568  {
569 -       struct kgem_bo *bo, *first = NULL;
570 +       struct kgem_bo *bo = NULL, *first = NULL;
571  
572         DBG(("%s: num_pages=%d, flags=%x\n", __FUNCTION__, num_pages, flags));
573  
574 @@ -3127,7 +3136,7 @@ void kgem_retire__buffers(struct kgem *k
575  
576  static bool kgem_retire__flushing(struct kgem *kgem)
577  {
578 -       struct kgem_bo *bo, *next;
579 +       struct kgem_bo *bo = NULL, *next;
580         bool retired = false;
581  
582         list_for_each_entry_safe(bo, next, &kgem->flushing, request) {
583 @@ -3425,7 +3434,7 @@ static void kgem_commit__check_reloc(str
584  #ifndef NDEBUG
585  static void kgem_commit__check_buffers(struct kgem *kgem)
586  {
587 -       struct kgem_buffer *bo;
588 +       struct kgem_buffer *bo = NULL;
589  
590         list_for_each_entry(bo, &kgem->active_buffers, base.list)
591                 assert(bo->base.exec == NULL);
592 @@ -3437,7 +3446,7 @@ static void kgem_commit__check_buffers(s
593  static void kgem_commit(struct kgem *kgem)
594  {
595         struct kgem_request *rq = kgem->next_request;
596 -       struct kgem_bo *bo, *next;
597 +       struct kgem_bo *bo = NULL, *next;
598  
599         kgem_commit__check_reloc(kgem);
600  
601 @@ -3551,7 +3560,7 @@ static void kgem_close_inactive(struct k
602  
603  static void kgem_finish_buffers(struct kgem *kgem)
604  {
605 -       struct kgem_buffer *bo, *next;
606 +       struct kgem_buffer *bo = NULL, *next;
607  
608         list_for_each_entry_safe(bo, next, &kgem->batch_buffers, base.list) {
609                 DBG(("%s: buffer handle=%d, used=%d, exec?=%d, write=%d, mmapped=%s, refcnt=%d\n",
610 @@ -3940,7 +3949,7 @@ static int compact_batch_surface(struct
611  
612  static struct kgem_bo *first_available(struct kgem *kgem, struct list *list)
613  {
614 -       struct kgem_bo *bo;
615 +       struct kgem_bo *bo = NULL;
616  
617         list_for_each_entry(bo, list, list) {
618                 assert(bo->refcnt > 0);
619 @@ -4224,7 +4233,7 @@ void _kgem_submit(struct kgem *kgem)
620                        kgem->nreloc, kgem->nexec, kgem->nfence, kgem->aperture, kgem->aperture_fenced, kgem->aperture_high, kgem->aperture_total, -ret);
621  
622                 for (i = 0; i < kgem->nexec; i++) {
623 -                       struct kgem_bo *bo, *found = NULL;
624 +                       struct kgem_bo *bo = NULL, *found = NULL;
625  
626                         list_for_each_entry(bo, &kgem->next_request->buffers, request) {
627                                 if (bo->handle == kgem->exec[i].handle) {
628 @@ -4588,7 +4597,7 @@ bool kgem_cleanup_cache(struct kgem *kge
629  static struct kgem_bo *
630  search_linear_cache(struct kgem *kgem, unsigned int num_pages, unsigned flags)
631  {
632 -       struct kgem_bo *bo, *first = NULL;
633 +       struct kgem_bo *bo = NULL, *first = NULL;
634         bool use_active = (flags & CREATE_INACTIVE) == 0;
635         struct list *cache;
636  
637 @@ -5392,7 +5401,7 @@ struct kgem_bo *kgem_create_2d(struct kg
638                                uint32_t flags)
639  {
640         struct list *cache;
641 -       struct kgem_bo *bo;
642 +       struct kgem_bo *bo = NULL;
643         uint32_t pitch, tiled_height, size;
644         uint32_t handle;
645         int i, bucket, retry;
646 @@ -7245,7 +7254,7 @@ void kgem_bo_sync__gtt(struct kgem *kgem
647  void kgem_clear_dirty(struct kgem *kgem)
648  {
649         struct list * const buffers = &kgem->next_request->buffers;
650 -       struct kgem_bo *bo;
651 +       struct kgem_bo *bo = NULL;
652  
653         list_for_each_entry(bo, buffers, request) {
654                 if (!bo->gpu_dirty)
655 @@ -7525,7 +7534,7 @@ struct kgem_bo *kgem_create_buffer(struc
656                                    uint32_t size, uint32_t flags,
657                                    void **ret)
658  {
659 -       struct kgem_buffer *bo;
660 +       struct kgem_buffer *bo = NULL;
661         unsigned offset, alloc;
662         struct kgem_bo *old;
663  
664
665
666 [FILE:856:patches/patch-src_sna_kgem__debug.c]
667 $NetBSD: patch-src_sna_kgem__debug.c,v 1.1 2022/03/15 18:53:42 tnn Exp $
668
669 https://gitlab.freedesktop.org/xorg/driver/xf86-video-intel/-/issues/171
670 https://gitlab.freedesktop.org/E5ten/xf86-video-intel/-/commit/a92ccaf05efe8f11b3c5cd217d48ad3cf4caa090
671
672 --- src/sna/kgem_debug.c.orig   2021-01-15 20:59:05 UTC
673 +++ src/sna/kgem_debug.c
674 @@ -56,7 +56,7 @@ struct kgem_bo *
675  kgem_debug_get_bo_for_reloc_entry(struct kgem *kgem,
676                                   struct drm_i915_gem_relocation_entry *reloc)
677  {
678 -       struct kgem_bo *bo;
679 +       struct kgem_bo *bo = NULL;
680  
681         if (reloc == NULL)
682                 return NULL;
683 @@ -86,7 +86,7 @@ static int kgem_debug_handle_is_fenced(s
684  
685  static int kgem_debug_handle_tiling(struct kgem *kgem, uint32_t handle)
686  {
687 -       struct kgem_bo *bo;
688 +       struct kgem_bo *bo = NULL;
689  
690         list_for_each_entry(bo, &kgem->next_request->buffers, request)
691                 if (bo->target_handle == handle)
692
693
694 [FILE:851:patches/patch-src_sna_sna__damage.c]
695 $NetBSD: patch-src_sna_sna__damage.c,v 1.1 2022/03/15 18:53:42 tnn Exp $
696
697 https://gitlab.freedesktop.org/xorg/driver/xf86-video-intel/-/issues/171
698 https://gitlab.freedesktop.org/E5ten/xf86-video-intel/-/commit/a92ccaf05efe8f11b3c5cd217d48ad3cf4caa090
699
700 --- src/sna/sna_damage.c.orig   2021-01-15 20:59:05 UTC
701 +++ src/sna/sna_damage.c
702 @@ -215,7 +215,7 @@ static void __sna_damage_reduce(struct s
703         int n, nboxes;
704         BoxPtr boxes, free_boxes = NULL;
705         pixman_region16_t *region = &damage->region;
706 -       struct sna_damage_box *iter;
707 +       struct sna_damage_box *iter = NULL;
708  
709         assert(damage->mode != DAMAGE_ALL);
710         assert(damage->dirty);
711 @@ -1808,7 +1808,7 @@ void _sna_damage_debug_get_region(struct
712  {
713         int n, nboxes;
714         BoxPtr boxes;
715 -       struct sna_damage_box *iter;
716 +       struct sna_damage_box *iter = NULL;
717  
718         RegionCopy(r, &damage->region);
719         if (!damage->dirty)
720
721
722 [FILE:614:patches/patch-src_sna_sna__dri3.c]
723 $NetBSD: patch-src_sna_sna__dri3.c,v 1.1 2022/03/15 18:53:42 tnn Exp $
724
725 https://gitlab.freedesktop.org/xorg/driver/xf86-video-intel/-/issues/171
726 https://gitlab.freedesktop.org/E5ten/xf86-video-intel/-/commit/a92ccaf05efe8f11b3c5cd217d48ad3cf4caa090
727
728 --- src/sna/sna_dri3.c.orig     2021-01-15 20:59:05 UTC
729 +++ src/sna/sna_dri3.c
730 @@ -175,7 +175,7 @@ static PixmapPtr sna_dri3_pixmap_from_fd
731  {
732         struct sna *sna = to_sna_from_screen(screen);
733         PixmapPtr pixmap;
734 -       struct sna_pixmap *priv;
735 +       struct sna_pixmap *priv = NULL;
736         struct kgem_bo *bo;
737  
738         DBG(("%s(fd=%d, width=%d, height=%d, stride=%d, depth=%d, bpp=%d)\n",
739
740
741 [FILE:977:patches/patch-src_sna_sna__present.c]
742 $NetBSD: patch-src_sna_sna__present.c,v 1.1 2022/03/15 18:53:42 tnn Exp $
743
744 https://gitlab.freedesktop.org/xorg/driver/xf86-video-intel/-/issues/171
745 https://gitlab.freedesktop.org/E5ten/xf86-video-intel/-/commit/a92ccaf05efe8f11b3c5cd217d48ad3cf4caa090
746
747 --- src/sna/sna_present.c.orig  2021-01-15 20:59:05 UTC
748 +++ src/sna/sna_present.c
749 @@ -376,7 +376,7 @@ sna_present_get_crtc(WindowPtr window)
750  static void add_keepalive(struct sna *sna, xf86CrtcPtr crtc, uint64_t msc)
751  {
752         struct list *q = sna_crtc_vblank_queue(crtc);
753 -       struct sna_present_event *info, *tmp;
754 +       struct sna_present_event *info, *tmp = NULL;
755         union drm_wait_vblank vbl;
756  
757         list_for_each_entry(tmp, q, link) {
758 @@ -480,7 +480,7 @@ static int
759  sna_present_queue_vblank(RRCrtcPtr crtc, uint64_t event_id, uint64_t msc)
760  {
761         struct sna *sna = to_sna_from_screen(crtc->pScreen);
762 -       struct sna_present_event *info, *tmp;
763 +       struct sna_present_event *info, *tmp = NULL;
764         const struct ust_msc *swap;
765         struct list *q;
766  
767
768
769 [FILE:561:patches/patch-src_sna_sna__video.c]
770 --- src/sna/sna_video.c.orig    2021-01-15 20:59:05 UTC
771 +++ src/sna/sna_video.c
772 @@ -59,7 +59,7 @@
773  #include "intel_options.h"
774  
775  #include <xf86xv.h>
776 -#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
777 +#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
778  #include <sys/types.h>
779  #include <sys/endian.h>
780  #ifdef __OpenBSD__
781 @@ -67,6 +67,9 @@
782  #else
783  #define bswap_32 bswap32
784  #endif
785 +#elif defined(__sun)
786 +#include <sys/byteorder.h>
787 +#define bswap_32 BSWAP_32
788  #else
789  #include <byteswap.h>
790  #endif
791
792
793 [FILE:592:patches/patch-src_uxa_intel__batchbuffer.c]
794 $NetBSD: patch-src_uxa_intel__batchbuffer.c,v 1.1 2022/03/15 18:53:42 tnn Exp $
795
796 Similar to https://gitlab.freedesktop.org/xorg/driver/xf86-video-intel/-/issues/171
797
798 --- src/uxa/intel_batchbuffer.c.orig    2021-01-15 20:59:05 UTC
799 +++ src/uxa/intel_batchbuffer.c
800 @@ -142,7 +142,7 @@ void intel_batch_teardown(ScrnInfoPtr sc
801  static void intel_batch_do_flush(ScrnInfoPtr scrn)
802  {
803         intel_screen_private *intel = intel_get_screen_private(scrn);
804 -       struct intel_uxa_pixmap *priv;
805 +       struct intel_uxa_pixmap *priv = NULL;
806  
807         list_for_each_entry(priv, &intel->batch_pixmaps, batch)
808                 priv->dirty = 0;
809
810
811 [FILE:4751:patches/patch-test_present-speed.c]
812 present-speed.c:317:23: error: variable 'b' is uninitialized when used here [-Werror,-Wuninitialized]
813                 list_for_each_entry(b, &mru, link)
814                                     ^
815 present-speed.c:115:45: note: expanded from macro 'list_for_each_entry'
816     for (pos = __container_of((head)->next, pos, member);               \
817                                             ^~~
818 present-speed.c:112:41: note: expanded from macro '__container_of'
819     (void *)((char *)(ptr) - ((char *)&(sample)->member - (char *)(sample)))
820                                         ^~~~~~
821 present-speed.c:297:19: note: initialize the variable 'b' to silence this warning
822                 struct buffer *b;
823                                 ^
824                                  = NULL
825 present-speed.c:229:19: error: variable 'tmp' is used uninitialized whenever its declaration is reached
826       [-Werror,-Wsometimes-uninitialized]
827                         struct buffer *tmp, *b = NULL;
828                         ~~~~~~~~~~~~~~~^~~
829 present-speed.c:231:24: note: uninitialized use occurs here
830                         list_for_each_entry(tmp, &mru, link) {
831                                             ^~~
832 present-speed.c:115:45: note: expanded from macro 'list_for_each_entry'
833     for (pos = __container_of((head)->next, pos, member);               \
834                                             ^~~
835 present-speed.c:112:41: note: expanded from macro '__container_of'
836     (void *)((char *)(ptr) - ((char *)&(sample)->member - (char *)(sample)))
837                                         ^~~~~~
838 present-speed.c:229:22: note: initialize the variable 'tmp' to silence this warning
839                         struct buffer *tmp, *b = NULL;
840                                           ^
841                                            = NULL
842 present-speed.c:557:24: error: variable 'b' is uninitialized when used here [-Werror,-Wuninitialized]
843                         list_for_each_entry(b, &pp[i].mru, link)
844                                             ^
845 present-speed.c:115:45: note: expanded from macro 'list_for_each_entry'
846     for (pos = __container_of((head)->next, pos, member);               \
847                                             ^~~
848 present-speed.c:112:41: note: expanded from macro '__container_of'
849     (void *)((char *)(ptr) - ((char *)&(sample)->member - (char *)(sample)))
850                                         ^~~~~~
851 present-speed.c:537:20: note: initialize the variable 'b' to silence this warning
852                         struct buffer *b;
853                                         ^
854                                          = NULL
855 present-speed.c:467:19: error: variable 'tmp' is used uninitialized whenever its declaration is reached
856       [-Werror,-Wsometimes-uninitialized]
857                         struct buffer *tmp, *b = NULL;
858                         ~~~~~~~~~~~~~~~^~~
859 present-speed.c:469:24: note: uninitialized use occurs here
860                         list_for_each_entry(tmp, &pp[i].mru, link) {
861                                             ^~~
862 present-speed.c:115:45: note: expanded from macro 'list_for_each_entry'
863     for (pos = __container_of((head)->next, pos, member);               \
864                                             ^~~
865 present-speed.c:112:41: note: expanded from macro '__container_of'
866     (void *)((char *)(ptr) - ((char *)&(sample)->member - (char *)(sample)))
867                                         ^~~~~~
868 present-speed.c:467:22: note: initialize the variable 'tmp' to silence this warning
869                         struct buffer *tmp, *b = NULL;
870                                           ^
871                                            = NULL
872
873 --- test/present-speed.c.orig   2021-01-15 20:59:05 UTC
874 +++ test/present-speed.c
875 @@ -226,7 +226,7 @@ static void run(Display *dpy, Window win
876         clock_gettime(CLOCK_MONOTONIC, &start);
877         do {
878                 for (n = 0; n < 1000; n++) {
879 -                       struct buffer *tmp, *b = NULL;
880 +                       struct buffer *tmp = NULL, *b = NULL;
881  retry:
882                         list_for_each_entry(tmp, &mru, link) {
883                                 if (tmp->fence.xid)
884 @@ -294,7 +294,7 @@ retry:
885         } while (end.tv_sec < start.tv_sec + 10);
886  
887         if (options & DRI3) {
888 -               struct buffer *b;
889 +               struct buffer *b = NULL;
890                 XID pixmap;
891  
892                 pixmap = xcb_generate_id(c);
893 @@ -464,7 +464,7 @@ static void perpixel(Display *dpy,
894         clock_gettime(CLOCK_MONOTONIC, &start);
895         do {
896                 for (i = 0; i < sz; i++) {
897 -                       struct buffer *tmp, *b = NULL;
898 +                       struct buffer *tmp = NULL, *b = NULL;
899  retry:
900                         list_for_each_entry(tmp, &pp[i].mru, link) {
901                                 if (tmp->fence.xid)
902 @@ -534,7 +534,7 @@ retry:
903         for (i = 0; i < sz; i++) {
904                 if (options & DRI3) {
905                         int depth = DefaultDepth(dpy, DefaultScreen(dpy));
906 -                       struct buffer *b;
907 +                       struct buffer *b = NULL;
908                         XID pixmap;
909  
910                         pixmap = xcb_generate_id(c);
911
912
913 [FILE:284:dragonfly/patch-src_sna_sna__threads.c]
914 --- src/sna/sna_threads.c.orig  2018-12-03 09:01:25 UTC
915 +++ src/sna/sna_threads.c
916 @@ -29,6 +29,9 @@
917  #include "config.h"
918  #endif
919  
920 +#define _WITH_GETLINE  /* to expose getline() in stdio.h on FreeBSD */
921 +#include <stdio.h>     /* for getline() */
922 +
923  #include "sna.h"
924  
925  #include <unistd.h>
926