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
6 #include "nv_include.h"
7 #include "nv04_pushbuf.h"
8 +#if !defined(__AROS__)
18 +#if !defined(__AROS__)
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];
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;
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;
39 + unsigned cpp = pspix->depth > 16 ? 4 : 2;
41 unsigned line_len = w * cpp;
42 unsigned src_offset = 0, src_pitch = 0, linear = 0;
43 /* Maximum DMA transfer */
45 BEGIN_RING(chan, m2mf, NV50_MEMORY_TO_MEMORY_FORMAT_LINEAR_IN, 7);
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);
52 + OUT_RING (chan, pspix->width * cpp);
53 + OUT_RING (chan, pspix->height);
57 OUT_RING (chan, (y << 16) | (x * cpp));
62 +#if !defined(__AROS__)
63 if (dst_pitch == line_len) {
64 memcpy(dst, src, dst_pitch * line_count);
65 dst += dst_pitch * line_count;
72 + HiddNouveauReadIntoRAM(
74 + dst, dst_pitch, dstPixFmt,
77 + dst += dst_pitch * line_count;
79 nouveau_bo_unmap(pNv->GART);
86 +#if !defined(__AROS__)
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];
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;
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;
107 + unsigned cpp = pdpix->depth > 16 ? 4 : 2;
109 unsigned line_len = w * cpp;
110 unsigned dst_offset = 0, dst_pitch = 0, linear = 0;
111 /* Maximum DMA transfer */
113 if (nouveau_bo_map(pNv->GART, NOUVEAU_BO_WR))
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;
126 + HiddNouveauWriteFromRAM(
127 + (APTR)src, src_pitch, srcPixFmt,
131 + src += src_pitch * line_count;
133 nouveau_bo_unmap(pNv->GART);
135 if (MARK_RING(chan, 32, 6))
137 BEGIN_RING(chan, m2mf, NV50_MEMORY_TO_MEMORY_FORMAT_LINEAR_OUT, 7);
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);
144 + OUT_RING (chan, pdpix->width * cpp);
145 + OUT_RING (chan, pdpix->height);
149 OUT_RING (chan, (y << 16) | (x * cpp));
154 +#if !defined(__AROS__)
156 nouveau_exa_mark_sync(ScreenPtr pScreen)
158 @@ -350,11 +409,16 @@
159 nouveau_bo_ref(NULL, &nvpix->bo);
166 nv50_style_tiled_pixmap(PixmapPtr ppix)
168 +#if !defined(__AROS__)
169 ScrnInfoPtr pScrn = xf86Screens[ppix->drawable.pScreen->myNum];
171 + ScrnInfoPtr pScrn = globalcarddataptr;
173 NVPtr pNv = NVPTR(pScrn);
175 return pNv->Architecture >= NV_ARCH_50 &&
177 NOUVEAU_BO_TILE_LAYOUT_MASK);
180 +#if !defined(__AROS__)
182 nouveau_exa_download_from_screen(PixmapPtr pspix, int x, int y, int w, int h,
183 char *dst, int dst_pitch)
185 pNv->EXADriverPtr = exa;
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);
212 + return NVAccelUploadM2MF(bmdata, x, y, width, height,
213 + srcpixels, srcpitch, srcPixFmt, cl, o);
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);
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
244 #ifndef __NOUVEAU_LOCAL_H__
245 #define __NOUVEAU_LOCAL_H__
247 +#if !defined(__AROS__)
248 #include "compiler.h"
249 #include "xf86_OSproc.h"
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
258 OUT_RING (chan, pat1);
261 +#if !defined(__AROS__)
263 NV04EXASetROP(ScrnInfoPtr pScrn, CARD32 alu, CARD32 planemask)
266 pNv->currentRop = alu;
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);
282 +#if !defined(__AROS__)
284 NV04EXAStateSolidResubmit(struct nouveau_channel *chan)
288 NV04EXAPrepareSolid(pNv->pdpix, pNv->alu, pNv->planemask, pNv->fg_colour);
293 NV04EXAPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg)
295 +#if !defined(__AROS__)
296 ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
298 + ScrnInfoPtr pScrn = globalcarddataptr;
300 NVPtr pNv = NVPTR(pScrn);
301 struct nouveau_channel *chan = pNv->chan;
302 struct nouveau_grobj *surf2d = pNv->NvContextSurfaces;
304 if (MARK_RING(chan, 64, 2))
307 +#if !defined(__AROS__)
308 planemask |= ~0 << pPixmap->drawable.bitsPerPixel;
309 if (planemask != ~0 || alu != GXcopy) {
310 if (pPixmap->drawable.bitsPerPixel == 32)
313 + if (alu != 0x03 /* DrawMode_Copy */) {
315 BEGIN_RING(chan, rect, NV04_GDI_RECTANGLE_TEXT_OPERATION, 1);
316 OUT_RING (chan, 1); /* ROP_AND */
317 NV04EXASetROP(pScrn, alu, planemask);
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;
327 fmt2 = NV04_GDI_RECTANGLE_TEXT_COLOR_FORMAT_X16A1R5G5B5;
331 + if (pPixmap->depth == 16)
332 + fmt2 = NV04_GDI_RECTANGLE_TEXT_COLOR_FORMAT_A16R5G6B5;
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);
341 +#if !defined(__AROS__)
342 pNv->pdpix = pPixmap;
344 pNv->planemask = planemask;
346 chan->flush_notify = NV04EXAStateSolidResubmit;
348 + chan->flush_notify = NULL;
354 NV04EXASolid (PixmapPtr pPixmap, int x1, int y1, int x2, int y2)
356 +#if !defined(__AROS__)
357 ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
359 + ScrnInfoPtr pScrn = globalcarddataptr;
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)
374 +#if !defined(__AROS__)
376 NV04EXADoneSolid (PixmapPtr pPixmap)
378 @@ -177,12 +216,17 @@
379 NV04EXAPrepareCopy(pNv->pspix, pNv->pdpix, 0, 0, pNv->alu,
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];
391 + ScrnInfoPtr pScrn = globalcarddataptr;
393 NVPtr pNv = NVPTR(pScrn);
394 struct nouveau_channel *chan = pNv->chan;
395 struct nouveau_grobj *surf2d = pNv->NvContextSurfaces;
397 struct nouveau_bo *dst_bo = nouveau_pixmap_bo(pDstPixmap);
400 +#if !defined(__AROS__)
401 if (pSrcPixmap->drawable.bitsPerPixel !=
402 pDstPixmap->drawable.bitsPerPixel)
404 + if (pSrcPixmap->depth != pDstPixmap->depth)
408 if (!NVAccelGetCtxSurf2DFormatFromPixmap(pDstPixmap, &fmt))
409 @@ -201,12 +249,16 @@
410 if (MARK_RING(chan, 64, 2))
413 +#if !defined(__AROS__)
414 planemask |= ~0 << pDstPixmap->drawable.bitsPerPixel;
415 if (planemask != ~0 || alu != GXcopy) {
416 if (pDstPixmap->drawable.bitsPerPixel == 32) {
421 + if (alu != 0x03 /* DrawMode_Copy */) {
424 BEGIN_RING(chan, blit, NV01_IMAGE_BLIT_OPERATION, 1);
425 OUT_RING (chan, 1); /* ROP_AND */
426 @@ -227,11 +279,15 @@
430 +#if !defined(__AROS__)
431 pNv->pspix = pSrcPixmap;
432 pNv->pdpix = pDstPixmap;
434 pNv->planemask = planemask;
435 chan->flush_notify = NV04EXAStateCopyResubmit;
437 + chan->flush_notify = NULL;
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];
449 + ScrnInfoPtr pScrn = globalcarddataptr;
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;
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)
475 +#if !defined(__AROS__)
477 NV04EXADoneCopy(PixmapPtr pDstPixmap)
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);
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,
515 + if (NV04EXAPrepareCopy(srcdata, destdata, 0, 0, drawmode, ~0))
517 + NV04EXACopy(destdata, srcX, srcY, destX, destY, width, height);
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
528 get_tex_format(PicturePtr pict)
530 +#if !defined(__AROS__)
531 ScrnInfoPtr pScrn = xf86Screens[pict->pDrawable->pScreen->myNum];
533 + ScrnInfoPtr pScrn = globalcarddataptr;
535 NVPtr pNv = NVPTR(pScrn);
537 /* If repeat is set we're always handling a 1x1 texture with
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 */
547 return mask && mask->componentAlpha && PICT_FORMAT_RGB(mask->format);
550 +#if !defined(__AROS__)
552 check_texture(PicturePtr pict)
555 print_fallback_info("Accelerating", op, src, mask, dst);
561 setup_texture(NVPtr pNv, int unit, PicturePtr pict, PixmapPtr pixmap)
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;
570 + long w = pixmap->width,
571 + h = pixmap->height;
574 NV10TCL_TX_FORMAT_WRAP_T_CLAMP_TO_EDGE |
575 NV10TCL_TX_FORMAT_WRAP_S_CLAMP_TO_EDGE |
577 (NV10TCL_RC_IN_RGB_##input##_INPUT_CONSTANT_COLOR##unit | \
578 NV10TCL_RC_IN_RGB_##input##_COMPONENT_USAGE_##chan)
580 +#if !defined(__AROS__)
582 setup_combiners(NVPtr pNv, PicturePtr src, PicturePtr mask)
585 +setup_combiners(NVPtr pNv, PicturePtr src, PicturePtr mask, int op)
588 struct nouveau_channel *chan = pNv->chan;
589 struct nouveau_grobj *celsius = pNv->Nv3D;
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)) {
597 + if (!needs_src_alpha(op)) {
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__)
608 setup_blend_function(NVPtr pNv)
611 +setup_blend_function(NVPtr pNv, PicturePtr dst, PicturePtr mask, int blendop)
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];
619 + struct pict_op *op = &nv10_pict_op[blendop];
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))
628 + !PICT_FORMAT_A(dst->format))
630 /* ONE_MINUS_DST_ALPHA doesn't always do the right thing for
631 * framebuffers without alpha channel. But it's the same as
634 src_factor = SF(ZERO);
636 +#if !defined(__AROS__)
637 if (effective_component_alpha(pNv->pmpict)) {
639 + if (effective_component_alpha(mask)) {
641 if (dst_factor == DF(SRC_ALPHA))
642 dst_factor = DF(SRC_COLOR);
643 else if (dst_factor == DF(ONE_MINUS_SRC_ALPHA))
648 +#if !defined(__AROS__)
650 NV10StateCompositeReemit(struct nouveau_channel *chan)
653 NV10EXAPrepareComposite(pNv->alu, pNv->pspict, pNv->pmpict, pNv->pdpict,
654 pNv->pspix, pNv->pmpix, pNv->pdpix);
659 NV10EXAPrepareComposite(int op,
660 @@ -585,13 +625,18 @@
664 +#if !defined(__AROS__)
665 ScrnInfoPtr pScrn = xf86Screens[dst->drawable.pScreen->myNum];
667 + ScrnInfoPtr pScrn = globalcarddataptr;
669 NVPtr pNv = NVPTR(pScrn);
670 struct nouveau_channel *chan = pNv->chan;
672 if (MARK_RING(chan, 128, 5))
675 +#if !defined(__AROS__)
677 pNv->pspict = pict_src;
678 pNv->pmpict = pict_mask;
686 if (!setup_render_target(pNv, pict_dst, dst))
688 !setup_texture(pNv, 1, pict_mask, mask))
691 +#if !defined(__AROS__)
692 /* Set the register combiners up. */
693 setup_combiners(pNv, pict_src, pict_mask);
696 setup_blend_function(pNv);
698 chan->flush_notify = NV10StateCompositeReemit;
700 + /* Set the register combiners up. */
701 + setup_combiners(pNv, pict_src, pict_mask, op);
704 + setup_blend_function(pNv, pict_dst, pict_mask, op);
706 + chan->flush_notify = NULL;
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. */
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)
729 #define QUAD(x, y, w, h) \
730 {{{ IntToxFixed(x), IntToxFixed(y), xFixed1 }}, \
731 {{ IntToxFixed(x + w), IntToxFixed(y), xFixed1 }}, \
736 +#if !defined(__AROS__)
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];
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;
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,
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);
770 MAP(transform_vertex, mask->transform, maskq);
773 WAIT_RING (chan, 64);
774 BEGIN_RING(chan, celsius, NV10TCL_VERTEX_BEGIN_END, 1);
776 OUT_RING (chan, NV10TCL_VERTEX_BEGIN_END_STOP);
779 +#if !defined(__AROS__)
781 NV10EXADoneComposite(PixmapPtr dst)
785 chan->flush_notify = NULL;
790 NVAccelInitNV10TCL(ScrnInfoPtr pScrn)
791 @@ -969,3 +1058,32 @@
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,
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,
818 + width, height, &sPict, NULL);
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
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
836 typedef struct nv_pict_surface_format {
842 +#if !defined(__AROS__)
843 static nv30_exa_state_t exa_state;
844 #define NV30EXA_STATE nv30_exa_state_t *state = &exa_state
847 static nv_pict_surface_format_t
848 NV30SurfaceFormat[] = {
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 *
863 +#if !defined(__AROS__)
865 NV30EXATexture(ScrnInfoPtr pScrn, PixmapPtr pPix, PicturePtr pPict, int unit)
868 +NV30EXATexture(ScrnInfoPtr pScrn, PixmapPtr pPix, PicturePtr pPict, int unit, nv30_exa_state_t * state)
871 NVPtr pNv = NVPTR(pScrn);
872 struct nouveau_channel *chan = pNv->chan;
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) <<
880 + (log2i(pPix->width) <<
882 NV34TCL_TX_FORMAT_BASE_SIZE_U_SHIFT) |
883 +#if !defined(__AROS__)
884 (log2i(pPix->drawable.height) <<
886 + (log2i(pPix->height) <<
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;
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 */
917 +#if !defined(__AROS__)
919 NV30EXACheckCompositeTexture(PicturePtr pPict, PicturePtr pdPict, int op)
922 NV30EXAPrepareComposite(pNv->alu, pNv->pspict, pNv->pmpict, pNv->pdpict,
923 pNv->pspix, pNv->pmpix, pNv->pdpix);
927 +#if !defined(__AROS__)
929 NV30EXAPrepareComposite(int op, PicturePtr psPict,
934 ScrnInfoPtr pScrn = xf86Screens[psPix->drawable.pScreen->myNum];
937 +NV30EXAPrepareComposite(int op, PicturePtr psPict,
943 + nv30_exa_state_t * state)
945 + ScrnInfoPtr pScrn = globalcarddataptr;
947 NVPtr pNv = NVPTR(pScrn);
948 struct nouveau_channel *chan = pNv->chan;
949 struct nouveau_grobj *rankine = pNv->Nv3D;
951 PICT_FORMAT_RGB(pmPict->format)));
953 if (!NV30_SetupSurface(pScrn, pdPix, pdPict) ||
954 +#if !defined(__AROS__)
955 !NV30EXATexture(pScrn, psPix, psPict, 0)) {
957 + !NV30EXATexture(pScrn, psPix, psPict, 0, state)) {
966 +#if !defined(__AROS__)
967 if (!NV30EXATexture(pScrn, pmPix, pmPict, 1)) {
969 + if (!NV30EXATexture(pScrn, pmPix, pmPict, 1, state)) {
975 BEGIN_RING(chan, rankine, 0x23c, 1);
976 OUT_RING (chan, pmPict?3:1);
978 +#if !defined(__AROS__)
980 pNv->pspict = psPict;
981 pNv->pmpict = pmPict;
985 chan->flush_notify = NV30EXAStateCompositeReemit;
987 + chan->flush_notify = NULL;
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__)
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]);
1015 OUT_RING (chan, ((dy)<<16)|(dx)); \
1018 +#if !defined(__AROS__)
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];
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;
1035 NVPtr pNv = NVPTR(pScrn);
1036 struct nouveau_channel *chan = pNv->chan;
1037 struct nouveau_grobj *rankine = pNv->Nv3D;
1042 +#if !defined(__AROS__)
1044 NV30EXADoneComposite(PixmapPtr pdPix)
1048 chan->flush_notify = NULL;
1053 NVAccelInitNV30TCL(ScrnInfoPtr pScrn)
1054 @@ -914,3 +988,33 @@
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,
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,
1082 + width, height, &state);
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
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
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
1111 typedef struct nv_pict_surface_format {
1117 +#if !defined(__AROS__)
1118 static nv40_exa_state_t exa_state;
1119 #define NV40EXA_STATE nv40_exa_state_t *state = &exa_state
1122 static nv_pict_surface_format_t
1123 NV40SurfaceFormat[] = {
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__)
1140 NV40EXATexture(ScrnInfoPtr pScrn, PixmapPtr pPix, PicturePtr pPict, int unit)
1143 +NV40EXATexture(ScrnInfoPtr pScrn, PixmapPtr pPix, PicturePtr pPict, int unit, nv40_exa_state_t * state)
1146 NVPtr pNv = NVPTR(pScrn);
1147 struct nouveau_channel *chan = pNv->chan;
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;
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 */
1178 +#if !defined(__AROS__)
1180 NV40EXACheckCompositeTexture(PicturePtr pPict, PicturePtr pdPict, int op)
1183 NV40EXAPrepareComposite(pNv->alu, pNv->pspict, pNv->pmpict, pNv->pdpict,
1184 pNv->pspix, pNv->pmpix, pNv->pdpix);
1188 +#if !defined(__AROS__)
1190 NV40EXAPrepareComposite(int op, PicturePtr psPict,
1192 @@ -416,6 +443,18 @@
1195 ScrnInfoPtr pScrn = xf86Screens[psPix->drawable.pScreen->myNum];
1198 +NV40EXAPrepareComposite(int op, PicturePtr psPict,
1199 + PicturePtr pmPict,
1200 + PicturePtr pdPict,
1204 + nv40_exa_state_t * state)
1206 + ScrnInfoPtr pScrn = globalcarddataptr;
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)) {
1218 + !NV40EXATexture(pScrn, psPix, psPict, 0, state)) {
1224 NV40_LoadVtxProg(pScrn, &nv40_vp_exa_render);
1226 +#if !defined(__AROS__)
1227 if (!NV40EXATexture(pScrn, pmPix, pmPict, 1)) {
1229 + if (!NV40EXATexture(pScrn, pmPix, pmPict, 1, state)) {
1235 BEGIN_RING(chan, curie, NV40TCL_TEX_CACHE_CTL, 1);
1238 +#if !defined(__AROS__)
1240 pNv->pspict = psPict;
1241 pNv->pmpict = pmPict;
1245 chan->flush_notify = NV40EXAStateCompositeReemit;
1247 + chan->flush_notify = NULL;
1253 float *x_ret, float *y_ret)
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__)
1260 v.vector[0] = IntToxFixed(x);
1261 v.vector[1] = IntToxFixed(y);
1263 PictureTransformPoint(t, &v);
1264 *x_ret = xFixedToFloat(v.vector[0]) / sx;
1265 *y_ret = xFixedToFloat(v.vector[1]) / sy;
1268 *x_ret = (float)x / sx;
1269 *y_ret = (float)y / sy;
1271 OUT_RING (chan, ((dy)<<16)|(dx)); \
1274 +#if !defined(__AROS__)
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];
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;
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;
1300 WAIT_RING(chan, 64);
1302 OUT_RING (chan, NV40TCL_BEGIN_END_STOP);
1305 +#if !defined(__AROS__)
1307 NV40EXADoneComposite(PixmapPtr pdPix)
1311 chan->flush_notify = NULL;
1315 #define NV40TCL_CHIPSET_4X_MASK 0x00000baf
1316 #define NV44TCL_CHIPSET_4X_MASK 0x00005450
1317 @@ -760,3 +827,33 @@
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,
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,
1345 + width, height, &state);
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
1355 #include "nv_include.h"
1356 #include "nv50_accel.h"
1358 +#if !defined(__AROS__)
1360 NV50SyncToVBlank(PixmapPtr ppix, BoxPtr box)
1363 BEGIN_RING(chan, nvsw, 0x0068, 1);
1364 OUT_RING (chan, 0x11111111);
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
1377 +#if !defined(__AROS__)
1378 static struct nv50_exa_state exa_state;
1380 #define NV50EXA_LOCALS(p) \
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
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;
1395 #define BF(f) NV50TCL_BLEND_FUNC_SRC_RGB_##f
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) },
1407 NV50EXA_LOCALS(ppix);
1409 +#if !defined(__AROS__)
1410 switch (ppix->drawable.bitsPerPixel) {
1412 + switch (ppix->depth) {
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);
1425 + OUT_RING (chan, ppix->width);
1426 + OUT_RING (chan, ppix->height);
1428 if (OUT_RELOCh(chan, bo, 0, bo_flags) ||
1429 OUT_RELOCl(chan, bo, 0, bo_flags))
1433 +#if !defined(__AROS__)
1434 NV50EXASetClip(ppix, 0, 0, ppix->drawable.width, ppix->drawable.height);
1436 + NV50EXASetClip(ppix, 0, 0, ppix->width, ppix->height);
1442 OUT_RING (chan, pat1);
1445 +#if !defined(__AROS__)
1447 NV50EXASetROP(PixmapPtr pdpix, int alu, Pixel planemask)
1449 @@ -210,7 +235,43 @@
1450 pNv->currentRop = alu;
1455 +NV50EXASetROP(PixmapPtr pdpix, int alu, Pixel planemask)
1457 + NV50EXA_LOCALS(pdpix);
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);
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;
1478 + OUT_RING (chan, 2);
1481 + OUT_RING (chan, 1);
1484 + BEGIN_RING(chan, eng2d, NV50_2D_ROP, 1);
1485 + OUT_RING (chan, rop);
1489 +#if !defined(__AROS__)
1491 NV50EXAStateSolidResubmit(struct nouveau_channel *chan)
1494 NV50EXAPrepareSolid(pNv->pdpix, pNv->alu, pNv->planemask,
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__)
1508 pNv->planemask = planemask;
1509 pNv->fg_colour = fg;
1510 chan->flush_notify = NV50EXAStateSolidResubmit;
1512 + chan->flush_notify = NULL;
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)
1527 +#if !defined(__AROS__)
1529 NV50EXADoneSolid(PixmapPtr pdpix)
1532 NV50EXAPrepareCopy(pNv->pspix, pNv->pdpix, 0, 0, pNv->alu,
1538 NV50EXAPrepareCopy(PixmapPtr pspix, PixmapPtr pdpix, int dx, int dy,
1539 @@ -308,11 +378,15 @@
1541 NV50EXASetROP(pdpix, alu, planemask);
1543 +#if !defined(__AROS__)
1547 pNv->planemask = planemask;
1548 chan->flush_notify = NV50EXAStateCopyResubmit;
1550 + chan->flush_notify = NULL;
1555 @@ -342,10 +416,13 @@
1557 OUT_RING (chan, srcY);
1559 +#if !defined(__AROS__)
1560 if(width * height >= 512)
1565 +#if !defined(__AROS__)
1567 NV50EXADoneCopy(PixmapPtr pdpix)
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);
1585 + OUT_RING (chan, ppix->width);
1586 + OUT_RING (chan, ppix->height);
1588 BEGIN_RING(chan, tesla, NV50TCL_RT_ARRAY_MODE, 1);
1589 OUT_RING (chan, 0x00000001);
1594 +#if !defined(__AROS__)
1596 NV50EXACheckTexture(PicturePtr ppict, PicturePtr pdpict, int op)
1598 @@ -572,13 +656,19 @@
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__)
1610 NV50EXATexture(PixmapPtr ppix, PicturePtr ppict, unsigned unit)
1613 +NV50EXATexture(PixmapPtr ppix, PicturePtr ppict, unsigned unit, struct nv50_exa_state * state)
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))
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);
1626 + OUT_RING (chan, ppix->width);
1627 + OUT_RING (chan, (1 << NV50TIC_0_5_DEPTH_SHIFT) | ppix->height);
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;
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 */
1648 +#if !defined(__AROS__)
1650 NV50EXACheckBlend(int op)
1653 NOUVEAU_FALLBACK("unsupported blend op %d\n", op);
1659 NV50EXABlend(PixmapPtr ppix, PicturePtr ppict, int op, int component_alpha)
1664 +#if !defined(__AROS__)
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);
1674 +#if !defined(__AROS__)
1676 NV50EXAPrepareComposite(int op,
1677 PicturePtr pspict, PicturePtr pmpict, PicturePtr pdpict,
1678 PixmapPtr pspix, PixmapPtr pmpix, PixmapPtr pdpix)
1681 +NV50EXAPrepareComposite(int op,
1682 + PicturePtr pspict, PicturePtr pmpict, PicturePtr pdpict,
1683 + PixmapPtr pspix, PixmapPtr pmpix, PixmapPtr pdpix,
1684 + struct nv50_exa_state * state)
1687 NV50EXA_LOCALS(pspix);
1688 const unsigned shd_flags = NOUVEAU_BO_VRAM | NOUVEAU_BO_RD;
1689 @@ -866,13 +979,21 @@
1693 +#if !defined(__AROS__)
1694 if (!NV50EXATexture(pspix, pspict, 0)) {
1696 + if (!NV50EXATexture(pspix, pspict, 0, state)) {
1699 NOUVEAU_FALLBACK("src picture invalid\n");
1703 +#if !defined(__AROS__)
1704 if (!NV50EXATexture(pmpix, pmpict, 1)) {
1706 + if (!NV50EXATexture(pmpix, pmpict, 1, state)) {
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__)
1717 pNv->pspict = pspict;
1718 pNv->pmpict = pmpict;
1719 @@ -918,6 +1040,9 @@
1722 chan->flush_notify = NV50EXAStateCompositeResubmit;
1724 + chan->flush_notify = NULL;
1729 @@ -928,6 +1053,9 @@
1730 float *x_ret, float *y_ret)
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__)
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;
1745 *x_ret = (float)x / sx;
1746 *y_ret = (float)y / sy;
1750 +#if !defined(__AROS__)
1752 NV50EXAComposite(PixmapPtr pdpix, int sx, int sy, int mx, int my,
1753 int dx, int dy, int w, int h)
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)
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 @@
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 @@
1779 +#if !defined(__AROS__)
1781 NV50EXADoneComposite(PixmapPtr pdpix)
1783 @@ -999,4 +1135,71 @@
1785 chan->flush_notify = NULL;
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);
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,
1819 + if (NV50EXAPrepareCopy(srcdata, destdata, 0, 0, drawmode, ~0))
1821 + NV50EXACopy(destdata, srcX, srcY, destX , destY, width, height);
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,
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,
1849 + width, height, &state);
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
1860 #include "nv_include.h"
1861 #include "nv04_pushbuf.h"
1862 +#if defined(__AROS__)
1863 +#include <aros/debug.h>
1866 +#if !defined(__AROS__)
1868 nouveau_allocate_surface(ScrnInfoPtr scrn, int width, int height, int bpp,
1869 int usage_hint, int *pitch, struct nouveau_bo **bo)
1871 BEGIN_RING(chan, blit, 0x00000130, 1);
1877 NVAccelInitDmaNotifier0(ScrnInfoPtr pScrn)
1882 +#if !defined(__AROS__)
1883 /* FLAGS_ROP_AND, DmaFB, DmaFB, 0 */
1885 NVAccelInitContextBeta1(ScrnInfoPtr pScrn)
1886 @@ -233,11 +239,16 @@
1887 OUT_RING (chan, 0xffff0000);
1893 NVAccelGetCtxSurf2DFormatFromPixmap(PixmapPtr pPix, int *fmt_ret)
1895 +#if !defined(__AROS__)
1896 switch (pPix->drawable.bitsPerPixel) {
1898 + switch (pPix->depth) {
1901 *fmt_ret = NV04_CONTEXT_SURFACES_2D_FORMAT_A8R8G8B8;
1903 @@ -245,7 +256,11 @@
1904 *fmt_ret = NV04_CONTEXT_SURFACES_2D_FORMAT_X8R8G8B8_Z8R8G8B8;
1907 +#if !defined(__AROS__)
1908 if (pPix->drawable.depth == 16)
1910 + if (pPix->depth == 16)
1912 *fmt_ret = NV04_CONTEXT_SURFACES_2D_FORMAT_R5G6B5;
1914 *fmt_ret = NV04_CONTEXT_SURFACES_2D_FORMAT_X1R5G5B5_Z1R5G5B5;
1919 +#if !defined(__AROS__)
1921 NVAccelGetCtxSurf2DFormatFromPicture(PicturePtr pPict, int *fmt_ret)
1925 return (PixmapPtr) pDraw;
1930 NVAccelInitImagePattern(ScrnInfoPtr pScrn)
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;
1944 +#if !defined(__AROS__)
1946 NVAccelInitScaledImage(ScrnInfoPtr pScrn)
1954 /* FLAGS_NONE, NvDmaFB, NvDmaAGP, NvDmaNotifier0 */
1960 +#if !defined(__AROS__)
1962 NVAccelInitImageFromCpu(ScrnInfoPtr pScrn)
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;
1981 +#if !defined(__AROS__)
1982 #define INIT_CONTEXT_OBJECT(name) do { \
1983 ret = NVAccelInit##name(pScrn); \
1985 @@ -615,6 +637,16 @@
1990 +#define INIT_CONTEXT_OBJECT(name) do { \
1991 + ret = NVAccelInit##name(pScrn); \
1993 + bug("[nouveau] Failed to initialise context object: "#name \
1994 + " (%d)\n", ret); \
2001 NVAccelCommonInit(ScrnInfoPtr pScrn)
2002 @@ -622,8 +654,10 @@
2003 NVPtr pNv = NVPTR(pScrn);
2006 +#if !defined(__AROS__)
2011 /* General engine objects */
2012 if (pNv->Architecture < NV_ARCH_C0)
2013 @@ -632,15 +666,19 @@
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);
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);
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__)
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);
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);
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);
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
2086 +#if !defined(__AROS__)
2087 pNv->currentRop = 0xfffffffa;
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
2097 #define NOUVEAU_BO(a, b, c) (NOUVEAU_BO_##a | NOUVEAU_BO_##b | NOUVEAU_BO_##c)
2099 +#if !defined(__AROS__)
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];
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;
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;
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;
2130 if (!nv50_style_tiled_pixmap(pspix)) {
2133 src_pitch = exaGetPixmapPitch(pspix);
2134 src_offset = (y * src_pitch) + (x * cpp);
2135 +#if defined(__AROS__)
2136 + exec |= NVC0_M2MF_EXEC_LINEAR_IN;
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);
2145 + OUT_RING (chan, pspix->width * cpp);
2146 + OUT_RING (chan, pspix->height);
2154 BEGIN_RING(chan, m2mf, NVC0_M2MF_EXEC, 1);
2155 +#if !defined(__AROS__)
2156 OUT_RING (chan, 0x100000 | (tiled << 8));
2158 + OUT_RING (chan, exec | (tiled << 8));
2161 if (nouveau_bo_map(pNv->GART, NOUVEAU_BO_RD)) {
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 @@
2177 + HiddNouveauReadIntoRAM(
2178 + (char *)src, line_len,
2179 + dst, dst_pitch, dstPixFmt,
2182 + dst += dst_pitch * line_count;
2184 nouveau_bo_unmap(pNv->GART);
2187 @@ -115,29 +155,54 @@
2191 +#if !defined(__AROS__)
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];
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;
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;
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;
2222 if (!nv50_style_tiled_pixmap(pdpix)) {
2224 dst_pitch = exaGetPixmapPitch(pdpix);
2225 dst_offset = (y * dst_pitch) + (x * cpp);
2226 +#if defined(__AROS__)
2227 + exec |= NVC0_M2MF_EXEC_LINEAR_OUT;
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);
2236 + OUT_RING (chan, pdpix->width * cpp);
2237 + OUT_RING (chan, pdpix->height);
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);
2259 + HiddNouveauWriteFromRAM(
2260 + (APTR)src, src_pitch, srcPixFmt,
2264 + src += src_pitch * line_count;
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));
2276 + OUT_RING (chan, exec | (tiled << 4));
2286 +#if !defined(__AROS__)
2287 struct nvc0_exa_state {
2289 PictTransformPtr transform;
2293 static struct nvc0_exa_state exa_state;
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
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;
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) },
2325 NVC0EXA2DSurfaceFormat(PixmapPtr ppix, uint32_t *fmt)
2327 NVC0EXA_LOCALS(ppix);
2329 +#if !defined(__AROS__)
2330 switch (ppix->drawable.bitsPerPixel) {
2332 + switch (ppix->depth) {
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);
2345 + OUT_RING (chan, ppix->width);
2346 + OUT_RING (chan, ppix->height);
2348 if (OUT_RELOCh(chan, bo, 0, bo_flags) ||
2349 OUT_RELOCl(chan, bo, 0, bo_flags))
2353 +#if !defined(__AROS__)
2354 NVC0EXASetClip(ppix, 0, 0, ppix->drawable.width, ppix->drawable.height);
2356 + NVC0EXASetClip(ppix, 0, 0, ppix->width, ppix->height);
2362 OUT_RING (chan, pat1);
2365 +#if !defined(__AROS__)
2367 NVC0EXASetROP(PixmapPtr pdpix, int alu, Pixel planemask)
2369 @@ -388,7 +494,42 @@
2370 pNv->currentRop = alu;
2375 +NVC0EXASetROP(PixmapPtr pdpix, int alu, Pixel planemask)
2377 + NVC0EXA_LOCALS(pdpix);
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);
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;
2398 + OUT_RING (chan, 2);
2401 + OUT_RING (chan, 1);
2403 + BEGIN_RING(chan, eng2d, NV50_2D_ROP, 1);
2404 + OUT_RING (chan, rop);
2408 +#if !defined(__AROS__)
2410 NVC0EXAStateSolidResubmit(struct nouveau_channel *chan)
2413 NVC0EXAPrepareSolid(pNv->pdpix, pNv->alu, pNv->planemask,
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__)
2427 pNv->planemask = planemask;
2428 pNv->fg_colour = fg;
2429 chan->flush_notify = NVC0EXAStateSolidResubmit;
2431 + chan->flush_notify = NULL;
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)
2446 +#if !defined(__AROS__)
2448 NVC0EXADoneSolid(PixmapPtr pdpix)
2451 NVC0EXAPrepareCopy(pNv->pspix, pNv->pdpix, 0, 0, pNv->alu,
2457 NVC0EXAPrepareCopy(PixmapPtr pspix, PixmapPtr pdpix, int dx, int dy,
2458 @@ -486,11 +636,15 @@
2460 NVC0EXASetROP(pdpix, alu, planemask);
2462 +#if !defined(__AROS__)
2466 pNv->planemask = planemask;
2467 chan->flush_notify = NVC0EXAStateCopyResubmit;
2469 + chan->flush_notify = NULL;
2474 @@ -520,10 +674,13 @@
2476 OUT_RING (chan, srcY);
2478 +#if !defined(__AROS__)
2479 if (width * height >= 512)
2484 +#if !defined(__AROS__)
2486 NVC0EXADoneCopy(PixmapPtr pdpix)
2488 @@ -1201,4 +1358,43 @@
2490 chan->flush_notify = NULL;
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);
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,
2524 + if (NVC0EXAPrepareCopy(srcdata, destdata, 0, 0, drawmode, ~0))
2526 + NVC0EXACopy(destdata, srcX, srcY, destX , destY, width, height);
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
2536 #ifndef __NV_INCLUDE_H__
2537 #define __NV_INCLUDE_H__
2539 + Copyright © 2011, The AROS Development Team. All rights reserved.
2543 -#ifdef HAVE_CONFIG_H
2544 -#include "config.h"
2547 -#include <string.h>
2550 -#include <unistd.h>
2551 -#include <stdlib.h>
2553 -/* All drivers should typically include these */
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"
2577 -#include "xf86RandR12.h"
2579 -#include "nv_const.h"
2581 -#include "dixstruct.h"
2582 -#include "scrnintstr.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>
2602 -#define DPMS_SERVER
2603 -#include <X11/extensions/dpms.h>
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"
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 */
2626 +#define ScrnInfoPtr struct CardData *
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
2641 + BOOL componentAlpha;
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
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
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)
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):
2721 +static inline BOOL PICT_FORMAT_RGB(int 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):
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;
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__ */