> Date: Thu, 17 Aug 2017 22:17:44 +0200
> From: Stefan Sperling <s...@stsp.name>
> 
> On Thu, Aug 17, 2017 at 09:28:43PM +0200, Mark Kettenis wrote:
> > > Date: Mon, 14 Aug 2017 01:38:56 +0200 (CEST)
> > > From: Mark Kettenis <mark.kette...@xs4all.nl>
> > > 
> > > Because I have a laptop that needs it.
> > > 
> > > ok?
> > 
> > Ping!  Anybody?
> 
> Reads fine. ok.
> 
> I don't see where rotation is enabled, e.g. where RI_ROTATE_CW or
> RI_ROTATE_CCW would be set. I suppose on zaurus it was set by MD code?
> Did anything apart from zaurus ever use rasops rotation support?
> 
> I have a tablet-like mini laptop for which I already use 90 deg
> clock-wise rotation in X with wsfb. I'm delighted to learn this
> could be done for text mode as well.

Here are the bits to do that for inteldrm(4).  We assume rotation is
wanted if with < height.  It rotates counter-clockwise because that is
what's needed on my 2-in-1.  I'm curious to see if other machines are
happy that way too.

Rotating efifb is hard.  The rotation code calls malloc(9), wich
doesn't work during the early boot phase.

ok?


Index: dev/pci/drm/files.drm
===================================================================
RCS file: /cvs/src/sys/dev/pci/drm/files.drm,v
retrieving revision 1.37
diff -u -p -r1.37 files.drm
--- dev/pci/drm/files.drm       2 Jul 2017 20:58:55 -0000       1.37
+++ dev/pci/drm/files.drm       17 Aug 2017 20:34:55 -0000
@@ -48,7 +48,7 @@ file  dev/pci/drm/ttm/ttm_object.c            ttm
 file   dev/pci/drm/ttm/ttm_page_alloc.c        ttm
 file   dev/pci/drm/ttm/ttm_tt.c                ttm
 
-device inteldrm: agpint, drmbase, wsemuldisplaydev, rasops32, i2cbus, 
i2c_bitbang
+device inteldrm: agpint, drmbase, wsemuldisplaydev, rasops32, rasops_rotation, 
i2cbus, i2c_bitbang
 attach inteldrm at pci
 file   dev/pci/drm/i915/i915_cmd_parser.c      inteldrm
 file   dev/pci/drm/i915/i915_dma.c             inteldrm
Index: dev/pci/drm/i915/i915_drv.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/drm/i915/i915_drv.c,v
retrieving revision 1.106
diff -u -p -r1.106 i915_drv.c
--- dev/pci/drm/i915/i915_drv.c 19 Jul 2017 14:34:10 -0000      1.106
+++ dev/pci/drm/i915/i915_drv.c 17 Aug 2017 20:34:55 -0000
@@ -2287,6 +2287,8 @@ inteldrm_attach(struct device *parent, s
        inteldrm_init_backlight(dev_priv);
 
        ri->ri_flg = RI_CENTER | RI_WRONLY | RI_VCONS | RI_CLEAR;
+       if (ri->ri_width < ri->ri_height)
+               ri->ri_flg |= RI_ROTATE_CCW;
        ri->ri_hw = dev_priv;
        rasops_init(ri, 160, 160);
 
@@ -2308,6 +2310,13 @@ inteldrm_attach(struct device *parent, s
 
        if (console) {
                long defattr;
+
+               /*
+                * Clear the entire screen if we're doing rotation to
+                * make sure no unrotated content survives.
+                */
+               if (ri->ri_flg & RI_ROTATE_CCW)
+                       memset(ri->ri_bits, 0, ri->ri_height * ri->ri_stride);
 
                ri->ri_ops.alloc_attr(ri->ri_active, 0, 0, 0, &defattr);
                wsdisplay_cnattach(&inteldrm_stdscreen, ri->ri_active,

Reply via email to