~ubuntu-branches/ubuntu/raring/virtualbox-ose/raring

« back to all changes in this revision

Viewing changes to src/VBox/Frontends/VBoxFB/Framebuffer.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2009-12-18 16:44:29 UTC
  • mfrom: (0.3.3 upstream) (0.4.6 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091218164429-jd34ccexpv5na11a
Tags: 3.1.2-dfsg-1ubuntu1
* Merge from Debian unstable (LP: #498219), remaining changes:
  - Disable update action
    - debian/patches/u01-disable-update-action.dpatch
  - VirtualBox should go in Accessories, not in System tools (LP: #288590)
    - debian/virtualbox-ose-qt.files/virtualbox-ose.desktop
  - Add Apport hook
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Add Launchpad integration
    - debian/control
    - debian/lpi-bug.xpm
    - debian/patches/u02-lp-integration.dpatch
* Fixes the following bugs:
  - Kernel module fails to build with Linux >= 2.6.32 (LP: #474625)
  - X.Org drivers need to be rebuilt against X-Server 1.7 (LP: #495935)
  - The *-source packages try to build the kernel modules even though the
    kernel headers aren't available (LP: #473334)
* Replace *-source packages with transitional packages for *-dkms.
* Adapt u01-disable-update-action.dpatch and u02-lp-integration.dpatch for
  new upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 */
6
6
 
7
7
/*
8
 
 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
 
8
 * Copyright (C) 2006-2009 Sun Microsystems, Inc.
9
9
 *
10
10
 * This file is part of VirtualBox Open Source Edition (OSE), as
11
11
 * available from http://www.virtualbox.org. This file is free software;
41
41
        createSurface(fbWidth, fbHeight);
42
42
    }
43
43
    fbSurfaceLocked = 0;
44
 
    uint32_t bitsPerPixel;
 
44
    PRUint32 bitsPerPixel;
45
45
    GetBitsPerPixel(&bitsPerPixel);
46
46
    fbPitch = fbWidth * (bitsPerPixel / 8);
47
47
}
64
64
    return NS_OK;
65
65
}
66
66
 
67
 
NS_IMETHODIMP VBoxDirectFB::GetHeight(uint32_t *height)
 
67
NS_IMETHODIMP VBoxDirectFB::GetHeight(PRUint32 *height)
68
68
{
69
69
    if (!height)
70
70
        return NS_ERROR_INVALID_POINTER;
129
129
    return NS_OK;
130
130
}
131
131
 
132
 
NS_IMETHODIMP VBoxDirectFB::GetAddress(uint32_t *address)
 
132
NS_IMETHODIMP VBoxDirectFB::GetAddress(PRUint8 **address)
133
133
{
134
134
    if (!address)
135
135
        return NS_ERROR_INVALID_POINTER;
136
 
    *address = (uint32_t)fbBufferAddress;
 
136
    *address = (PRUint8 *)fbBufferAddress;
137
137
    return NS_OK;
138
138
}
139
139
 
140
 
NS_IMETHODIMP VBoxDirectFB::GetBitsPerPixel(uint32_t *bitsPerPixel)
 
140
NS_IMETHODIMP VBoxDirectFB::GetBitsPerPixel(PRUint32 *bitsPerPixel)
141
141
{
142
142
    if (!bitsPerPixel)
143
143
        return NS_ERROR_INVALID_POINTER;
161
161
    return NS_OK;
162
162
}
163
163
 
164
 
NS_IMETHODIMP VBoxDirectFB::GetBytesPerLine(uint32_t *bytesPerLine)
 
164
NS_IMETHODIMP VBoxDirectFB::GetBytesPerLine(PRUint32 *bytesPerLine)
165
165
{
166
166
    if (!bytesPerLine)
167
167
        return NS_ERROR_INVALID_POINTER;
169
169
    return NS_OK;
170
170
}
171
171
 
172
 
NS_IMETHODIMP VBoxDirectFB::COMGETTER(PixelFormat) (ULONG *pixelFormat)
 
172
NS_IMETHODIMP VBoxDirectFB::GetPixelFormat (PRUint32 *pixelFormat)
173
173
{
174
174
    if (!pixelFormat)
175
175
        return NS_ERROR_INVALID_POINTER;
177
177
    return NS_OK;
178
178
}
179
179
 
180
 
NS_IMETHODIMP VBoxDirectFB::COMGETTER(UsesGuestVRAM) (BOOL *usesGuestVRAM)
 
180
NS_IMETHODIMP VBoxDirectFB::GetUsesGuestVRAM (PRBool *usesGuestVRAM)
181
181
{
182
182
    if (!usesGuestVRAM)
183
183
        return NS_ERROR_INVALID_POINTER;
184
 
    *usesGuestVRAM = FALSE;
185
 
    return NS_OK;
186
 
}
187
 
 
188
 
NS_IMETHODIMP VBoxDirectFB::NotifyUpdate(uint32_t x, uint32_t y,
189
 
                                         uint32_t w, uint32_t h)
 
184
    *usesGuestVRAM = false;
 
185
    return NS_OK;
 
186
}
 
187
 
 
188
NS_IMETHODIMP VBoxDirectFB::GetHeightReduction(PRUint32 *heightReduction)
 
189
{
 
190
    if (!heightReduction)
 
191
        return NS_ERROR_INVALID_POINTER;
 
192
    *heightReduction = 0;
 
193
    return NS_OK;
 
194
}
 
195
 
 
196
NS_IMETHODIMP VBoxDirectFB::GetOverlay(IFramebufferOverlay **overlay)
 
197
{
 
198
    if (!overlay)
 
199
        return NS_ERROR_INVALID_POINTER;
 
200
    /* Not yet implemented */
 
201
    *overlay = 0;
 
202
    return NS_OK;
 
203
}
 
204
 
 
205
NS_IMETHODIMP VBoxDirectFB::GetWinId(PRUint64 *winId)
 
206
{
 
207
    if (!winId)
 
208
        return NS_ERROR_INVALID_POINTER;
 
209
    *winId = 0;
 
210
    return NS_OK;
 
211
}
 
212
 
 
213
NS_IMETHODIMP VBoxDirectFB::NotifyUpdate(PRUint32 x, PRUint32 y,
 
214
                                         PRUint32 w, PRUint32 h)
190
215
{
191
216
    // we only need to take action if we have a memory framebuffer
192
217
    if (fbInternalSurface)
219
244
    return NS_OK;
220
245
}
221
246
 
222
 
NS_IMETHODIMP VBoxDirectFB::RequestResize(ULONG aScreenId, ULONG pixelFormat, uint32_t vram,
223
 
                                          uint32_t bitsPerPixel, uint32_t bytesPerLine,
224
 
                                          uint32_t w, uint32_t h,
 
247
NS_IMETHODIMP VBoxDirectFB::RequestResize(PRUint32 aScreenId, PRUint32 pixelFormat, PRUint8 *vram,
 
248
                                          PRUint32 bitsPerPixel, PRUint32 bytesPerLine,
 
249
                                          PRUint32 w, PRUint32 h,
225
250
                                          PRBool *finished)
226
251
{
227
252
    uint32_t needsLocking = fbSurfaceLocked;
228
 
    uint32_t bitsPerPixel;
229
253
 
230
 
    GetBitsPerPixel(&bitsPerPixel);
231
 
    printf("RequestResize: w = %d, h = %d, fbSurfaceLocked = %d\n", w, h, fbSurfaceLocked);
 
254
    printf("RequestResize: aScreenId = %d, pixelFormat = %d, vram = %p, bitsPerPixel = %d, bytesPerLine = %d, w = %d, h = %d, fbSurfaceLocked = %d\n", aScreenId, pixelFormat, vram, bitsPerPixel, bytesPerLine, w, h, fbSurfaceLocked);
232
255
 
233
256
    // we can't work with a locked surface
234
257
    if (needsLocking)
299
322
    return NS_OK;
300
323
}
301
324
 
 
325
NS_IMETHODIMP VBoxDirectFB::VideoModeSupported(PRUint32 w, PRUint32 h, PRUint32 bpp, PRBool *supported)
 
326
{
 
327
    if (!supported)
 
328
        return NS_ERROR_INVALID_POINTER;
 
329
    *supported = true;
 
330
    return NS_OK;
 
331
}
 
332
 
 
333
NS_IMETHODIMP VBoxDirectFB::GetVisibleRegion(PRUint8 *rectangles, PRUint32 count, PRUint32 *countCopied)
 
334
{
 
335
    PRTRECT rects = (PRTRECT)rectangles;
 
336
 
 
337
    if (!rects || !countCopied)
 
338
        return NS_ERROR_INVALID_POINTER;
 
339
    /** @todo */
 
340
    *countCopied = 0;
 
341
    return NS_OK;
 
342
}
 
343
 
 
344
NS_IMETHODIMP VBoxDirectFB::SetVisibleRegion(PRUint8 *rectangles, PRUint32 count)
 
345
{
 
346
    PRTRECT rects = (PRTRECT)rectangles;
 
347
 
 
348
    if (!rects)
 
349
        return NS_ERROR_INVALID_POINTER;
 
350
    /** @todo */
 
351
    return NS_OK;
 
352
}
 
353
 
 
354
NS_IMETHODIMP VBoxDirectFB::ProcessVHWACommand(PRUint8 *command)
 
355
{
 
356
    return NS_ERROR_NOT_IMPLEMENTED;
 
357
}
 
358
 
302
359
int VBoxDirectFB::createSurface(uint32_t w, uint32_t h)
303
360
{
304
361
    printf("creating a new internal surface, w = %u, h = %u...\n", w, h);