really - i prefer it and if we hit the 2gb limit of a signed int for
bytes added to a textblock... thats the day we will need evas 2 :)
SVN revision: 52576
* add information about modules "=static" suffix.
* fix lots of typos spotted by emacs "flyspell-mode".
* add more spacing and separator lines around sections.
SVN revision: 52477
There is no meaning in negative values for image loading, marking as
dirty or size, so image internals (cache, entry) were changed to
unsigned, reducing possible errors, particularly with overflow.
engines were converted to the new way, but any 3rd party modules will
still work as they should be using values >= 0 only anyway.
please review.
new cases introduced by "comparison between signed and unsigned" were
fixed in the modules that used cache_entry or Image_Entry dimensions.
SVN revision: 52428
As we're heading for a release we better remove as much errors as
possible and as the first step I'm removing warnings due unused
parameters, variables and functions. These tend to pollute real errors
spotted by -Wall and clang/llvm.
This does not fixes all, just the clear that could be set to
__UNUSED__, particularly to do (and I'd like some help from the
authors):
* src/lib/engines/common/evas_font_{draw,query}.c (tasn):
intl_props is just used while doing BIDI, but also used in other
#ifdef blocks :-/
* evas_map_* (raster):
huge amount of warnings, code is quite confusing and thus I'm not
touching it. I have no idea whenever the commented blocks or extra
parameters are intended to be used or no.
* src/modules/engines/fbevas_fb_main.c (raster?):
is fb_setvt() to be used? If not do you mind removing it?
* src/modules/engines/gl_{common,x11} (raster):
huge amount of warnings, code is quite nested and full of #ifdefs
that does not help to give a clear picture of what's going on.
* src/bin/evas_cserve_main.c (raster):
I could have ignored most of the errors, but is the code correct? I
mean, there is no unload of images being applied. If you confirm
none of those warnings are harmful I can flag them as unused.
* src/lib/engines/common_8 (dottedmag):
lots of unused functions that were acquired from common_16, they
are unused and if they will not, then they should be removed.
SVN revision: 52421
soft16 was written as a single engine, thus it was all static/global
and had no EAPI in its functions, but then it was moved into
"src/lib/common_16" and got that, but got no prefix! That could cause
clash with other libraries, so adding such prefix.
soft8 was a copy of 16, thus had the same problems.
the engines were all based on software_x11, thus they defined the same
methods to deal with Xlib, however if you link them all in the same
binary (--enable-MODULE=static), the symbol would be redefined. Rename
symbols according to their module.
SVN revision: 52420
Advantages:
* it is the simplest method to implement
Disadvantages:
* it's slow
* it does not take into account transparency
* it does not work with the composite manager (Windows >= Vista)
Layered windows should be used (all the disadvantaged above are
fixed), but i've never succeeded in making them work.
SVN revision: 52416
Make this function recursive, so it can adjust the coords for all
parent objects. It starts with the grand-grand-grand-...-parent and goes
down until the same object.
SVN revision: 52407
We are iterating EINA_INLIST_REVERSE_FOREACH(list, obj) in a recursive
function. Don't mark the other objects as havemap_parent if the first
in the list has it.
SVN revision: 52403
The solution is that we only delete invisible standalones now, not visible ones, this is correct intuitively and of course fixes the bug.
SVN revision: 52302
I removed a function that caused the issue and made no sense at all, honestly, it didn't make any sense.
I did a lot of testing trying to see if there are any new bugs after the fix, and nothing, so I guess my instincts were correct.
Please if you can, check out the removed function (_layout_walk_back_to_item_word_redo) and see if it makes any sense to you, if it does, please let me know.
SVN revision: 52243
Add two new canvas level callbacks: OBJECT_FOCUS_IN/OUT
As we already had callbacks for objects gaining or losing focus, then
two more for the Canvas, now we can have the entire Evas be notified when
any object changes its focused status. The object in question is passed
as the event_info for the callback.
SVN revision: 52196
Assert cache->usage never becomes negative as was occurring before the
fix in r52149.
Just in time, the fix in r52149 was made by Ulisses, not me.
SVN revision: 52190
Memory usage was not accounted right because
cache->func.mem_size_get(ie) returns 0 when called after
cache->func.destructor(ie). Thus the total memory used, kept on
cache->usage, is never decremented in _evas_cache_image_remove_activ()
This implies that cache->usage will keep growing and eventually it will
overflow, becoming negative. So evas_cache_image_flush() will not do its
job because cache->limit (assumed to be positive) will not be less than
cache->usage anymore. So the total memory allocated will start to grow
and the limit won't be respected.
Strictly speaking, it's not a leak, since all the memory will be
eventually freed when evas shutdown is called, but the program might be
killed by over allocating memory. This is caught by valgrind with the
massif tool. The graphic below shows that in the end a huge memory amount
is allocated. This is the moment when cache->usage became negative.
MB
26.04^ #
| #::::
| #::::
| #::::
| #::::
| #::::
| #::::
| #::::
| #::::
| #::::
| #::::
| #::::
| #::::
| #::::
| #::::
| #::::
| #::::
| #::::
| :::::::::::::::::@@:::::::::@:::@::::::@::::::::::::::::::::::::::#::::
| : ::: ::: ::: :::@ :: ::: : @:: @:: :::@: :: ::: : : :: :: : ::: :#::::
0 +----------------------------------------------------------------------->Gi
0 54.83
This patch is a one line fix, which swaps the calls to
_evas_cache_image_remove_activ() and cache->func.destructor() making
cache->limit to be respected.
SVN revision: 52149
Lowering priority was wrong. Some bugs:
1) You don't lower the priority by setting the scheduler policy to some
of the real-time ones (SCHED_RR or SCHER_FIFO). If you do so, you are
actually increasing the priority of the workers and your main thread
you be preempted and stalled until the workers complete their job.
Fortunately this will only happen if your programming is running as
root, as normal users (without CAP_SYS_NICE) are unable to set
priority to real-time values.
2) setpriority() and getpriority() are not part of pthread and you can't
use the id returned by pthread. Manpage explicitly says so on
pthread_self(3):
"The thread ID returned by pthread_self() is not the same thing as the
kernel thread ID returned by a call to gettid(2)."
Since glibc does not have a gettid, here we are using
syscall(SYS_gettid)
This patch was tested with the program below. Compile and run:
$ gcc p_hello2.c -o p_hello2 -lpthread
$ ./p_hello2 10
You'll see that the main thread remains with its priority and threads
created by the main thread change their own niceness.
#include <errno.h>
#include <pthread.h>
#include <sched.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/resource.h>
#include <sys/syscall.h>
#include <sys/time.h>
#include <sys/types.h>
/* Lower priority of current thread.
*
* It's used by worker threads so they use up "bg cpu" as it was really intended
* to work. If current thread is running with real-time priority, we decrease
* our priority by 5. This is done in a portable way. Otherwise we are
* running with SCHED_OTHER policy and there's no portable way to set the nice
* level on current thread. In Linux, it does work and it's the only one that is
* implemented.
*/
static void
_ecore_thread_pri_drop(void)
{
struct sched_param param;
int pol, prio, ret;
pid_t tid;
pthread_t pthread_id;
pthread_id = pthread_self();
ret = pthread_getschedparam(pthread_id, &pol, ¶m);
if (ret)
{
fprintf(stderr, "Unable to query sched parameters\n");
return;
}
if (pol == SCHED_RR || pol == SCHED_FIFO)
{
prio = sched_get_priority_max(pol);
param.sched_priority += 5;
if (prio > 0 && param.sched_priority > prio)
param.sched_priority = prio;
pthread_setschedparam(pthread_id, pol, ¶m);
}
#ifdef __linux__
else
{
tid = syscall(SYS_gettid);
errno = 0;
prio = getpriority(PRIO_PROCESS, tid);
if (errno == 0)
{
prio += 5;
if (prio > 19)
prio = 19;
setpriority(PRIO_PROCESS, tid, prio);
}
}
#endif
}
/*
* p_hello.c -- a hello program (in pthread)
*/
#define MAX_THREAD 1000
typedef struct {
int id;
} parm;
void *hello(void *arg)
{
parm *p=(parm *)arg;
pid_t tid;
int prio;
tid = syscall(SYS_gettid);
printf("[%d] Hello from node %d\n", tid, p->id);
pthread_yield();
printf("[%d] HELLO!\n", tid);
_ecore_thread_pri_drop();
prio = getpriority(PRIO_PROCESS, tid);
printf("[%d] New nice value: %d\n", tid, prio);
return (NULL);
}
int main(int argc, char* argv[]) {
int n,i;
pthread_t *threads;
pthread_attr_t pthread_custom_attr;
parm *p;
pid_t tid;
int prio;
if (argc != 2)
{
printf ("Usage: %s n\n where n is no. of threads\n",argv[0]);
exit(1);
}
n=atoi(argv[1]);
if ((n < 1) || (n > MAX_THREAD)) {
printf ("The no of thread should between 1 and %d.\n",MAX_THREAD);
exit(1);
}
threads = (pthread_t *)malloc(n * sizeof(*threads));
pthread_attr_init(&pthread_custom_attr);
p = (parm *)malloc(n * sizeof(parm));
/* Start up thread */
tid = syscall(SYS_gettid);
for (i=0; i<n; i++) {
prio = getpriority(PRIO_PROCESS, tid);
printf("[%d] root thread nice value: %d\n", tid, prio);
p[i].id=i;
pthread_create(&threads[i], &pthread_custom_attr, hello, (void *)(p+i));
}
/* Synchronize the completion of each thread. */
for (i=0; i<n; i++) {
pthread_join(threads[i],NULL);
}
free(p);
return 0;
}
SVN revision: 52040