Ejemplo n.º 1
0
		Link::Link(string p_name, string p_path, string p_src, string p_dst, string p_lag)
		{
			name = p_name;

			setSrc(p_path + p_src);
			setDst(p_path + p_dst);

			DOUBLE n = brahms::text::s2n(p_lag.c_str());
			lag = n;
			if (n == brahms::text::S2N_FAILED || n != lag)
				ferr << E_SYSTEM_FILE << "invalid lag in Link";

			//	make inferences, as necessary - currently we don't support set
			//	transport, so we only support the following:
			//
			//	port to port					A>P to B<Q
			//									A>>X>P to B<<Y<Q
			if (src.type == ST_OUTPUT_PORT && dst.type == ST_INPUT_PORT)
			{
				//	ok
				dstPortNameInferred = false;
			}

			//	port to set						A>P to B<<Y (to <<Y<P)
			//									A>>X>P to B<<Y (to <<Y<P)
			else if (src.type == ST_OUTPUT_PORT && dst.type == ST_INPUT_SET)
			{
				//	infer portname and change dst type
				dst.portName = src.portName;
				dst.type = ST_INPUT_PORT;
				dstPortNameInferred = true;
			}

			//	port to process					A>P to B (to <P)
			//									A>>X>P to B (to <P)
			else if (src.type == ST_OUTPUT_PORT && dst.type == ST_PROCESS)
			{
				//	infer portname and change dst type
				dst.portName = src.portName;
				dst.type = ST_INPUT_PORT;
				dstPortNameInferred = true;
			}

			//	otherwise, raise a hand-wavy error
			else
			{
				ferr << E_SYSTEMML << "Link protocol either invalid or not currently supported in \"" << string(*this) << "\"";
			}
		}
static Bool
prepareSolid(PixmapPtr      pPixmap,
             int            alu,
             Pixel          planemask,
             Pixel          fg)
{
    ScrnInfoPtr pScrn = xf86ScreenToScrn(pPixmap->drawable.pScreen);
    G80Ptr pNv = G80PTR(pScrn);

    if(pPixmap->drawable.depth > 24) return FALSE;
    if(!setDst(pNv, pPixmap)) return FALSE;
    G80DmaStart(pNv, 0x2ac, 1);
    G80DmaNext (pNv, 4);
    G80SetRopSolid(pNv, alu, planemask);
    G80DmaStart(pNv, 0x580, 1);
    G80DmaNext (pNv, 4);
    G80DmaStart(pNv, 0x588, 1);
    G80DmaNext (pNv, fg);

    pNv->DMAKickoffCallback = G80DMAKickoffCallback;
    return TRUE;
}
static Bool
prepareCopy(PixmapPtr       pSrcPixmap,
            PixmapPtr       pDstPixmap,
            int             dx,
            int             dy,
            int             alu,
            Pixel           planemask)
{
    ScrnInfoPtr pScrn = xf86ScreenToScrn(pDstPixmap->drawable.pScreen);
    G80Ptr pNv = G80PTR(pScrn);

    if(!setSrc(pNv, pSrcPixmap)) return FALSE;
    if(!setDst(pNv, pDstPixmap)) return FALSE;
    G80DmaStart(pNv, 0x2ac, 1);
    if(alu == GXcopy && planemask == ~0) {
        G80DmaNext (pNv, 3);
    } else {
        G80DmaNext (pNv, 4);
        G80SetRopSolid(pNv, alu, planemask);
    }
    pNv->DMAKickoffCallback = G80DMAKickoffCallback;
    return TRUE;
}
static Bool
upload(PixmapPtr pDst,
       int       x,
       int       y,
       int       w,
       int       h,
       char      *src,
       int       src_pitch)
{
    ScrnInfoPtr pScrn = xf86ScreenToScrn(pDst->drawable.pScreen);
    G80Ptr pNv = G80PTR(pScrn);
    const int Bpp = pDst->drawable.bitsPerPixel >> 3;
    int line_dwords = (w * Bpp + 3) / 4;
    const Bool kickoff = w * h >= 512;
    CARD32 depth;

    if(!setDst(pNv, pDst)) return FALSE;
    switch(pDst->drawable.depth) {
        case  8: depth = 0x000000f3; break;
        case 15: depth = 0x000000f8; break;
        case 16: depth = 0x000000e8; break;
        case 24: depth = 0x000000e6; break;
        case 32: depth = 0x000000cf; break;
        default: return FALSE;
    }

    G80SetClip(pNv, x, y, w, h);
    G80DmaStart(pNv, 0x2ac, 1);
    G80DmaNext (pNv, 3);
    G80DmaStart(pNv, 0x800, 2);
    G80DmaNext (pNv, 0);
    G80DmaNext (pNv, depth);
    G80DmaStart(pNv, 0x838, 10);
    G80DmaNext (pNv, (line_dwords * 4) / Bpp);
    G80DmaNext (pNv, h);
    G80DmaNext (pNv, 0);
    G80DmaNext (pNv, 1);
    G80DmaNext (pNv, 0);
    G80DmaNext (pNv, 1);
    G80DmaNext (pNv, 0);
    G80DmaNext (pNv, x);
    G80DmaNext (pNv, 0);
    G80DmaNext (pNv, y);

    while(h-- > 0) {
        int count = line_dwords;
        char *p = src;

        while(count) {
            int size = count > 1792 ? 1792 : count;

            G80DmaStart(pNv, 0x40000860, size);
            memcpy(&pNv->dmaBase[pNv->dmaCurrent], p, size * 4);

            p += size * Bpp;
            pNv->dmaCurrent += size;

            count -= size;
        }

        src += src_pitch;
    }

    if(kickoff)
        G80DmaKickoff(pNv);
    else
        pNv->DMAKickoffCallback = G80DMAKickoffCallback;

    return TRUE;
}