How does the Allwinner F133 (D1s) chip perform display rotation under Tina?

How does the Allwinner F133 (D1s) chip compiled for the Allwinner online developer community perform display rotation under Tina?

problem background

At present, most of the displays are based on the horizontal screen design layout, UI, pictures, video and other displays. Most of the commonly used MIPI screens are vertical screens. In order to avoid re-adjusting the layout, the display provides a display method that rotates the vertical screen into a horizontal screen. Save customer development time.

There are hardware G2D rotation methods and software algorithm rotation methods for display rotation. You can choose to use the two methods according to your own screen conditions, test and compare, and mainly evaluate memory usage, time efficiency, and rotation effects.

Display driver rotation framebuffer configuration

1. Since the previous public version blocked the screen rotation related configuration in modules.mk by default, if your version disables rotation, you need to remove the related configuration.

路径:target/allwinner/f133-common/modules.mk

Block the following 3 related options:

CONFIG_SUNXI_DISP2_FB_DISABLE_ROTATE

CONFIG_SUNXI_DISP2_FB_ROTATION_SUPPORT

CONFIG_SUNXI_DISP2_FB_HW_ROTATION_SUPPORT

The modified code is as follows:

.....
$(eval $(call KernelPackage,net-rtl8821cs))

define KernelPackage/sunxi-disp
  SUBMENU:=$(VIDEO_MENU)
  TITLE:=sunxi-disp support
  KCONFIG:=\
	  CONFIG_DISP2_SUNXI=m \
	  #CONFIG_SUNXI_DISP2_FB_DISABLE_ROTATE=y \
	  #CONFIG_SUNXI_DISP2_FB_ROTATION_SUPPORT=n \
	  #CONFIG_SUNXI_DISP2_FB_HW_ROTATION_SUPPORT=y \
	  CONFIG_DISP2_SUNXI_BOOT_COLORBAR=n \
	  CONFIG_DISP2_SUNXI_DEBUG=y \
	  CONFIG_DISP2_SUNXI_COMPOSER=n \
	  CONFIG_DISP2_SUNXI_SUPPORT_SMBL=y \

.....

2. Hardware rotation needs to ensure that the G2D driver has been enabled

make kernel_menuconfig
	Device Drivers  --->
		<*> SUNXI G2D Driver
		[*]   sunxi g2d mixer module
		[*]   sunxi g2d rotate module

3. Turn on display driver rotation support

make kernel_menuconfig
	Device Drivers  --->
		Graphics support  ---> 
			Frame buffer Devices  --->
				 Video support for sunxi  --->
				 	DISP2 Framebuffer rotation support (Disable rotation)  --->
				 		 ( ) Disable rotation
						 ( ) Software rotation support  	(不要选这个,方案未支持)
						 (X) Hardware(G2D) rotation support (选择G2D旋转)

4. dts configuration

Board.dts and uboot-board.dts are modified synchronously.

&disp{
    .....
    disp_rotation_used       = <1>;/* 使能旋转功能 */
    degree0                  = <3>; /* X:screen index; 0:0 degree; 1:90 degree; 3:270 degree */
    fb0_width                = <1280>;/*fb 的长宽交换*/
    fb0_height               = <800>;
    .....
};

5. It is necessary to pay attention to the programming of the framebuffer after rotation. The rotated buffer will not be directly displayed on the screen. It is necessary to call the FBIOPAN_DISPLAY interface at the place where the application refreshes the screen. Synchronously rotate the buffer to the LCD.

Example of swiping the GUI with the modified public version rotation:

path:package/gui/littlevgl-6/lv_drivers/display/fbdev.c

void fbdev_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_p){
....
    lv_disp_flush_ready(drv);
    ioctl(fbfd, FBIOPAN_DISPLAY, &vinfo); /*函数最后,在刷屏函数后面,调用 FBIOPAN_DISPLAY 接口*/
}

Software rotation LVGL UI configuration

The UI rotation algorithm is implemented on lvgl-6 in the public version, and the software swaps the dot position to achieve rotation. This method is purely software, and does not need to change other configurations. On the basis of the original non-rotation, modify the LV_UI_ROTATE_DIRECTION macro.

Path: lv_conf.h

/* UI rotation:
* - 0:  no rotate
* - 1:  90°
* - 2: 180°
* - 3: 270°
*/

#define LV_UI_ROTATE_DIRECTION     0

Video Rotation Configuration

There are two ways of video rotation: decoder rotation and G2D rotation.

1. Encoder rotation (VE), using the TPlayerSetRotate interface, note that this interface does not support LBC mode, and does not support H265 video rotation. For details, please refer to the <Tina Linux Multimedia Decoding> document.

函数原型: int TPlayerSetRotate(TPlayer* p,TplayerVideoRotateTyperotateDegree);
功能 设置视频旋转的角度
参数 p: 通过 TPlayerCreate 函数创建的 TPlayer 指针; rotateDegree: 视频旋转的角度
返回值 成功返回 0,失败返回-1。
调用说明 这个函数需要在 TPlayerSetDataSource() 函数之前调用

2. G2D rotation:

Method 1: (1) The TPlayerSetG2dRotate() interface uses G2D for rotation. This interface is called after TPlayerCreate().

Method 2: (2) Configure the default rotation directly in the configuration file, file path:

package/allwinner/tina_multimedia/tplayer/configs/f133_linux_cedarx.conf

48 #use g2d module to rotate the video. notice:F133/R528
49 g2d_rotate_flag = 1
50 g2d_rotate_degree = 1

picture rotation

To be supported.

For more information, please visit the Allwinner Online Developer Community . "Allwinner Online Developer Community" is a developer communication platform operated by Allwinner Online, a wholly-owned subsidiary of Allwinner Technology, including online documents, data downloads, purchase channels, and development There are several major sections of the Developer Academy and the Technology Forum, aiming to provide a space for chip/embedded/smart product developers to communicate and learn, and to focus on supporting the promotion of the RISC-V ecosystem.

Follow the official account: Allwinner Online

{{o.name}}
{{m.name}}

Guess you like

Origin my.oschina.net/u/6169614/blog/5596818