m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2018-05-27 14:45:16 +0200
committerMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2018-05-27 14:45:16 +0200
commite1d57f01b2112a6415313c83fc300f94475db382 (patch)
tree4e9df991eae85889b359ad41b8facbce0f4ac693
parent1b4cb06d5d27901e7f94e9aea7a0c1e9b960a3af (diff)
Implement draw background
-rw-r--r--harddoomdev.c9
-rw-r--r--harddoomdev.h2
-rw-r--r--surface.c31
3 files changed, 42 insertions, 0 deletions
diff --git a/harddoomdev.c b/harddoomdev.c
index 1a818ea..c4489aa 100644
--- a/harddoomdev.c
+++ b/harddoomdev.c
@@ -245,6 +245,15 @@ void draw_span(struct surface_data *surface_data, struct flat_data *flat_data,
send_command(surface_data->doom_data, HARDDOOM_CMD_DRAW_SPAN);
}
+void draw_background(struct surface_data *surface_data,
+ struct flat_data *flat_data)
+{
+ set_surf_dst_pt(surface_data->doom_data, surface_data->page_table_dev);
+ set_flat(surface_data->doom_data, flat_data->flat_dev);
+
+ send_command(surface_data->doom_data, HARDDOOM_CMD_DRAW_BACKGROUND);
+}
+
uint32_t doomdev_read_stat(void __iomem *iomem, size_t stat)
{
return doomdev_read(iomem, HARDDOOM_STATS(stat));
diff --git a/harddoomdev.h b/harddoomdev.h
index 9381fd5..4ddd01e 100644
--- a/harddoomdev.h
+++ b/harddoomdev.h
@@ -23,5 +23,7 @@ void draw_column(struct surface_data *surface_data,
struct texture_data *texture_data, struct doomdev_column column);
void draw_span(struct surface_data *surface_data, struct flat_data *flat_data,
struct doomdev_span span);
+void draw_background(struct surface_data *surface_data,
+ struct flat_data *flat_data);
#endif
diff --git a/surface.c b/surface.c
index 29530b7..fddc0fe 100644
--- a/surface.c
+++ b/surface.c
@@ -163,6 +163,35 @@ long draw_spans(struct file *filp, unsigned long arg)
return param->spans_num;
}
+long do_draw_background(struct file *filp, unsigned long arg)
+{
+ struct doomdev_surf_ioctl_draw_background *param;
+ struct surface_data *surface_data;
+ struct flat_data *flat_data;
+ struct fd flat_fds;
+
+ surface_data = filp->private_data;
+
+ param = (struct doomdev_surf_ioctl_draw_background *) arg;
+
+ flat_fds = fdget(param->flat_fd);
+ flat_data = flat_fds.file->private_data;
+
+ if (surface_data->doom_data != flat_data->doom_data) {
+ return -EINVAL;
+ }
+
+ mutex_lock(&surface_data->doom_data->cmd_mutex);
+
+ draw_background(surface_data, flat_data);
+
+ mutex_unlock(&surface_data->doom_data->cmd_mutex);
+
+ fdput(flat_fds);
+
+ return 0;
+}
+
long surface_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{
switch (cmd) {
@@ -176,6 +205,8 @@ long surface_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
return draw_columns(filp, arg);
case DOOMDEV_SURF_IOCTL_DRAW_SPANS:
return draw_spans(filp, arg);
+ case DOOMDEV_SURF_IOCTL_DRAW_BACKGROUND:
+ return do_draw_background(filp, arg);
default:
return -1;
}