From: kettenis Date: Fri, 15 Jul 2022 17:57:25 +0000 (+0000) Subject: Implement support for framebuffers that don't start on a page boundary. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=63294167c4eaf171adac4fb2d8cc6d072a13af61;p=openbsd Implement support for framebuffers that don't start on a page boundary. This happens on the new 14" and 16" Macbook Pro where we deliberately use a framebuffer that skips the first few lines to avoid "the notch". The offset of the first pixel is added to struct wsdisplay_fbinfo. The stride is added as well, mirroring the value returned by the WSDISPLAYIO_LINEBYTES ioctl, such that we can retire that one in the future. A compat ioctl is implemented to help the transition. The compat code will be removed after OpenBSD 7.3 has been released. ok miod@ --- diff --git a/sys/arch/amd64/amd64/efifb.c b/sys/arch/amd64/amd64/efifb.c index c5accebf23b..6896826041a 100644 --- a/sys/arch/amd64/amd64/efifb.c +++ b/sys/arch/amd64/amd64/efifb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: efifb.c,v 1.33 2020/07/07 02:13:13 jcs Exp $ */ +/* $OpenBSD: efifb.c,v 1.34 2022/07/15 17:57:25 kettenis Exp $ */ /* * Copyright (c) 2015 YASUOKA Masahiko @@ -290,6 +290,8 @@ efifb_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p) wdf->width = ri->ri_width; wdf->height = ri->ri_height; wdf->depth = ri->ri_depth; + wdf->stride = ri->ri_stride; + wdf->offset = 0; wdf->cmsize = 0; /* color map is unavailable */ break; case WSDISPLAYIO_LINEBYTES: diff --git a/sys/arch/armv7/omap/amdisplay.c b/sys/arch/armv7/omap/amdisplay.c index da32488114c..551fb3b1804 100644 --- a/sys/arch/armv7/omap/amdisplay.c +++ b/sys/arch/armv7/omap/amdisplay.c @@ -1,4 +1,4 @@ -/* $OpenBSD: amdisplay.c,v 1.16 2021/10/24 17:52:27 mpi Exp $ */ +/* $OpenBSD: amdisplay.c,v 1.17 2022/07/15 17:57:25 kettenis Exp $ */ /* * Copyright (c) 2016 Ian Sutton * @@ -595,6 +595,8 @@ amdisplay_ioctl(void *sconf, u_long cmd, caddr_t data, int flat, struct proc *p) wdf->width = ri->ri_width; wdf->height = ri->ri_height; wdf->depth = ri->ri_depth; + wdf->stride = ri->ri_stride; + wdf->offset = 0; wdf->cmsize = 0; break; case WSDISPLAYIO_LINEBYTES: diff --git a/sys/arch/armv7/omap/omdisplay.c b/sys/arch/armv7/omap/omdisplay.c index c554c331b0c..e80a2218421 100644 --- a/sys/arch/armv7/omap/omdisplay.c +++ b/sys/arch/armv7/omap/omdisplay.c @@ -1,4 +1,4 @@ -/* $OpenBSD: omdisplay.c,v 1.9 2021/10/24 17:52:27 mpi Exp $ */ +/* $OpenBSD: omdisplay.c,v 1.10 2022/07/15 17:57:25 kettenis Exp $ */ /* * Copyright (c) 2007 Dale Rahn * @@ -596,6 +596,11 @@ omdisplay_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p) wsdisp_info->height = sc->sc_geometry->height; wsdisp_info->width = sc->sc_geometry->width; wsdisp_info->depth = 16; /* XXX */ + if (scr != NULL) + wsdisp_info->stride = scr->rinfo.r_stride; + else + wsdisp_info->stride = 0; + wsdisp_info->offset = 0; wsdisp_info->cmsize = 0; break; diff --git a/sys/arch/loongson/dev/radeonfb.c b/sys/arch/loongson/dev/radeonfb.c index 96fe82e8d9e..63054969f7b 100644 --- a/sys/arch/loongson/dev/radeonfb.c +++ b/sys/arch/loongson/dev/radeonfb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radeonfb.c,v 1.4 2020/05/25 09:55:48 jsg Exp $ */ +/* $OpenBSD: radeonfb.c,v 1.5 2022/07/15 17:57:26 kettenis Exp $ */ /* * Copyright (c) 2009 Mark Kettenis. @@ -306,6 +306,8 @@ radeonfb_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p) wdf->width = ri->ri_width; wdf->height = ri->ri_height; wdf->depth = ri->ri_depth; + wdf->stride = ri->ri_stride; + wdf->offset = 0; wdf->cmsize = 0; break; case WSDISPLAYIO_LINEBYTES: diff --git a/sys/arch/loongson/dev/sisfb.c b/sys/arch/loongson/dev/sisfb.c index d6867983ed8..a86cbca608f 100644 --- a/sys/arch/loongson/dev/sisfb.c +++ b/sys/arch/loongson/dev/sisfb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sisfb.c,v 1.9 2021/03/11 11:16:58 jsg Exp $ */ +/* $OpenBSD: sisfb.c,v 1.10 2022/07/15 17:57:26 kettenis Exp $ */ /* * Copyright (c) 2010 Miodrag Vallat. @@ -300,6 +300,8 @@ sisfb_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p) wdf->width = ri->ri_width; wdf->height = ri->ri_height; wdf->depth = ri->ri_depth; + wdf->stride = ri->ri_stride; + wdf->offset = 0; wdf->cmsize = 256; break; case WSDISPLAYIO_LINEBYTES: diff --git a/sys/arch/loongson/dev/smfb.c b/sys/arch/loongson/dev/smfb.c index 2cda10d91aa..840bfa764a1 100644 --- a/sys/arch/loongson/dev/smfb.c +++ b/sys/arch/loongson/dev/smfb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smfb.c,v 1.20 2021/01/02 14:29:16 visa Exp $ */ +/* $OpenBSD: smfb.c,v 1.21 2022/07/15 17:57:26 kettenis Exp $ */ /* * Copyright (c) 2009, 2010 Miodrag Vallat. @@ -282,6 +282,8 @@ smfb_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p) wdf->width = ri->ri_width; wdf->height = ri->ri_height; wdf->depth = ri->ri_depth; + wdf->stride = ri->ri_stride; + wdf->offset = 0; wdf->cmsize = 0; break; case WSDISPLAYIO_LINEBYTES: diff --git a/sys/arch/luna88k/dev/lunafb.c b/sys/arch/luna88k/dev/lunafb.c index 5b7a9320c6c..7f0e2e60d38 100644 --- a/sys/arch/luna88k/dev/lunafb.c +++ b/sys/arch/luna88k/dev/lunafb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lunafb.c,v 1.28 2021/09/17 12:02:31 aoyama Exp $ */ +/* $OpenBSD: lunafb.c,v 1.29 2022/07/15 17:57:26 kettenis Exp $ */ /* $NetBSD: lunafb.c,v 1.7.6.1 2002/08/07 01:48:34 lukem Exp $ */ /*- @@ -243,6 +243,8 @@ omfbioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p) wsd_fbip->height = dc->dc_ht; wsd_fbip->width = dc->dc_wid; wsd_fbip->depth = dc->dc_depth; + wsd_fbip->stride = dc->dc_rowbytes; + wsd_fbip->offset = 8; wsd_fbip->cmsize = dc->dc_cmsize; #undef wsd_fbip break; diff --git a/sys/arch/macppc/pci/vgafb.c b/sys/arch/macppc/pci/vgafb.c index e3752045b95..2994310f604 100644 --- a/sys/arch/macppc/pci/vgafb.c +++ b/sys/arch/macppc/pci/vgafb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vgafb.c,v 1.62 2020/05/25 09:55:48 jsg Exp $ */ +/* $OpenBSD: vgafb.c,v 1.63 2022/07/15 17:57:26 kettenis Exp $ */ /* $NetBSD: vga.c,v 1.3 1996/12/02 22:24:54 cgd Exp $ */ /* @@ -228,6 +228,8 @@ vgafb_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p) wdf->width = ri->ri_width; wdf->height = ri->ri_height; wdf->depth = ri->ri_depth; + wdf->stride = ri->ri_stride; + wdf->offset = 0; wdf->cmsize = 256; break; case WSDISPLAYIO_LINEBYTES: diff --git a/sys/arch/powerpc64/dev/astfb.c b/sys/arch/powerpc64/dev/astfb.c index 398b9288ad7..450acbd743b 100644 --- a/sys/arch/powerpc64/dev/astfb.c +++ b/sys/arch/powerpc64/dev/astfb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: astfb.c,v 1.4 2022/04/06 18:59:27 naddy Exp $ */ +/* $OpenBSD: astfb.c,v 1.5 2022/07/15 17:57:26 kettenis Exp $ */ /* * Copyright (c) 2020 Mark Kettenis. @@ -201,6 +201,8 @@ astfb_wsioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p) wdf->width = ri->ri_width; wdf->height = ri->ri_height; wdf->depth = ri->ri_depth; + wdf->stride = ri->ri_stride; + wdf->offset = 0; wdf->cmsize = 0; /* color map is unavailable */ break; case WSDISPLAYIO_LINEBYTES: diff --git a/sys/arch/sparc64/dev/creator.c b/sys/arch/sparc64/dev/creator.c index a98955aef84..d149cb3842c 100644 --- a/sys/arch/sparc64/dev/creator.c +++ b/sys/arch/sparc64/dev/creator.c @@ -1,4 +1,4 @@ -/* $OpenBSD: creator.c,v 1.54 2021/10/24 17:05:03 mpi Exp $ */ +/* $OpenBSD: creator.c,v 1.55 2022/07/15 17:57:26 kettenis Exp $ */ /* * Copyright (c) 2002 Jason L. Wright (jason@thought.net) @@ -258,6 +258,8 @@ creator_ioctl(v, cmd, data, flags, p) wdf->height = sc->sc_sunfb.sf_height; wdf->width = sc->sc_sunfb.sf_width; wdf->depth = 32; + wdf->stride = sc->sc_sunfb.sf_linebytes; + wdf->offset = 0; wdf->cmsize = 0; break; case WSDISPLAYIO_GETSUPPORTEDDEPTH: diff --git a/sys/arch/sparc64/dev/gfb.c b/sys/arch/sparc64/dev/gfb.c index e0db571e4db..1742f7980d5 100644 --- a/sys/arch/sparc64/dev/gfb.c +++ b/sys/arch/sparc64/dev/gfb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gfb.c,v 1.3 2021/10/24 17:05:03 mpi Exp $ */ +/* $OpenBSD: gfb.c,v 1.4 2022/07/15 17:57:26 kettenis Exp $ */ /* * Copyright (c) 2009 Mark Kettenis. @@ -117,6 +117,8 @@ gfb_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p) wdf->height = sc->sc_sunfb.sf_height; wdf->width = sc->sc_sunfb.sf_width; wdf->depth = sc->sc_sunfb.sf_depth; + wdf->stride = sc->sc_sunfb.sf_linebytes; + wdf->offset = 0; wdf->cmsize = 256; break; case WSDISPLAYIO_LINEBYTES: diff --git a/sys/arch/sparc64/dev/gfxp.c b/sys/arch/sparc64/dev/gfxp.c index ddfec9ae7d8..84568580e2f 100644 --- a/sys/arch/sparc64/dev/gfxp.c +++ b/sys/arch/sparc64/dev/gfxp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gfxp.c,v 1.15 2021/10/24 17:05:03 mpi Exp $ */ +/* $OpenBSD: gfxp.c,v 1.16 2022/07/15 17:57:26 kettenis Exp $ */ /* * Copyright (c) 2009 Mark Kettenis. @@ -274,6 +274,8 @@ gfxp_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p) wdf->height = sc->sc_sunfb.sf_height; wdf->width = sc->sc_sunfb.sf_width; wdf->depth = sc->sc_sunfb.sf_depth; + wdf->stride = sc->sc_sunfb.sf_linebytes; + wdf->offset = 0; if (sc->sc_sunfb.sf_depth == 32) wdf->cmsize = 0; else diff --git a/sys/arch/sparc64/dev/ifb.c b/sys/arch/sparc64/dev/ifb.c index c2931781f88..c2886dbbe45 100644 --- a/sys/arch/sparc64/dev/ifb.c +++ b/sys/arch/sparc64/dev/ifb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ifb.c,v 1.25 2021/10/24 17:05:03 mpi Exp $ */ +/* $OpenBSD: ifb.c,v 1.26 2022/07/15 17:57:26 kettenis Exp $ */ /* * Copyright (c) 2007, 2008, 2009 Miodrag Vallat. @@ -561,6 +561,8 @@ ifb_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p) wdf->height = sc->sc_sunfb.sf_height; wdf->width = sc->sc_sunfb.sf_width; wdf->depth = sc->sc_sunfb.sf_depth; + wdf->stride = sc->sc_sunfb.sf_linebytes; + wdf->offset = 0; wdf->cmsize = 256; break; case WSDISPLAYIO_LINEBYTES: diff --git a/sys/arch/sparc64/dev/machfb.c b/sys/arch/sparc64/dev/machfb.c index 6f21125a1ab..21cc38e2a69 100644 --- a/sys/arch/sparc64/dev/machfb.c +++ b/sys/arch/sparc64/dev/machfb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machfb.c,v 1.12 2021/10/24 17:05:03 mpi Exp $ */ +/* $OpenBSD: machfb.c,v 1.13 2022/07/15 17:57:26 kettenis Exp $ */ /* * Copyright (c) 2009 Mark Kettenis. @@ -347,6 +347,8 @@ machfb_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p) wdf->height = sc->sc_sunfb.sf_height; wdf->width = sc->sc_sunfb.sf_width; wdf->depth = sc->sc_sunfb.sf_depth; + wdf->stride = sc->sc_sunfb.sf_linebytes; + wdf->offset = 0; wdf->cmsize = 256; break; case WSDISPLAYIO_LINEBYTES: diff --git a/sys/arch/sparc64/dev/radeonfb.c b/sys/arch/sparc64/dev/radeonfb.c index 5b81ae6ac6d..e94dc7278af 100644 --- a/sys/arch/sparc64/dev/radeonfb.c +++ b/sys/arch/sparc64/dev/radeonfb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radeonfb.c,v 1.7 2021/10/24 17:05:04 mpi Exp $ */ +/* $OpenBSD: radeonfb.c,v 1.8 2022/07/15 17:57:26 kettenis Exp $ */ /* * Copyright (c) 2009 Mark Kettenis. @@ -268,6 +268,8 @@ radeonfb_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p) wdf->height = sc->sc_sunfb.sf_height; wdf->width = sc->sc_sunfb.sf_width; wdf->depth = sc->sc_sunfb.sf_depth; + wdf->stride = sc->sc_sunfb.sf_linebytes; + wdf->offset = 0; if (sc->sc_sunfb.sf_depth == 32) wdf->cmsize = 0; else diff --git a/sys/arch/sparc64/dev/raptor.c b/sys/arch/sparc64/dev/raptor.c index fbd60381563..86c0abbbfcc 100644 --- a/sys/arch/sparc64/dev/raptor.c +++ b/sys/arch/sparc64/dev/raptor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: raptor.c,v 1.11 2021/10/24 17:05:04 mpi Exp $ */ +/* $OpenBSD: raptor.c,v 1.12 2022/07/15 17:57:26 kettenis Exp $ */ /* * Copyright (c) 2009 Mark Kettenis. @@ -257,6 +257,8 @@ raptor_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p) wdf->height = sc->sc_sunfb.sf_height; wdf->width = sc->sc_sunfb.sf_width; wdf->depth = sc->sc_sunfb.sf_depth; + wdf->stride = sc->sc_sunfb.sf_linebytes; + wdf->offset = 0; wdf->cmsize = 256; break; case WSDISPLAYIO_LINEBYTES: diff --git a/sys/arch/sparc64/dev/vgafb.c b/sys/arch/sparc64/dev/vgafb.c index 8f3bd1ac84b..d5624a4c517 100644 --- a/sys/arch/sparc64/dev/vgafb.c +++ b/sys/arch/sparc64/dev/vgafb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vgafb.c,v 1.67 2021/10/24 17:05:04 mpi Exp $ */ +/* $OpenBSD: vgafb.c,v 1.68 2022/07/15 17:57:26 kettenis Exp $ */ /* * Copyright (c) 2001 Jason L. Wright (jason@thought.net) @@ -212,6 +212,8 @@ vgafb_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p) wdf->height = sc->sc_sunfb.sf_height; wdf->width = sc->sc_sunfb.sf_width; wdf->depth = sc->sc_sunfb.sf_depth; + wdf->stride = sc->sc_sunfb.sf_linebytes; + wdf->offset = 0; wdf->cmsize = 256; break; case WSDISPLAYIO_GETSUPPORTEDDEPTH: diff --git a/sys/dev/fdt/rkdrm.c b/sys/dev/fdt/rkdrm.c index bccda1b84db..634f108277d 100644 --- a/sys/dev/fdt/rkdrm.c +++ b/sys/dev/fdt/rkdrm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rkdrm.c,v 1.13 2022/04/06 18:59:28 naddy Exp $ */ +/* $OpenBSD: rkdrm.c,v 1.14 2022/07/15 17:57:26 kettenis Exp $ */ /* $NetBSD: rk_drm.c,v 1.3 2019/12/15 01:00:58 mrg Exp $ */ /*- * Copyright (c) 2019 Jared D. McNeill @@ -276,6 +276,8 @@ rkdrm_wsioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p) wdf->width = ri->ri_width; wdf->height = ri->ri_height; wdf->depth = ri->ri_depth; + wdf->stride = ri->ri_stride; + wdf->offset = 0; wdf->cmsize = 0; return 0; case WSDISPLAYIO_LINEBYTES: diff --git a/sys/dev/fdt/simplefb.c b/sys/dev/fdt/simplefb.c index 985a584f5bf..1c9d14114d0 100644 --- a/sys/dev/fdt/simplefb.c +++ b/sys/dev/fdt/simplefb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: simplefb.c,v 1.15 2022/01/09 05:42:37 jsg Exp $ */ +/* $OpenBSD: simplefb.c,v 1.16 2022/07/15 17:57:26 kettenis Exp $ */ /* * Copyright (c) 2016 Mark Kettenis * @@ -234,6 +234,7 @@ int simplefb_wsioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p) { struct rasops_info *ri = v; + struct simplefb_softc *sc = ri->ri_hw; struct wsdisplay_param *dp = (struct wsdisplay_param *)data; struct wsdisplay_fbinfo *wdf; @@ -254,6 +255,8 @@ simplefb_wsioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p) wdf->width = ri->ri_width; wdf->height = ri->ri_height; wdf->depth = ri->ri_depth; + wdf->stride = ri->ri_stride; + wdf->offset = sc->sc_paddr & PAGE_MASK; wdf->cmsize = 0; /* color map is unavailable */ break; case WSDISPLAYIO_LINEBYTES: diff --git a/sys/dev/fdt/ssdfb.c b/sys/dev/fdt/ssdfb.c index a457701384f..6a172850b2b 100644 --- a/sys/dev/fdt/ssdfb.c +++ b/sys/dev/fdt/ssdfb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssdfb.c,v 1.12 2021/10/24 17:52:27 mpi Exp $ */ +/* $OpenBSD: ssdfb.c,v 1.13 2022/07/15 17:57:26 kettenis Exp $ */ /* * Copyright (c) 2018 Patrick Wildt * @@ -634,6 +634,8 @@ ssdfb_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p) wdf->width = ri->ri_width; wdf->height = ri->ri_height; wdf->depth = ri->ri_depth; + wdf->stride = ri->ri_stride; + wdf->offset = 0; wdf->cmsize = 0; /* color map is unavailable */ break; case WSDISPLAYIO_LINEBYTES: diff --git a/sys/dev/ic/sti.c b/sys/dev/ic/sti.c index 87a9fa37697..d4628e54f7a 100644 --- a/sys/dev/ic/sti.c +++ b/sys/dev/ic/sti.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sti.c,v 1.81 2021/04/29 15:12:14 kettenis Exp $ */ +/* $OpenBSD: sti.c,v 1.82 2022/07/15 17:57:26 kettenis Exp $ */ /* * Copyright (c) 2000-2003 Michael Shalayeff @@ -1114,6 +1114,11 @@ sti_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p) wdf->height = scr->scr_cfg.scr_height; wdf->width = scr->scr_cfg.scr_width; wdf->depth = scr->scr_bpp; + if (scr->scr_bpp > 8) + wdf->stride = scr->sc_cfg.fb_width * 4; + else + wdf->stride = src->sc_cfg.fb_width; + wdf->offset = 0; if (scr->putcmap == NULL || scr->scr_bpp > 8) wdf->cmsize = 0; else diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_kms.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_kms.c index 262e8fdb05b..66e36cde096 100644 --- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_kms.c +++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_kms.c @@ -2015,6 +2015,8 @@ amdgpu_wsioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p) wdf->width = ri->ri_width; wdf->height = ri->ri_height; wdf->depth = ri->ri_depth; + wdf->stride = ri->ri_stride; + wdf->offset = 0; wdf->cmsize = 0; return 0; case WSDISPLAYIO_GETPARAM: diff --git a/sys/dev/pci/drm/i915/i915_drv.c b/sys/dev/pci/drm/i915/i915_drv.c index d8d52895951..0510113caef 100644 --- a/sys/dev/pci/drm/i915/i915_drv.c +++ b/sys/dev/pci/drm/i915/i915_drv.c @@ -2104,6 +2104,8 @@ inteldrm_wsioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p) wdf->width = ri->ri_width; wdf->height = ri->ri_height; wdf->depth = ri->ri_depth; + wdf->stride = ri->ri_stride; + wdf->offset = 0; wdf->cmsize = 0; return 0; case WSDISPLAYIO_GETPARAM: diff --git a/sys/dev/pci/drm/radeon/radeon_kms.c b/sys/dev/pci/drm/radeon/radeon_kms.c index 8d412fffb3c..75702aafd11 100644 --- a/sys/dev/pci/drm/radeon/radeon_kms.c +++ b/sys/dev/pci/drm/radeon/radeon_kms.c @@ -241,6 +241,8 @@ radeondrm_wsioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p) wdf->width = ri->ri_width; wdf->height = ri->ri_height; wdf->depth = ri->ri_depth; + wdf->stride = ri->ri_stride; + wdf->offset = 0; wdf->cmsize = 0; return 0; case WSDISPLAYIO_GETPARAM: diff --git a/sys/dev/pci/tga.c b/sys/dev/pci/tga.c index 8711c16ab87..222fa777892 100644 --- a/sys/dev/pci/tga.c +++ b/sys/dev/pci/tga.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tga.c,v 1.42 2022/03/11 18:00:52 mpi Exp $ */ +/* $OpenBSD: tga.c,v 1.43 2022/07/15 17:57:26 kettenis Exp $ */ /* $NetBSD: tga.c,v 1.40 2002/03/13 15:05:18 ad Exp $ */ /* @@ -594,6 +594,8 @@ tga_ioctl(v, cmd, data, flag, p) wsd_fbip->height = sc->sc_dc->dc_ht; wsd_fbip->width = sc->sc_dc->dc_wid; wsd_fbip->depth = sc->sc_dc->dc_tgaconf->tgac_phys_depth; + wsd_fbip->stride = sc->sc_dc->dc_rowbytes; + wsd_fbip->offset = 0; wsd_fbip->cmsize = 1024; /* XXX ??? */ #undef wsd_fbip break; diff --git a/sys/dev/pcmcia/cfxga.c b/sys/dev/pcmcia/cfxga.c index 11f6597992b..2237db1fb55 100644 --- a/sys/dev/pcmcia/cfxga.c +++ b/sys/dev/pcmcia/cfxga.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cfxga.c,v 1.32 2022/04/06 18:59:30 naddy Exp $ */ +/* $OpenBSD: cfxga.c,v 1.33 2022/07/15 17:57:26 kettenis Exp $ */ /* * Copyright (c) 2005, 2006, Matthieu Herrb and Miodrag Vallat @@ -595,11 +595,14 @@ cfxga_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p) scr = sc->sc_active; if (scr == NULL) { /* try later...after running wsconscfg to add screens */ - wdf->height = wdf->width = wdf->depth = wdf->cmsize = 0; + wdf->height = wdf->width = wdf->depth = 0; + wdf->stride = wdf->offset = wdf->cmsize = 0; } else { wdf->height = scr->scr_ri.ri_height; wdf->width = scr->scr_ri.ri_width; wdf->depth = scr->scr_ri.ri_depth; + wdf->stride = scr->scr_ri.ri_stride; + wdf->offset = 0; wdf->cmsize = scr->scr_ri.ri_depth <= 8 ? (1 << scr->scr_ri.ri_depth) : 0; } diff --git a/sys/dev/sbus/agten.c b/sys/dev/sbus/agten.c index 03a8fe0c79c..5fa76a2fa8c 100644 --- a/sys/dev/sbus/agten.c +++ b/sys/dev/sbus/agten.c @@ -1,4 +1,4 @@ -/* $OpenBSD: agten.c,v 1.12 2022/03/13 13:34:54 mpi Exp $ */ +/* $OpenBSD: agten.c,v 1.13 2022/07/15 17:57:26 kettenis Exp $ */ /* * Copyright (c) 2002, 2003, Miodrag Vallat. * All rights reserved. @@ -237,6 +237,8 @@ agten_ioctl(void *dev, u_long cmd, caddr_t data, int flags, struct proc *p) wdf->height = sc->sc_sunfb.sf_height; wdf->width = sc->sc_sunfb.sf_width; wdf->depth = sc->sc_sunfb.sf_depth; + wdf->stride = sc->sc_sunfb.sf_linebytes; + wdf->offset = 0; wdf->cmsize = (sc->sc_sunfb.sf_depth == 8) ? 256 : 0; break; case WSDISPLAYIO_LINEBYTES: diff --git a/sys/dev/sbus/bwtwo.c b/sys/dev/sbus/bwtwo.c index e81f50222b7..ef130106359 100644 --- a/sys/dev/sbus/bwtwo.c +++ b/sys/dev/sbus/bwtwo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bwtwo.c,v 1.20 2022/03/13 13:34:54 mpi Exp $ */ +/* $OpenBSD: bwtwo.c,v 1.21 2022/07/15 17:57:27 kettenis Exp $ */ /* * Copyright (c) 2002 Jason L. Wright (jason@thought.net) @@ -225,6 +225,8 @@ bwtwo_ioctl(v, cmd, data, flags, p) wdf->height = sc->sc_sunfb.sf_height; wdf->width = sc->sc_sunfb.sf_width; wdf->depth = sc->sc_sunfb.sf_depth; + wdf->stride = sc->sc_sunfb.sf_linebytes; + wdf->offset = 0; wdf->cmsize = 0; break; case WSDISPLAYIO_LINEBYTES: diff --git a/sys/dev/sbus/cgsix.c b/sys/dev/sbus/cgsix.c index 2f5adfefb3c..9b4e8e669e4 100644 --- a/sys/dev/sbus/cgsix.c +++ b/sys/dev/sbus/cgsix.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cgsix.c,v 1.61 2022/03/13 13:34:54 mpi Exp $ */ +/* $OpenBSD: cgsix.c,v 1.62 2022/07/15 17:57:27 kettenis Exp $ */ /* * Copyright (c) 2001 Jason L. Wright (jason@thought.net) @@ -270,6 +270,8 @@ cgsix_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p) wdf->height = sc->sc_sunfb.sf_height; wdf->width = sc->sc_sunfb.sf_width; wdf->depth = sc->sc_sunfb.sf_depth; + wdf->stride = sc->sc_sunfb.sf_linebytes; + wdf->offset = 0; wdf->cmsize = 256; break; case WSDISPLAYIO_LINEBYTES: diff --git a/sys/dev/sbus/cgthree.c b/sys/dev/sbus/cgthree.c index 000fa09c4be..612720a5c29 100644 --- a/sys/dev/sbus/cgthree.c +++ b/sys/dev/sbus/cgthree.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cgthree.c,v 1.46 2022/03/13 13:34:54 mpi Exp $ */ +/* $OpenBSD: cgthree.c,v 1.47 2022/07/15 17:57:27 kettenis Exp $ */ /* * Copyright (c) 2001 Jason L. Wright (jason@thought.net) @@ -282,6 +282,8 @@ cgthree_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p) wdf->height = sc->sc_sunfb.sf_height; wdf->width = sc->sc_sunfb.sf_width; wdf->depth = sc->sc_sunfb.sf_depth; + wdf->stride = sc->sc_sunfb.sf_linebytes; + wdf->offset = 0; wdf->cmsize = 256; break; case WSDISPLAYIO_LINEBYTES: diff --git a/sys/dev/sbus/cgtwelve.c b/sys/dev/sbus/cgtwelve.c index f8f61c48376..a09a46aa78d 100644 --- a/sys/dev/sbus/cgtwelve.c +++ b/sys/dev/sbus/cgtwelve.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cgtwelve.c,v 1.11 2022/03/13 13:34:54 mpi Exp $ */ +/* $OpenBSD: cgtwelve.c,v 1.12 2022/07/15 17:57:27 kettenis Exp $ */ /* * Copyright (c) 2002, 2003 Miodrag Vallat. All rights reserved. @@ -279,6 +279,8 @@ cgtwelve_ioctl(void *dev, u_long cmd, caddr_t data, int flags, struct proc *p) wdf->height = sc->sc_sunfb.sf_height; wdf->width = sc->sc_sunfb.sf_width; wdf->depth = 32; + wdf->stride = sc->sc_sunfb.sf_linebytes * 32; + wdf->offset = 0; wdf->cmsize = 0; break; case WSDISPLAYIO_GETSUPPORTEDDEPTH: diff --git a/sys/dev/sbus/mgx.c b/sys/dev/sbus/mgx.c index 7c336cbd94c..bbaab80ca80 100644 --- a/sys/dev/sbus/mgx.c +++ b/sys/dev/sbus/mgx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mgx.c,v 1.15 2022/03/13 13:34:54 mpi Exp $ */ +/* $OpenBSD: mgx.c,v 1.16 2022/07/15 17:57:27 kettenis Exp $ */ /* * Copyright (c) 2003, Miodrag Vallat. * All rights reserved. @@ -359,6 +359,8 @@ mgx_ioctl(void *dev, u_long cmd, caddr_t data, int flags, struct proc *p) wdf->height = sc->sc_sunfb.sf_height; wdf->width = sc->sc_sunfb.sf_width; wdf->depth = sc->sc_sunfb.sf_depth; + wdf->stride = sc->sc_sunfb.sf_linebytes; + wdf->offset = 0; wdf->cmsize = 256; break; case WSDISPLAYIO_LINEBYTES: diff --git a/sys/dev/sbus/rfx.c b/sys/dev/sbus/rfx.c index 96b504ef1c5..8dd7844de62 100644 --- a/sys/dev/sbus/rfx.c +++ b/sys/dev/sbus/rfx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rfx.c,v 1.14 2022/03/13 13:34:54 mpi Exp $ */ +/* $OpenBSD: rfx.c,v 1.15 2022/07/15 17:57:27 kettenis Exp $ */ /* * Copyright (c) 2004, Miodrag Vallat. @@ -321,6 +321,8 @@ rfx_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p) wdf->height = sc->sc_sunfb.sf_height; wdf->width = sc->sc_sunfb.sf_width; wdf->depth = sc->sc_sunfb.sf_depth; + wdf->stride = sc->sc_sunfb.sf_linebytes; + wdf->offset = 0; wdf->cmsize = 256; break; case WSDISPLAYIO_LINEBYTES: diff --git a/sys/dev/sbus/tvtwo.c b/sys/dev/sbus/tvtwo.c index 4ff7dc720c2..06e26a3c113 100644 --- a/sys/dev/sbus/tvtwo.c +++ b/sys/dev/sbus/tvtwo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tvtwo.c,v 1.17 2022/03/13 13:34:54 mpi Exp $ */ +/* $OpenBSD: tvtwo.c,v 1.18 2022/07/15 17:57:27 kettenis Exp $ */ /* * Copyright (c) 2003, 2006, 2008, Miodrag Vallat. @@ -313,6 +313,8 @@ tvtwo_ioctl(void *dev, u_long cmd, caddr_t data, int flags, struct proc *p) wdf->height = sc->sc_sunfb.sf_height; wdf->width = sc->sc_sunfb.sf_width; wdf->depth = 32; + wdf->stride = sc->sc_sunfb.sf_linebytes * 4; + wdf->offset = 0; wdf->cmsize = 0; break; case WSDISPLAYIO_GETSUPPORTEDDEPTH: diff --git a/sys/dev/sbus/vigra.c b/sys/dev/sbus/vigra.c index ae6f7ffd67e..90a8394ce33 100644 --- a/sys/dev/sbus/vigra.c +++ b/sys/dev/sbus/vigra.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vigra.c,v 1.13 2022/03/13 13:34:54 mpi Exp $ */ +/* $OpenBSD: vigra.c,v 1.14 2022/07/15 17:57:27 kettenis Exp $ */ /* * Copyright (c) 2002, 2003, Miodrag Vallat. @@ -330,6 +330,8 @@ vigra_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p) wdf->height = sc->sc_sunfb.sf_height; wdf->width = sc->sc_sunfb.sf_width; wdf->depth = sc->sc_sunfb.sf_depth; + wdf->stride = sc->sc_sunfb.sf_linebytes; + wdf->offset = 0; wdf->cmsize = 256; break; case WSDISPLAYIO_LINEBYTES: diff --git a/sys/dev/sbus/zx.c b/sys/dev/sbus/zx.c index cfefe7ffc6a..a4969b77de5 100644 --- a/sys/dev/sbus/zx.c +++ b/sys/dev/sbus/zx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: zx.c,v 1.23 2022/03/13 13:34:54 mpi Exp $ */ +/* $OpenBSD: zx.c,v 1.24 2022/07/15 17:57:27 kettenis Exp $ */ /* $NetBSD: zx.c,v 1.5 2002/10/02 16:52:46 thorpej Exp $ */ /* @@ -330,6 +330,8 @@ zx_ioctl(void *dev, u_long cmd, caddr_t data, int flags, struct proc *p) wdf->height = sc->sc_sunfb.sf_height; wdf->width = sc->sc_sunfb.sf_width; wdf->depth = 32; + wdf->stride = sc->sc_sunfb.sf_linebytes; + wdf->offset = 0; wdf->cmsize = 0; break; case WSDISPLAYIO_GETSUPPORTEDDEPTH: diff --git a/sys/dev/usb/udl.c b/sys/dev/usb/udl.c index 0a20c09a605..008ae4bb159 100644 --- a/sys/dev/usb/udl.c +++ b/sys/dev/usb/udl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: udl.c,v 1.97 2022/01/09 05:43:00 jsg Exp $ */ +/* $OpenBSD: udl.c,v 1.98 2022/07/15 17:57:27 kettenis Exp $ */ /* * Copyright (c) 2009 Marcus Glocker @@ -509,6 +509,8 @@ udl_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p) wdf->height = sc->sc_height; wdf->width = sc->sc_width; wdf->depth = sc->sc_depth; + wdf->stride = sc->sc_width * (sc->sc_depth / 8); + wdf->offset = 0; wdf->cmsize = 0; /* XXX fill up colormap size */ break; case WSDISPLAYIO_SMODE: diff --git a/sys/dev/wscons/wsconsio.h b/sys/dev/wscons/wsconsio.h index 9a3fbb142dc..de483493360 100644 --- a/sys/dev/wscons/wsconsio.h +++ b/sys/dev/wscons/wsconsio.h @@ -1,4 +1,4 @@ -/* $OpenBSD: wsconsio.h,v 1.97 2021/03/12 23:42:50 kettenis Exp $ */ +/* $OpenBSD: wsconsio.h,v 1.98 2022/07/15 17:57:27 kettenis Exp $ */ /* $NetBSD: wsconsio.h,v 1.74 2005/04/28 07:15:44 martin Exp $ */ /* @@ -448,10 +448,21 @@ struct wsdisplay_fbinfo { u_int height; /* height in pixels */ u_int width; /* width in pixels */ u_int depth; /* bits per pixel */ + u_int stride; /* bytes per line */ + u_int offset; /* first pixel offset (bytes) */ u_int cmsize; /* color map size (entries) */ }; #define WSDISPLAYIO_GINFO _IOR('W', 65, struct wsdisplay_fbinfo) +/* Backwards compat; remove after OpenBSD 7.3 is released. */ +struct wsdisplay_ofbinfo { + u_int height; /* height in pixels */ + u_int width; /* width in pixels */ + u_int depth; /* bits per pixel */ + u_int cmsize; /* color map size (entries) */ +}; +#define WSDISPLAYIO_OGINFO _IOR('W', 65, struct wsdisplay_ofbinfo) + /* Colormap operations. Not applicable to all display types. */ struct wsdisplay_cmap { u_int index; /* first element (0 origin) */ diff --git a/sys/dev/wscons/wsdisplay.c b/sys/dev/wscons/wsdisplay.c index b86602e2895..cc6f1008497 100644 --- a/sys/dev/wscons/wsdisplay.c +++ b/sys/dev/wscons/wsdisplay.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsdisplay.c,v 1.148 2022/07/08 21:29:20 miod Exp $ */ +/* $OpenBSD: wsdisplay.c,v 1.149 2022/07/15 17:57:27 kettenis Exp $ */ /* $NetBSD: wsdisplay.c,v 1.82 2005/02/27 00:27:52 perry Exp $ */ /* @@ -1302,6 +1302,25 @@ wsdisplay_driver_ioctl(struct wsdisplay_softc *sc, u_long cmd, caddr_t data, { int error; +#if defined(OpenBSD7_1) || defined(OpenBSD7_2) || defined(OpenBSD7_3) + if (cmd == WSDISPLAYIO_OGINFO) { + struct wsdisplay_ofbinfo *oinfo = + (struct wsdisplay_ofbinfo *)data; + struct wsdisplay_fbinfo info; + + error = (*sc->sc_accessops->ioctl)(sc->sc_accesscookie, + WSDISPLAYIO_GINFO, (caddr_t)&info, flag, p); + if (error) + return error; + + oinfo->height = info.height; + oinfo->width = info.width; + oinfo->depth = info.depth; + oinfo->cmsize = info.cmsize; + return (0); + } +#endif + error = ((*sc->sc_accessops->ioctl)(sc->sc_accesscookie, cmd, data, flag, p)); /* Do not report parameters with empty ranges to userland. */