Permalink
Browse files

Implement luna-sysmgr portability initiative

*  Add concept of known and unknown devices
*  Remove general reliance on TARGET_DEVICE
*  Add explicit support for hidlib, libnapp, media-api, nyx and affinity
*  Change default configuration for unknown device to exclude unsupported libraries
*  Clean up names for DEFINES for HAS_LUNA_PREFS and HAS_QPA

Open-webOS-DCO-1.0-Signed-off-by: Roger Stringer <roger.stringer@palm.com>

Change-Id: I476638f29a287cf1e352fd4a57813a44819835c3
  • Loading branch information...
1 parent 55ddfd8 commit 60d9a2a41ad9b30c98d5be9a0fee6dde92357d58 @RS102839 RS102839 committed Oct 11, 2012
@@ -238,7 +238,7 @@ Example response for a succesful call:
]
}
\endcode
-/**
+ *
* Called by the backup service for all four of our callback functions: preBackup,
* postBackup, preRestore, postRestore.
*/
@@ -48,7 +48,7 @@ class FlickGesture : public QGesture
friend class FlickGestureRecognizer;
-#if defined(HAVE_QPA)
+#if defined(HAS_QPA)
friend class QPAHiddTpHandler;
#else
friend class QWSHiddTpHandlerPrivate;
View
@@ -25,7 +25,7 @@
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
-#include <string.h>
+#include <string.h>
#include <linux/fb.h>
#include <linux/kd.h>
#include <linux/input.h>
@@ -60,8 +60,10 @@
#include "Logging.h"
#include "SystemUiController.h"
-#if defined(TARGET_DEVICE)
+#if defined(HAS_HIDLIB)
#include "HidLib.h"
+// TODO: these should come from hidd headers
+#define MAX_HIDD_EVENTS 100
#endif
#define HOSTARM_LOG "HostArm"
@@ -70,17 +72,16 @@
#define FBIO_WAITFORVSYNC _IOW('F', 0x20, u_int32_t)
#endif
-// TODO: these should come from hidd headers
-#define MAX_HIDD_EVENTS 100
-#if defined(TARGET_DEVICE)
-//TODO: Move me to a header!
+
+#if defined(HAS_QPA) && defined(TARGET_DEVICE)
+// From the Palm QPA
extern "C" void setTransform(QTransform*);
extern "C" InputControl* getTouchpanel(void);
extern "C" void setBluetoothCallback(void (*fun)(bool));
#endif
-#if defined(TARGET_DEVICE)
+#if defined(HAS_QPA) && defined(TARGET_DEVICE)
static void bluetoothCallback(bool enable)
{
HostBase::instance()->setBluetoothKeyboardActive(enable);
@@ -90,7 +91,7 @@ static void bluetoothCallback(bool enable)
HostArm::HostArm() :
m_nyxLightNotifier(NULL)
, m_nyxProxNotifier(NULL)
-#if defined(TARGET_DEVICE)
+#if defined(HAS_HIDLIB)
, m_hwRev(HidHardwareRevisionEVT1)
, m_hwPlatform (HidHardwarePlatformCastle)
#endif
@@ -110,9 +111,11 @@ HostArm::HostArm() :
, m_bluetoothKeyboardActive(false)
, m_OrientationSensor(0)
{
-#if defined(TARGET_DEVICE)
+#if defined(HAS_HIDLIB)
m_hwRev = HidGetHardwareRevision();
m_hwPlatform = HidGetHardwarePlatform();
+#endif
+#if defined(HAS_QPA) && defined(TARGET_DEVICE)
setBluetoothCallback(&bluetoothCallback);
#endif
}
@@ -216,7 +219,8 @@ void HostArm::init(int w, int h)
m_fb1NumBuffers = fixinfo.smem_len / (rowBytes * varinfo.yres);
printf("Linux Fb0: Num Buffers: %d, Fb1: Num Buffers: %d\n", m_fb0NumBuffers, m_fb1NumBuffers);
-#ifdef TARGET_DEVICE
+#if defined(HAS_QPA) && defined(TARGET_DEVICE)
+// From the Palm QPA
setTransform(&m_trans);
#endif
}
@@ -506,7 +510,7 @@ void HostArm::show()
disableScreenBlanking();
startService();
setupInput();
-#if defined(TARGET_DEVICE)
+#if defined(HAS_HIDLIB)
getInitialSwitchStates();
#endif
}
@@ -538,7 +542,7 @@ bool HostArm::getMsgValueInt(LSMessage* msg, int& value)
}
-#if defined(TARGET_DEVICE)
+#if defined(HAS_HIDLIB)
bool HostArm::switchStateCallback(LSHandle* handle, LSMessage* msg, void* data)
{
int switchCode = (int)data;
@@ -775,7 +779,7 @@ InputControl* HostArm::getInputControlTouchpanel()
{
if (m_nyxInputControlTouchpanel)
return m_nyxInputControlTouchpanel;
-#if defined(TARGET_DEVICE)
+#if defined(HAS_QPA) && defined(TARGET_DEVICE)
m_nyxInputControlTouchpanel = getTouchpanel();
#endif
if (!m_nyxInputControlTouchpanel)
View
@@ -33,7 +33,7 @@
#include "NyxInputControl.h"
#include "NyxLedControl.h"
-#if defined(TARGET_DEVICE)
+#if defined(HAS_HIDLIB)
#include "HidLib.h"
#endif
#include "lunaservice.h"
@@ -110,7 +110,7 @@ class HostArm : public HostBase, public NYXConnectorObserver
virtual void show();
virtual int getNumberOfSwitches() const;
-#if defined(TARGET_DEVICE)
+#if defined(HAS_HIDLIB)
virtual void getInitialSwitchStates(void);
#endif
int readHidEvents(int fd, struct input_event* eventBuf, int bufSize);
@@ -145,7 +145,7 @@ class HostArm : public HostBase, public NYXConnectorObserver
virtual void setCentralWidget(QWidget* view);
-#if defined(TARGET_DEVICE)
+#if defined(HAS_HIDLIB)
HidHardwareRevision_t m_hwRev;
HidHardwarePlatform_t m_hwPlatform;
#endif
@@ -186,7 +186,7 @@ class HostArm : public HostBase, public NYXConnectorObserver
virtual void setRenderingLayerEnabled(bool enable);
static bool getMsgValueInt(LSMessage* msg, int& value);
-#if defined(TARGET_DEVICE)
+#if defined(HAS_HIDLIB)
static bool switchStateCallback(LSHandle* handle, LSMessage* msg, void* data);
#endif
/**
@@ -32,20 +32,14 @@
#if defined(TARGET_DESKTOP)
#include "HostQtDesktop.h"
-#elif defined(TARGET_DEVICE)
+#else
#include "HostArm.cpp"
- #ifdef MACHINE_CASTLE
- #include "HostArmCastle.cpp"
- #elif defined(MACHINE_PIXIE)
- #include "HostArmPixie.cpp"
- #elif defined(MACHINE_WINDSOR)
- #include "HostArmWindsor.cpp"
+ #if defined(TARGET_EMULATOR)
+ #include "HostArmQemu.cpp"
#elif defined(MACHINE_BROADWAY)
#include "HostArmBroadway.cpp"
#elif defined(MACHINE_MANTARAY)
#include "HostArmMantaray.cpp"
- #elif defined(MACHINE_CHILE)
- #include "HostArmChile.cpp"
#elif defined(MACHINE_TOPAZ)
#include "HostArmTopaz.cpp"
#elif defined(MACHINE_OPAL)
@@ -55,9 +49,6 @@
#else
#include "HostArmUnknown.cpp"
#endif
-#elif defined(TARGET_EMULATOR)
- #include "HostArm.cpp"
- #include "HostArmQemu.cpp"
#endif
static HostBase* sInstance = 0;
@@ -98,28 +89,18 @@ HostBase* HostBase::instance()
new HostQtDesktop;
#elif defined(TARGET_EMULATOR)
new HostArmQemu;
-#elif defined(TARGET_DEVICE)
- #ifdef MACHINE_CASTLE
- new HostArmCastle;
- #elif defined(MACHINE_PIXIE)
- new HostArmPixie;
- #elif defined (MACHINE_WINDSOR)
- new HostArmWindsor;
- #elif defined(MACHINE_BROADWAY)
+#elif defined(MACHINE_BROADWAY)
new HostArmBroadway;
- #elif defined (MACHINE_MANTARAY)
+#elif defined(MACHINE_MANTARAY)
new HostArmMantaray;
- #elif defined(MACHINE_CHILE)
- new HostArmChile;
- #elif defined(MACHINE_TOPAZ)
+#elif defined(MACHINE_TOPAZ)
new HostArmTopaz;
- #elif defined(MACHINE_OPAL)
+#elif defined(MACHINE_OPAL)
new HostArmOpal;
- #elif defined(MACHINE_WINDSORNOT)
+#elif defined(MACHINE_WINDSORNOT)
new HostArmWindsorNot;
- #else
+#else
new HostArmUnknown;
- #endif
#endif
}
@@ -83,7 +83,7 @@ void CardWebApp::paintEvent(QPaintEvent* event)
// clear IPC Buffer if we switched from software to direct rendering
// but only after we finished painting!
if (m_lastPaintIPCBuffer) {
-#if defined (HAVE_OPENGL)
+#if defined(HAVE_OPENGL)
glFlush();
#endif
m_data->clear();
@@ -81,7 +81,7 @@ void MemoryWatcher::start()
m_timer.start(kTimerMs);
-#if defined(TARGET_DEVICE)
+#if defined(HAS_MEMCHUTE)
m_memWatch = MemchuteWatcherNew(MemoryWatcher::memchuteCallback);
if (m_memWatch != NULL) {
MemchuteGmainAttach(m_memWatch, WebAppManager::instance()->mainLoop());
@@ -195,7 +195,7 @@ void MemoryWatcher::doLowMemActions(bool allowExpensive)
g_warning("MemoryWatcher: RSS usage after low memory actions: %dMB\n", m_currRssUsage);
}
-#if defined(TARGET_DEVICE)
+#if defined(HAS_MEMCHUTE)
void MemoryWatcher::memchuteCallback(MemchuteThreshold threshold)
{
MemoryWatcher* mw = MemoryWatcher::instance();
@@ -30,7 +30,7 @@
#include "SignalSlot.h"
#include "Timer.h"
-#if defined(TARGET_DEVICE)
+#if defined(HAS_MEMCHUTE)
extern "C" {
#include <memchute.h>
}
@@ -67,7 +67,7 @@ class MemoryWatcher
bool timerTicked();
int getCurrentRssUsage() const;
-#if defined(TARGET_DEVICE)
+#if defined(HAS_MEMCHUTE)
static void memchuteCallback(MemchuteThreshold threshold);
#endif
@@ -90,7 +90,7 @@ class MemoryWatcher
MemState m_lastNotifiedState;
-#if defined(TARGET_DEVICE)
+#if defined(HAS_MEMCHUTE)
int m_memchuteCriticalThreshold;
MemchuteWatcher* m_memWatch;
#endif
@@ -167,7 +167,7 @@ void RemoteWindowDataOpenGLQt::sendWindowUpdate(int x, int y, int w, int h)
bool RemoteWindowDataOpenGLQt::hasDirectRendering() const
{
-#if defined(TARGET_DEVICE)
+#if defined(DIRECT_RENDERING)
return true;
#else
return false;
View
@@ -51,8 +51,8 @@ CONFIG_BUILD += opengl
#CONFIG_BUILD += openglcomposited
-SOURCES += HostQtDesktop.cpp FlickGestureRecognizer.cpp SoundPlayerDummy.cpp
-HEADERS += HostQtDesktop.h FlickGestureRecognizer.h FlickGesture.h SoundPlayerDummy.h
+SOURCES += HostQtDesktop.cpp FlickGestureRecognizer.cpp
+HEADERS += HostQtDesktop.h FlickGestureRecognizer.h FlickGesture.h
LIBS += \
-Wl,-rpath $$(LUNA_STAGING)/lib \
View
@@ -0,0 +1,65 @@
+# @@@LICENSE
+#
+# Copyright (c) 2010-2012 Hewlett-Packard Development Company, L.P.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# LICENSE@@@
+
+MACHINE_NAME = $$(MACHINE)
+
+contains(MACHINE_NAME, "broadway") {
+ DEFINES += MACHINE_BROADWAY USE_KEYMAPS PALM_DEVICE
+ CONFIG_BUILD += opengl texturesharing directrendering
+ CONFIG_BUILD += haptics napp nyx hidlib webosdevice
+ LIBS += -lqpalm
+}
+contains(MACHINE_NAME, "mantaray") {
+ DEFINES += MACHINE_MANTARAY USE_KEYMAPS PALM_DEVICE
+ CONFIG_BUILD += opengl openglcomposited directrendering
+ CONFIG_BUILD += haptics napp nyx hidlib webosdevice
+ LIBS += -lqpalm
+}
+contains(MACHINE_NAME, "windsornot") {
+ DEFINES += MACHINE_WINDSORNOT PALM_DEVICE
+ CONFIG_BUILD += opengl openglcomposited directrendering
+ CONFIG_BUILD += nyx napp hidlib webosdevice
+ LIBS += -lqpalm
+}
+contains(MACHINE_NAME, "topaz") {
+ DEFINES += MACHINE_TOPAZ PALM_DEVICE
+ # DEFINES += ENABLE_JS_DEBUG_VERBOSE
+
+###### Uncomment the following for debug building, e.g. for source debugging via eclipse, etc.
+###### Note that this is all really adhoc and quick'n'dirty, and not meant to be a robust method
+# CONFIG -= release
+# CONFIG += debug
+# QMAKE_CXXFLAGS -= $$QMAKE_CXXFLAGS_RELEASE -fomit-frame-pointer -frename-registers -finline-functions
+# QMAKE_CXXFLAGS += -O0 -pg -fno-omit-frame-pointer -fno-rename-registers -fno-inline-functions -fno-exceptions -fno-rtti
+# PALM_CC_OPT =
+# PALM_CXX_OPT =
+# PALM_CXX_EXTRA =
+# QMAKE_LFLAGS -= $$QMAKE_LFLAGS_RELEASE
+# QMAKE_LFLAGS +=
+############
+
+ CONFIG_BUILD += opengl directrendering # texturesharing fb1poweroptimization
+ CONFIG_BUILD += affinity haptics napp nyx hidlib webosdevice
+ LIBS += -lqpalm
+}
+contains(MACHINE_NAME, "opal") {
+ DEFINES += MACHINE_OPAL PALM_DEVICE
+ CONFIG_BUILD += opengl texturesharing directrendering
+ CONFIG_BUILD += affinity haptics napp nyx hidlib webosdevice
+ LIBS += -lqpalm
+}
Oops, something went wrong.

0 comments on commit 60d9a2a

Please sign in to comment.