1 | /* $Id: VBox2DHelpers.cpp 72057 2018-04-27 11:55:52Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - 2D Video Acceleration helpers implementation.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2009-2018 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 | #if defined(VBOX_GUI_USE_QGL) || defined(VBOX_WITH_VIDEOHWACCEL)
|
---|
20 |
|
---|
21 | #ifdef VBOX_WITH_PRECOMPILED_HEADERS
|
---|
22 | # include <precomp.h>
|
---|
23 | #else /* !VBOX_WITH_PRECOMPILED_HEADERS */
|
---|
24 |
|
---|
25 | # define LOG_GROUP LOG_GROUP_GUI
|
---|
26 |
|
---|
27 | // WORKAROUND:
|
---|
28 | // QGLWidget drags in Windows.h and stdint.h
|
---|
29 | # ifdef RT_OS_WINDOWS
|
---|
30 | # include <iprt/win/windows.h>
|
---|
31 | # include <iprt/stdint.h>
|
---|
32 | # endif
|
---|
33 |
|
---|
34 | /* Qt includes: */
|
---|
35 | # include <QGLWidget>
|
---|
36 |
|
---|
37 | /* GUI includes: */
|
---|
38 | #include "VBox2DHelpers.h"
|
---|
39 |
|
---|
40 | /* Other VBox includes: */
|
---|
41 | # include <VBox/VBoxGL2D.h>
|
---|
42 |
|
---|
43 | #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
|
---|
44 |
|
---|
45 |
|
---|
46 | /*********************************************************************************************************************************
|
---|
47 | * Global Variables *
|
---|
48 | *********************************************************************************************************************************/
|
---|
49 |
|
---|
50 | static bool g_fVBoxVHWAChecked = false;
|
---|
51 | static bool g_fVBoxVHWASupported = false;
|
---|
52 |
|
---|
53 |
|
---|
54 | /*********************************************************************************************************************************
|
---|
55 | * Namespace VBox2DHelpers implementation. *
|
---|
56 | *********************************************************************************************************************************/
|
---|
57 |
|
---|
58 | bool VBox2DHelpers::isAcceleration2DVideoAvailable()
|
---|
59 | {
|
---|
60 | if (!g_fVBoxVHWAChecked)
|
---|
61 | {
|
---|
62 | g_fVBoxVHWAChecked = true;
|
---|
63 | g_fVBoxVHWASupported = VBoxVHWAInfo::checkVHWASupport();
|
---|
64 | }
|
---|
65 | return g_fVBoxVHWASupported;
|
---|
66 | }
|
---|
67 |
|
---|
68 | quint64 VBox2DHelpers::required2DOffscreenVideoMemory()
|
---|
69 | {
|
---|
70 | /* HDTV == 1920x1080 ~ 2M
|
---|
71 | * for the 4:2:2 formats each pixel is 2Bytes
|
---|
72 | * so each frame may be 4MiB
|
---|
73 | * so for triple-buffering we would need 12 MiB */
|
---|
74 | return _1M * 12;
|
---|
75 | }
|
---|
76 |
|
---|
77 | #endif /* VBOX_GUI_USE_QGL || VBOX_WITH_VIDEOHWACCEL */
|
---|