Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef UDLFB_H
0003 #define UDLFB_H
0004 
0005 /*
0006  * TODO: Propose standard fb.h ioctl for reporting damage,
0007  * using _IOWR() and one of the existing area structs from fb.h
0008  * Consider these ioctls deprecated, but they're still used by the
0009  * DisplayLink X server as yet - need both to be modified in tandem
0010  * when new ioctl(s) are ready.
0011  */
0012 #define DLFB_IOCTL_RETURN_EDID   0xAD
0013 #define DLFB_IOCTL_REPORT_DAMAGE 0xAA
0014 struct dloarea {
0015     int x, y;
0016     int w, h;
0017     int x2, y2;
0018 };
0019 
0020 struct urb_node {
0021     struct list_head entry;
0022     struct dlfb_data *dlfb;
0023     struct urb *urb;
0024 };
0025 
0026 struct urb_list {
0027     struct list_head list;
0028     spinlock_t lock;
0029     struct semaphore limit_sem;
0030     int available;
0031     int count;
0032     size_t size;
0033 };
0034 
0035 struct dlfb_data {
0036     struct usb_device *udev;
0037     struct fb_info *info;
0038     struct urb_list urbs;
0039     char *backing_buffer;
0040     int fb_count;
0041     bool virtualized; /* true when physical usb device not present */
0042     atomic_t usb_active; /* 0 = update virtual buffer, but no usb traffic */
0043     atomic_t lost_pixels; /* 1 = a render op failed. Need screen refresh */
0044     char *edid; /* null until we read edid from hw or get from sysfs */
0045     size_t edid_size;
0046     int sku_pixel_limit;
0047     int base16;
0048     int base8;
0049     u32 pseudo_palette[256];
0050     int blank_mode; /*one of FB_BLANK_ */
0051     struct mutex render_mutex;
0052     int damage_x;
0053     int damage_y;
0054     int damage_x2;
0055     int damage_y2;
0056     spinlock_t damage_lock;
0057     struct work_struct damage_work;
0058     struct fb_ops ops;
0059     /* blit-only rendering path metrics, exposed through sysfs */
0060     atomic_t bytes_rendered; /* raw pixel-bytes driver asked to render */
0061     atomic_t bytes_identical; /* saved effort with backbuffer comparison */
0062     atomic_t bytes_sent; /* to usb, after compression including overhead */
0063     atomic_t cpu_kcycles_used; /* transpired during pixel processing */
0064     struct fb_var_screeninfo current_mode;
0065     struct list_head deferred_free;
0066 };
0067 
0068 #define NR_USB_REQUEST_I2C_SUB_IO 0x02
0069 #define NR_USB_REQUEST_CHANNEL 0x12
0070 
0071 /* -BULK_SIZE as per usb-skeleton. Can we get full page and avoid overhead? */
0072 #define BULK_SIZE 512
0073 #define MAX_TRANSFER (PAGE_SIZE*16 - BULK_SIZE)
0074 #define WRITES_IN_FLIGHT (4)
0075 
0076 #define MAX_VENDOR_DESCRIPTOR_SIZE 256
0077 
0078 #define GET_URB_TIMEOUT HZ
0079 #define FREE_URB_TIMEOUT (HZ*2)
0080 
0081 #define BPP                     2
0082 #define MAX_CMD_PIXELS      255
0083 
0084 #define RLX_HEADER_BYTES    7
0085 #define MIN_RLX_PIX_BYTES       4
0086 #define MIN_RLX_CMD_BYTES   (RLX_HEADER_BYTES + MIN_RLX_PIX_BYTES)
0087 
0088 #define RLE_HEADER_BYTES    6
0089 #define MIN_RLE_PIX_BYTES   3
0090 #define MIN_RLE_CMD_BYTES   (RLE_HEADER_BYTES + MIN_RLE_PIX_BYTES)
0091 
0092 #define RAW_HEADER_BYTES    6
0093 #define MIN_RAW_PIX_BYTES   2
0094 #define MIN_RAW_CMD_BYTES   (RAW_HEADER_BYTES + MIN_RAW_PIX_BYTES)
0095 
0096 #define DL_DEFIO_WRITE_DELAY    msecs_to_jiffies(HZ <= 300 ? 4 : 10) /* optimal value for 720p video */
0097 #define DL_DEFIO_WRITE_DISABLE  (HZ*60) /* "disable" with long delay */
0098 
0099 /* remove these once align.h patch is taken into kernel */
0100 #define DL_ALIGN_UP(x, a) ALIGN(x, a)
0101 #define DL_ALIGN_DOWN(x, a) ALIGN_DOWN(x, a)
0102 
0103 #endif