Skip to contentSkip to conversation

Experimental Cocoa Video Driver

PATCH In review Pierre d'Herbemont 2 participants 3 messages Feb 27, 2005 – Mar 2, 2005 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Experimental Cocoa Video Driver

Hi!

Here is a early draft of a cocoa video driver for qemu, strongly based on libsdl. I don't know if I'll have time to finish it, so I am sending it to the qemu-devel.

I think it might be interesting for QemuX (or other Mac OS X frontend): the patch shows that the GUI can be run within Qemu process, that means that you can use qemu functions, think vm_stop or vm_start, directly from the GUI. Moreover it means also only one icon in the dock and one menu bar for Qemu,

To enable the cocoa driver, just use the --enable-cocoa option in configure. The driver is still not completed as it should, no full screen mode, no mouse event, and partial keyboard event, but that shouldn't be to difficult to add though.

Pierre.

? .DS_Store
? .gdb_history
? cocoa.m
? linux-test
Index: Makefile.target
===================================================================
RCS file: /cvsroot/qemu/qemu/Makefile.target,v
retrieving revision 1.58

Makefile.target +8 -1
diff -u -r1.58 Makefile.target
@@ -346,6 +346,10 @@
 ifdef CONFIG_SDL
 VL_OBJS+=sdl.o
 endif
+ifdef CONFIG_COCOA
+VL_OBJS+=cocoa.o
+COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa
+endif
 ifdef CONFIG_SLIRP
 DEFINES+=-I$(SRC_PATH)/slirp
 SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
