wip prep commit in lieu of gfx subsystem update changes.
[AROS.git] / workbench / libs / cgfx / cvideoctrltaglist.c
blob9ce4294748263631a2ac6a735744661ab513cc5c
1 /*
2 Copyright © 1995-2017, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
9 #include <aros/debug.h>
10 #include <cybergraphx/cybergraphics.h>
11 #include <graphics/view.h>
12 #include <hidd/gfx.h>
13 #include <proto/oop.h>
14 #include <proto/utility.h>
16 #include "cybergraphics_intern.h"
17 #include "gfxfuncsupport.h"
19 /*****************************************************************************
21 NAME */
22 #include <proto/cybergraphics.h>
25 AROS_LH2(void, CVideoCtrlTagList,
27 /* SYNOPSIS */
28 AROS_LHA(struct ViewPort *, vp, A0),
29 AROS_LHA(struct TagItem *, tags, A1),
31 /* LOCATION */
32 struct Library *, CyberGfxBase, 27, Cybergraphics)
34 /* FUNCTION
35 Controls video output. It currently only allows adjustment of
36 power-saving modes, using the following tag:
37 SETVC_DPMSLevel (IPTR) - one of the following DPMS levels:
38 DPMS_ON - normal operation.
39 DPMS_STANDBY - less than 80% power usage.
40 DPMS_SUSPEND - less than 30W power usage.
41 DPMS_OFF - less than 8W power usage.
43 INPUTS
44 vp - a ViewPort belonging to the video output device to be controlled.
45 tags - a taglist containing video control options.
47 RESULT
48 None.
50 NOTES
52 EXAMPLE
54 BUGS
56 SEE ALSO
58 INTERNALS
60 *****************************************************************************/
62 AROS_LIBFUNC_INIT
64 struct TagItem *tag, *tstate;
65 ULONG dpmslevel = 0;
66 OOP_Object *gfxhidd = NULL;
68 struct TagItem htags[] =
70 { aHidd_Gfx_DPMSLevel, 0UL },
71 { TAG_DONE, 0UL }
74 BOOL dpms_found = FALSE;
76 HIDDT_DPMSLevel hdpms = 0;
78 for (tstate = tags; (tag = NextTagItem(&tstate)); )
80 switch (tag->ti_Tag)
82 case SETVC_DPMSLevel:
83 dpmslevel = tag->ti_Data;
84 dpms_found = TRUE;
85 break;
87 default:
88 D(bug("!!! UNKNOWN TAG IN CVideoCtrlTagList(): %x !!!\n"
89 , tag->ti_Tag));
90 break;
92 } /* switch() */
94 } /* for (each tagitem) */
97 if (dpms_found)
100 /* Convert to hidd dpms level */
101 switch (dpmslevel)
103 case DPMS_ON:
104 hdpms = vHidd_Gfx_DPMSLevel_On;
105 break;
107 case DPMS_STANDBY:
108 hdpms = vHidd_Gfx_DPMSLevel_Standby;
109 break;
111 case DPMS_SUSPEND:
112 hdpms = vHidd_Gfx_DPMSLevel_Suspend;
113 break;
115 case DPMS_OFF:
116 hdpms = vHidd_Gfx_DPMSLevel_Off;
117 break;
119 default:
120 D(bug("!!! UNKNOWN DPMS LEVEL IN CVideoCtrlTagList(): %x !!!\n"
121 , dpmslevel));
123 dpms_found = FALSE;
124 break;
129 if (dpms_found)
131 htags[0].ti_Data = hdpms;
133 else
135 htags[0].ti_Tag = TAG_IGNORE;
138 OOP_GetAttr(HIDD_BM_OBJ(vp->RasInfo->BitMap), aHidd_BitMap_GfxHidd, (IPTR *)&gfxhidd);
139 if (gfxhidd)
140 OOP_SetAttrs(gfxhidd, htags);
142 AROS_LIBFUNC_EXIT
143 } /* CVideoCtrlTagList */