-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Setting dispmanx resource palette when using VC_IMAGE_8BPP pixel format #95
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
Comments
Can I confirm if you need a single 256 entry colour palette with an 8bpp framebuffer, and all resources should use this palette. Or |
Hi popcornmix! Thanks for answering :) I already have two 8bpp resources (since my backend uses double buffer to avoid tearing), wich I created with pix_format = VC_IMAGE_8BPP; dispvars->resources[0] = vc_dispmanx_resource_create( dispvars->resources[1] = vc_dispmanx_resource_create( The programs using SDL1.2.x must be able to set the palette on the video SDL_Surface using SDL_SetPalette(). vc_dispmanx_resource_write_data( dispvars->resources[flip_page], Now, the problem is that colors are totally messed up with 8BPP resources, so I guess these resources should have a way to have their palettes changed, accoring to the palette in the SDL_Surface whose pixels field is used to draw the final frame. SO I believe what I need is an 256 colors palette, just one for both resources, wich can be updated (changed) anytime before I call vc_dispmanx_resource_write_data(): An SDL_Color is 8x8x8, yes, but the values it can take inside a palette are limited to a given 256 set of combinations in a given moment for a given surface. |
What I need to know is what is the maximum number of different palettes you need in total for a given instance in time? |
I should need only a palette at a given time for every resource, and a way (a function call) to change that palette. |
But how many resources are on screen? |
There's only one resource on screen at a given time, since I simply alternate between two resources to create the "double buffer". So, one resource on screen at a time. One or the other. This is how I swap bewteen them, in case there's any doubt: dispvars->update = vc_dispmanx_update_start( 0 ); vc_dispmanx_element_change_source(dispvars->update, flip_page = !flip_page; If you know about a better (more optimal) way to implement double buffer using dispmanx, please tell me for the good of libSDL 1.2.x on the Pi. :) |
Double buffering like that seems fine. I'll try and get a hello_dispmanx type test working with a palette and see if this works. It may be best to add a new dispmanx_ function to set the palette for a resource. |
But I can't guarantee an user is on an 8bpp framebuffer when using an SDL 1.2.x program, so that ioctl isn't a solution. |
I've been making further experiments with the FBIOPUTCMAP ioctl: I know you must be busy, but I'd love to see that "hello world" palette change example. |
I'm not in a hurry because 8bpp support isn't that important to me, but after implementing my own software paletted-8bpp to 32bpp conversion and finding how much CPU it eats on the PI (it's ok for 320x200 buffers, but it's a complete hog in bigger video buffers) , I'd like to know it there's a chance to be able of setting resource palettes. |
If you just need a single active palette, then yes, I will implement that. |
I've had a bash at this, and this test program seems to be working: check that looks okay, and I'll push out an updated firmware tomorrow. |
This is now pushed out. rpi-update to get. |
…ERSPACE and crypto options See: http://www.raspberrypi.org/phpBB3/viewtopic.php?f=29&t=55711 bootcode: fix noobs boot issue when booting from alternate partition firmware: Support for multichannel audio (from next tree). Improvements to force_audio option. firmware: Improvements to spdif formatting of HDMI PCM data during start/stop/pause/underrun. firmware: Add pause_burst_frames config option to avoid noise when pausing ac3 passthrough firmware: Add dispmanx api to set resource's palette See: raspberrypi/userland#95
…ERSPACE and crypto options See: http://www.raspberrypi.org/phpBB3/viewtopic.php?f=29&t=55711 bootcode: fix noobs boot issue when booting from alternate partition firmware: Support for multichannel audio (from next tree). Improvements to force_audio option. firmware: Improvements to spdif formatting of HDMI PCM data during start/stop/pause/underrun. firmware: Add pause_burst_frames config option to avoid noise when pausing ac3 passthrough firmware: Add dispmanx api to set resource's palette See: raspberrypi/userland#95
Thanks a lot for this, popcornmix! I've already incorporated native 8bpp to my DispmanX libSDL 1.2.x backend here: Many SDL apps/games using 8bpp modes now work great, without slow color conversions. |
Glad it worked for you. Feel free to close this. |
…ERSPACE and crypto options See: http://www.raspberrypi.org/phpBB3/viewtopic.php?f=29&t=55711 bootcode: fix noobs boot issue when booting from alternate partition firmware: Support for multichannel audio (from next tree). Improvements to force_audio option. firmware: Improvements to spdif formatting of HDMI PCM data during start/stop/pause/underrun. firmware: Add pause_burst_frames config option to avoid noise when pausing ac3 passthrough firmware: Add dispmanx api to set resource's palette See: raspberrypi/userland#95
Hi there,
I really need help with this.
I made a "hacky" but working dispmanx backend for libSDL 1.2.x (wich is available on my github, of course), but I recently discovered 8bpp games/apps wouldn't display correctly.
In particular, 8bpp games wich set custom palettes seem to show all kind of strange colors.
I use VC_IMAGE_8BPP as pixel format when I create a resource with vc_dispmanx_resource_create() in case the game/app is requesting a 8bpp video mode, so when I do vc_dispmanx_resource_write_data() (because I dump SDL video surface to one of my two resources for double buffering by doing this), the pixel format parameter is the same.
Pixels appear with the expected size, etc, but wrong colors.
How can I modify a VC_IMAGE_8BPP resource's palette, then? Is there any other way to archieve this?
Thanks
The text was updated successfully, but these errors were encountered: