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