0001
0002 #ifndef UDLFB_H
0003 #define UDLFB_H
0004
0005
0006
0007
0008
0009
0010
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;
0042 atomic_t usb_active;
0043 atomic_t lost_pixels;
0044 char *edid;
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;
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
0060 atomic_t bytes_rendered;
0061 atomic_t bytes_identical;
0062 atomic_t bytes_sent;
0063 atomic_t cpu_kcycles_used;
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
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)
0097 #define DL_DEFIO_WRITE_DISABLE (HZ*60)
0098
0099
0100 #define DL_ALIGN_UP(x, a) ALIGN(x, a)
0101 #define DL_ALIGN_DOWN(x, a) ALIGN_DOWN(x, a)
0102
0103 #endif