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