Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / hidds / nouveau / xf86-video-nouveau.diff
blob93b42860cd2fdad430c3def21e854da0c222202c
1 diff -ur /data/deadwood/source/xf86-video-nouveau-src-2011-08-23/nouveau_exa.c xf86-video-nouveau/nouveau_exa.c
2 --- /data/deadwood/source/xf86-video-nouveau-src-2011-08-23/nouveau_exa.c 2011-08-23 04:10:58.000000000 +0200
3 +++ xf86-video-nouveau/nouveau_exa.c 2011-10-05 18:57:25.000000000 +0200
4 @@ -22,6 +22,7 @@
6 #include "nv_include.h"
7 #include "nv04_pushbuf.h"
8 +#if !defined(__AROS__)
9 #include "exa.h"
11 static inline Bool
12 @@ -40,17 +41,31 @@
14 return TRUE;
16 +#endif
18 +#if !defined(__AROS__)
19 static inline Bool
20 NVAccelDownloadM2MF(PixmapPtr pspix, int x, int y, int w, int h,
21 char *dst, unsigned dst_pitch)
23 ScrnInfoPtr pScrn = xf86Screens[pspix->drawable.pScreen->myNum];
24 +#else
25 +static inline Bool
26 +NVAccelDownloadM2MF(PixmapPtr pspix, int x, int y, int w, int h,
27 + char *dst, unsigned dst_pitch,
28 + HIDDT_StdPixFmt dstPixFmt, OOP_Class *cl, OOP_Object *o)
30 + ScrnInfoPtr pScrn = globalcarddataptr;
31 +#endif
32 NVPtr pNv = NVPTR(pScrn);
33 struct nouveau_channel *chan = pNv->chan;
34 struct nouveau_grobj *m2mf = pNv->NvMemFormat;
35 struct nouveau_bo *bo = nouveau_pixmap_bo(pspix);
36 +#if !defined(__AROS__)
37 unsigned cpp = pspix->drawable.bitsPerPixel / 8;
38 +#else
39 + unsigned cpp = pspix->depth > 16 ? 4 : 2;
40 +#endif
41 unsigned line_len = w * cpp;
42 unsigned src_offset = 0, src_pitch = 0, linear = 0;
43 /* Maximum DMA transfer */
44 @@ -90,8 +105,13 @@
45 BEGIN_RING(chan, m2mf, NV50_MEMORY_TO_MEMORY_FORMAT_LINEAR_IN, 7);
46 OUT_RING (chan, 0);
47 OUT_RING (chan, bo->tile_mode << 4);
48 +#if !defined(__AROS__)
49 OUT_RING (chan, pspix->drawable.width * cpp);
50 OUT_RING (chan, pspix->drawable.height);
51 +#else
52 + OUT_RING (chan, pspix->width * cpp);
53 + OUT_RING (chan, pspix->height);
54 +#endif
55 OUT_RING (chan, 1);
56 OUT_RING (chan, 0);
57 OUT_RING (chan, (y << 16) | (x * cpp));
58 @@ -134,6 +154,7 @@
59 return FALSE;
61 src = pNv->GART->map;
62 +#if !defined(__AROS__)
63 if (dst_pitch == line_len) {
64 memcpy(dst, src, dst_pitch * line_count);
65 dst += dst_pitch * line_count;
66 @@ -144,6 +165,15 @@
67 dst += dst_pitch;
70 +#else
71 + (void)i;
72 + HiddNouveauReadIntoRAM(
73 + src, line_len,
74 + dst, dst_pitch, dstPixFmt,
75 + w, line_count,
76 + cl, o);
77 + dst += dst_pitch * line_count;
78 +#endif
79 nouveau_bo_unmap(pNv->GART);
81 if (linear)
82 @@ -155,16 +185,29 @@
83 return TRUE;
86 +#if !defined(__AROS__)
87 static inline Bool
88 NVAccelUploadM2MF(PixmapPtr pdpix, int x, int y, int w, int h,
89 const char *src, int src_pitch)
91 ScrnInfoPtr pScrn = xf86Screens[pdpix->drawable.pScreen->myNum];
92 +#else
93 +static inline Bool
94 +NVAccelUploadM2MF(PixmapPtr pdpix, int x, int y, int w, int h,
95 + const char *src, int src_pitch,
96 + HIDDT_StdPixFmt srcPixFmt, OOP_Class *cl, OOP_Object *o)
98 + ScrnInfoPtr pScrn = globalcarddataptr;
99 +#endif
100 NVPtr pNv = NVPTR(pScrn);
101 struct nouveau_channel *chan = pNv->chan;
102 struct nouveau_grobj *m2mf = pNv->NvMemFormat;
103 struct nouveau_bo *bo = nouveau_pixmap_bo(pdpix);
104 +#if !defined(__AROS__)
105 unsigned cpp = pdpix->drawable.bitsPerPixel / 8;
106 +#else
107 + unsigned cpp = pdpix->depth > 16 ? 4 : 2;
108 +#endif
109 unsigned line_len = w * cpp;
110 unsigned dst_offset = 0, dst_pitch = 0, linear = 0;
111 /* Maximum DMA transfer */
112 @@ -191,6 +234,7 @@
113 if (nouveau_bo_map(pNv->GART, NOUVEAU_BO_WR))
114 return FALSE;
115 dst = pNv->GART->map;
116 +#if !defined(__AROS__)
117 if (src_pitch == line_len) {
118 memcpy(dst, src, src_pitch * line_count);
119 src += src_pitch * line_count;
120 @@ -201,6 +245,15 @@
121 dst += line_len;
124 +#else
125 + (void)i;
126 + HiddNouveauWriteFromRAM(
127 + (APTR)src, src_pitch, srcPixFmt,
128 + dst, line_len,
129 + w, line_count,
130 + cl, o);
131 + src += src_pitch * line_count;
132 +#endif
133 nouveau_bo_unmap(pNv->GART);
135 if (MARK_RING(chan, 32, 6))
136 @@ -223,8 +276,13 @@
137 BEGIN_RING(chan, m2mf, NV50_MEMORY_TO_MEMORY_FORMAT_LINEAR_OUT, 7);
138 OUT_RING (chan, 0);
139 OUT_RING (chan, bo->tile_mode << 4);
140 +#if !defined(__AROS__)
141 OUT_RING (chan, pdpix->drawable.width * cpp);
142 OUT_RING (chan, pdpix->drawable.height);
143 +#else
144 + OUT_RING (chan, pdpix->width * cpp);
145 + OUT_RING (chan, pdpix->height);
146 +#endif
147 OUT_RING (chan, 1);
148 OUT_RING (chan, 0);
149 OUT_RING (chan, (y << 16) | (x * cpp));
150 @@ -270,6 +328,7 @@
151 return TRUE;
154 +#if !defined(__AROS__)
155 static int
156 nouveau_exa_mark_sync(ScreenPtr pScreen)
158 @@ -350,11 +409,16 @@
159 nouveau_bo_ref(NULL, &nvpix->bo);
160 free(nvpix);
162 +#endif
164 -bool
165 +Bool
166 nv50_style_tiled_pixmap(PixmapPtr ppix)
168 +#if !defined(__AROS__)
169 ScrnInfoPtr pScrn = xf86Screens[ppix->drawable.pScreen->myNum];
170 +#else
171 + ScrnInfoPtr pScrn = globalcarddataptr;
172 +#endif
173 NVPtr pNv = NVPTR(pScrn);
175 return pNv->Architecture >= NV_ARCH_50 &&
176 @@ -362,6 +426,7 @@
177 NOUVEAU_BO_TILE_LAYOUT_MASK);
180 +#if !defined(__AROS__)
181 static Bool
182 nouveau_exa_download_from_screen(PixmapPtr pspix, int x, int y, int w, int h,
183 char *dst, int dst_pitch)
184 @@ -593,3 +658,55 @@
185 pNv->EXADriverPtr = exa;
186 return TRUE;
188 +#endif
191 +/* AROS CODE */
193 +Bool NVC0AccelUploadM2MF(PixmapPtr pdpix, int x, int y, int w, int h,
194 + const char *src, int src_pitch,
195 + HIDDT_StdPixFmt srcPixFmt, OOP_Class *cl, OOP_Object *o);
197 +/* NOTE: Assumes lock on bitmap is already made */
198 +/* NOTE: Assumes lock on GART object is already made */
199 +/* NOTE: Assumes buffer is not mapped */
200 +BOOL HiddNouveauNVAccelUploadM2MF(
201 + UBYTE * srcpixels, ULONG srcpitch, HIDDT_StdPixFmt srcPixFmt,
202 + LONG x, LONG y, LONG width, LONG height,
203 + OOP_Class *cl, OOP_Object *o)
205 + struct HIDDNouveauBitMapData * bmdata = OOP_INST_DATA(cl, o);
206 + struct CardData * carddata = &(SD(cl)->carddata);
208 + if (carddata->architecture >= NV_ARCH_C0)
209 + return NVC0AccelUploadM2MF(bmdata, x, y, width, height,
210 + srcpixels, srcpitch, srcPixFmt, cl, o);
211 + else
212 + return NVAccelUploadM2MF(bmdata, x, y, width, height,
213 + srcpixels, srcpitch, srcPixFmt, cl, o);
216 +Bool
217 +NVC0AccelDownloadM2MF(PixmapPtr pspix, int x, int y, int w, int h,
218 + char *dst, unsigned dst_pitch,
219 + HIDDT_StdPixFmt dstPixFmt, OOP_Class *cl, OOP_Object *o);
221 +/* NOTE: Assumes lock on bitmap is already made */
222 +/* NOTE: Assumes lock on GART object is already made */
223 +/* NOTE: Assumes buffer is not mapped */
224 +BOOL HiddNouveauNVAccelDownloadM2MF(
225 + UBYTE * dstpixels, ULONG dstpitch, HIDDT_StdPixFmt dstPixFmt,
226 + LONG x, LONG y, LONG width, LONG height,
227 + OOP_Class *cl, OOP_Object *o)
229 + struct HIDDNouveauBitMapData * bmdata = OOP_INST_DATA(cl, o);
230 + struct CardData * carddata = &(SD(cl)->carddata);
232 + if (carddata->architecture >= NV_ARCH_C0)
233 + return NVC0AccelDownloadM2MF(bmdata, x, y, width, height,
234 + dstpixels, dstpitch, dstPixFmt, cl, o);
235 + else
236 + return NVAccelDownloadM2MF(bmdata, x, y, width, height,
237 + dstpixels, dstpitch, dstPixFmt, cl, o);
240 diff -ur /data/deadwood/source/xf86-video-nouveau-src-2011-08-23/nouveau_local.h xf86-video-nouveau/nouveau_local.h
241 --- /data/deadwood/source/xf86-video-nouveau-src-2011-08-23/nouveau_local.h 2011-08-23 04:10:58.000000000 +0200
242 +++ xf86-video-nouveau/nouveau_local.h 2011-05-29 21:41:00.000000000 +0200
243 @@ -23,8 +23,10 @@
244 #ifndef __NOUVEAU_LOCAL_H__
245 #define __NOUVEAU_LOCAL_H__
247 +#if !defined(__AROS__)
248 #include "compiler.h"
249 #include "xf86_OSproc.h"
250 +#endif
252 /* Debug output */
253 #define NOUVEAU_MSG(fmt,args...) ErrorF(fmt, ##args)
254 diff -ur /data/deadwood/source/xf86-video-nouveau-src-2011-08-23/nv04_exa.c xf86-video-nouveau/nv04_exa.c
255 --- /data/deadwood/source/xf86-video-nouveau-src-2011-08-23/nv04_exa.c 2011-08-23 04:10:58.000000000 +0200
256 +++ xf86-video-nouveau/nv04_exa.c 2011-10-05 18:49:17.000000000 +0200
257 @@ -40,6 +40,7 @@
258 OUT_RING (chan, pat1);
261 +#if !defined(__AROS__)
262 static void
263 NV04EXASetROP(ScrnInfoPtr pScrn, CARD32 alu, CARD32 planemask)
265 @@ -63,7 +64,20 @@
266 pNv->currentRop = alu;
269 +#else
270 +static void
271 +NV04EXASetROP(ScrnInfoPtr pScrn, CARD32 alu, CARD32 planemask)
273 + NVPtr pNv = NVPTR(pScrn);
274 + struct nouveau_channel *chan = pNv->chan;
275 + struct nouveau_grobj *rop = pNv->NvRop;
277 + BEGIN_RING(chan, rop, NV03_CONTEXT_ROP_ROP, 1);
278 + OUT_RING (chan, NVROP[alu].copy);
280 +#endif
282 +#if !defined(__AROS__)
283 static void
284 NV04EXAStateSolidResubmit(struct nouveau_channel *chan)
286 @@ -72,11 +86,16 @@
288 NV04EXAPrepareSolid(pNv->pdpix, pNv->alu, pNv->planemask, pNv->fg_colour);
290 +#endif
292 Bool
293 NV04EXAPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg)
295 +#if !defined(__AROS__)
296 ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
297 +#else
298 + ScrnInfoPtr pScrn = globalcarddataptr;
299 +#endif
300 NVPtr pNv = NVPTR(pScrn);
301 struct nouveau_channel *chan = pNv->chan;
302 struct nouveau_grobj *surf2d = pNv->NvContextSurfaces;
303 @@ -87,10 +106,14 @@
304 if (MARK_RING(chan, 64, 2))
305 return FALSE;
307 +#if !defined(__AROS__)
308 planemask |= ~0 << pPixmap->drawable.bitsPerPixel;
309 if (planemask != ~0 || alu != GXcopy) {
310 if (pPixmap->drawable.bitsPerPixel == 32)
311 return FALSE;
312 +#else
313 + if (alu != 0x03 /* DrawMode_Copy */) {
314 +#endif
315 BEGIN_RING(chan, rect, NV04_GDI_RECTANGLE_TEXT_OPERATION, 1);
316 OUT_RING (chan, 1); /* ROP_AND */
317 NV04EXASetROP(pScrn, alu, planemask);
318 @@ -103,6 +126,7 @@
319 return FALSE;
320 pitch = exaGetPixmapPitch(pPixmap);
322 +#if !defined(__AROS__)
323 if (pPixmap->drawable.bitsPerPixel == 16) {
324 if (pPixmap->drawable.depth == 16) {
325 fmt2 = NV04_GDI_RECTANGLE_TEXT_COLOR_FORMAT_A16R5G6B5;
326 @@ -110,6 +134,10 @@
327 fmt2 = NV04_GDI_RECTANGLE_TEXT_COLOR_FORMAT_X16A1R5G5B5;
330 +#else
331 + if (pPixmap->depth == 16)
332 + fmt2 = NV04_GDI_RECTANGLE_TEXT_COLOR_FORMAT_A16R5G6B5;
333 +#endif
335 /* When SURFACE_FORMAT_A8R8G8B8 is used with GDI_RECTANGLE_TEXT, the
336 * alpha channel gets forced to 0xFF for some reason. We're using
337 @@ -132,18 +160,26 @@
338 BEGIN_RING(chan, rect, NV04_GDI_RECTANGLE_TEXT_COLOR1_A, 1);
339 OUT_RING (chan, fg);
341 +#if !defined(__AROS__)
342 pNv->pdpix = pPixmap;
343 pNv->alu = alu;
344 pNv->planemask = planemask;
345 pNv->fg_colour = fg;
346 chan->flush_notify = NV04EXAStateSolidResubmit;
347 +#else
348 + chan->flush_notify = NULL;
349 +#endif
350 return TRUE;
353 void
354 NV04EXASolid (PixmapPtr pPixmap, int x1, int y1, int x2, int y2)
356 +#if !defined(__AROS__)
357 ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
358 +#else
359 + ScrnInfoPtr pScrn = globalcarddataptr;
360 +#endif
361 NVPtr pNv = NVPTR(pScrn);
362 struct nouveau_channel *chan = pNv->chan;
363 struct nouveau_grobj *rect = pNv->NvRectangle;
364 @@ -155,10 +191,13 @@
365 OUT_RING (chan, (x1 << 16) | y1);
366 OUT_RING (chan, (width << 16) | height);
368 +#if !defined(__AROS__)
369 if((width * height) >= 512)
370 +#endif
371 FIRE_RING (chan);
374 +#if !defined(__AROS__)
375 void
376 NV04EXADoneSolid (PixmapPtr pPixmap)
378 @@ -177,12 +216,17 @@
379 NV04EXAPrepareCopy(pNv->pspix, pNv->pdpix, 0, 0, pNv->alu,
380 pNv->planemask);
382 +#endif
384 Bool
385 NV04EXAPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int dx, int dy,
386 int alu, Pixel planemask)
388 +#if !defined(__AROS__)
389 ScrnInfoPtr pScrn = xf86Screens[pSrcPixmap->drawable.pScreen->myNum];
390 +#else
391 + ScrnInfoPtr pScrn = globalcarddataptr;
392 +#endif
393 NVPtr pNv = NVPTR(pScrn);
394 struct nouveau_channel *chan = pNv->chan;
395 struct nouveau_grobj *surf2d = pNv->NvContextSurfaces;
396 @@ -191,8 +235,12 @@
397 struct nouveau_bo *dst_bo = nouveau_pixmap_bo(pDstPixmap);
398 int fmt;
400 +#if !defined(__AROS__)
401 if (pSrcPixmap->drawable.bitsPerPixel !=
402 pDstPixmap->drawable.bitsPerPixel)
403 +#else
404 + if (pSrcPixmap->depth != pDstPixmap->depth)
405 +#endif
406 return FALSE;
408 if (!NVAccelGetCtxSurf2DFormatFromPixmap(pDstPixmap, &fmt))
409 @@ -201,12 +249,16 @@
410 if (MARK_RING(chan, 64, 2))
411 return FALSE;
413 +#if !defined(__AROS__)
414 planemask |= ~0 << pDstPixmap->drawable.bitsPerPixel;
415 if (planemask != ~0 || alu != GXcopy) {
416 if (pDstPixmap->drawable.bitsPerPixel == 32) {
417 MARK_UNDO(chan);
418 return FALSE;
420 +#else
421 + if (alu != 0x03 /* DrawMode_Copy */) {
422 +#endif
424 BEGIN_RING(chan, blit, NV01_IMAGE_BLIT_OPERATION, 1);
425 OUT_RING (chan, 1); /* ROP_AND */
426 @@ -227,11 +279,15 @@
427 return FALSE;
430 +#if !defined(__AROS__)
431 pNv->pspix = pSrcPixmap;
432 pNv->pdpix = pDstPixmap;
433 pNv->alu = alu;
434 pNv->planemask = planemask;
435 chan->flush_notify = NV04EXAStateCopyResubmit;
436 +#else
437 + chan->flush_notify = NULL;
438 +#endif
439 return TRUE;
442 @@ -239,10 +295,15 @@
443 NV04EXACopy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, int dstY,
444 int width, int height)
446 +#if !defined(__AROS__)
447 ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum];
448 +#else
449 + ScrnInfoPtr pScrn = globalcarddataptr;
450 +#endif
451 NVPtr pNv = NVPTR(pScrn);
452 struct nouveau_channel *chan = pNv->chan;
453 struct nouveau_grobj *blit = pNv->NvImageBlit;
454 +#if !defined(__AROS__)
455 int split_dstY = NOUVEAU_ALIGN(dstY + 1, 64);
456 int split_height = split_dstY - dstY;
458 @@ -278,16 +339,20 @@
459 height -= split_height;
460 dstY = 0;
462 +#endif
464 BEGIN_RING(chan, blit, NV01_IMAGE_BLIT_POINT_IN, 3);
465 OUT_RING (chan, (srcY << 16) | srcX);
466 OUT_RING (chan, (dstY << 16) | dstX);
467 OUT_RING (chan, (height << 16) | width);
469 +#if !defined(__AROS__)
470 if((width * height) >= 512)
471 +#endif
472 FIRE_RING (chan);
475 +#if !defined(__AROS__)
476 void
477 NV04EXADoneCopy(PixmapPtr pDstPixmap)
479 @@ -419,5 +484,43 @@
480 FIRE_RING(chan);
481 return TRUE;
483 +#endif
485 +/* AROS CODE */
487 +VOID HIDDNouveauNV04SetPattern(struct CardData * carddata, LONG clr0, LONG clr1,
488 + LONG pat0, LONG pat1)
490 + NV04EXASetPattern(carddata, clr0, clr1, pat0, pat1);
493 +/* NOTE: Assumes lock on bitmap is already made */
494 +/* NOTE: Assumes buffer is not mapped */
495 +BOOL HIDDNouveauNV04FillSolidRect(struct CardData * carddata,
496 + struct HIDDNouveauBitMapData * bmdata, LONG minX, LONG minY, LONG maxX,
497 + LONG maxY, ULONG drawmode, ULONG color)
499 + if (NV04EXAPrepareSolid(bmdata, drawmode, ~0, color))
501 + NV04EXASolid(bmdata, minX, minY, maxX + 1, maxY + 1);
502 + return TRUE;
505 + return FALSE;
508 +/* NOTE: Assumes lock on bitmap is already made */
509 +/* NOTE: Assumes buffer is not mapped */
510 +BOOL HIDDNouveauNV04CopySameFormat(struct CardData * carddata,
511 + struct HIDDNouveauBitMapData * srcdata, struct HIDDNouveauBitMapData * destdata,
512 + LONG srcX, LONG srcY, LONG destX, LONG destY, LONG width, LONG height,
513 + ULONG drawmode)
515 + if (NV04EXAPrepareCopy(srcdata, destdata, 0, 0, drawmode, ~0))
517 + NV04EXACopy(destdata, srcX, srcY, destX, destY, width, height);
518 + return TRUE;
521 + return FALSE;
523 diff -ur /data/deadwood/source/xf86-video-nouveau-src-2011-08-23/nv10_exa.c xf86-video-nouveau/nv10_exa.c
524 --- /data/deadwood/source/xf86-video-nouveau-src-2011-08-23/nv10_exa.c 2011-08-23 04:10:58.000000000 +0200
525 +++ xf86-video-nouveau/nv10_exa.c 2011-09-26 21:10:47.000000000 +0200
526 @@ -65,7 +65,11 @@
527 static int
528 get_tex_format(PicturePtr pict)
530 +#if !defined(__AROS__)
531 ScrnInfoPtr pScrn = xf86Screens[pict->pDrawable->pScreen->myNum];
532 +#else
533 + ScrnInfoPtr pScrn = globalcarddataptr;
534 +#endif
535 NVPtr pNv = NVPTR(pScrn);
537 /* If repeat is set we're always handling a 1x1 texture with
538 @@ -120,6 +124,7 @@
539 { SF(ONE_MINUS_DST_ALPHA), DF(SRC_ALPHA) }, /* AtopReverse */
540 { SF(ONE_MINUS_DST_ALPHA), DF(ONE_MINUS_SRC_ALPHA) }, /* Xor */
541 { SF(ONE), DF(ONE) }, /* Add */
542 + { SF(SRC_ALPHA), DF(ONE_MINUS_SRC_ALPHA) }, /* OverAlpha */
545 static inline Bool
546 @@ -141,6 +146,7 @@
547 return mask && mask->componentAlpha && PICT_FORMAT_RGB(mask->format);
550 +#if !defined(__AROS__)
551 static Bool
552 check_texture(PicturePtr pict)
554 @@ -368,6 +374,7 @@
555 print_fallback_info("Accelerating", op, src, mask, dst);
556 return TRUE;
558 +#endif
560 static Bool
561 setup_texture(NVPtr pNv, int unit, PicturePtr pict, PixmapPtr pixmap)
562 @@ -376,8 +383,13 @@
563 struct nouveau_grobj *celsius = pNv->Nv3D;
564 struct nouveau_bo *bo = nouveau_pixmap_bo(pixmap);
565 unsigned tex_reloc = NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_RD;
566 +#if !defined(__AROS__)
567 long w = pict->pDrawable->width,
568 h = pict->pDrawable->height;
569 +#else
570 + long w = pixmap->width,
571 + h = pixmap->height;
572 +#endif
573 unsigned int txfmt =
574 NV10TCL_TX_FORMAT_WRAP_T_CLAMP_TO_EDGE |
575 NV10TCL_TX_FORMAT_WRAP_S_CLAMP_TO_EDGE |
576 @@ -481,8 +493,13 @@
577 (NV10TCL_RC_IN_RGB_##input##_INPUT_CONSTANT_COLOR##unit | \
578 NV10TCL_RC_IN_RGB_##input##_COMPONENT_USAGE_##chan)
580 +#if !defined(__AROS__)
581 static void
582 setup_combiners(NVPtr pNv, PicturePtr src, PicturePtr mask)
583 +#else
584 +static void
585 +setup_combiners(NVPtr pNv, PicturePtr src, PicturePtr mask, int op)
586 +#endif
588 struct nouveau_channel *chan = pNv->chan;
589 struct nouveau_grobj *celsius = pNv->Nv3D;
590 @@ -499,7 +516,11 @@
591 rc_in_alpha |= RC_IN_ONE(B);
593 if (effective_component_alpha(mask)) {
594 +#if !defined(__AROS__)
595 if (!needs_src_alpha(pNv->alu)) {
596 +#else
597 + if (!needs_src_alpha(op)) {
598 +#endif
599 /* The alpha channels won't be used for blending. Drop
600 * them, as our pixels only have 4 components...
601 * output_i = src_i * mask_i
602 @@ -535,24 +556,41 @@
603 OUT_RING (chan, rc_in_rgb);
606 +#if !defined(__AROS__)
607 static void
608 setup_blend_function(NVPtr pNv)
609 +#else
610 +static void
611 +setup_blend_function(NVPtr pNv, PicturePtr dst, PicturePtr mask, int blendop)
612 +#endif
614 struct nouveau_channel *chan = pNv->chan;
615 struct nouveau_grobj *celsius = pNv->Nv3D;
616 +#if !defined(__AROS__)
617 struct pict_op *op = &nv10_pict_op[pNv->alu];
618 +#else
619 + struct pict_op *op = &nv10_pict_op[blendop];
620 +#endif
621 int src_factor = op->src;
622 int dst_factor = op->dst;
624 if (src_factor == SF(ONE_MINUS_DST_ALPHA) &&
625 +#if !defined(__AROS__)
626 !PICT_FORMAT_A(pNv->pdpict->format))
627 +#else
628 + !PICT_FORMAT_A(dst->format))
629 +#endif
630 /* ONE_MINUS_DST_ALPHA doesn't always do the right thing for
631 * framebuffers without alpha channel. But it's the same as
632 * ZERO in that case.
634 src_factor = SF(ZERO);
636 +#if !defined(__AROS__)
637 if (effective_component_alpha(pNv->pmpict)) {
638 +#else
639 + if (effective_component_alpha(mask)) {
640 +#endif
641 if (dst_factor == DF(SRC_ALPHA))
642 dst_factor = DF(SRC_COLOR);
643 else if (dst_factor == DF(ONE_MINUS_SRC_ALPHA))
644 @@ -566,6 +604,7 @@
645 OUT_RING (chan, 1);
648 +#if !defined(__AROS__)
649 static void
650 NV10StateCompositeReemit(struct nouveau_channel *chan)
652 @@ -575,6 +614,7 @@
653 NV10EXAPrepareComposite(pNv->alu, pNv->pspict, pNv->pmpict, pNv->pdpict,
654 pNv->pspix, pNv->pmpix, pNv->pdpix);
656 +#endif
658 Bool
659 NV10EXAPrepareComposite(int op,
660 @@ -585,13 +625,18 @@
661 PixmapPtr mask,
662 PixmapPtr dst)
664 +#if !defined(__AROS__)
665 ScrnInfoPtr pScrn = xf86Screens[dst->drawable.pScreen->myNum];
666 +#else
667 + ScrnInfoPtr pScrn = globalcarddataptr;
668 +#endif
669 NVPtr pNv = NVPTR(pScrn);
670 struct nouveau_channel *chan = pNv->chan;
672 if (MARK_RING(chan, 128, 5))
673 return FALSE;
675 +#if !defined(__AROS__)
676 pNv->alu = op;
677 pNv->pspict = pict_src;
678 pNv->pmpict = pict_mask;
679 @@ -599,6 +644,7 @@
680 pNv->pspix = src;
681 pNv->pmpix = mask;
682 pNv->pdpix = dst;
683 +#endif
685 /* Set dst format */
686 if (!setup_render_target(pNv, pict_dst, dst))
687 @@ -613,6 +659,7 @@
688 !setup_texture(pNv, 1, pict_mask, mask))
689 goto fail;
691 +#if !defined(__AROS__)
692 /* Set the register combiners up. */
693 setup_combiners(pNv, pict_src, pict_mask);
695 @@ -620,6 +667,15 @@
696 setup_blend_function(pNv);
698 chan->flush_notify = NV10StateCompositeReemit;
699 +#else
700 + /* Set the register combiners up. */
701 + setup_combiners(pNv, pict_src, pict_mask, op);
703 + /* Set PictOp */
704 + setup_blend_function(pNv, pict_dst, pict_mask, op);
706 + chan->flush_notify = NULL;
707 +#endif
709 return TRUE;
711 @@ -629,6 +685,20 @@
712 return FALSE;
715 +#if defined(__AROS__)
716 +/* WARNING: These defines are only used to hack QUAD/MAP/OUT_RINGi defines
717 + in this use case. They WILL NOT work in generic case. DO NOT reuse them. */
718 +struct _PictVector
720 + float vector[3];
722 +typedef struct _PictVector PictVector;
723 +#define xFixed1 0.0f
724 +#define xFixedFrac(x) 0
725 +#define xFixedToInt(x) (x)
726 +#define IntToxFixed(x) (float)(x)
727 +#endif
729 #define QUAD(x, y, w, h) \
730 {{{ IntToxFixed(x), IntToxFixed(y), xFixed1 }}, \
731 {{ IntToxFixed(x + w), IntToxFixed(y), xFixed1 }}, \
732 @@ -670,6 +740,7 @@
733 OUT_RINGf (chan, 0);
736 +#if !defined(__AROS__)
737 static inline void
738 transform_vertex(PictTransformPtr t, int i, PictVector vs[])
740 @@ -685,18 +756,34 @@
741 int width, int height)
743 ScrnInfoPtr pScrn = xf86Screens[pix_dst->drawable.pScreen->myNum];
744 +#else
745 +static void
746 +NV10EXAComposite(PixmapPtr pix_dst,
747 + int srcX, int srcY,
748 + int maskX, int maskY,
749 + int dstX, int dstY,
750 + int width, int height,
751 + PicturePtr src, PicturePtr mask)
753 + ScrnInfoPtr pScrn = globalcarddataptr;
754 +#endif
755 NVPtr pNv = NVPTR(pScrn);
756 struct nouveau_channel *chan = pNv->chan;
757 struct nouveau_grobj *celsius = pNv->Nv3D;
758 +#if !defined(__AROS__)
759 PicturePtr mask = pNv->pmpict,
760 src = pNv->pspict;
761 +#endif
762 PictVector dstq[4] = QUAD(dstX, dstY, width, height),
763 maskq[4] = QUAD(maskX, maskY, width, height),
764 srcq[4] = QUAD(srcX, srcY, width, height);
766 +#if !defined(__AROS__)
767 + /* We are not doing any transformations */
768 MAP(transform_vertex, src->transform, srcq);
769 if (mask)
770 MAP(transform_vertex, mask->transform, maskq);
771 +#endif
773 WAIT_RING (chan, 64);
774 BEGIN_RING(chan, celsius, NV10TCL_VERTEX_BEGIN_END, 1);
775 @@ -708,6 +795,7 @@
776 OUT_RING (chan, NV10TCL_VERTEX_BEGIN_END_STOP);
779 +#if !defined(__AROS__)
780 void
781 NV10EXADoneComposite(PixmapPtr dst)
783 @@ -717,6 +805,7 @@
785 chan->flush_notify = NULL;
787 +#endif
789 Bool
790 NVAccelInitNV10TCL(ScrnInfoPtr pScrn)
791 @@ -969,3 +1058,32 @@
793 return TRUE;
796 +/* AROS CODE */
798 +/* NOTE: Assumes lock on bitmap is already made */
799 +/* NOTE: Assumes buffer is not mapped */
800 +/* NOTE: Allows different formats of source and destination */
801 +BOOL HIDDNouveauNV103DCopyBox(struct CardData * carddata,
802 + struct HIDDNouveauBitMapData * srcdata, struct HIDDNouveauBitMapData * destdata,
803 + LONG srcX, LONG srcY, LONG destX, LONG destY, LONG width, LONG height,
804 + ULONG blendop)
806 + struct Picture sPict, dPict;
807 + LONG maskX = 0; LONG maskY = 0;
809 + HIDDNouveauFillPictureFromBitMapData(&sPict, srcdata);
810 + HIDDNouveauFillPictureFromBitMapData(&dPict, destdata);
812 + if (NV10EXAPrepareComposite(blendop,
813 + &sPict, NULL, &dPict, srcdata, NULL, destdata))
815 + NV10EXAComposite(destdata, srcX, srcY,
816 + maskX, maskY,
817 + destX , destY,
818 + width, height, &sPict, NULL);
819 + return TRUE;
822 + return FALSE;
824 diff -ur /data/deadwood/source/xf86-video-nouveau-src-2011-08-23/nv30_exa.c xf86-video-nouveau/nv30_exa.c
825 --- /data/deadwood/source/xf86-video-nouveau-src-2011-08-23/nv30_exa.c 2011-08-23 04:10:58.000000000 +0200
826 +++ xf86-video-nouveau/nv30_exa.c 2011-09-26 21:11:04.000000000 +0200
827 @@ -26,6 +26,10 @@
828 #include "nv_include.h"
829 #include "nv30_shaders.h"
830 #include "nv04_pushbuf.h"
831 +#if defined(__AROS__)
832 +#include <aros/debug.h>
833 +#define NV30EXA_STATE
834 +#endif
836 typedef struct nv_pict_surface_format {
837 int pict_fmt;
838 @@ -54,8 +58,10 @@
839 float height;
840 } unit[2];
841 } nv30_exa_state_t;
842 +#if !defined(__AROS__)
843 static nv30_exa_state_t exa_state;
844 #define NV30EXA_STATE nv30_exa_state_t *state = &exa_state
845 +#endif
847 static nv_pict_surface_format_t
848 NV30SurfaceFormat[] = {
849 @@ -223,7 +229,8 @@
850 /* Atop */ { 1, 1, BF( DST_ALPHA), BF(ONE_MINUS_SRC_ALPHA) },
851 /* AtopReverse */ { 1, 1, BF(ONE_MINUS_DST_ALPHA), BF( SRC_ALPHA) },
852 /* Xor */ { 1, 1, BF(ONE_MINUS_DST_ALPHA), BF(ONE_MINUS_SRC_ALPHA) },
853 -/* Add */ { 0, 0, BF( ONE), BF( ONE) }
854 +/* Add */ { 0, 0, BF( ONE), BF( ONE) },
855 +/* OverAlpha */ { 1, 0, BF( SRC_ALPHA), BF(ONE_MINUS_SRC_ALPHA) }
858 static nv_pict_op_t *
859 @@ -299,8 +306,13 @@
863 +#if !defined(__AROS__)
864 static Bool
865 NV30EXATexture(ScrnInfoPtr pScrn, PixmapPtr pPix, PicturePtr pPict, int unit)
866 +#else
867 +static Bool
868 +NV30EXATexture(ScrnInfoPtr pScrn, PixmapPtr pPix, PicturePtr pPict, int unit, nv30_exa_state_t * state)
869 +#endif
871 NVPtr pNv = NVPTR(pScrn);
872 struct nouveau_channel *chan = pNv->chan;
873 @@ -326,9 +338,17 @@
874 if (OUT_RELOCl(chan, bo, 0, tex_reloc) ||
875 OUT_RELOCd(chan, bo, NV34TCL_TX_FORMAT_DIMS_2D | (1 << 16) | 8 |
876 (fmt->card_fmt << NV34TCL_TX_FORMAT_FORMAT_SHIFT) |
877 +#if !defined(__AROS__)
878 (log2i(pPix->drawable.width) <<
879 +#else
880 + (log2i(pPix->width) <<
881 +#endif
882 NV34TCL_TX_FORMAT_BASE_SIZE_U_SHIFT) |
883 +#if !defined(__AROS__)
884 (log2i(pPix->drawable.height) <<
885 +#else
886 + (log2i(pPix->height) <<
887 +#endif
888 NV34TCL_TX_FORMAT_BASE_SIZE_V_SHIFT),
889 tex_reloc | NOUVEAU_BO_OR,
890 NV34TCL_TX_FORMAT_DMA0, NV34TCL_TX_FORMAT_DMA1))
891 @@ -343,12 +363,21 @@
892 OUT_RING (chan, (card_filter << NV34TCL_TX_FILTER_MINIFY_SHIFT) /* min */ |
893 (card_filter << NV34TCL_TX_FILTER_MAGNIFY_SHIFT) /* mag */ |
894 0x2000 /* engine lock */);
895 +#if !defined(__AROS__)
896 OUT_RING (chan, (pPix->drawable.width << NV34TCL_TX_NPOT_SIZE_W_SHIFT) | pPix->drawable.height);
897 OUT_RING (chan, 0); /* border ARGB */
899 state->unit[unit].width = (float)pPix->drawable.width;
900 state->unit[unit].height = (float)pPix->drawable.height;
901 state->unit[unit].transform = pPict->transform;
902 +#else
903 + OUT_RING (chan, (pPix->width << NV34TCL_TX_NPOT_SIZE_W_SHIFT) | pPix->height);
904 + OUT_RING (chan, 0); /* border ARGB */
906 + state->unit[unit].width = (float)pPix->width;
907 + state->unit[unit].height = (float)pPix->height;
908 + state->unit[unit].transform = NULL; /* Keep this NULL, we are doing simple blits */
909 +#endif
911 return TRUE;
913 @@ -379,6 +408,7 @@
914 return TRUE;
917 +#if !defined(__AROS__)
918 static Bool
919 NV30EXACheckCompositeTexture(PicturePtr pPict, PicturePtr pdPict, int op)
921 @@ -460,7 +490,9 @@
922 NV30EXAPrepareComposite(pNv->alu, pNv->pspict, pNv->pmpict, pNv->pdpict,
923 pNv->pspix, pNv->pmpix, pNv->pdpix);
925 +#endif
927 +#if !defined(__AROS__)
928 Bool
929 NV30EXAPrepareComposite(int op, PicturePtr psPict,
930 PicturePtr pmPict,
931 @@ -470,6 +502,18 @@
932 PixmapPtr pdPix)
934 ScrnInfoPtr pScrn = xf86Screens[psPix->drawable.pScreen->myNum];
935 +#else
936 +static Bool
937 +NV30EXAPrepareComposite(int op, PicturePtr psPict,
938 + PicturePtr pmPict,
939 + PicturePtr pdPict,
940 + PixmapPtr psPix,
941 + PixmapPtr pmPix,
942 + PixmapPtr pdPix,
943 + nv30_exa_state_t * state)
945 + ScrnInfoPtr pScrn = globalcarddataptr;
946 +#endif
947 NVPtr pNv = NVPTR(pScrn);
948 struct nouveau_channel *chan = pNv->chan;
949 struct nouveau_grobj *rankine = pNv->Nv3D;
950 @@ -487,7 +531,11 @@
951 PICT_FORMAT_RGB(pmPict->format)));
953 if (!NV30_SetupSurface(pScrn, pdPix, pdPict) ||
954 +#if !defined(__AROS__)
955 !NV30EXATexture(pScrn, psPix, psPict, 0)) {
956 +#else
957 + !NV30EXATexture(pScrn, psPix, psPict, 0, state)) {
958 +#endif
959 MARK_UNDO(chan);
960 return FALSE;
962 @@ -507,7 +555,11 @@
963 #endif
965 if (pmPict) {
966 +#if !defined(__AROS__)
967 if (!NV30EXATexture(pScrn, pmPix, pmPict, 1)) {
968 +#else
969 + if (!NV30EXATexture(pScrn, pmPix, pmPict, 1, state)) {
970 +#endif
971 MARK_UNDO(chan);
972 return FALSE;
974 @@ -537,6 +589,7 @@
975 BEGIN_RING(chan, rankine, 0x23c, 1);
976 OUT_RING (chan, pmPict?3:1);
978 +#if !defined(__AROS__)
979 pNv->alu = op;
980 pNv->pspict = psPict;
981 pNv->pmpict = pmPict;
982 @@ -545,6 +598,9 @@
983 pNv->pmpix = pmPix;
984 pNv->pdpix = pdPix;
985 chan->flush_notify = NV30EXAStateCompositeReemit;
986 +#else
987 + chan->flush_notify = NULL;
988 +#endif
989 return TRUE;
992 @@ -555,15 +611,21 @@
993 NV30EXATransformCoord(PictTransformPtr t, int x, int y, float sx, float sy,
994 float *x_ret, float *y_ret)
996 +#if !defined(__AROS__)
997 PictVector v;
998 +#endif
1000 if (t) {
1001 + /* Note: current t is always NULL in AROS. That is good enough for
1002 + operations being done (simple blits with alpha) */
1003 +#if !defined(__AROS__)
1004 v.vector[0] = IntToxFixed(x);
1005 v.vector[1] = IntToxFixed(y);
1006 v.vector[2] = xFixed1;
1007 PictureTransformPoint(t, &v);
1008 *x_ret = xFixedToFloat(v.vector[0]);
1009 *y_ret = xFixedToFloat(v.vector[1]);
1010 +#endif
1011 } else {
1012 *x_ret = (float)x;
1013 *y_ret = (float)y;
1014 @@ -584,6 +646,7 @@
1015 OUT_RING (chan, ((dy)<<16)|(dx)); \
1016 } while(0)
1018 +#if !defined(__AROS__)
1019 void
1020 NV30EXAComposite(PixmapPtr pdPix, int srcX , int srcY,
1021 int maskX, int maskY,
1022 @@ -591,6 +654,15 @@
1023 int width, int height)
1025 ScrnInfoPtr pScrn = xf86Screens[pdPix->drawable.pScreen->myNum];
1026 +#else
1027 +static void
1028 +NV30EXAComposite(PixmapPtr pdPix, int srcX , int srcY,
1029 + int maskX, int maskY,
1030 + int dstX , int dstY,
1031 + int width, int height, nv30_exa_state_t * state)
1033 + ScrnInfoPtr pScrn = globalcarddataptr;
1034 +#endif
1035 NVPtr pNv = NVPTR(pScrn);
1036 struct nouveau_channel *chan = pNv->chan;
1037 struct nouveau_grobj *rankine = pNv->Nv3D;
1038 @@ -652,6 +724,7 @@
1039 OUT_RING (chan, 0);
1042 +#if !defined(__AROS__)
1043 void
1044 NV30EXADoneComposite(PixmapPtr pdPix)
1046 @@ -661,6 +734,7 @@
1048 chan->flush_notify = NULL;
1050 +#endif
1052 Bool
1053 NVAccelInitNV30TCL(ScrnInfoPtr pScrn)
1054 @@ -914,3 +988,33 @@
1056 return TRUE;
1059 +/* AROS CODE */
1061 +/* NOTE: Assumes lock on bitmap is already made */
1062 +/* NOTE: Assumes buffer is not mapped */
1063 +/* NOTE: Allows different formats of source and destination */
1064 +BOOL HIDDNouveauNV303DCopyBox(struct CardData * carddata,
1065 + struct HIDDNouveauBitMapData * srcdata, struct HIDDNouveauBitMapData * destdata,
1066 + LONG srcX, LONG srcY, LONG destX, LONG destY, LONG width, LONG height,
1067 + ULONG blendop)
1069 + struct Picture sPict, dPict;
1070 + nv30_exa_state_t state;
1071 + LONG maskX = 0; LONG maskY = 0;
1073 + HIDDNouveauFillPictureFromBitMapData(&sPict, srcdata);
1074 + HIDDNouveauFillPictureFromBitMapData(&dPict, destdata);
1076 + if (NV30EXAPrepareComposite(blendop,
1077 + &sPict, NULL, &dPict, srcdata, NULL, destdata, &state))
1079 + NV30EXAComposite(destdata, srcX, srcY,
1080 + maskX, maskY,
1081 + destX , destY,
1082 + width, height, &state);
1083 + return TRUE;
1086 + return FALSE;
1088 diff -ur /data/deadwood/source/xf86-video-nouveau-src-2011-08-23/nv30_shaders.c xf86-video-nouveau/nv30_shaders.c
1089 --- /data/deadwood/source/xf86-video-nouveau-src-2011-08-23/nv30_shaders.c 2011-08-23 04:10:58.000000000 +0200
1090 +++ xf86-video-nouveau/nv30_shaders.c 2011-09-05 20:03:01.000000000 +0200
1091 @@ -20,7 +20,6 @@
1092 * SOFTWARE.
1096 #include "nv30_shaders.h"
1097 #include "nv04_pushbuf.h"
1099 diff -ur /data/deadwood/source/xf86-video-nouveau-src-2011-08-23/nv40_exa.c xf86-video-nouveau/nv40_exa.c
1100 --- /data/deadwood/source/xf86-video-nouveau-src-2011-08-23/nv40_exa.c 2011-08-23 04:10:58.000000000 +0200
1101 +++ xf86-video-nouveau/nv40_exa.c 2011-09-26 21:11:21.000000000 +0200
1102 @@ -23,6 +23,10 @@
1103 #include "nv_include.h"
1104 #include "nv30_shaders.h"
1105 #include "nv04_pushbuf.h"
1106 +#if defined(__AROS__)
1107 +#include <aros/debug.h>
1108 +#define NV40EXA_STATE
1109 +#endif
1111 typedef struct nv_pict_surface_format {
1112 int pict_fmt;
1113 @@ -51,8 +55,10 @@
1114 float height;
1115 } unit[2];
1116 } nv40_exa_state_t;
1117 +#if !defined(__AROS__)
1118 static nv40_exa_state_t exa_state;
1119 #define NV40EXA_STATE nv40_exa_state_t *state = &exa_state
1120 +#endif
1122 static nv_pict_surface_format_t
1123 NV40SurfaceFormat[] = {
1124 @@ -172,7 +178,8 @@
1125 /* Atop */ { 1, 1, SF( DST_ALPHA), DF(ONE_MINUS_SRC_ALPHA) },
1126 /* AtopReverse */ { 1, 1, SF(ONE_MINUS_DST_ALPHA), DF( SRC_ALPHA) },
1127 /* Xor */ { 1, 1, SF(ONE_MINUS_DST_ALPHA), DF(ONE_MINUS_SRC_ALPHA) },
1128 -/* Add */ { 0, 0, SF( ONE), DF( ONE) }
1129 +/* Add */ { 0, 0, SF( ONE), DF( ONE) },
1130 +/* OverAlpha */ { 1, 0, SF( SRC_ALPHA), DF(ONE_MINUS_SRC_ALPHA) }
1133 static nv_pict_op_t *
1134 @@ -233,8 +240,13 @@
1138 +#if !defined(__AROS__)
1139 static Bool
1140 NV40EXATexture(ScrnInfoPtr pScrn, PixmapPtr pPix, PicturePtr pPict, int unit)
1141 +#else
1142 +static Bool
1143 +NV40EXATexture(ScrnInfoPtr pScrn, PixmapPtr pPix, PicturePtr pPict, int unit, nv40_exa_state_t * state)
1144 +#endif
1146 NVPtr pNv = NVPTR(pScrn);
1147 struct nouveau_channel *chan = pNv->chan;
1148 @@ -291,6 +303,7 @@
1149 OUT_RING (chan, NV40TCL_TEX_FILTER_MIN_NEAREST |
1150 NV40TCL_TEX_FILTER_MAG_NEAREST | 0x3fd6);
1152 +#if !defined(__AROS__)
1153 OUT_RING (chan, (pPix->drawable.width << 16) | pPix->drawable.height);
1154 OUT_RING (chan, 0); /* border ARGB */
1155 BEGIN_RING(chan, curie, NV40TCL_TEX_SIZE1(unit), 1);
1156 @@ -300,6 +313,17 @@
1157 state->unit[unit].width = (float)pPix->drawable.width;
1158 state->unit[unit].height = (float)pPix->drawable.height;
1159 state->unit[unit].transform = pPict->transform;
1160 +#else
1161 + OUT_RING (chan, (pPix->width << 16) | pPix->height);
1162 + OUT_RING (chan, 0); /* border ARGB */
1163 + BEGIN_RING(chan, curie, NV40TCL_TEX_SIZE1(unit), 1);
1164 + OUT_RING (chan, (1 << NV40TCL_TEX_SIZE1_DEPTH_SHIFT) |
1165 + (uint32_t)pPix->pitch);
1167 + state->unit[unit].width = (float)pPix->width;
1168 + state->unit[unit].height = (float)pPix->height;
1169 + state->unit[unit].transform = NULL; /* Keep this NULL, we are doing simple blits */
1170 +#endif
1171 return TRUE;
1174 @@ -329,6 +353,7 @@
1175 return TRUE;
1178 +#if !defined(__AROS__)
1179 static Bool
1180 NV40EXACheckCompositeTexture(PicturePtr pPict, PicturePtr pdPict, int op)
1182 @@ -406,7 +431,9 @@
1183 NV40EXAPrepareComposite(pNv->alu, pNv->pspict, pNv->pmpict, pNv->pdpict,
1184 pNv->pspix, pNv->pmpix, pNv->pdpix);
1186 +#endif
1188 +#if !defined(__AROS__)
1189 Bool
1190 NV40EXAPrepareComposite(int op, PicturePtr psPict,
1191 PicturePtr pmPict,
1192 @@ -416,6 +443,18 @@
1193 PixmapPtr pdPix)
1195 ScrnInfoPtr pScrn = xf86Screens[psPix->drawable.pScreen->myNum];
1196 +#else
1197 +static Bool
1198 +NV40EXAPrepareComposite(int op, PicturePtr psPict,
1199 + PicturePtr pmPict,
1200 + PicturePtr pdPict,
1201 + PixmapPtr psPix,
1202 + PixmapPtr pmPix,
1203 + PixmapPtr pdPix,
1204 + nv40_exa_state_t * state)
1206 + ScrnInfoPtr pScrn = globalcarddataptr;
1207 +#endif
1208 NVPtr pNv = NVPTR(pScrn);
1209 struct nouveau_channel *chan = pNv->chan;
1210 struct nouveau_grobj *curie = pNv->Nv3D;
1211 @@ -433,14 +472,22 @@
1212 PICT_FORMAT_RGB(pmPict->format)));
1214 if (!NV40_SetupSurface(pScrn, pdPix, pdPict->format) ||
1215 +#if !defined(__AROS__)
1216 !NV40EXATexture(pScrn, psPix, psPict, 0)) {
1217 +#else
1218 + !NV40EXATexture(pScrn, psPix, psPict, 0, state)) {
1219 +#endif
1220 MARK_UNDO(chan);
1221 return FALSE;
1224 NV40_LoadVtxProg(pScrn, &nv40_vp_exa_render);
1225 if (pmPict) {
1226 +#if !defined(__AROS__)
1227 if (!NV40EXATexture(pScrn, pmPix, pmPict, 1)) {
1228 +#else
1229 + if (!NV40EXATexture(pScrn, pmPix, pmPict, 1, state)) {
1230 +#endif
1231 MARK_UNDO(chan);
1232 return FALSE;
1234 @@ -476,6 +523,7 @@
1235 BEGIN_RING(chan, curie, NV40TCL_TEX_CACHE_CTL, 1);
1236 OUT_RING (chan, 1);
1238 +#if !defined(__AROS__)
1239 pNv->alu = op;
1240 pNv->pspict = psPict;
1241 pNv->pmpict = pmPict;
1242 @@ -484,6 +532,9 @@
1243 pNv->pmpix = pmPix;
1244 pNv->pdpix = pdPix;
1245 chan->flush_notify = NV40EXAStateCompositeReemit;
1246 +#else
1247 + chan->flush_notify = NULL;
1248 +#endif
1249 return TRUE;
1252 @@ -495,6 +546,9 @@
1253 float *x_ret, float *y_ret)
1255 if (t) {
1256 + /* Note: current t is always NULL in AROS. That is good enough for
1257 + operations being done (simple blits with alpha) */
1258 +#if !defined(__AROS__)
1259 PictVector v;
1260 v.vector[0] = IntToxFixed(x);
1261 v.vector[1] = IntToxFixed(y);
1262 @@ -502,6 +556,7 @@
1263 PictureTransformPoint(t, &v);
1264 *x_ret = xFixedToFloat(v.vector[0]) / sx;
1265 *y_ret = xFixedToFloat(v.vector[1]) / sy;
1266 +#endif
1267 } else {
1268 *x_ret = (float)x / sx;
1269 *y_ret = (float)y / sy;
1270 @@ -522,6 +577,7 @@
1271 OUT_RING (chan, ((dy)<<16)|(dx)); \
1272 } while(0)
1274 +#if !defined(__AROS__)
1275 void
1276 NV40EXAComposite(PixmapPtr pdPix, int srcX , int srcY,
1277 int maskX, int maskY,
1278 @@ -529,11 +585,20 @@
1279 int width, int height)
1281 ScrnInfoPtr pScrn = xf86Screens[pdPix->drawable.pScreen->myNum];
1282 +#else
1283 +static void
1284 +NV40EXAComposite(PixmapPtr pdPix, int srcX , int srcY,
1285 + int maskX, int maskY,
1286 + int dstX , int dstY,
1287 + int width, int height, nv40_exa_state_t * state)
1289 + ScrnInfoPtr pScrn = globalcarddataptr;
1290 +#endif
1291 NVPtr pNv = NVPTR(pScrn);
1292 struct nouveau_channel *chan = pNv->chan;
1293 struct nouveau_grobj *curie = pNv->Nv3D;
1294 - float sX0, sX1, sX2, sY0, sY1, sY2;
1295 - float mX0, mX1, mX2, mY0, mY1, mY2;
1296 + float sX0=0.0f, sX1=0.0f, sX2=0.0f, sY0=0.0f, sY1=0.0f, sY2=0.0f;
1297 + float mX0=0.0f, mX1=0.0f, mX2=0.0f, mY0=0.0f, mY1=0.0f, mY2=0.0f;
1298 NV40EXA_STATE;
1300 WAIT_RING(chan, 64);
1301 @@ -587,6 +652,7 @@
1302 OUT_RING (chan, NV40TCL_BEGIN_END_STOP);
1305 +#if !defined(__AROS__)
1306 void
1307 NV40EXADoneComposite(PixmapPtr pdPix)
1309 @@ -596,6 +662,7 @@
1311 chan->flush_notify = NULL;
1313 +#endif
1315 #define NV40TCL_CHIPSET_4X_MASK 0x00000baf
1316 #define NV44TCL_CHIPSET_4X_MASK 0x00005450
1317 @@ -760,3 +827,33 @@
1319 return TRUE;
1322 +/* AROS CODE */
1324 +/* NOTE: Assumes lock on bitmap is already made */
1325 +/* NOTE: Assumes buffer is not mapped */
1326 +/* NOTE: Allows different formats of source and destination */
1327 +BOOL HIDDNouveauNV403DCopyBox(struct CardData * carddata,
1328 + struct HIDDNouveauBitMapData * srcdata, struct HIDDNouveauBitMapData * destdata,
1329 + LONG srcX, LONG srcY, LONG destX, LONG destY, LONG width, LONG height,
1330 + ULONG blendop)
1332 + struct Picture sPict, dPict;
1333 + nv40_exa_state_t state;
1334 + LONG maskX = 0; LONG maskY = 0;
1336 + HIDDNouveauFillPictureFromBitMapData(&sPict, srcdata);
1337 + HIDDNouveauFillPictureFromBitMapData(&dPict, destdata);
1339 + if (NV40EXAPrepareComposite(blendop,
1340 + &sPict, NULL, &dPict, srcdata, NULL, destdata, &state))
1342 + NV40EXAComposite(destdata, srcX, srcY,
1343 + maskX, maskY,
1344 + destX , destY,
1345 + width, height, &state);
1346 + return TRUE;
1349 + return FALSE;
1351 diff -ur /data/deadwood/source/xf86-video-nouveau-src-2011-08-23/nv50_accel.c xf86-video-nouveau/nv50_accel.c
1352 --- /data/deadwood/source/xf86-video-nouveau-src-2011-08-23/nv50_accel.c 2011-08-23 04:10:58.000000000 +0200
1353 +++ xf86-video-nouveau/nv50_accel.c 2011-05-29 21:41:00.000000000 +0200
1354 @@ -23,6 +23,7 @@
1355 #include "nv_include.h"
1356 #include "nv50_accel.h"
1358 +#if !defined(__AROS__)
1359 void
1360 NV50SyncToVBlank(PixmapPtr ppix, BoxPtr box)
1362 @@ -52,6 +53,7 @@
1363 BEGIN_RING(chan, nvsw, 0x0068, 1);
1364 OUT_RING (chan, 0x11111111);
1366 +#endif
1368 Bool
1369 NVAccelInitNV50TCL(ScrnInfoPtr pScrn)
1370 diff -ur /data/deadwood/source/xf86-video-nouveau-src-2011-08-23/nv50_exa.c xf86-video-nouveau/nv50_exa.c
1371 --- /data/deadwood/source/xf86-video-nouveau-src-2011-08-23/nv50_exa.c 2011-08-23 04:10:58.000000000 +0200
1372 +++ xf86-video-nouveau/nv50_exa.c 2011-09-26 21:06:19.000000000 +0200
1373 @@ -37,6 +37,7 @@
1374 float height;
1375 } unit[2];
1377 +#if !defined(__AROS__)
1378 static struct nv50_exa_state exa_state;
1380 #define NV50EXA_LOCALS(p) \
1381 @@ -46,6 +47,15 @@
1382 struct nouveau_grobj *eng2d = pNv->Nv2D; (void)eng2d; \
1383 struct nouveau_grobj *tesla = pNv->Nv3D; (void)tesla; \
1384 struct nv50_exa_state *state = &exa_state; (void)state
1385 +#else
1386 +#define NV50EXA_LOCALS(p) \
1387 + ScrnInfoPtr pScrn = globalcarddataptr; \
1388 + NVPtr pNv = NVPTR(pScrn); \
1389 + struct nouveau_channel *chan = pNv->chan; (void)chan; \
1390 + struct nouveau_grobj *eng2d = pNv->Nv2D; (void)eng2d; \
1391 + struct nouveau_grobj *tesla = pNv->Nv3D; (void)tesla;
1393 +#endif
1395 #define BF(f) NV50TCL_BLEND_FUNC_SRC_RGB_##f
1397 @@ -71,6 +81,7 @@
1398 /* AtopReverse */ { 1, 1, BF(ONE_MINUS_DST_ALPHA), BF( SRC_ALPHA) },
1399 /* Xor */ { 1, 1, BF(ONE_MINUS_DST_ALPHA), BF(ONE_MINUS_SRC_ALPHA) },
1400 /* Add */ { 0, 0, BF( ONE), BF( ONE) },
1401 +/* OverAlpha */ { 1, 0, BF( SRC_ALPHA), BF(ONE_MINUS_SRC_ALPHA) },
1404 static Bool
1405 @@ -78,7 +89,11 @@
1407 NV50EXA_LOCALS(ppix);
1409 +#if !defined(__AROS__)
1410 switch (ppix->drawable.bitsPerPixel) {
1411 +#else
1412 + switch (ppix->depth) {
1413 +#endif
1414 case 8 : *fmt = NV50_2D_SRC_FORMAT_R8_UNORM; break;
1415 case 15: *fmt = NV50_2D_SRC_FORMAT_X1R5G5B5_UNORM; break;
1416 case 16: *fmt = NV50_2D_SRC_FORMAT_R5G6B5_UNORM; break;
1417 @@ -135,14 +150,23 @@
1420 BEGIN_RING(chan, eng2d, mthd + 0x18, 4);
1421 +#if !defined(__AROS__)
1422 OUT_RING (chan, ppix->drawable.width);
1423 OUT_RING (chan, ppix->drawable.height);
1424 +#else
1425 + OUT_RING (chan, ppix->width);
1426 + OUT_RING (chan, ppix->height);
1427 +#endif
1428 if (OUT_RELOCh(chan, bo, 0, bo_flags) ||
1429 OUT_RELOCl(chan, bo, 0, bo_flags))
1430 return FALSE;
1432 if (is_src == 0)
1433 +#if !defined(__AROS__)
1434 NV50EXASetClip(ppix, 0, 0, ppix->drawable.width, ppix->drawable.height);
1435 +#else
1436 + NV50EXASetClip(ppix, 0, 0, ppix->width, ppix->height);
1437 +#endif
1439 return TRUE;
1441 @@ -159,6 +183,7 @@
1442 OUT_RING (chan, pat1);
1445 +#if !defined(__AROS__)
1446 static void
1447 NV50EXASetROP(PixmapPtr pdpix, int alu, Pixel planemask)
1449 @@ -210,7 +235,43 @@
1450 pNv->currentRop = alu;
1453 +#else
1454 +static void
1455 +NV50EXASetROP(PixmapPtr pdpix, int alu, Pixel planemask)
1457 + NV50EXA_LOCALS(pdpix);
1458 + int rop;
1460 + rop = NVROP[alu].copy;
1462 + BEGIN_RING(chan, eng2d, NV50_2D_OPERATION, 1);
1463 + if (alu == 0x03 /* DrawMode_Copy */) {
1464 + OUT_RING (chan, NV50_2D_OPERATION_SRCCOPY);
1465 + return;
1466 + } else {
1467 + OUT_RING (chan, NV50_2D_OPERATION_SRCCOPY_PREMULT);
1470 + BEGIN_RING(chan, eng2d, NV50_2D_PATTERN_FORMAT, 2);
1471 + switch (pdpix->depth) {
1472 + case 8: OUT_RING (chan, 3); break;
1473 + case 15: OUT_RING (chan, 1); break;
1474 + case 16: OUT_RING (chan, 0); break;
1475 + case 24:
1476 + case 32:
1477 + default:
1478 + OUT_RING (chan, 2);
1479 + break;
1481 + OUT_RING (chan, 1);
1484 + BEGIN_RING(chan, eng2d, NV50_2D_ROP, 1);
1485 + OUT_RING (chan, rop);
1487 +#endif
1489 +#if !defined(__AROS__)
1490 static void
1491 NV50EXAStateSolidResubmit(struct nouveau_channel *chan)
1493 @@ -220,6 +281,7 @@
1494 NV50EXAPrepareSolid(pNv->pdpix, pNv->alu, pNv->planemask,
1495 pNv->fg_colour);
1497 +#endif
1499 Bool
1500 NV50EXAPrepareSolid(PixmapPtr pdpix, int alu, Pixel planemask, Pixel fg)
1501 @@ -245,11 +307,15 @@
1502 OUT_RING (chan, fmt);
1503 OUT_RING (chan, fg);
1505 +#if !defined(__AROS__)
1506 pNv->pdpix = pdpix;
1507 pNv->alu = alu;
1508 pNv->planemask = planemask;
1509 pNv->fg_colour = fg;
1510 chan->flush_notify = NV50EXAStateSolidResubmit;
1511 +#else
1512 + chan->flush_notify = NULL;
1513 +#endif
1514 return TRUE;
1517 @@ -265,10 +331,13 @@
1518 OUT_RING (chan, x2);
1519 OUT_RING (chan, y2);
1521 +#if !defined(__AROS__)
1522 if((x2 - x1) * (y2 - y1) >= 512)
1523 +#endif
1524 FIRE_RING (chan);
1527 +#if !defined(__AROS__)
1528 void
1529 NV50EXADoneSolid(PixmapPtr pdpix)
1531 @@ -286,6 +355,7 @@
1532 NV50EXAPrepareCopy(pNv->pspix, pNv->pdpix, 0, 0, pNv->alu,
1533 pNv->planemask);
1535 +#endif
1537 Bool
1538 NV50EXAPrepareCopy(PixmapPtr pspix, PixmapPtr pdpix, int dx, int dy,
1539 @@ -308,11 +378,15 @@
1541 NV50EXASetROP(pdpix, alu, planemask);
1543 +#if !defined(__AROS__)
1544 pNv->pspix = pspix;
1545 pNv->pdpix = pdpix;
1546 pNv->alu = alu;
1547 pNv->planemask = planemask;
1548 chan->flush_notify = NV50EXAStateCopyResubmit;
1549 +#else
1550 + chan->flush_notify = NULL;
1551 +#endif
1552 return TRUE;
1555 @@ -342,10 +416,13 @@
1556 OUT_RING (chan, 0);
1557 OUT_RING (chan, srcY);
1559 +#if !defined(__AROS__)
1560 if(width * height >= 512)
1561 +#endif
1562 FIRE_RING (chan);
1565 +#if !defined(__AROS__)
1566 void
1567 NV50EXADoneCopy(PixmapPtr pdpix)
1569 @@ -463,6 +540,7 @@
1571 return TRUE;
1573 +#endif
1575 static Bool
1576 NV50EXARenderTarget(PixmapPtr ppix, PicturePtr ppict)
1577 @@ -505,14 +583,20 @@
1578 OUT_RING (chan, bo->tile_mode << 4);
1579 OUT_RING (chan, 0x00000000);
1580 BEGIN_RING(chan, tesla, NV50TCL_RT_HORIZ(0), 2);
1581 +#if !defined(__AROS__)
1582 OUT_RING (chan, ppix->drawable.width);
1583 OUT_RING (chan, ppix->drawable.height);
1584 +#else
1585 + OUT_RING (chan, ppix->width);
1586 + OUT_RING (chan, ppix->height);
1587 +#endif
1588 BEGIN_RING(chan, tesla, NV50TCL_RT_ARRAY_MODE, 1);
1589 OUT_RING (chan, 0x00000001);
1591 return TRUE;
1594 +#if !defined(__AROS__)
1595 static Bool
1596 NV50EXACheckTexture(PicturePtr ppict, PicturePtr pdpict, int op)
1598 @@ -572,13 +656,19 @@
1600 return TRUE;
1602 +#endif
1604 #define _(X1,X2,X3,X4,FMT) (NV50TIC_0_0_TYPER_UNORM | NV50TIC_0_0_TYPEG_UNORM | NV50TIC_0_0_TYPEB_UNORM | NV50TIC_0_0_TYPEA_UNORM | \
1605 NV50TIC_0_0_MAP##X1 | NV50TIC_0_0_MAP##X2 | NV50TIC_0_0_MAP##X3 | NV50TIC_0_0_MAP##X4 | \
1606 NV50TIC_0_0_FMT_##FMT)
1608 +#if !defined(__AROS__)
1609 static Bool
1610 NV50EXATexture(PixmapPtr ppix, PicturePtr ppict, unsigned unit)
1611 +#else
1612 +static Bool
1613 +NV50EXATexture(PixmapPtr ppix, PicturePtr ppict, unsigned unit, struct nv50_exa_state * state)
1614 +#endif
1616 NV50EXA_LOCALS(ppix);
1617 struct nouveau_bo *bo = nouveau_pixmap_bo(ppix);
1618 @@ -678,8 +768,13 @@
1619 NOUVEAU_BO_HIGH | NOUVEAU_BO_OR, mode, mode))
1620 return FALSE;
1621 OUT_RING (chan, 0x00300000);
1622 +#if !defined(__AROS__)
1623 OUT_RING (chan, ppix->drawable.width);
1624 OUT_RING (chan, (1 << NV50TIC_0_5_DEPTH_SHIFT) | ppix->drawable.height);
1625 +#else
1626 + OUT_RING (chan, ppix->width);
1627 + OUT_RING (chan, (1 << NV50TIC_0_5_DEPTH_SHIFT) | ppix->height);
1628 +#endif
1629 OUT_RING (chan, 0x03000000);
1630 OUT_RING (chan, 0x00000000);
1632 @@ -736,12 +831,19 @@
1633 OUT_RING (chan, 0x00000000);
1634 OUT_RING (chan, 0x00000000);
1636 +#if !defined(__AROS__)
1637 state->unit[unit].width = ppix->drawable.width;
1638 state->unit[unit].height = ppix->drawable.height;
1639 state->unit[unit].transform = ppict->transform;
1640 +#else
1641 + state->unit[unit].width = ppix->width;
1642 + state->unit[unit].height = ppix->height;
1643 + state->unit[unit].transform = NULL; /* Keep this NULL, we are doing simple blits */
1644 +#endif
1645 return TRUE;
1648 +#if !defined(__AROS__)
1649 static Bool
1650 NV50EXACheckBlend(int op)
1652 @@ -749,6 +851,7 @@
1653 NOUVEAU_FALLBACK("unsupported blend op %d\n", op);
1654 return TRUE;
1656 +#endif
1658 static void
1659 NV50EXABlend(PixmapPtr ppix, PicturePtr ppict, int op, int component_alpha)
1660 @@ -793,6 +896,7 @@
1664 +#if !defined(__AROS__)
1665 Bool
1666 NV50EXACheckComposite(int op,
1667 PicturePtr pspict, PicturePtr pmpict, PicturePtr pdpict)
1668 @@ -829,11 +933,20 @@
1669 NV50EXAPrepareComposite(pNv->alu, pNv->pspict, pNv->pmpict, pNv->pdpict,
1670 pNv->pspix, pNv->pmpix, pNv->pdpix);
1672 +#endif
1674 +#if !defined(__AROS__)
1675 Bool
1676 NV50EXAPrepareComposite(int op,
1677 PicturePtr pspict, PicturePtr pmpict, PicturePtr pdpict,
1678 PixmapPtr pspix, PixmapPtr pmpix, PixmapPtr pdpix)
1679 +#else
1680 +static Bool
1681 +NV50EXAPrepareComposite(int op,
1682 + PicturePtr pspict, PicturePtr pmpict, PicturePtr pdpict,
1683 + PixmapPtr pspix, PixmapPtr pmpix, PixmapPtr pdpix,
1684 + struct nv50_exa_state * state)
1685 +#endif
1687 NV50EXA_LOCALS(pspix);
1688 const unsigned shd_flags = NOUVEAU_BO_VRAM | NOUVEAU_BO_RD;
1689 @@ -866,13 +979,21 @@
1690 return FALSE;
1693 +#if !defined(__AROS__)
1694 if (!NV50EXATexture(pspix, pspict, 0)) {
1695 +#else
1696 + if (!NV50EXATexture(pspix, pspict, 0, state)) {
1697 +#endif
1698 MARK_UNDO(chan);
1699 NOUVEAU_FALLBACK("src picture invalid\n");
1702 if (pmpict) {
1703 +#if !defined(__AROS__)
1704 if (!NV50EXATexture(pmpix, pmpict, 1)) {
1705 +#else
1706 + if (!NV50EXATexture(pmpix, pmpict, 1, state)) {
1707 +#endif
1708 MARK_UNDO(chan);
1709 NOUVEAU_FALLBACK("mask picture invalid\n");
1711 @@ -910,6 +1031,7 @@
1712 BEGIN_RING(chan, tesla, NV50TCL_BIND_TIC(2), 1);
1713 OUT_RING (chan, 0x203);
1715 +#if !defined(__AROS__)
1716 pNv->alu = op;
1717 pNv->pspict = pspict;
1718 pNv->pmpict = pmpict;
1719 @@ -918,6 +1040,9 @@
1720 pNv->pmpix = pmpix;
1721 pNv->pdpix = pdpix;
1722 chan->flush_notify = NV50EXAStateCompositeResubmit;
1723 +#else
1724 + chan->flush_notify = NULL;
1725 +#endif
1726 return TRUE;
1729 @@ -928,6 +1053,9 @@
1730 float *x_ret, float *y_ret)
1732 if (t) {
1733 + /* Note: current t is always NULL in AROS. That is good enough for
1734 + operations being done (simple blits with alpha) */
1735 +#if !defined(__AROS__)
1736 PictVector v;
1738 v.vector[0] = IntToxFixed(x);
1739 @@ -936,18 +1064,25 @@
1740 PictureTransformPoint(t, &v);
1741 *x_ret = xFixedToFloat(v.vector[0]) / sx;
1742 *y_ret = xFixedToFloat(v.vector[1]) / sy;
1743 +#endif
1744 } else {
1745 *x_ret = (float)x / sx;
1746 *y_ret = (float)y / sy;
1750 +#if !defined(__AROS__)
1751 void
1752 NV50EXAComposite(PixmapPtr pdpix, int sx, int sy, int mx, int my,
1753 int dx, int dy, int w, int h)
1754 +#else
1755 +static void
1756 +NV50EXAComposite(PixmapPtr pdpix, int sx, int sy, int mx, int my,
1757 + int dx, int dy, int w, int h, struct nv50_exa_state * state)
1758 +#endif
1760 NV50EXA_LOCALS(pdpix);
1761 - float sX0, sX1, sX2, sY0, sY1, sY2;
1762 + float sX0=0.0f, sX1=0.0f, sX2=0.0f, sY0=0.0f, sY1=0.0f, sY2=0.0f;
1764 WAIT_RING (chan, 64);
1765 BEGIN_RING(chan, tesla, NV50TCL_SCISSOR_HORIZ(0), 2);
1766 @@ -967,7 +1102,7 @@
1767 &sX2, &sY2);
1769 if (state->have_mask) {
1770 - float mX0, mX1, mX2, mY0, mY1, mY2;
1771 + float mX0=0.0f, mX1=0.0f, mX2=0.0f, mY0=0.0f, mY1=0.0f, mY2=0.0f;
1773 NV50EXATransform(state->unit[1].transform, mx, my + (h * 2),
1774 state->unit[1].width, state->unit[1].height,
1775 @@ -992,6 +1127,7 @@
1776 OUT_RING (chan, 0);
1779 +#if !defined(__AROS__)
1780 void
1781 NV50EXADoneComposite(PixmapPtr pdpix)
1783 @@ -999,4 +1135,71 @@
1785 chan->flush_notify = NULL;
1787 +#endif
1789 +/* AROS CODE */
1791 +VOID HIDDNouveauNV50SetPattern(struct CardData * carddata, LONG col0,
1792 + LONG col1, LONG pat0, LONG pat1)
1794 + NV50EXASetPattern(NULL, col0, col1, pat0, pat1);
1797 +/* NOTE: Assumes lock on bitmap is already made */
1798 +/* NOTE: Assumes buffer is not mapped */
1799 +BOOL HIDDNouveauNV50FillSolidRect(struct CardData * carddata,
1800 + struct HIDDNouveauBitMapData * bmdata, LONG minX, LONG minY, LONG maxX,
1801 + LONG maxY, ULONG drawmode, ULONG color)
1803 + if (NV50EXAPrepareSolid(bmdata, drawmode, ~0, color))
1805 + NV50EXASolid(bmdata, minX, minY, maxX + 1, maxY + 1);
1806 + return TRUE;
1809 + return FALSE;
1812 +/* NOTE: Assumes lock on bitmap is already made */
1813 +/* NOTE: Assumes buffer is not mapped */
1814 +BOOL HIDDNouveauNV50CopySameFormat(struct CardData * carddata,
1815 + struct HIDDNouveauBitMapData * srcdata, struct HIDDNouveauBitMapData * destdata,
1816 + LONG srcX, LONG srcY, LONG destX, LONG destY, LONG width, LONG height,
1817 + ULONG drawmode)
1819 + if (NV50EXAPrepareCopy(srcdata, destdata, 0, 0, drawmode, ~0))
1821 + NV50EXACopy(destdata, srcX, srcY, destX , destY, width, height);
1822 + return TRUE;
1825 + return FALSE;
1828 +/* NOTE: Assumes lock on bitmap is already made */
1829 +/* NOTE: Assumes buffer is not mapped */
1830 +/* NOTE: Allows different formats of source and destination */
1831 +BOOL HIDDNouveauNV503DCopyBox(struct CardData * carddata,
1832 + struct HIDDNouveauBitMapData * srcdata, struct HIDDNouveauBitMapData * destdata,
1833 + LONG srcX, LONG srcY, LONG destX, LONG destY, LONG width, LONG height,
1834 + ULONG blendop)
1836 + struct Picture sPict, dPict;
1837 + struct nv50_exa_state state;
1838 + ULONG maskX = 0; ULONG maskY = 0;
1840 + HIDDNouveauFillPictureFromBitMapData(&sPict, srcdata);
1841 + HIDDNouveauFillPictureFromBitMapData(&dPict, destdata);
1843 + if (NV50EXAPrepareComposite(blendop,
1844 + &sPict, NULL, &dPict, srcdata, NULL, destdata, &state))
1846 + NV50EXAComposite(destdata, srcX, srcY,
1847 + maskX, maskY,
1848 + destX , destY,
1849 + width, height, &state);
1850 + return TRUE;
1853 + return FALSE;
1855 diff -ur /data/deadwood/source/xf86-video-nouveau-src-2011-08-23/nv_accel_common.c xf86-video-nouveau/nv_accel_common.c
1856 --- /data/deadwood/source/xf86-video-nouveau-src-2011-08-23/nv_accel_common.c 2011-08-23 04:10:58.000000000 +0200
1857 +++ xf86-video-nouveau/nv_accel_common.c 2011-10-05 19:06:30.000000000 +0200
1858 @@ -22,7 +22,11 @@
1860 #include "nv_include.h"
1861 #include "nv04_pushbuf.h"
1862 +#if defined(__AROS__)
1863 +#include <aros/debug.h>
1864 +#endif
1866 +#if !defined(__AROS__)
1867 Bool
1868 nouveau_allocate_surface(ScrnInfoPtr scrn, int width, int height, int bpp,
1869 int usage_hint, int *pitch, struct nouveau_bo **bo)
1870 @@ -149,6 +153,7 @@
1871 BEGIN_RING(chan, blit, 0x00000130, 1);
1872 OUT_RING (chan, 0);
1874 +#endif
1876 static Bool
1877 NVAccelInitDmaNotifier0(ScrnInfoPtr pScrn)
1878 @@ -193,6 +198,7 @@
1879 return TRUE;
1882 +#if !defined(__AROS__)
1883 /* FLAGS_ROP_AND, DmaFB, DmaFB, 0 */
1884 static Bool
1885 NVAccelInitContextBeta1(ScrnInfoPtr pScrn)
1886 @@ -233,11 +239,16 @@
1887 OUT_RING (chan, 0xffff0000);
1888 return TRUE;
1890 +#endif
1892 Bool
1893 NVAccelGetCtxSurf2DFormatFromPixmap(PixmapPtr pPix, int *fmt_ret)
1895 +#if !defined(__AROS__)
1896 switch (pPix->drawable.bitsPerPixel) {
1897 +#else
1898 + switch (pPix->depth) {
1899 +#endif
1900 case 32:
1901 *fmt_ret = NV04_CONTEXT_SURFACES_2D_FORMAT_A8R8G8B8;
1902 break;
1903 @@ -245,7 +256,11 @@
1904 *fmt_ret = NV04_CONTEXT_SURFACES_2D_FORMAT_X8R8G8B8_Z8R8G8B8;
1905 break;
1906 case 16:
1907 +#if !defined(__AROS__)
1908 if (pPix->drawable.depth == 16)
1909 +#else
1910 + if (pPix->depth == 16)
1911 +#endif
1912 *fmt_ret = NV04_CONTEXT_SURFACES_2D_FORMAT_R5G6B5;
1913 else
1914 *fmt_ret = NV04_CONTEXT_SURFACES_2D_FORMAT_X1R5G5B5_Z1R5G5B5;
1915 @@ -260,6 +275,7 @@
1916 return TRUE;
1919 +#if !defined(__AROS__)
1920 Bool
1921 NVAccelGetCtxSurf2DFormatFromPicture(PicturePtr pPict, int *fmt_ret)
1923 @@ -292,6 +308,7 @@
1924 else
1925 return (PixmapPtr) pDraw;
1927 +#endif
1929 static Bool
1930 NVAccelInitImagePattern(ScrnInfoPtr pScrn)
1931 @@ -339,7 +356,7 @@
1932 BEGIN_RING(chan, rop, NV03_CONTEXT_ROP_DMA_NOTIFY, 1);
1933 OUT_RING (chan, chan->nullobj->handle);
1935 - pNv->currentRop = ~0;
1936 +// pNv->currentRop = ~0;
1937 return TRUE;
1940 @@ -421,6 +438,7 @@
1941 return TRUE;
1944 +#if !defined(__AROS__)
1945 static Bool
1946 NVAccelInitScaledImage(ScrnInfoPtr pScrn)
1948 @@ -491,6 +509,7 @@
1950 return TRUE;
1952 +#endif
1954 /* FLAGS_NONE, NvDmaFB, NvDmaAGP, NvDmaNotifier0 */
1955 static Bool
1956 @@ -522,6 +541,7 @@
1957 return TRUE;
1960 +#if !defined(__AROS__)
1961 static Bool
1962 NVAccelInitImageFromCpu(ScrnInfoPtr pScrn)
1964 @@ -571,6 +591,7 @@
1966 return TRUE;
1968 +#endif
1970 static Bool
1971 NVAccelInit2D_NV50(ScrnInfoPtr pScrn)
1972 @@ -602,10 +623,11 @@
1973 BEGIN_RING(chan, eng2d, 0x58c, 1);
1974 OUT_RING (chan, 0x111);
1976 - pNv->currentRop = 0xfffffffa;
1977 +// pNv->currentRop = 0xfffffffa;
1978 return TRUE;
1981 +#if !defined(__AROS__)
1982 #define INIT_CONTEXT_OBJECT(name) do { \
1983 ret = NVAccelInit##name(pScrn); \
1984 if (!ret) { \
1985 @@ -615,6 +637,16 @@
1986 return FALSE; \
1988 } while(0)
1989 +#else
1990 +#define INIT_CONTEXT_OBJECT(name) do { \
1991 + ret = NVAccelInit##name(pScrn); \
1992 + if (!ret) { \
1993 + bug("[nouveau] Failed to initialise context object: "#name \
1994 + " (%d)\n", ret); \
1995 + return FALSE; \
1996 + } \
1997 +} while(0)
1998 +#endif
2000 Bool
2001 NVAccelCommonInit(ScrnInfoPtr pScrn)
2002 @@ -622,8 +654,10 @@
2003 NVPtr pNv = NVPTR(pScrn);
2004 Bool ret;
2006 +#if !defined(__AROS__)
2007 if (pNv->NoAccel)
2008 return TRUE;
2009 +#endif
2011 /* General engine objects */
2012 if (pNv->Architecture < NV_ARCH_C0)
2013 @@ -632,15 +666,19 @@
2014 /* 2D engine */
2015 if (pNv->Architecture < NV_ARCH_50) {
2016 INIT_CONTEXT_OBJECT(ContextSurfaces);
2017 +#if !defined(__AROS__)
2018 INIT_CONTEXT_OBJECT(ContextBeta1);
2019 INIT_CONTEXT_OBJECT(ContextBeta4);
2020 +#endif
2021 INIT_CONTEXT_OBJECT(ImagePattern);
2022 INIT_CONTEXT_OBJECT(RasterOp);
2023 INIT_CONTEXT_OBJECT(Rectangle);
2024 INIT_CONTEXT_OBJECT(ImageBlit);
2025 +#if !defined(__AROS__)
2026 INIT_CONTEXT_OBJECT(ScaledImage);
2027 INIT_CONTEXT_OBJECT(ClipRectangle);
2028 INIT_CONTEXT_OBJECT(ImageFromCpu);
2029 +#endif
2030 } else
2031 if (pNv->Architecture < NV_ARCH_C0) {
2032 INIT_CONTEXT_OBJECT(2D_NV50);
2033 @@ -682,22 +720,28 @@
2035 NVPtr pNv = NVPTR(pScrn);
2037 +#if !defined(__AROS__)
2038 if (pNv->NoAccel)
2039 return;
2040 +#endif
2042 nouveau_notifier_free(&pNv->notify0);
2043 nouveau_notifier_free(&pNv->vblank_sem);
2045 nouveau_grobj_free(&pNv->NvContextSurfaces);
2046 +#if !defined(__AROS__)
2047 nouveau_grobj_free(&pNv->NvContextBeta1);
2048 nouveau_grobj_free(&pNv->NvContextBeta4);
2049 +#endif
2050 nouveau_grobj_free(&pNv->NvImagePattern);
2051 nouveau_grobj_free(&pNv->NvRop);
2052 nouveau_grobj_free(&pNv->NvRectangle);
2053 nouveau_grobj_free(&pNv->NvImageBlit);
2054 +#if !defined(__AROS__)
2055 nouveau_grobj_free(&pNv->NvScaledImage);
2056 nouveau_grobj_free(&pNv->NvClipRectangle);
2057 nouveau_grobj_free(&pNv->NvImageFromCpu);
2058 +#endif
2059 nouveau_grobj_free(&pNv->Nv2D);
2060 nouveau_grobj_free(&pNv->NvMemFormat);
2061 nouveau_grobj_free(&pNv->NvSW);
2062 @@ -706,3 +750,16 @@
2063 nouveau_bo_ref(NULL, &pNv->tesla_scratch);
2064 nouveau_bo_ref(NULL, &pNv->shader_mem);
2068 +/* AROS CODE */
2070 +BOOL HIDDNouveauAccelCommonInit(struct CardData * carddata)
2072 + return NVAccelCommonInit(carddata);
2075 +VOID HIDDNouveauAccelFree(struct CardData * carddata)
2077 + NVAccelFree(carddata);
2079 diff -ur /data/deadwood/source/xf86-video-nouveau-src-2011-08-23/nvc0_accel.c xf86-video-nouveau/nvc0_accel.c
2080 --- /data/deadwood/source/xf86-video-nouveau-src-2011-08-23/nvc0_accel.c 2011-09-24 10:24:30.000000000 +0200
2081 +++ xf86-video-nouveau/nvc0_accel.c 2011-09-24 10:24:51.000000000 +0200
2082 @@ -76,7 +76,9 @@
2083 OUT_RING (chan, 1);
2084 FIRE_RING (chan);
2086 +#if !defined(__AROS__)
2087 pNv->currentRop = 0xfffffffa;
2088 +#endif
2089 return TRUE;
2092 diff -ur /data/deadwood/source/xf86-video-nouveau-src-2011-08-23/nvc0_exa.c xf86-video-nouveau/nvc0_exa.c
2093 --- /data/deadwood/source/xf86-video-nouveau-src-2011-08-23/nvc0_exa.c 2011-09-25 16:32:02.000000000 +0200
2094 +++ xf86-video-nouveau/nvc0_exa.c 2011-10-05 19:00:37.000000000 +0200
2095 @@ -28,29 +28,55 @@
2097 #define NOUVEAU_BO(a, b, c) (NOUVEAU_BO_##a | NOUVEAU_BO_##b | NOUVEAU_BO_##c)
2099 +#if !defined(__AROS__)
2100 Bool
2101 NVC0AccelDownloadM2MF(PixmapPtr pspix, int x, int y, int w, int h,
2102 char *dst, unsigned dst_pitch)
2104 ScrnInfoPtr pScrn = xf86Screens[pspix->drawable.pScreen->myNum];
2105 +#else
2106 +Bool
2107 +NVC0AccelDownloadM2MF(PixmapPtr pspix, int x, int y, int w, int h,
2108 + char *dst, unsigned dst_pitch,
2109 + HIDDT_StdPixFmt dstPixFmt, OOP_Class *cl, OOP_Object *o)
2111 + ScrnInfoPtr pScrn = globalcarddataptr;
2112 +#endif
2113 NVPtr pNv = NVPTR(pScrn);
2114 struct nouveau_channel *chan = pNv->chan;
2115 struct nouveau_bo *bo = nouveau_pixmap_bo(pspix);
2116 struct nouveau_grobj *m2mf = pNv->NvMemFormat;
2117 +#if !defined(__AROS__)
2118 const int cpp = pspix->drawable.bitsPerPixel / 8;
2119 const int line_len = w * cpp;
2120 const int line_limit = (128 << 10) / line_len;
2121 unsigned src_offset = 0, src_pitch = 0, tiled = 1;
2122 +#else
2123 + const int cpp = pspix->depth > 16 ? 4 : 2;
2124 + const int line_len = w * cpp;
2125 + const int line_limit = pNv->GART->size / line_len;
2126 + unsigned src_offset = 0, src_pitch = 0, tiled = 1;
2127 + unsigned int exec = (1 << 20) | NVC0_M2MF_EXEC_LINEAR_OUT;
2128 +#endif
2130 if (!nv50_style_tiled_pixmap(pspix)) {
2132 tiled = 0;
2133 src_pitch = exaGetPixmapPitch(pspix);
2134 src_offset = (y * src_pitch) + (x * cpp);
2135 +#if defined(__AROS__)
2136 + exec |= NVC0_M2MF_EXEC_LINEAR_IN;
2137 +#endif
2138 } else {
2139 BEGIN_RING(chan, m2mf, NVC0_M2MF_TILING_MODE_IN, 5);
2140 OUT_RING (chan, bo->tile_mode);
2141 +#if !defined(__AROS__)
2142 OUT_RING (chan, pspix->drawable.width * cpp);
2143 OUT_RING (chan, pspix->drawable.height);
2144 +#else
2145 + OUT_RING (chan, pspix->width * cpp);
2146 + OUT_RING (chan, pspix->height);
2147 +#endif
2148 OUT_RING (chan, 1);
2149 OUT_RING (chan, 0);
2151 @@ -86,7 +112,11 @@
2154 BEGIN_RING(chan, m2mf, NVC0_M2MF_EXEC, 1);
2155 +#if !defined(__AROS__)
2156 OUT_RING (chan, 0x100000 | (tiled << 8));
2157 +#else
2158 + OUT_RING (chan, exec | (tiled << 8));
2159 +#endif
2161 if (nouveau_bo_map(pNv->GART, NOUVEAU_BO_RD)) {
2162 MARK_UNDO(chan);
2163 @@ -94,6 +124,7 @@
2165 src = pNv->GART->map;
2167 +#if !defined(__AROS__)
2168 if (dst_pitch == line_len) {
2169 memcpy(dst, src, dst_pitch * line_count);
2170 dst += dst_pitch * line_count;
2171 @@ -104,6 +135,15 @@
2172 dst += dst_pitch;
2175 +#else
2176 + (void)i;
2177 + HiddNouveauReadIntoRAM(
2178 + (char *)src, line_len,
2179 + dst, dst_pitch, dstPixFmt,
2180 + w, line_count,
2181 + cl, o);
2182 + dst += dst_pitch * line_count;
2183 +#endif
2184 nouveau_bo_unmap(pNv->GART);
2186 if (!tiled)
2187 @@ -115,29 +155,54 @@
2188 return TRUE;
2191 +#if !defined(__AROS__)
2192 Bool
2193 NVC0AccelUploadM2MF(PixmapPtr pdpix, int x, int y, int w, int h,
2194 const char *src, int src_pitch)
2196 ScrnInfoPtr pScrn = xf86Screens[pdpix->drawable.pScreen->myNum];
2197 +#else
2198 +Bool
2199 +NVC0AccelUploadM2MF(PixmapPtr pdpix, int x, int y, int w, int h,
2200 + const char *src, int src_pitch,
2201 + HIDDT_StdPixFmt srcPixFmt, OOP_Class *cl, OOP_Object *o)
2203 + ScrnInfoPtr pScrn = globalcarddataptr;
2204 +#endif
2205 NVPtr pNv = NVPTR(pScrn);
2206 struct nouveau_channel *chan = pNv->chan;
2207 struct nouveau_bo *bo = nouveau_pixmap_bo(pdpix);
2208 struct nouveau_grobj *m2mf = pNv->NvMemFormat;
2209 +#if !defined(__AROS__)
2210 int cpp = pdpix->drawable.bitsPerPixel / 8;
2211 int line_len = w * cpp;
2212 int line_limit = (128 << 10) / line_len;
2213 unsigned dst_offset = 0, dst_pitch = 0, tiled = 1;
2214 +#else
2215 + int cpp = pdpix->depth > 16 ? 4 : 2;
2216 + int line_len = w * cpp;
2217 + int line_limit = pNv->GART->size / line_len;
2218 + unsigned dst_offset = 0, dst_pitch = 0, tiled = 1;
2219 + unsigned int exec = (1 << 20) | NVC0_M2MF_EXEC_LINEAR_IN;
2220 +#endif
2222 if (!nv50_style_tiled_pixmap(pdpix)) {
2223 tiled = 0;
2224 dst_pitch = exaGetPixmapPitch(pdpix);
2225 dst_offset = (y * dst_pitch) + (x * cpp);
2226 +#if defined(__AROS__)
2227 + exec |= NVC0_M2MF_EXEC_LINEAR_OUT;
2228 +#endif
2229 } else {
2230 BEGIN_RING(chan, m2mf, NVC0_M2MF_TILING_MODE_OUT, 5);
2231 OUT_RING (chan, bo->tile_mode);
2232 +#if !defined(__AROS__)
2233 OUT_RING (chan, pdpix->drawable.width * cpp);
2234 OUT_RING (chan, pdpix->drawable.height);
2235 +#else
2236 + OUT_RING (chan, pdpix->width * cpp);
2237 + OUT_RING (chan, pdpix->height);
2238 +#endif
2239 OUT_RING (chan, 1);
2240 OUT_RING (chan, 0);
2242 @@ -154,6 +219,7 @@
2243 return FALSE;
2244 dst = pNv->GART->map;
2246 +#if !defined(__AROS__)
2247 if (src_pitch == line_len) {
2248 memcpy(dst, src, src_pitch * line_count);
2249 src += src_pitch * line_count;
2250 @@ -162,8 +228,17 @@
2251 memcpy(dst, src, line_len);
2252 src += src_pitch;
2253 dst += line_len;
2257 +#else
2258 + (void)i;
2259 + HiddNouveauWriteFromRAM(
2260 + (APTR)src, src_pitch, srcPixFmt,
2261 + dst, line_len,
2262 + w, line_count,
2263 + cl, o);
2264 + src += src_pitch * line_count;
2265 +#endif
2266 nouveau_bo_unmap(pNv->GART);
2268 if (MARK_RING(chan, 16, 4))
2269 @@ -191,7 +266,11 @@
2270 OUT_RING (chan, line_count);
2272 BEGIN_RING(chan, m2mf, NVC0_M2MF_EXEC, 1);
2273 +#if !defined(__AROS__)
2274 OUT_RING (chan, 0x100000 | (tiled << 4));
2275 +#else
2276 + OUT_RING (chan, exec | (tiled << 4));
2277 +#endif
2278 FIRE_RING (chan);
2280 if (!tiled)
2281 @@ -203,7 +282,7 @@
2282 return TRUE;
2286 +#if !defined(__AROS__)
2287 struct nvc0_exa_state {
2288 struct {
2289 PictTransformPtr transform;
2290 @@ -215,7 +294,9 @@
2293 static struct nvc0_exa_state exa_state;
2294 +#endif
2296 +#if !defined(__AROS__)
2297 #define NVC0EXA_LOCALS(p) \
2298 ScrnInfoPtr pScrn = xf86Screens[(p)->drawable.pScreen->myNum]; \
2299 NVPtr pNv = NVPTR(pScrn); \
2300 @@ -224,7 +305,17 @@
2301 struct nouveau_grobj *eng2d = pNv->Nv2D; (void)eng2d; \
2302 struct nouveau_grobj *fermi = pNv->Nv3D; (void)fermi; \
2303 struct nvc0_exa_state *state = &exa_state; (void)state
2304 +#else
2305 +#define NVC0EXA_LOCALS(p) \
2306 + ScrnInfoPtr pScrn = globalcarddataptr; \
2307 + NVPtr pNv = NVPTR(pScrn); \
2308 + struct nouveau_channel *chan = pNv->chan; (void)chan; \
2309 + struct nouveau_grobj *m2mf = pNv->NvMemFormat; (void)m2mf; \
2310 + struct nouveau_grobj *eng2d = pNv->Nv2D; (void)eng2d; \
2311 + struct nouveau_grobj *fermi = pNv->Nv3D; (void)fermi;
2312 +#endif
2314 +#if !defined(__AROS__)
2315 #define BF(f) NV50_BLEND_FACTOR_##f
2317 struct nvc0_blend_op {
2318 @@ -250,13 +341,18 @@
2319 /* Xor */ { 1, 1, BF(ONE_MINUS_DST_ALPHA), BF(ONE_MINUS_SRC_ALPHA) },
2320 /* Add */ { 0, 0, BF( ONE), BF( ONE) },
2322 +#endif
2324 static Bool
2325 NVC0EXA2DSurfaceFormat(PixmapPtr ppix, uint32_t *fmt)
2327 NVC0EXA_LOCALS(ppix);
2329 +#if !defined(__AROS__)
2330 switch (ppix->drawable.bitsPerPixel) {
2331 +#else
2332 + switch (ppix->depth) {
2333 +#endif
2334 case 8 : *fmt = NV50_2D_SRC_FORMAT_R8_UNORM; break;
2335 case 15: *fmt = NV50_2D_SRC_FORMAT_X1R5G5B5_UNORM; break;
2336 case 16: *fmt = NV50_2D_SRC_FORMAT_R5G6B5_UNORM; break;
2337 @@ -313,14 +409,23 @@
2340 BEGIN_RING(chan, eng2d, mthd + 0x18, 4);
2341 +#if !defined(__AROS__)
2342 OUT_RING (chan, ppix->drawable.width);
2343 OUT_RING (chan, ppix->drawable.height);
2344 +#else
2345 + OUT_RING (chan, ppix->width);
2346 + OUT_RING (chan, ppix->height);
2347 +#endif
2348 if (OUT_RELOCh(chan, bo, 0, bo_flags) ||
2349 OUT_RELOCl(chan, bo, 0, bo_flags))
2350 return FALSE;
2352 if (is_src == 0)
2353 +#if !defined(__AROS__)
2354 NVC0EXASetClip(ppix, 0, 0, ppix->drawable.width, ppix->drawable.height);
2355 +#else
2356 + NVC0EXASetClip(ppix, 0, 0, ppix->width, ppix->height);
2357 +#endif
2359 return TRUE;
2361 @@ -337,6 +442,7 @@
2362 OUT_RING (chan, pat1);
2365 +#if !defined(__AROS__)
2366 static void
2367 NVC0EXASetROP(PixmapPtr pdpix, int alu, Pixel planemask)
2369 @@ -388,7 +494,42 @@
2370 pNv->currentRop = alu;
2373 +#else
2374 +static void
2375 +NVC0EXASetROP(PixmapPtr pdpix, int alu, Pixel planemask)
2377 + NVC0EXA_LOCALS(pdpix);
2378 + LONG rop;
2380 + rop = NVROP[alu].copy;
2382 + BEGIN_RING(chan, eng2d, NV50_2D_OPERATION, 1);
2383 + if (alu == 0x03 /* DrawMode_Copy */) {
2384 + OUT_RING (chan, NV50_2D_OPERATION_SRCCOPY);
2385 + return;
2386 + } else {
2387 + OUT_RING (chan, NV50_2D_OPERATION_SRCCOPY_PREMULT);
2390 + BEGIN_RING(chan, eng2d, NV50_2D_PATTERN_FORMAT, 2);
2391 + switch (pdpix->depth) {
2392 + case 8: OUT_RING (chan, 3); break;
2393 + case 15: OUT_RING (chan, 1); break;
2394 + case 16: OUT_RING (chan, 0); break;
2395 + case 24:
2396 + case 32:
2397 + default:
2398 + OUT_RING (chan, 2);
2399 + break;
2401 + OUT_RING (chan, 1);
2403 + BEGIN_RING(chan, eng2d, NV50_2D_ROP, 1);
2404 + OUT_RING (chan, rop);
2406 +#endif
2408 +#if !defined(__AROS__)
2409 static void
2410 NVC0EXAStateSolidResubmit(struct nouveau_channel *chan)
2412 @@ -398,6 +539,7 @@
2413 NVC0EXAPrepareSolid(pNv->pdpix, pNv->alu, pNv->planemask,
2414 pNv->fg_colour);
2416 +#endif
2418 Bool
2419 NVC0EXAPrepareSolid(PixmapPtr pdpix, int alu, Pixel planemask, Pixel fg)
2420 @@ -423,11 +565,15 @@
2421 OUT_RING (chan, fmt);
2422 OUT_RING (chan, fg);
2424 +#if !defined(__AROS__)
2425 pNv->pdpix = pdpix;
2426 pNv->alu = alu;
2427 pNv->planemask = planemask;
2428 pNv->fg_colour = fg;
2429 chan->flush_notify = NVC0EXAStateSolidResubmit;
2430 +#else
2431 + chan->flush_notify = NULL;
2432 +#endif
2433 return TRUE;
2436 @@ -443,10 +589,13 @@
2437 OUT_RING (chan, x2);
2438 OUT_RING (chan, y2);
2440 +#if !defined(__AROS__)
2441 if ((x2 - x1) * (y2 - y1) >= 512)
2442 +#endif
2443 FIRE_RING (chan);
2446 +#if !defined(__AROS__)
2447 void
2448 NVC0EXADoneSolid(PixmapPtr pdpix)
2450 @@ -464,6 +613,7 @@
2451 NVC0EXAPrepareCopy(pNv->pspix, pNv->pdpix, 0, 0, pNv->alu,
2452 pNv->planemask);
2454 +#endif
2456 Bool
2457 NVC0EXAPrepareCopy(PixmapPtr pspix, PixmapPtr pdpix, int dx, int dy,
2458 @@ -486,11 +636,15 @@
2460 NVC0EXASetROP(pdpix, alu, planemask);
2462 +#if !defined(__AROS__)
2463 pNv->pspix = pspix;
2464 pNv->pdpix = pdpix;
2465 pNv->alu = alu;
2466 pNv->planemask = planemask;
2467 chan->flush_notify = NVC0EXAStateCopyResubmit;
2468 +#else
2469 + chan->flush_notify = NULL;
2470 +#endif
2471 return TRUE;
2474 @@ -520,10 +674,13 @@
2475 OUT_RING (chan, 0);
2476 OUT_RING (chan, srcY);
2478 +#if !defined(__AROS__)
2479 if (width * height >= 512)
2480 +#endif
2481 FIRE_RING (chan);
2484 +#if !defined(__AROS__)
2485 void
2486 NVC0EXADoneCopy(PixmapPtr pdpix)
2488 @@ -1201,4 +1358,43 @@
2490 chan->flush_notify = NULL;
2492 +#endif
2494 +/* AROS CODE */
2496 +VOID HIDDNouveauNVC0SetPattern(struct CardData * carddata, LONG clr0, LONG clr1,
2497 + LONG pat0, LONG pat1)
2499 + NVC0EXASetPattern(NULL, clr0, clr1, pat0, pat1);
2502 +/* NOTE: Assumes lock on bitmap is already made */
2503 +/* NOTE: Assumes buffer is not mapped */
2504 +BOOL HIDDNouveauNVC0FillSolidRect(struct CardData * carddata,
2505 + struct HIDDNouveauBitMapData * bmdata, LONG minX, LONG minY, LONG maxX,
2506 + LONG maxY, ULONG drawmode, ULONG color)
2508 + if (NVC0EXAPrepareSolid(bmdata, drawmode, ~0, color))
2510 + NVC0EXASolid(bmdata, minX, minY, maxX + 1, maxY + 1);
2511 + return TRUE;
2514 + return FALSE;
2517 +/* NOTE: Assumes lock on both bitmaps is already made */
2518 +/* NOTE: Assumes both buffers are not mapped */
2519 +BOOL HIDDNouveauNVC0CopySameFormat(struct CardData * carddata,
2520 + struct HIDDNouveauBitMapData * srcdata, struct HIDDNouveauBitMapData * destdata,
2521 + LONG srcX, LONG srcY, LONG destX, LONG destY, LONG width, LONG height,
2522 + ULONG drawmode)
2524 + if (NVC0EXAPrepareCopy(srcdata, destdata, 0, 0, drawmode, ~0))
2526 + NVC0EXACopy(destdata, srcX, srcY, destX , destY, width, height);
2527 + return TRUE;
2530 + return FALSE;
2532 diff -ur /data/deadwood/source/xf86-video-nouveau-src-2011-08-23/nv_include.h xf86-video-nouveau/nv_include.h
2533 --- /data/deadwood/source/xf86-video-nouveau-src-2011-08-23/nv_include.h 2011-08-23 04:10:58.000000000 +0200
2534 +++ xf86-video-nouveau/nv_include.h 2011-09-26 21:07:38.000000000 +0200
2535 @@ -1,84 +1,168 @@
2536 #ifndef __NV_INCLUDE_H__
2537 #define __NV_INCLUDE_H__
2539 + Copyright © 2011, The AROS Development Team. All rights reserved.
2540 + $Id$
2543 -#ifdef HAVE_CONFIG_H
2544 -#include "config.h"
2545 -#endif
2547 -#include <string.h>
2548 -#include <math.h>
2549 -#include <errno.h>
2550 -#include <unistd.h>
2551 -#include <stdlib.h>
2553 -/* All drivers should typically include these */
2554 -#include "xf86.h"
2555 -#include "xf86_OSproc.h"
2556 -#define PPC_MMIO_IS_BE
2557 -#include "compiler.h"
2559 -/* Drivers for PCI hardware need this */
2560 -#include "xf86PciInfo.h"
2562 -/* Drivers that need to access the PCI config space directly need this */
2563 -#include "xf86Pci.h"
2565 -/* All drivers initialising the SW cursor need this */
2566 -#include "mipointer.h"
2568 -/* All drivers implementing backing store need this */
2569 -#include "mibstore.h"
2571 -#include "micmap.h"
2573 -#include "xf86DDC.h"
2575 -#include "vbe.h"
2577 -#include "xf86RandR12.h"
2579 -#include "nv_const.h"
2581 -#include "dixstruct.h"
2582 -#include "scrnintstr.h"
2584 -#include "fb.h"
2586 -#include "xf86cmap.h"
2587 -#include "shadowfb.h"
2589 -#include "xf86xv.h"
2590 -#include <X11/extensions/Xv.h>
2592 -#include "xf86Cursor.h"
2593 -#include "xf86DDC.h"
2595 -#include "region.h"
2597 -#include <X11/extensions/randr.h>
2599 -#ifdef HAVE_XEXTPROTO_71
2600 -#include <X11/extensions/dpmsconst.h>
2601 -#else
2602 -#define DPMS_SERVER
2603 -#include <X11/extensions/dpms.h>
2604 -#endif
2606 -#define NV_DMA_DEBUG 0
2608 -#include "nv_type.h"
2609 -#include "nv_proto.h"
2610 -#include "nv_dma.h"
2611 +#include "nouveau_intern.h"
2612 #include "nouveau_class.h"
2613 -#include "sarea.h"
2615 -#include "nouveau_drmif.h"
2616 -#include "nouveau_device.h"
2617 -#include "nouveau_channel.h"
2618 -#include "nouveau_bo.h"
2619 -#include "nouveau_grobj.h"
2620 -#include "nouveau_notifier.h"
2621 #include "nouveau_local.h"
2622 -#include "nouveau_pushbuf.h"
2624 +/* Some overriding defines for AROS */
2625 +#define Bool BOOL
2626 +#define ScrnInfoPtr struct CardData *
2627 +#define NVPTR(x) x
2628 +#define NVPtr struct CardData *
2629 +#define Architecture architecture
2630 +#define PixmapPtr struct HIDDNouveauBitMapData *
2631 +#define xf86DrvMsg(a, b, fmt, ...) bug(fmt, ##__VA_ARGS__)
2632 +#define ErrorF(msg, ...) bug(msg, ##__VA_ARGS__)
2633 +#define PictFormatShort LONG
2634 +#define PictTransformPtr APTR
2635 +#define Pixel HIDDT_Pixel
2636 +#define CARD32 LONG
2638 +struct Picture
2640 + LONG format;
2641 + BOOL componentAlpha;
2642 + LONG filter;
2643 + BOOL repeat;
2644 + LONG repeatType;
2647 +typedef struct Picture * PicturePtr;
2649 +/* This construction is implemented so that original EXA funtion calls don't
2650 + have to be extended with ScrnInfoPtr parameter which makes code harder to
2651 + maintain */
2652 +extern struct CardData * globalcarddataptr;
2654 +#define PictFilterNearest 1
2655 +#define PictFilterBilinear 2
2657 +#define RepeatNone 0 /* This must be zero/FALSE, see nv10_exa for usage against ppict->repeat which is BOOL */
2658 +#define RepeatNormal 1
2659 +#define RepeatReflect 2
2660 +#define RepeatPad 3
2662 +#define PICT_UNKNOWN 0
2663 +#define PICT_a8r8g8b8 1
2664 +#define PICT_x8r8g8b8 2
2665 +#define PICT_a8b8g8r8 3
2666 +#define PICT_x8b8g8r8 4
2667 +#define PICT_b8g8r8a8 5
2668 +#define PICT_b8g8r8x8 6
2669 +#define PICT_a2b10g10r10 7
2670 +#define PICT_x2b10g10r10 8
2671 +#define PICT_a2r10g10b10 9
2672 +#define PICT_x2r10g10b10 10
2673 +#define PICT_a1r5g5b5 11
2674 +#define PICT_x1r5g5b5 12
2675 +#define PICT_a1b5g5r5 13
2676 +#define PICT_x1b5g5r5 14
2677 +#define PICT_x4r4g4b4 15
2678 +#define PICT_a4r4g4b4 16
2679 +#define PICT_x4b4g4r4 17
2680 +#define PICT_a4b4g4r4 18
2681 +#define PICT_r5g6b5 19
2682 +#define PICT_b5g6r5 20
2683 +#define PICT_a8 21
2686 +#define nouveau_pixmap_bo(x) (x->bo)
2687 +#define exaGetPixmapPitch(x) (x->pitch)
2689 +#define PictOpSaturate 14
2691 +Bool NVAccelInitNV50TCL(ScrnInfoPtr pScrn);
2692 +Bool NVAccelInitNV40TCL(ScrnInfoPtr pScrn);
2693 +Bool NVAccelInitNV30TCL(ScrnInfoPtr pScrn);
2694 +Bool NVAccelInitNV10TCL(ScrnInfoPtr pScrn);
2695 +Bool NVAccelInitM2MF_NVC0(ScrnInfoPtr pScrn);
2696 +Bool NVAccelInit2D_NVC0(ScrnInfoPtr pScrn);
2697 +Bool NVAccelInit3D_NVC0(ScrnInfoPtr pScrn);
2698 +Bool nv50_style_tiled_pixmap(PixmapPtr ppix);
2701 +static inline BOOL PICT_FORMAT_A(int format)
2703 + switch(format)
2705 + case(PICT_a8r8g8b8):
2706 + case(PICT_a8b8g8r8):
2707 + case(PICT_b8g8r8a8):
2708 + case(PICT_a2b10g10r10):
2709 + case(PICT_a2r10g10b10):
2710 + case(PICT_a1r5g5b5):
2711 + case(PICT_a1b5g5r5):
2712 + case(PICT_a4r4g4b4):
2713 + case(PICT_a4b4g4r4):
2714 + case(PICT_a8):
2715 + return TRUE;
2718 + return FALSE;
2721 +static inline BOOL PICT_FORMAT_RGB(int format)
2723 + switch(format)
2725 + case(PICT_a8r8g8b8):
2726 + case(PICT_x8r8g8b8):
2727 + case(PICT_x8b8g8r8):
2728 + case(PICT_a8b8g8r8):
2729 + case(PICT_b8g8r8a8):
2730 + case(PICT_b8g8r8x8):
2731 + case(PICT_a2b10g10r10):
2732 + case(PICT_x2b10g10r10):
2733 + case(PICT_a2r10g10b10):
2734 + case(PICT_x2r10g10b10):
2735 + case(PICT_a1r5g5b5):
2736 + case(PICT_x1r5g5b5):
2737 + case(PICT_a1b5g5r5):
2738 + case(PICT_x1b5g5r5):
2739 + case(PICT_x4r4g4b4):
2740 + case(PICT_a4r4g4b4):
2741 + case(PICT_x4b4g4r4):
2742 + case(PICT_a4b4g4r4):
2743 + case(PICT_r5g6b5):
2744 + case(PICT_b5g6r5):
2745 + return TRUE;
2748 + return FALSE;
2752 +static inline VOID HIDDNouveauFillPictureFromBitMapData(struct Picture * pPict,
2753 + struct HIDDNouveauBitMapData * bmdata)
2755 + /* pPict->format */
2756 + if (bmdata->depth == 32)
2757 + pPict->format = PICT_a8r8g8b8;
2758 + else if (bmdata->depth == 24)
2759 + pPict->format = PICT_x8r8g8b8;
2760 + else if (bmdata->depth == 16)
2761 + pPict->format = PICT_r5g6b5;
2762 + else
2763 + pPict->format = PICT_UNKNOWN;
2765 + /* pPict->componentAlpha - keep this always as FALSE, used when mask
2766 + bitmap would be present (which is not the case in AROS */
2767 + pPict->componentAlpha = FALSE;
2769 + /* pPict->filter - keep this always as PictFilterNearest, unless you want
2770 + bi-linear (probably slower and might give weird effects */
2771 + pPict->filter = PictFilterNearest;
2773 + /* pPict->repeat - keep this always as FALSE */
2774 + pPict->repeat = FALSE;
2775 + /* pPict->repeatType - value does not matter as long as repeat is FALSE */
2776 + pPict->repeatType = RepeatNone;
2779 #endif /* __NV_INCLUDE_H__ */