|
|
1.1 root 1: /* $Id: sun-fb.c,v 1.1 2004/08/19 11:34:13 fredette Exp $ */
2:
3: /* machine/sun/sun-fb.c - Sun framebuffer emulation support: */
4:
5: /*
6: * Copyright (c) 2004 Matt Fredette
7: * All rights reserved.
8: *
9: * Redistribution and use in source and binary forms, with or without
10: * modification, are permitted provided that the following conditions
11: * are met:
12: * 1. Redistributions of source code must retain the above copyright
13: * notice, this list of conditions and the following disclaimer.
14: * 2. Redistributions in binary form must reproduce the above copyright
15: * notice, this list of conditions and the following disclaimer in the
16: * documentation and/or other materials provided with the distribution.
17: * 3. All advertising materials mentioning features or use of this software
18: * must display the following acknowledgement:
19: * This product includes software developed by Matt Fredette.
20: * 4. The name of the author may not be used to endorse or promote products
21: * derived from this software without specific prior written permission.
22: *
23: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26: * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
27: * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28: * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
29: * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
31: * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32: * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33: * POSSIBILITY OF SUCH DAMAGE.
34: */
35:
36: #include <tme/common.h>
37: _TME_RCSID("$Id: sun-fb.c,v 1.1 2004/08/19 11:34:13 fredette Exp $");
38:
39: /* includes: */
40: #include "sun-fb.h"
41:
42: /* this returns the P4 size value for the given resolution: */
43: tme_uint32_t
44: tme_sun_fb_p4_size(const char *size)
45: {
46: if (TME_ARG_IS(size, "1600x1280")) {
47: return (TME_SUN_P4_SIZE_1600_1280);
48: }
49: else if (TME_ARG_IS(size, "1152x900")) {
50: return (TME_SUN_P4_SIZE_1152_900);
51: }
52: else if (TME_ARG_IS(size, "1024x1024")) {
53: return (TME_SUN_P4_SIZE_1024_1024);
54: }
55: else if (TME_ARG_IS(size, "1280x1024")) {
56: return (TME_SUN_P4_SIZE_1280_1024);
57: }
58: else if (TME_ARG_IS(size, "1440x1440")) {
59: return (TME_SUN_P4_SIZE_1440_1440);
60: }
61: else if (TME_ARG_IS(size, "640x480")) {
62: return (TME_SUN_P4_SIZE_640_480);
63: }
64: return (TME_SUN_P4_SIZE_NULL);
65: }
66:
67: /* this returns the width for the given P4 size value: */
68: tme_uint32_t
69: tme_sun_fb_p4_size_width(tme_uint32_t p4_size)
70: {
71: switch (p4_size) {
72: case TME_SUN_P4_SIZE_1600_1280: return(1600);
73: case TME_SUN_P4_SIZE_1152_900: return(1152);
74: case TME_SUN_P4_SIZE_1024_1024: return(1024);
75: case TME_SUN_P4_SIZE_1280_1024: return(1280);
76: case TME_SUN_P4_SIZE_1440_1440: return(1440);
77: case TME_SUN_P4_SIZE_640_480: return(640);
78: default: abort();
79: }
80: }
81:
82: /* this returns the height for the given P4 size value: */
83: tme_uint32_t
84: tme_sun_fb_p4_size_height(tme_uint32_t p4_size)
85: {
86: switch (p4_size) {
87: case TME_SUN_P4_SIZE_1600_1280: return(1280);
88: case TME_SUN_P4_SIZE_1152_900: return(900);
89: case TME_SUN_P4_SIZE_1024_1024: return(1024);
90: case TME_SUN_P4_SIZE_1280_1024: return(1024);
91: case TME_SUN_P4_SIZE_1440_1440: return(1440);
92: case TME_SUN_P4_SIZE_640_480: return(480);
93: default: abort();
94: }
95: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.