Sunxi disp driver interface

The allwinner provided sunxi disp driver has many severe issues and needs to be significantly redesigned. Since the allwinner engineers decided to directly use numbers for ioctls, instead of using the _IO macros, there is no way around redefining all of them to begin with. We will try to keep the current interface stable for as long as possible, and make the future break or breaks as abrupt and complete as possible. But:

The /dev/disp interface will break and will in the end vanish completely!

First!
The disp ioctl header file has been cleaned up and some versioning has been added. Be sure to get the correct header file from the kernel source (LINK!).

In Documentation/sunxi/disp/ there is disp_version.c which gives a good example of how to easily support the new and mandatory versioning ioctl.

Current users
Below is a list of the current users of the disp interface, where the repository for this code is, and how the responsible author can notified of breakage.

Stable IOCTLs
The following IOCTLs and their structures are known to be in active use as they were flagged to us by the programs listed in the previous section. We will try to do our utmost best to keep these IOCTLs stable. All other ioctls are a bit of a free-for-all, and will not be checked for. There is a very good overview of all available ioctls and how to use them:
 * Documentation/sunxi/disp/disp_ioctls.txt
 * Sunxi disp driver interface/IOCTL


 * DISP_CMD_EXECUTE_CMD_AND_STOP_CACHE
 * DISP_CMD_FB_RELEASE
 * DISP_CMD_FB_REQUEST
 * DISP_CMD_GET_OUTPUT_TYPE
 * DISP_CMD_HDMI_GET_HPD_STATUS
 * DISP_CMD_HDMI_GET_MODE
 * DISP_CMD_HDMI_OFF
 * DISP_CMD_HDMI_ON
 * DISP_CMD_HDMI_SET_MODE
 * DISP_CMD_HDMI_SUPPORT_MODE
 * DISP_CMD_LAYER_ALPHA_OFF
 * DISP_CMD_LAYER_ALPHA_ON
 * DISP_CMD_LAYER_BOTTOM
 * DISP_CMD_LAYER_CK_OFF
 * DISP_CMD_LAYER_CK_ON
 * DISP_CMD_LAYER_CLOSE
 * DISP_CMD_LAYER_GET_BLACK_EXTEN_LEVEL
 * DISP_CMD_LAYER_GET_CHROMA_SHARP_LEVEL
 * DISP_CMD_LAYER_GET_LUMA_SHARP_LEVEL
 * DISP_CMD_LAYER_GET_PARA
 * DISP_CMD_LAYER_GET_VPP_EN
 * DISP_CMD_LAYER_GET_WHITE_EXTEN_LEVEL
 * DISP_CMD_LAYER_OPEN
 * DISP_CMD_LAYER_RELEASE
 * DISP_CMD_LAYER_REQUEST
 * DISP_CMD_LAYER_SET_ALPHA_VALUE
 * DISP_CMD_LAYER_SET_BLACK_EXTEN_LEVEL
 * DISP_CMD_LAYER_SET_CHROMA_SHARP_LEVEL
 * DISP_CMD_LAYER_SET_LUMA_SHARP_LEVEL
 * DISP_CMD_LAYER_SET_PARA
 * DISP_CMD_LAYER_SET_PIPE
 * DISP_CMD_LAYER_SET_SCN_WINDOW
 * DISP_CMD_LAYER_SET_WHITE_EXTEN_LEVEL
 * DISP_CMD_LAYER_TOP
 * DISP_CMD_LAYER_VPP_OFF
 * DISP_CMD_LAYER_VPP_ON
 * DISP_CMD_LCD_OFF
 * DISP_CMD_LCD_ON
 * DISP_CMD_SCN_GET_HEIGHT
 * DISP_CMD_SCN_GET_WIDTH
 * DISP_CMD_SET_COLORKEY
 * DISP_CMD_START_CMD_CACHE
 * DISP_CMD_VIDEO_GET_FRAME_ID
 * DISP_CMD_VIDEO_SET_FB
 * DISP_CMD_VIDEO_START
 * DISP_CMD_VIDEO_STOP

Deinterlacer
There is a deinterlacer implemented in Sunxi Display Driver. It seems to be controlled by the scaler's registers and is activated by the DISP_CMD_VIDEO iotcl's. [[Media:Sunxi_deint.pdf|This scheme]] gives an overview about how the necessary registers are set within sunxi display driver.

Allwinner's example code should give a few hints, how the ioctl workflow should work.