Device Profile Proposal: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
 
(Also belongs to Devices.)
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
==Device Profile==
[[Category:QtEcosystemTeamTasklist]]
[[Category:Devices]]
== 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.
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===
=== Configure option ===


We propose to introduce ‘’‘-device’‘’ and ‘’‘-device-option <span class="caps">KEY</span>=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.
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:<br />
Example:
 
<code>
===Platform Extensions===
./configure -device broadcom/linux-mipsel-97425-gcc -device-option BRCM_ROCKFORD_PATH=/opt/bcm/rockford
</code>


=== 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
# qplatformdefs.h or qmake.conf adds the define QT_DIRECTFB_HAS_PLATFORM_CODE
# qplatformdefs.h or qmake.conf adds the define QT_DIRECTFB_HAS_PLATFORM_CODE
# The platform plugin initializes it’s hooks as so:<br />
# The platform plugin initializes it's hooks as so:
# platform plugin calls hooks, checking for null<br />
<code>
# qmake.conf of the device spec has <span class="caps">DIRECTFB</span>_PLATFORM_SOURCES, <span class="caps">DIRECTFB</span>_PLATFORM_LIBS etc.
DirectFBPlatformHooks hooks = { 0 };
# platformplugin.pro can do <span class="caps">LIBS</span> += $DIRECTFB_PLATFORM_LIBS
#ifdef QT_DIRECTFB_HAS_PLATFORM_CODE
extern DirectFBPlatformHooks platform_hook;
hooks = platform_hook;
#endif
</code>


===Discussion===
# platform plugin calls hooks, checking for null
<code>
if (hook->init)
hook->init(). // avoids any ifdef usage
</code>
# qmake.conf of the device spec has DIRECTFB_PLATFORM_SOURCES, DIRECTFB_PLATFORM_LIBS etc.
# platformplugin.pro can do LIBS += $DIRECTFB_PLATFORM_LIBS


====Configure====
=== 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.
* 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.
Line 28: Line 44:
* What about Fedora/Ubuntu that would like to have exactly ''one'' Qt? Will we end up with runtime detection?
* What about Fedora/Ubuntu that would like to have exactly ''one'' Qt? Will we end up with runtime detection?


====Platform Hooks====
==== Platform Hooks ====


* Easily make out what the hooks are looking at the struct
* Easily make out what the hooks are looking at the struct
* Platform code can bring it’s own libs through <span class="caps">DIRECTFB</span>_PLATFORM_LIBS
* 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
* 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
* Since the hooks can be switched at runtime, we can a device profile supporting mutiple device flavors


===not merged parts===
=== not merged parts ===


# -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.
# -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.
Line 41: Line 57:


configure implementation strategy
configure implementation strategy
* Put device variables, toolchain path, rootfs path, pkg-config paths (can be auto derived?) in device.pri.
* 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.
* 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
* 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)
* [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==
== Counter Proposals ==


===Subclass plugins===
=== Subclass plugins ===


* It might be cleaner to subclass the plugin.
* It might be cleaner to subclass the plugin.
Line 57: Line 72:
** somehow inject the new class name into the main.cpp
** somehow inject the new class name into the main.cpp
* In the case of eglfs this would include:
* In the case of eglfs this would include:
** subclass *Screen to add init code
** subclass Screen to add init code
** subclass *Integration to create the new screen class
** subclass Integration to create the new screen class
** somehow inject thew new plugin string into the .json file
** somehow inject thew new plugin string into the .json file
** somehow inject the new class name into the main.cpp
** 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.
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.
===Categories:===
* [[:Category:QtEcosystemTeamTasklist|QtEcosystemTeamTasklist]]

Latest revision as of 14:29, 15 September 2016

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.