From f64fd8d27d38e7c04e7ad859e1708660bc23509545688673ef16ae4094287500 Mon Sep 17 00:00:00 2001 From: Vincent Untz Date: Thu, 20 Oct 2011 13:29:10 +0000 Subject: [PATCH] Accepting request 88834 from home:vuntz:branches:GNOME:Factory I guess the best way to get testers is to submit it... OBS-URL: https://build.opensuse.org/request/show/88834 OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gnome-session?expand=0&rev=132 --- gnome-session-blacklist-hardware.patch | 231 ++++++++++++++++++++ gnome-session-gnome.fallback-boot-arg.patch | 102 +++++++++ gnome-session.changes | 10 + gnome-session.spec | 13 +- 4 files changed, 353 insertions(+), 3 deletions(-) create mode 100644 gnome-session-blacklist-hardware.patch create mode 100644 gnome-session-gnome.fallback-boot-arg.patch diff --git a/gnome-session-blacklist-hardware.patch b/gnome-session-blacklist-hardware.patch new file mode 100644 index 0000000..d637844 --- /dev/null +++ b/gnome-session-blacklist-hardware.patch @@ -0,0 +1,231 @@ +From 50b121a7737a13bde1195d1aea215ff8789f65fd Mon Sep 17 00:00:00 2001 +From: Vincent Untz +Date: Wed, 19 Oct 2011 14:27:25 +0200 +Subject: [PATCH 1/2] tools: Use whitelist/blacklist regexps when evaluating + renderer + +The regexps are in a file that we also ship. + +https://bugzilla.gnome.org/show_bug.cgi?id=644325 +--- + data/Makefile.am | 5 +- + data/hardware-compatibility | 20 +++++ + tools/Makefile.am | 3 +- + tools/gnome-session-check-accelerated-helper.c | 95 ++++++++++++++++++++++-- + 4 files changed, 115 insertions(+), 8 deletions(-) + create mode 100644 data/hardware-compatibility + +diff --git a/data/Makefile.am b/data/Makefile.am +index cdd3201..6f0fb33 100644 +--- a/data/Makefile.am ++++ b/data/Makefile.am +@@ -5,6 +5,9 @@ ui_DATA = \ + session-properties.ui \ + gsm-inhibit-dialog.ui + ++hwcompatdir = $(pkgdatadir) ++hwcompat_DATA = hardware-compatibility ++ + xsessiondir = $(datadir)/xsessions + xsession_in_files = gnome.desktop.in + xsession_DATA = $(xsession_in_files:.desktop.in=.desktop) +@@ -39,7 +42,7 @@ EXTRA_DIST = \ + $(session_in_in_files) \ + $(gsettings_SCHEMAS:.xml=.xml.in) \ + $(ui_DATA) \ +- $(pixmap_DATA_dist) ++ $(hwcompat_DATA) + + CLEANFILES = \ + $(gsettings_SCHEMAS) \ +diff --git a/data/hardware-compatibility b/data/hardware-compatibility +new file mode 100644 +index 0000000..b311898 +--- /dev/null ++++ b/data/hardware-compatibility +@@ -0,0 +1,20 @@ ++## ++## This file contains a list of blacklist/whitelist regular expressions for ++## renderer strings. ++## ++## The regular expressions are case-insensitive POSIX Extended Regular ++## Expressions. See regex(7) for details. ++## ++## Syntax: ++## - Comment lines start with '#' ++## - Lines starting with '+' are whitelisting. ++## - Lines starting with '-' are blacklisting. ++## - Lines not starting with '#', '+', '-' are ignored. ++## ++ ++# Old Mesa software GL renderer ++-software rasterizer ++ ++# Gallium has softpipe and llvmpipe ++-softpipe ++-llvmpipe +diff --git a/tools/Makefile.am b/tools/Makefile.am +index aaf1ca1..dc85836 100644 +--- a/tools/Makefile.am ++++ b/tools/Makefile.am +@@ -26,7 +26,8 @@ gnome_session_quit_LDADD = \ + gnome_session_check_accelerated_helper_SOURCES = \ + gnome-session-check-accelerated-helper.c + +-gnome_session_check_accelerated_helper_CPPFLAGS = \ ++gnome_session_check_accelerated_helper_CPPFLAGS = \ ++ -DPKGDATADIR=\""$(pkgdatadir)"\" \ + $(GL_TEST_CFLAGS) + + gnome_session_check_accelerated_helper_LDADD = \ +diff --git a/tools/gnome-session-check-accelerated-helper.c b/tools/gnome-session-check-accelerated-helper.c +index c1b49e2..c0fa1e5 100644 +--- a/tools/gnome-session-check-accelerated-helper.c ++++ b/tools/gnome-session-check-accelerated-helper.c +@@ -75,6 +75,8 @@ + #include + #include + ++#include ++ + #include + #include + #include +@@ -148,6 +150,92 @@ _has_composite (Display *display) + } + + static int ++_is_comment (const char *line) ++{ ++ while (*line && isspace(*line)) ++ line++; ++ ++ if (*line == '#' || *line == '\0') ++ return 0; ++ else ++ return 1; ++} ++ ++static int ++_is_gl_renderer_blacklisted (const char *renderer) ++{ ++ FILE *blacklist; ++ char *line = NULL; ++ size_t line_len = 0; ++ int ret = 1; ++ ++ blacklist = fopen(PKGDATADIR "/hardware-compatibility", "r"); ++ if (blacklist == NULL) ++ goto out; ++ ++ while (getline (&line, &line_len, blacklist) != -1) { ++ int whitelist = 0; ++ const char *re_str; ++ regex_t re; ++ int status; ++ ++ if (line == NULL) ++ break; ++ ++ /* Drop trailing \n */ ++ line[strlen(line) - 1] = '\0'; ++ ++ if (_is_comment (line) == 0) { ++ free (line); ++ line = NULL; ++ continue; ++ } ++ ++ if (line[0] == '+') ++ whitelist = 1; ++ else if (line[0] == '-') ++ whitelist = 0; ++ else { ++ _print_error ("Invalid syntax in this line for hardware compatibility:"); ++ _print_error (line); ++ free (line); ++ line = NULL; ++ continue; ++ } ++ ++ re_str = line + 1; ++ ++ if (regcomp (&re, re_str, REG_EXTENDED|REG_ICASE|REG_NOSUB) != 0) { ++ _print_error ("Cannot use this regular expression for hardware compatibility:"); ++ _print_error (re_str); ++ } else { ++ status = regexec (&re, renderer, 0, NULL, 0); ++ regfree(&re); ++ ++ if (status == 0) { ++ if (whitelist) ++ ret = 0; ++ goto out; ++ } ++ } ++ ++ free (line); ++ line = NULL; ++ } ++ ++ ret = 0; ++ ++out: ++ if (line != NULL) ++ free (line); ++ ++ if (blacklist != NULL) ++ fclose (blacklist); ++ ++ return ret; ++} ++ ++static int + _has_hardware_gl (Display *display) + { + int screen; +@@ -193,12 +281,7 @@ _has_hardware_gl (Display *display) + goto out; + + renderer = (const char *) glGetString (GL_RENDERER); +- /* The current Mesa software GL renderer string is +- * "Software Rasterizer". +- * Gallium has softpipe and llvmpipe. */ +- if (strcasestr (renderer, "software rasterizer") != NULL || +- strcasestr (renderer, "softpipe") != NULL || +- strcasestr (renderer, "llvmpipe") != NULL) ++ if (_is_gl_renderer_blacklisted (renderer) != 0) + goto out; + + /* we need to get the max texture size while we have a context, +-- +1.7.7 + + +From 5762becdbb2a308647067e0e09617b3f91f0ac0e Mon Sep 17 00:00:00 2001 +From: Vincent Untz +Date: Wed, 19 Oct 2011 14:36:57 +0200 +Subject: [PATCH 2/2] data: Blacklist Intel 830-865 hardware + +https://bugzilla.gnome.org/show_bug.cgi?id=644325 +--- + data/hardware-compatibility | 3 +++ + 1 files changed, 3 insertions(+), 0 deletions(-) + +diff --git a/data/hardware-compatibility b/data/hardware-compatibility +index b311898..ddbfe07 100644 +--- a/data/hardware-compatibility ++++ b/data/hardware-compatibility +@@ -12,6 +12,9 @@ + ## - Lines not starting with '#', '+', '-' are ignored. + ## + ++# Intel 830-865 ++-Intel(R) 8[[:digit:]]{2,2}[^[:digit:]] ++ + # Old Mesa software GL renderer + -software rasterizer + +-- +1.7.7 + diff --git a/gnome-session-gnome.fallback-boot-arg.patch b/gnome-session-gnome.fallback-boot-arg.patch new file mode 100644 index 0000000..dbcf449 --- /dev/null +++ b/gnome-session-gnome.fallback-boot-arg.patch @@ -0,0 +1,102 @@ +commit 2613036679b7691c93f5bbd1e15379d80fbb9bf6 +Author: Vincent Untz +Date: Wed Oct 19 13:14:50 2011 +0200 + + tools: Look at gnome.fallback argument in kernel boot line + + This is a quick way to let users easily force the fallback (or + non-fallback mode) with gnome.fallback=0/1 on boot. + +diff --git a/tools/gnome-session-check-accelerated-helper.c b/tools/gnome-session-check-accelerated-helper.c +index 3f83f76..c1fbe9d 100644 +--- a/tools/gnome-session-check-accelerated-helper.c ++++ b/tools/gnome-session-check-accelerated-helper.c +@@ -70,7 +70,9 @@ + /* for strcasestr */ + #define _GNU_SOURCE + ++#include + #include ++#include + #include + + #include +@@ -87,6 +89,54 @@ _print_error (const char *str) + } + + static int ++_parse_kcmdline (void) ++{ ++ FILE *kcmdline; ++ char *line = NULL; ++ size_t line_len = 0; ++ int ret = -1; ++ ++ kcmdline = fopen("/proc/cmdline", "r"); ++ if (kcmdline == NULL) ++ return ret; ++ ++ while (getline (&line, &line_len, kcmdline) != -1) { ++ const char *arg; ++ const char *str; ++ int key_len = strlen ("gnome.fallback="); ++ ++ if (line == NULL) ++ break; ++ ++ /* don't break if we found the argument once: last mention wins */ ++ ++ str = line; ++ do { ++ arg = strstr (str, "gnome.fallback="); ++ str = arg + key_len; ++ ++ if (arg && ++ (arg == line || isspace (arg[-1])) && /* gnome.fallback= is really the beginning of an argument */ ++ (isdigit (arg[key_len]))) { /* the first character of the value of this argument is an integer */ ++ if ((arg[key_len+1] == '\0' || isspace (arg[key_len+1]))) /* the value of this argument is only one character long */ ++ ret = arg[key_len] - '0'; ++ else /* invalid value */ ++ ret = 0xDEAD; ++ ++ } ++ } while (arg != NULL); ++ ++ free (line); ++ line = NULL; ++ line_len = 0; ++ } ++ ++ fclose (kcmdline); ++ ++ return ret; ++} ++ ++static int + _has_composite (Display *display) + { + int dummy1, dummy2; +@@ -257,9 +307,23 @@ _is_max_texture_size_big_enough (Display *display) + int + main (int argc, char **argv) + { ++ int kcmdline_parsed; + Display *display = NULL; + int ret = 1; + ++ kcmdline_parsed = _parse_kcmdline (); ++ if (kcmdline_parsed >= 0) { ++ if (kcmdline_parsed == 0) { ++ _print_error ("Non-fallback mode forced by kernel command line."); ++ ret = 0; ++ goto out; ++ } else if (kcmdline_parsed == 1) { ++ _print_error ("Fallback mode forced by kernel command line."); ++ goto out; ++ } else ++ _print_error ("Invalid value for gnome.fallback passed in kernel command line."); ++ } ++ + display = XOpenDisplay (NULL); + if (!display) { + _print_error ("No X display."); diff --git a/gnome-session.changes b/gnome-session.changes index cc440e8..366f0bb 100644 --- a/gnome-session.changes +++ b/gnome-session.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Wed Oct 19 11:18:10 UTC 2011 - vuntz@opensuse.org + +- Add gnome-session-gnome.fallback-boot-arg.patch: let users be + able to pass gnome.fallback=0/1 argument at boot to choose + fallback/non-fallback mode. +- Add gnome-session-blacklist-hardware.patch: use an external file + to easily blacklist/whitelist some hardware when checking if + we have 3d support. + ------------------------------------------------------------------- Sun Oct 16 17:15:54 UTC 2011 - vuntz@opensuse.org diff --git a/gnome-session.spec b/gnome-session.spec index cdd2cc5..64cf9dc 100644 --- a/gnome-session.spec +++ b/gnome-session.spec @@ -37,6 +37,10 @@ Patch1: gnome-session-kdm-support.patch Patch2: gnome-session-wm-switch.patch # PATCH-NEEDS-REBASE gnome-session-bgo507101-tile-ui.patch bgo507101 vuntz@novell.com -- Tile UI for logout dialog. (Was: PATCH-FIX-UPSTREAM) Patch3: gnome-session-bgo507101-tile-ui.patch +# PATCH-FEATURE-UPSTREAM gnome-session-gnome.fallback-boot-arg.patch vuntz@opensuse.org -- Let users be able to pass gnome.fallback at boot to choose fallback/non-fallback +Patch4: gnome-session-gnome.fallback-boot-arg.patch +# PATCH-FEATURE-UPSTREAM gnome-session-blacklist-hardware.patch bgo#644325 vuntz@opensuse.org -- Use an external file to easily blacklist/whitelist some hardware +Patch5: gnome-session-blacklist-hardware.patch BuildRequires: fdupes BuildRequires: gnome-common BuildRequires: gnome-patch-translation @@ -137,6 +141,8 @@ translation-update-upstream #%patch2 -p1 # needs-rebase #%patch3 -p0 +%patch4 -p1 +%patch5 -p1 # gnome-patch-translation-update %build @@ -215,9 +221,6 @@ rm -rf %{buildroot} %doc AUTHORS COPYING ChangeLog NEWS README %{_bindir}/gnome-session %{_bindir}/gnome-session-quit -# Helper for the session definitions, to know if hardware is accelerated -%{_libexecdir}/gnome-session-check-accelerated -%{_libexecdir}/gnome-session-check-accelerated-helper %{_datadir}/GConf/gsettings/gnome-session.convert %{_datadir}/glib-2.0/schemas/org.gnome.SessionManager.gschema.xml %dir %{_datadir}/gnome-session @@ -226,6 +229,10 @@ rm -rf %{buildroot} %{_datadir}/icons/hicolor/scalable/apps/gnome-session-sleep.svg %doc %{_mandir}/man1/gnome-session.1* %doc %{_mandir}/man1/gnome-session-quit.1* +# Helper for the session definitions, to know if hardware is accelerated +%{_libexecdir}/gnome-session-check-accelerated +%{_libexecdir}/gnome-session-check-accelerated-helper +%{_datadir}/gnome-session/hardware-compatibility %files lang -f %{name}-3.0.lang