-
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ev3: fix display fb handling for new kernel #3
Conversation
Your image is RGBA, but the framebuffer is XRGB, so if you are writing the image directly to the framebuffer, it won't work exactly right. |
I was operating on the basis that the fb packing is big endian, which I got from the fbset source (in the absence of any real documentation to that effect - so certainly possible wrong). This means that the A will get put in the last slot and be ignored. If it is actually little endian, then I'll either have to wrap |
You could very well be right, but then wouldn't R and B would be swapped. If you go to the route of re-implementing, you might consider using an 8-bit grayscale image (the EV3 screen is actually only 2-bit grayscale, but 8-bit is the closest "standard" format). Then when you push the image to the screen, use the same 8-bit pixel value for each of RGB. |
I'll do the experiments to see if what is going on. As far as making the image type handle an 8 bit greyscale, that's handled by the stdlib image/color code; an image copy of a greyscale to the fb will just work. Do we have a gamut mapping of colour values to the grey scale bits, or it just linear? |
The kernel driver does the mapping from RGB to grayscale. /**
* tinydrm_xrgb8888_to_gray8 - Convert XRGB8888 to grayscale
* @dst: 8-bit grayscale destination buffer
* @vaddr: XRGB8888 source buffer
* @fb: DRM framebuffer
* @clip: Clip rectangle area to copy
*
* Drm doesn't have native monochrome or grayscale support.
* Such drivers can announce the commonly supported XR24 format to userspace
* and use this function to convert to the native format.
*
* Monochrome drivers will use the most significant bit,
* where 1 means foreground color and 0 background color.
*
* ITU BT.601 is used for the RGB -> luma (brightness) conversion.
*/ |
The code for that is very helpful. It looks like the endianism is machine-endian and (as the name suggests) In the kernel:
In
This means that all that's needed is the correct byte order to be written to the byte buffer that reflects the fb. |
This will fail since it will try to build against master. I'll ping after having done successful tests on actual hardware over the weekend. |
Tested and working (failure here is due to the dependency on the ev3dev-stretch branch). |
PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not much to see 😄
Indeed! |
@dlech Please take a look.
This was even easier than I had guessed.
Fixes #2.