udlfb.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #ifndef UDLFB_H
  2. #define UDLFB_H
  3. /*
  4. * TODO: Propose standard fb.h ioctl for reporting damage,
  5. * using _IOWR() and one of the existing area structs from fb.h
  6. * Consider these ioctls deprecated, but they're still used by the
  7. * DisplayLink X server as yet - need both to be modified in tandem
  8. * when new ioctl(s) are ready.
  9. */
  10. #define DLFB_IOCTL_RETURN_EDID 0xAD
  11. #define DLFB_IOCTL_REPORT_DAMAGE 0xAA
  12. struct dloarea {
  13. int x, y;
  14. int w, h;
  15. int x2, y2;
  16. };
  17. struct urb_node {
  18. struct list_head entry;
  19. struct dlfb_data *dev;
  20. struct delayed_work release_urb_work;
  21. struct urb *urb;
  22. };
  23. struct urb_list {
  24. struct list_head list;
  25. spinlock_t lock;
  26. struct semaphore limit_sem;
  27. int available;
  28. int count;
  29. size_t size;
  30. };
  31. struct dlfb_data {
  32. struct usb_device *udev;
  33. struct device *gdev; /* &udev->dev */
  34. struct fb_info *info;
  35. struct urb_list urbs;
  36. struct kref kref;
  37. char *backing_buffer;
  38. int fb_count;
  39. bool virtualized; /* true when physical usb device not present */
  40. struct delayed_work init_framebuffer_work;
  41. struct delayed_work free_framebuffer_work;
  42. atomic_t usb_active; /* 0 = update virtual buffer, but no usb traffic */
  43. atomic_t lost_pixels; /* 1 = a render op failed. Need screen refresh */
  44. char *edid; /* null until we read edid from hw or get from sysfs */
  45. size_t edid_size;
  46. int sku_pixel_limit;
  47. int base16;
  48. int base8;
  49. u32 pseudo_palette[256];
  50. int blank_mode; /*one of FB_BLANK_ */
  51. /* blit-only rendering path metrics, exposed through sysfs */
  52. atomic_t bytes_rendered; /* raw pixel-bytes driver asked to render */
  53. atomic_t bytes_identical; /* saved effort with backbuffer comparison */
  54. atomic_t bytes_sent; /* to usb, after compression including overhead */
  55. atomic_t cpu_kcycles_used; /* transpired during pixel processing */
  56. };
  57. #define NR_USB_REQUEST_I2C_SUB_IO 0x02
  58. #define NR_USB_REQUEST_CHANNEL 0x12
  59. /* -BULK_SIZE as per usb-skeleton. Can we get full page and avoid overhead? */
  60. #define BULK_SIZE 512
  61. #define MAX_TRANSFER (PAGE_SIZE*16 - BULK_SIZE)
  62. #define WRITES_IN_FLIGHT (4)
  63. #define MAX_VENDOR_DESCRIPTOR_SIZE 256
  64. #define GET_URB_TIMEOUT HZ
  65. #define FREE_URB_TIMEOUT (HZ*2)
  66. #define BPP 2
  67. #define MAX_CMD_PIXELS 255
  68. #define RLX_HEADER_BYTES 7
  69. #define MIN_RLX_PIX_BYTES 4
  70. #define MIN_RLX_CMD_BYTES (RLX_HEADER_BYTES + MIN_RLX_PIX_BYTES)
  71. #define RLE_HEADER_BYTES 6
  72. #define MIN_RLE_PIX_BYTES 3
  73. #define MIN_RLE_CMD_BYTES (RLE_HEADER_BYTES + MIN_RLE_PIX_BYTES)
  74. #define RAW_HEADER_BYTES 6
  75. #define MIN_RAW_PIX_BYTES 2
  76. #define MIN_RAW_CMD_BYTES (RAW_HEADER_BYTES + MIN_RAW_PIX_BYTES)
  77. #define DL_DEFIO_WRITE_DELAY 5 /* fb_deferred_io.delay in jiffies */
  78. #define DL_DEFIO_WRITE_DISABLE (HZ*60) /* "disable" with long delay */
  79. /* remove these once align.h patch is taken into kernel */
  80. #define DL_ALIGN_UP(x, a) ALIGN(x, a)
  81. #define DL_ALIGN_DOWN(x, a) ALIGN(x-(a-1), a)
  82. #endif