MeeGo 1.2 Harmattan Developer Documentation Develop for the Nokia N9

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
QEMU window

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:

  1. In the Tools menu, select Options.
  2. Select Linux Devices and open the MeeGo Qemu Settings tab.
  3. 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.

Supported graphics acceleration in QEMU
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:

  1. 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.
  2. Click Next, then click Update.
  3. During the update, close Qt Creator if you are prompted to. Do not close the Maintain Qt SDK window.
  4. After the components have been downloaded, click Finish.
  5. 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:

  1. In the Tools menu, select Options.
  2. Select Linux Devices > Device Configurations.
  3. In the Configuration field, select QEMU.
  4. Check that the settings are as follows:
    • Device type: Emulator (Qemu)
    • Authentication type: Password
    • Host name: localhost
    • Username: developer
    • Password: <blank>
    Device configuration settings for emulator

Enabling hardware-based graphics acceleration

Prerequisite

  • You have installed the display drivers on your host workstation.

To enable hardware-based graphics acceleration:

In Linux:

  1. In your terminal application, enter the following command:
    echo "export  DGLES2_BACKEND=glx" >> ~/.profile
    
  2. Restart your host workstation.

In Windows:

  1. Start Control Panel.
  2. Go to System > Advanced system settings.
  3. Select the Advanced tab and click Environment Variables.
  4. Under the System variables list, click New....
  5. To add a new system variable:
    1. Set Variable name as DGLES2_BACKEND.
    2. Set Variable value as wgl.
  6. Click OK > OK > OK.
  7. Restart your host workstation.

Starting QEMU

To run your application in QEMU:

  1. Configure your application for the emulator.
  2. Run your application in the emulator.

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.

Key mapping between device and computer keyboard
Device key or functionality Computer key or shortkey
  • Alphabet keys
  • comma (,)
  • Period (.)
  • Space
  • Arrow keys
  • Enter
  • Backspace
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.