#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/usb.h>
#include <linux/uaccess.h>
#include <linux/mm.h>
#include <linux/fb.h>
#include <linux/vmalloc.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <asm/unaligned.h>
#include <video/udlfb.h>
#include "edid.h"
#define OUT_EP_NUM …
static const struct fb_fix_screeninfo dlfb_fix = …;
static const u32 udlfb_info_flags = …;
static const struct usb_device_id id_table[] = …;
MODULE_DEVICE_TABLE(usb, id_table);
static bool console = …;
static bool fb_defio = …;
static bool shadow = …;
static int pixel_limit;
struct dlfb_deferred_free { … };
static int dlfb_realloc_framebuffer(struct dlfb_data *dlfb, struct fb_info *info, u32 new_len);
static void dlfb_urb_completion(struct urb *urb);
static struct urb *dlfb_get_urb(struct dlfb_data *dlfb);
static int dlfb_submit_urb(struct dlfb_data *dlfb, struct urb * urb, size_t len);
static int dlfb_alloc_urb_list(struct dlfb_data *dlfb, int count, size_t size);
static void dlfb_free_urb_list(struct dlfb_data *dlfb);
static char *dlfb_set_register(char *buf, u8 reg, u8 val)
{ … }
static char *dlfb_vidreg_lock(char *buf)
{ … }
static char *dlfb_vidreg_unlock(char *buf)
{ … }
static char *dlfb_blanking(char *buf, int fb_blank)
{ … }
static char *dlfb_set_color_depth(char *buf, u8 selection)
{ … }
static char *dlfb_set_base16bpp(char *wrptr, u32 base)
{ … }
static char *dlfb_set_base8bpp(char *wrptr, u32 base)
{ … }
static char *dlfb_set_register_16(char *wrptr, u8 reg, u16 value)
{ … }
static char *dlfb_set_register_16be(char *wrptr, u8 reg, u16 value)
{ … }
static u16 dlfb_lfsr16(u16 actual_count)
{ … }
static char *dlfb_set_register_lfsr16(char *wrptr, u8 reg, u16 value)
{ … }
static char *dlfb_set_vid_cmds(char *wrptr, struct fb_var_screeninfo *var)
{ … }
static int dlfb_set_video_mode(struct dlfb_data *dlfb,
struct fb_var_screeninfo *var)
{ … }
static int dlfb_ops_mmap(struct fb_info *info, struct vm_area_struct *vma)
{ … }
static int dlfb_trim_hline(const u8 *bback, const u8 **bfront, int *width_bytes)
{ … }
static void dlfb_compress_hline(
const uint16_t **pixel_start_ptr,
const uint16_t *const pixel_end,
uint32_t *device_address_ptr,
uint8_t **command_buffer_ptr,
const uint8_t *const cmd_buffer_end,
unsigned long back_buffer_offset,
int *ident_ptr)
{ … }
static int dlfb_render_hline(struct dlfb_data *dlfb, struct urb **urb_ptr,
const char *front, char **urb_buf_ptr,
u32 byte_offset, u32 byte_width,
int *ident_ptr, int *sent_ptr)
{ … }
static int dlfb_handle_damage(struct dlfb_data *dlfb, int x, int y, int width, int height)
{ … }
static void dlfb_init_damage(struct dlfb_data *dlfb)
{ … }
static void dlfb_damage_work(struct work_struct *w)
{ … }
static void dlfb_offload_damage(struct dlfb_data *dlfb, int x, int y, int width, int height)
{ … }
static void dlfb_dpy_deferred_io(struct fb_info *info, struct list_head *pagereflist)
{ … }
static int dlfb_get_edid(struct dlfb_data *dlfb, char *edid, int len)
{ … }
static int dlfb_ops_ioctl(struct fb_info *info, unsigned int cmd,
unsigned long arg)
{ … }
static int
dlfb_ops_setcolreg(unsigned regno, unsigned red, unsigned green,
unsigned blue, unsigned transp, struct fb_info *info)
{ … }
static int dlfb_ops_open(struct fb_info *info, int user)
{ … }
static void dlfb_ops_destroy(struct fb_info *info)
{ … }
static int dlfb_ops_release(struct fb_info *info, int user)
{ … }
static int dlfb_is_valid_mode(struct fb_videomode *mode, struct dlfb_data *dlfb)
{ … }
static void dlfb_var_color_format(struct fb_var_screeninfo *var)
{ … }
static int dlfb_ops_check_var(struct fb_var_screeninfo *var,
struct fb_info *info)
{ … }
static int dlfb_ops_set_par(struct fb_info *info)
{ … }
static char *dlfb_dummy_render(char *buf)
{ … }
static int dlfb_ops_blank(int blank_mode, struct fb_info *info)
{ … }
static void dlfb_ops_damage_range(struct fb_info *info, off_t off, size_t len)
{ … }
static void dlfb_ops_damage_area(struct fb_info *info, u32 x, u32 y, u32 width, u32 height)
{ … }
FB_GEN_DEFAULT_DEFERRED_SYSMEM_OPS(dlfb_ops,
dlfb_ops_damage_range,
dlfb_ops_damage_area)
static const struct fb_ops dlfb_ops = …;
static void dlfb_deferred_vfree(struct dlfb_data *dlfb, void *mem)
{ … }
static int dlfb_realloc_framebuffer(struct dlfb_data *dlfb, struct fb_info *info, u32 new_len)
{ … }
static int dlfb_setup_modes(struct dlfb_data *dlfb,
struct fb_info *info,
char *default_edid, size_t default_edid_size)
{ … }
static ssize_t metrics_bytes_rendered_show(struct device *fbdev,
struct device_attribute *a, char *buf) { … }
static ssize_t metrics_bytes_identical_show(struct device *fbdev,
struct device_attribute *a, char *buf) { … }
static ssize_t metrics_bytes_sent_show(struct device *fbdev,
struct device_attribute *a, char *buf) { … }
static ssize_t metrics_cpu_kcycles_used_show(struct device *fbdev,
struct device_attribute *a, char *buf) { … }
static ssize_t edid_show(
struct file *filp,
struct kobject *kobj, struct bin_attribute *a,
char *buf, loff_t off, size_t count) { … }
static ssize_t edid_store(
struct file *filp,
struct kobject *kobj, struct bin_attribute *a,
char *src, loff_t src_off, size_t src_size) { … }
static ssize_t metrics_reset_store(struct device *fbdev,
struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static const struct bin_attribute edid_attr = …;
static const struct device_attribute fb_device_attrs[] = …;
static int dlfb_select_std_channel(struct dlfb_data *dlfb)
{ … }
static int dlfb_parse_vendor_descriptor(struct dlfb_data *dlfb,
struct usb_interface *intf)
{ … }
static int dlfb_usb_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{ … }
static void dlfb_usb_disconnect(struct usb_interface *intf)
{ … }
static struct usb_driver dlfb_driver = …;
module_usb_driver(…) …;
static void dlfb_urb_completion(struct urb *urb)
{ … }
static void dlfb_free_urb_list(struct dlfb_data *dlfb)
{ … }
static int dlfb_alloc_urb_list(struct dlfb_data *dlfb, int count, size_t size)
{ … }
static struct urb *dlfb_get_urb(struct dlfb_data *dlfb)
{ … }
static int dlfb_submit_urb(struct dlfb_data *dlfb, struct urb *urb, size_t len)
{ … }
module_param(console, bool, S_IWUSR | S_IRUSR | S_IWGRP | S_IRGRP);
MODULE_PARM_DESC(…) …;
module_param(fb_defio, bool, S_IWUSR | S_IRUSR | S_IWGRP | S_IRGRP);
MODULE_PARM_DESC(…) …;
module_param(shadow, bool, S_IWUSR | S_IRUSR | S_IWGRP | S_IRGRP);
MODULE_PARM_DESC(…) …;
module_param(pixel_limit, int, S_IWUSR | S_IRUSR | S_IWGRP | S_IRGRP);
MODULE_PARM_DESC(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;