mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 08:30:42 -05:00
shaped-texture: Remove mipmap framerate limiting
Although mipmapping is still slower than not mipmapping, commit16fa2100
simplified N synchronous draw calls per texture tower into just one. So it's more efficient now, and four years have passed since the throttling was introduced so people also have better hardware as well as mutter being generally faster than it used to be. So I am happy to effectively revert commitc9c32835
. This means antialiasing will remain consistent rather than popping in and out of existence. Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/403 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2538>
This commit is contained in:
parent
d692c9e0f5
commit
e0145447a3
@ -48,20 +48,6 @@
|
|||||||
#include "core/boxes-private.h"
|
#include "core/boxes-private.h"
|
||||||
#include "meta/meta-shaped-texture.h"
|
#include "meta/meta-shaped-texture.h"
|
||||||
|
|
||||||
/* MAX_MIPMAPPING_FPS needs to be as small as possible for the best GPU
|
|
||||||
* performance, but higher than the refresh rate of commonly slow updating
|
|
||||||
* windows like top or a blinking cursor, so that such windows do get
|
|
||||||
* mipmapped.
|
|
||||||
*/
|
|
||||||
#define MAX_MIPMAPPING_FPS 5
|
|
||||||
#define MIN_MIPMAP_AGE_USEC (G_USEC_PER_SEC / MAX_MIPMAPPING_FPS)
|
|
||||||
|
|
||||||
/* MIN_FAST_UPDATES_BEFORE_UNMIPMAP allows windows to update themselves
|
|
||||||
* occasionally without causing mipmapping to be disabled, so long as such
|
|
||||||
* an update takes fewer update_area calls than:
|
|
||||||
*/
|
|
||||||
#define MIN_FAST_UPDATES_BEFORE_UNMIPMAP 20
|
|
||||||
|
|
||||||
static void meta_shaped_texture_dispose (GObject *object);
|
static void meta_shaped_texture_dispose (GObject *object);
|
||||||
|
|
||||||
static void clutter_content_iface_init (ClutterContentInterface *iface);
|
static void clutter_content_iface_init (ClutterContentInterface *iface);
|
||||||
@ -118,11 +104,6 @@ struct _MetaShapedTexture
|
|||||||
int fallback_width, fallback_height;
|
int fallback_width, fallback_height;
|
||||||
int dst_width, dst_height;
|
int dst_width, dst_height;
|
||||||
|
|
||||||
gint64 prev_invalidation, last_invalidation;
|
|
||||||
guint fast_updates;
|
|
||||||
guint remipmap_timeout_id;
|
|
||||||
gint64 earliest_remipmap;
|
|
||||||
|
|
||||||
int buffer_scale;
|
int buffer_scale;
|
||||||
|
|
||||||
guint create_mipmaps : 1;
|
guint create_mipmaps : 1;
|
||||||
@ -258,8 +239,6 @@ meta_shaped_texture_dispose (GObject *object)
|
|||||||
{
|
{
|
||||||
MetaShapedTexture *stex = (MetaShapedTexture *) object;
|
MetaShapedTexture *stex = (MetaShapedTexture *) object;
|
||||||
|
|
||||||
g_clear_handle_id (&stex->remipmap_timeout_id, g_source_remove);
|
|
||||||
|
|
||||||
g_clear_pointer (&stex->texture_mipmap, meta_texture_mipmap_free);
|
g_clear_pointer (&stex->texture_mipmap, meta_texture_mipmap_free);
|
||||||
|
|
||||||
g_clear_pointer (&stex->texture, cogl_object_unref);
|
g_clear_pointer (&stex->texture, cogl_object_unref);
|
||||||
@ -621,20 +600,6 @@ set_cogl_texture (MetaShapedTexture *stex,
|
|||||||
meta_texture_mipmap_invalidate (stex->texture_mipmap);
|
meta_texture_mipmap_invalidate (stex->texture_mipmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
|
||||||
texture_is_idle_and_not_mipmapped (gpointer user_data)
|
|
||||||
{
|
|
||||||
MetaShapedTexture *stex = META_SHAPED_TEXTURE (user_data);
|
|
||||||
|
|
||||||
if ((g_get_monotonic_time () - stex->earliest_remipmap) < 0)
|
|
||||||
return G_SOURCE_CONTINUE;
|
|
||||||
|
|
||||||
clutter_content_invalidate (CLUTTER_CONTENT (stex));
|
|
||||||
stex->remipmap_timeout_id = 0;
|
|
||||||
|
|
||||||
return G_SOURCE_REMOVE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
flip_ints (int *x,
|
flip_ints (int *x,
|
||||||
int *y)
|
int *y)
|
||||||
@ -646,10 +611,6 @@ flip_ints (int *x,
|
|||||||
*y = tmp;
|
*y = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static CoglTexture *
|
|
||||||
select_texture_for_paint (MetaShapedTexture *stex,
|
|
||||||
ClutterPaintContext *paint_context);
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
do_paint_content (MetaShapedTexture *stex,
|
do_paint_content (MetaShapedTexture *stex,
|
||||||
ClutterPaintNode *root_node,
|
ClutterPaintNode *root_node,
|
||||||
@ -733,9 +694,8 @@ do_paint_content (MetaShapedTexture *stex,
|
|||||||
transforms.x_scale < 0.5 &&
|
transforms.x_scale < 0.5 &&
|
||||||
transforms.y_scale < 0.5)
|
transforms.y_scale < 0.5)
|
||||||
{
|
{
|
||||||
paint_tex = select_texture_for_paint (stex, paint_context);
|
paint_tex = meta_texture_mipmap_get_paint_texture (stex->texture_mipmap);
|
||||||
if (paint_tex != stex->texture)
|
min_filter = COGL_PIPELINE_FILTER_LINEAR_MIPMAP_NEAREST;
|
||||||
min_filter = COGL_PIPELINE_FILTER_LINEAR_MIPMAP_NEAREST;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -916,49 +876,6 @@ do_paint_content (MetaShapedTexture *stex,
|
|||||||
g_clear_pointer (&blended_tex_region, cairo_region_destroy);
|
g_clear_pointer (&blended_tex_region, cairo_region_destroy);
|
||||||
}
|
}
|
||||||
|
|
||||||
static CoglTexture *
|
|
||||||
select_texture_for_paint (MetaShapedTexture *stex,
|
|
||||||
ClutterPaintContext *paint_context)
|
|
||||||
{
|
|
||||||
CoglTexture *texture = NULL;
|
|
||||||
int64_t now;
|
|
||||||
|
|
||||||
if (!stex->texture)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
now = g_get_monotonic_time ();
|
|
||||||
|
|
||||||
if (stex->create_mipmaps && stex->last_invalidation)
|
|
||||||
{
|
|
||||||
int64_t age = now - stex->last_invalidation;
|
|
||||||
|
|
||||||
if (age >= MIN_MIPMAP_AGE_USEC ||
|
|
||||||
stex->fast_updates < MIN_FAST_UPDATES_BEFORE_UNMIPMAP)
|
|
||||||
{
|
|
||||||
texture = meta_texture_mipmap_get_paint_texture (stex->texture_mipmap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!texture)
|
|
||||||
{
|
|
||||||
texture = stex->texture;
|
|
||||||
|
|
||||||
if (stex->create_mipmaps)
|
|
||||||
{
|
|
||||||
/* Minus 1000 to ensure we don't fail the age test in timeout */
|
|
||||||
stex->earliest_remipmap = now + MIN_MIPMAP_AGE_USEC - 1000;
|
|
||||||
|
|
||||||
if (!stex->remipmap_timeout_id)
|
|
||||||
stex->remipmap_timeout_id =
|
|
||||||
g_timeout_add (MIN_MIPMAP_AGE_USEC / 1000,
|
|
||||||
texture_is_idle_and_not_mipmapped,
|
|
||||||
stex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return texture;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_shaped_texture_paint_content (ClutterContent *content,
|
meta_shaped_texture_paint_content (ClutterContent *content,
|
||||||
ClutterActor *actor,
|
ClutterActor *actor,
|
||||||
@ -1165,20 +1082,6 @@ meta_shaped_texture_update_area (MetaShapedTexture *stex,
|
|||||||
|
|
||||||
meta_texture_mipmap_invalidate (stex->texture_mipmap);
|
meta_texture_mipmap_invalidate (stex->texture_mipmap);
|
||||||
|
|
||||||
stex->prev_invalidation = stex->last_invalidation;
|
|
||||||
stex->last_invalidation = g_get_monotonic_time ();
|
|
||||||
|
|
||||||
if (stex->prev_invalidation)
|
|
||||||
{
|
|
||||||
gint64 interval = stex->last_invalidation - stex->prev_invalidation;
|
|
||||||
gboolean fast_update = interval < MIN_MIPMAP_AGE_USEC;
|
|
||||||
|
|
||||||
if (!fast_update)
|
|
||||||
stex->fast_updates = 0;
|
|
||||||
else if (stex->fast_updates < MIN_FAST_UPDATES_BEFORE_UNMIPMAP)
|
|
||||||
stex->fast_updates++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user