Fix IO memory access .. SB128 driver makes noises in VMWare - CMI is untested (Curren...
[AROS.git] / rom / graphics / qblit.c
blob9c0a3d4e4b5d9738cb4901d57a57dc34de4a3bb8
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Queue a Blit
6 Lang: english
7 */
9 #include <proto/exec.h>
10 #include <hardware/intbits.h>
11 #include <hardware/blit.h>
12 #include <graphics/gfxbase.h>
14 /*****************************************************************************
16 NAME */
17 #include <proto/graphics.h>
19 AROS_LH1(void, QBlit,
21 /* SYNOPSIS */
22 AROS_LHA(struct bltnode *, bn, A1),
24 /* LOCATION */
25 struct GfxBase *, GfxBase, 46, Graphics)
27 /* FUNCTION
28 Queues a request for a blit. This request is queued at the end
29 of the list.
31 INPUTS
32 bn - pointer to blitnode structure
34 RESULT
35 The routine that function in the bltnode is pointing to is
36 called when the blitter is ready for work. No other task will
37 be able to access the blitter while you're doing the blit.
38 Queued blits have precedence over a task that tries to own the
39 blitter via OwnBlitter(). So all queued blitter requests will
40 be done first until the task that attempts a OwnBlitter can
41 actually access the blitter.
43 NOTES
44 Not all hardware has a blitter. On hardware where there is no
45 blitter, a blitter is simulated. Therefore all code that will
46 be executed in the function that is called must not contain
47 code that is hacking the blitter's register but should contain
48 calls to graphics functions instead.
50 EXAMPLE
52 BUGS
54 SEE ALSO
55 QBSBlit(), OwnBlitter(), DisownBlitter(), hardware/blit.h
57 INTERNALS
59 HISTORY
61 ******************************************************************************/
63 AROS_LIBFUNC_INIT
65 /* this function uses the simple FIFO queue blthd (blttl) */
67 /* I am accessing a public structure and there's no semaphore...
68 * Interrupts disabled because this is accessed from blitter interrupt.
70 Disable();
72 if (NULL == GfxBase->blthd)
74 /* OwnBlitter() only if both lists are empty */
75 if (NULL == GfxBase->bsblthd)
76 OwnBlitter();
78 /* it's the first one in the list */
79 GfxBase->blthd = bn;
80 GfxBase->blttl = bn;
82 /* In this case the following also has to happen:
83 It is my understanding that at the end of every blit an interrupt
84 occurs that can take care of any blits in this queue or allow
85 a taks to wake up when it was blocked due to a call to OwnBlitter.
86 But in this case there might not be such an interrupt for a long
87 time if no calls to blitterfunctions are made. Therefore this
88 blit might be queued forever. To avoid this I have to cause
89 a Blitter interrupt, if no task owns the blitter right now.
90 (BlitOwner)
93 !!! missing code here!! See explanation above!
95 #if (AROS_FLAVOUR & AROS_FLAVOUR_BINCOMPAT) && defined(mc68000)
97 /* Trigger blitter interrupt */
98 volatile struct Custom *custom = (struct Custom *)(void **)0xdff000;
99 custom->intreq = INTF_SETCLR | INTF_BLIT;
100 custom->intena = INTF_SETCLR | INTF_BLIT;
102 #endif
104 else
106 /* queue it at the end */
107 GfxBase->blttl->n = bn;
108 GfxBase->blttl = bn;
111 Enable();
113 AROS_LIBFUNC_EXIT
114 } /* QBlit */