You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Use native implementation of grey-to-RGB conversion for display update #501
This change should do it for the EV3; IIRC, other platforms will need their own solution to handle the extra bit used for the green channel.
The things that blocked me from opening a PR for that change originally were A) needing to test on the EV3 and B) needing to try with python3. (or, I suppose B is a prereq to testing with our library on A.) Hopefully I can get some time to build in Docker and figure out the Python targets.
But this does not include the time that it takes to import our Display library...that has gone up significantly. I did not time it before but it now takes 47s just to from ev3dev2.display import Display :(
What version of Pillow ships with ev3dev? (not in front of my ev3 at the moment). Something to try would be to apply @WasabiFan 's patch to that version and see what we get.
the list is only of length 68352, this causes an IndexError: mmap slice assignment is wrong size exception. The original size of self.mmap is determined by FbMem._get_fix_info(fid)'s smem_len...the fix_info.smem_len is used in _map_fb_memory.
For grins I hacked _map_fb_memory to use a size of 68352, re-ran my test with "RGB" and got 22050ms, 20909ms, and 21051ms.
What version of Pillow ships with ev3dev? (not in front of my ev3 at the moment). Something to try would be to apply @WasabiFan 's patch to that version and see what we get.
pillow takes drastically longer to import and about 2x as long to update the screen in v5.3 (what your master is based off of) vs v4.0.0 (what ev3dev ships with today)
I don't see any speed benefit when switching from XRGB to RGB (with your patch)
Are you sure it's a matter of the different version rather than different build parameters?
Are you saying that you think the implementation for L->RBG packing I added isn't what is needed? Does it not do what we previously intended to do? (You can look at the Pillow test I added to see what it does.)
What build parameters are used for the pillow install that ships on ev3dev? To build I changed all of pip to pip3 and python to python3 in the Makefile. That was all I changed.
Well that's... Cool... I'm not sure what's going on there. Perhaps a Python version issue — maybe there's a better-supported way of working with python3. Or maybe it's an endianness or word size issue. I know the tests passed when I initially implemented it, but I think I was doing that on a desktop.
Also, I think I was wrong earlier; we want to use "RGBA" not RGB".
On 4.0.x I got 21707ms so something about how I am building this has a significant impact. This is starting to feel like more trouble than it is worth...
To be clear... This is still 2X slower than what we have now, right? If so, there's something wrong. I might be able to take a closer look this weekend.
I got it to compile that week but then ran into an issue getting the module recognized by python3. I'll self-assign this and take a look after finals are over.
Activity
WasabiFan commentedon Mar 30, 2019
Do we have interest in pursuing this? I never actually got to testing it on the EV3 but I can if the perf boost is beneficial.
dwalton76 commentedon Apr 18, 2019
I'll give it a try on my EV3
dwalton76 commentedon Apr 18, 2019
Testing with this:
I ran it three times to get a baseline:
WasabiFan commentedon Apr 18, 2019
That's without the Pillow patch, right?
dwalton76 commentedon Apr 18, 2019
right....Pillow is still building :( Am going to test on
masteron your fork thengreyscale-to-rgb-packerdwalton76 commentedon Apr 18, 2019
With
masteron your fork I gotBut this does not include the time that it takes to import our Display library...that has gone up significantly. I did not time it before but it now takes 47s just to
from ev3dev2.display import Display:(dwalton76 commentedon Apr 19, 2019
With the patch I get
dwalton76 commentedon Apr 19, 2019
What version of Pillow ships with ev3dev? (not in front of my ev3 at the moment). Something to try would be to apply @WasabiFan 's patch to that version and see what we get.
WasabiFan commentedon Apr 19, 2019
I believe this also requires changing the Python library to use the native packer. Should be...
dwalton76 commentedon Apr 19, 2019
Today when we do
we get back a list of size 91136 but with
the list is only of length 68352, this causes an
IndexError: mmap slice assignment is wrong sizeexception. The original size of self.mmap is determined byFbMem._get_fix_info(fid)'ssmem_len...thefix_info.smem_lenis used in_map_fb_memory.For grins I hacked _map_fb_memory to use a size of 68352, re-ran my test with "RGB" and got 22050ms, 20909ms, and 21051ms.
WasabiFan commentedon Apr 19, 2019
Which platform are you running this on? It is only applicable on EV3.
dwalton76 commentedon Apr 19, 2019
Am running on an EV3.
System info (from
ev3dev-sysinfo)dwalton76 commentedon Apr 19, 2019
We are running 4.0.0-4
WasabiFan commentedon Apr 19, 2019
Right now, your measurements are showing that the change doesn't improve performance, right?
dwalton76 commentedon Apr 19, 2019
Right...findings to this point are:
WasabiFan commentedon Apr 19, 2019
Are you sure it's a matter of the different version rather than different build parameters?
Are you saying that you think the implementation for L->RBG packing I added isn't what is needed? Does it not do what we previously intended to do? (You can look at the Pillow test I added to see what it does.)
dwalton76 commentedon Apr 19, 2019
What build parameters are used for the pillow install that ships on ev3dev? To build I changed all of
piptopip3andpythontopython3in the Makefile. That was all I changed.The test cases appear to be a dumpster fire :(
WasabiFan commentedon Apr 19, 2019
Well that's... Cool... I'm not sure what's going on there. Perhaps a Python version issue — maybe there's a better-supported way of working with python3. Or maybe it's an endianness or word size issue. I know the tests passed when I initially implemented it, but I think I was doing that on a desktop.
Also, I think I was wrong earlier; we want to use "RGBA" not RGB".
dwalton76 commentedon Apr 19, 2019
Lets try your patch against their
6.0.xbranch and see what we get.dwalton76 commentedon Apr 19, 2019
I am scratching my head over how they build for python3 though...changing the Makefile like this feels a bit hackish
dwalton76 commentedon Apr 19, 2019
On
6.0.xwith your patch applied I got 23277ms, that was with this which does not have the mmap size mismatch issue.When I was using
I got an
ValueError: No packer found from RGB to RGBAexception. Side NOTE, our Display library is still taking about 50s to import.I am going to drop down to
4.0.xand see what sort of times we get to see if there is something about how I am building this that is having an impact.dwalton76 commentedon Apr 20, 2019
On 4.0.x I got 21707ms so something about how I am building this has a significant impact. This is starting to feel like more trouble than it is worth...
WasabiFan commentedon Apr 20, 2019
Don't do the "convert". Just toBytes.
dwalton76 commentedon Apr 20, 2019
ok back to
6.0.xwith your patch andI got 21682ms. I went back to using XRGB and got 22923ms.
WasabiFan commentedon Apr 20, 2019
To be clear... This is still 2X slower than what we have now, right? If so, there's something wrong. I might be able to take a closer look this weekend.
dwalton76 commentedon Apr 20, 2019
yeah 4.0.0 that ships with ev3dev takes ~12000ms, 4.0.0 that I bulid/install from their git repo takes ~22000ms.
dwalton76 commentedon Jun 8, 2019
@WasabiFan thoughts on this?
WasabiFan commentedon Jun 9, 2019
I got it to compile that week but then ran into an issue getting the module recognized by python3. I'll self-assign this and take a look after finals are over.