@@ -373,7 +377,10 @@
 endif
 
 $(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
-	$(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(VL_LIBS)
+	$(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS)
+
+cocoa.o: cocoa.m
+	$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
 
 sdl.o: sdl.c keymaps.c sdl_keysym.h
 	$(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<

Index: configure
===================================================================
RCS file: /cvsroot/qemu/qemu/configure,v
retrieving revision 1.56

configure +9 -0
diff -u -r1.56 configure
@@ -83,6 +83,7 @@
 linux="no"
 kqemu="no"
 kernel_path=""
+cocoa="no"
 
 # OS specific
 targetos=`uname -s`
@@ -178,6 +179,8 @@
   ;; 
   --kernel-path=*) kernel_path=${opt#--kernel-path=}
   ;; 
+  --enable-cocoa) cocoa="yes" ; sdl="no"
+  ;; 
   esac
 done
 
@@ -403,6 +406,7 @@
 echo "target list       $target_list"
 echo "gprof enabled     $gprof"
 echo "static build      $static"
+echo "Cocoa support     $cocoa"
 echo "SDL support       $sdl"
 echo "SDL static link   $sdl_static"
 echo "mingw32 support   $mingw32"
@@ -676,6 +680,11 @@
     fi
 fi
 
+if test "$cocoa" = "yes" ; then
+    echo "#define CONFIG_COCOA 1" >> $config_h
+    echo "CONFIG_COCOA=yes" >> $config_mak
+fi
+
 done # for target in $targets
 
 # build tree in object directory if source path is different from current one

Index: vl.c
===================================================================
RCS file: /cvsroot/qemu/qemu/vl.c,v
retrieving revision 1.120

vl.c +10 -1
diff -u -r1.120 vl.c
@@ -72,6 +72,13 @@
 #endif
 #endif /* CONFIG_SDL */
 
+#ifdef CONFIG_COCOA
+#ifdef main
+# undef main
+#endif
+#define main qemu_main
+#endif /* CONFIG_COCOA */
+
 #include "disas.h"
 
 #include "exec-all.h"
@@ -3550,8 +3557,10 @@
     if (nographic) {
         dumb_display_init(ds);
     } else {
-#ifdef CONFIG_SDL
+#if defined(CONFIG_SDL)
         sdl_display_init(ds, full_screen);
+#elif defined(CONFIG_COCOA)
+        cocoa_display_init(ds, full_screen);
 #else
         dumb_display_init(ds);
 #endif
cocoa.m new file +607 -0

607 lines not on this page · raw message

#1 lore raw

I'm having trouble compiling QEMU with the cocoa video driver on my iBook. I'm running OS X 10.3.8 on a 700MHz iBook G3 w/ 640Mb or RAM and XTools 1.5. After running "./configure --prefix=/sw --enable-cocoa", compilation runs smoothly until here:

gcc -Wall -O2 -g -fno-strict-aliasing -D__powerpc__ -I. -I/Users/stealthdave/Source/qemu/qemu/target-ppc -I/Users/stealthdave/Source/qemu/qemu -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -I/Users/stealthdave/Source/qemu/qemu/slirp -c -o cocoa.o /Users/stealthdave/Source/qemu/qemu/cocoa.m In file included from /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/DriverServices.h:32,
from
/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/CarbonCore.h:129,
from
/System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:21,
from
/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:20,
from
/System/Library/Frameworks/Foundation.framework/Headers/NSAppleEventDescriptor.h:8,
from
/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:85,
from
/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12,
from /Users/stealthdave/Source/qemu/qemu/cocoa.m:38:
/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/MachineExceptions.h:45: error: parse error before numeric constant /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/MachineExceptions.h:46: error: parse error before numeric constant /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/MachineExceptions.h:49: error: parse error before numeric constant /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/MachineExceptions.h:51: error: parse error before numeric constant /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/MachineExceptions.h:53: error: parse error before numeric constant /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/MachineExceptions.h:54: error: parse error before numeric constant /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/MachineExceptions.h:56: error: parse error before '}' token
make[1]: *** [cocoa.o] Error 1
make: *** [all] Error 1

Am I missing a library or something?

- Dave

Quoted 15 lines · Pierre d'Herbemont

Hi!

Here is a early draft of a cocoa video driver for qemu, strongly based on libsdl. I don't know if I'll have time to finish it, so I am sending it to the qemu-devel.

I think it might be interesting for QemuX (or other Mac OS X frontend): the patch shows that the GUI can be run within Qemu process, that means that you can use qemu functions, think vm_stop or vm_start, directly from the GUI. Moreover it means also only one icon in the dock and one menu bar for Qemu,

To enable the cocoa driver, just use the --enable-cocoa option in configure. The driver is still not completed as it should, no full screen mode, no mouse event, and partial keyboard event, but that shouldn't be to difficult to add though.

Pierre.

<cocoa_drv.diff.txt>_______________________________________________ Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel

#2 lore raw

David,

I checked out qemu's cvs from scratch, and compilation went fine.... for i386-softmmu. So try ./configure --prefix=/sw --enable-cocoa --target-list=i386-softmmu.

I'll try to send a quick fix for that.

Pierre.

Quoted 61 lines · David Still

I'm having trouble compiling QEMU with the cocoa video driver on my iBook. I'm running OS X 10.3.8 on a 700MHz iBook G3 w/ 640Mb or RAM and XTools 1.5. After running "./configure --prefix=/sw --enable-cocoa", compilation runs smoothly until here:

gcc -Wall -O2 -g -fno-strict-aliasing -D__powerpc__ -I.

(quoted diff) +0 -4
-I/Users/stealthdave/Source/qemu/qemu/target-ppc  
-I/Users/stealthdave/Source/qemu/qemu -D_GNU_SOURCE  
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE  
-I/Users/stealthdave/Source/qemu/qemu/slirp -c -o cocoa.o  

/Users/stealthdave/Source/qemu/qemu/cocoa.m
In file included from /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/DriverServices.h:32,
from
/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/CarbonCore.h:129,
from
/System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:21,
from
/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:20,
from
/System/Library/Frameworks/Foundation.framework/Headers/NSAppleEventDescriptor.h:8,
from
/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:85,
from
/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12,
from /Users/stealthdave/Source/qemu/qemu/cocoa.m:38:
/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/MachineExceptions.h:45: error: parse error before numeric constant /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/MachineExceptions.h:46: error: parse error before numeric constant /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/MachineExceptions.h:49: error: parse error before numeric constant /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/MachineExceptions.h:51: error: parse error before numeric constant /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/MachineExceptions.h:53: error: parse error before numeric constant /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/MachineExceptions.h:54: error: parse error before numeric constant /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/MachineExceptions.h:56: error: parse error before '}' token make[1]: *** [cocoa.o] Error 1
make: *** [all] Error 1

Am I missing a library or something?

- Dave

Quoted 8 lines · Pierre d'Herbemont

Hi!

Here is a early draft of a cocoa video driver for qemu, strongly based on libsdl. I don't know if I'll have time to finish it, so I am sending it to the qemu-devel.

I think it might be interesting for QemuX (or other Mac OS X frontend): the patch shows that the GUI can be run within Qemu process, that means that you can use qemu functions, think vm_stop or vm_start, directly from the GUI. Moreover it means also only one icon in the dock and one menu bar for Qemu,

To enable the cocoa driver, just use the --enable-cocoa option in configure. The driver is still not completed as it should, no full screen mode, no mouse event, and partial keyboard event, but that shouldn't be to difficult to add though.

Quoted 7 lines

Pierre.

<cocoa_drv.diff.txt>_______________________________________________ Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel

_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel