[Bf-blender-cvs] [dbb5a561c8b] temp-benchmark: Benchmark: wm hacks to open a single window with benchmark space.

Brecht Van Lommel noreply at git.blender.org
Thu Aug 2 19:40:06 CEST 2018


Commit: dbb5a561c8ba6cc77c627730ba8ce70ea98d04dd
Author: Brecht Van Lommel
Date:   Fri Jul 20 12:36:51 2018 +0200
Branches: temp-benchmark
https://developer.blender.org/rBdbb5a561c8ba6cc77c627730ba8ce70ea98d04dd

Benchmark: wm hacks to open a single window with benchmark space.

===================================================================

M	intern/ghost/intern/GHOST_WindowCocoa.mm
M	intern/ghost/intern/GHOST_WindowWin32.cpp
M	intern/ghost/intern/GHOST_WindowX11.cpp
M	release/scripts/modules/addon_utils.py
M	source/blender/editors/screen/screen_draw.c
M	source/blender/editors/screen/screen_edit.c
M	source/blender/windowmanager/intern/wm.c
M	source/blender/windowmanager/intern/wm_files.c
M	source/blender/windowmanager/intern/wm_init_exit.c
M	source/blender/windowmanager/intern/wm_window.c
M	source/creator/CMakeLists.txt
M	source/creator/creator.c

===================================================================

diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm
index 2b986428fd3..aa20f533069 100644
--- a/intern/ghost/intern/GHOST_WindowCocoa.mm
+++ b/intern/ghost/intern/GHOST_WindowCocoa.mm
@@ -533,8 +533,9 @@ GHOST_WindowCocoa::GHOST_WindowCocoa(
 	rect.size.width = width;
 	rect.size.height = height;
 	
+	/* Benchmark: no window resize. */
 	m_window = [[CocoaWindow alloc] initWithContentRect:rect
-	        styleMask:NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask | NSMiniaturizableWindowMask
+	        styleMask:NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask
 	        backing:NSBackingStoreBuffered defer:NO];
 
 	if (m_window == nil) {
diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp
index 676a29f28d4..570a447a352 100644
--- a/intern/ghost/intern/GHOST_WindowWin32.cpp
+++ b/intern/ghost/intern/GHOST_WindowWin32.cpp
@@ -149,7 +149,8 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 *system,
 		else if (top < monitor.rcWork.top)
 			top = monitor.rcWork.top;
 
-		int wintype = WS_OVERLAPPEDWINDOW;
+		/* Benchmark: no window resize. */
+		int wintype = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX;
 		if (m_parentWindowHwnd != 0) {
 			wintype = WS_CHILD;
 			GetWindowRect((HWND)m_parentWindowHwnd, &rect);
diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp
index e740542961e..c7d1329a3c8 100644
--- a/intern/ghost/intern/GHOST_WindowX11.cpp
+++ b/intern/ghost/intern/GHOST_WindowX11.cpp
@@ -484,10 +484,11 @@ GHOST_WindowX11(GHOST_SystemX11 *system,
 		xsizehints->y = top;
 		xsizehints->width = width;
 		xsizehints->height = height;
-		xsizehints->min_width = 320;     /* size hints, could be made apart of the ghost api */
-		xsizehints->min_height = 240;    /* limits are also arbitrary, but should not allow 1x1 window */
-		xsizehints->max_width = 65535;
-		xsizehints->max_height = 65535;
+		/* Benchmark: fixed window size. */
+		xsizehints->min_width = width;     /* size hints, could be made apart of the ghost api */
+		xsizehints->min_height = height;    /* limits are also arbitrary, but should not allow 1x1 window */
+		xsizehints->max_width = width;
+		xsizehints->max_height = height;
 		XSetWMNormalHints(m_display, m_window, xsizehints);
 		XFree(xsizehints);
 	}
diff --git a/release/scripts/modules/addon_utils.py b/release/scripts/modules/addon_utils.py
index f73d23c150b..38926e10961 100644
--- a/release/scripts/modules/addon_utils.py
+++ b/release/scripts/modules/addon_utils.py
@@ -345,6 +345,8 @@ def enable(module_name, *, default_set=False, persistent=False, handle_error=Non
     # disable the context, using the context at all is
     # really bad while loading an addon, don't do it!
     with RestrictBlend():
+        # Benchmark: disable addons
+        return None
 
         # 1) try import
         try:
diff --git a/source/blender/editors/screen/screen_draw.c b/source/blender/editors/screen/screen_draw.c
index 10d72d74b22..9dc7f8a9e57 100644
--- a/source/blender/editors/screen/screen_draw.c
+++ b/source/blender/editors/screen/screen_draw.c
@@ -433,6 +433,9 @@ static void drawscredge_area(ScrArea *sa, int sizex, int sizey, unsigned int pos
  */
 void ED_screen_draw_edges(wmWindow *win)
 {
+	/* Benchmark: no edges between editors. */
+	return;
+
 	bScreen *screen = WM_window_get_active_screen(win);
 	const int winsize_x = WM_window_pixels_x(win);
 	const int winsize_y = WM_window_pixels_y(win);
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index 1d14940085b..0ee394b6cc2 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -792,6 +792,9 @@ static void screen_global_statusbar_area_create(wmWindow *win)
 
 void ED_screen_global_areas_create(wmWindow *win)
 {
+	/* Benchmark: no global areas. */
+	return;
+
 	/* Don't create global areas for child windows. */
 	if (win->parent) {
 		return;
diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c
index 7247529d02d..9ddfdb2aa77 100644
--- a/source/blender/windowmanager/intern/wm.c
+++ b/source/blender/windowmanager/intern/wm.c
@@ -243,8 +243,14 @@ void WM_keymap_init(bContext *C)
 		/* create default key config, only initialize once,
 		 * it's persistent across sessions */
 		if (!(wm->defaultconf->flag & KEYCONF_INIT_DEFAULT)) {
+			/* Benchmark: no keymaps. */
+#if 0
 			wm_window_keymap(wm->defaultconf);
 			ED_spacetypes_keymap(wm->defaultconf);
+#else
+			SpaceType *st = BKE_spacetype_from_id(SPACE_FILE);
+			st->keymap(wm->defaultconf);
+#endif
 
 			wm->defaultconf->flag |= KEYCONF_INIT_DEFAULT;
 		}
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index e44081bef54..d677ee3eb2e 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -556,6 +556,11 @@ static void wm_file_read_post(bContext *C, const bool is_startup_file, const boo
 
 		/* Ensure tools are registered. */
 		WM_toolsystem_init(C);
+
+		/* Benchmark: fullscreen editor. */
+		CTX_wm_window_set(C, wm->windows.first);
+		ED_screen_full_newspace(C, NULL, SPACE_BENCHMARK);
+		CTX_wm_window_set(C, NULL);
 	}
 }
 
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index 4b0d751a7ce..9e5cf4b64aa 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -341,6 +341,9 @@ void WM_init(bContext *C, int argc, const char **argv)
 
 void WM_init_splash(bContext *C)
 {
+	/* Benchmark: no splash screen. */
+	return;
+
 	if ((U.uiflag & USER_SPLASH_DISABLE) == 0) {
 		wmWindowManager *wm = CTX_wm_manager(C);
 		wmWindow *prevwin = CTX_wm_window(C);
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index f391c92b4ca..2156c19ae2e 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -546,8 +546,10 @@ void wm_window_title(wmWindowManager *wm, wmWindow *win)
 			             G_MAIN->recovered ? " (Recovered)" : "");
 			GHOST_SetTitle(win->ghostwin, str);
 		}
-		else
-			GHOST_SetTitle(win->ghostwin, "Blender");
+		else {
+			/* Benchmark: title. */
+			GHOST_SetTitle(win->ghostwin, "Blender Benchmark");
+		}
 
 		/* Informs GHOST of unsaved changes, to set window modified visual indicator (MAC OS X)
 		 * and to give hint of unsaved changes for a user warning mechanism
@@ -691,6 +693,23 @@ static void wm_window_ghostwindow_add(wmWindowManager *wm, const char *title, wm
 	}
 }
 
+/* Benchmark: ugly hack to get DPI before we have opened any windows. */
+static void wm_window_set_startup_dpi(wmWindow *win)
+{
+	GHOST_GLSettings glSettings = {0};
+
+	win->ghostwin = GHOST_CreateWindow(g_system, "Temp",
+	                                   0, 0, 512, 512,
+	                                   GHOST_kWindowStateNormal,
+	                                   GHOST_kDrawingContextTypeOpenGL,
+	                                   glSettings);
+
+	WM_window_set_dpi(win);
+
+	GHOST_DisposeWindow(g_system, win->ghostwin);
+	win->ghostwin = NULL;
+}
+
 /**
  * Initialize #wmWindow without ghostwin, open these and clear.
  *
@@ -758,7 +777,13 @@ void wm_window_ghostwindows_ensure(wmWindowManager *wm)
 				win->cursor = CURSOR_STD;
 			}
 
-			wm_window_ghostwindow_add(wm, "Blender", win);
+			/* Benchmark: fixed size window. */
+			wm_window_set_startup_dpi(win);
+			win->sizex = 800 * UI_DPI_FAC;
+			win->sizey = 570 * UI_DPI_FAC;
+
+			/* Benchmark: title. */
+			wm_window_ghostwindow_add(wm, "Blender Benchmark", win);
 		}
 		/* happens after fileread */
 		wm_window_ensure_eventstate(win);
@@ -954,7 +979,7 @@ wmWindow *WM_window_open_temp(bContext *C, int x, int y, int sizex, int sizey, i
 	else if (sa->spacetype == SPACE_IPO)
 		title = IFACE_("Blender Drivers Editor");
 	else
-		title = "Blender";
+		title = "Blender Benchmark"; /* Benchmark: title. */
 
 	if (win->ghostwin) {
 		GHOST_SetTitle(win->ghostwin, title);
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index b98b917815b..ef78d23875b 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -336,21 +336,6 @@ install(
 if(WITH_PYTHON)
 	# install(CODE "message(\"copying blender scripts...\")")
 
-	# exclude addons_contrib if release
-	if("${BLENDER_VERSION_CYCLE}" STREQUAL "release" OR
-	   "${BLENDER_VERSION_CYCLE}" STREQUAL "rc")
-		set(ADDON_EXCLUDE_CONDITIONAL "addons_contrib/*")
-	else()
-		set(ADDON_EXCLUDE_CONDITIONAL "_addons_contrib/*")  # dummy, wont do anything
-	endif()
-
-	# do not install freestyle dir if disabled
-	if(NOT WITH_FREESTYLE)
-		set(FREESTYLE_EXCLUDE_CONDITIONAL "freestyle/*")
-	else()
-		set(FREESTYLE_EXCLUDE_CONDITIONAL "_freestyle/*")  # dummy, wont do anything
-	endif()
-
 	install(
 		DIRECTORY ${CMAKE_SOURCE_DIR}/release/scripts
 		DESTINATION ${TARGETDIR_VER}
@@ -358,12 +343,10 @@ if(WITH_PYTHON)
 		PATTERN ".gitignore" EXCLUDE
 		PATTERN ".arcconfig" EXCLUDE
 		PATTERN "__pycache__" EXCLUDE
-		PATTERN "${ADDON_EXCLUDE_CONDITIONAL}" EXCLUDE
-		PATTERN "${FREESTYLE_EXCLUDE_CONDITIONAL}" EXCLUDE
+		PATTERN "addons/*" EXCLUDE
+		PATTERN "addons_contrib/*" EXCLUDE
+		PATTERN "freestyle/*" EXCLUDE
 	)
-
-	unset(ADDON_EXCLUDE_CONDITIONAL)
-	unset(FREESTYLE_EXCLUDE_CONDITIONAL)
 endif()
 
 # localization
diff --git a/source/creator/creator.c b/source/creator/creator.c
index 914211afd56..b4aa3739969 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -400,6 +400,9 @@ int main(
 	G.factory_startup = true;  /* using preferences or user startup makes no sense for py-as-module */
 #endif
 
+	/* Benchmark: factory startup. */
+	G.factory_startup = true;
+
 #ifdef WITH_FFMPEG
 	IMB_ffmpeg_init();
 #endif



More information about the Bf-blender-cvs mailing list