Built-in linux framebuffer rotates

I need to integrate the LCD screen into my embedded Linux system (ARM9). The LCD is a portrait of 320x480, and I need to run the screen in landscape orientation of 480x320. Using the LCD configuration register, I can rotate it to hardware so that (x, y) (0,0) rotates 90 degrees. This is where my problem begins, the wide side of the screen narrows from 480 pixels to 320, and the long side of the image exits the screen. This should be fixed by resizing the AFAIK framebuffer, but I tried several ways to do this without success. using fbset, below are the settings for the portrait:

mode "480x320-55" # D: 9.091 MHz, H: 18.182 kHz, V: 55.096 Hz geometry 480 320 480 320 16 timings 110000 4 4 4 4 12 2 rgba 5/0,6/5,5/11,0/0 endmode 

Sending a team:

 fbset --geometry 480 320 480 320 16 

Results in:

 mode "480x320-55" # D: 9.091 MHz, H: 18.182 kHz, V: 55.096 Hz geometry 480 320 480 320 16 timings 110000 4 4 4 4 12 2 rgba 5/0,6/5,5/11,0/0 endmode 

This makes the image several times and overlaps, but the screen width is still too narrow.

I tried to provide double screen size for virtual xres and yres, but no change.

 fbset --geometry 480 320 960 640 16 

I also tried using the fb rotation function, which I found on the network "saFbdevRotation.c", which uses FB IOCTL, but the active screen size is still incorrect.

rotate 90 degrees, see output

 $> ./fb_rotate -r 90 ## Before rotation ### Fix Screen Info: Line Length - 640 Physical Address = 81a00000 Buffer Length = 1048576 ### Var Screen Info: Xres - 320 Yres - 480 Xres Virtual - 320 Yres Virtual - 480 Bits Per Pixel - 16 Pixel Clk - 110000 Rotation - 0 ## after rotation ### Fix Screen Info: Line Length - 960 Physical Address = 81a00000 Buffer Length = 1048576 ### Var Screen Info: Xres - 480 Yres - 320 Xres Virtual - 480 Yres Virtual - 320 Bits Per Pixel - 16 Pixel Clk - 110000 Rotation - 90 

I can also add that the system is very limited by free memory, could this be the reason that fb does not allocate a new buffer? However, there were no errors in dmesg.

I will feel your recommendation.

+4
source share
2 answers

I can also add that the system is very limited by free memory, maybe this causes fb to NOT allocate a new buffer? However, there was no error in dmesg.

Usually the standard way to allocate a video buffer is to pre-allocate a large video buffer (based on the maximum video resolution that you support) at boot time, which transfers the kernel men = to the kernel, t occupy it initially.

and then the video driver can do

 void *ioremap(unsigned long phys_addr, unsigned long size) 

which creates the mmap area for the driver, directly controls the frame buffer.

You can verify this by running cat /proc/iomen

Thus, the video driver memory is pre-allocated and different from the Linux kernel system memory (e.g. kmalloc () or get_free_pages () or vmalloc ()), what you are concerned about is excluded.

0
source

I think your problem is with the LCD you are using. I saw several built-in LCDs that claim to support 90 degrees rotation, but the result was exactly what you described. My problems have always arisen using the RGB display interface. I suspect that rotation could work using the CPU interface. I saw only one built-in display that was able to correctly rotate for the RGB interface.

The fact is that you should try to make a turn with either the LCD HW, your HW processor, or pure SW. I don’t know if Linux framebuffer can use pure SW or your HW processor, it probably depends on your driver.

0
source

All Articles