display: add initialization option
authorJinhyung Jo <jinhyung.jo@samsung.com>
Tue, 26 Jul 2016 07:45:42 +0000 (16:45 +0900)
committerJinhyung Jo <jinhyung.jo@samsung.com>
Thu, 8 Sep 2016 08:22:44 +0000 (17:22 +0900)
Add code to run with OpenGL Legacy Profile in Mac OS X.

Change-Id: I23967ccdd33d87d96df858460ceaa688b129d41e
Signed-off-by: Jinhyung Jo <jinhyung.jo@samsung.com>
tizen/src/ui/qt5.c
tizen/src/ui/qt5.h
tizen/src/ui/qt5_supplement.cpp
tizen/src/ui/qt5_supplement.h
vl.c

index 928c85e871c4ebde29946f710a85c9d6383ba095..fe5adaa53c1878b38838b5d8d31ff03684c195a2 100644 (file)
@@ -176,6 +176,11 @@ int get_display_pixel_density(void)
     return pixel_density_dpi;
 }
 
+void maru_qt5_set_force_legacy(bool isLegacy)
+{
+    qt5_set_force_legacy(isLegacy);
+}
+
 void maru_qt5_display_init(DisplayState *ds, int full_screen)
 {
     int i;
index 83ee83ac77bdef8a927c3f4a31c8988428965c6e..68afb3559e1b5d35e121f462d4605dd87cca6967 100644 (file)
@@ -39,4 +39,6 @@ void maru_qt5_display_init(DisplayState *ds, int full_screen);
 void set_display_pixel_density(int dpi);
 int get_display_pixel_density(void);
 
+void maru_qt5_set_force_legacy(bool isLegacy);
+
 #endif // __QT5_H__
index c2a462a39f1a2172f1d6afc2b852cccc15c776f2..50e8e1c4683dd3ed7e1f4956d5920978135c3cf4 100644 (file)
@@ -56,6 +56,7 @@ void loadConFormFromXML(QFile *, UiInformation *);
 bool qt5IsOnscreen;
 QApplication *qt5App = NULL;
 QOpenGLContext *qt5GLContext;
+bool isForceLegacy;
 
 static int argc = 0;
 static char *argv[0];
@@ -319,6 +320,11 @@ void qt5_destroy()
     uiInfo = NULL;
 }
 
+void qt5_set_force_legacy(bool isLegacy)
+{
+    isForceLegacy = isLegacy;
+}
+
 void qt5_early_prepare(bool isOnscreen)
 {
     qt5IsOnscreen = isOnscreen;
@@ -346,12 +352,15 @@ void qt5_early_prepare(bool isOnscreen)
         sfcFormat.setAlphaBufferSize(8);
         sfcFormat.setDepthBufferSize(24);
         sfcFormat.setStencilBufferSize(8);
-        // FIXME: modify the version using the gl_version proerty of VIGS
-        sfcFormat.setMajorVersion(3);
 #ifdef CONFIG_DARWIN
-        sfcFormat.setMinorVersion(2);
-        sfcFormat.setProfile(QSurfaceFormat::CoreProfile);
+        // The default OpenGL version for QSurfaceFormat is 2.0.
+        if (!isForceLegacy) {
+            sfcFormat.setMajorVersion(3);
+            sfcFormat.setMinorVersion(2);
+            sfcFormat.setProfile(QSurfaceFormat::CoreProfile);
+        }
 #else
+        sfcFormat.setMajorVersion(3);
         sfcFormat.setMinorVersion(1);
 #endif
         QSurfaceFormat::setDefaultFormat(sfcFormat);
index 836af47ce9e9e29459e216343017fbc6e171a139..dbdcd06be23a5cf7508b1deb091b7f1d1b0f287e 100644 (file)
@@ -46,6 +46,8 @@ void qt5_switch_internal(void);
 void qt5_refresh_internal(void);
 
 const char* qt5_get_version(void);
+
+void qt5_set_force_legacy(bool isLegacy);
 #ifdef __cplusplus
 }
 #endif
diff --git a/vl.c b/vl.c
index 36172f619911c6097108765dd5167d7f0d19f826..9bd7b3bb744c552ed85af90bc5f52f9cb520fff1 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -2282,6 +2282,9 @@ static DisplayType select_display(const char *p)
                 }
                 set_display_pixel_density(dpi);
                 nextopt = endptr;
+            } else if (strstart(opts, ",forcelegacy", &nextopt)) {
+                opts = nextopt;
+                maru_qt5_set_force_legacy(true);
             } else {
             invalid_maru_qt_args:
                 error_report(FAILED_TO_DISPLAY_PARSING);