9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] igfx on haswell
@ 2021-11-10 15:03 qwx
  2021-11-12 18:37 ` Kyle Milz
  0 siblings, 1 reply; 7+ messages in thread
From: qwx @ 2021-11-10 15:03 UTC (permalink / raw)
  To: 9front

Hello,

I recently acquired an x240 and upgraded it with some
x250 parts, and I noticed that igfx now magically works
on it.  Previous reports suggested that the only
haswell machines on which igfx worked were the two I
had worked with in the past.  Everything was configured
correctly according to both the spec and the values of
the card's registers, but screens remained blank, and
short of blind guessing games and trial and error, I
couldn't do much debugging without the hardware at hand.
Since broadwell is not very different from haswell, it's
possible that it works there as well without modification.

It would be great if anyone with haswell (*40 thinkpads)
or broadwell (*50 thinkpads) could try to test if it
works for them as well.  eDP (internal display), DP
and HDMI/DVI could/should work, as they do for me.  Note
that haswell VGA is still unimplemented.

The steps necessary are adding the PCI did (use pci(8))
to /lib/vgadb under the igfx ctrl entry, and
/sys/src/cmd/aux/vga/igfx.c:/^devtype if it's not
there already, and either booting with monitor=auto in
plan9.ini, or calling vga(8) eg.:

	; aux/vga -m auto -l $vgasize

If things worked correctly, you will see a picture,
otherwise the screen will remain blank.

Setups that require more than just automatic
configuration would be more painful.  You could either
refer to [1] or ask here, but please don't waste too
much time :)

Thanks!

Cheers,
qwx

[1] http://nopenopenope.net/posts/igfx

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [9front] igfx on haswell
  2021-11-10 15:03 [9front] igfx on haswell qwx
@ 2021-11-12 18:37 ` Kyle Milz
  2021-11-13  9:42   ` qwx
  0 siblings, 1 reply; 7+ messages in thread
From: Kyle Milz @ 2021-11-12 18:37 UTC (permalink / raw)
  To: 9front

[-- Attachment #1: vga_igfx_5500.diff --]
[-- Type: text/plain, Size: 1170 bytes --]

hi,

diff below seems to let me use igfx on a thinkpad x1 carbon
3rd gen with a broadwell chipset.

% cat /dev/vgactl
type igfx
size 2560x1440x32 x8r8g8b8
tilt none
hwgc soft
hwaccel off
hwblank off
addr p 0xc0000000 v 0xffffff00c0000000 size 0x4000000
softscreen on

i tried using the hdmi port on the side but the tv did not
get a signal. i have been testing it lightly and there does
not seem to be much difference from vesa.


diff c7775b365ef3e73748f23b7ace521214753de2a7 uncommitted
--- a/lib/vgadb
+++ b/lib/vgadb
@@ -438,6 +438,7 @@
 	vid=0x8086 did=0x2a42	# Intel 4 Series Mobile
 	vid=0x8086 did=0x0a16	# Intel 4th Gen Core (HD 4400)
 	vid=0x8086 did=0x0412	# Intel 4th Gen Core (HD 4600)
+	vid=0x8086 did=0x1616	# Intel 5th Gen Core (HD 5500)
 	vid=0x8086 did=0x3185	# Intel 9.5th Gen Core (UHD 600)
 	vid=0x8086 did=0x0a06
 	link=vga
--- a/sys/src/cmd/aux/vga/igfx.c
+++ b/sys/src/cmd/aux/vga/igfx.c
@@ -368,6 +368,7 @@
 		/* wet floor */
 	case 0x0a06:
 	case 0x3185:    /* UHD 600 - 9.5 Gen Core */
+	case 0x1616:	/* HD 5500 - 5th Gen Core */
 	case 0x0412:	/* HD 4600 - 4th Gen Core */
 		return TypeHSW;
 	case 0x0166:	/* 3rd Gen Core - ThinkPad X230 */

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [9front] igfx on haswell
  2021-11-12 18:37 ` Kyle Milz
@ 2021-11-13  9:42   ` qwx
  2021-11-13 21:49     ` Kyle Milz
  0 siblings, 1 reply; 7+ messages in thread
From: qwx @ 2021-11-13  9:42 UTC (permalink / raw)
  To: 9front

On Fri Nov 12 19:40:39 +0100 2021, krwmilz@gmail.com wrote:
> hi,
> 
> diff below seems to let me use igfx on a thinkpad x1 carbon
> 3rd gen with a broadwell chipset.
> 
> % cat /dev/vgactl
> type igfx
> size 2560x1440x32 x8r8g8b8
> tilt none
> hwgc soft
> hwaccel off
> hwblank off
> addr p 0xc0000000 v 0xffffff00c0000000 size 0x4000000
> softscreen on
> 
> i tried using the hdmi port on the side but the tv did not
> get a signal. i have been testing it lightly and there does
> not seem to be much difference from vesa.

