* [Qemu-devel] [PATCH] OpenGL for OS X @ 2008-02-01 16:45 Mike Kronenberg 2008-02-05 9:05 ` Alexander Graf 2008-02-16 7:54 ` Mike Kronenberg 0 siblings, 2 replies; 9+ messages in thread From: Mike Kronenberg @ 2008-02-01 16:45 UTC (permalink / raw) To: qemu-devel [-- Attachment #1: Type: text/plain, Size: 21481 bytes --] After a little discussion on the list, I made this patch for cocoa.m, to replace CoreGraphic by OpenGL. It's way faster than CG, but it requires a Mac with OpenGL capable Graphics Card and at least 8mb of VRAM. I think starting with G4 and Highend G3, this requirements are met. features: [new] draws dirty lines of the window as needed, implemented with OpenGL (used the extensions as proposed by Pierre) [new] window can be resized [fix] conditional builds for Leopard, without linking to a specific sdk [fix] lineflicker in fullscreen mode The Question is, where to draw the line - or - if it needs a switch for CG/OpenGL support for cocoa. Please test and comment. Mike [1] http://www.kberg.ch/qemu/091patches/cocoa_m_OpenGL.diff.gz --- /Users/mike/Documents/Qemu091gcc4/qemu/cocoa.m_original.m 2008-01-21 17:11:30.000000000 +0100 +++ /Users/mike/Documents/Qemu091gcc4/qemu/cocoa.m 2008-02-01 17:11:41.000000000 +0100 @@ -22,12 +22,17 @@ * THE SOFTWARE. */ +#include <AvailabilityMacros.h> + #import <Cocoa/Cocoa.h> +#import <OpenGL/gl.h> + #include "qemu-common.h" #include "console.h" #include "sysemu.h" +#define titleBarHeight 21.0 //#define DEBUG @@ -54,6 +59,16 @@ int bitsPerPixel; } QEMUScreen; +typedef struct { + float x; + float y; + float width; + float height; + float dx; + float dy; + float zoom; +} COCOADisplayProperties; + int qemu_main(int argc, char **argv); // main defined in qemu/vl.c NSWindow *normalWindow; id cocoaView; @@ -246,18 +261,19 @@ QemuCocoaView ------------------------------------------------------ */ -@interface QemuCocoaView : NSView +@interface QemuCocoaView : NSOpenGLView { QEMUScreen screen; + COCOADisplayProperties displayProperties; NSWindow *fullScreenWindow; - float cx,cy,cw,ch,cdx,cdy; - CGDataProviderRef dataProviderRef; + GLuint screen_tex; int modifiers_state[256]; BOOL isMouseGrabed; BOOL isFullscreen; BOOL isAbsoluteEnabled; BOOL isTabletEnabled; } +- (void) setContentDimensionsForFrame:(NSRect)rect; - (void) resizeContentToWidth:(int)w height:(int)h displayState: (DisplayState *)ds; - (void) grabMouse; - (void) ungrabMouse; @@ -266,17 +282,16 @@ - (void) setAbsoluteEnabled:(BOOL)tIsAbsoluteEnabled; - (BOOL) isMouseGrabed; - (BOOL) isAbsoluteEnabled; -- (float) cdx; -- (float) cdy; - (QEMUScreen) gscreen; +- (COCOADisplayProperties) displayProperties; @end @implementation QemuCocoaView -- (id)initWithFrame:(NSRect)frameRect +- (id)initWithFrame:(NSRect)frameRect pixelFormat: (NSOpenGLPixelFormat *)format { - COCOA_DEBUG("QemuCocoaView: initWithFrame\n"); + COCOA_DEBUG("QemuCocoaView: initWithFrame:pixelFormat\n"); - self = [super initWithFrame:frameRect]; + self = [super initWithFrame:frameRect pixelFormat:format]; if (self) { screen.bitsPerComponent = 8; @@ -284,6 +299,8 @@ screen.width = frameRect.size.width; screen.height = frameRect.size.height; + displayProperties.zoom = 1.0; + } return self; } @@ -295,110 +312,118 @@ if (screenBuffer) free(screenBuffer); - if (dataProviderRef) - CGDataProviderRelease(dataProviderRef); - [super dealloc]; } - (void) drawRect:(NSRect) rect { - COCOA_DEBUG("QemuCocoaView: drawRect\n"); + COCOA_DEBUG("QemuCocoaView: drawRect: NSRect(%f, %f, %f, %f)\n", rect.origin.x, rect.origin.y, rect.size.width, rect.size.height); if ((int)screenBuffer == -1) return; - // get CoreGraphic context - CGContextRef viewContextRef = [[NSGraphicsContext currentContext] graphicsPort]; - CGContextSetInterpolationQuality (viewContextRef, kCGInterpolationNone); - CGContextSetShouldAntialias (viewContextRef, NO); - - // draw screen bitmap directly to Core Graphics context - if (dataProviderRef) { - CGImageRef imageRef = CGImageCreate( - screen.width, //width - screen.height, //height - screen.bitsPerComponent, //bitsPerComponent - screen.bitsPerPixel, //bitsPerPixel - (screen.width * 4), //bytesPerRow + // remove old texture + if( screen_tex != 0) { + glDeleteTextures(1, &screen_tex); + } + + screen_tex = 1; + float onePixel[2]; + onePixel[0] = 2.0 / displayProperties.width; + onePixel[1] = 2.0 / displayProperties.height; + + //calculate the texure rect + NSRect clipRect; + clipRect = NSMakeRect( + 0.0, // we update the whole width, as QEMU in vga is always updating whole memory pages) + floor((float)screen.height - (rect.origin.y + rect.size.height) / displayProperties.dy), + (float)screen.width, + ceil(rect.size.height / displayProperties.dy)); + int start = (int)clipRect.origin.y * screen.width * 4; + unsigned char *startPointer = screenBuffer; + + //adapt the drawRect to the textureRect + rect = NSMakeRect( + 0.0, // we update the whole width, as QEMU in vga is always updating whole memory pages) + (screen.height - (clipRect.origin.y + clipRect.size.height)) * displayProperties.dy, + displayProperties.width, + clipRect.size.height * displayProperties.dy); + + glEnable(GL_TEXTURE_RECTANGLE_ARB); // enable rectangle textures + + // bind screenBuffer to texture + glPixelStorei(GL_UNPACK_ROW_LENGTH, screen.width); // Sets the appropriate unpacking row length for the bitmap. + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); // Sets the byte-aligned unpacking that's needed for bitmaps that are 3 bytes per pixel. + + glBindTexture (GL_TEXTURE_RECTANGLE_ARB, screen_tex); // Binds the texture name to the texture target. + glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR); // Sets filtering so that it does not use a mipmap, which would be redundant for the texture rectangle extension + + // optimize loading of texture + glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_STORAGE_HINT_APPLE, GL_STORAGE_SHARED_APPLE); // + glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE); // bypass OpenGL framework + glTextureRangeAPPLE(GL_TEXTURE_RECTANGLE_EXT, (int)clipRect.size.height * screen.width * 4, &startPointer[start]); // bypass OpenGL driver + + glTexImage2D( + GL_TEXTURE_RECTANGLE_ARB, + 0, + GL_RGBA, + screen.width, + (int)clipRect.size.height, + 0, #if __LITTLE_ENDIAN__ - CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB), // colorspace for OS X >= 10.4 - kCGImageAlphaNoneSkipLast, + GL_RGBA, + GL_UNSIGNED_BYTE, #else - CGColorSpaceCreateDeviceRGB(), //colorspace for OS X < 10.4 (actually ppc) - kCGImageAlphaNoneSkipFirst, //bitmapInfo -#endif - dataProviderRef, //provider - NULL, //decode - 0, //interpolate - kCGRenderingIntentDefault //intent - ); -// test if host support "CGImageCreateWithImageInRect" at compiletime -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) - if (CGImageCreateWithImageInRect == NULL) { // test if "CGImageCreateWithImageInRect" is supported on host at runtime + GL_BGRA, + GL_UNSIGNED_INT_8_8_8_8_REV, #endif - // compatibility drawing code (draws everything) (OS X < 10.4) - CGContextDrawImage (viewContextRef, CGRectMake(0, 0, [self bounds].size.width, [self bounds].size.height), imageRef); -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) - } else { - // selective drawing code (draws only dirty rectangles) (OS X >= 10.4) - const NSRect *rectList; - int rectCount; - int i; - CGImageRef clipImageRef; - CGRect clipRect; - - [self getRectsBeingDrawn:&rectList count:&rectCount]; - for (i = 0; i < rectCount; i++) { - clipRect.origin.x = rectList[i].origin.x / cdx; - clipRect.origin.y = (float)screen.height - (rectList[i].origin.y + rectList[i].size.height) / cdy; - clipRect.size.width = rectList[i].size.width / cdx; - clipRect.size.height = rectList[i].size.height / cdy; - clipImageRef = CGImageCreateWithImageInRect( - imageRef, - clipRect - ); - CGContextDrawImage (viewContextRef, cgrect(rectList[i]), clipImageRef); - CGImageRelease (clipImageRef); - } - } -#endif - CGImageRelease (imageRef); + &startPointer[start]); + + glBegin(GL_QUADS); + { + glTexCoord2f(0.0f, 0.0f); + glVertex2f(-1.0f, (GLfloat)(onePixel[1] * (rect.origin.y + rect.size.height) - 1.0)); + + glTexCoord2f(0.0f, (GLfloat)clipRect.size.height); + glVertex2f(-1.0f, (GLfloat)(onePixel[1] * rect.origin.y - 1.0)); + + glTexCoord2f((GLfloat)clipRect.size.width, (GLfloat)clipRect.size.height); + glVertex2f(1.0f, (GLfloat)(onePixel[1] * rect.origin.y - 1.0)); + + glTexCoord2f((GLfloat)clipRect.size.width, 0.0f); + glVertex2f(1.0f, (GLfloat)(onePixel[1] * (rect.origin.y + rect.size.height) - 1.0)); } + glEnd(); + + glFlush(); } -- (void) setContentDimensions +- (void) setContentDimensionsForFrame:(NSRect)rect { - COCOA_DEBUG("QemuCocoaView: setContentDimensions\n"); + COCOA_DEBUG("QemuCocoaView: setContentDimensionsForFrame: NSRect(%f, %f, %f, %f)\n", rect.origin.x, rect.origin.y, rect.size.width, rect.size.height); - if (isFullscreen) { - cdx = [[NSScreen mainScreen] frame].size.width / (float)screen.width; - cdy = [[NSScreen mainScreen] frame].size.height / (float)screen.height; - cw = screen.width * cdx; - ch = screen.height * cdy; - cx = ([[NSScreen mainScreen] frame].size.width - cw) / 2.0; - cy = ([[NSScreen mainScreen] frame].size.height - ch) / 2.0; - } else { - cx = 0; - cy = 0; - cw = screen.width; - ch = screen.height; - cdx = 1.0; - cdy = 1.0; - } + displayProperties.dx = rect.size.width / (float)screen.width; + displayProperties.dy = rect.size.height / (float)screen.height; + displayProperties.width = rect.size.width; + displayProperties.height = rect.size.height; + displayProperties.x = 0.0;//([self bounds].size.width - cw) / 2.0; + displayProperties.y = 0.0;//([self bounds].size.height - ch) / 2.0; + + [[self openGLContext] makeCurrentContext]; + glViewport(displayProperties.x, displayProperties.y, displayProperties.width, displayProperties.height); + [self update]; } - (void) resizeContentToWidth:(int)w height:(int)h displayState: (DisplayState *)ds { - COCOA_DEBUG("QemuCocoaView: resizeContent\n"); + COCOA_DEBUG("QemuCocoaView: resizeContentToWidth:%i height:%i\n", w, h); // update screenBuffer - if (dataProviderRef) - CGDataProviderRelease(dataProviderRef); if (screenBuffer) free(screenBuffer); screenBuffer = malloc( w * 4 * h ); + // update display state ds->data = screenBuffer; ds->linesize = (w * 4); ds->depth = 32; @@ -410,21 +435,31 @@ ds->bgr = 0; #endif - dataProviderRef = CGDataProviderCreateWithData(NULL, screenBuffer, w * 4 * h, NULL); + // update screen state + screen.width = w; + screen.height = h; + + NSSize normalWindowSize; + normalWindowSize = NSMakeSize( + (float)w * displayProperties.zoom, + (float)h * displayProperties.zoom + titleBarHeight + ); + + // keep Window in correct aspect ratio + [normalWindow setMaxSize:NSMakeSize(normalWindowSize.width, normalWindowSize.height)]; + [normalWindow setAspectRatio:NSMakeSize(normalWindowSize.width, normalWindowSize.height)]; // update windows if (isFullscreen) { - [[fullScreenWindow contentView] setFrame:[[NSScreen mainScreen] frame]]; - [normalWindow setFrame:NSMakeRect([normalWindow frame].origin.x, [normalWindow frame].origin.y - h + screen.height, w, h + [normalWindow frame].size.height - screen.height) display:NO animate:NO]; + [self setContentDimensionsForFrame:[[NSScreen mainScreen] frame]]; + [normalWindow setFrame:NSMakeRect([normalWindow frame].origin.x, [normalWindow frame].origin.y + [normalWindow frame].size.height - normalWindowSize.height, normalWindowSize.width, normalWindowSize.height) display:NO animate:NO]; } else { if (qemu_name) [normalWindow setTitle:[NSString stringWithFormat:@"QEMU %s", qemu_name]]; - [normalWindow setFrame:NSMakeRect([normalWindow frame].origin.x, [normalWindow frame].origin.y - h + screen.height, w, h + [normalWindow frame].size.height - screen.height) display:YES animate:YES]; + [self setContentDimensionsForFrame:NSMakeRect(0, 0, w * displayProperties.zoom, h * displayProperties.zoom)]; + [self setFrame:NSMakeRect(0, 0, w * displayProperties.zoom, h * displayProperties.zoom)]; + [normalWindow setFrame:NSMakeRect([normalWindow frame].origin.x, [normalWindow frame].origin.y + [normalWindow frame].size.height - normalWindowSize.height, normalWindowSize.width, normalWindowSize.height) display:YES animate:YES]; } - screen.width = w; - screen.height = h; - [self setContentDimensions]; - [self setFrame:NSMakeRect(cx, cy, cw, ch)]; } - (void) toggleFullScreen:(id)sender @@ -434,9 +469,8 @@ if (isFullscreen) { // switch from fullscreen to desktop isFullscreen = FALSE; [self ungrabMouse]; - [self setContentDimensions]; // test if host support "enterFullScreenMode:withOptions" at compiletime -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) +#ifdef AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER if ([NSView respondsToSelector:@selector(exitFullScreenModeWithOptions:)]) { // test if "exitFullScreenModeWithOptions" is supported on host at runtime [self exitFullScreenModeWithOptions:nil]; } else { @@ -445,15 +479,16 @@ [normalWindow setContentView: self]; [normalWindow makeKeyAndOrderFront: self]; [NSMenu setMenuBarVisible:YES]; -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) +#ifdef AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER } #endif + [self setContentDimensionsForFrame:NSMakeRect(0.0, 0.0, screen.width * displayProperties.zoom, screen.height * displayProperties.zoom)]; } else { // switch from desktop to fullscreen isFullscreen = TRUE; [self grabMouse]; - [self setContentDimensions]; + [self setContentDimensionsForFrame:NSMakeRect(0.0, 0.0, [[NSScreen mainScreen] frame].size.width, [[NSScreen mainScreen] frame].size.height)]; // test if host support "enterFullScreenMode:withOptions" at compiletime -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) +#ifdef AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER if ([NSView respondsToSelector:@selector(enterFullScreenMode:withOptions:)]) { // test if "enterFullScreenMode:withOptions" is supported on host at runtime [self enterFullScreenMode:[NSScreen mainScreen] withOptions:[NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:NO], NSFullScreenModeAllScreens, @@ -469,7 +504,7 @@ [fullScreenWindow setHasShadow:NO]; [fullScreenWindow setContentView:self]; [fullScreenWindow makeKeyAndOrderFront:self]; -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) +#ifdef AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER } #endif } @@ -581,7 +616,7 @@ break; case NSMouseMoved: if (isAbsoluteEnabled) { - if (p.x < 0 || p.x > screen.width || p.y < 0 || p.y > screen.height || ![[self window] isKeyWindow]) { + if (p.x < 0 || p.x > (screen.width * displayProperties.zoom) || p.y < 0 || p.y > (screen.height * displayProperties.zoom) || ![[self window] isKeyWindow]) { if (isTabletEnabled) { // if we leave the window, deactivate the tablet [NSCursor unhide]; isTabletEnabled = FALSE; @@ -688,12 +723,42 @@ isMouseGrabed = FALSE; } +- (NSSize)windowWillResize:(NSWindow *)window toSize: (NSSize)proposedFrameSize +{ + COCOA_DEBUG("QemuCocoaView: windowWillResize: toSize: NSSize(%f, %f)\n", proposedFrameSize.width, proposedFrameSize.height); + + // update zoom + displayProperties.zoom = proposedFrameSize.width / (float)screen.width; + + // Update the content to new size before window is resized, if the new size is bigger + if (proposedFrameSize.width > [window frame].size.width || proposedFrameSize.height > [window frame].size.height) { + [self setContentDimensionsForFrame:NSMakeRect(0, 0, proposedFrameSize.width, proposedFrameSize.height - titleBarHeight)]; + [self setFrame:NSMakeRect(displayProperties.x, displayProperties.y, displayProperties.width, displayProperties.height - titleBarHeight)]; + } + + return proposedFrameSize; +} + +- (void)windowDidResize:(NSNotification *)notification +{ + COCOA_DEBUG("QemuCocoaView: windowDidResize\n"); + + // update the content, if the size has changed + if (displayProperties.width != [[self window] frame].size.width || displayProperties.height != [[self window] frame].size.height - titleBarHeight) { + if (isFullscreen) { + [self setContentDimensionsForFrame:NSMakeRect(0, 0, [[self window] frame].size.width, [[self window] frame].size.height)]; + } else { + [self setContentDimensionsForFrame:NSMakeRect(0, 0, [[self window] frame].size.width, [[self window] frame].size.height - titleBarHeight)]; + } + [self setFrame:NSMakeRect(displayProperties.x, displayProperties.y, displayProperties.width, displayProperties.height)]; + } +} + - (void) setAbsoluteEnabled:(BOOL)tIsAbsoluteEnabled {isAbsoluteEnabled = tIsAbsoluteEnabled;} - (BOOL) isMouseGrabed {return isMouseGrabed;} - (BOOL) isAbsoluteEnabled {return isAbsoluteEnabled;} -- (float) cdx {return cdx;} -- (float) cdy {return cdy;} - (QEMUScreen) gscreen {return screen;} +- (COCOADisplayProperties) displayProperties {return displayProperties;} @end @@ -722,7 +787,7 @@ if (self) { // create a view and add it to the window - cocoaView = [[QemuCocoaView alloc] initWithFrame:NSMakeRect(0.0, 0.0, 640.0, 480.0)]; + cocoaView = [[QemuCocoaView alloc] initWithFrame:NSMakeRect(0.0, 0.0, 640.0, 480.0) pixelFormat: [NSOpenGLView defaultPixelFormat]]; if(!cocoaView) { fprintf(stderr, "(cocoa) can't create a view\n"); exit(1); @@ -730,7 +795,7 @@ // create a window normalWindow = [[NSWindow alloc] initWithContentRect: [cocoaView frame] - styleMask:NSTitledWindowMask|NSMiniaturizableWindowMask| NSClosableWindowMask + styleMask:NSTitledWindowMask|NSMiniaturizableWindowMask| NSClosableWindowMask|NSResizableWindowMask backing:NSBackingStoreBuffered defer:NO]; if(!normalWindow) { fprintf(stderr, "(cocoa) can't create window\n"); @@ -740,6 +805,7 @@ [normalWindow setTitle:[NSString stringWithFormat:@"QEMU"]]; [normalWindow setContentView:cocoaView]; [normalWindow makeKeyAndOrderFront:self]; + [normalWindow setDelegate:cocoaView]; } return self; @@ -927,15 +993,12 @@ COCOA_DEBUG("qemu_cocoa: cocoa_update\n"); NSRect rect; - if ([cocoaView cdx] == 1.0) { - rect = NSMakeRect(x, [cocoaView gscreen].height - y - h, w, h); - } else { - rect = NSMakeRect( - x * [cocoaView cdx], - ([cocoaView gscreen].height - y - h) * [cocoaView cdy], - w * [cocoaView cdx], - h * [cocoaView cdy]); - } + rect = NSMakeRect( + x * [cocoaView displayProperties].dx, + ([cocoaView gscreen].height - y - h) * [cocoaView displayProperties].dy, + w * [cocoaView displayProperties].dx, + h * [cocoaView displayProperties].dy); + [cocoaView displayRect:rect]; } --- /Users/mike/Documents/Qemu091gcc4/qemu/configure_original 2008-02-01 09:27:49.000000000 +0100 +++ /Users/mike/Documents/Qemu091gcc4/qemu/configure 2008-02-01 09:33:37.000000000 +0100 @@ -154,7 +154,7 @@ cocoa="yes" coreaudio="yes" OS_CFLAGS="-mdynamic-no-pic" -OS_LDFLAGS="-framework CoreFoundation -framework IOKit" +OS_LDFLAGS="-framework CoreFoundation -framework IOKit -framework OpenGL" ;; SunOS) solaris="yes" --- /Users/mike/Documents/Qemu091gcc4/qemu/Makefile.target_original 2008-02-01 09:38:48.000000000 +0100 +++ /Users/mike/Documents/Qemu091gcc4/qemu/Makefile.target 2008-02-01 09:38:32.000000000 +0100 @@ -525,7 +525,7 @@ VL_OBJS+=gdbstub.o endif ifdef CONFIG_COCOA -COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit +COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit -framework OpenGL ifdef CONFIG_COREAUDIO COCOA_LIBS+=-framework CoreAudio endif [-- Attachment #2: smime.p7s --] [-- Type: application/pkcs7-signature, Size: 2111 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH] OpenGL for OS X 2008-02-01 16:45 [Qemu-devel] [PATCH] OpenGL for OS X Mike Kronenberg @ 2008-02-05 9:05 ` Alexander Graf 2008-02-05 16:06 ` Anthony Liguori 2008-02-16 7:54 ` Mike Kronenberg 1 sibling, 1 reply; 9+ messages in thread From: Alexander Graf @ 2008-02-05 9:05 UTC (permalink / raw) To: qemu-devel On Feb 1, 2008, at 5:45 PM, Mike Kronenberg wrote: > After a little discussion on the list, I made this patch for > cocoa.m, to replace CoreGraphic by OpenGL. Great! Thank you. > It's way faster than CG, but it requires a Mac with OpenGL capable > Graphics Card and at least 8mb of VRAM. > I think starting with G4 and Highend G3, this requirements are met. Maybe I will try if I find some spare time, but as far as I know Apple provides a quite powerful OpenGL emulation. Last time I ran osx on Vesa output, everything worked just fine. > features: > [new] draws dirty lines of the window as needed, implemented with > OpenGL (used the extensions as proposed by Pierre) > [new] window can be resized > [fix] conditional builds for Leopard, without linking to a specific > sdk > [fix] lineflicker in fullscreen mode > > The Question is, where to draw the line - or - if it needs a switch > for CG/OpenGL support for cocoa. As this OpenGL implementation is based on the Apple pass-through extensions, I don't think it'd make a good start for a generic implementation. Additionally I believe SDL is a good choice for the output too, as they implement optimizations for the specific platforms. The only sad part is that I have not seen a 64-bit capable SDL on Mac OS X ;-). > Please test and comment. > > Mike > > [1] http://www.kberg.ch/qemu/091patches/cocoa_m_OpenGL.diff.gz > Apart from this core dump which I received after playing a bit with an ubuntu image, the patch looks fine to me. It's a lot faster than the previous one. Regards, Alex Process: qemu-system-x86_64 [58929] Path: /Users/alex/Documents/business/suse/qemu.patches.mac/ qemu.nonpatched/qemu/x86_64-softmmu/qemu-system-x86_64 Identifier: qemu-system-x86_64 Version: ??? (???) Code Type: X86-64 (Native) Parent Process: bash [1763] Date/Time: 2008-02-05 09:56:07.071 +0100 OS Version: Mac OS X 10.5.1 (9B18) Report Version: 6 Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x00000000239ae600 Crashed Thread: 0 Thread 0 Crashed: 0 libGLImage.dylib 0x00007fff8464e490 void glgConvertTo_32<GLGConverter_ABGR8_ARGB8, (GLGMemory)1>(GLGOperation const*, GLDPixelMode const*) + 96 1 libGLImage.dylib 0x00007fff84627eb3 glgProcessPixelsWithProcessor + 1187 2 ...er.AppleIntelGMA950GLDriver 0x0000000003599adc glrLoadSysTexture + 4188 3 ...er.AppleIntelGMA950GLDriver 0x000000000357f8cc glrLoadCurrentTextures + 556 4 ...er.AppleIntelGMA950GLDriver 0x00000000035b2f0a gldUpdateDispatch + 394 5 GLEngine 0x0000000014cd8fee glBegin_Exec + 302 6 qemu-system-x86_64 0x0000000001089dca -[QemuCocoaView drawRect:] + 506 (cocoa.m:384) 7 com.apple.AppKit 0x00007fff8396f479 -[NSView _drawRect:clip:] + 3618 8 com.apple.AppKit 0x00007fff8396dfeb -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1234 9 com.apple.AppKit 0x00007fff8396e37e -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 2149 10 com.apple.AppKit 0x00007fff8396c7c5 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView :] + 806 11 com.apple.AppKit 0x00007fff8396c06c -[NSThemeFrame _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView :] + 328 12 com.apple.AppKit 0x00007fff839688dc -[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] + 3008 13 com.apple.AppKit 0x00007fff838a63cd -[NSView displayIfNeeded] + 1190 14 com.apple.AppKit 0x00007fff8395b90b -[NSWindow _setFrameCommon:display:stashSize:] + 1615 15 com.apple.AppKit 0x00007fff839ae2e8 _NSMoveHelperTimerCallBack + 1115 16 com.apple.CoreFoundation 0x00007fff821ff5f5 CFRunLoopRunSpecific + 3813 17 com.apple.AppKit 0x00007fff83b0a5c6 -[NSMoveHelper _doAnimation] + 1012 18 com.apple.AppKit 0x00007fff83b86af3 -[NSMoveHelper _resizeWindow:toFrame:display:] + 535 19 com.apple.AppKit 0x00007fff83996c68 -[NSWindow setFrame:display:animate:] + 955 20 qemu-system-x86_64 0x0000000001089979 -[QemuCocoaView resizeContentToWidth:height:displayState:] + 1065 (cocoa.m:463) 21 qemu-system-x86_64 0x0000000001030957 vga_update_display + 2679 (vga.c:1495) 22 qemu-system-x86_64 0x0000000001007e4f gui_update + 15 (vl.c:7173) 23 qemu-system-x86_64 0x0000000001001cc6 qemu_run_timers + 54 (vl.c:1069) 24 qemu-system-x86_64 0x0000000001008b3a main_loop_wait + 650 (vl.c:7445) 25 qemu-system-x86_64 0x0000000001009ee1 qemu_main + 4817 (vl.c:7527) 26 qemu-system-x86_64 0x00000000010879fe - [QemuCocoaAppController startEmulationWithArgc:argv:] + 14 (cocoa.m:855) 27 com.apple.Foundation 0x00007fff810399e0 _nsnote_callback + 112 28 com.apple.CoreFoundation 0x00007fff821e2846 _CFXNotificationPostNotification + 566 29 com.apple.Foundation 0x00007fff81036de6 - [NSNotificationCenter postNotificationName:object:userInfo:] + 102 30 com.apple.AppKit 0x00007fff83930454 -[NSApplication _postDidFinishNotification] + 104 31 com.apple.AppKit 0x00007fff8393037f -[NSApplication _sendFinishLaunchingNotification] + 78 32 com.apple.AppKit 0x00007fff838a6c9d - [NSApplication(NSAppleEventHandling) _handleAEOpen:] + 239 33 com.apple.AppKit 0x00007fff838a6582 - [NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:] + 84 34 com.apple.Foundation 0x00007fff8105dc27 - [NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:] + 375 35 com.apple.Foundation 0x00007fff8105da45 _NSAppleEventManagerGenericHandler + 117 36 com.apple.AE 0x00007fff833d3717 aeDispatchAppleEvent(AEDesc const*, AEDesc*, unsigned int, unsigned char*) + 123 37 com.apple.AE 0x00007fff833c138b dispatchEventAndSendReply(AEDesc const*, AEDesc*) + 41 38 com.apple.AE 0x00007fff833c122d aeProcessAppleEvent + 179 39 com.apple.HIToolbox 0x00007fff81659a77 AEProcessAppleEvent + 34 40 com.apple.AppKit 0x00007fff838a41d2 _DPSNextEvent + 1068 41 com.apple.AppKit 0x00007fff838a39fc -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 136 42 com.apple.AppKit 0x00007fff8389d796 -[NSApplication run] + 455 43 qemu-system-x86_64 0x0000000001088313 main + 1651 (cocoa.m:982) 44 qemu-system-x86_64 0x0000000001001124 start + 52 Thread 1: 0 libSystem.B.dylib 0x00007fff819657de __semwait_signal + 10 1 libGLProgrammability.dylib 0x00007fff824aba7b glvmDoWork + 155 2 libSystem.B.dylib 0x00007fff8198c1e3 _pthread_start + 316 3 libSystem.B.dylib 0x00007fff8198c0a5 thread_start + 13 Thread 0 crashed with X86 Thread State (64-bit): rax: 0x0000000000000280 rbx: 0x0000000000000a00 rcx: 0x0000000000000000 rdx: 0x00000000239ae600 rdi: 0x00007fff5fbf89f0 rsi: 0x0000000023adbf40 rbp: 0x00007fff5fbf8740 rsp: 0x00007fff5fbf8728 r8: 0x00000000239ae600 r9: 0x0000000023adc940 r10: 0x0000000023adbf40 r11: 0x00000000000001e1 r12: 0x0000000000000a00 r13: 0x0000000000000a00 r14: 0x00007fff5fbf87e0 r15: 0x0000000003894338 rip: 0x00007fff8464e490 rfl: 0x0000000000010246 cr2: 0x00000000239ae600 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH] OpenGL for OS X 2008-02-05 9:05 ` Alexander Graf @ 2008-02-05 16:06 ` Anthony Liguori 2008-02-05 16:29 ` Johannes Schindelin 0 siblings, 1 reply; 9+ messages in thread From: Anthony Liguori @ 2008-02-05 16:06 UTC (permalink / raw) To: qemu-devel Alexander Graf wrote: > On Feb 1, 2008, at 5:45 PM, Mike Kronenberg wrote: > >> After a little discussion on the list, I made this patch for cocoa.m, >> to replace CoreGraphic by OpenGL. > > Great! Thank you. > >> It's way faster than CG, but it requires a Mac with OpenGL capable >> Graphics Card and at least 8mb of VRAM. >> I think starting with G4 and Highend G3, this requirements are met. > > Maybe I will try if I find some spare time, but as far as I know Apple > provides a quite powerful OpenGL emulation. Last time I ran osx on > Vesa output, everything worked just fine. > >> features: >> [new] draws dirty lines of the window as needed, implemented with >> OpenGL (used the extensions as proposed by Pierre) >> [new] window can be resized >> [fix] conditional builds for Leopard, without linking to a specific sdk >> [fix] lineflicker in fullscreen mode >> >> The Question is, where to draw the line - or - if it needs a switch >> for CG/OpenGL support for cocoa. > > As this OpenGL implementation is based on the Apple pass-through > extensions, I don't think it'd make a good start for a generic > implementation. Additionally I believe SDL is a good choice for the > output too, as they implement optimizations for the specific > platforms. The only sad part is that I have not seen a 64-bit capable > SDL on Mac OS X ;-). I would really like to use OpenGL on non-Apple platforms. OpenGL gives much better scaling than SDL. Typically, and OpenGL app has very little platform specific code. It would be nice if we could use similar code here. Regards, Anthony Liguori >> Please test and comment. >> >> Mike >> >> [1] http://www.kberg.ch/qemu/091patches/cocoa_m_OpenGL.diff.gz >> > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH] OpenGL for OS X 2008-02-05 16:06 ` Anthony Liguori @ 2008-02-05 16:29 ` Johannes Schindelin 2008-02-05 16:34 ` Anthony Liguori 0 siblings, 1 reply; 9+ messages in thread From: Johannes Schindelin @ 2008-02-05 16:29 UTC (permalink / raw) To: Anthony Liguori; +Cc: qemu-devel Hi, On Tue, 5 Feb 2008, Anthony Liguori wrote: > I would really like to use OpenGL on non-Apple platforms. OpenGL gives > much better scaling than SDL. Typically, and OpenGL app has very little > platform specific code. It would be nice if we could use similar code > here. But SDL runs on many more platforms than those which have OpenGL. So if at all, this should be optional, and not replace SDL. Ciao, Dscho ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH] OpenGL for OS X 2008-02-05 16:29 ` Johannes Schindelin @ 2008-02-05 16:34 ` Anthony Liguori 2008-02-05 16:45 ` Fabrice Bellard 0 siblings, 1 reply; 9+ messages in thread From: Anthony Liguori @ 2008-02-05 16:34 UTC (permalink / raw) To: Johannes Schindelin; +Cc: qemu-devel Johannes Schindelin wrote: > Hi, > > On Tue, 5 Feb 2008, Anthony Liguori wrote: > > >> I would really like to use OpenGL on non-Apple platforms. OpenGL gives >> much better scaling than SDL. Typically, and OpenGL app has very little >> platform specific code. It would be nice if we could use similar code >> here. >> > > But SDL runs on many more platforms than those which have OpenGL. > > So if at all, this should be optional, and not replace SDL. > Absolutely. My thinking was just that if we're already going to have OpenGL code to support OS X (where SDL isn't an option), then we might as well make it so it's usable elsewhere. Regards, Anthony Liguori > Ciao, > Dscho > > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH] OpenGL for OS X 2008-02-05 16:34 ` Anthony Liguori @ 2008-02-05 16:45 ` Fabrice Bellard 2008-02-06 6:00 ` Gwenole Beauchesne 0 siblings, 1 reply; 9+ messages in thread From: Fabrice Bellard @ 2008-02-05 16:45 UTC (permalink / raw) To: qemu-devel Anthony Liguori wrote: > Johannes Schindelin wrote: >> Hi, >> >> On Tue, 5 Feb 2008, Anthony Liguori wrote: >> >> >>> I would really like to use OpenGL on non-Apple platforms. OpenGL >>> gives much better scaling than SDL. Typically, and OpenGL app has >>> very little platform specific code. It would be nice if we could use >>> similar code here. >>> >> >> But SDL runs on many more platforms than those which have OpenGL. >> >> So if at all, this should be optional, and not replace SDL. >> > > Absolutely. My thinking was just that if we're already going to have > OpenGL code to support OS X (where SDL isn't an option), then we might > as well make it so it's usable elsewhere. This is an SDL related issue (i.e. SDL may or may not use OpenGL to display graphics). Fixing SDL for Mac OS X would also be interesting. Regards, Fabrice. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH] OpenGL for OS X 2008-02-05 16:45 ` Fabrice Bellard @ 2008-02-06 6:00 ` Gwenole Beauchesne 2008-02-06 12:39 ` Philip Boulain 0 siblings, 1 reply; 9+ messages in thread From: Gwenole Beauchesne @ 2008-02-06 6:00 UTC (permalink / raw) To: qemu-devel Hi, 2008/2/5, Fabrice Bellard <fabrice@bellard.org>: > This is an SDL related issue (i.e. SDL may or may not use OpenGL to > display graphics). Fixing SDL for Mac OS X would also be interesting. I think SDL trunk (1.3) supports OpenGL rendering more specifically for various platforms. Besides, on my MacBook, fullscreen SDL with a HW surface can indeed perform much better (550 Mpixels/sec) than fullscreen GL (190 Mpixels/sec). With a SW surface, results are equivalent to GL though. In windowed (800x600) mode, SDL performs at 28 Mpixels/sec and GL at 150 Mpixels/sec. So, SDL 1.2 for OSX (CG?) in windowed mode is indeed sub-optimal. I have not tried with SDL trunk yet. You can get my tests as svn co http://svn.beauchesne.info/svn/gwenole/projects/blitter-tests/trunk blitter-tests Note: I am not sure if I am using GL/PBOs correctly though I followed the specs. I mean the tests run e.g. on Linux but not on Windows with the same level of drivers (nvidia 169.xx). In the latter case, the program crashes in glUnmapBuffer()... Regards, Gwenolé. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH] OpenGL for OS X 2008-02-06 6:00 ` Gwenole Beauchesne @ 2008-02-06 12:39 ` Philip Boulain 0 siblings, 0 replies; 9+ messages in thread From: Philip Boulain @ 2008-02-06 12:39 UTC (permalink / raw) To: qemu-devel On 6 Feb 2008, at 06:00, Gwenole Beauchesne wrote: > 2008/2/5, Fabrice Bellard <fabrice@bellard.org>: >> This is an SDL related issue (i.e. SDL may or may not use OpenGL to >> display graphics). Fixing SDL for Mac OS X would also be interesting. > > I think SDL trunk (1.3) supports OpenGL rendering more specifically > for various platforms. > > Besides, on my MacBook, fullscreen SDL with a HW surface can indeed > perform much better (550 Mpixels/sec) than fullscreen GL (190 > Mpixels/sec). With a SW surface, results are equivalent to GL though. > > In windowed (800x600) mode, SDL performs at 28 Mpixels/sec and GL at > 150 Mpixels/sec. So, SDL 1.2 for OSX (CG?) in windowed mode is indeed > sub-optimal. I have not tried with SDL trunk yet. > > You can get my tests as svn co > http://svn.beauchesne.info/svn/gwenole/projects/blitter-tests/trunk > blitter-tests After some more figures? Modern MacBook Pro (ATI Radeon X1600), just ./configure'd and make'd with defaults: WINDOWED X11 (Apple's server, circa OS X 10.4) best: * Testing XShmPutImage() 607 frames in 10.0 secs, 60.53 fps, 47.600 Mpixels/sec SDL (1.2.12 stable release) best: * Testing SDL_Blit() with RGB masks 00ff0000,0000ff00,000000ff 600 frames in 10.0 secs, 59.86 fps, 47.078 Mpixels/sec OpenGL (without pixel buffer objects; with was slower) best: * Testing glTexSubImage2D with target GL_TEXTURE_RECTANGLE_ARB, format GL_BGRA, type GL_UNSIGNED_INT_8_8_8_8_REV 2628 frames in 10.0 secs, 262.67 fps, 206.571 Mpixels/sec FULLSCREEN X11 could only produce a screen-size window; it achieved 28.1 Mp/s for comparison. * Testing SDL_Blit() with RGB masks 00ff0000,0000ff00,000000ff 1379 frames in 10.0 secs, 137.78 fps, 178.558 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_RECTANGLE_ARB, format GL_BGRA, type GL_UNSIGNED_INT_8_8_8_8_REV 1845 frames in 10.0 secs, 184.37 fps, 238.945 Mpixels/sec So, yes, can confirm that stable SDL is currently slooow in windowed mode compared to OGL, and still slower in fullscreen. Interestingly, use of pixel buffer objects made things /slower/ here. I noted very heavy CPU activity for glperf for the GL_TEXTURE_2D, format GL_BGRA, type GL_UNSIGNED_BYTE case, too (also the fastest, RECTANGLE_ARB case, but this may have just been that it was shunting so much more data). Full details below. LionsPhil --- WINDOWED --- # # Running program x11perf # Global test configuration: Per-test duration: 10 seconds Display size: 1024x768, 24 bpp, windowed mode * Testing XPutImage() 361 frames in 10.0 secs, 35.96 fps, 28.279 Mpixels/sec * Testing XShmPutImage() 607 frames in 10.0 secs, 60.53 fps, 47.600 Mpixels/sec # # Running program sdlperf # Test global configuration: Per-test duration: 10 seconds Display size: 1024x768, 32 bpp, windowed mode, SW surface * Testing SDL_Blit() with RGB masks 00ff0000,0000ff00,000000ff 600 frames in 10.0 secs, 59.86 fps, 47.078 Mpixels/sec * Testing SDL_Blit() with RGB masks 000000ff,0000ff00,00ff0000 303 frames in 10.1 secs, 30.11 fps, 23.677 Mpixels/sec # # Running program glperf # OpenGL version : 2.0 ATI-1.4.56 OpenGL vendor : ATI Technologies Inc. OpenGL renderer : ATI Radeon X1600 OpenGL Engine OpenGL extensions: GL_APPLE_client_storage GL_APPLE_texture_range GL_APPLE_packed_pixels GL_EXT_abgr GL_EXT_bgra GL_ARB_shading_language_100 GL_ARB_fragment_program GL_ARB_fragment_shader GL_ARB_pixel_buffer_object GL_EXT_framebuffer_object GL_EXT_texture_rectangle GL_ARB_texture_rectangle GL_ARB_texture_non_power_of_two GL_ARB_imaging GL_SGI_color_matrix Global test configuration: Per-test duration: 10 seconds Display size: 1024x768, 32 bpp, windowed mode Use non-power-of-two textures : yes Use pixel buffer objects : no Use Apple client storage extension : no Use Apple texture range extension : no * Testing glTexSubImage2D with target GL_TEXTURE_2D, format GL_RGB, type GL_UNSIGNED_BYTE 257 frames in 10.0 secs, 25.58 fps, 20.115 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_2D, format GL_RGBA, type GL_UNSIGNED_BYTE 2397 frames in 10.0 secs, 239.56 fps, 188.395 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_2D, format GL_BGRA, type GL_UNSIGNED_BYTE 1034 frames in 10.0 secs, 103.21 fps, 81.171 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_2D, format GL_BGRA, type GL_UNSIGNED_INT_8_8_8_8_REV 2618 frames in 10.0 secs, 261.62 fps, 205.744 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_RECTANGLE_ARB, format GL_RGB, type GL_UNSIGNED_BYTE 259 frames in 10.1 secs, 25.75 fps, 20.251 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_RECTANGLE_ARB, format GL_RGBA, type GL_UNSIGNED_BYTE 2377 frames in 10.0 secs, 237.53 fps, 186.804 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_RECTANGLE_ARB, format GL_BGRA, type GL_UNSIGNED_BYTE 1034 frames in 10.0 secs, 103.22 fps, 81.179 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_RECTANGLE_ARB, format GL_BGRA, type GL_UNSIGNED_INT_8_8_8_8_REV 2628 frames in 10.0 secs, 262.67 fps, 206.571 Mpixels/sec # # Running program glperf --pbo # OpenGL version : 2.0 ATI-1.4.56 OpenGL vendor : ATI Technologies Inc. OpenGL renderer : ATI Radeon X1600 OpenGL Engine OpenGL extensions: GL_APPLE_client_storage GL_APPLE_texture_range GL_APPLE_packed_pixels GL_EXT_abgr GL_EXT_bgra GL_ARB_shading_language_100 GL_ARB_fragment_program GL_ARB_fragment_shader GL_ARB_pixel_buffer_object GL_EXT_framebuffer_object GL_EXT_texture_rectangle GL_ARB_texture_rectangle GL_ARB_texture_non_power_of_two GL_ARB_imaging GL_SGI_color_matrix Global test configuration: Per-test duration: 10 seconds Display size: 1024x768, 32 bpp, windowed mode Use non-power-of-two textures : yes Use pixel buffer objects : yes, copy mode Use Apple client storage extension : no Use Apple texture range extension : no * Testing glTexSubImage2D with target GL_TEXTURE_2D, format GL_RGB, type GL_UNSIGNED_BYTE 250 frames in 10.1 secs, 24.80 fps, 19.507 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_2D, format GL_RGBA, type GL_UNSIGNED_BYTE 1579 frames in 10.0 secs, 157.79 fps, 124.091 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_2D, format GL_BGRA, type GL_UNSIGNED_BYTE 1580 frames in 10.0 secs, 157.83 fps, 124.120 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_2D, format GL_BGRA, type GL_UNSIGNED_INT_8_8_8_8_REV 1580 frames in 10.0 secs, 157.91 fps, 124.182 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_RECTANGLE_ARB, format GL_RGB, type GL_UNSIGNED_BYTE 251 frames in 10.1 secs, 24.95 fps, 19.620 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_RECTANGLE_ARB, format GL_RGBA, type GL_UNSIGNED_BYTE 1579 frames in 10.0 secs, 157.79 fps, 124.091 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_RECTANGLE_ARB, format GL_BGRA, type GL_UNSIGNED_BYTE 1580 frames in 10.0 secs, 157.87 fps, 124.157 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_RECTANGLE_ARB, format GL_BGRA, type GL_UNSIGNED_INT_8_8_8_8_REV 1579 frames in 10.0 secs, 157.79 fps, 124.091 Mpixels/sec # # Running program glperf --persistent-pbo # OpenGL version : 2.0 ATI-1.4.56 OpenGL vendor : ATI Technologies Inc. OpenGL renderer : ATI Radeon X1600 OpenGL Engine OpenGL extensions: GL_APPLE_client_storage GL_APPLE_texture_range GL_APPLE_packed_pixels GL_EXT_abgr GL_EXT_bgra GL_ARB_shading_language_100 GL_ARB_fragment_program GL_ARB_fragment_shader GL_ARB_pixel_buffer_object GL_EXT_framebuffer_object GL_EXT_texture_rectangle GL_ARB_texture_rectangle GL_ARB_texture_non_power_of_two GL_ARB_imaging GL_SGI_color_matrix Global test configuration: Per-test duration: 10 seconds Display size: 1024x768, 32 bpp, windowed mode Use non-power-of-two textures : yes Use pixel buffer objects : yes, persistent mode Use Apple client storage extension : no Use Apple texture range extension : no * Testing glTexSubImage2D with target GL_TEXTURE_2D, format GL_RGB, type GL_UNSIGNED_BYTE 259 frames in 10.1 secs, 25.70 fps, 20.215 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_2D, format GL_RGBA, type GL_UNSIGNED_BYTE 1469 frames in 10.0 secs, 146.78 fps, 115.435 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_2D, format GL_BGRA, type GL_UNSIGNED_BYTE 1522 frames in 10.0 secs, 152.06 fps, 119.587 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_2D, format GL_BGRA, type GL_UNSIGNED_INT_8_8_8_8_REV 1522 frames in 10.0 secs, 152.06 fps, 119.587 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_RECTANGLE_ARB, format GL_RGB, type GL_UNSIGNED_BYTE 260 frames in 10.0 secs, 25.87 fps, 20.348 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_RECTANGLE_ARB, format GL_RGBA, type GL_UNSIGNED_BYTE 1516 frames in 10.0 secs, 151.45 fps, 119.104 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_RECTANGLE_ARB, format GL_BGRA, type GL_UNSIGNED_BYTE 1521 frames in 10.0 secs, 151.96 fps, 119.509 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_RECTANGLE_ARB, format GL_BGRA, type GL_UNSIGNED_INT_8_8_8_8_REV 1521 frames in 10.0 secs, 151.99 fps, 119.533 Mpixels/sec --- FULLSCREEN --- # # Running program x11perf # Global test configuration: Per-test duration: 10 seconds Display size: 1440x900, 24 bpp, fullscreen mode * Testing XPutImage() 219 frames in 10.0 secs, 21.81 fps, 28.261 Mpixels/sec * Testing XShmPutImage() X SHM extension returned an error, disabling 218 frames in 10.1 secs, 21.68 fps, 28.100 Mpixels/sec # # Running program sdlperf # Test global configuration: Per-test duration: 10 seconds Display size: 1440x900, 32 bpp, fullscreen mode, SW surface * Testing SDL_Blit() with RGB masks 00ff0000,0000ff00,000000ff 1379 frames in 10.0 secs, 137.78 fps, 178.558 Mpixels/sec * Testing SDL_Blit() with RGB masks 000000ff,0000ff00,00ff0000 322 frames in 10.1 secs, 32.02 fps, 41.503 Mpixels/sec # # Running program glperf # OpenGL version : 2.0 ATI-1.4.56 OpenGL vendor : ATI Technologies Inc. OpenGL renderer : ATI Radeon X1600 OpenGL Engine OpenGL extensions: GL_APPLE_client_storage GL_APPLE_texture_range GL_APPLE_packed_pixels GL_EXT_abgr GL_EXT_bgra GL_ARB_shading_language_100 GL_ARB_fragment_program GL_ARB_fragment_shader GL_ARB_pixel_buffer_object GL_EXT_framebuffer_object GL_EXT_texture_rectangle GL_ARB_texture_rectangle GL_ARB_texture_non_power_of_two GL_ARB_imaging GL_SGI_color_matrix Global test configuration: Per-test duration: 10 seconds Display size: 1440x900, 32 bpp, fullscreen mode Use non-power-of-two textures : yes Use pixel buffer objects : no Use Apple client storage extension : no Use Apple texture range extension : no * Testing glTexSubImage2D with target GL_TEXTURE_2D, format GL_RGB, type GL_UNSIGNED_BYTE 158 frames in 10.1 secs, 15.60 fps, 20.222 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_2D, format GL_RGBA, type GL_UNSIGNED_BYTE 1412 frames in 10.0 secs, 141.06 fps, 182.812 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_2D, format GL_BGRA, type GL_UNSIGNED_BYTE 669 frames in 10.0 secs, 66.71 fps, 86.460 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_2D, format GL_BGRA, type GL_UNSIGNED_INT_8_8_8_8_REV 1843 frames in 10.0 secs, 184.12 fps, 238.614 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_RECTANGLE_ARB, format GL_RGB, type GL_UNSIGNED_BYTE 159 frames in 10.1 secs, 15.73 fps, 20.390 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_RECTANGLE_ARB, format GL_RGBA, type GL_UNSIGNED_BYTE 1532 frames in 10.0 secs, 153.06 fps, 198.369 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_RECTANGLE_ARB, format GL_BGRA, type GL_UNSIGNED_BYTE 668 frames in 10.0 secs, 66.67 fps, 86.409 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_RECTANGLE_ARB, format GL_BGRA, type GL_UNSIGNED_INT_8_8_8_8_REV 1845 frames in 10.0 secs, 184.37 fps, 238.945 Mpixels/sec # # Running program glperf --pbo # OpenGL version : 2.0 ATI-1.4.56 OpenGL vendor : ATI Technologies Inc. OpenGL renderer : ATI Radeon X1600 OpenGL Engine OpenGL extensions: GL_APPLE_client_storage GL_APPLE_texture_range GL_APPLE_packed_pixels GL_EXT_abgr GL_EXT_bgra GL_ARB_shading_language_100 GL_ARB_fragment_program GL_ARB_fragment_shader GL_ARB_pixel_buffer_object GL_EXT_framebuffer_object GL_EXT_texture_rectangle GL_ARB_texture_rectangle GL_ARB_texture_non_power_of_two GL_ARB_imaging GL_SGI_color_matrix Global test configuration: Per-test duration: 10 seconds Display size: 1440x900, 32 bpp, fullscreen mode Use non-power-of-two textures : yes Use pixel buffer objects : yes, copy mode Use Apple client storage extension : no Use Apple texture range extension : no * Testing glTexSubImage2D with target GL_TEXTURE_2D, format GL_RGB, type GL_UNSIGNED_BYTE 152 frames in 10.1 secs, 15.00 fps, 19.446 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_2D, format GL_RGBA, type GL_UNSIGNED_BYTE 1068 frames in 10.0 secs, 106.68 fps, 138.261 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_2D, format GL_BGRA, type GL_UNSIGNED_BYTE 1071 frames in 10.0 secs, 106.94 fps, 138.594 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_2D, format GL_BGRA, type GL_UNSIGNED_INT_8_8_8_8_REV 1071 frames in 10.0 secs, 106.96 fps, 138.621 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_RECTANGLE_ARB, format GL_RGB, type GL_UNSIGNED_BYTE 152 frames in 10.1 secs, 15.10 fps, 19.566 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_RECTANGLE_ARB, format GL_RGBA, type GL_UNSIGNED_BYTE 1072 frames in 10.0 secs, 107.05 fps, 138.737 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_RECTANGLE_ARB, format GL_BGRA, type GL_UNSIGNED_BYTE 1072 frames in 10.0 secs, 107.10 fps, 138.806 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_RECTANGLE_ARB, format GL_BGRA, type GL_UNSIGNED_INT_8_8_8_8_REV 1072 frames in 10.0 secs, 107.05 fps, 138.737 Mpixels/sec # # Running program glperf --persistent-pbo # OpenGL version : 2.0 ATI-1.4.56 OpenGL vendor : ATI Technologies Inc. OpenGL renderer : ATI Radeon X1600 OpenGL Engine OpenGL extensions: GL_APPLE_client_storage GL_APPLE_texture_range GL_APPLE_packed_pixels GL_EXT_abgr GL_EXT_bgra GL_ARB_shading_language_100 GL_ARB_fragment_program GL_ARB_fragment_shader GL_ARB_pixel_buffer_object GL_EXT_framebuffer_object GL_EXT_texture_rectangle GL_ARB_texture_rectangle GL_ARB_texture_non_power_of_two GL_ARB_imaging GL_SGI_color_matrix Global test configuration: Per-test duration: 10 seconds Display size: 1440x900, 32 bpp, fullscreen mode Use non-power-of-two textures : yes Use pixel buffer objects : yes, persistent mode Use Apple client storage extension : no Use Apple texture range extension : no * Testing glTexSubImage2D with target GL_TEXTURE_2D, format GL_RGB, type GL_UNSIGNED_BYTE 158 frames in 10.1 secs, 15.64 fps, 20.270 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_2D, format GL_RGBA, type GL_UNSIGNED_BYTE 1038 frames in 10.0 secs, 103.63 fps, 134.310 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_2D, format GL_BGRA, type GL_UNSIGNED_BYTE 1038 frames in 10.0 secs, 103.64 fps, 134.323 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_2D, format GL_BGRA, type GL_UNSIGNED_INT_8_8_8_8_REV 1039 frames in 10.0 secs, 103.77 fps, 134.480 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_RECTANGLE_ARB, format GL_RGB, type GL_UNSIGNED_BYTE 158 frames in 10.1 secs, 15.70 fps, 20.349 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_RECTANGLE_ARB, format GL_RGBA, type GL_UNSIGNED_BYTE 1015 frames in 10.0 secs, 101.39 fps, 131.399 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_RECTANGLE_ARB, format GL_BGRA, type GL_UNSIGNED_BYTE 1039 frames in 10.0 secs, 103.74 fps, 134.453 Mpixels/sec * Testing glTexSubImage2D with target GL_TEXTURE_RECTANGLE_ARB, format GL_BGRA, type GL_UNSIGNED_INT_8_8_8_8_REV 1040 frames in 10.0 secs, 103.82 fps, 134.555 Mpixels/sec ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH] OpenGL for OS X 2008-02-01 16:45 [Qemu-devel] [PATCH] OpenGL for OS X Mike Kronenberg 2008-02-05 9:05 ` Alexander Graf @ 2008-02-16 7:54 ` Mike Kronenberg 1 sibling, 0 replies; 9+ messages in thread From: Mike Kronenberg @ 2008-02-16 7:54 UTC (permalink / raw) To: qemu-devel [-- Attachment #1: Type: text/plain, Size: 985 bytes --] On 01.02.2008, at 17:45, Mike Kronenberg wrote: > After a little discussion on the list, I made this patch for > cocoa.m, to replace CoreGraphic by OpenGL. > > It's way faster than CG, but it requires a Mac with OpenGL capable > Graphics Card and at least 8mb of VRAM. > I think starting with G4 and Highend G3, this requirements are met. > > features: > [new] draws dirty lines of the window as needed, implemented with > OpenGL (used the extensions as proposed by Pierre) > [new] window can be resized > [fix] conditional builds for Leopard, without linking to a specific > sdk > [fix] lineflicker in fullscreen mode > > The Question is, where to draw the line - or - if it needs a switch > for CG/OpenGL support for cocoa. > > Please test and comment. > > Mike > > [1] http://www.kberg.ch/qemu/091patches/cocoa_m_OpenGL.diff.gz Just wanted to ask, if this OpenGL patch for cocoa gets applied, else I have to fix two minor issues with the my CoreGraphics for cocoa. Mike [-- Attachment #2: smime.p7s --] [-- Type: application/pkcs7-signature, Size: 2111 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2008-02-16 7:54 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-02-01 16:45 [Qemu-devel] [PATCH] OpenGL for OS X Mike Kronenberg 2008-02-05 9:05 ` Alexander Graf 2008-02-05 16:06 ` Anthony Liguori 2008-02-05 16:29 ` Johannes Schindelin 2008-02-05 16:34 ` Anthony Liguori 2008-02-05 16:45 ` Fabrice Bellard 2008-02-06 6:00 ` Gwenole Beauchesne 2008-02-06 12:39 ` Philip Boulain 2008-02-16 7:54 ` Mike Kronenberg
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).