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