Some fixes.
[cake.git] / rom / graphics / qblit.c
blob12394e2da1750bce7bfa1da2106a724582513cf3
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/blit.h>
11 #include <graphics/gfxbase.h>
13 /*****************************************************************************
15 NAME */
16 #include <proto/graphics.h>
18 AROS_LH1(void, QBlit,
20 /* SYNOPSIS */
21 AROS_LHA(struct bltnode *, bn, A1),
23 /* LOCATION */
24 struct GfxBase *, GfxBase, 46, Graphics)
26 /* FUNCTION
27 Queues a request for a blit. This request is queued at the end
28 of the list.
30 INPUTS
31 bn - pointer to blitnode structure
33 RESULT
34 The routine that function in the bltnode is pointing to is
35 called when the blitter is ready for work. No other task will
36 be able to access the blitter while you're doing the blit.
37 Queued blits have precedence over a task that tries to own the
38 blitter via OwnBlitter(). So all queued blitter requests will
39 be done first until the task that attempts a OwnBlitter can
40 actually access the blitter.
42 NOTES
43 Not all hardware has a blitter. On hardware where there is no
44 blitter, a blitter is simulated. Therefore all code that will
45 be executed in the function that is called must not contain
46 code that is hacking the blitter's register but should contain
47 calls to graphics functions instead.
49 EXAMPLE
51 BUGS
53 SEE ALSO
54 QBSBlit(), OwnBlitter(), DisownBlitter(), hardware/blit.h
56 INTERNALS
58 HISTORY
60 ******************************************************************************/
62 AROS_LIBFUNC_INIT
64 /* this function uses the simple FIFO queue blthd (blttl) */
66 /* I am accessing a public structure and there's no semaphore...*/
67 Forbid();
69 if (NULL == GfxBase->blthd)
71 /* it's the first one in the list */
72 GfxBase->blthd = bn;
73 GfxBase->blttl = bn;
75 /* In this case the following also has to happen:
76 It is my understanding that at the end of every blit an interrupt
77 occurs that can take care of any blits in this queue or allow
78 a taks to wake up when it was blocked due to a call to OwnBlitter.
79 But in this case there might not be such an interrupt for a long
80 time if no calls to blitterfunctions are made. Therefore this
81 blit might be queued forever. To avoid this I have to cause
82 a Blitter interrupt, if no task owns the blitter right now.
83 (BlitOwner)
86 !!! missing code here!! See explanation above!
89 else
91 /* queue it at the end */
92 GfxBase->blttl->n = bn;
93 GfxBase->blttl = bn;
96 Permit();
98 AROS_LIBFUNC_EXIT
99 } /* QBlit */