Using QEMU with Qt SDK
Harmattan emulator (QEMU) overview
QEMU, available as a separate component for the Qt SDK, provides access to an authentic Harmattan system, and emulates the hardware of the Harmattan device. You can run and test your application in an environment similar to that of a device without actually having one. Threre are separate versions of QEMU available for each Harmattan release:
- PR1.0
- PR1.1
- PR1.2
With QEMU, you can test:
- how your application reacts to the user using hardware controls, such as power button, and touch screen
- how your applications look in different orientation modes
The difference between the emulations in Qt Simulator and QEMU is that in Qt Simulator the application is compiled to the host's architecture and when run, it uses the libraries in the host. When you use QEMU, the application is compiled to the target device's architecture and when run, it uses the same libraries as the target device.
QEMU supports both hardware-based OpenGL and software-based graphics acceleration. Software-based graphics acceleration is used by default. When software graphics acceleration is used, this is indicated by the (SoftGL) string at the end of the emulator window title.
To switch between software rendering and hardware acceleration in Qt Creator:
- In the Tools menu, select Options.
- Select Linux Devices and open the MeeGo Qemu Settings tab.
- Select the option that you want to use and click OK.
QEMU performance
The QEMU start-up takes about 90 seconds, but varies according to your host workstation's performance. On a moderately fast workstation, the emulation performance rate of the CPU is approximately 70 per cent of the speed on the actual device. Similarly, the QEMU graphics performance also depends on the performance, the operating system, and graphics drivers of your workstation. Typically, the performance rate is between 35 and 40 per cent with hardware-based graphics acceleration and approximately 20 per cent with software-based graphics acceleration.
Supported hardware-based graphics acceleration in QEMU
The following table presents the display controllers supported by different operating systems.
OS | OS version | Display controller |
---|---|---|
Windows, 32-bit | 7 | NVIDIA Quadro FX 770M |
NVIDIA Quadro FX 580 | ||
Intel Q45 | ||
Windows, 64-bit | 7 | NVIDIA Quadro FX 580 |
Windows, 32-bit | XP | NVIDIA Quadro FX 770M |
Linux, 32-bit | Ubuntu 11.04, Natty Narwhal | NVIDIA 880M |
Linux, 64-bit | Ubuntu 11.04, Natty Narwhal | NVIDIA Quadro NVS 285 |
NVIDIA FX 580 | ||
Mac OS X, 64-bit | 10.6, Snow Leopard | NVIDIA GeForce 8600M GT |
ATI Radeon HD 6750M | ||
Intel HD Graphics 3000 | ||
10.7, Lion | ATI Radeon HD 6750M | |
Intel HD Graphics 3000 |
Updating Qt SDK with QEMU
You must update the Qt SDK with QEMU unless you have already done so in the installing phase. To update the Qt SDK with QEMU:
- Click Help on the Qt Creator top toolbar and select Start Updater. On the Package manager tab, you can find the QEMU from under Qt SDK > Development Tools > Harmattan > Harmattan Emulator.
- Click Next, then click Update.
- During the update, close Qt Creator if you are prompted to. Do not close the Maintain Qt SDK window.
- After the components have been downloaded, click Finish.
- Restart Qt Creator.
The Qt SDK has now been updated with the automatically configured QEMU target.
Checking QEMU configuration
To verify that the QEMU configuration is correct:
- In the Tools menu, select Options.
- Select Linux Devices > Device Configurations.
- In the Configuration field, select QEMU.
- Check that the settings are as follows:
- Device type: Emulator (Qemu)
- Authentication type: Password
- Host name: localhost
- Username: developer
- Password: <blank>
Enabling hardware-based graphics acceleration
Prerequisite
- You have installed the display drivers on your host workstation.
To enable hardware-based graphics acceleration:
In Linux:
- In your terminal application, enter the following command:
-
echo "export DGLES2_BACKEND=glx" >> ~/.profile
-
- Restart your host workstation.
In Windows:
- Start Control Panel.
- Go to System > Advanced system settings.
- Select the Advanced tab and click Environment Variables.
- Under the System variables list, click New....
- To add a new system variable:
- Set Variable name as DGLES2_BACKEND.
- Set Variable value as wgl.
- Click OK > OK > OK.
- Restart your host workstation.
Starting QEMU
To run your application in QEMU:
Note: If you are switching between QEMU versions, for example from QEMU PR1.1 to QEMU PR1.2, the running QEMU version must be closed. There cannot be two different instances running at the same time.
Using QEMU with mouse and keyboard
Root console
- To access the root console of the platform, use the keyboard shortcut Ctrl + Alt + 3.
Note: Keyboard settings in the root console do not emulate the device keyboard. Instead, the normal computer keyboard settings are used.
- To return to the Harmattan GUI from root console, use the keyboard shortcut Ctrl + Alt + 1.
Touch screen
- To emulate touch-screen use, click the desired place on the emulator with the left mouse button.
Emulating device keys with the computer keyboard
The following table summarises how to emulate device keys or functionalities using computer keys.
Device key or functionality | Computer key or shortkey |
---|---|
|
Respective keys on the computer keyboard |
Shift | Shift key |
Ctrl | Ctrl key |
Mode | Alt key |
Power | Esc |
Keypad slider open/close | F1 |
Camera focus | F4 |
Camera take picture | F5
Note: The actual camera functionality is not emulated. |
Volume down | F7 |
Volume up | F8 |
Accelerometer X axis, negative | 1 (in the numeric keypad) |
Accelerometer X axis, positive | 2 (in the numeric keypad) |
Accelerometer Z axis, negative | 4 (in the numeric keypad) |
Accelerometer Z axis, positive | 5 (in the numeric keypad) |
Accelerometer Y axis, negative | 7 (in the numeric keypad) |
Accelerometer Y axis, positive | 8 (in the numeric keypad) |
Note: One push of the accelerometer key turns the acceleration 50%.
Closing QEMU
To close QEMU, click the X at the top right corner of the device emulator view. The emulator reads this as a press of the power button and displays the text "Shutting down" in the emulator window title pane. The emulator closes shortly after this.