1/*
2 * Attribute setting for the Creator and Creator3D framebuffer.
3 *
4 * Copyright (C) 1999 David S. Miller (davem@redhat.com)
5 * Copyright (C) 1999 Jakub Jelinek (jakub@redhat.com)
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20 * JAKUB JELINEK OR DAVID MILLER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
23 * IN THE SOFTWARE.
24 */
25
26#ifdef HAVE_CONFIG_H
27#include "config.h"
28#endif
29
30#include "ffb.h"
31#include "ffb_fifo.h"
32#include "ffb_rcache.h"
33
34/* If we're going to write any attributes, write them all. */
35void __FFB_Attr_Raw(FFBPtr pFfb, unsigned int ppc, unsigned int ppc_mask,
36		    unsigned int pmask, unsigned int rop,
37		    int drawop, int fg, unsigned int fbc, unsigned int wid)
38{
39	ffb_fbcPtr ffb = pFfb->regs;
40
41	FFBLOG(("WRATTRS_RAW: PPC[%08x:%08x] PMSK[%08x] ROP[%08x] DOP[%08x] FG[%08x] FBC[%08x] WID[%02x]\n",
42		ppc, ppc_mask, pmask, rop, drawop, fg, fbc, wid));
43	pFfb->ppc_cache &= ~ppc_mask;
44	pFfb->ppc_cache |= ppc;
45	pFfb->fg_cache = fg;
46	pFfb->fbc_cache = fbc;
47	pFfb->wid_cache = wid;
48	pFfb->rop_cache = rop;
49	pFfb->pmask_cache = pmask;
50	pFfb->drawop_cache = drawop;
51	pFfb->rp_active = 1;
52	FFBFifo(pFfb, 7);
53	ffb->ppc = ppc;
54	ffb->fg = fg;
55	ffb->fbc = fbc;
56	ffb->wid = wid;
57	ffb->rop = rop;
58	ffb->pmask = pmask;
59	ffb->drawop = drawop;
60}
61
62void __FFB_Attr_SFB_VAR(FFBPtr pFfb, unsigned int ppc, unsigned int ppc_mask, unsigned int fbc,
63			unsigned int wid, unsigned int rop, unsigned int pmask)
64{
65	ffb_fbcPtr ffb = pFfb->regs;
66
67	FFBLOG(("WRATTRS_SFBVAR: PPC[%08x:%08x] PMSK[%08x] ROP[%08x] FBC[%08x] WID[%02x]\n",
68		ppc, ppc_mask, pmask, rop, fbc, wid));
69	pFfb->ppc_cache &= ~ppc_mask;
70	pFfb->ppc_cache |= ppc;
71	pFfb->fbc_cache = fbc;
72	pFfb->wid_cache = wid;
73	pFfb->rop_cache = rop;
74	pFfb->pmask_cache = pmask;
75	pFfb->rp_active = 1;
76	FFBFifo(pFfb, 5);
77	ffb->ppc = ppc;
78	ffb->fbc = fbc;
79	ffb->wid = wid;
80	ffb->rop = rop;
81	ffb->pmask = pmask;
82}
83