VirtualBox

source: vbox/trunk/src/VBox/Additions/haiku/VBoxVideo/common/VBoxVideo_common.h@ 43363

Last change on this file since 43363 was 43363, checked in by vboxsync, 12 years ago

Haiku Additions.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.8 KB
Line 
1/* $Id: VBoxVideo_common.h 43363 2012-09-20 09:56:07Z vboxsync $ */
2/** @file
3 * VBoxVideo, Haiku Guest Additions, common header.
4 */
5
6/*
7 * Copyright (C) 2012 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18/*
19 * This code is based on:
20 *
21 * VirtualBox Guest Additions for Haiku.
22 * Copyright (c) 2011 Mike Smith <[email protected]>
23 * François Revol <[email protected]>
24 *
25 * Permission is hereby granted, free of charge, to any person
26 * obtaining a copy of this software and associated documentation
27 * files (the "Software"), to deal in the Software without
28 * restriction, including without limitation the rights to use,
29 * copy, modify, merge, publish, distribute, sublicense, and/or sell
30 * copies of the Software, and to permit persons to whom the
31 * Software is furnished to do so, subject to the following
32 * conditions:
33 *
34 * The above copyright notice and this permission notice shall be
35 * included in all copies or substantial portions of the Software.
36 *
37 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
38 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
39 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
40 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
41 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
42 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
43 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
44 * OTHER DEALINGS IN THE SOFTWARE.
45 */
46
47#ifndef _VBOXVIDEO_COMMON_H
48#define _VBOXVIDEO_COMMON_H
49
50#include <Drivers.h>
51#include <Accelerant.h>
52#include <PCI.h>
53
54struct SharedInfo {
55 display_mode currentMode;
56
57 area_id framebufferArea;
58 void* framebuffer;
59};
60
61enum {
62 VBOXVIDEO_GET_PRIVATE_DATA = B_DEVICE_OP_CODES_END + 1,
63 VBOXVIDEO_GET_DEVICE_NAME,
64 VBOXVIDEO_SET_DISPLAY_MODE
65};
66
67static inline uint32 get_color_space_for_depth(uint32 depth)
68{
69 switch (depth) {
70 case 1:
71 return B_GRAY1;
72 case 4:
73 return B_GRAY8;
74 // the app_server is smart enough to translate this to VGA mode
75 case 8:
76 return B_CMAP8;
77 case 15:
78 return B_RGB15;
79 case 16:
80 return B_RGB16;
81 case 24:
82 return B_RGB24;
83 case 32:
84 return B_RGB32;
85 }
86
87 return 0;
88}
89
90static inline uint32 get_depth_for_color_space(uint32 depth)
91{
92 switch (depth) {
93 case B_GRAY1:
94 return 1;
95 case B_GRAY8:
96 return 4;
97 case B_CMAP8:
98 return 8;
99 case B_RGB15:
100 return 15;
101 case B_RGB16:
102 return 16;
103 case B_RGB24:
104 return 24;
105 case B_RGB32:
106 return 32;
107 }
108
109 return 0;
110}
111
112#endif
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette