summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@googlemail.com>2012-09-12 15:23:15 +0200
committerDavid Herrmann <dh.herrmann@googlemail.com>2012-09-12 15:23:15 +0200
commit2df4fc0d31ac534f35efb71e0e8cc6909bc2a571 (patch)
tree37e65803e026f97ed30c8aa0c6524fec9f0349fc /src
parent87c99634381562660ee5f7d35cf773c46b134f85 (diff)
uterm: video: add *_display_fake_blend(v) requests
Instead of requiring to use uterm_screen objects we now add a fake_blendv() request directly to the display object. We rename it to "fake_blend" instead of just "blend" so we can later implement real blending. This reuses the existing infrastructure. But the fake_blendv is the way to go so we rename the existing functions to "fake_*" either. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Diffstat (limited to 'src')
-rw-r--r--src/uterm.h9
-rw-r--r--src/uterm_video.c35
-rw-r--r--src/uterm_video.h3
-rw-r--r--src/uterm_video_drm.c8
-rw-r--r--src/uterm_video_dumb.c8
-rw-r--r--src/uterm_video_fbdev.c8
6 files changed, 62 insertions, 9 deletions
diff --git a/src/uterm.h b/src/uterm.h
index 2cb5fd9..da09a24 100644
--- a/src/uterm.h
+++ b/src/uterm.h
@@ -217,6 +217,15 @@ int uterm_display_get_dpms(const struct uterm_display *disp);
int uterm_display_use(struct uterm_display *disp);
int uterm_display_swap(struct uterm_display *disp);
+int uterm_display_fake_blend(struct uterm_display *disp,
+ const struct uterm_video_buffer *buf,
+ unsigned int x, unsigned int y,
+ uint8_t fr, uint8_t fg, uint8_t fb,
+ uint8_t br, uint8_t bg, uint8_t bb);
+int uterm_display_fake_blendv(struct uterm_display *disp,
+ const struct uterm_video_blend_req *req,
+ size_t num);
+
/* video interface */
int uterm_video_new(struct uterm_video **out,
diff --git a/src/uterm_video.c b/src/uterm_video.c
index 5b09465..24c5b4f 100644
--- a/src/uterm_video.c
+++ b/src/uterm_video.c
@@ -412,6 +412,41 @@ int uterm_display_swap(struct uterm_display *disp)
return VIDEO_CALL(disp->ops->swap, 0, disp);
}
+int uterm_display_fake_blend(struct uterm_display *disp,
+ const struct uterm_video_buffer *buf,
+ unsigned int x, unsigned int y,
+ uint8_t fr, uint8_t fg, uint8_t fb,
+ uint8_t br, uint8_t bg, uint8_t bb)
+{
+ struct uterm_video_blend_req req;
+
+ if (!disp)
+ return -EINVAL;
+
+ memset(&req, 0, sizeof(req));
+ req.buf = buf;
+ req.x = x;
+ req.y = y;
+ req.fr = fr;
+ req.fg = fg;
+ req.fb = fb;
+ req.br = br;
+ req.bg = bg;
+ req.bb = bb;
+
+ return VIDEO_CALL(disp->ops->fake_blendv, -EOPNOTSUPP, disp, &req, 1);
+}
+
+int uterm_display_fake_blendv(struct uterm_display *disp,
+ const struct uterm_video_blend_req *req,
+ size_t num)
+{
+ if (!disp)
+ return -EINVAL;
+
+ return VIDEO_CALL(disp->ops->fake_blendv, -EOPNOTSUPP, disp, req, num);
+}
+
int uterm_video_new(struct uterm_video **out,
struct ev_eloop *eloop,
unsigned int type,
diff --git a/src/uterm_video.h b/src/uterm_video.h
index 57f8669..16a89df 100644
--- a/src/uterm_video.h
+++ b/src/uterm_video.h
@@ -64,6 +64,9 @@ struct display_ops {
uint8_t br, uint8_t bg, uint8_t bb);
int (*blendv) (struct uterm_display *disp,
const struct uterm_video_blend_req *req, size_t num);
+ int (*fake_blendv) (struct uterm_display *disp,
+ const struct uterm_video_blend_req *req,
+ size_t num);
int (*fill) (struct uterm_display *disp,
uint8_t r, uint8_t g, uint8_t b, unsigned int x,
unsigned int y, unsigned int width, unsigned int height);
diff --git a/src/uterm_video_drm.c b/src/uterm_video_drm.c
index 1e7f492..eb367ab 100644
--- a/src/uterm_video_drm.c
+++ b/src/uterm_video_drm.c
@@ -756,8 +756,9 @@ static int display_blend(struct uterm_display *disp,
return 0;
}
-static int display_blendv(struct uterm_display *disp,
- const struct uterm_video_blend_req *req, size_t num)
+static int display_fake_blendv(struct uterm_display *disp,
+ const struct uterm_video_blend_req *req,
+ size_t num)
{
int ret;
unsigned int i;
@@ -1265,7 +1266,8 @@ const struct display_ops drm_display_ops = {
.swap = display_swap,
.blit = display_blit,
.blend = display_blend,
- .blendv = display_blendv,
+ .blendv = display_fake_blendv,
+ .fake_blendv = display_fake_blendv,
.fill = display_fill,
};
diff --git a/src/uterm_video_dumb.c b/src/uterm_video_dumb.c
index 8bd48e6..f60db13 100644
--- a/src/uterm_video_dumb.c
+++ b/src/uterm_video_dumb.c
@@ -498,8 +498,9 @@ static int display_blend(struct uterm_display *disp,
return 0;
}
-static int display_blendv(struct uterm_display *disp,
- const struct uterm_video_blend_req *req, size_t num)
+static int display_fake_blendv(struct uterm_display *disp,
+ const struct uterm_video_blend_req *req,
+ size_t num)
{
unsigned int tmp;
uint8_t *dst, *src;
@@ -937,7 +938,8 @@ const struct display_ops dumb_display_ops = {
.swap = display_swap,
.blit = display_blit,
.blend = display_blend,
- .blendv = display_blendv,
+ .blendv = display_fake_blendv,
+ .fake_blendv = display_fake_blendv,
.fill = display_fill,
};
diff --git a/src/uterm_video_fbdev.c b/src/uterm_video_fbdev.c
index e9f5c1d..864a787 100644
--- a/src/uterm_video_fbdev.c
+++ b/src/uterm_video_fbdev.c
@@ -632,8 +632,9 @@ static int display_blend(struct uterm_display *disp,
return 0;
}
-static int display_blendv(struct uterm_display *disp,
- const struct uterm_video_blend_req *req, size_t num)
+static int display_fake_blendv(struct uterm_display *disp,
+ const struct uterm_video_blend_req *req,
+ size_t num)
{
unsigned int tmp;
uint8_t *dst, *src;
@@ -933,7 +934,8 @@ const struct display_ops fbdev_display_ops = {
.swap = display_swap,
.blit = display_blit,
.blend = display_blend,
- .blendv = display_blendv,
+ .blendv = display_fake_blendv,
+ .fake_blendv = display_fake_blendv,
.fill = display_fill,
};