Great, thanks!  For hdmi/dvi to work, igfx must manage to get
an edid from the monitor, this doesn't happen with some of
them, but you might coerce it to work with yet another vgadb
entry for it, specifying a port with display=.  It will be on
one of the 4 remaining DP ports, 4-7 (3 is eDP).  There's no
way to force hdmi on a specific port though iirc.

If possible, please add the pci did to
/sys/src/9/pc/vgaigfx.c:152.  The hardware cursor should be
enabled when you invoke aux/vga.  If it's visible while
/dev/vgactl shows `hwgc igfxhwgc', it works.

One last thing, could you please also say if:

	; ls '#g'

prints anything after configuring igfx?  It shouldnt.

Thanks a lot!

Cheers,
qwx

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [9front] igfx on haswell
  2021-11-13  9:42   ` qwx
@ 2021-11-13 21:49     ` Kyle Milz
  2021-11-13 22:29       ` qwx
  0 siblings, 1 reply; 7+ messages in thread
From: Kyle Milz @ 2021-11-13 21:49 UTC (permalink / raw)
  To: 9front

On Sat, Nov 13, 2021 at 10:42:17AM +0100, qwx@sciops.net wrote:
> Great, thanks!  For hdmi/dvi to work, igfx must manage to get
> an edid from the monitor, this doesn't happen with some of
> them, but you might coerce it to work with yet another vgadb
> entry for it, specifying a port with display=.  It will be on
> one of the 4 remaining DP ports, 4-7 (3 is eDP).  There's no
> way to force hdmi on a specific port though iirc.

i played around with aux/vga -pvV and it manages to get an edid
for the internal display about 1/10 of the time. the other 9/10
times the 8 edid header bytes contain random garbage. i tried
comparing i915 drm code with igfx.c to find out why but no luck.

i have not tried getting the edid from an external display but
suspect something similar is happening.

> If possible, please add the pci did to
> /sys/src/9/pc/vgaigfx.c:152.  The hardware cursor should be
> enabled when you invoke aux/vga.  If it's visible while
> /dev/vgactl shows `hwgc igfxhwgc', it works.

i tried that, but got the same output as before. forcing it with

	% echo hwgc igfxhwgc >/dev/vgactl

causes the cursor to disappear.

> One last thing, could you please also say if:
> 
> 	; ls '#g'

prints nothing.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [9front] igfx on haswell
  2021-11-13 21:49     ` Kyle Milz
@ 2021-11-13 22:29       ` qwx
  2021-11-15  3:05         ` Kyle Milz
  0 siblings, 1 reply; 7+ messages in thread
From: qwx @ 2021-11-13 22:29 UTC (permalink / raw)
  To: 9front

On Sat Nov 13 22:51:48 +0100 2021, krwmilz@gmail.com wrote:
> On Sat, Nov 13, 2021 at 10:42:17AM +0100, qwx@sciops.net wrote:
> > Great, thanks!  For hdmi/dvi to work, igfx must manage to get
> > an edid from the monitor, this doesn't happen with some of
> > them, but you might coerce it to work with yet another vgadb
> > entry for it, specifying a port with display=.  It will be on
> > one of the 4 remaining DP ports, 4-7 (3 is eDP).  There's no
> > way to force hdmi on a specific port though iirc.
> 
> i played around with aux/vga -pvV and it manages to get an edid
> for the internal display about 1/10 of the time. the other 9/10
> times the 8 edid header bytes contain random garbage. i tried
> comparing i915 drm code with igfx.c to find out why but no luck.
> 
> i have not tried getting the edid from an external display but
> suspect something similar is happening.

Interesting.  I'll play around with the x240 and retest with my
desktop, I've never had issues with that one with the monitors
I've used.  Reading the linux code isn't super helpful though,
it's just a huge mishmash of incomprehensible and undocumented
black magic.


> > If possible, please add the pci did to
> > /sys/src/9/pc/vgaigfx.c:152.  The hardware cursor should be
> > enabled when you invoke aux/vga.  If it's visible while
> > /dev/vgactl shows `hwgc igfxhwgc', it works.
> 
> i tried that, but got the same output as before. forcing it with
> 
> 	% echo hwgc igfxhwgc >/dev/vgactl
> 
> causes the cursor to disappear.

If you got the same output as before, it might be because you
haven't updated or installed a new kernel.  Your vgadb diff
shows that you had inserted the did in the correct ctrl
section which sets igfxhwgc, so that should happen
automatically when you boot with whatever params or use
aux/vga, ie. you shouldn't need to write to /dev/vgactl.  Not
to say that a bug isn't possible of course!


> > One last thing, could you please also say if:
> > 
> > 	; ls '#g'
> 
> prints nothing.

Great!

Thanks a lot, I'll push your diff and vgaigfx.c change,
and please report back about the cursor when possible.
I think we may now claim that we support broadwell!

Cheers,
qwx

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [9front] igfx on haswell
  2021-11-13 22:29       ` qwx
@ 2021-11-15  3:05         ` Kyle Milz
  2021-11-15  9:25           ` qwx
  0 siblings, 1 reply; 7+ messages in thread
From: Kyle Milz @ 2021-11-15  3:05 UTC (permalink / raw)
  To: 9front

On Sat, Nov 13, 2021 at 11:29:31PM +0100, qwx@sciops.net wrote:
> Interesting.  I'll play around with the x240 and retest with my
> desktop, I've never had issues with that one with the monitors
> I've used.  Reading the linux code isn't super helpful though,
> it's just a huge mishmash of incomprehensible and undocumented
> black magic.

yeah i've noticed that. the docs on kernel.org are not a bad
introduction.

> > > If possible, please add the pci did to
> > > /sys/src/9/pc/vgaigfx.c:152.  The hardware cursor should be
> > > enabled when you invoke aux/vga.  If it's visible while
> > > /dev/vgactl shows `hwgc igfxhwgc', it works.
> > 
> > i tried that, but got the same output as before. forcing it with
> > 
> > 	% echo hwgc igfxhwgc >/dev/vgactl
> > 
> > causes the cursor to disappear.
> 
> If you got the same output as before, it might be because you
> haven't updated or installed a new kernel.  Your vgadb diff
> shows that you had inserted the did in the correct ctrl
> section which sets igfxhwgc, so that should happen
> automatically when you boot with whatever params or use
> aux/vga, ie. you shouldn't need to write to /dev/vgactl.  Not
> to say that a bug isn't possible of course!

i've been hacking the kernel already and got installation figured
out, copying into /n/9fat/ in my case. i double checked and
no difference, still 'hgwc soft'. i added some debugging in the
functions of vgaigfx.c and they only fire when i force hwgc to
igfxhwgc as above. so it looks like they are not being triggered
automatically for whatever reason.

> Thanks a lot, I'll push your diff and vgaigfx.c change,
> and please report back about the cursor when possible.
> I think we may now claim that we support broadwell!

haha, i guess for some definition of support :)

is 'hwaccel' ever available for igfx? i understand this would only
be 2D but i was curious why it is off. same for 'hwblank', is that
expected to work?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [9front] igfx on haswell
  2021-11-15  3:05         ` Kyle Milz
@ 2021-11-15  9:25           ` qwx
  0 siblings, 0 replies; 7+ messages in thread
From: qwx @ 2021-11-15  9:25 UTC (permalink / raw)
  To: 9front

On Mon Nov 15 04:18:36 +0100 2021, krwmilz@gmail.com wrote:
> > If you got the same output as before, it might be because you
> > haven't updated or installed a new kernel.  Your vgadb diff
> > shows that you had inserted the did in the correct ctrl
> > section which sets igfxhwgc, so that should happen
> > automatically when you boot with whatever params or use
> > aux/vga, ie. you shouldn't need to write to /dev/vgactl.  Not
> > to say that a bug isn't possible of course!
> 
> i've been hacking the kernel already and got installation figured
> out, copying into /n/9fat/ in my case. i double checked and
> no difference, still 'hgwc soft'. i added some debugging in the
> functions of vgaigfx.c and they only fire when i force hwgc to
> igfxhwgc as above. so it looks like they are not being triggered
> automatically for whatever reason.

Huh, maybe I'm misremembering or missing something as well.
I'll check what happens out again.


> > Thanks a lot, I'll push your diff and vgaigfx.c change,
> > and please report back about the cursor when possible.
> > I think we may now claim that we support broadwell!
> 
> haha, i guess for some definition of support :)
> 
> is 'hwaccel' ever available for igfx? i understand this would only
> be 2D but i was curious why it is off. same for 'hwblank', is that
> expected to work?

Hey, you've got a picture and you can use the mouse, that's
a win :)  hwaccel hasn't been implemented for igfx.  iirc
mischief took a stab at it some years ago, but it wasn't
that trivial.  So, you can turn it on, but it won't really
do anything.  As far as hwblank...  I honestly don't
remember.  vgaigfx.c doesn't check for sandybridge or later
and I don't remember why.  Soft blanking should work though
and that's one reason to have igfx working, otherwise,
unless blanking is turned off, the screen will stay blanked
forever.  This is true for every thinkpad from sandybridge
or earlier on, according to all reports.

Thanks again for your work!

Cheers,
qwx

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-11-15 10:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-10 15:03 [9front] igfx on haswell qwx
2021-11-12 18:37 ` Kyle Milz
2021-11-13  9:42   ` qwx
2021-11-13 21:49     ` Kyle Milz
2021-11-13 22:29       ` qwx
2021-11-15  3:05         ` Kyle Milz
2021-11-15  9:25           ` qwx

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).