Hi, This patch fixes a leak when creating fragment functions in some of the plugins. The leak happens when there is a plugin that uses a fragment program with parameters and texture units on only a subset of windows. During screen painting, the allocated param and unit change across windows in the patched plugins, which (because of the mismatch with the previously created and stored function) causes new fragment functions to be created at each frame without destroying the old one, increasing the length of s->fragmentFunctions and slowly degrading painting performance.
Regards, Erkin
From 35bc55f1ff0aeefb1d89a43b96d373584aee6381 Mon Sep 17 00:00:00 2001 From: Erkin Bahceci <[EMAIL PROTECTED]> Date: Sun, 4 Nov 2007 10:49:48 -0600 Subject: [PATCH] Fix fragment function leak. --- plugins/blur.c | 6 ++++++ plugins/video.c | 3 +++ plugins/water.c | 3 +++ 3 files changed, 12 insertions(+), 0 deletions(-) diff --git a/plugins/blur.c b/plugins/blur.c index 4c9bea1..68d6e8d 100644 --- a/plugins/blur.c +++ b/plugins/blur.c @@ -1054,6 +1054,9 @@ getSrcBlurFragmentFunction (CompScreen *s, { handle = createFragmentFunction (s, "blur", data); + if (function->handle) + destroyFragmentFunction (s, function->handle); + function->handle = handle; function->target = target; function->param = param; @@ -1258,6 +1261,9 @@ getDstBlurFragmentFunction (CompScreen *s, { handle = createFragmentFunction (s, "blur", data); + if (function->handle) + destroyFragmentFunction (s, function->handle); + function->handle = handle; function->target = target; function->param = param; diff --git a/plugins/video.c b/plugins/video.c index 4268d00..ccd1e0e 100644 --- a/plugins/video.c +++ b/plugins/video.c @@ -363,6 +363,9 @@ getYV12FragmentFunction (CompScreen *s, { handle = createFragmentFunction (s, "video", data); + if (function->handle) + destroyFragmentFunction (s, function->handle); + function->handle = handle; function->target = target; function->param = param; diff --git a/plugins/water.c b/plugins/water.c index fca4df3..a09ae43 100644 --- a/plugins/water.c +++ b/plugins/water.c @@ -369,6 +369,9 @@ getBumpMapFragmentFunction (CompScreen *s, { handle = createFragmentFunction (s, "water", data); + if (function->handle) + destroyFragmentFunction (s, function->handle); + function->handle = handle; function->target = target; function->param = param; -- 1.5.2.5
_______________________________________________ compiz mailing list compiz@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/compiz