GUAC-669: Limit how high the fill pattern heuristic is allowed to increase update cost.

This commit is contained in:
Michael Jumper 2014-05-05 11:17:38 -07:00
parent c5ada6631c
commit 014e245baa

View File

@ -28,6 +28,7 @@
#include <guacamole/protocol.h> #include <guacamole/protocol.h>
#include <guacamole/socket.h> #include <guacamole/socket.h>
#include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
@ -64,6 +65,13 @@
*/ */
#define GUAC_SURFACE_NEGLIGIBLE_INCREASE 4 #define GUAC_SURFACE_NEGLIGIBLE_INCREASE 4
/**
* If combining an update because it appears to be follow a fill pattern,
* the combined cost must not exceed
* GUAC_SURFACE_FILL_PATTERN_FACTOR * (total uncombined cost).
*/
#define GUAC_SURFACE_FILL_PATTERN_FACTOR 3
/* Define cairo_format_stride_for_width() if missing */ /* Define cairo_format_stride_for_width() if missing */
#ifndef HAVE_CAIRO_FORMAT_STRIDE_FOR_WIDTH #ifndef HAVE_CAIRO_FORMAT_STRIDE_FOR_WIDTH
#define cairo_format_stride_for_width(format, width) (width*4) #define cairo_format_stride_for_width(format, width) (width*4)
@ -178,8 +186,10 @@ static int __guac_common_should_combine(guac_common_surface* surface, int x, int
return 1; return 1;
/* Combine if we anticipate further updates, as this update follows a common fill pattern */ /* Combine if we anticipate further updates, as this update follows a common fill pattern */
if (x == surface->dirty_x && y == surface->dirty_y + surface->dirty_height) if (x == surface->dirty_x && y == surface->dirty_y + surface->dirty_height) {
if (combined_cost <= (dirty_cost + update_cost) * GUAC_SURFACE_FILL_PATTERN_FACTOR)
return 1; return 1;
}
} }