diff options
Diffstat (limited to 'surface.c')
-rw-r--r-- | surface.c | 38 |
1 files changed, 37 insertions, 1 deletions
@@ -17,7 +17,7 @@ long draw_lines(struct file *filp, unsigned long arg) struct doomdev_surf_ioctl_draw_lines *param; struct doomdev_line *lines; int i; - + surface_data = filp->private_data; param = (struct doomdev_surf_ioctl_draw_lines *) arg; lines = (struct doomdev_line *) param->lines_ptr; @@ -55,6 +55,40 @@ long fill_rects(struct file *filp, unsigned long arg) return param->rects_num; } +long copy_rects(struct file *filp, unsigned long arg) +{ + struct surface_data *dst_data; + struct surface_data *src_data; + struct doomdev_surf_ioctl_copy_rects *param; + struct doomdev_copy_rect *rects; + struct fd src_fds; + int i; + + p("in copy rects\n"); + + dst_data = filp->private_data; + param = (struct doomdev_surf_ioctl_copy_rects *) arg; + rects = (struct doomdev_copy_rect *) param->rects_ptr; + + src_fds = fdget(param->surf_src_fd); + src_data = src_fds.file->private_data; + + if (dst_data->doom_data != src_data->doom_data) { + p("copying between devices"); + return -EINVAL; + } + + mutex_lock(&dst_data->doom_data->cmd_mutex); + + for (i = 0; i < param->rects_num; i++) { + copy_rect(dst_data, src_data, rects[i]); + } + + mutex_unlock(&dst_data->doom_data->cmd_mutex); + + return param->rects_num; +} + long surface_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { switch (cmd) { @@ -62,6 +96,8 @@ long surface_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) return draw_lines(filp, arg); case DOOMDEV_SURF_IOCTL_FILL_RECTS: return fill_rects(filp, arg); + case DOOMDEV_SURF_IOCTL_COPY_RECTS: + return copy_rects(filp, arg); default: return -1; } |