2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: Queue a beam-synchronized Blit
9 #include <proto/exec.h>
10 #include <hardware/intbits.h>
11 #include <hardware/blit.h>
12 #include <graphics/gfxbase.h>
14 #include "graphics_intern.h"
16 /*****************************************************************************
19 #include <proto/graphics.h>
21 AROS_LH1(void, QBSBlit
,
24 AROS_LHA(struct bltnode
*, bn
, A1
),
27 struct GfxBase
*, GfxBase
, 49, Graphics
)
30 Queues a request for a beam-synchronized blit.
33 bn - pointer to blitnode structure
36 The routine that function in the bltnode is pointing to is
37 called when the blitter is ready for work. No other task will
38 be able to access the blitter while you're doing the blit.
39 Queued blits have precedence over a task that tries to own the
40 blitter via OwnBlitter(). So all queued blitter requests will
41 be done first until the task that attempts a OwnBlitter can
42 actually access the blitter.
45 Not all hardware has a blitter. On hardware where there is no
46 blitter, a blitter is simulated. Therefore all code that will
47 be executed in the function that is called must not contain
48 code that is hacking the blitter's register but should contain
49 calls to graphics functions instead.
56 QBSBlit(), OwnBlitter(), DisownBlitter(), hardware/blit.h
62 ******************************************************************************/
66 /* this function uses the queue bsblthd (bsblttl) */
68 /* I am accessing a public structure and there's no semaphore...*/
71 if (NULL
== GfxBase
->bsblthd
)
73 /* OwnBlitter() only if both lists are empty */
74 if (NULL
== GfxBase
->blthd
)
77 /* it's the first one in the list */
78 GfxBase
->bsblthd
= bn
;
79 GfxBase
->bsblttl
= bn
;
81 /* In this case the following also has to happen:
82 It is my understanding that at the end of every blit an interrupt
83 occurs that can take care of any blits in this queue or allow
84 a taks to wake up when it was blocked due to a call to OwnBlitter.
85 But in this case there might not be such an interrupt for a long
86 time if no calls to blitterfunctions are made. Therefore this
87 blit might be queued forever. To avoid this I have to cause
88 a Blitter interrupt, if no task owns the blitter right now.
92 !!! missing code here!! See explanation above!
94 #if (AROS_FLAVOUR & AROS_FLAVOUR_BINCOMPAT) && defined(mc68000)
96 /* Trigger blitter interrupt */
97 volatile struct Custom
*custom
= (struct Custom
*)(void **)0xdff000;
98 custom
->intreq
= INTF_SETCLR
| INTF_BLIT
;
99 custom
->intena
= INTF_SETCLR
| INTF_BLIT
;
105 /* queue it at the end */
106 GfxBase
->bsblttl
->n
= bn
;
107 GfxBase
->bsblttl
= bn
;