mirror of
https://github.com/AsahiLinux/m1n1
synced 2024-11-22 14:43:08 +00:00
experiments/dcp.py: Handle external displays correctly
Pass disp0's comaptible string to DCPManager. Fixes Mac Studio and M1 Macbook handling. Signed-off-by: Janne Grunau <j@jannau.net>
This commit is contained in:
parent
452a3243c0
commit
053eb7bfda
1 changed files with 11 additions and 7 deletions
|
@ -15,10 +15,14 @@ from m1n1.fw.dcp.manager import DCPManager
|
||||||
from m1n1.fw.dcp.ipc import ByRef
|
from m1n1.fw.dcp.ipc import ByRef
|
||||||
from m1n1.proxyutils import RegMonitor
|
from m1n1.proxyutils import RegMonitor
|
||||||
|
|
||||||
is_t8103 = u.adt["arm-io"].compatible[0] == "arm-io,t8103"
|
disp_name = "/arm-io/disp0"
|
||||||
|
|
||||||
|
external = hasattr(u.adt[disp_name], "external") and u.adt[disp_name].external != 0
|
||||||
|
compat = u.adt[disp_name].compatible[0].split(",")[-1]
|
||||||
|
|
||||||
mon = RegMonitor(u)
|
mon = RegMonitor(u)
|
||||||
|
|
||||||
if is_t8103:
|
if compat == 't8103':
|
||||||
#mon.add(0x230000000, 0x18000)
|
#mon.add(0x230000000, 0x18000)
|
||||||
#mon.add(0x230018000, 0x4000)
|
#mon.add(0x230018000, 0x4000)
|
||||||
#mon.add(0x230068000, 0x8000)
|
#mon.add(0x230068000, 0x8000)
|
||||||
|
@ -85,7 +89,7 @@ dcp.start()
|
||||||
dcp.start_ep(0x37)
|
dcp.start_ep(0x37)
|
||||||
dcp.dcpep.initialize()
|
dcp.dcpep.initialize()
|
||||||
|
|
||||||
mgr = DCPManager(dcp.dcpep)
|
mgr = DCPManager(dcp.dcpep, compat)
|
||||||
|
|
||||||
mon.poll()
|
mon.poll()
|
||||||
|
|
||||||
|
@ -104,14 +108,14 @@ assert mgr.setPowerState(1, False, ByRef(0)) == 0
|
||||||
|
|
||||||
mon.poll()
|
mon.poll()
|
||||||
|
|
||||||
if is_t8103:
|
if external:
|
||||||
assert mgr.set_display_device(2) == 0
|
assert mgr.set_display_device(2) == 0
|
||||||
else:
|
else:
|
||||||
assert mgr.set_display_device(0) == 2
|
assert mgr.set_display_device(0) == 2
|
||||||
assert mgr.set_parameter_dcp(14, [0], 1) == 0
|
assert mgr.set_parameter_dcp(14, [0], 1) == 0
|
||||||
#mgr.set_digital_out_mode(86, 38)
|
#mgr.set_digital_out_mode(86, 38)
|
||||||
|
|
||||||
if is_t8103:
|
if external:
|
||||||
assert mgr.set_display_device(2) == 0
|
assert mgr.set_display_device(2) == 0
|
||||||
else:
|
else:
|
||||||
assert mgr.set_display_device(0) == 2
|
assert mgr.set_display_device(0) == 2
|
||||||
|
@ -123,7 +127,7 @@ assert mgr.get_gamma_table(t) == 2
|
||||||
assert mgr.set_contrast(0) == 0
|
assert mgr.set_contrast(0) == 0
|
||||||
assert mgr.setBrightnessCorrection(65536) == 0
|
assert mgr.setBrightnessCorrection(65536) == 0
|
||||||
|
|
||||||
if is_t8103:
|
if external:
|
||||||
assert mgr.set_display_device(2) == 0
|
assert mgr.set_display_device(2) == 0
|
||||||
else:
|
else:
|
||||||
assert mgr.set_display_device(0) == 2
|
assert mgr.set_display_device(0) == 2
|
||||||
|
@ -277,7 +281,7 @@ swaps = mgr.swaps
|
||||||
mon.poll()
|
mon.poll()
|
||||||
|
|
||||||
fb_size = align_up(width * height * 4, 8 * 0x4000)
|
fb_size = align_up(width * height * 4, 8 * 0x4000)
|
||||||
print(f"Dispaly {width}x{height}, fb size: {fb_size}")
|
print(f"Display {width}x{height}, fb size: {fb_size}")
|
||||||
|
|
||||||
buf = u.memalign(0x4000, fb_size)
|
buf = u.memalign(0x4000, fb_size)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue