2 Copyright © 1995-2017, The AROS Development Team. All rights reserved.
6 #include <aros/debug.h>
8 #include <proto/alib.h>
9 #include <proto/exec.h>
10 #include <proto/oop.h>
11 #include <proto/arossupport.h>
12 #include <proto/utility.h>
13 #include <proto/graphics.h>
15 #include <exec/lists.h>
16 #include <exec/memory.h>
17 #include <exec/rawfmt.h>
19 #include <graphics/displayinfo.h>
20 #include <graphics/monitor.h>
22 #include <cybergraphx/cybergraphics.h>
31 #include "graphics_intern.h"
32 #include "gfxfuncsupport.h"
35 HIDDT_ModeID
get_best_resolution_and_depth(struct monitor_driverdata
*mdd
, struct GfxBase
*GfxBase
)
37 HIDDT_ModeID ret
= vHidd_ModeID_Invalid
;
38 struct DisplayInfoHandle
*dh
;
39 ULONG best_resolution
= 0;
42 for (dh
= mdd
->modes
; dh
->id
!= vHidd_ModeID_Invalid
; dh
++) {
43 OOP_Object
*sync
, *pf
;
46 HIDD_Gfx_GetMode(mdd
->gfxhidd
, dh
->id
, &sync
, &pf
);
47 OOP_GetAttr(pf
, aHidd_PixFmt_Depth
, &depth
);
49 if (depth
>= best_depth
) {
53 OOP_GetAttr(sync
, aHidd_Sync_HDisp
, &width
);
54 OOP_GetAttr(sync
, aHidd_Sync_VDisp
, &height
);
57 if (res
> best_resolution
) {
59 best_resolution
= res
;
67 /* Looks up a DriverData corresponding to a MonitorSpec */
68 struct monitor_driverdata
*MonitorFromSpec(struct MonitorSpec
*mspc
, struct GfxBase
*GfxBase
)
70 struct monitor_driverdata
*ret
= NULL
;
71 struct monitor_driverdata
*mdd
;
78 * FIXME: NULL ms_Object will likely mean chipset MonitorSpec (they don't have 1:1 relation with sync objects)
79 * Process this correctly here. Or am i wrong ?
84 OOP_GetAttr((OOP_Object
*)mspc
->ms_Object
, aHidd_Sync_GfxHidd
, (IPTR
*)&drv
);
86 ObtainSemaphoreShared(&CDD(GfxBase
)->displaydb_sem
);
88 for (mdd
= CDD(GfxBase
)->monitors
; mdd
; mdd
= mdd
->next
)
91 * Sync objects know nothing about fakegfx proxy class.
92 * They carry a pointer to a real driver object.
94 if (mdd
->gfxhidd_orig
== drv
)
101 ReleaseSemaphore(&CDD(GfxBase
)->displaydb_sem
);