test/library/usereltest.c: Refined test to show that problem is not solved.
[AROS.git] / rom / graphics / qbsblit.c
blob69fc73bb037225e5fe3110aa3d3b38a7769aa6b3
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/intbits.h>
11 #include <hardware/blit.h>
12 #include <graphics/gfxbase.h>
14 /*****************************************************************************
16 NAME */
17 #include <proto/graphics.h>
19 AROS_LH1(void, QBSBlit,
21 /* SYNOPSIS */
22 AROS_LHA(struct bltnode *, bn, A1),
24 /* LOCATION */
25 struct GfxBase *, GfxBase, 49, Graphics)
27 /* FUNCTION
28 Queues a request for a beam-synchronized blit.
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 queue bsblthd (bsblttl) */
66 /* I am accessing a public structure and there's no semaphore...*/
67 Disable();
69 if (NULL == GfxBase->bsblthd)
71 /* OwnBlitter() only if both lists are empty */
72 if (NULL == GfxBase->blthd)
73 OwnBlitter();
75 /* it's the first one in the list */
76 GfxBase->bsblthd = bn;
77 GfxBase->bsblttl = bn;
79 /* In this case the following also has to happen:
80 It is my understanding that at the end of every blit an interrupt
81 occurs that can take care of any blits in this queue or allow
82 a taks to wake up when it was blocked due to a call to OwnBlitter.
83 But in this case there might not be such an interrupt for a long
84 time if no calls to blitterfunctions are made. Therefore this
85 blit might be queued forever. To avoid this I have to cause
86 a Blitter interrupt, if no task owns the blitter right now.
87 (BlitOwner)
90 !!! missing code here!! See explanation above!
92 #if (AROS_FLAVOUR & AROS_FLAVOUR_BINCOMPAT) && defined(mc68000)
94 /* Trigger blitter interrupt */
95 volatile struct Custom *custom = (struct Custom *)(void **)0xdff000;
96 custom->intreq = INTF_SETCLR | INTF_BLIT;
97 custom->intena = INTF_SETCLR | INTF_BLIT;
99 #endif
101 else
103 /* queue it at the end */
104 GfxBase->bsblttl->n = bn;
105 GfxBase->bsblttl = bn;
108 Enable();
110 AROS_LIBFUNC_EXIT
112 } /* QBSBlit */