From a71d524ecad48837e0124a03124bc05f59a48be7 Mon Sep 17 00:00:00 2001 From: marha Date: Thu, 30 Apr 2015 23:24:30 +0200 Subject: fontconfig pixman libX11 mesa git update 30 Apr 2015 libX11 commit d3415d1f052530760b4617db45affcb984cfe35c pixman commit e0c0153d8e5d42c08c2b9bd2cf2123bff2c48d75 fontconfig commit 4a6f5efd5f6a468e1872d58e589bcf30ba88e2fd mesa commit 1ac7db07b363207e8ded9259f84bbcaa084b8667 --- mesalib/src/gallium/auxiliary/Android.mk | 5 +- mesalib/src/gallium/auxiliary/hud/hud_context.c | 163 +++++++++++++++++++++++- mesalib/src/gallium/auxiliary/hud/hud_private.h | 4 + mesalib/src/gallium/auxiliary/util/u_tile.c | 4 +- mesalib/src/gallium/auxiliary/util/u_video.h | 36 ++++++ 5 files changed, 201 insertions(+), 11 deletions(-) (limited to 'mesalib/src/gallium/auxiliary') diff --git a/mesalib/src/gallium/auxiliary/Android.mk b/mesalib/src/gallium/auxiliary/Android.mk index 0bc183170..96a2125de 100644 --- a/mesalib/src/gallium/auxiliary/Android.mk +++ b/mesalib/src/gallium/auxiliary/Android.mk @@ -33,14 +33,13 @@ LOCAL_SRC_FILES := \ $(VL_STUB_SOURCES) LOCAL_C_INCLUDES := \ - $(GALLIUM_TOP)/auxiliary/util \ - $(MESA_TOP)/src + $(GALLIUM_TOP)/auxiliary/util LOCAL_MODULE := libmesa_gallium # generate sources LOCAL_MODULE_CLASS := STATIC_LIBRARIES -intermediates := $(call local-intermediates-dir) +intermediates := $(call local-generated-sources-dir) LOCAL_GENERATED_SOURCES := $(addprefix $(intermediates)/, $(GENERATED_SOURCES)) $(LOCAL_GENERATED_SOURCES): PRIVATE_PYTHON := $(MESA_PYTHON2) diff --git a/mesalib/src/gallium/auxiliary/hud/hud_context.c b/mesalib/src/gallium/auxiliary/hud/hud_context.c index e46c68cdd..00ec20589 100644 --- a/mesalib/src/gallium/auxiliary/hud/hud_context.c +++ b/mesalib/src/gallium/auxiliary/hud/hud_context.c @@ -569,9 +569,36 @@ hud_pane_set_max_value(struct hud_pane *pane, uint64_t value) pane->yscale = -(int)pane->inner_height / (float)pane->max_value; } +static void +hud_pane_update_dyn_ceiling(struct hud_graph *gr, struct hud_pane *pane) +{ + unsigned i; + float tmp = 0.0f; + + if (pane->dyn_ceil_last_ran != gr->index) { + LIST_FOR_EACH_ENTRY(gr, &pane->graph_list, head) { + for (i = 0; i < gr->num_vertices; ++i) { + tmp = gr->vertices[i * 2 + 1] > tmp ? + gr->vertices[i * 2 + 1] : tmp; + } + } + + /* Avoid setting it lower than the initial starting height. */ + tmp = tmp > pane->initial_max_value ? tmp : pane->initial_max_value; + hud_pane_set_max_value(pane, tmp); + } + + /* + * Mark this adjustment run so we could avoid repeating a full update + * again needlessly in case the pane has more than one graph. + */ + pane->dyn_ceil_last_ran = gr->index; +} + static struct hud_pane * hud_pane_create(unsigned x1, unsigned y1, unsigned x2, unsigned y2, - unsigned period, uint64_t max_value) + unsigned period, uint64_t max_value, uint64_t ceiling, + boolean dyn_ceiling) { struct hud_pane *pane = CALLOC_STRUCT(hud_pane); @@ -590,6 +617,10 @@ hud_pane_create(unsigned x1, unsigned y1, unsigned x2, unsigned y2, pane->inner_height = pane->inner_y2 - pane->inner_y1; pane->period = period; pane->max_num_vertices = (x2 - x1 + 2) / 2; + pane->ceiling = ceiling; + pane->dyn_ceiling = dyn_ceiling; + pane->dyn_ceil_last_ran = 0; + pane->initial_max_value = max_value; hud_pane_set_max_value(pane, max_value); LIST_INITHEAD(&pane->graph_list); return pane; @@ -633,6 +664,9 @@ hud_pane_add_graph(struct hud_pane *pane, struct hud_graph *gr) void hud_graph_add_value(struct hud_graph *gr, uint64_t value) { + gr->current_value = value; + value = value > gr->pane->ceiling ? gr->pane->ceiling : value; + if (gr->index == gr->pane->max_num_vertices) { gr->vertices[0] = 0; gr->vertices[1] = gr->vertices[(gr->index-1)*2+1]; @@ -646,7 +680,9 @@ hud_graph_add_value(struct hud_graph *gr, uint64_t value) gr->num_vertices++; } - gr->current_value = value; + if (gr->pane->dyn_ceiling == true) { + hud_pane_update_dyn_ceiling(gr, gr->pane); + } if (value > gr->pane->max_value) { hud_pane_set_max_value(gr->pane, value); } @@ -683,6 +719,69 @@ parse_string(const char *s, char *out) return i; } +static char * +read_pane_settings(char *str, unsigned * const x, unsigned * const y, + unsigned * const width, unsigned * const height, + uint64_t * const ceiling, boolean * const dyn_ceiling) +{ + char *ret = str; + unsigned tmp; + + while (*str == '.') { + ++str; + switch (*str) { + case 'x': + ++str; + *x = strtoul(str, &ret, 10); + str = ret; + break; + + case 'y': + ++str; + *y = strtoul(str, &ret, 10); + str = ret; + break; + + case 'w': + ++str; + tmp = strtoul(str, &ret, 10); + *width = tmp > 80 ? tmp : 80; /* 80 is chosen arbitrarily */ + str = ret; + break; + + /* + * Prevent setting height to less than 50. If the height is set to less, + * the text of the Y axis labels on the graph will start overlapping. + */ + case 'h': + ++str; + tmp = strtoul(str, &ret, 10); + *height = tmp > 50 ? tmp : 50; + str = ret; + break; + + case 'c': + ++str; + tmp = strtoul(str, &ret, 10); + *ceiling = tmp > 10 ? tmp : 10; + str = ret; + break; + + case 'd': + ++str; + ret = str; + *dyn_ceiling = true; + break; + + default: + fprintf(stderr, "gallium_hud: syntax error: unexpected '%c'\n", *str); + } + + } + + return ret; +} + static boolean has_occlusion_query(struct pipe_screen *screen) { @@ -705,11 +804,15 @@ static void hud_parse_env_var(struct hud_context *hud, const char *env) { unsigned num, i; - char name[256], s[256]; + char name_a[256], s[256]; + char *name; struct hud_pane *pane = NULL; unsigned x = 10, y = 10; unsigned width = 251, height = 100; unsigned period = 500 * 1000; /* default period (1/2 second) */ + uint64_t ceiling = UINT64_MAX; + unsigned column_width = 251; + boolean dyn_ceiling = false; const char *period_env; /* @@ -725,11 +828,23 @@ hud_parse_env_var(struct hud_context *hud, const char *env) } } - while ((num = parse_string(env, name)) != 0) { + while ((num = parse_string(env, name_a)) != 0) { env += num; + /* check for explicit location, size and etc. settings */ + name = read_pane_settings(name_a, &x, &y, &width, &height, &ceiling, + &dyn_ceiling); + + /* + * Keep track of overall column width to avoid pane overlapping in case + * later we create a new column while the bottom pane in the current + * column is less wide than the rest of the panes in it. + */ + column_width = width > column_width ? width : column_width; + if (!pane) { - pane = hud_pane_create(x, y, x + width, y + height, period, 10); + pane = hud_pane_create(x, y, x + width, y + height, period, 10, + ceiling, dyn_ceiling); if (!pane) return; } @@ -807,6 +922,7 @@ hud_parse_env_var(struct hud_context *hud, const char *env) if (num && sscanf(s, "%u", &i) == 1) { hud_pane_set_max_value(pane, i); + pane->initial_max_value = i; } else { fprintf(stderr, "gallium_hud: syntax error: unexpected '%c' (%i) " @@ -826,6 +942,7 @@ hud_parse_env_var(struct hud_context *hud, const char *env) case ',': env++; y += height + hud->font.glyph_height * (pane->num_graphs + 2); + height = 100; if (pane && pane->num_graphs) { LIST_ADDTAIL(&pane->head, &hud->pane_list); @@ -836,17 +953,27 @@ hud_parse_env_var(struct hud_context *hud, const char *env) case ';': env++; y = 10; - x += width + hud->font.glyph_width * 7; + x += column_width + hud->font.glyph_width * 7; + height = 100; if (pane && pane->num_graphs) { LIST_ADDTAIL(&pane->head, &hud->pane_list); pane = NULL; } + + /* Starting a new column; reset column width. */ + column_width = 251; break; default: fprintf(stderr, "gallium_hud: syntax error: unexpected '%c'\n", *env); } + + /* Reset to defaults for the next pane in case these were modified. */ + width = 251; + ceiling = UINT64_MAX; + dyn_ceiling = false; + } if (pane) { @@ -878,6 +1005,30 @@ print_help(struct pipe_screen *screen) puts(""); puts(" Example: GALLIUM_HUD=\"cpu,fps;primitives-generated\""); puts(""); + puts(" Additionally, by prepending '.[identifier][value]' modifiers to"); + puts(" a name, it is possible to explicitly set the location and size"); + puts(" of a pane, along with limiting overall maximum value of the"); + puts(" Y axis and activating dynamic readjustment of the Y axis."); + puts(" Several modifiers may be applied to the same pane simultaneously."); + puts(""); + puts(" 'x[value]' sets the location of the pane on the x axis relative"); + puts(" to the upper-left corner of the viewport, in pixels."); + puts(" 'y[value]' sets the location of the pane on the y axis relative"); + puts(" to the upper-left corner of the viewport, in pixels."); + puts(" 'w[value]' sets width of the graph pixels."); + puts(" 'h[value]' sets height of the graph in pixels."); + puts(" 'c[value]' sets the ceiling of the value of the Y axis."); + puts(" If the graph needs to draw values higher than"); + puts(" the ceiling allows, the value is clamped."); + puts(" 'd' activates dynamic Y axis readjustment to set the value of"); + puts(" the Y axis to match the highest value still visible in the graph."); + puts(""); + puts(" If 'c' and 'd' modifiers are used simultaneously, both are in effect:"); + puts(" the Y axis does not go above the restriction imposed by 'c' while"); + puts(" still adjusting the value of the Y axis down when appropriate."); + puts(""); + puts(" Example: GALLIUM_HUD=\".w256.h64.x1600.y520.d.c1000fps+cpu,.datom-count\""); + puts(""); puts(" Available names:"); puts(" fps"); puts(" cpu"); diff --git a/mesalib/src/gallium/auxiliary/hud/hud_private.h b/mesalib/src/gallium/auxiliary/hud/hud_private.h index 1606ada4a..230f02664 100644 --- a/mesalib/src/gallium/auxiliary/hud/hud_private.h +++ b/mesalib/src/gallium/auxiliary/hud/hud_private.h @@ -62,6 +62,10 @@ struct hud_pane { float yscale; unsigned max_num_vertices; uint64_t max_value; + uint64_t initial_max_value; + uint64_t ceiling; + unsigned dyn_ceil_last_ran; + boolean dyn_ceiling; boolean uses_byte_units; uint64_t period; /* in microseconds */ diff --git a/mesalib/src/gallium/auxiliary/util/u_tile.c b/mesalib/src/gallium/auxiliary/util/u_tile.c index 8e199200f..b91bb413a 100644 --- a/mesalib/src/gallium/auxiliary/util/u_tile.c +++ b/mesalib/src/gallium/auxiliary/util/u_tile.c @@ -341,13 +341,13 @@ x32_s8_get_tile_rgba(const unsigned *src, unsigned i, j; for (i = 0; i < h; i++) { - float *pRow = p; + uint32_t *pRow = (uint32_t *)p; for (j = 0; j < w; j++, pRow += 4) { src++; pRow[0] = pRow[1] = pRow[2] = - pRow[3] = (float)(*src++ & 0xff); + pRow[3] = (*src++ & 0xff); } p += dst_stride; } diff --git a/mesalib/src/gallium/auxiliary/util/u_video.h b/mesalib/src/gallium/auxiliary/util/u_video.h index 45b2d6e76..b4743d13f 100644 --- a/mesalib/src/gallium/auxiliary/util/u_video.h +++ b/mesalib/src/gallium/auxiliary/util/u_video.h @@ -38,6 +38,7 @@ extern "C" { /* u_reduce_video_profile() needs these */ #include "pipe/p_compiler.h" #include "util/u_debug.h" +#include "util/u_math.h" static INLINE enum pipe_video_format u_reduce_video_profile(enum pipe_video_profile profile) @@ -146,6 +147,41 @@ u_copy_swap422_packed(void *const *destination_data, } } +static INLINE uint32_t +u_get_h264_level(uint32_t width, uint32_t height, uint32_t *max_reference) +{ + uint32_t max_dpb_mbs; + + width = align(width, 16); + height = align(height, 16); + + /* Max references will be used for caculation of number of DPB buffers + in the UVD driver, limitation of max references is 16. Some client + like mpv application for VA-API, it requires references more than that, + so we have to set max of references to 16 here. */ + *max_reference = MIN2(*max_reference, 16); + max_dpb_mbs = (width / 16) * (height / 16) * *max_reference; + + /* The calculation is based on "Decoded picture buffering" section + from http://en.wikipedia.org/wiki/H.264/MPEG-4_AVC */ + if (max_dpb_mbs <= 8100) + return 30; + else if (max_dpb_mbs <= 18000) + return 31; + else if (max_dpb_mbs <= 20480) + return 32; + else if (max_dpb_mbs <= 32768) + return 41; + else if (max_dpb_mbs <= 34816) + return 42; + else if (max_dpb_mbs <= 110400) + return 50; + else if (max_dpb_mbs <= 184320) + return 51; + else + return 52; +} + #ifdef __cplusplus } #endif -- cgit v1.2.3