Re: After 7.3 to 7.4 upgrade on an iMac11,2, the screen turns black

2023-10-24 Thread Marcus Glocker
On Tue, Oct 24, 2023 at 09:14:48PM +1100, Jonathan Gray wrote:

> On Wed, Oct 18, 2023 at 08:31:41PM +0200, Marcus Glocker wrote:
> > When I revert this commit, the screen on my iMac11,2 works again:
> > 
> > https://marc.info/?l=openbsd-cvs=167989100718759=2
> 
> I can't think of anything else to try, so I have committed the revert.

Same here.  I was going through the code for some hours, and tried out
a few things.  But it doesn't make any sense to me how the same commit
could fix the issue on Linux while for us it's introducing the issue.

> Thanks for the report.

Thanks for reverting it.

> > Index: atombios_encoders.c
> > ===
> > RCS file: /cvs/src/sys/dev/pci/drm/radeon/atombios_encoders.c,v
> > retrieving revision 1.19
> > diff -u -p -u -p -r1.19 atombios_encoders.c
> > --- atombios_encoders.c 27 Mar 2023 04:23:40 -  1.19
> > +++ atombios_encoders.c 18 Oct 2023 18:29:56 -
> > @@ -2122,12 +2122,11 @@ int radeon_atom_pick_dig_encoder(struct 
> >  
> > /*
> >  * On DCE32 any encoder can drive any block so usually just use crtc id,
> > -* but Apple thinks different at least on iMac10,1 and iMac11,2, so 
> > there use linkb,
> > +* but Apple thinks different at least on iMac10,1, so there use linkb,
> >  * otherwise the internal eDP panel will stay dark.
> >  */
> > if (ASIC_IS_DCE32(rdev)) {
> > -   if (dmi_match(DMI_PRODUCT_NAME, "iMac10,1") ||
> > -   dmi_match(DMI_PRODUCT_NAME, "iMac11,2"))
> > +   if (dmi_match(DMI_PRODUCT_NAME, "iMac10,1"))
> > enc_idx = (dig->linkb) ? 1 : 0;
> > else
> > enc_idx = radeon_crtc->crtc_id;
> > 
> > 



Re: After 7.3 to 7.4 upgrade on an iMac11,2, the screen turns black

2023-10-24 Thread Jonathan Gray
On Wed, Oct 18, 2023 at 08:31:41PM +0200, Marcus Glocker wrote:
> When I revert this commit, the screen on my iMac11,2 works again:
> 
> https://marc.info/?l=openbsd-cvs=167989100718759=2

I can't think of anything else to try, so I have committed the revert.
Thanks for the report.

> 
> 
> Index: atombios_encoders.c
> ===
> RCS file: /cvs/src/sys/dev/pci/drm/radeon/atombios_encoders.c,v
> retrieving revision 1.19
> diff -u -p -u -p -r1.19 atombios_encoders.c
> --- atombios_encoders.c   27 Mar 2023 04:23:40 -  1.19
> +++ atombios_encoders.c   18 Oct 2023 18:29:56 -
> @@ -2122,12 +2122,11 @@ int radeon_atom_pick_dig_encoder(struct 
>  
>   /*
>* On DCE32 any encoder can drive any block so usually just use crtc id,
> -  * but Apple thinks different at least on iMac10,1 and iMac11,2, so 
> there use linkb,
> +  * but Apple thinks different at least on iMac10,1, so there use linkb,
>* otherwise the internal eDP panel will stay dark.
>*/
>   if (ASIC_IS_DCE32(rdev)) {
> - if (dmi_match(DMI_PRODUCT_NAME, "iMac10,1") ||
> - dmi_match(DMI_PRODUCT_NAME, "iMac11,2"))
> + if (dmi_match(DMI_PRODUCT_NAME, "iMac10,1"))
>   enc_idx = (dig->linkb) ? 1 : 0;
>   else
>   enc_idx = radeon_crtc->crtc_id;
> 
> 



Re: After 7.3 to 7.4 upgrade on an iMac11,2, the screen turns black

2023-10-20 Thread Jonathan Gray
On Fri, Oct 20, 2023 at 04:37:36PM -0400, George Koehler wrote:
> On Thu, 19 Oct 2023 11:00:42 +1100
> Jonathan Gray  wrote:
> 
> > Are there multiple models of iMac11,2 or is this due to something
> > not acting as linux does?
> 
> Yes, iMac11,2 (21.5-inch, Mid 2010) has 3 models in everymac.com,
>  - Core i3 3.06 GHz, Radeon HD 4670, 256M vram
>  - Core i3 3.2  GHz, Radeon HD 5670, 512M vram
>  - Core i5 3.6  GHz, Radeon HD 5670, 512M vram
> 
> These Radeons might differ.  Marcus's 3.06 has product id 0x9488,
> which in drm/drm_pciids.h is CHIP_RV730.  An iMac11,2 3.2 in
> OpenBSD's dmesg collection has id 0x68c0, which is CHIP_REDWOOD.
> 
> An iMac probably has its original graphics card.  A Mac tower can
> swap cards; a PowerMac7,3 might have radeon or nvidia.
> 
> --gkoehler

This particular quirk is only done on the Radeon HD 4670/RV730 model due
to the earlier DCE test:

0x9488 Mobility Radeon HD 4670 (RV730)
0x68c0 Mobility Radeon HD 5730 (REDWOOD)

https://www.x.org/wiki/RadeonFeature/
RV730 is DCE3.2
REDWOOD is DCE4

if (ASIC_IS_DCE32(rdev)) {
if (dmi_match(DMI_PRODUCT_NAME, "iMac10,1") ||
dmi_match(DMI_PRODUCT_NAME, "iMac11,2"))



Re: After 7.3 to 7.4 upgrade on an iMac11,2, the screen turns black

2023-10-20 Thread George Koehler
On Thu, 19 Oct 2023 11:00:42 +1100
Jonathan Gray  wrote:

> Are there multiple models of iMac11,2 or is this due to something
> not acting as linux does?

Yes, iMac11,2 (21.5-inch, Mid 2010) has 3 models in everymac.com,
 - Core i3 3.06 GHz, Radeon HD 4670, 256M vram
 - Core i3 3.2  GHz, Radeon HD 5670, 512M vram
 - Core i5 3.6  GHz, Radeon HD 5670, 512M vram

These Radeons might differ.  Marcus's 3.06 has product id 0x9488,
which in drm/drm_pciids.h is CHIP_RV730.  An iMac11,2 3.2 in
OpenBSD's dmesg collection has id 0x68c0, which is CHIP_REDWOOD.

An iMac probably has its original graphics card.  A Mac tower can
swap cards; a PowerMac7,3 might have radeon or nvidia.

--gkoehler



Re: After 7.3 to 7.4 upgrade on an iMac11,2, the screen turns black

2023-10-19 Thread Marcus Glocker
On Thu, Oct 19, 2023 at 11:00:42AM +1100, Jonathan Gray wrote:

> On Wed, Oct 18, 2023 at 08:31:41PM +0200, Marcus Glocker wrote:
> > When I revert this commit, the screen on my iMac11,2 works again:
> > 
> > https://marc.info/?l=openbsd-cvs=167989100718759=2
> 
> Are there multiple models of iMac11,2 or is this due to something
> not acting as linux does?

I don't know, but I doubt that there are multiple iMac11,2 models.
It looks more like a tweak in our radeondrm implementation.  I just
installed Debian 12 on that iMac11,2, and graphic is just working fine.

[2.373067] [drm] radeon kernel modesetting enabled.
[2.373639] [drm] initializing kernel modesetting (RV730 0x1002:0x9488 
0x106B:0x00B6 0x00).
[2.658184] [drm] Detected VRAM RAM=256M, BAR=256M
[2.658185] [drm] RAM width 128bits DDR
[2.658210] [drm] radeon: 256M of VRAM memory ready
[2.658211] [drm] radeon: 1024M of GTT memory ready.
[2.658218] [drm] Loading RV730 Microcode
[2.658353] [drm] External GPIO thermal controller with fan control
[2.661588] [drm] radeon: dpm initialized
 
> I'm not opposed to reverting it and having a local diff, but would
> prefer not to.

I understand.  I guess it will be difficult to find out what we do
different in radeondrm which leads to that this commit breaks it on
OpenBSD/iMac11,2.

> > Index: atombios_encoders.c
> > ===
> > RCS file: /cvs/src/sys/dev/pci/drm/radeon/atombios_encoders.c,v
> > retrieving revision 1.19
> > diff -u -p -u -p -r1.19 atombios_encoders.c
> > --- atombios_encoders.c 27 Mar 2023 04:23:40 -  1.19
> > +++ atombios_encoders.c 18 Oct 2023 18:29:56 -
> > @@ -2122,12 +2122,11 @@ int radeon_atom_pick_dig_encoder(struct 
> >  
> > /*
> >  * On DCE32 any encoder can drive any block so usually just use crtc id,
> > -* but Apple thinks different at least on iMac10,1 and iMac11,2, so 
> > there use linkb,
> > +* but Apple thinks different at least on iMac10,1, so there use linkb,
> >  * otherwise the internal eDP panel will stay dark.
> >  */
> > if (ASIC_IS_DCE32(rdev)) {
> > -   if (dmi_match(DMI_PRODUCT_NAME, "iMac10,1") ||
> > -   dmi_match(DMI_PRODUCT_NAME, "iMac11,2"))
> > +   if (dmi_match(DMI_PRODUCT_NAME, "iMac10,1"))
> > enc_idx = (dig->linkb) ? 1 : 0;
> > else
> > enc_idx = radeon_crtc->crtc_id;
> > 



Re: After 7.3 to 7.4 upgrade on an iMac11,2, the screen turns black

2023-10-18 Thread Jonathan Gray
On Wed, Oct 18, 2023 at 08:31:41PM +0200, Marcus Glocker wrote:
> When I revert this commit, the screen on my iMac11,2 works again:
> 
> https://marc.info/?l=openbsd-cvs=167989100718759=2

Are there multiple models of iMac11,2 or is this due to something
not acting as linux does?

I'm not opposed to reverting it and having a local diff, but would
prefer not to.

> 
> 
> Index: atombios_encoders.c
> ===
> RCS file: /cvs/src/sys/dev/pci/drm/radeon/atombios_encoders.c,v
> retrieving revision 1.19
> diff -u -p -u -p -r1.19 atombios_encoders.c
> --- atombios_encoders.c   27 Mar 2023 04:23:40 -  1.19
> +++ atombios_encoders.c   18 Oct 2023 18:29:56 -
> @@ -2122,12 +2122,11 @@ int radeon_atom_pick_dig_encoder(struct 
>  
>   /*
>* On DCE32 any encoder can drive any block so usually just use crtc id,
> -  * but Apple thinks different at least on iMac10,1 and iMac11,2, so 
> there use linkb,
> +  * but Apple thinks different at least on iMac10,1, so there use linkb,
>* otherwise the internal eDP panel will stay dark.
>*/
>   if (ASIC_IS_DCE32(rdev)) {
> - if (dmi_match(DMI_PRODUCT_NAME, "iMac10,1") ||
> - dmi_match(DMI_PRODUCT_NAME, "iMac11,2"))
> + if (dmi_match(DMI_PRODUCT_NAME, "iMac10,1"))
>   enc_idx = (dig->linkb) ? 1 : 0;
>   else
>   enc_idx = radeon_crtc->crtc_id;
> 



Re: After 7.3 to 7.4 upgrade on an iMac11,2, the screen turns black

2023-10-18 Thread Marcus Glocker
When I revert this commit, the screen on my iMac11,2 works again:

https://marc.info/?l=openbsd-cvs=167989100718759=2


Index: atombios_encoders.c
===
RCS file: /cvs/src/sys/dev/pci/drm/radeon/atombios_encoders.c,v
retrieving revision 1.19
diff -u -p -u -p -r1.19 atombios_encoders.c
--- atombios_encoders.c 27 Mar 2023 04:23:40 -  1.19
+++ atombios_encoders.c 18 Oct 2023 18:29:56 -
@@ -2122,12 +2122,11 @@ int radeon_atom_pick_dig_encoder(struct 
 
/*
 * On DCE32 any encoder can drive any block so usually just use crtc id,
-* but Apple thinks different at least on iMac10,1 and iMac11,2, so 
there use linkb,
+* but Apple thinks different at least on iMac10,1, so there use linkb,
 * otherwise the internal eDP panel will stay dark.
 */
if (ASIC_IS_DCE32(rdev)) {
-   if (dmi_match(DMI_PRODUCT_NAME, "iMac10,1") ||
-   dmi_match(DMI_PRODUCT_NAME, "iMac11,2"))
+   if (dmi_match(DMI_PRODUCT_NAME, "iMac10,1"))
enc_idx = (dig->linkb) ? 1 : 0;
else
enc_idx = radeon_crtc->crtc_id;



After 7.3 to 7.4 upgrade on an iMac11,2, the screen turns black

2023-10-18 Thread Marcus Glocker
>Synopsis:  After 7.3 to 7.4 upgrade on an iMac11,2, the screen turns black
>Category:  dev/pci/drm
>Environment:
System  : OpenBSD 7.4
Details : OpenBSD 7.4 (GENERIC.MP) #1397: Tue Oct 10 09:02:37 MDT 
2023
 
dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP

Architecture: OpenBSD.amd64
Machine : amd64

>Description:
After 7.3 to 7.4 upgrade on an iMac11,2, the screen turns black after 
the
"radeondrm0: RV730" driver has initialized.

>How-To-Repeat:
Upgrade iMac11,2 to from 7.3 to 7.4.

>Fix:
Unknown.

Is this a re-introduction of following issue?

https://marc.info/?l=openbsd-bugs=15963703771=2
https://marc.info/?l=openbsd-cvs=159778022923074=2

Does this commit has anything to do with it?

https://marc.info/?l=openbsd-cvs=167989100718759=2

SENDBUG: dmesg, pcidump, acpidump and usbdevs are attached.
SENDBUG: Feel free to delete or use the -D flag if they contain sensitive 
information.

dmesg:
OpenBSD 7.4 (GENERIC.MP) #1397: Tue Oct 10 09:02:37 MDT 2023
dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 4201062400 (4006MB)
avail mem = 4054011904 (3866MB)
random: good seed from bootblocks
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.4 @ 0xe (60 entries)
bios0: vendor Apple Inc. version "98.0.0.0.0" date 04/24/2019
bios0: Apple Inc. iMac11,2
acpi0 at bios0: ACPI 4.0
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP ASF! HPET APIC APIC SBST ECDT SSDT SSDT MCFG SSDT SSDT
acpi0: wakeup devices P0P2(S4) GFX0(S4) EC__(S3) HDEF(S4) RP01(S4) GIGE(S5) 
RP02(S4) ARPT(S5) RP03(S4) RP04(S4) EHC1(S3) EHC2(S3)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpihpet0 at acpi0: 14318179 Hz
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Core(TM) i3 CPU 540 @ 3.07GHz, 3059.03 MHz, 06-25-05, patch 
0007
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,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,POPCNT,NXE,RDTSCP,LONG,LAHF,PERF,ITSC,IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,MELTDOWN
cpu0: 32KB 64b/line 8-way D-cache, 32KB 64b/line 4-way I-cache, 256KB 64b/line 
8-way L2 cache, 4MB 64b/line 16-way L3 cache
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
cpu0: apic clock running at 133MHz
cpu0: mwait min=64, max=64, C-substates=0.2.1.1, IBE
cpu1 at mainbus0: apid 1 (application processor)
cpu1: Intel(R) Core(TM) i3 CPU 540 @ 3.07GHz, 3059.03 MHz, 06-25-05, patch 
0007
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,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,POPCNT,NXE,RDTSCP,LONG,LAHF,PERF,ITSC,IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,MELTDOWN
cpu1: 32KB 64b/line 8-way D-cache, 32KB 64b/line 4-way I-cache, 256KB 64b/line 
8-way L2 cache, 4MB 64b/line 16-way L3 cache
cpu1: smt 1, core 0, package 0
cpu2 at mainbus0: apid 4 (application processor)
cpu2: Intel(R) Core(TM) i3 CPU 540 @ 3.07GHz, 3059.03 MHz, 06-25-05, patch 
0007
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,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,POPCNT,NXE,RDTSCP,LONG,LAHF,PERF,ITSC,IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,MELTDOWN
cpu2: 32KB 64b/line 8-way D-cache, 32KB 64b/line 4-way I-cache, 256KB 64b/line 
8-way L2 cache, 4MB 64b/line 16-way L3 cache
cpu2: smt 0, core 2, package 0
cpu3 at mainbus0: apid 5 (application processor)
cpu3: Intel(R) Core(TM) i3 CPU 540 @ 3.07GHz, 3059.05 MHz, 06-25-05, patch 
0007
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,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,POPCNT,NXE,RDTSCP,LONG,LAHF,PERF,ITSC,IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,MELTDOWN
cpu3: 32KB 64b/line 8-way D-cache, 32KB 64b/line 4-way I-cache, 256KB 64b/line 
8-way L2 cache, 4MB 64b/line 16-way L3 cache
cpu3: smt 1, core 2, package 0
ioapic0 at mainbus0: apid 2 pa 0xfec0, version 20, 24 pins, remapped
acpiec0 at acpi0
acpimcfg0 at acpi0
acpimcfg0: addr 0xe000, bus 0-6
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 1 (P0P2)
acpiprt2 at acpi0: bus 2 (RP01)
acpiprt3 at acpi0: bus 3 (RP02)
acpiprt4 at acpi0: bus 4 (RP03)
acpiprt5 at acpi0: bus -1 (RP04)
acpipci0 at acpi0 PCI0: 0x0004 0x0011 0x0001memory map conflict 
0xe00f8000/0x1000
memory map conflict 0xfed1c000/0x4000
memory map conflict 0xffec2000/0x24000

acpicmos0 at acpi0
asmc0 at acpi0: SMC_ (smc-piketon) addr 0x300/0x20: rev 1.64f564, 276 keys
acpibtn0 at acpi0: PWRB