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 928c85e..fe5adaa 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 83ee83a..68afb35 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 c2a462a..50e8e1c 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 836af47..dbdcd06 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 36172f6..9bd7b3b 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);