ffb_attr.c revision dbbd9e4b
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/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_attr.c,v 1.1 2000/05/18 23:21:35 dawes Exp $ */
26
27#ifdef HAVE_CONFIG_H
28#include "config.h"
29#endif
30
31#include "ffb.h"
32#include "ffb_fifo.h"
33#include "ffb_rcache.h"
34
35/* If we're going to write any attributes, write them all. */
36void __FFB_Attr_Raw(FFBPtr pFfb, unsigned int ppc, unsigned int ppc_mask,
37		    unsigned int pmask, unsigned int rop,
38		    int drawop, int fg, unsigned int fbc, unsigned int wid)
39{
40	ffb_fbcPtr ffb = pFfb->regs;
41
42	FFBLOG(("WRATTRS_RAW: PPC[%08x:%08x] PMSK[%08x] ROP[%08x] DOP[%08x] FG[%08x] FBC[%08x] WID[%02x]\n",
43		ppc, ppc_mask, pmask, rop, drawop, fg, fbc, wid));
44	pFfb->ppc_cache &= ~ppc_mask;
45	pFfb->ppc_cache |= ppc;
46	pFfb->fg_cache = fg;
47	pFfb->fbc_cache = fbc;
48	pFfb->wid_cache = wid;
49	pFfb->rop_cache = rop;
50	pFfb->pmask_cache = pmask;
51	pFfb->drawop_cache = drawop;
52	pFfb->rp_active = 1;
53	FFBFifo(pFfb, 7);
54	ffb->ppc = ppc;
55	ffb->fg = fg;
56	ffb->fbc = fbc;
57	ffb->wid = wid;
58	ffb->rop = rop;
59	ffb->pmask = pmask;
60	ffb->drawop = drawop;
61}
62
63void __FFB_Attr_SFB_VAR(FFBPtr pFfb, unsigned int ppc, unsigned int ppc_mask, unsigned int fbc,
64			unsigned int wid, unsigned int rop, unsigned int pmask)
65{
66	ffb_fbcPtr ffb = pFfb->regs;
67
68	FFBLOG(("WRATTRS_SFBVAR: PPC[%08x:%08x] PMSK[%08x] ROP[%08x] FBC[%08x] WID[%02x]\n",
69		ppc, ppc_mask, pmask, rop, fbc, wid));
70	pFfb->ppc_cache &= ~ppc_mask;
71	pFfb->ppc_cache |= ppc;
72	pFfb->fbc_cache = fbc;
73	pFfb->wid_cache = wid;
74	pFfb->rop_cache = rop;
75	pFfb->pmask_cache = pmask;
76	pFfb->rp_active = 1;
77	FFBFifo(pFfb, 5);
78	ffb->ppc = ppc;
79	ffb->fbc = fbc;
80	ffb->wid = wid;
81	ffb->rop = rop;
82	ffb->pmask = pmask;
83}
84