define __KERNEL_STRICT_NAMES to avoid inclusion of kernel types on systems that carry...
[cake.git] / rom / graphics / dispinfo.h
blob00b84d9b25e48470fd2c0c99a8991ae39f48159c
1 #ifndef DISPINFO_H
2 #define DISPINFO_H
4 #ifndef PROTO_GRAPHICS_H
5 #include <proto/graphics.h>
6 #endif
8 /****************************************************************************************/
10 /* stegerg: check */
12 /* #define NOTNULLMASK 0x10000000 --> trouble with more than 4 gfxmodes: 4 << 26 = 0x10000000 */
13 #define NOTNULLMASK 0x0001000
15 #define MAJOR_ID_MSB 30
16 #define MAJOR_ID_LSB 26
17 #define MAJOR_ID_SHIFT MAJOR_ID_LSB
18 #define MAJOR_ID_MASK (((1 << (MAJOR_ID_MSB - MAJOR_ID_LSB + 1)) - 1) << MAJOR_ID_LSB)
20 #define MINOR_ID_MSB 25
21 #define MINOR_ID_LSB 20
22 #define MINOR_ID_SHIFT MINOR_ID_LSB
23 #define MINOR_ID_MASK (((1 << (MINOR_ID_MSB - MINOR_ID_LSB + 1)) - 1) << MINOR_ID_LSB)
25 #define NUM2MAJORID(num) ((num) << MAJOR_ID_SHIFT)
26 /*#define MAJORID2NUM(modeid) ( ((modeid) & ~NOTNULLMASK) >> MAJOR_ID_SHIFT)*/
27 #define MAJORID2NUM(modeid) ( ((modeid) & MAJOR_ID_MASK) >> MAJOR_ID_SHIFT)
29 #define NUM2MINORID(num) ((num) << MINOR_ID_SHIFT)
30 /*#define MINORID2NUM(modeid) ( ((modeid) & ~NOTNULLMASK) >> MINOR_ID_SHIFT)*/
31 #define MINORID2NUM(modeid) ( ((modeid) & MINOR_ID_MASK) >> MINOR_ID_SHIFT)
33 /* stegerg: end check */
36 /* This macro assures that a modeid is never 0 by setting the MSB to 1.
37 This is usefull because FindDisplayInfo just returns the modeid,
38 and FidDisplayInfo returning 0 indicates failure
41 #define GENERATE_MODEID(majoridx, minoridx) \
42 (NUM2MAJORID(majoridx) | NUM2MINORID(minoridx) | NOTNULLMASK)
45 ModeID construction is really private to the HIDD so
46 this is a hack
49 #define AMIGA_TO_HIDD_MODEID(modeid) \
50 ( ((modeid) == INVALID_ID) \
51 ? vHidd_ModeID_Invalid \
52 : ( (MAJORID2NUM(modeid) << 16) | MINORID2NUM(modeid)) )
54 #define HIDD_TO_AMIGA_MODEID(modeid) \
55 ( ((modeid) == vHidd_ModeID_Invalid) \
56 ? INVALID_ID \
57 : (GENERATE_MODEID((modeid) >> 16, (modeid) & 0x0000FFFF)) )
59 /****************************************************************************************/
61 struct displayinfo_db
63 struct MonitorSpec *mspecs;
64 ULONG num_mspecs;
65 struct SignalSemaphore sema;
68 /****************************************************************************************/
70 APTR build_dispinfo_db(struct GfxBase *GfxBase);
71 VOID destroy_dispinfo_db(APTR dispinfo_db, struct GfxBase *GfxBase);
72 HIDDT_ModeID get_hiddmode_for_amigamodeid(ULONG modeid, struct GfxBase *GfxBase);
73 HIDDT_ModeID get_best_resolution_and_depth(struct GfxBase *GfxBase);
75 /****************************************************************************************/
77 #endif