r4493@vps: verhaegs | 2007-04-19 14:44:00 -0400
[AROS.git] / rom / graphics / qbsblit.c
blob11991344a8ddf2dfb74c20b261ffadeb7d9c9366
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Queue a beam-synchronized 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, QBSBlit,
20 /* SYNOPSIS */
21 AROS_LHA(struct bltnode *, bn, A1),
23 /* LOCATION */
24 struct GfxBase *, GfxBase, 49, Graphics)
26 /* FUNCTION
27 Queues a request for a beam-synchronized blit.
29 INPUTS
30 bn - pointer to blitnode structure
32 RESULT
33 The routine that function in the bltnode is pointing to is
34 called when the blitter is ready for work. No other task will
35 be able to access the blitter while you're doing the blit.
36 Queued blits have precedence over a task that tries to own the
37 blitter via OwnBlitter(). So all queued blitter requests will
38 be done first until the task that attempts a OwnBlitter can
39 actually access the blitter.
41 NOTES
42 Not all hardware has a blitter. On hardware where there is no
43 blitter, a blitter is simulated. Therefore all code that will
44 be executed in the function that is called must not contain
45 code that is hacking the blitter's register but should contain
46 calls to graphics functions instead.
48 EXAMPLE
50 BUGS
52 SEE ALSO
53 QBSBlit() OwnBlitter DisownBlitter() hardware/blit.h
55 INTERNALS
57 HISTORY
59 ******************************************************************************/
61 AROS_LIBFUNC_INIT
63 /* this function uses the queue bsblthd (bsblttl) */
65 /* I am accessing a public structure and there's no semaphore...*/
66 Forbid();
68 if (NULL == GfxBase->bsblthd)
70 /* it's the first one in the list */
71 GfxBase->bsblthd = bn;
72 GfxBase->bsblttl = bn;
74 /* In this case the following also has to happen:
75 It is my understanding that at the end of every blit an interrupt
76 occurs that can take care of any blits in this queue or allow
77 a taks to wake up when it was blocked due to a call to OwnBlitter.
78 But in this case there might not be such an interrupt for a long
79 time if no calls to blitterfunctions are made. Therefore this
80 blit might be queued forever. To avoid this I have to cause
81 a Blitter interrupt, if no task owns the blitter right now.
82 (BlitOwner)
85 !!! missing code here!! See explanation above!
88 else
90 /* queue it at the end */
91 GfxBase->bsblttl->n = bn;
92 GfxBase->bsblttl = bn;
95 Permit();
97 AROS_LIBFUNC_EXIT
99 } /* QBSBlit */