1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox frontends: Qt GUI ("VirtualBox"):
|
---|
4 | * VBoxFrameBuffer class and subclasses declarations
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.virtualbox.org. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License (GPL) as published by the Free Software
|
---|
14 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | *
|
---|
18 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
19 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
20 | * additional information or have any questions.
|
---|
21 | */
|
---|
22 |
|
---|
23 | #ifndef __VBoxFrameBuffer_h__
|
---|
24 | #define __VBoxFrameBuffer_h__
|
---|
25 |
|
---|
26 | #include "COMDefs.h"
|
---|
27 |
|
---|
28 | /* Qt includes */
|
---|
29 | #include <QImage>
|
---|
30 | #include <QPixmap>
|
---|
31 | #include <QMutex>
|
---|
32 |
|
---|
33 | #if defined (VBOX_GUI_USE_SDL)
|
---|
34 | #include <SDL.h>
|
---|
35 | #include <signal.h>
|
---|
36 | #endif
|
---|
37 |
|
---|
38 | #if defined (Q_WS_WIN) && defined (VBOX_GUI_USE_DDRAW)
|
---|
39 | // VBox/cdefs.h defines these:
|
---|
40 | #undef LOWORD
|
---|
41 | #undef HIWORD
|
---|
42 | #undef LOBYTE
|
---|
43 | #undef HIBYTE
|
---|
44 | #include <ddraw.h>
|
---|
45 | #endif
|
---|
46 |
|
---|
47 | class VBoxConsoleView;
|
---|
48 |
|
---|
49 | //#define VBOX_GUI_FRAMEBUF_STAT
|
---|
50 |
|
---|
51 | #if defined (VBOX_GUI_DEBUG) && defined (VBOX_GUI_FRAMEBUF_STAT)
|
---|
52 | #define FRAMEBUF_DEBUG_START(prefix) \
|
---|
53 | uint64_t prefix##elapsed = VMCPUTimer::ticks();
|
---|
54 | #define FRAMEBUF_DEBUG_STOP(prefix,w,h) { \
|
---|
55 | prefix##elapsed = VMCPUTimer::ticks() - prefix##elapsed; \
|
---|
56 | V_DEBUG(( "Last update: %04d x %04d px, %03.3f ms, %.0f ticks", \
|
---|
57 | (w), (h), \
|
---|
58 | (double) prefix##elapsed / (double) VMCPUTimer::ticksPerMsec(), \
|
---|
59 | (double) prefix##elapsed \
|
---|
60 | )); \
|
---|
61 | }
|
---|
62 | #else
|
---|
63 | #define FRAMEBUF_DEBUG_START(prefix) {}
|
---|
64 | #define FRAMEBUF_DEBUG_STOP(prefix,w,h) {}
|
---|
65 | #endif
|
---|
66 |
|
---|
67 | /////////////////////////////////////////////////////////////////////////////
|
---|
68 |
|
---|
69 | /**
|
---|
70 | * Frame buffer resize event.
|
---|
71 | */
|
---|
72 | class VBoxResizeEvent : public QEvent
|
---|
73 | {
|
---|
74 | public:
|
---|
75 |
|
---|
76 | VBoxResizeEvent (ulong aPixelFormat, uchar *aVRAM,
|
---|
77 | ulong aBitsPerPixel, ulong aBytesPerLine,
|
---|
78 | ulong aWidth, ulong aHeight) :
|
---|
79 | QEvent ((QEvent::Type) VBoxDefs::ResizeEventType),
|
---|
80 | mPixelFormat (aPixelFormat), mVRAM (aVRAM), mBitsPerPixel (aBitsPerPixel),
|
---|
81 | mBytesPerLine (aBytesPerLine), mWidth (aWidth), mHeight (aHeight) {}
|
---|
82 | ulong pixelFormat() { return mPixelFormat; }
|
---|
83 | uchar *VRAM() { return mVRAM; }
|
---|
84 | ulong bitsPerPixel() { return mBitsPerPixel; }
|
---|
85 | ulong bytesPerLine() { return mBytesPerLine; }
|
---|
86 | ulong width() { return mWidth; }
|
---|
87 | ulong height() { return mHeight; }
|
---|
88 |
|
---|
89 | private:
|
---|
90 |
|
---|
91 | ulong mPixelFormat;
|
---|
92 | uchar *mVRAM;
|
---|
93 | ulong mBitsPerPixel;
|
---|
94 | ulong mBytesPerLine;
|
---|
95 | ulong mWidth;
|
---|
96 | ulong mHeight;
|
---|
97 | };
|
---|
98 |
|
---|
99 | /**
|
---|
100 | * Frame buffer repaint event.
|
---|
101 | */
|
---|
102 | class VBoxRepaintEvent : public QEvent
|
---|
103 | {
|
---|
104 | public:
|
---|
105 | VBoxRepaintEvent (int x, int y, int w, int h) :
|
---|
106 | QEvent ((QEvent::Type) VBoxDefs::RepaintEventType),
|
---|
107 | ex (x), ey (y), ew (w), eh (h)
|
---|
108 | {}
|
---|
109 | int x() { return ex; }
|
---|
110 | int y() { return ey; }
|
---|
111 | int width() { return ew; }
|
---|
112 | int height() { return eh; }
|
---|
113 | private:
|
---|
114 | int ex, ey, ew, eh;
|
---|
115 | };
|
---|
116 |
|
---|
117 | /**
|
---|
118 | * Frame buffer set region event.
|
---|
119 | */
|
---|
120 | class VBoxSetRegionEvent : public QEvent
|
---|
121 | {
|
---|
122 | public:
|
---|
123 | VBoxSetRegionEvent (const QRegion &aReg)
|
---|
124 | : QEvent ((QEvent::Type) VBoxDefs::SetRegionEventType)
|
---|
125 | , mReg (aReg) {}
|
---|
126 | QRegion region() { return mReg; }
|
---|
127 | private:
|
---|
128 | QRegion mReg;
|
---|
129 | };
|
---|
130 |
|
---|
131 | /////////////////////////////////////////////////////////////////////////////
|
---|
132 |
|
---|
133 | /**
|
---|
134 | * Common IFramebuffer implementation for all methods used by GUI to maintain
|
---|
135 | * the VM display video memory.
|
---|
136 | *
|
---|
137 | * Note that although this class can be called from multiple threads
|
---|
138 | * (in particular, the GUI thread and EMT) it doesn't protect access to every
|
---|
139 | * data field using its mutex lock. This is because all synchronization between
|
---|
140 | * the GUI and the EMT thread is supposed to be done using the
|
---|
141 | * IFramebuffer::NotifyUpdate() and IFramebuffer::RequestResize() methods
|
---|
142 | * (in particular, the \a aFinished parameter of these methods is responsible
|
---|
143 | * for the synchronization). These methods are always called on EMT and
|
---|
144 | * therefore always follow one another but never in parallel.
|
---|
145 | *
|
---|
146 | * Using this object's mutex lock (exposed also in IFramebuffer::Lock() and
|
---|
147 | * IFramebuffer::Unlock() implementations) usually makes sense only if some
|
---|
148 | * third-party thread (i.e. other than GUI or EMT) needs to make sure that
|
---|
149 | * *no* VM display update or resize event can occur while it is accessing
|
---|
150 | * IFramebuffer properties or the underlying display memory storage area.
|
---|
151 | *
|
---|
152 | * See IFramebuffer documentation for more info.
|
---|
153 | */
|
---|
154 |
|
---|
155 | class VBoxFrameBuffer : public IFramebuffer
|
---|
156 | {
|
---|
157 | public:
|
---|
158 |
|
---|
159 | VBoxFrameBuffer (VBoxConsoleView *aView);
|
---|
160 | virtual ~VBoxFrameBuffer();
|
---|
161 |
|
---|
162 | NS_DECL_ISUPPORTS
|
---|
163 |
|
---|
164 | #if defined (Q_OS_WIN32)
|
---|
165 |
|
---|
166 | STDMETHOD_(ULONG, AddRef)()
|
---|
167 | {
|
---|
168 | return ::InterlockedIncrement (&refcnt);
|
---|
169 | }
|
---|
170 |
|
---|
171 | STDMETHOD_(ULONG, Release)()
|
---|
172 | {
|
---|
173 | long cnt = ::InterlockedDecrement (&refcnt);
|
---|
174 | if (cnt == 0)
|
---|
175 | delete this;
|
---|
176 | return cnt;
|
---|
177 | }
|
---|
178 |
|
---|
179 | STDMETHOD(QueryInterface) (REFIID riid , void **ppObj)
|
---|
180 | {
|
---|
181 | if (riid == IID_IUnknown) {
|
---|
182 | *ppObj = this;
|
---|
183 | AddRef();
|
---|
184 | return S_OK;
|
---|
185 | }
|
---|
186 | if (riid == IID_IFramebuffer) {
|
---|
187 | *ppObj = this;
|
---|
188 | AddRef();
|
---|
189 | return S_OK;
|
---|
190 | }
|
---|
191 | *ppObj = NULL;
|
---|
192 | return E_NOINTERFACE;
|
---|
193 | }
|
---|
194 |
|
---|
195 | #endif
|
---|
196 |
|
---|
197 | // IFramebuffer COM methods
|
---|
198 | STDMETHOD(COMGETTER(Address)) (BYTE **aAddress);
|
---|
199 | STDMETHOD(COMGETTER(Width)) (ULONG *aWidth);
|
---|
200 | STDMETHOD(COMGETTER(Height)) (ULONG *aHeight);
|
---|
201 | STDMETHOD(COMGETTER(BitsPerPixel)) (ULONG *aBitsPerPixel);
|
---|
202 | STDMETHOD(COMGETTER(BytesPerLine)) (ULONG *aBytesPerLine);
|
---|
203 | STDMETHOD(COMGETTER(PixelFormat)) (ULONG *aPixelFormat);
|
---|
204 | STDMETHOD(COMGETTER(UsesGuestVRAM)) (BOOL *aUsesGuestVRAM);
|
---|
205 | STDMETHOD(COMGETTER(HeightReduction)) (ULONG *aHeightReduction);
|
---|
206 | STDMETHOD(COMGETTER(Overlay)) (IFramebufferOverlay **aOverlay);
|
---|
207 |
|
---|
208 | STDMETHOD(Lock)();
|
---|
209 | STDMETHOD(Unlock)();
|
---|
210 |
|
---|
211 | STDMETHOD(RequestResize) (ULONG aScreenId, ULONG aPixelFormat,
|
---|
212 | BYTE *aVRAM, ULONG aBitsPerPixel, ULONG aBytesPerLine,
|
---|
213 | ULONG aWidth, ULONG aHeight,
|
---|
214 | BOOL *aFinished);
|
---|
215 |
|
---|
216 | STDMETHOD(OperationSupported)(FramebufferAccelerationOperation_T aOperation,
|
---|
217 | BOOL *aSupported);
|
---|
218 | STDMETHOD(VideoModeSupported) (ULONG aWidth, ULONG aHeight, ULONG aBPP,
|
---|
219 | BOOL *aSupported);
|
---|
220 | STDMETHOD(SolidFill) (ULONG aX, ULONG aY, ULONG aWidth, ULONG aHeight,
|
---|
221 | ULONG aColor, BOOL *aHandled);
|
---|
222 | STDMETHOD(CopyScreenBits) (ULONG aXDst, ULONG aYDst, ULONG aXSrc, ULONG aYSrc,
|
---|
223 | ULONG aWidth, ULONG aHeight, BOOL *aHandled);
|
---|
224 |
|
---|
225 | STDMETHOD(GetVisibleRegion)(BYTE *aRectangles, ULONG aCount, ULONG *aCountCopied);
|
---|
226 | STDMETHOD(SetVisibleRegion)(BYTE *aRectangles, ULONG aCount);
|
---|
227 |
|
---|
228 | ulong width() { return mWdt; }
|
---|
229 | ulong height() { return mHgt; }
|
---|
230 |
|
---|
231 | virtual ulong pixelFormat()
|
---|
232 | {
|
---|
233 | return FramebufferPixelFormat_FOURCC_RGB;
|
---|
234 | }
|
---|
235 |
|
---|
236 | virtual bool usesGuestVRAM()
|
---|
237 | {
|
---|
238 | return false;
|
---|
239 | }
|
---|
240 |
|
---|
241 | void lock() { mMutex->lock(); }
|
---|
242 | void unlock() { mMutex->unlock(); }
|
---|
243 |
|
---|
244 | virtual uchar *address() = 0;
|
---|
245 | virtual ulong bitsPerPixel() = 0;
|
---|
246 | virtual ulong bytesPerLine() = 0;
|
---|
247 |
|
---|
248 | /**
|
---|
249 | * Called on the GUI thread (from VBoxConsoleView) when some part of the
|
---|
250 | * VM display viewport needs to be repainted on the host screen.
|
---|
251 | */
|
---|
252 | virtual void paintEvent (QPaintEvent *pe) = 0;
|
---|
253 |
|
---|
254 | /**
|
---|
255 | * Called on the GUI thread (from VBoxConsoleView) after it gets a
|
---|
256 | * VBoxResizeEvent posted from the RequestResize() method implementation.
|
---|
257 | */
|
---|
258 | virtual void resizeEvent (VBoxResizeEvent *re)
|
---|
259 | {
|
---|
260 | mWdt = re->width();
|
---|
261 | mHgt = re->height();
|
---|
262 | }
|
---|
263 |
|
---|
264 | /**
|
---|
265 | * Called on the GUI thread (from VBoxConsoleView) when the VM console
|
---|
266 | * window is moved.
|
---|
267 | */
|
---|
268 | virtual void moveEvent (QMoveEvent * /*me*/ ) {}
|
---|
269 |
|
---|
270 | protected:
|
---|
271 |
|
---|
272 | VBoxConsoleView *mView;
|
---|
273 | QMutex *mMutex;
|
---|
274 | int mWdt;
|
---|
275 | int mHgt;
|
---|
276 |
|
---|
277 | #if defined (Q_OS_WIN32)
|
---|
278 | private:
|
---|
279 | long refcnt;
|
---|
280 | #endif
|
---|
281 | };
|
---|
282 |
|
---|
283 | /////////////////////////////////////////////////////////////////////////////
|
---|
284 |
|
---|
285 | #if defined (VBOX_GUI_USE_QIMAGE)
|
---|
286 |
|
---|
287 | class VBoxQImageFrameBuffer : public VBoxFrameBuffer
|
---|
288 | {
|
---|
289 | public:
|
---|
290 |
|
---|
291 | VBoxQImageFrameBuffer (VBoxConsoleView *aView);
|
---|
292 |
|
---|
293 | STDMETHOD(NotifyUpdate) (ULONG aX, ULONG aY,
|
---|
294 | ULONG aW, ULONG aH,
|
---|
295 | BOOL *aFinished);
|
---|
296 |
|
---|
297 | ulong pixelFormat() { return mPixelFormat; }
|
---|
298 | bool usesGuestVRAM() { return mUsesGuestVRAM; }
|
---|
299 |
|
---|
300 | uchar *address() { return mImg.bits(); }
|
---|
301 | ulong bitsPerPixel() { return mImg.depth(); }
|
---|
302 | ulong bytesPerLine() { return mImg.bytesPerLine(); }
|
---|
303 |
|
---|
304 | void paintEvent (QPaintEvent *pe);
|
---|
305 | void resizeEvent (VBoxResizeEvent *re);
|
---|
306 |
|
---|
307 | private:
|
---|
308 |
|
---|
309 | QPixmap mPM;
|
---|
310 | QImage mImg;
|
---|
311 | ulong mPixelFormat;
|
---|
312 | bool mUsesGuestVRAM;
|
---|
313 | };
|
---|
314 |
|
---|
315 | #endif
|
---|
316 |
|
---|
317 | /////////////////////////////////////////////////////////////////////////////
|
---|
318 |
|
---|
319 | #if defined (VBOX_GUI_USE_SDL)
|
---|
320 |
|
---|
321 | class VBoxSDLFrameBuffer : public VBoxFrameBuffer
|
---|
322 | {
|
---|
323 | public:
|
---|
324 |
|
---|
325 | VBoxSDLFrameBuffer (VBoxConsoleView *aView);
|
---|
326 | virtual ~VBoxSDLFrameBuffer();
|
---|
327 |
|
---|
328 | STDMETHOD(NotifyUpdate) (ULONG aX, ULONG aY,
|
---|
329 | ULONG aW, ULONG aH,
|
---|
330 | BOOL *aFinished);
|
---|
331 |
|
---|
332 | uchar *address()
|
---|
333 | {
|
---|
334 | SDL_Surface *surf = mSurfVRAM ? mSurfVRAM : mScreen;
|
---|
335 | return surf ? (uchar *) (uintptr_t) surf->pixels : 0;
|
---|
336 | }
|
---|
337 |
|
---|
338 | ulong bitsPerPixel()
|
---|
339 | {
|
---|
340 | SDL_Surface *surf = mSurfVRAM ? mSurfVRAM : mScreen;
|
---|
341 | return surf ? surf->format->BitsPerPixel : 0;
|
---|
342 | }
|
---|
343 |
|
---|
344 | ulong bytesPerLine()
|
---|
345 | {
|
---|
346 | SDL_Surface *surf = mSurfVRAM ? mSurfVRAM : mScreen;
|
---|
347 | return surf ? surf->pitch : 0;
|
---|
348 | }
|
---|
349 |
|
---|
350 | ulong pixelFormat()
|
---|
351 | {
|
---|
352 | return mPixelFormat;
|
---|
353 | }
|
---|
354 |
|
---|
355 | bool usesGuestVRAM()
|
---|
356 | {
|
---|
357 | return mSurfVRAM != NULL;
|
---|
358 | }
|
---|
359 |
|
---|
360 | void paintEvent (QPaintEvent *pe);
|
---|
361 | void resizeEvent (VBoxResizeEvent *re);
|
---|
362 |
|
---|
363 | private:
|
---|
364 |
|
---|
365 | SDL_Surface *mScreen;
|
---|
366 | SDL_Surface *mSurfVRAM;
|
---|
367 |
|
---|
368 | ulong mPixelFormat;
|
---|
369 | };
|
---|
370 |
|
---|
371 | #endif
|
---|
372 |
|
---|
373 | /////////////////////////////////////////////////////////////////////////////
|
---|
374 |
|
---|
375 | #if defined (VBOX_GUI_USE_DDRAW)
|
---|
376 |
|
---|
377 | class VBoxDDRAWFrameBuffer : public VBoxFrameBuffer
|
---|
378 | {
|
---|
379 | public:
|
---|
380 |
|
---|
381 | VBoxDDRAWFrameBuffer (VBoxConsoleView *aView);
|
---|
382 | virtual ~VBoxDDRAWFrameBuffer();
|
---|
383 |
|
---|
384 | STDMETHOD(NotifyUpdate) (ULONG aX, ULONG aY,
|
---|
385 | ULONG aW, ULONG aH,
|
---|
386 | BOOL *aFinished);
|
---|
387 |
|
---|
388 | uchar *address() { return (uchar *) mSurfaceDesc.lpSurface; }
|
---|
389 | ulong bitsPerPixel() { return mSurfaceDesc.ddpfPixelFormat.dwRGBBitCount; }
|
---|
390 | ulong bytesPerLine() { return (ulong) mSurfaceDesc.lPitch; }
|
---|
391 |
|
---|
392 | ulong pixelFormat() { return mPixelFormat; };
|
---|
393 |
|
---|
394 | bool usesGuestVRAM() { return mUsesGuestVRAM; }
|
---|
395 |
|
---|
396 | void paintEvent (QPaintEvent *pe);
|
---|
397 | void resizeEvent (VBoxResizeEvent *re);
|
---|
398 | void moveEvent (QMoveEvent *me);
|
---|
399 |
|
---|
400 | private:
|
---|
401 |
|
---|
402 | void releaseObjects();
|
---|
403 |
|
---|
404 | bool createSurface (ULONG aPixelFormat, uchar *pvVRAM,
|
---|
405 | ULONG aBitsPerPixel, ULONG aBytesPerLine,
|
---|
406 | ULONG aWidth, ULONG aHeight);
|
---|
407 | void deleteSurface();
|
---|
408 | void drawRect (ULONG x, ULONG y, ULONG w, ULONG h);
|
---|
409 | void getWindowPosition (void);
|
---|
410 |
|
---|
411 | LPDIRECTDRAW7 mDDRAW;
|
---|
412 | LPDIRECTDRAWCLIPPER mClipper;
|
---|
413 | LPDIRECTDRAWSURFACE7 mSurface;
|
---|
414 | DDSURFACEDESC2 mSurfaceDesc;
|
---|
415 | LPDIRECTDRAWSURFACE7 mPrimarySurface;
|
---|
416 |
|
---|
417 | ulong mPixelFormat;
|
---|
418 |
|
---|
419 | bool mUsesGuestVRAM;
|
---|
420 |
|
---|
421 | int mWndX;
|
---|
422 | int mWndY;
|
---|
423 |
|
---|
424 | bool mSynchronousUpdates;
|
---|
425 | };
|
---|
426 |
|
---|
427 | #endif
|
---|
428 |
|
---|
429 | /////////////////////////////////////////////////////////////////////////////
|
---|
430 |
|
---|
431 | #if defined (Q_WS_MAC) && defined (VBOX_GUI_USE_QUARTZ2D)
|
---|
432 |
|
---|
433 | #include <Carbon/Carbon.h>
|
---|
434 |
|
---|
435 | class VBoxQuartz2DFrameBuffer : public VBoxFrameBuffer
|
---|
436 | {
|
---|
437 | public:
|
---|
438 |
|
---|
439 | VBoxQuartz2DFrameBuffer (VBoxConsoleView *aView);
|
---|
440 | virtual ~VBoxQuartz2DFrameBuffer ();
|
---|
441 |
|
---|
442 | STDMETHOD (NotifyUpdate) (ULONG aX, ULONG aY,
|
---|
443 | ULONG aW, ULONG aH,
|
---|
444 | BOOL *aFinished);
|
---|
445 | STDMETHOD (SetVisibleRegion) (BYTE *aRectangles, ULONG aCount);
|
---|
446 |
|
---|
447 | uchar *address() { return mDataAddress; }
|
---|
448 | ulong bitsPerPixel() { return CGImageGetBitsPerPixel (mImage); }
|
---|
449 | ulong bytesPerLine() { return CGImageGetBytesPerRow (mImage); }
|
---|
450 | ulong pixelFormat() { return mPixelFormat; };
|
---|
451 | bool usesGuestVRAM() { return mBitmapData == NULL; }
|
---|
452 |
|
---|
453 | const CGImageRef imageRef() const { return mImage; }
|
---|
454 |
|
---|
455 | void paintEvent (QPaintEvent *pe);
|
---|
456 | void resizeEvent (VBoxResizeEvent *re);
|
---|
457 |
|
---|
458 | private:
|
---|
459 |
|
---|
460 | void clean();
|
---|
461 |
|
---|
462 | uchar *mDataAddress;
|
---|
463 | void *mBitmapData;
|
---|
464 | ulong mPixelFormat;
|
---|
465 | CGImageRef mImage;
|
---|
466 | typedef struct
|
---|
467 | {
|
---|
468 | /** The size of this structure expressed in rcts entries. */
|
---|
469 | ULONG allocated;
|
---|
470 | /** The number of entries in the rcts array. */
|
---|
471 | ULONG used;
|
---|
472 | /** Variable sized array of the rectangle that makes up the region. */
|
---|
473 | CGRect rcts[1];
|
---|
474 | } RegionRects;
|
---|
475 | /** The current valid region, all access is by atomic cmpxchg or atomic xchg.
|
---|
476 | *
|
---|
477 | * The protocol for updating and using this has to take into account that
|
---|
478 | * the producer (SetVisibleRegion) and consumer (paintEvent) are running
|
---|
479 | * on different threads. Therefore the producer will create a new RegionRects
|
---|
480 | * structure before atomically replace the existing one. While the consumer
|
---|
481 | * will read the value by atomically replace it by NULL, and then when its
|
---|
482 | * done try restore it by cmpxchg. If the producer has already put a new
|
---|
483 | * region there, it will be discarded (see mRegionUnused).
|
---|
484 | */
|
---|
485 | RegionRects volatile *mRegion;
|
---|
486 | /** For keeping the unused region and thus avoid some RTMemAlloc/RTMemFree calls.
|
---|
487 | * This is operated with atomic cmpxchg and atomic xchg. */
|
---|
488 | RegionRects volatile *mRegionUnused;
|
---|
489 | };
|
---|
490 |
|
---|
491 | #endif
|
---|
492 |
|
---|
493 | #endif // !__VBoxFrameBuffer_h__
|
---|