Qt wiki will be updated on October 12th 2023 starting at 11:30 AM (EEST) and the maintenance will last around 2-3 hours. During the maintenance the site will be unavailable.

Device Profile Proposal: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
(Add "cleanup" tag)
(Convert ExpressionEngine section headers)
Line 16: Line 16:
</code>
</code>


h3. Platform Extensions  
=== Platform Extensions ===
 
# Platform integration plugins will have a hooks struct (struct of function pointers to init, destroy, etc)
# Platform integration plugins will have a hooks struct (struct of function pointers to init, destroy, etc)
# Each platform exposes a variable named platform_hook that is the above struct
# Each platform exposes a variable named platform_hook that is the above struct

Revision as of 15:50, 5 March 2015

This article may require cleanup to meet the Qt Wiki's quality standards. Reason: Auto-imported from ExpressionEngine.
Please improve this article if you can. Remove the {{cleanup}} tag and add this page to Updated pages list after it's clean.

Device Profile

Modern devices require platform/device init code for OpenGL and possible other features in the future. We have gained some experience with device profile in Qtopia and would like to propose the following development path.

Configure option

We propose to introduce -device and -device-option KEY=VALUE configure options. The first will select a mkspec and the second will add variables that can be used by the mkspec. Right now we don't plan to inject configure options through the device profile.

Example:

./configure -device broadcom/linux-mipsel-97425-gcc -device-option BRCM_ROCKFORD_PATH=/opt/bcm/rockford

Platform Extensions

  1. Platform integration plugins will have a hooks struct (struct of function pointers to init, destroy, etc)
  2. Each platform exposes a variable named platform_hook that is the above struct
  3. qplatformdefs.h or qmake.conf adds the define QT_DIRECTFB_HAS_PLATFORM_CODE
  4. The platform plugin initializes it's hooks as so:
DirectFBPlatformHooks hooks = { 0 };
#ifdef QT_DIRECTFB_HAS_PLATFORM_CODE
extern DirectFBPlatformHooks platform_hook;
hooks = platform_hook;
#endif
  1. platform plugin calls hooks, checking for null
if (hook->init)
 hook->init(). // avoids any ifdef usage
  1. qmake.conf of the device spec has DIRECTFB_PLATFORM_SOURCES, DIRECTFB_PLATFORM_LIBS etc.
  2. platformplugin.pro can do LIBS += $DIRECTFB_PLATFORM_LIBS

Discussion

Configure

  • The mkspec needs to start with linux as the dirname will end up as a scope in QMake and given the future of qmake it might not make sense to provide an variable inside the mkspecs to replace the name/scope.
  • How to keep a consistent interface between different implementations? Do we ever need to keep state? Where would we keep it? Influence strategy?
  • Alternatively keep all this code in the main file and only have a define that activates the code?
  • What about Fedora/Ubuntu that would like to have exactly one Qt? Will we end up with runtime detection?

Platform Hooks

  • Easily make out what the hooks are looking at the struct
  • Platform code can bring it's own libs through DIRECTFB_PLATFORM_LIBS
  • Keep usage QT_DIRECTFB_HAS_PLATFORM_CODE to one place in the platform plugin
  • Since the hooks can be switched at runtime, we can a device profile supporting mutiple device flavors

not merged parts

  1. -device argument to configure will mandate 3 other flags -sysroot, -toolchain and -pkg-config-path. Maybe we can require pkg-config support for the whole -device stuff. And automatically setup pkg-config-sysroot-dir.
  2. rpath-link vs -L needs to be explored. Devices like the pi have some ilbs in $SYSROOT/opt/vc

configure implementation strategy

  • Put device variables, toolchain path, rootfs path, pkg-config paths (can be auto derived?) in device.pri.

' One can use device specific variables to influence the variable values. For example, ubuntu and fedora might have different paths.

  • include(../device.pri) or load(devicespec) in qmake.conf
  • [not sure] Add config.sh that is sourced inside configure- use this to disable board specific stuff that are known not to work. (disable webkit2 maybe)

Counter Proposals

Subclass plugins

  • It might be cleaner to subclass the plugin.
  • In the case of directfb this would include:
    • subclass DirectFBEGLIntegration and implement platformInit
    • somehow inject the new plugin string into the .json file
    • somehow inject the new class name into the main.cpp
  • In the case of eglfs this would include:
    • subclass Screen to add init code

* subclass Integration to create the new screen class * somehow inject thew new plugin string into the .json file

    • somehow inject the new class name into the main.cpp

Right now I think it will be a major pain in terms of buildsystem to somehow make this work, and with eglfs it requires to subclass a class just to create another one.