mirror of
https://github.com/elementary/gala.git
synced 2024-10-26 16:01:57 +03:00
Fix Nvidia FBO issue with suspend/resume
This commit is contained in:
parent
5b3d3bcc2b
commit
4b001cad52
@ -19,8 +19,30 @@ using Meta;
|
|||||||
|
|
||||||
namespace Gala
|
namespace Gala
|
||||||
{
|
{
|
||||||
|
[DBus (name = "org.freedesktop.login1.Manager")]
|
||||||
|
public interface LoginDRemote : GLib.Object
|
||||||
|
{
|
||||||
|
public signal void prepare_for_sleep (bool suspending);
|
||||||
|
}
|
||||||
|
|
||||||
public class WindowManagerGala : Meta.Plugin, WindowManager
|
public class WindowManagerGala : Meta.Plugin, WindowManager
|
||||||
{
|
{
|
||||||
|
const uint GL_VENDOR = 0x1F00;
|
||||||
|
const string LOGIND_DBUS_NAME = "org.freedesktop.login1";
|
||||||
|
const string LOGIND_DBUS_OBJECT_PATH = "/org/freedesktop/login1";
|
||||||
|
|
||||||
|
delegate unowned string? GlQueryFunc (uint id);
|
||||||
|
|
||||||
|
static bool is_nvidia ()
|
||||||
|
{
|
||||||
|
var gl_get_string = (GlQueryFunc) Cogl.get_proc_address ("glGetString");
|
||||||
|
if (gl_get_string == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
unowned string? vendor = gl_get_string (GL_VENDOR);
|
||||||
|
return (vendor != null && vendor.contains ("NVIDIA Corporation"));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@ -58,6 +80,8 @@ namespace Gala
|
|||||||
|
|
||||||
Window? moving; //place for the window that is being moved over
|
Window? moving; //place for the window that is being moved over
|
||||||
|
|
||||||
|
LoginDRemote? logind_proxy = null;
|
||||||
|
|
||||||
Gee.LinkedList<ModalProxy> modal_stack = new Gee.LinkedList<ModalProxy> ();
|
Gee.LinkedList<ModalProxy> modal_stack = new Gee.LinkedList<ModalProxy> ();
|
||||||
|
|
||||||
Gee.HashSet<Meta.WindowActor> minimizing = new Gee.HashSet<Meta.WindowActor> ();
|
Gee.HashSet<Meta.WindowActor> minimizing = new Gee.HashSet<Meta.WindowActor> ();
|
||||||
@ -83,6 +107,25 @@ namespace Gala
|
|||||||
public override void start ()
|
public override void start ()
|
||||||
{
|
{
|
||||||
Util.later_add (LaterType.BEFORE_REDRAW, show_stage);
|
Util.later_add (LaterType.BEFORE_REDRAW, show_stage);
|
||||||
|
|
||||||
|
// Handle FBO issue with nvidia blob
|
||||||
|
if (logind_proxy == null
|
||||||
|
&& is_nvidia ()) {
|
||||||
|
try {
|
||||||
|
logind_proxy = Bus.get_proxy_sync (BusType.SYSTEM, LOGIND_DBUS_NAME, LOGIND_DBUS_OBJECT_PATH);
|
||||||
|
logind_proxy.prepare_for_sleep.connect (prepare_for_sleep);
|
||||||
|
} catch (Error e) {
|
||||||
|
warning ("Failed to get LoginD proxy: %s", e.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void prepare_for_sleep (bool suspending)
|
||||||
|
{
|
||||||
|
if (suspending)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Meta.Background.refresh_all ();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool show_stage ()
|
bool show_stage ()
|
||||||
@ -123,7 +166,7 @@ namespace Gala
|
|||||||
* +---- background manager
|
* +---- background manager
|
||||||
* +-- shell elements
|
* +-- shell elements
|
||||||
* +-- top window group
|
* +-- top window group
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var system_background = new SystemBackground (screen);
|
var system_background = new SystemBackground (screen);
|
||||||
system_background.add_constraint (new Clutter.BindConstraint (stage,
|
system_background.add_constraint (new Clutter.BindConstraint (stage,
|
||||||
|
Loading…
Reference in New Issue
Block a user