summaryrefslogtreecommitdiff
path: root/src/VBox/Additions/x11/vboxvideo/testcase/tstSetModeXOrg.c
blob: b30a35b00c16038c7f3343d6cad24467404cdbce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/* $Id: tstSetModeXOrg.c $ */
/** @file
 * vboxvideo unit test - modesetting.
 */

/*
 * Copyright (C) 2011 Oracle Corporation
 *
 * This file is part of VirtualBox Open Source Edition (OSE), as
 * available from http://www.virtualbox.org. This file is free software;
 * you can redistribute it and/or modify it under the terms of the GNU
 * General Public License (GPL) as published by the Free Software
 * Foundation, in version 2 as it comes in the "COPYING" file of the
 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
 */

/*******************************************************************************
*   Header Files                                                               *
*******************************************************************************/

#include "../vboxvideo.h"

#include <VBox/VBoxVideoGuest.h>

#include <iprt/assert.h>
#include <iprt/err.h>
#include <iprt/test.h>

#include <xf86.h>

void xf86Msg(MessageType type, const char *format, ...) {}
void xf86DrvMsg(int scrnIndex, MessageType type, const char *format, ...) {}

static ScrnInfoRec scrnInfo[1];
static ScrnInfoPtr pScrns[1] = { &scrnInfo[0] };
ScrnInfoPtr *xf86Screens = pScrns;

Bool vbox_device_available(VBOXPtr pVBox)
{
    return TRUE;
}

Bool vboxEnableGraphicsCap(VBOXPtr pVBox)
{
    return TRUE;
}

void VBOXDRIUpdateStride(ScrnInfoPtr pScrn, VBOXPtr pVBox) {}

static struct
{
    uint16_t cWidth;
    uint16_t cHeight;
    uint16_t cVirtWidth;
    uint16_t cBPP;
    uint16_t fFlags;
    uint16_t cx;
    uint16_t cy;
} s_ModeRegs;

RTDECL(void) VBoxVideoSetModeRegisters(uint16_t cWidth, uint16_t cHeight,
                                       uint16_t cVirtWidth, uint16_t cBPP,
                                       uint16_t fFlags,
                                       uint16_t cx, uint16_t cy)
{
    s_ModeRegs.cWidth     = cWidth;
    s_ModeRegs.cHeight    = cHeight;
    s_ModeRegs.cVirtWidth = cVirtWidth;
    s_ModeRegs.cBPP       = cBPP;
    s_ModeRegs.fFlags     = fFlags;
    s_ModeRegs.cx         = cx;
    s_ModeRegs.cy         = cy;
}

static struct
{
    PHGSMIGUESTCOMMANDCONTEXT pCtx;
    uint32_t cDisplay;
    int32_t  cOriginX;
    int32_t  cOriginY;
    uint32_t offStart;
    uint32_t cbPitch;
    uint32_t cWidth;
    uint32_t cHeight;
    uint16_t cBPP;
    uint16_t fFlags;
} s_DisplayInfo;

void VBoxHGSMIProcessDisplayInfo(PHGSMIGUESTCOMMANDCONTEXT pCtx,
                                 uint32_t cDisplay, int32_t  cOriginX,
                                 int32_t  cOriginY, uint32_t offStart,
                                 uint32_t cbPitch, uint32_t cWidth,
                                 uint32_t cHeight, uint16_t cBPP,
                                 uint16_t fFlags)
{
    s_DisplayInfo.pCtx     = pCtx;
    s_DisplayInfo.cDisplay = cDisplay;
    s_DisplayInfo.cOriginX = cOriginX;
    s_DisplayInfo.cOriginY = cOriginY;
    s_DisplayInfo.offStart = offStart;
    s_DisplayInfo.cbPitch  = cbPitch;
    s_DisplayInfo.cWidth   = cWidth;
    s_DisplayInfo.cHeight  = cHeight;
    s_DisplayInfo.cBPP     = cBPP;
    s_DisplayInfo.fFlags   = fFlags;
}


static int setup(void)
{
    return VINF_SUCCESS;
}

static void teardown(void)
{
}

int main(void)
{
    /*
     * Init the runtime, test and say hello.
     */
    RTTEST hTest;
    RTEXITCODE rcExit = RTTestInitAndCreate("tstVBoxVideoXOrg", &hTest);
    if (rcExit != RTEXITCODE_SUCCESS)
        return rcExit;
    RTTestBanner(hTest);

    /*
     * Run the tests.
     */
    AssertRC(setup());
    teardown();

    /*
     * Summary
     */
    return RTTestSummaryAndDestroy(hTest);
}