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>
This commit is contained in:
David Herrmann 2012-09-12 15:23:15 +02:00
parent 87c9963438
commit 2df4fc0d31
6 changed files with 62 additions and 9 deletions

View File

@ -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,

View File

@ -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,

View File

@ -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);

View File

@ -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,
};

View File

@ -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,
};

View File

@ -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,
};