This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project gfxprim.git.
The branch, master has been updated via 0c37dfaea46213d3c1564499de0849c451e1f326 (commit) via 9f103b51400ce326ec4d1d80693e3547a6ad2d24 (commit) via a0cc425717d82517e00ec3f5e02f5231c60fd6e1 (commit) via dc2499537b2ddc6bcc24015366d37df87653b1d9 (commit) via 027536fe29c61495b170e8ce0e04736496c619df (commit) from 1a6ee3086c94fc16d12a2115ca78501255758ea3 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- http://repo.or.cz/w/gfxprim.git/commit/0c37dfaea46213d3c1564499de0849c451e1f...
commit 0c37dfaea46213d3c1564499de0849c451e1f326 Author: Cyril Hrubis metan@ucw.cz Date: Wed Jun 12 21:49:50 2013 +0200
core: Fix warning on GP_GET_BITS(0, 32, val).
The change is cosmetic as the generated code remains the same (at least for x86_64).
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/include/core/GP_GetSetBits.h b/include/core/GP_GetSetBits.h index d724828..40d6b81 100644 --- a/include/core/GP_GetSetBits.h +++ b/include/core/GP_GetSetBits.h @@ -17,14 +17,25 @@ * Boston, MA 02110-1301 USA * * * * Copyright (C) 2011 Tomas Gavenciak gavento@ucw.cz * - * Copyright (C) 2011 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2011-2013 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
/*
- The macros are taking generally three arguments - + Helper macros to get/set bits given offset and lenght. + + The GP_GET_BITS() and GP_SET_BITS() works __ONLY__ on aligned data types. + Which means that you can only pass value that is suitably aligned for it's + type, for example passing an 32 bit integer is OK, passing a char buffer + casted to 32 bit integer is not (unless you made sure that the start address + is multiple of 4). + + Now the align-safe variants first gets the value from a buffer, byte by byte + and then uses the GP_GET_BITS() or GP_SET_BITS(). The number in their name + tells how much bytes are touched, as we need to touch minimal number of + bytes needed. + */
#ifndef CORE_GP_GET_SET_BITS_H @@ -37,12 +48,12 @@ * Note: operates with value types same as val */ #define GP_GET_BITS(offset, len, val) - ( ( (val)>>(offset) ) & ( ((((typeof(val))1)<<(len)) - 1) ) ) + (sizeof(val) * 8 <= len ? + (val)>>(offset) : + ((val)>>(offset)) & (((((typeof(val))1)<<(len)) - 1)))
/* * Align-safe getbits - * - * TODO: Fix big endian */ #define GP_GET_BITS4_ALIGNED(offset, len, val) ({ uint32_t v; @@ -90,9 +101,9 @@ * GP_SET_BITS does both */ #define GP_CLEAR_BITS(offset, len, dest) - ( (dest) &= ~(((((typeof(dest))1) << (len)) - 1) << (offset)) ) + ((dest) &= ~(((((typeof(dest))1) << (len)) - 1) << (offset)))
-#define GP_SET_BITS_OR(offset, dest, val) ( (dest) |= ((val)<<(offset)) ) +#define GP_SET_BITS_OR(offset, dest, val) ((dest) |= ((val)<<(offset)))
#define GP_SET_BITS(offset, len, dest, val) do { GP_CLEAR_BITS(offset, len, dest); diff --git a/libs/core/GP_Pixel.gen.c.t b/libs/core/GP_Pixel.gen.c.t index 077f4be..9dc56f8 100644 --- a/libs/core/GP_Pixel.gen.c.t +++ b/libs/core/GP_Pixel.gen.c.t @@ -61,8 +61,6 @@ const GP_PixelTypeDescription const GP_PixelTypes [GP_PIXEL_MAX] = { %% endfor };
-#warning FIXME: do generic get set bit for pixel printing - %% for pt in pixeltypes %% if not pt.is_unknown() /*
http://repo.or.cz/w/gfxprim.git/commit/9f103b51400ce326ec4d1d80693e3547a6ad2...
commit 9f103b51400ce326ec4d1d80693e3547a6ad2d24 Author: Cyril Hrubis metan@ucw.cz Date: Wed Jun 12 21:49:21 2013 +0200
tests: core: Add GetSetBits test.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/tests/core/GetSetBits.gen.c.t b/tests/core/GetSetBits.gen.c.t new file mode 100644 index 0000000..1f28cfd --- /dev/null +++ b/tests/core/GetSetBits.gen.c.t @@ -0,0 +1,130 @@ +/***************************************************************************** + * This file is part of gfxprim library. * + * * + * Gfxprim is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * Gfxprim is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with gfxprim; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * + * Boston, MA 02110-1301 USA * + * * + * Copyright (C) 2009-2013 Cyril Hrubis metan@ucw.cz * + * * + *****************************************************************************/ + +%% extends "base.test.c.t" + +{% block descr %}GP_GET_BITS() and GP_SET_BITS() tests.{% endblock %} + +%% block body + +#include <stdlib.h> +#include <stdint.h> +#include <core/GP_GetSetBits.h> +#include <core/GP_Common.h> +#include "tst_test.h" + +static const uint32_t patterns[] = { + 0x00000000, + 0xffffffff, + 0x55555555, + 0xaaaaaaaa, + 0x43f8af32, +}; + +%% for len in range(1, 33) +%% for off in range(0, 33 - len) +static int getbits_{{ off }}_{{ len }}(void) +{ + uint32_t p_exp, p_get; + unsigned int i, fail = 0; + + for (i = 0; i < GP_ARRAY_SIZE(patterns); i++) { + p_get = GP_GET_BITS({{ off }}, {{ len }}, patterns[i]); + p_exp = (patterns[i] >> {{ off }}) & {{ hex((2 ** len) - 1) }}; + + if (p_get != p_exp) { + tst_msg("Pattern 0x%08x differs get 0x%08x, expected 0x%08x", + patterns[i], p_get, p_exp); + fail++; + } else { + tst_msg("Pattern 0x%08x have 0x%08x", patterns[i], p_get); + } + } + + if (fail) + return TST_FAILED; + + return TST_SUCCESS; +} +%% endfor +%% endfor + +%% macro mask(off, len) +~{{ hex((2 ** len - 1) * (2 ** off)) }} +%%- endmacro + +%% for len in range(1, 33) +%% for off in range(0, 33 - len) +static int setbits_{{ off }}_{{ len }}(void) +{ + uint32_t p_exp, canary1, p_get, canary2, val; + unsigned int i, j, fail = 0; + + for (i = 0; i < GP_ARRAY_SIZE(patterns); i++) { + for (j = 0; j < GP_ARRAY_SIZE(patterns); j++) { + {# GP_SET_BITS() needs value clamped to the len #} + val = patterns[j] & {{ hex(2 ** len - 1) }}; + + canary1 = 0; + canary2 = 0; + p_get = patterns[i]; + GP_SET_BITS({{ off }}, {{ len }}, p_get, val); + + p_exp = patterns[i] & {{ mask(off, len) }}; + p_exp |= val<<{{ off }}; + + if (p_get != p_exp || canary1 != 0 || canary2 != 0) { + tst_msg("BG 0x%08x FG 0x%08x differs get 0x%08x, expected 0x%08x", + patterns[i], val, p_get, p_exp); + fail++; + } + } + } + + if (fail) + return TST_FAILED; + + return TST_SUCCESS; +} +%% endfor +%% endfor + +const struct tst_suite tst_suite = { + .suite_name = "GetSetBits testsuite", + .tests = { +%% for len in range(1, 33) +%% for off in range(0, 33 - len) + {.name = "GP_GET_BITS off={{ off }} len={{ len }}", + .tst_fn = getbits_{{ off }}_{{ len }}}, +%% endfor +%% endfor +%% for len in range(1, 33) +%% for off in range(0, 33 - len) + {.name = "GP_SET_BITS off={{ off }} len={{ len }}", + .tst_fn = setbits_{{ off }}_{{ len }}}, +%% endfor +%% endfor + {.name = NULL} + } +}; + +%% endblock body diff --git a/tests/core/Makefile b/tests/core/Makefile index c770fc5..3568fd0 100644 --- a/tests/core/Makefile +++ b/tests/core/Makefile @@ -5,10 +5,10 @@ include $(TOPDIR)/pre.mk CSOURCES=Context.c Pixel.c
GENSOURCES+=WritePixel.gen.c GetPutPixel.gen.c Convert.gen.c BlitConv.gen.c - Convert_Scale.gen.c + Convert_Scale.gen.c GetSetBits.gen.c
APPS=WritePixel.gen Pixel Context GetPutPixel.gen Convert.gen BlitConv.gen - Convert_Scale.gen + Convert_Scale.gen GetSetBits.gen
include ../tests.mk
diff --git a/tests/core/test_list.txt b/tests/core/test_list.txt index 3edab32..5fbaeba 100644 --- a/tests/core/test_list.txt +++ b/tests/core/test_list.txt @@ -2,6 +2,7 @@ WritePixel.gen Context Pixel +GetSetBits.gen GetPutPixel.gen Convert.gen Convert_Scale.gen
http://repo.or.cz/w/gfxprim.git/commit/a0cc425717d82517e00ec3f5e02f5231c60fd...
commit a0cc425717d82517e00ec3f5e02f5231c60fd6e1 Author: Cyril Hrubis metan@ucw.cz Date: Wed Jun 12 19:49:18 2013 +0200
pylib: Propagate floor() and ceil() to templates.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/pylib/gp_codegen/render_utils.py b/pylib/gp_codegen/render_utils.py index cf3d7d4..c5433ea 100644 --- a/pylib/gp_codegen/render_utils.py +++ b/pylib/gp_codegen/render_utils.py @@ -6,6 +6,7 @@ import logging as log import os import time import re +from math import floor, ceil
# Custom filters
@@ -56,6 +57,8 @@ def create_environment(config, template_dir): env.globals['int'] = int env.globals['float'] = float env.globals['round'] = round + env.globals['floor'] = floor + env.globals['ceil'] = ceil env.globals['min'] = min env.globals['max'] = max # Add custom filters
http://repo.or.cz/w/gfxprim.git/commit/dc2499537b2ddc6bcc24015366d37df87653b...
commit dc2499537b2ddc6bcc24015366d37df87653b1d9 Author: Cyril Hrubis metan@ucw.cz Date: Sun Jun 9 18:11:00 2013 +0200
core: Cleanup the GP_Pixel(SN)Print functions.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/build/syms/Core_symbols.txt b/build/syms/Core_symbols.txt index c04e144..10f0e5d 100644 --- a/build/syms/Core_symbols.txt +++ b/build/syms/Core_symbols.txt @@ -35,6 +35,9 @@ GP_PixelRGBMatch GP_PixelTypeByName GP_RGB888ToPixel
+GP_PixelPrint +GP_PixelSNPrint + GP_BlitXYXY GP_BlitXYXY_Fast GP_BlitXYWH diff --git a/include/core/GP_Pixel.gen.h.t b/include/core/GP_Pixel.gen.h.t index aab38df..e0c0a61 100644 --- a/include/core/GP_Pixel.gen.h.t +++ b/include/core/GP_Pixel.gen.h.t @@ -57,11 +57,6 @@ typedef enum GP_PixelType { %% endfor */
-/* - * snprintf a human readable value of pixel type {{ pt.name }} - */ -void GP_PixelSNPrint_{{ pt.name }}(char *buf, size_t len, GP_Pixel p); - /* * macros to get channels of pixel type {{ pt.name }} */ diff --git a/include/core/GP_Pixel.h b/include/core/GP_Pixel.h index 4a0806e..642f8b3 100644 --- a/include/core/GP_Pixel.h +++ b/include/core/GP_Pixel.h @@ -157,21 +157,12 @@ static inline const GP_PixelTypeDescription *GP_PixelTypeDesc(GP_PixelType type) * Print a human-readable representation of a pixel value to a string. * Arguments as for snprintf(). */ -static inline void GP_PixelSNPrint(char *buf, size_t len, GP_Pixel pixel, - GP_PixelType type) -{ - GP_FN_PER_PIXELTYPE(GP_PixelSNPrint, type, buf, len, pixel); -} +void GP_PixelSNPrint(char *buf, size_t len, GP_Pixel pixel, GP_PixelType type);
/* - * "printf" out a human-readable representation of pixel value. + * Prints human-readable representation of pixel value into the stdout. */ -static inline void GP_PixelPrint(GP_Pixel pixel, GP_PixelType type) -{ - char buf[256]; - GP_PixelSNPrint(buf, 256, pixel, type); - printf("%s", buf); -} +void GP_PixelPrint(GP_Pixel pixel, GP_PixelType type);
/* * Returns pixel type for passed human-readable name (e.g. RGB888). diff --git a/libs/core/GP_Pixel.gen.c.t b/libs/core/GP_Pixel.gen.c.t index 0511120..077f4be 100644 --- a/libs/core/GP_Pixel.gen.c.t +++ b/libs/core/GP_Pixel.gen.c.t @@ -44,7 +44,7 @@ Pixel type definitions and functions * Description of all known pixel types */ const GP_PixelTypeDescription const GP_PixelTypes [GP_PIXEL_MAX] = { -%% for pt in pixeltypes +%% for pt in pixeltypes /* GP_PIXEL_{{ pt.name }} */ { .type = GP_PIXEL_{{ pt.name }}, .name = "{{ pt.name }}", @@ -54,26 +54,39 @@ const GP_PixelTypeDescription const GP_PixelTypes [GP_PIXEL_MAX] = { .bitmap = "{{ pt.bits|join("") }}", .flags = 0{{ getflags(pt) }}, .channels = { -%% for c in pt.chanslist +%% for c in pt.chanslist { .name = "{{ c[0] }}", .offset = {{ c[1] }}, .size = {{ c[2] }} }, -%% endfor +%% endfor } }, -%% endfor +%% endfor };
#warning FIXME: do generic get set bit for pixel printing
-%% for pt in pixeltypes -%% if not pt.is_unknown() +%% for pt in pixeltypes +%% if not pt.is_unknown() /* * snprintf a human readable value of pixel type {{pt.name}} */ -void GP_PixelSNPrint_{{ pt.name }}(char *buf, size_t len, GP_Pixel p) +static void GP_PixelSNPrint_{{ pt.name }}(char *buf, size_t len, GP_Pixel p) { - snprintf(buf, len, "<{{ pt.name }} 0x%0{{ (pt.pixelsize.size+3)//4 }}x{% for c in pt.chanslist %} {{ c[0] }}=%d{% endfor %}>", - GP_GET_BITS(0, {{ pt.pixelsize.size }}, p){% for c in pt.chanslist %}, GP_GET_BITS({{ c[1] }}, {{ c[2] }}, p){% endfor %}); + snprintf(buf, len, "{{ pt.name }} 0x%0{{ (pt.pixelsize.size+3)//4 }}x{% for c in pt.chanslist %} {{ c[0] }}=%d{% endfor %}", + GP_GET_BITS(0, {{ pt.pixelsize.size }}, p){% for c in pt.chanslist %}, GP_Pixel_GET_{{ c.name}}_{{ pt.name }}(p){% endfor %}); +} + +%% endif +%% endfor + +void GP_PixelSNPrint(char *buf, size_t len, GP_Pixel p, GP_PixelType pixel_type) +{ + GP_FN_PER_PIXELTYPE(GP_PixelSNPrint, pixel_type, buf, len, p); +} + +void GP_PixelPrint(GP_Pixel p, GP_PixelType pixel_type) +{ + char buf[256]; + GP_PixelSNPrint(buf, sizeof(buf), p, pixel_type); + puts(buf); }
-%% endif -%% endfor %% endblock body
http://repo.or.cz/w/gfxprim.git/commit/027536fe29c61495b170e8ce0e04736496c61...
commit 027536fe29c61495b170e8ce0e04736496c619df Author: Cyril Hrubis metan@ucw.cz Date: Sun Jun 9 15:28:32 2013 +0200
build: Update list of exported symbols.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/build/syms/Input_symbols.txt b/build/syms/Input_symbols.txt index de44378..2062806 100644 --- a/build/syms/Input_symbols.txt +++ b/build/syms/Input_symbols.txt @@ -9,6 +9,8 @@ GP_InputDriverKBDEventPut GP_EventQueueSetCursorPosition GP_EventQueueSetScreenSize GP_EventQueueGet +GP_EventQueuePeek +GP_EventQueuePutBack GP_EventQueueEventsQueued GP_EventQueueInit GP_EventQueueFree
-----------------------------------------------------------------------
Summary of changes: build/syms/Core_symbols.txt | 3 + build/syms/Input_symbols.txt | 2 + include/core/GP_GetSetBits.h | 27 ++++++--- include/core/GP_Pixel.gen.h.t | 5 -- include/core/GP_Pixel.h | 15 +---- libs/core/GP_Pixel.gen.c.t | 37 +++++++---- pylib/gp_codegen/render_utils.py | 3 + tests/core/GetSetBits.gen.c.t | 130 ++++++++++++++++++++++++++++++++++++++ tests/core/Makefile | 4 +- tests/core/test_list.txt | 1 + 10 files changed, 187 insertions(+), 40 deletions(-) create mode 100644 tests/core/GetSetBits.gen.c.t
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos@gmail.com if you want to unsubscribe, or site admin admin@repo.or.cz if you receive no reply.