From nobody Mon Jul 29 16:38:32 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WXkZK2nXDz5RYmR; Mon, 29 Jul 2024 16:38:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WXkZK0xznz4FNG; Mon, 29 Jul 2024 16:38:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722271113; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Z9urPkRT4DNPUdxMZNV9Ur6LsLKdWeqv0qXzRPZArf0=; b=hfLpqr14+kvgi9VGtiOj8FsH7O9e436vism1YKauJxRUF/LX/3sukSVvlAPYlOiZLEKuQJ M1tfPIe28nI6ksNxkJ/4HZb6ApngZahcIrpPZkLXcoCFv8Y7/cY3ezMOTQw8tvmxSudaRS t+ui9s88Z+B4EQYnJ8th0UhLWTb4h8mTqi34vNft1rh4nacrU5T53MUijMUKlJ+lZK2gzg lc8EagCN2ashQteg221H834Q08IoZOddDpWxpDpbKMW4IkpzTw2cS/LieyPvkzvdKQNDBe L65+3IreUFpIDCdJVwDOsvKqfvAmFik7HqMMNmCtboCy6G7fryuyJv5gfH1j9w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722271113; a=rsa-sha256; cv=none; b=hpq/2desadHgkEyKvjKFlBVCwHQ7HZW0SijoD5AIMVPMhvOIueHiILbh+A2u2Z5Ss55gmI R5Gz1o4uQ+UnpyYkInw+UYlA/bgkeWYaR7AQukPtmOnBwgzADmZW1OBtUl5vsBiDsfCEA4 T8VOjnQOjQlWPQB+WC4MoL0Y/wwUA3KIgRqCoaze9ZeQbgpI8eZZmF+SCnLK1NiNdohNaM 56lla2/ROhwDvSrKZYBSVsnN/QMQBCSBR59kJNK5NKrc0n05IbtWQqUdGSmayBXL/EuRsR hq5oZg0AYJiFb1/8uRLdZqRq8y8zhHMoBSV10trqtArlaxwtusHlV7dfjjignQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722271113; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Z9urPkRT4DNPUdxMZNV9Ur6LsLKdWeqv0qXzRPZArf0=; b=WLXeE/QAe9XopVvEA3g8iYQcfcsHS8XArX2Sf96RSWFoijs+zjauEHG3j4V3PebDWRWoX1 mheYwTmvCobKog0Gb89flpTQAeRltZ2PKjH/FjXY/2cKOSvzV6GrizBO6+o1QC2CDXCilv 7VaxhwwGsJf4TIikfjtZFwYer5USIcy0MPM51sTlu7X4Qp5DTxynMJVltDKd7X1gkrj5K/ OGliI9fXD5fSuMcCa938NFu6EQ091Ns9We86yGtbY4+rKmnGCDpTaOl5hiIXOsutxGf0JK PmcQpR20sgzRpXDG4k0LwzunFydujriAEAJ18ZIuZCZs1DGawQF8OVdjVjwJow== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4WXkZK0Yyvzhlr; Mon, 29 Jul 2024 16:38:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 46TGcWnd004984; Mon, 29 Jul 2024 16:38:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46TGcWAb004981; Mon, 29 Jul 2024 16:38:32 GMT (envelope-from git) Date: Mon, 29 Jul 2024 16:38:32 GMT Message-Id: <202407291638.46TGcWAb004981@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Emmanuel Vadot Subject: git: 01215ffec65a - stable/14 - vt: Add vd_bitblt_argb List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 01215ffec65ae607a0583c564158097b5d56e531 Auto-Submitted: auto-generated The branch stable/14 has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=01215ffec65ae607a0583c564158097b5d56e531 commit 01215ffec65ae607a0583c564158097b5d56e531 Author: Emmanuel Vadot AuthorDate: 2024-07-09 12:35:12 +0000 Commit: Emmanuel Vadot CommitDate: 2024-07-29 16:37:12 +0000 vt: Add vd_bitblt_argb This blit an ARGB image on the dedicated vd. This also adds vt_fb_bitblt_argb which will works for most of the vt backends Differential Revision: https://reviews.freebsd.org/D45929 Reviewed by: tsoome Sponsored by: Beckhoff Automation GmbH & Co. KG (cherry picked from commit b93028d8cd3aafc883b5f0ecec65a8a2a30af7f3) --- sys/dev/virtio/gpu/virtio_gpu.c | 12 ++++++++++ sys/dev/vt/hw/efifb/efifb.c | 1 + sys/dev/vt/hw/fb/vt_early_fb.c | 1 + sys/dev/vt/hw/fb/vt_fb.c | 47 +++++++++++++++++++++++++++++++++++++++ sys/dev/vt/hw/fb/vt_fb.h | 1 + sys/dev/vt/hw/ofwfb/ofwfb.c | 12 ++++++++++ sys/dev/vt/hw/simplefb/simplefb.c | 12 ++++++++++ sys/dev/vt/hw/vbefb/vbefb.c | 1 + sys/dev/vt/hw/vga/vt_vga.c | 12 ++++++++++ sys/dev/vt/vt.h | 5 +++++ 10 files changed, 104 insertions(+) diff --git a/sys/dev/virtio/gpu/virtio_gpu.c b/sys/dev/virtio/gpu/virtio_gpu.c index 6209fe4beae1..ccb49a6b7695 100644 --- a/sys/dev/virtio/gpu/virtio_gpu.c +++ b/sys/dev/virtio/gpu/virtio_gpu.c @@ -102,6 +102,7 @@ static vd_bitblt_text_t vtgpu_fb_bitblt_text; static vd_bitblt_bmp_t vtgpu_fb_bitblt_bitmap; static vd_drawrect_t vtgpu_fb_drawrect; static vd_setpixel_t vtgpu_fb_setpixel; +static vd_bitblt_argb_t vtgpu_fb_bitblt_argb; static struct vt_driver vtgpu_fb_driver = { .vd_name = "virtio_gpu", @@ -111,6 +112,7 @@ static struct vt_driver vtgpu_fb_driver = { .vd_bitblt_text = vtgpu_fb_bitblt_text, .vd_invalidate_text = vt_fb_invalidate_text, .vd_bitblt_bmp = vtgpu_fb_bitblt_bitmap, + .vd_bitblt_argb = vtgpu_fb_bitblt_argb, .vd_drawrect = vtgpu_fb_drawrect, .vd_setpixel = vtgpu_fb_setpixel, .vd_postswitch = vt_fb_postswitch, @@ -180,6 +182,16 @@ vtgpu_fb_bitblt_bitmap(struct vt_device *vd, const struct vt_window *vw, vtgpu_resource_flush(sc, x, y, width, height); } +static int +vtgpu_fb_bitblt_argb(struct vt_device *vd, const struct vt_window *vw, + const uint8_t *argb, + unsigned int width, unsigned int height, + unsigned int x, unsigned int y) +{ + + return (EOPNOTSUPP); +} + static void vtgpu_fb_drawrect(struct vt_device *vd, int x1, int y1, int x2, int y2, int fill, term_color_t color) diff --git a/sys/dev/vt/hw/efifb/efifb.c b/sys/dev/vt/hw/efifb/efifb.c index 12909d836a24..3ba501c000cb 100644 --- a/sys/dev/vt/hw/efifb/efifb.c +++ b/sys/dev/vt/hw/efifb/efifb.c @@ -59,6 +59,7 @@ static struct vt_driver vt_efifb_driver = { .vd_bitblt_text = vt_fb_bitblt_text, .vd_invalidate_text = vt_fb_invalidate_text, .vd_bitblt_bmp = vt_fb_bitblt_bitmap, + .vd_bitblt_argb = vt_fb_bitblt_argb, .vd_drawrect = vt_fb_drawrect, .vd_setpixel = vt_fb_setpixel, .vd_fb_ioctl = vt_fb_ioctl, diff --git a/sys/dev/vt/hw/fb/vt_early_fb.c b/sys/dev/vt/hw/fb/vt_early_fb.c index 265a148ae556..920bfa05fd63 100644 --- a/sys/dev/vt/hw/fb/vt_early_fb.c +++ b/sys/dev/vt/hw/fb/vt_early_fb.c @@ -59,6 +59,7 @@ static struct vt_driver vt_fb_early_driver = { .vd_bitblt_text = vt_fb_bitblt_text, .vd_invalidate_text = vt_fb_invalidate_text, .vd_bitblt_bmp = vt_fb_bitblt_bitmap, + .vd_bitblt_argb = vt_fb_bitblt_argb, .vd_drawrect = vt_fb_drawrect, .vd_setpixel = vt_fb_setpixel, .vd_priority = VD_PRIORITY_GENERIC, diff --git a/sys/dev/vt/hw/fb/vt_fb.c b/sys/dev/vt/hw/fb/vt_fb.c index 5f4173ab144f..87d0595a66f1 100644 --- a/sys/dev/vt/hw/fb/vt_fb.c +++ b/sys/dev/vt/hw/fb/vt_fb.c @@ -50,6 +50,7 @@ static struct vt_driver vt_fb_driver = { .vd_bitblt_text = vt_fb_bitblt_text, .vd_invalidate_text = vt_fb_invalidate_text, .vd_bitblt_bmp = vt_fb_bitblt_bitmap, + .vd_bitblt_argb = vt_fb_bitblt_argb, .vd_drawrect = vt_fb_drawrect, .vd_setpixel = vt_fb_setpixel, .vd_postswitch = vt_fb_postswitch, @@ -333,6 +334,52 @@ vt_fb_bitblt_bitmap(struct vt_device *vd, const struct vt_window *vw, } } +int +vt_fb_bitblt_argb(struct vt_device *vd, const struct vt_window *vw, + const uint8_t *argb, + unsigned int width, unsigned int height, + unsigned int x, unsigned int y) +{ + struct fb_info *info; + uint32_t o, cc; + int bpp, xi, yi; + + info = vd->vd_softc; + bpp = FBTYPE_GET_BYTESPP(info); + if (bpp != 4) + return (EOPNOTSUPP); + + if (info->fb_flags & FB_FLAG_NOWRITE) + return (0); + + KASSERT((info->fb_vbase != 0), ("Unmapped framebuffer")); + + /* Bound by right and bottom edges. */ + if (y + height > vw->vw_draw_area.tr_end.tp_row) { + if (y >= vw->vw_draw_area.tr_end.tp_row) + return (EINVAL); + height = vw->vw_draw_area.tr_end.tp_row - y; + } + if (x + width > vw->vw_draw_area.tr_end.tp_col) { + if (x >= vw->vw_draw_area.tr_end.tp_col) + return (EINVAL); + width = vw->vw_draw_area.tr_end.tp_col - x; + } + for (yi = 0; yi < height; yi++) { + for (xi = 0; xi < (width * 4); xi += 4) { + o = (y + yi) * info->fb_stride + (x + (xi / 4)) * bpp; + o += vd->vd_transpose; + cc = (argb[yi * width * 4 + xi] << 16) | + (argb[yi * width * 4 + xi + 1] << 8) | + (argb[yi * width * 4 + xi + 2]) | + (argb[yi * width * 4 + xi + 3] << 24); + vt_fb_mem_wr4(info, o, cc); + } + } + + return (0); +} + void vt_fb_bitblt_text(struct vt_device *vd, const struct vt_window *vw, const term_rect_t *area) diff --git a/sys/dev/vt/hw/fb/vt_fb.h b/sys/dev/vt/hw/fb/vt_fb.h index 54f7ba667eb1..fc3db42b2a15 100644 --- a/sys/dev/vt/hw/fb/vt_fb.h +++ b/sys/dev/vt/hw/fb/vt_fb.h @@ -42,6 +42,7 @@ vd_blank_t vt_fb_blank; vd_bitblt_text_t vt_fb_bitblt_text; vd_invalidate_text_t vt_fb_invalidate_text; vd_bitblt_bmp_t vt_fb_bitblt_bitmap; +vd_bitblt_argb_t vt_fb_bitblt_argb; vd_drawrect_t vt_fb_drawrect; vd_setpixel_t vt_fb_setpixel; vd_postswitch_t vt_fb_postswitch; diff --git a/sys/dev/vt/hw/ofwfb/ofwfb.c b/sys/dev/vt/hw/ofwfb/ofwfb.c index 0dc0c39f92cb..aca6b6faeae1 100644 --- a/sys/dev/vt/hw/ofwfb/ofwfb.c +++ b/sys/dev/vt/hw/ofwfb/ofwfb.c @@ -67,6 +67,7 @@ static vd_probe_t ofwfb_probe; static vd_init_t ofwfb_init; static vd_bitblt_text_t ofwfb_bitblt_text; static vd_bitblt_bmp_t ofwfb_bitblt_bitmap; +static vd_bitblt_argb_t ofwfb_bitblt_argb; static const struct vt_driver vt_ofwfb_driver = { .vd_name = "ofwfb", @@ -75,6 +76,7 @@ static const struct vt_driver vt_ofwfb_driver = { .vd_blank = vt_fb_blank, .vd_bitblt_text = ofwfb_bitblt_text, .vd_bitblt_bmp = ofwfb_bitblt_bitmap, + .vd_bitblt_argb = ofwfb_bitblt_argb, .vd_fb_ioctl = vt_fb_ioctl, .vd_fb_mmap = vt_fb_mmap, .vd_priority = VD_PRIORITY_GENERIC+1, @@ -243,6 +245,16 @@ ofwfb_bitblt_bitmap(struct vt_device *vd, const struct vt_window *vw, } } +static int +ofwfb_bitblt_argb(struct vt_device *vd, const struct vt_window *vw, + const uint8_t *argb, + unsigned int width, unsigned int height, + unsigned int x, unsigned int y) +{ + + return (EOPNOTSUPP); +} + void ofwfb_bitblt_text(struct vt_device *vd, const struct vt_window *vw, const term_rect_t *area) diff --git a/sys/dev/vt/hw/simplefb/simplefb.c b/sys/dev/vt/hw/simplefb/simplefb.c index c5f17e1b3d16..2f8fd6036ae3 100644 --- a/sys/dev/vt/hw/simplefb/simplefb.c +++ b/sys/dev/vt/hw/simplefb/simplefb.c @@ -50,6 +50,7 @@ static vd_init_t vt_simplefb_init; static vd_fini_t vt_simplefb_fini; static vd_probe_t vt_simplefb_probe; +static vd_bitblt_argb_t vt_simplefb_bitblt_argb; static struct vt_driver vt_simplefb_driver = { .vd_name = "simplefb", @@ -60,6 +61,7 @@ static struct vt_driver vt_simplefb_driver = { .vd_bitblt_text = vt_fb_bitblt_text, .vd_invalidate_text = vt_fb_invalidate_text, .vd_bitblt_bmp = vt_fb_bitblt_bitmap, + .vd_bitblt_argb = vt_simplefb_bitblt_argb, .vd_drawrect = vt_fb_drawrect, .vd_setpixel = vt_fb_setpixel, .vd_fb_ioctl = vt_fb_ioctl, @@ -222,3 +224,13 @@ vt_simplefb_fini(struct vt_device *vd, void *softc) vt_fb_fini(vd, softc); pmap_unmapdev((void *)sc->fb_vbase, sc->fb_size); } + +static int +vt_simplefb_bitblt_argb(struct vt_device *vd, const struct vt_window *vw, + const uint8_t *argb, + unsigned int width, unsigned int height, + unsigned int x, unsigned int y) +{ + + return (EOPNOTSUPP); +} diff --git a/sys/dev/vt/hw/vbefb/vbefb.c b/sys/dev/vt/hw/vbefb/vbefb.c index f7dce1be0832..4e65657639b4 100644 --- a/sys/dev/vt/hw/vbefb/vbefb.c +++ b/sys/dev/vt/hw/vbefb/vbefb.c @@ -59,6 +59,7 @@ static struct vt_driver vt_vbefb_driver = { .vd_bitblt_text = vt_fb_bitblt_text, .vd_invalidate_text = vt_fb_invalidate_text, .vd_bitblt_bmp = vt_fb_bitblt_bitmap, + .vd_bitblt_argb = vt_fb_bitblt_argb, .vd_drawrect = vt_fb_drawrect, .vd_setpixel = vt_fb_setpixel, .vd_fb_ioctl = vt_fb_ioctl, diff --git a/sys/dev/vt/hw/vga/vt_vga.c b/sys/dev/vt/hw/vga/vt_vga.c index fdfbaebc0e79..51880ebb62e2 100644 --- a/sys/dev/vt/hw/vga/vt_vga.c +++ b/sys/dev/vt/hw/vga/vt_vga.c @@ -97,6 +97,7 @@ static vd_blank_t vga_blank; static vd_bitblt_text_t vga_bitblt_text; static vd_invalidate_text_t vga_invalidate_text; static vd_bitblt_bmp_t vga_bitblt_bitmap; +static vd_bitblt_argb_t vga_bitblt_argb; static vd_drawrect_t vga_drawrect; static vd_setpixel_t vga_setpixel; static vd_postswitch_t vga_postswitch; @@ -109,6 +110,7 @@ static const struct vt_driver vt_vga_driver = { .vd_bitblt_text = vga_bitblt_text, .vd_invalidate_text = vga_invalidate_text, .vd_bitblt_bmp = vga_bitblt_bitmap, + .vd_bitblt_argb = vga_bitblt_argb, .vd_drawrect = vga_drawrect, .vd_setpixel = vga_setpixel, .vd_postswitch = vga_postswitch, @@ -999,6 +1001,16 @@ vga_bitblt_bitmap(struct vt_device *vd, const struct vt_window *vw, } } +static int +vga_bitblt_argb(struct vt_device *vd, const struct vt_window *vw, + const uint8_t *argb, + unsigned int width, unsigned int height, + unsigned int x, unsigned int y) +{ + + return (EOPNOTSUPP); +} + static void vga_initialize_graphics(struct vt_device *vd) { diff --git a/sys/dev/vt/vt.h b/sys/dev/vt/vt.h index 56a28c0420c7..8e35a81bc101 100644 --- a/sys/dev/vt/vt.h +++ b/sys/dev/vt/vt.h @@ -345,6 +345,10 @@ typedef void vd_bitblt_bmp_t(struct vt_device *vd, const struct vt_window *vw, const uint8_t *pattern, const uint8_t *mask, unsigned int width, unsigned int height, unsigned int x, unsigned int y, term_color_t fg, term_color_t bg); +typedef int vd_bitblt_argb_t(struct vt_device *vd, const struct vt_window *vw, + const uint8_t *argb, + unsigned int width, unsigned int height, + unsigned int x, unsigned int y); typedef int vd_fb_ioctl_t(struct vt_device *, u_long, caddr_t, struct thread *); typedef int vd_fb_mmap_t(struct vt_device *, vm_ooffset_t, vm_paddr_t *, int, vm_memattr_t *); @@ -368,6 +372,7 @@ struct vt_driver { vd_bitblt_text_t *vd_bitblt_text; vd_invalidate_text_t *vd_invalidate_text; vd_bitblt_bmp_t *vd_bitblt_bmp; + vd_bitblt_argb_t *vd_bitblt_argb; /* Framebuffer ioctls, if present. */ vd_fb_ioctl_t *vd_fb_ioctl;