Quoting Vijay Sankar <vsan...@foretell.ca>:

Quoting Mark Kettenis <mark.kette...@xs4all.nl>:

Machines with Intel integrated graphics have this concept of stolen
memory; system memory set aside by the BIOS for use by the graphics
chip.  On OpenBSD we don't touch that memory since we don't want to
step on the BIOS' toes.  We also assume that this memory is mapped in
the graphics translation table (GTT).  So we reserve a block of the
size of the stolen memory at the start of the aperture and never use
it.

On modern machines this strategy doesn't make a lot of sense.  The
size of the stolen memory can be larger than the graphics aperture,
leaving inteldrm(4) no space to map framebuffers and other graphics
objects.

The diff below gets rid of this policy on Sandy Bridge and Ivy Bridge
CPUs, making the full aperture available for use by inteldrm(4).  This
works fine on my x220, but before I commit this, I'd like to see a
little bit more testing.  If you have a machine with Intel HD Graphics
2000/3000/2500/4000, please give this diff a try.  If possible, test
the following:

* Check that X still works properly.

* Check that suspend/resume still works.  (Don't bother if
  suspend/resume doesn't work without this diff).

* Disable the inteldrm driver (boot with the -c option, disable
  inteldrm at the UKC> prompt) and check if the VGA text console
  still works properly.

Thanks,

Mark

Index: agp_i810.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/agp_i810.c,v
retrieving revision 1.74
diff -u -p -r1.74 agp_i810.c
--- agp_i810.c  18 Mar 2013 12:02:56 -0000      1.74
+++ agp_i810.c  4 Apr 2013 20:38:14 -0000
@@ -506,79 +506,11 @@ agp_i810_attach(struct device *parent, s

        case CHIP_SANDYBRIDGE:
        case CHIP_IVYBRIDGE:
-
-               /* Stolen memory is set up at the beginning of the aperture by
-                * the BIOS, consisting of the GATT followed by 4kb for the
-                * BIOS display.
+               /*
+                * Even though stolen memory exists on these machines,
+                * it isn't necessarily mapped into the aperture.
                 */
-
-               gcc1 = (u_int16_t)pci_conf_read(bpa.pa_pc, bpa.pa_tag,
-                   AGP_INTEL_SNB_GMCH_CTRL);
-
-               stolen = 4;
-
-               switch (gcc1 & AGP_INTEL_SNB_GMCH_GMS_STOLEN_MASK) {
-               case AGP_INTEL_SNB_GMCH_GMS_STOLEN_32M:
-                       isc->stolen = (32768 - stolen) * 1024 / 4096;
-                       break;
-               case AGP_INTEL_SNB_GMCH_GMS_STOLEN_64M:
-                       isc->stolen = (65536 - stolen) * 1024 / 4096;
-                       break;
-               case AGP_INTEL_SNB_GMCH_GMS_STOLEN_96M:
-                       isc->stolen = (98304 - stolen) * 1024 / 4096;
-                       break;
-               case AGP_INTEL_SNB_GMCH_GMS_STOLEN_128M:
-                       isc->stolen = (131072 - stolen) * 1024 / 4096;
-                       break;
-               case AGP_INTEL_SNB_GMCH_GMS_STOLEN_160M:
-                       isc->stolen = (163840 - stolen) * 1024 / 4096;
-                       break;
-               case AGP_INTEL_SNB_GMCH_GMS_STOLEN_192M:
-                       isc->stolen = (196608 - stolen) * 1024 / 4096;
-                       break;
-               case AGP_INTEL_SNB_GMCH_GMS_STOLEN_224M:
-                       isc->stolen = (229376 - stolen) * 1024 / 4096;
-                       break;
-               case AGP_INTEL_SNB_GMCH_GMS_STOLEN_256M:
-                       isc->stolen = (262144 - stolen) * 1024 / 4096;
-                       break;
-               case AGP_INTEL_SNB_GMCH_GMS_STOLEN_288M:
-                       isc->stolen = (294912 - stolen) * 1024 / 4096;
-                       break;
-               case AGP_INTEL_SNB_GMCH_GMS_STOLEN_320M:
-                       isc->stolen = (327680 - stolen) * 1024 / 4096;
-                       break;
-               case AGP_INTEL_SNB_GMCH_GMS_STOLEN_352M:
-                       isc->stolen = (360448 - stolen) * 1024 / 4096;
-                       break;
-               case AGP_INTEL_SNB_GMCH_GMS_STOLEN_384M:
-                       isc->stolen = (393216 - stolen) * 1024 / 4096;
-                       break;
-               case AGP_INTEL_SNB_GMCH_GMS_STOLEN_416M:
-                       isc->stolen = (425984 - stolen) * 1024 / 4096;
-                       break;
-               case AGP_INTEL_SNB_GMCH_GMS_STOLEN_448M:
-                       isc->stolen = (458752 - stolen) * 1024 / 4096;
-                       break;
-               case AGP_INTEL_SNB_GMCH_GMS_STOLEN_480M:
-                       isc->stolen = (491520 - stolen) * 1024 / 4096;
-                       break;
-               case AGP_INTEL_SNB_GMCH_GMS_STOLEN_512M:
-                       isc->stolen = (524288 - stolen) * 1024 / 4096;
-                       break;
-               default:
-                       isc->stolen = 0;
-                       printf("unknown memory configuration, disabling\n");
-                       goto out;
-               }
-
-#ifdef DEBUG
-               if (isc->stolen > 0) {
-                       printf(": detected %dk stolen memory",
-                           isc->stolen * 4);
-               } else
-                       printf(": no preallocated video memory\n");
-#endif
+               isc->stolen = 0;

                /* GATT address is already in there, make sure it's enabled */
                gatt->ag_physical = READ4(AGP_I810_PGTBL_CTL) & ~1;





The font on the console looks different than the normal OpenBSD font, other than that X and KDE both work great. The patch worked perfectly on two desktops and failed on a ThinkPad.

hw.vendor=ASUSTeK Computer INC.
hw.product=P8H67-M EVO
hw.physmem=17082646528

and

hw.vendor=ASUSTeK COMPUTER INC.
hw.product=P8H77-M
hw.physmem=8246112256

I seem to be doing wrong on a ThinkPad. The ThinkPad has the same line for vga as the desktop boxes

vga1 at pci0 dev 2 function 0 "Intel HD Graphics 3000" rev 0x09

so I am thinking that may be I did something wrong here.

On the following system

hw.vendor=LENOVO
hw.product=1143AFU
hw.version=ThinkPad E520
hw.physmem=4201246720

the same USB stick that I was using to boot the other two boxes did not work. I saw a whole bunch of panic messages flash on the console but since there is no serial port on that laptop, I am not sure how to get the debug output.

I am now trying to build all the binaries and will try with a different USB stick.

Thanks again and please let me know if there is something else I can try or help with.

Vijay




Vijay Sankar, M.Eng., P.Eng.
ForeTell Technologies Limited
vsan...@foretell.ca

---------------------------------------------
This message was sent using ForeTell-POST 4.9




I retried the tests on a ThinkPad after rebuilding binaries. Worked beautifully!! dmesg below.

Thanks very much,

Vijay

more dmesg.thinkpad
OpenBSD 5.3-current (GENERIC.MP) #2: Fri Apr  5 19:05:25 CDT 2013
    r...@server4.foretell.ca:/usr/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 4185518080 (3991MB)
avail mem = 4066394112 (3878MB)
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.6 @ 0xe0830 (66 entries)
bios0: vendor LENOVO version "8HET38WW(1.20)" date 09/09/2011
bios0: LENOVO 1143AFU
acpi0 at bios0: rev 2
acpi0: sleep states S0 S1 S3 S4 S5
acpi0: tables DSDT FACP SLIC SSDT SSDT SSDT SSDT ASF! HPET APIC MCFG SSDT SSDT UEFI UEFI UEFI acpi0: wakeup devices P0P1(S4) GLAN(S4) EHC1(S0) EHC2(S0) HDEF(S4) PXSX(S4) RP01(S4) PXSX(S4) RP02(S4) PXSX(S4) RP03(S4) PXSX(S4) RP04(S4) PXSX(S4) RP05(S4) PXSX(S4) RP06(S4) PXSX(S4) RP07(S4) PXSX(S4) RP08(S4) PEG0(S4) PEGP(S4) PEG1(S4) PEG2(S4) PEG3(S4) LID0(S3)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpihpet0 at acpi0: 14318179 Hz
acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Core(TM) i5-2430M CPU @ 2.40GHz, 2394.93 MHz
cpu0: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,NXE,LONG,LAHF,PERF,ITSC
cpu0: 256KB 64b/line 8-way L2 cache
cpu0: apic clock running at 99MHz
cpu1 at mainbus0: apid 1 (application processor)
cpu1: Intel(R) Core(TM) i5-2430M CPU @ 2.40GHz, 2394.56 MHz
cpu1: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,NXE,LONG,LAHF,PERF,ITSC
cpu1: 256KB 64b/line 8-way L2 cache
cpu2 at mainbus0: apid 2 (application processor)
cpu2: Intel(R) Core(TM) i5-2430M CPU @ 2.40GHz, 2394.56 MHz
cpu2: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,NXE,LONG,LAHF,PERF,ITSC
cpu2: 256KB 64b/line 8-way L2 cache
cpu3 at mainbus0: apid 3 (application processor)
cpu3: Intel(R) Core(TM) i5-2430M CPU @ 2.40GHz, 2394.56 MHz
cpu3: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,NXE,LONG,LAHF,PERF,ITSC
cpu3: 256KB 64b/line 8-way L2 cache
ioapic0 at mainbus0: apid 2 pa 0xfec00000, version 20, 24 pins
acpimcfg0 at acpi0 addr 0xf8000000, bus 0-63
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus -1 (P0P1)
acpiprt2 at acpi0: bus 1 (RP01)
acpiprt3 at acpi0: bus 2 (RP02)
acpiprt4 at acpi0: bus 3 (RP03)
acpiprt5 at acpi0: bus 8 (RP04)
acpiprt6 at acpi0: bus -1 (RP05)
acpiprt7 at acpi0: bus -1 (RP06)
acpiprt8 at acpi0: bus -1 (RP07)
acpiprt9 at acpi0: bus 9 (RP08)
acpiprt10 at acpi0: bus -1 (PEG0)
acpiprt11 at acpi0: bus -1 (PEG1)
acpiprt12 at acpi0: bus -1 (PEG2)
acpiprt13 at acpi0: bus -1 (PEG3)
acpiec0 at acpi0
acpicpu0 at acpi0: C3, C1, PSS
acpicpu1 at acpi0: C3, C1, PSS
acpicpu2 at acpi0: C3, C1, PSS
acpicpu3 at acpi0: C3, C1, PSS
acpitz0 at acpi0: critical temperature is 120 degC
acpitz1 at acpi0: critical temperature is 120 degC
acpibat0 at acpi0: BAT0 model "LNV-42T4848" serial 15098 type LION oem "31310043474c"
acpithinkpad0 at acpi0
acpiac0 at acpi0: AC unit online
acpibtn0 at acpi0: LID0
cpu0: Enhanced SpeedStep 2394 MHz: speeds: 2401, 2400, 2000, 1800, 1600, 1400, 1200, 1000, 800 MHz
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 "Intel Core 2G Host" rev 0x09
vga1 at pci0 dev 2 function 0 "Intel HD Graphics 3000" rev 0x09
intagp0 at vga1
agp0 at intagp0: aperture at 0xc0000000, size 0x10000000
inteldrm0 at vga1
drm0 at inteldrm0
inteldrm0: apic 2 int 16
wsdisplay0 at vga1 mux 1: console (std, vt100 emulation)
wsdisplay0: screen 1-5 added (std, vt100 emulation)
"Intel 6 Series MEI" rev 0x04 at pci0 dev 22 function 0 not configured
ehci0 at pci0 dev 26 function 0 "Intel 6 Series USB" rev 0x04: apic 2 int 16
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 "Intel EHCI root hub" rev 2.00/1.00 addr 1
azalia0 at pci0 dev 27 function 0 "Intel 6 Series HD Audio" rev 0x04: msi
azalia0: codecs: Conexant/0x506e, Intel/0x2805, using Conexant/0x506e
audio0 at azalia0
ppb0 at pci0 dev 28 function 0 "Intel 6 Series PCIE" rev 0xb4: msi
pci1 at ppb0 bus 1
ppb1 at pci0 dev 28 function 1 "Intel 6 Series PCIE" rev 0xb4: msi
pci2 at ppb1 bus 2
re0 at pci2 dev 0 function 0 "Realtek 8168" rev 0x06: RTL8168E/8111E (0x2c00), apic 2 int 17, address f0:de:f1:9b:8d:ca
rgephy0 at re0 phy 7: RTL8169S/8110S PHY, rev. 4
ppb2 at pci0 dev 28 function 2 "Intel 6 Series PCIE" rev 0xb4: msi
pci3 at ppb2 bus 3
sdhc0 at pci3 dev 0 function 0 "Ricoh 5U823 SD/MMC" rev 0x04: apic 2 int 18
sdmmc0 at sdhc0
ppb3 at pci0 dev 28 function 3 "Intel 6 Series PCIE" rev 0xb4: msi
pci4 at ppb3 bus 8
iwn0 at pci4 dev 0 function 0 "Intel WiFi Link 1000" rev 0x00: msi, MIMO 1T2R, BGS, address 74:e5:0b:3c:b4:3c
ppb4 at pci0 dev 28 function 7 "Intel 6 Series PCIE" rev 0xb4: msi
pci5 at ppb4 bus 9
ehci1 at pci0 dev 29 function 0 "Intel 6 Series USB" rev 0x04: apic 2 int 23
usb1 at ehci1: USB revision 2.0
uhub1 at usb1 "Intel EHCI root hub" rev 2.00/1.00 addr 1
pcib0 at pci0 dev 31 function 0 "Intel HM65 LPC" rev 0x04
ahci0 at pci0 dev 31 function 2 "Intel 6 Series AHCI" rev 0x04: msi, AHCI 1.3
scsibus0 at ahci0: 32 targets
sd0 at scsibus0 targ 0 lun 0: <ATA, ST9500420AS, 0003> SCSI3 0/direct fixed naa.5000c5004426bf9c
sd0: 476940MB, 512 bytes/sector, 976773168 sectors
cd0 at scsibus0 targ 4 lun 0: <Slimtype, DVD A DS8A5SH, XL63> ATAPI 5/cdrom removable ichiic0 at pci0 dev 31 function 3 "Intel 6 Series SMBus" rev 0x04: apic 2 int 18
iic0 at ichiic0
spdmem0 at iic0 addr 0x52: 4GB DDR3 SDRAM PC3-10600 SO-DIMM
isa0 at pcib0
isadma0 at isa0
pckbc0 at isa0 port 0x60/5
pckbd0 at pckbc0 (kbd slot)
pckbc0: using irq 1 for kbd slot
wskbd0 at pckbd0: console keyboard, using wsdisplay0
pms0 at pckbc0 (aux slot)
pckbc0: using irq 12 for aux slot
wsmouse0 at pms0 mux 0
wsmouse1 at pms0 mux 0
pms0: Synaptics touchpad, firmware 7.5
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
mtrr: Pentium Pro MTRR support
uhub2 at uhub0 port 1 "Intel Rate Matching Hub" rev 2.00/0.00 addr 2
umass0 at uhub2 port 3 configuration 1 interface 0 "Kingston DT Rubber 3.0" rev 2.10/1.00 addr 3
umass0: using SCSI over Bulk-Only
scsibus1 at umass0: 2 targets, initiator 0
sd1 at scsibus1 targ 1 lun 0: <Kingston, DT Rubber 3.0, 1.01> SCSI4 0/direct removable serial.0951168eACC10000032A
sd1: 15008MB, 512 bytes/sector, 30736384 sectors
uvideo0 at uhub2 port 5 configuration 1 interface 0 "Chicony Electronics Co., Ltd. Integrated Camera" rev 2.00/9.54 addr 4
video0 at uvideo0
uhub3 at uhub1 port 1 "Intel Rate Matching Hub" rev 2.00/0.00 addr 2
ugen0 at uhub3 port 3 "UPEK TouchStrip Fingerprint Sensor" rev 1.00/0.48 addr 3
vscsi0 at root
scsibus2 at vscsi0: 256 targets
softraid0 at root
scsibus3 at softraid0: 256 targets
root on sd1a (f477045739c855f9.a) swap on sd1b dump on sd1b



Vijay Sankar, M.Eng., P.Eng.
ForeTell Technologies Limited
vsan...@foretell.ca

---------------------------------------------
This message was sent using ForeTell-POST 4.9


Reply via email to