1.1.0版本

This commit is contained in:
xinzhu.yin
2026-04-16 16:51:05 +08:00
commit c157e774e5
333 changed files with 70759 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
from .pr import PanelReplay, PanelReplayConfig, PanelReplayStatus
from .pr_types import *
from .pr_sink import SinkPanelReplay, SinkPanelSelfRefresh
from .pr_sink_types import PRCapsFlags, PrGranularityCaps, SuYGranularity, PSRCapsFlags, PSRCaps, PSRSetupTime

View File

@@ -0,0 +1,73 @@
from UniTAP.libs.lib_tsi.tsi_io import PortIO
from UniTAP.libs.lib_tsi.tsi import *
from .pr_private_types import *
from .pr_status import PanelReplayStatus
from .pr_config import PanelReplayConfig
class PanelReplay:
"""
Class `PanelReplay` contains information about Panel Replay feature.
- Read Panel Replay `status`.
- Configure Panel Replay `config`.
- Disable Panel Replay `disable`.
- Enable Active mode `active_mode`.
- Enable Inactive mode `inactive_mode`.
- Enable selective update `selective_update`.
"""
def __init__(self, port_io: PortIO, pg_caps):
self.__io = port_io
self.__status = PanelReplayStatus(self.__io)
self.__config = PanelReplayConfig(self.__io, pg_caps)
self.__caps = self.__config.pr_caps
@property
def status(self) -> PanelReplayStatus:
"""
Returns object of class `PanelReplayStatus` for working with Panel Replay Status.
Returns:
object of `PanelReplayStatus` type
"""
return self.__status
@property
def config(self) -> PanelReplayConfig:
"""
Returns object of class `PanelReplayConfig` for configuration PR.
Returns:
object of `PanelReplayStatus` type
"""
return self.__config
def disable(self):
"""
Disable Panel Replay
"""
self.__write_pr_control(PrControl.Disable)
def active_mode(self):
"""
Enable active mode
"""
self.__write_pr_control(PrControl.EnableActiveMode)
def inactive_mode(self):
"""
Enable inactive mode
"""
self.__write_pr_control(PrControl.EnableInactiveMode)
def selective_update(self):
"""
Enable selective update mode (if device supports this feature)
"""
if self.__caps.pr_flags().selective_update:
self.__write_pr_control(PrControl.EnableSelectiveUpdate)
def __write_pr_control(self, command: PrControl):
self.__io.set(TSI_PG_STREAM_SELECT, 0)
self.__io.set(TSI_PG_PR_CTRL_W, command.value)

View File

@@ -0,0 +1,132 @@
from UniTAP.libs.lib_tsi.tsi_io import PortIO
from UniTAP.libs.lib_tsi.tsi import *
from .pr_types import *
from .pr_private_types import *
class PanelReplayConfig:
"""
Class `PanelReplayConfig` contains information about Panel Replay Configuration.
- Set configuration object `PrSettings`, function `set`.
- Get configuration object `PrSettings`, function `get`.
"""
def __init__(self, port_io: PortIO, pg_caps):
self.__io = port_io
self.__y_granularity_list = [e for e in YGranularity]
self.__mode_list = []
if pg_caps.flags.panel_replay:
self.__mode_list.append(PRMode.PR)
if pg_caps.flags.psr:
self.__mode_list.append(PRMode.PSR1)
self.__mode_list.append(PRMode.PSR2)
@property
def pr_caps(self):
return self.__read_caps()
def set(self, config: PrSettings):
"""
Write new configuration.
Args:
config (PrSettings).
"""
caps = self.pr_caps
self.__io.set(TSI_PG_STREAM_SELECT, 0)
pr_config, _ = self.__read_config()
pr_config.early_transport = config.flags.early_transport if caps.pr_flags().early_transport else 0
pr_config.crc_in_vsc_sdp = config.flags.crc_in_vsc_sdp if caps.pr_flags().crc_sel_update else 0
pr_config.hpd_irq_as_sdp = config.flags.hpd_irq
pr_config.hpd_irq_vsc_sdp = config.flags.hpd_irq_vsc_sdp
pr_config.hpd_irq_rfb = config.flags.hpd_irq_rfb
pr_config.hpd_irq_crc = config.flags.hpd_irq_crc
pr_config.self_refresh = config.flags.refresh_rate_unlock
pr_config.ext_y_granularity = config.flags.ext_y_gran
pr_config.main_link_on = config.flags.main_link_remain_on
if config.flags.y_granularity in self.get_available_y_granularity_values():
y_gran_value = (caps.pr_flags().y_gran_value & (1 << config.flags.y_granularity.value)) > 0
pr_config.y_gran_value = 1 << config.flags.y_granularity.value if y_gran_value else 0
if config.flags.mode in self.__mode_list:
pr_config.mode = config.flags.mode.value
data = [pr_config.value]
for item in config.regions:
region = RegionConfig(0)
region.value = item
data.extend(region.value)
self.__io.set(TSI_PG_PR_CFG, data, data_count=len(data))
def get(self) -> PrSettings:
"""
Returns current Panel Replay Configuration.
Returns:
object of `PrSettings` type
"""
pr_config, pr_regions = self.__read_config()
pr_settings = PrSettings()
pr_settings.flags = Flags(early_transport=pr_config.early_transport == 1,
crc_in_vsc_sdp=pr_config.crc_in_vsc_sdp == 1,
pr_mode=PRMode(pr_config.mode),
hpd_irq=pr_config.hpd_irq_as_sdp == 1,
hpd_irq_vsc_sdp=pr_config.hpd_irq_vsc_sdp == 1,
hpd_irq_rfb=pr_config.hpd_irq_rfb == 1,
hpd_irq_crc=pr_config.hpd_irq_crc == 1,
refresh_rate_unlock=pr_config.self_refresh == 1,
ext_y_gran=pr_config.ext_y_granularity == 1,
main_link_remain_on=pr_config.main_link_on == 1)
value = pr_config.y_gran_value
bit_number = 0
while value:
if value & 0x1:
pr_settings.y_granularity = YGranularity(bit_number)
break
bit_number += 1
value >>= 1
pr_settings.regions = pr_regions
return pr_settings
def get_available_y_granularity_values(self) -> List[YGranularity]:
"""
Get available values for Y Granularity.
Returns:
list of `YGranularity` type
"""
caps = self.pr_caps
gran_list = []
for i, enum_value in enumerate(YGranularity):
if caps.pr_flags().y_gran_value >> i & 0x1:
gran_list.append(enum_value)
return gran_list
def __read_config(self):
caps = self.pr_caps
self.__io.set(TSI_PG_STREAM_SELECT, 0)
result = self.__io.get(TSI_PG_PR_CFG, c_uint32, caps.calculate_size())[1]
if not isinstance(result, list):
result = [0]
pr_config = PrConfig(result[0])
pr_regions = []
for i in range(1, len(result) - 1, 2):
pr_regions.append(RegionConfig(result[i] & 0xFFFF,
result[i] >> 16 & 0xFFFF,
result[i + 1] & 0xFFFF,
result[i + 1] >> 16 & 0xFFFF))
return pr_config, pr_regions
def __read_caps(self) -> PRCaps:
self.__io.set(TSI_PG_STREAM_SELECT, 0)
return self.__io.get(TSI_PG_PR_CAPS_R, PRCaps)[1]

View File

@@ -0,0 +1,161 @@
from ctypes import Structure, c_uint32, c_uint16
from enum import IntEnum
from .pr_types import Flags, Region
class PrControl(IntEnum):
Disable = 0
EnableInactiveMode = 1
EnableActiveMode = 2
EnableSelectiveUpdate = 3
FullScreenLiveFrameUpdate = 4
class PrConfig(Structure):
_fields_ = [
("early_transport", c_uint32, 1),
("crc_in_vsc_sdp", c_uint32, 1),
('mode', c_uint32, 2),
('hpd_irq_as_sdp', c_uint32, 1),
('hpd_irq_vsc_sdp', c_uint32, 1),
('hpd_irq_rfb', c_uint32, 1),
('hpd_irq_crc', c_uint32, 1),
('self_refresh', c_uint32, 1),
('ext_y_granularity', c_uint32, 1),
('main_link_on', c_uint32, 1),
("y_gran_value", c_uint32, 4),
('reserved', c_uint32, 17)
]
@property
def value(self) -> int:
return (self.early_transport | self.crc_in_vsc_sdp << 1 | self.mode << 3 | self.hpd_irq_as_sdp << 4 |
self.hpd_irq_vsc_sdp << 5 | self.hpd_irq_rfb << 6 | self.hpd_irq_crc << 7 | self.self_refresh << 8 |
self.ext_y_granularity << 9 | self.main_link_on << 10 | self.y_gran_value << 13)
class RegionConfig(Structure):
_fields_ = [
("x", c_uint32, 16),
("y", c_uint32, 16),
('width', c_uint32, 16),
('height', c_uint32, 16),
]
@property
def value(self) -> list:
return [self.x | self.y << 16, self.width | self.height << 16]
@value.setter
def value(self, config: Region):
self.x = config.x
self.y = config.y
self.width = config.width
self.height = config.height
class PatternCaps(IntEnum):
PrNotSupported = 0
PrOnly = 1
PrSelectiveUpdate = 2
PrSelectiveUpdateEarlyTransport = 3
class PRCaps(Structure):
class PRFlags(Structure):
_fields_ = [
("selective_update", c_uint32, 1),
("early_transport", c_uint32, 1),
("crc_sel_update", c_uint32, 1),
("y_gran_value", c_uint16, 16),
('reserved', c_uint32, 13)
]
class SuRegions(Structure):
_fields_ = [
("number_regions", c_uint32, 8),
("buffer_capacity", c_uint32, 8),
('reserved', c_uint32, 16)
]
_fields_ = [
('flags', c_uint32),
('su_regions', c_uint32),
('reserved1', c_uint32, 4),
('color_bars', c_uint32, 4),
('chessboard', c_uint32, 4),
('solid_color', c_uint32, 4),
('solid_white', c_uint32, 4),
('solid_red', c_uint32, 4),
('solid_green', c_uint32, 4),
('solid_blue', c_uint32, 4),
('white_v_strips', c_uint32, 4),
('gradient_h_strips', c_uint32, 4),
('color_ramp', c_uint32, 4),
('color_square', c_uint32, 4),
('motion_pattern', c_uint32, 4),
('custom', c_uint32, 4),
('reserved2', c_uint32, 4),
('square_window', c_uint32, 4),
('dsc', c_uint32, 4)
]
def color_bars_caps(self) -> PatternCaps:
return PatternCaps(self.color_bars & 0x3)
def chessboard_caps(self) -> PatternCaps:
return PatternCaps(self.chessboard & 0x3)
def solid_color_caps(self) -> PatternCaps:
return PatternCaps(self.solid_color & 0x3)
def solid_white_caps(self) -> PatternCaps:
return PatternCaps(self.solid_white & 0x3)
def solid_red_caps(self) -> PatternCaps:
return PatternCaps(self.solid_red & 0x3)
def solid_green_caps(self) -> PatternCaps:
return PatternCaps(self.solid_green & 0x3)
def white_v_strips_caps(self) -> PatternCaps:
return PatternCaps(self.white_v_strips & 0x3)
def gradient_h_strips_caps(self) -> PatternCaps:
return PatternCaps(self.gradient_h_strips & 0x3)
def color_ramp_caps(self) -> PatternCaps:
return PatternCaps(self.color_ramp & 0x3)
def color_square_caps(self) -> PatternCaps:
return PatternCaps(self.color_square & 0x3)
def motion_pattern_caps(self) -> PatternCaps:
return PatternCaps(self.motion_pattern & 0x3)
def custom_caps(self) -> PatternCaps:
return PatternCaps(self.custom & 0x3)
def square_window_caps(self) -> PatternCaps:
return PatternCaps(self.square_window & 0x3)
def dsc_caps(self) -> PatternCaps:
return PatternCaps(self.dsc & 0x3)
def calculate_size(self) -> int:
return self.pr_su_regions().number_regions * self.pr_su_regions().buffer_capacity * 2 + 1
def pr_flags(self) -> PRFlags:
return self.PRFlags(self.flags & 0x1, (self.flags >> 1) & 0x1, (self.flags >> 2) & 0x1)
def pr_su_regions(self) -> SuRegions:
return self.SuRegions(self.su_regions & 0xFF, (self.su_regions >> 8) & 0xFF)
class PrStatus(Structure):
_fields_ = [
("command_status", c_uint32, 8),
("status", c_uint32, 8),
('reserved', c_uint32, 8),
('error', c_uint32, 8)
]

View File

@@ -0,0 +1,59 @@
from UniTAP.libs.lib_tsi.tsi_io import PortIO
from .pr_sink_status import SinkPanelReplayStatus, SinkPanelSelfRefreshStatus
from .pr_sink_caps import SinkPanelReplayCaps, SinkPanelSelfRefreshCaps
class SinkPanelReplay:
def __init__(self, port_io: PortIO):
self.__io = port_io
self.__status = SinkPanelReplayStatus(self.__io)
self.__caps = SinkPanelReplayCaps(self.__io)
@property
def status(self) -> SinkPanelReplayStatus:
"""
Returns object of class `SinkPanelReplayStatus` for working with Sink Panel Replay Status.
Returns:
object of `SinkPanelReplayStatus` type
"""
return self.__status
@property
def caps(self) -> SinkPanelReplayCaps:
"""
Returns object of class `SinkPanelReplayCaps` for configuration Sink Panel Replay capabilities.
Returns:
object of `SinkPanelReplayCaps` type
"""
return self.__caps
class SinkPanelSelfRefresh:
def __init__(self, port_io: PortIO):
self.__io = port_io
self.__status = SinkPanelSelfRefreshStatus(self.__io)
self.__caps = SinkPanelSelfRefreshCaps(self.__io)
@property
def status(self) -> SinkPanelSelfRefreshStatus:
"""
Returns object of class `SinkPanelSelfRefreshStatus` for working with Sink Panel Self Refresh Status.
Returns:
object of `SinkPanelSelfRefreshStatus` type
"""
return self.__status
@property
def caps(self) -> SinkPanelSelfRefreshCaps:
"""
Returns object of class `SinkPanelSelfRefreshCaps` for configuration Sink Panel Self Refresh capabilities.
Returns:
object of `SinkPanelSelfRefreshCaps` type
"""
return self.__caps

View File

@@ -0,0 +1,111 @@
from UniTAP.libs.lib_tsi.tsi_io import PortIO
from .pr_sink_private_types import SinkPanelReplayCapsStruct, SinkPanelSelfRefreshCapsStruct
from .pr_sink_types import PRCapsFlags, PrGranularityCaps, SuYGranularity, PSRCapsFlags, PSRCaps, PSRSetupTime
from UniTAP.libs.lib_tsi.tsi import *
from typing import Tuple
class SinkPanelReplayCaps:
"""
Class `SinkPanelReplayCaps` contains information about Sink Panel Replay capabilities.
- Set configuration with parameters: `PRCapsFlags`, `PrGranularityCaps`, PrGranularityCaps`, `SuYGranularity`.
Function `set`.
- Get configuration: Tuple[`PRCapsFlags`, `PrGranularityCaps`, `PrGranularityCaps`, `SuYGranularity``].
Function `get`.
"""
def __init__(self, port_io: PortIO):
self.__io = port_io
def set(self, flags: PRCapsFlags = PRCapsFlags(),
x_granularity: PrGranularityCaps = PrGranularityCaps.Line_1,
y_granularity: PrGranularityCaps = PrGranularityCaps.Line_1,
granularity: SuYGranularity = SuYGranularity()):
flags_value = (flags.pr_support | (flags.selective_update_support << 1) | (flags.early_transport_support << 2) |
(flags.dsc_decode_func_support << 10) | (flags.asynch_video_timing_support << 11) |
(flags.dsc_src_support << 12) | (flags.granularity_needed << 13) |
(flags.y_gran_extended_supported << 14) | (flags.link_off_supported << 15))
self.__write([flags_value, x_granularity.value, y_granularity.value, granularity.combined_value()])
self.__io.set(TSI_DPRX_HPD_PULSE_W, 500000, c_int)
def get(self) -> Tuple[PRCapsFlags, PrGranularityCaps, PrGranularityCaps, SuYGranularity]:
caps = self.__read()
flags = PRCapsFlags(pr_support=caps.pr_support,
selective_update_support=caps.selective_update_support,
early_transport_support=caps.early_transport_support,
dsc_decode_func_support=caps.dsc_decode_func_support,
asynch_video_timing_support=caps.asynch_video_timing_support,
dsc_src_support=caps.dsc_src_support,
granularity_needed=caps.granularity_needed,
y_gran_extended_supported=caps.y_gran_extended_supported,
link_off_supported=caps.link_off_supported)
x_granularity = PrGranularityCaps(caps.pr_x_granularity if caps.pr_x_granularity != 0 else 1)
y_granularity = PrGranularityCaps(caps.pr_y_granularity if caps.pr_y_granularity != 0 else 1)
granularity = SuYGranularity(value_of_8=caps.su_y_granularity.value_of_8,
value_of_10=caps.su_y_granularity.value_of_10,
value_of_12=caps.su_y_granularity.value_of_12,
value_of_14=caps.su_y_granularity.value_of_14,
value_of_15=caps.su_y_granularity.value_of_15,
value_of_16=caps.su_y_granularity.value_of_16,
value_of_18=caps.su_y_granularity.value_of_18,
value_of_20=caps.su_y_granularity.value_of_20,
value_of_24=caps.su_y_granularity.value_of_24,
value_of_30=caps.su_y_granularity.value_of_30,
value_of_32=caps.su_y_granularity.value_of_32,
value_of_36=caps.su_y_granularity.value_of_36,
value_of_40=caps.su_y_granularity.value_of_40,
value_of_48=caps.su_y_granularity.value_of_48,
value_of_54=caps.su_y_granularity.value_of_54,
value_of_64=caps.su_y_granularity.value_of_64)
return flags, x_granularity, y_granularity, granularity
def __read(self) -> SinkPanelReplayCapsStruct:
return self.__io.get(TSI_DPRX_PR_CAPS, SinkPanelReplayCapsStruct)[1]
def __write(self, data: list):
self.__io.set(TSI_DPRX_PR_CAPS, data, data_type=c_uint32, data_count=len(data))
class SinkPanelSelfRefreshCaps:
"""
Class `SinkPanelSelfRefreshCaps` contains information about Sink Panel Self Refresh capabilities.
- Set configuration with parameters: `PSRCapsFlags`, `PrGranularityCaps`, PrGranularityCaps`. Function `set`.
- Get configuration: Tuple[`PSRCapsFlags`, `PrGranularityCaps`, `PrGranularityCaps`]. Function `get`.
"""
def __init__(self, port_io: PortIO):
self.__io = port_io
def set(self, flags: PSRCapsFlags = PSRCapsFlags(),
x_granularity: PrGranularityCaps = PrGranularityCaps.Line_1,
y_granularity: PrGranularityCaps = PrGranularityCaps.Line_1):
flags_value = (flags.psr_caps.value | (flags.link_training_req_psr1 << 8) | (flags.psr_setup_time.value << 9) |
(flags.y_coor_psr2_su << 12) | (flags.su_coordinates_shall_adhere << 13) |
(flags.no_update_aux_frame_sync << 14))
self.__write([flags_value, x_granularity.value, y_granularity.value])
def get(self) -> Tuple[PSRCapsFlags, PrGranularityCaps, PrGranularityCaps]:
caps = self.__read()
flags = PSRCapsFlags(psr_caps=PSRCaps(caps.psr_caps),
link_training_req_psr1=caps.link_training_req_psr1,
psr_setup_time=PSRSetupTime(caps.psr_setup_time), y_coor_psr2_su=caps.y_coor_psr2_su,
su_coordinates_shall_adhere=caps.su_coordinates_shall_adhere,
no_update_aux_frame_sync=caps.no_update_aux_frame_sync)
x_granularity = PrGranularityCaps(caps.pr_x_granularity if caps.pr_x_granularity != 0 else 1)
y_granularity = PrGranularityCaps(caps.pr_y_granularity if caps.pr_y_granularity != 0 else 1)
return flags, x_granularity, y_granularity
def __read(self) -> SinkPanelSelfRefreshCapsStruct:
return self.__io.get(TSI_DPRX_PSR_CAPS, SinkPanelSelfRefreshCapsStruct)[1]
def __write(self, data: list):
self.__io.set(TSI_DPRX_PSR_CAPS, data, data_type=c_uint32, data_count=len(data))

View File

@@ -0,0 +1,111 @@
from ctypes import Structure, c_uint32
class SinkPanelReplayCapsStruct(Structure):
class SuYGranularityStruct(Structure):
_fields_ = [
("value_of_8", c_uint32, 1),
("value_of_10", c_uint32, 1),
("value_of_12", c_uint32, 1),
("value_of_14", c_uint32, 1),
("value_of_15", c_uint32, 1),
("value_of_16", c_uint32, 1),
("value_of_18", c_uint32, 1),
("value_of_20", c_uint32, 1),
("value_of_24", c_uint32, 1),
("value_of_30", c_uint32, 1),
("value_of_32", c_uint32, 1),
("value_of_36", c_uint32, 1),
("value_of_40", c_uint32, 1),
("value_of_48", c_uint32, 1),
("value_of_54", c_uint32, 1),
("value_of_64", c_uint32, 1),
("res", c_uint32, 16),
]
_fields_ = [
("pr_support", c_uint32, 1),
("selective_update_support", c_uint32, 1),
("early_transport_support", c_uint32, 1),
("res", c_uint32, 7),
("dsc_decode_func_support", c_uint32, 1),
("asynch_video_timing_support", c_uint32, 1),
("dsc_src_support", c_uint32, 1),
("granularity_needed", c_uint32, 1),
("y_gran_extended_supported", c_uint32, 1),
("link_off_supported", c_uint32, 1),
("res1", c_uint32, 16),
("pr_x_granularity", c_uint32),
("pr_y_granularity", c_uint32),
("su_y_granularity", SuYGranularityStruct)
]
class SinkPanelReplayStatusStruct(Structure):
class PRStatusDebugStruct(Structure):
_fields_ = [
("res", c_uint32, 8),
("psr_state", c_uint32, 1),
("res1", c_uint32, 1),
("crc_valid", c_uint32, 1),
("su_coordinate_valid", c_uint32, 1),
("res2", c_uint32, 20),
]
_fields_ = [
("active_frame_crc_err", c_uint32, 1),
("rfb_storage_err", c_uint32, 1),
("vsc_sdp_err", c_uint32, 1),
("ass_dp_missing", c_uint32, 1),
("res", c_uint32, 12),
("self_status", c_uint32, 3),
("frame_locked", c_uint32, 2),
("frame_locked_status_valid", c_uint32, 1),
("res1", c_uint32, 10),
("debug", PRStatusDebugStruct)
]
class SinkPanelSelfRefreshCapsStruct(Structure):
_fields_ = [
("psr_caps", c_uint32, 8),
("link_training_req_psr1", c_uint32, 1),
("psr_setup_time", c_uint32, 3),
("y_coor_psr2_su", c_uint32, 1),
("su_coordinates_shall_adhere", c_uint32, 1),
("no_update_aux_frame_sync", c_uint32, 1),
("res", c_uint32, 17),
("pr_x_granularity", c_uint32),
("pr_y_granularity", c_uint32),
]
class SinkPanelSelfRefreshStatusStruct(Structure):
class PSRStatusDebugStruct(Structure):
_fields_ = [
("min_frame_count_reentry", c_uint32, 1),
("last_actual_syn_latency", c_uint32, 1),
("psr_state", c_uint32, 1),
("update_rfb", c_uint32, 1),
("crc_valid", c_uint32, 1),
("su_valid", c_uint32, 1),
("first_scan_line_su", c_uint32, 1),
("last_scan_line_su", c_uint32, 1),
("y_coordinate_valid", c_uint32, 1),
("res", c_uint32, 17)
]
_fields_ = [
("link_crc_err", c_uint32, 1),
("rfb_storage_err", c_uint32, 1),
("vsc_sdp_err", c_uint32, 1),
("res", c_uint32, 5),
("su_psr_caps_change", c_uint32, 1),
("res1", c_uint32, 1),
("self_refresh", c_uint32, 3),
("res2", c_uint32, 13),
("debugStatus", PSRStatusDebugStruct)
]

View File

@@ -0,0 +1,62 @@
from UniTAP.libs.lib_tsi.tsi_io import PortIO
from .pr_sink_private_types import SinkPanelSelfRefreshStatusStruct, SinkPanelReplayStatusStruct
from .pr_sink_types import (SinkPRStatusFlags, SelfStatus, FrameStatus, SinkPSRStatusFlags, PRSSelfRefreshStatus)
from UniTAP.libs.lib_tsi.tsi import *
class SinkPanelReplayStatus:
"""
Class `SinkPanelReplayStatus` contains information about Sink Panel Replay Status.
- Get Flags status `flags`.
- Get Debug status `debug`.
"""
def __init__(self, port_io: PortIO):
self.__io = port_io
def flags(self) -> SinkPRStatusFlags:
"""
Returns current flags status.
Returns:
object of `SinkPRStatusFlags` type
"""
pr_flags = self.__read()
return SinkPRStatusFlags(active_frame_crc_err=pr_flags.active_frame_crc_err,
rfb_storage_err=pr_flags.rfb_storage_err,
vsc_sdp_err=pr_flags.vsc_sdp_err, ass_dp_missing=pr_flags.ass_dp_missing,
self_status=SelfStatus(pr_flags.self_status),
frame_locked=FrameStatus(pr_flags.frame_locked),
frame_locked_status_valid=pr_flags.frame_locked_status_valid)
def __read(self) -> SinkPanelReplayStatusStruct:
return self.__io.get(TSI_DPRX_PR_STATUS, SinkPanelReplayStatusStruct)[1]
class SinkPanelSelfRefreshStatus:
"""
Class `SinkPanelReplayStatus` contains information about Sink Panel Self Refresh Status.
- Get Flags status `flags`.
- Get Debug status `debug`.
"""
def __init__(self, port_io: PortIO):
self.__io = port_io
def flags(self) -> SinkPSRStatusFlags:
"""
Returns current flags status.
Returns:
object of `SinkPSRStatusFlags` type
"""
pr_flags = self.__read()
return SinkPSRStatusFlags(link_crc_err=pr_flags.link_crc_err,
rfb_storage_err=pr_flags.rfb_storage_err,
vsc_sdp_err=pr_flags.vsc_sdp_err,
su_psr_caps_change=pr_flags.su_psr_caps_change,
self_refresh=PRSSelfRefreshStatus(pr_flags.self_refresh))
def __read(self) -> SinkPanelSelfRefreshStatusStruct:
return self.__io.get(TSI_DPRX_PSR_STATUS, SinkPanelSelfRefreshStatusStruct)[1]

View File

@@ -0,0 +1,844 @@
from enum import IntEnum
class SelfStatus(IntEnum):
"""
Class `SelfStatus` contains all possible variants of Sink Panel Replay Self Status.
"""
Disable = 0
Inactive = 1
Entry = 2
Active = 3
InternalError = 7
def __str__(self):
if self.value == self.Disable:
return "Disable"
elif self.value == self.Inactive:
return "Inactive"
elif self.value == self.Entry:
return "Entry"
elif self.value == self.Active:
return "Active"
elif self.value == self.InternalError:
return "Internal error"
else:
return "Incorrect value"
class FrameStatus(IntEnum):
"""
Class `FrameStatus` contains all possible variants of Sink Panel Replay frame locked.
"""
Locked = 0
Coasting = 1
Governing = 2
ReLocking = 3
def __str__(self):
if self.value == self.Locked:
return "Locked"
elif self.value == self.Coasting:
return "Coasting"
elif self.value == self.Governing:
return "Governing"
elif self.value == self.ReLocking:
return "Re Locking"
else:
return "Incorrect value"
class SinkPRStatusFlags:
def __init__(self, active_frame_crc_err: bool = False, rfb_storage_err: bool = False,
vsc_sdp_err: bool = False, ass_dp_missing: bool = False, self_status: SelfStatus = SelfStatus.Disable,
frame_locked: FrameStatus = FrameStatus.Locked, frame_locked_status_valid: bool = False):
self.__active_frame_crc_err = active_frame_crc_err
self.__rfb_storage_err = rfb_storage_err
self.__vsc_sdp_err = vsc_sdp_err
self.__ass_dp_missing = ass_dp_missing
self.__self_status = self_status
self.__frame_locked = frame_locked
self.__frame_locked_status_valid = frame_locked_status_valid
@property
def active_frame_crc_err(self) -> bool:
"""
Returns state of flag active frame crc error .
Returns:
object of `bool` type
"""
return self.__active_frame_crc_err
@property
def rfb_storage_err(self) -> bool:
"""
Returns state of flag rfb storage error.
Returns:
object of `bool` type
"""
return self.__rfb_storage_err
@property
def vsc_sdp_err(self) -> bool:
"""
Returns state of flag VSC SDP error.
Returns:
object of `bool` type
"""
return self.__vsc_sdp_err
@property
def ass_dp_missing(self) -> bool:
"""
Returns state of flag ASSDP missing.
Returns:
object of `bool` type
"""
return self.__ass_dp_missing
@property
def self_status(self) -> SelfStatus:
"""
Returns self status.
Returns:
object of `SelfStatus` type
"""
return self.__self_status
@property
def frame_locked(self) -> FrameStatus:
"""
Returns frame locked status.
Returns:
object of `FrameStatus` type
"""
return self.__frame_locked
@property
def frame_locked_status_valid(self) -> bool:
"""
Returns state of valid frame locked status.
Returns:
object of `bool` type
"""
return self.__frame_locked_status_valid
def __str__(self) -> str:
return (f"Active frame CRC error: {self.active_frame_crc_err}\n"
f"RFB Storage error: {self.rfb_storage_err}\n"
f"PR VSC SDP uncorrectable error: {self.vsc_sdp_err}\n"
f"Adaptive sync SDP missing and not disabled: {self.ass_dp_missing}\n"
f"Sink device self refresh status: {self.self_status.__str__()}\n"
f"Sink frame locked: {self.frame_locked.__str__()}\n"
f"Sink frame locked status valid: {self.frame_locked_status_valid}\n")
class PRSSelfRefreshStatus(IntEnum):
InActive = 0
CaptureAndDisplayEntry = 1
DisplayFromRFBEntry = 2
CaptureAndDisplayActive = 3
CaptureAndDisplayExit = 4
InternalError = 7
def __str__(self):
if self.value == self.InActive:
return "Inactive"
elif self.value == self.CaptureAndDisplayEntry:
return "Capture and display (Entry)"
elif self.value == self.DisplayFromRFBEntry:
return "Display from RFB (Entry)"
elif self.value == self.CaptureAndDisplayActive:
return "Capture and display (Active)"
elif self.value == self.CaptureAndDisplayExit:
return "Capture and display (Exit_"
elif self.value == self.InternalError:
return "Internal Error"
else:
return "Incorrect version"
class SinkPSRStatusFlags:
def __init__(self, link_crc_err: bool = False, rfb_storage_err: bool = False, vsc_sdp_err: bool = False,
su_psr_caps_change: bool = False, self_refresh: PRSSelfRefreshStatus = PRSSelfRefreshStatus.InActive):
self.__link_crc_err = link_crc_err
self.__rfb_storage_err = rfb_storage_err
self.__vsc_sdp_err = vsc_sdp_err
self.__su_psr_caps_change = su_psr_caps_change
self.__self_refresh = self_refresh
@property
def link_crc_err(self) -> bool:
"""
Returns state of link crc error.
Returns:
object of `bool` type
"""
return self.__link_crc_err
@property
def rfb_storage_err(self) -> bool:
"""
Returns state of RFB storage error.
Returns:
object of `bool` type
"""
return self.__rfb_storage_err
@property
def vsc_sdp_err(self) -> bool:
"""
Returns state of vsc sdp error.
Returns:
object of `bool` type
"""
return self.__vsc_sdp_err
@property
def su_psr_caps_change(self) -> bool:
"""
Returns state of su PSR caps change.
Returns:
object of `bool` type
"""
return self.__su_psr_caps_change
@property
def self_refresh(self) -> PRSSelfRefreshStatus:
"""
Returns state of self refresh.
Returns:
object of `bool` type
"""
return self.__self_refresh
def __str__(self) -> str:
return (f"Link CRC error: {self.link_crc_err}\n"
f"FRB storage error: {self.rfb_storage_err}\n"
f"PSR2 VSC SDP uncorrectable error: {self.vsc_sdp_err}\n"
f"Sink device SU_PSR capability change: {self.su_psr_caps_change}\n"
f"Sink device self-refresh status: {self.self_refresh.__str__()}\n")
class PrGranularityCaps(IntEnum):
Line_1 = 1
Line_2 = 2
Line_4 = 4
Line_8 = 8
Line_16 = 16
def __str__(self) -> str:
if self.value == self.Line_1:
return "Line 1"
elif self.value == self.Line_2:
return "Line 2"
elif self.value == self.Line_4:
return "Line 4"
elif self.value == self.Line_8:
return "Line 8"
elif self.value == self.Line_16:
return "Line 16"
else:
return "Incorrect version"
class PRCapsFlags:
def __init__(self, pr_support: bool = False, selective_update_support: bool = False,
early_transport_support: bool = False, dsc_decode_func_support: bool = False,
asynch_video_timing_support: bool = False, dsc_src_support: bool = False,
granularity_needed: bool = False, y_gran_extended_supported: bool = False,
link_off_supported: bool = False):
self.__pr_support = pr_support
self.__selective_update_support = selective_update_support
self.__early_transport_support = early_transport_support
self.__dsc_decode_func_support = dsc_decode_func_support
self.__asynch_video_timing_support = asynch_video_timing_support
self.__dsc_src_support = dsc_src_support
self.__granularity_needed = granularity_needed
self.__y_gran_extended_supported = y_gran_extended_supported
self.__link_off_supported = link_off_supported
@property
def pr_support(self) -> bool:
"""
Returns PR support state.
Returns:
object of `bool` type
"""
return self.__pr_support
@pr_support.setter
def pr_support(self, value: bool):
self.__pr_support = value
@property
def selective_update_support(self) -> bool:
"""
Returns state of selective update support.
Returns:
object of `bool` type
"""
return self.__selective_update_support
@selective_update_support.setter
def selective_update_support(self, value: bool):
self.__selective_update_support = value
@property
def early_transport_support(self) -> bool:
"""
Returns state of early transport support.
Returns:
object of `bool` type
"""
return self.__early_transport_support
@early_transport_support.setter
def early_transport_support(self, value: bool):
self.__early_transport_support = value
@property
def dsc_decode_func_support(self) -> bool:
"""
Returns state of DSC decode function support.
Returns:
object of `bool` type
"""
return self.__dsc_decode_func_support
@dsc_decode_func_support.setter
def dsc_decode_func_support(self, value: bool):
self.__dsc_decode_func_support = value
@property
def asynch_video_timing_support(self) -> bool:
"""
Returns state of supports Asynchronous Video Timing.
Returns:
object of `bool` type
"""
return self.__asynch_video_timing_support
@asynch_video_timing_support.setter
def asynch_video_timing_support(self, value: bool):
self.__asynch_video_timing_support = value
@property
def dsc_src_support(self) -> bool:
"""
Returns state of DSC CRC of multiple SU regions support.
Returns:
object of `bool` type
"""
return self.__dsc_src_support
@dsc_src_support.setter
def dsc_src_support(self, value: bool):
self.__dsc_src_support = value
@property
def granularity_needed(self) -> bool:
"""
Returns state of Panel Replay Selective Update Granularity Needed.
Returns:
object of `bool` type
"""
return self.__granularity_needed
@granularity_needed.setter
def granularity_needed(self, value: bool):
self.__granularity_needed = value
@property
def y_gran_extended_supported(self) -> bool:
"""
Returns state of SU Y Granularity Extended Capabilities supported.
Returns:
object of `bool` type
"""
return self.__y_gran_extended_supported
@y_gran_extended_supported.setter
def y_gran_extended_supported(self, value: bool):
self.__y_gran_extended_supported = value
@property
def link_off_supported(self) -> bool:
"""
Returns state of Link OFF Supported in PR after Adaptive Sync SDP.
Returns:
object of `bool` type
"""
return self.__link_off_supported
@link_off_supported.setter
def link_off_supported(self, value: bool):
self.__link_off_supported = value
def __str__(self) -> str:
return (f"Panel Replay support: {self.pr_support}\n"
f"Selective Update support: {self.selective_update_support}\n"
f"Early Transport support: {self.early_transport_support}\n"
f"DSC decode functionality support: {self.dsc_decode_func_support}\n"
f"Asynchronous Video Timing support: {self.asynch_video_timing_support}\n"
f"DSC CRC of multiple SU regions support: {self.dsc_src_support}\n"
f"Panel Replay Selective Update granularity needed: {self.granularity_needed}\n"
f"SU Y Granularity Extended Capabilities supported: {self.y_gran_extended_supported}\n"
f"Link OFF Supported in PR after Adaptive Sync SDP: {self.link_off_supported}\n")
class SuYGranularity:
def __init__(self, value_of_8: bool = False, value_of_10: bool = False, value_of_12: bool = False,
value_of_14: bool = False, value_of_15: bool = False, value_of_16: bool = False,
value_of_18: bool = False, value_of_20: bool = False, value_of_24: bool = False,
value_of_30: bool = False, value_of_32: bool = False, value_of_36: bool = False,
value_of_40: bool = False, value_of_48: bool = False, value_of_54: bool = False,
value_of_64: bool = False):
self.__value_of_8 = value_of_8
self.__value_of_10 = value_of_10
self.__value_of_12 = value_of_12
self.__value_of_14 = value_of_14
self.__value_of_15 = value_of_15
self.__value_of_16 = value_of_16
self.__value_of_18 = value_of_18
self.__value_of_20 = value_of_20
self.__value_of_24 = value_of_24
self.__value_of_30 = value_of_30
self.__value_of_32 = value_of_32
self.__value_of_36 = value_of_36
self.__value_of_40 = value_of_40
self.__value_of_48 = value_of_48
self.__value_of_54 = value_of_54
self.__value_of_64 = value_of_64
@property
def value_of_8(self) -> bool:
"""
Supported Y granularity value of 8.
Returns:
object of `bool` type
"""
return self.__value_of_8
@value_of_8.setter
def value_of_8(self, value: bool):
self.__value_of_8 = value
@property
def value_of_10(self) -> bool:
"""
Supported Y granularity value of 10.
Returns:
object of `bool` type
"""
return self.__value_of_10
@value_of_10.setter
def value_of_10(self, value: bool):
self.__value_of_10 = value
@property
def value_of_12(self) -> bool:
"""
Supported Y granularity value of 12.
Returns:
object of `bool` type
"""
return self.__value_of_12
@value_of_12.setter
def value_of_12(self, value: bool):
self.__value_of_12 = value
@property
def value_of_14(self) -> bool:
"""
Supported Y granularity value of 14.
Returns:
object of `bool` type
"""
return self.__value_of_14
@value_of_14.setter
def value_of_14(self, value: bool):
self.__value_of_14 = value
@property
def value_of_15(self) -> bool:
"""
Supported Y granularity value of 15.
Returns:
object of `bool` type
"""
return self.__value_of_15
@value_of_15.setter
def value_of_15(self, value: bool):
self.__value_of_15 = value
@property
def value_of_16(self) -> bool:
"""
Supported Y granularity value of 16.
Returns:
object of `bool` type
"""
return self.__value_of_16
@value_of_16.setter
def value_of_16(self, value: bool):
self.__value_of_16 = value
@property
def value_of_18(self) -> bool:
"""
Supported Y granularity value of 18.
Returns:
object of `bool` type
"""
return self.__value_of_18
@value_of_18.setter
def value_of_18(self, value: bool):
self.__value_of_18 = value
@property
def value_of_20(self) -> bool:
"""
Supported Y granularity value of 20.
Returns:
object of `bool` type
"""
return self.__value_of_20
@value_of_20.setter
def value_of_20(self, value: bool):
self.__value_of_20 = value
@property
def value_of_24(self) -> bool:
"""
Supported Y granularity value of 24.
Returns:
object of `bool` type
"""
return self.__value_of_24
@value_of_24.setter
def value_of_24(self, value: bool):
self.__value_of_24 = value
@property
def value_of_30(self) -> bool:
"""
Supported Y granularity value of 30.
Returns:
object of `bool` type
"""
return self.__value_of_30
@value_of_30.setter
def value_of_30(self, value: bool):
self.__value_of_30 = value
@property
def value_of_32(self) -> bool:
"""
Supported Y granularity value of 32.
Returns:
object of `bool` type
"""
return self.__value_of_32
@value_of_32.setter
def value_of_32(self, value: bool):
self.__value_of_32 = value
@property
def value_of_36(self) -> bool:
"""
Supported Y granularity value of 36.
Returns:
object of `bool` type
"""
return self.__value_of_36
@value_of_36.setter
def value_of_36(self, value: bool):
self.__value_of_36 = value
@property
def value_of_40(self) -> bool:
"""
Supported Y granularity value of 40.
Returns:
object of `bool` type
"""
return self.__value_of_40
@value_of_40.setter
def value_of_40(self, value: bool):
self.__value_of_40 = value
@property
def value_of_48(self) -> bool:
"""
Supported Y granularity value of 48.
Returns:
object of `bool` type
"""
return self.__value_of_48
@value_of_48.setter
def value_of_48(self, value: bool):
self.__value_of_48 = value
@property
def value_of_54(self) -> bool:
"""
Supported Y granularity value of 54.
Returns:
object of `bool` type
"""
return self.__value_of_54
@value_of_54.setter
def value_of_54(self, value: bool):
self.__value_of_54 = value
@property
def value_of_64(self) -> bool:
"""
Supported Y granularity value of 64.
Returns:
object of `bool` type
"""
return self.__value_of_64
@value_of_64.setter
def value_of_64(self, value: bool):
self.__value_of_64 = value
def combined_value(self) -> int:
return (self.value_of_8 | (self.value_of_10 << 1) | (self.value_of_12 << 2) | (self.value_of_14 << 3) |
(self.value_of_15 << 4) | (self.value_of_16 << 5) | (self.value_of_18 << 6) | (self.value_of_20 << 7) |
(self.value_of_24 << 8) | (self.value_of_30 << 9) | (self.value_of_32 << 10) |
(self.value_of_36 << 11) | (self.value_of_40 << 12) | (self.value_of_48 << 13) |
(self.value_of_54 << 14) | (self.value_of_64 << 15))
def __str__(self) -> str:
return (f"Value of 8: {self.value_of_8}\n"
f"Value of 10: {self.value_of_10}\n"
f"Value of 12: {self.value_of_12}\n"
f"Value of 14: {self.value_of_14}\n"
f"Value of 15: {self.value_of_15}\n"
f"Value of 16: {self.value_of_16}\n"
f"Value of 18: {self.value_of_18}\n"
f"Value of 20: {self.value_of_20}\n"
f"Value of 24: {self.value_of_24}\n"
f"Value of 30: {self.value_of_30}\n"
f"Value of 32: {self.value_of_32}\n"
f"Value of 36: {self.value_of_36}\n"
f"Value of 40: {self.value_of_40}\n"
f"Value of 48: {self.value_of_48}\n"
f"Value of 54: {self.value_of_54}\n"
f"Value of 64: {self.value_of_64}\n"
)
class PSRCaps(IntEnum):
NotSupported = 0,
PSR1Supported = 1,
PSR2SUSupported = 2,
PSR2YcoorSupported = 3,
PSR2EarlyTransportSupported = 4
def __str__(self) -> str:
if self.value == self.NotSupported:
return "Not supported"
elif self.value == self.PSR1Supported:
return "PSR 1 supported"
elif self.value == self.PSR2SUSupported:
return "PSR 2 SU supported"
elif self.value == self.PSR2YcoorSupported:
return "PSR 2 SU and Y coordinates supported"
elif self.value == self.PSR2EarlyTransportSupported:
return "PSR 2 SU, Y coordinates and Early Transport supported"
else:
return "Incorrect version"
class PSRSetupTime(IntEnum):
T_330us = 0,
T_275us = 1,
T_220us = 2,
T_165us = 3,
T_110us = 4,
T_55us = 5,
T_0us = 6,
T_Reserved = 7
def __str__(self) -> str:
if self.value == self.T_330us:
return "330 us"
elif self.value == self.T_275us:
return "275 us"
elif self.value == self.T_220us:
return "220 us"
elif self.value == self.T_165us:
return "165 us"
elif self.value == self.T_110us:
return "110 us"
elif self.value == self.T_55us:
return "55 us"
elif self.value == self.T_0us:
return "0 us"
else:
return "Reserved"
class PSRCapsFlags:
def __init__(self, psr_caps: PSRCaps = PSRCaps.NotSupported, link_training_req_psr1: bool = False,
psr_setup_time: PSRSetupTime = PSRSetupTime.T_330us, y_coor_psr2_su: bool = False,
su_coordinates_shall_adhere: bool = False, no_update_aux_frame_sync: bool = False):
self.__psr_caps = psr_caps
self.__link_training_req_psr1 = link_training_req_psr1
self.__psr_setup_time = psr_setup_time
self.__y_coor_psr2_su = y_coor_psr2_su
self.__su_coordinates_shall_adhere = su_coordinates_shall_adhere
self.__no_update_aux_frame_sync = no_update_aux_frame_sync
@property
def psr_caps(self) -> PSRCaps:
"""
Returns PSR caps value from enum.
Returns:
object of `PSRCaps` type
"""
return self.__psr_caps
@psr_caps.setter
def psr_caps(self, value: PSRCaps):
self.__psr_caps = value
@property
def link_training_req_psr1(self) -> bool:
"""
Returns link training request PSR1 flag.
Returns:
object of `bool` type
"""
return self.__link_training_req_psr1
@link_training_req_psr1.setter
def link_training_req_psr1(self, value: bool):
self.__link_training_req_psr1 = value
@property
def psr_setup_time(self) -> PSRSetupTime:
"""
Returns PSR setup time value.
Returns:
object of `PSRSetupTime` type
"""
return self.__psr_setup_time
@psr_setup_time.setter
def psr_setup_time(self, value: PSRSetupTime):
self.__psr_setup_time = value
@property
def y_coor_psr2_su(self) -> bool:
"""
Returns flag for "Y-coordinate for PSR2 SU".
Returns:
object of `bool` type
"""
return self.__y_coor_psr2_su
@y_coor_psr2_su.setter
def y_coor_psr2_su(self, value: bool):
self.__y_coor_psr2_su = value
@property
def su_coordinates_shall_adhere(self) -> bool:
"""
Returns flag for "SU coordinates shall adhere"
Returns:
object of `bool` type
"""
return self.__su_coordinates_shall_adhere
@su_coordinates_shall_adhere.setter
def su_coordinates_shall_adhere(self, value: bool):
self.__su_coordinates_shall_adhere = value
@property
def no_update_aux_frame_sync(self) -> bool:
"""
Returns value for flag "Do not update AUX FRAME SYNC".
Returns:
object of `bool` type
"""
return self.__no_update_aux_frame_sync
@no_update_aux_frame_sync.setter
def no_update_aux_frame_sync(self, value: bool):
self.__no_update_aux_frame_sync = value
def __str__(self) -> str:
return (f"Panel Self Refresh supported: {self.psr_caps.__str__()}\n"
f"Link Training Requirement of Sink: {self.link_training_req_psr1}\n"
f"PSR Setup time: {self.psr_setup_time.__str__()}\n"
f"Y-coordinate Requirement of Sink Device: {self.y_coor_psr2_su}\n"
f"Panel Self Refresh 2 Selective Update Granularity Required: {self.su_coordinates_shall_adhere}\n"
f"Frame Sync Function Is Not Needed for Selective Update: {self.no_update_aux_frame_sync}\n")

View File

@@ -0,0 +1,48 @@
from UniTAP.libs.lib_tsi.tsi_io import PortIO
from .pr_private_types import *
from UniTAP.libs.lib_tsi.tsi import *
from .pr_types import *
class PanelReplayStatus:
"""
Class `PanelReplayStatus` contains information about Panel Replay Status.
- Get PR command `command`.
- Get current state (enabled/disabled) `status`.
- Get PR Error `error`.
"""
def __init__(self, port_io: PortIO):
self.__io = port_io
def command(self) -> PRCommand:
"""
Returns current command of PR.
Returns:
object of `PRCommand` type
"""
return PRCommand(self.__read().command_status)
def status(self) -> PRStatus:
"""
Returns current status of PR (enabled/disabled).
Returns:
object of `PRStatus` type
"""
return PRStatus(self.__read().status)
def error(self) -> PRError:
"""
Returns current error of PR.
Returns:
object of `PRError` type
"""
return PRError(self.__read().error)
def __read(self) -> PrStatus:
self.__io.set(TSI_PG_STREAM_SELECT, 0)
return self.__io.get(TSI_PG_PR_STATUS_R, PrStatus)[1]

View File

@@ -0,0 +1,399 @@
from enum import IntEnum
from typing import List
class PRCommand(IntEnum):
"""
Class `PRCommand` contains all possible variants of Panel Replay Command.
"""
No = 0
EnablingInactive = 1
EnablingActive = 2
RFB = 3
def __str__(self):
if self.value == self.No:
return "No command under execution."
if self.value == self.EnablingInactive:
return "Enabling inactive mode is in progress."
if self.value == self.EnablingActive:
return "Enabling active mode is in progress."
if self.value == self.RFB:
return "RFB selective update is in progress."
class PRStatus(IntEnum):
"""
Class `PRStatus` contains all possible variants of Panel Replay Status.
"""
Disabled = 0
EnabledInactive = 1
EnabledActive = 2
def __str__(self):
if self.value == self.Disabled:
return "Disabled."
if self.value == self.EnabledInactive:
return "Enabled in an inactive mode."
if self.value == self.EnabledActive:
return "Enabled in an active mode."
class PRError(IntEnum):
"""
Class `PRError` contains all possible variants of Panel Replay Error type.
"""
No = 0
Internal = 1
IncorrectCommandReceived = 2
FailedAccess = 3
LTFailed = 4
SelUpdIncorrect = 5
def __str__(self):
if self.value == self.No:
return "No errors."
if self.value == self.Internal:
return "Internal error."
if self.value == self.IncorrectCommandReceived:
return "Incorrect command received."
if self.value == self.FailedAccess:
return "Failed to access DPCD."
if self.value == self.LTFailed:
return "LinkTraining failed."
if self.value == self.SelUpdIncorrect:
return "Selective update config is incorrect."
class PRMode(IntEnum):
"""
Class `PRMode` contains all possible variants of Panel Replay mode.
"""
PR = 0
PSR1 = 1
PSR2 = 2
Res = 3
class YGranularity(IntEnum):
"""
Class `YGranularity` contains all possible variants of SU Y granularity.
"""
Value_8 = 0
Value_10 = 1
Value_12 = 2
Value_14 = 3
Value_15 = 4
Value_16 = 5
Value_18 = 6
Value_20 = 7
Value_24 = 8
Value_30 = 9
Value_32 = 10
Value_36 = 11
Value_40 = 12
Value_48 = 13
Value_54 = 14
Value_64 = 15
class Region:
"""
Class `Region` contains information about each PR Region (Frame).
- Set and get X coordinate 'x'.
- Set and get Y coordinate 'y'.
- Set and get Width 'width'.
- Set and get Height `height`
"""
def __init__(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0):
self.__x = x
self.__y = y
self.__width = width
self.__height = height
@property
def x(self) -> int:
"""
Returns current X coordinate value.
Returns:
object of `int` type
"""
return self.__x
@x.setter
def x(self, value: int):
self.__x = value
@property
def y(self) -> int:
"""
Returns current Y coordinate value.
Returns:
object of `int` type
"""
return self.__y
@y.setter
def y(self, value: int):
self.__y = value
@property
def width(self) -> int:
"""
Returns current Width value.
Returns:
object of `int` type
"""
return self.__width
@width.setter
def width(self, value: int):
self.__width = value
@property
def height(self) -> int:
"""
Returns current Height value.
Returns:
object of `int` type
"""
return self.__height
@height.setter
def height(self, value: int):
self.__height = value
class Flags:
"""
Class `Flags` contains information about Panel Replay flags capabilities.
- Set and get `early_transport` Early transport during selective update is supported.
- Set and get `crc_in_vsc_sdp`. CRC for selective update region/full active frame in VSC SDP is supported.
- Set and get `mode`. PanelReplay mode.
- Set and get `hpd_irq`. Generate HPD_IRQ with Adaptive-Sync SDP missing (PR).
- Set and get `hpd_irq_vsc_sdp`. IRQ_HPD with VSC SDP uncorrectable error (PR).
- Set and get `hpd_irq_rfb`. IRQ_HPD with RFB storage error (PR).
- Set and get `hpd_irq_crc`. IRQ_HPD with active frame CRC error.
- Set and get `refresh_rate_unlock`. Sink refresh rate unlock granted.
- Set and get `ext_y_gran`. Use SU extended Y granularity (PSR2 and PR).
- Set and get `main_link_remain_on`. Main-link remains ON during PSR1/PSR2 active states.
- Set and get `y_granularity`. SU Y granularity extended value selection.
"""
def __init__(self, early_transport: bool = False, crc_in_vsc_sdp: bool = False, pr_mode: PRMode = PRMode.PR,
hpd_irq: bool = False, hpd_irq_vsc_sdp: bool = False, hpd_irq_rfb: bool = False,
hpd_irq_crc: bool = False, refresh_rate_unlock: bool = False, ext_y_gran: bool = False,
main_link_remain_on: bool = False, y_granularity: YGranularity = YGranularity.Value_8):
self.__early_transport = early_transport
self.__crc_in_vsc_sdp = crc_in_vsc_sdp
self.__mode = pr_mode
self.__hpd_irq = hpd_irq
self.__hpd_irq_vsc_sdp = hpd_irq_vsc_sdp
self.__hpd_irq_rfb = hpd_irq_rfb
self.__hpd_irq_crc = hpd_irq_crc
self.__refresh_rate_unlock = refresh_rate_unlock
self.__ext_y_gran = ext_y_gran
self.__main_link_remain_on = main_link_remain_on
self.__y_granularity = y_granularity
@property
def early_transport(self) -> bool:
"""
Returns current early transport value.
Returns:
object of `bool` type
"""
return self.__early_transport
@early_transport.setter
def early_transport(self, value: bool):
self.__early_transport = value
@property
def crc_in_vsc_sdp(self) -> bool:
"""
Returns current crc in vsc sdp value.
Returns:
object of `bool` type
"""
return self.__crc_in_vsc_sdp
@crc_in_vsc_sdp.setter
def crc_in_vsc_sdp(self, value: bool):
self.__crc_in_vsc_sdp = value
@property
def mode(self) -> PRMode:
"""
Returns current PR mode.
Returns:
object of `PRMode` type
"""
return self.__mode
@mode.setter
def mode(self, value: PRMode):
self.__mode = value
@property
def hpd_irq(self) -> bool:
"""
Returns current state of HPD_IRQ with Adaptive-Sync SDP missing (PR).
Returns:
object of `bool` type
"""
return self.__hpd_irq
@hpd_irq.setter
def hpd_irq(self, value: bool):
self.__hpd_irq = value
@property
def hpd_irq_vsc_sdp(self) -> bool:
"""
Returns current state of IRQ_HPD with VSC SDP uncorrectable error (PR).
Returns:
object of `bool` type
"""
return self.__hpd_irq_vsc_sdp
@hpd_irq_vsc_sdp.setter
def hpd_irq_vsc_sdp(self, value: bool):
self.__hpd_irq_vsc_sdp = value
@property
def hpd_irq_rfb(self) -> bool:
"""
Returns current state of IRQ_HPD with RFB storage error (PR).
Returns:
object of `bool` type
"""
return self.__hpd_irq_rfb
@hpd_irq_rfb.setter
def hpd_irq_rfb(self, value: bool):
self.__hpd_irq_rfb = value
@property
def hpd_irq_crc(self) -> bool:
"""
Returns current state of IRQ_HPD with active frame CRC error.
Returns:
object of `bool` type
"""
return self.__hpd_irq_crc
@hpd_irq_crc.setter
def hpd_irq_crc(self, value: bool):
self.__hpd_irq_crc = value
@property
def refresh_rate_unlock(self) -> bool:
"""
Returns current state of Sink refresh rate unlock granted.
Returns:
object of `bool` type
"""
return self.__refresh_rate_unlock
@refresh_rate_unlock.setter
def refresh_rate_unlock(self, value: bool):
self.__refresh_rate_unlock = value
@property
def ext_y_gran(self) -> bool:
"""
Returns current state of SU extended Y granularity (PSR2 and PR).
Returns:
object of `bool` type
"""
return self.__ext_y_gran
@ext_y_gran.setter
def ext_y_gran(self, value: bool):
self.__ext_y_gran = value
@property
def main_link_remain_on(self) -> bool:
"""
Returns current state of Main-link remains ON during PSR1/PSR2 active states.
Returns:
object of `bool` type
"""
return self.__main_link_remain_on
@main_link_remain_on.setter
def main_link_remain_on(self, value: bool):
self.__main_link_remain_on = value
@property
def y_granularity(self) -> YGranularity:
"""
Returns current value of SU Y granularity.
Returns:
object of `YGranularity` type
"""
return self.__y_granularity
@y_granularity.setter
def y_granularity(self, y_granularity: YGranularity):
self.__y_granularity = y_granularity
class PrSettings:
"""
Class `PrSettings` contains information about Panel Replay capabilities.
- Set and get `flags` Flags capabilities.
- Set and get `regions`. Regions capabilities.
"""
def __init__(self):
self.__regions: [Region] = []
self.__flags: Flags = Flags()
@property
def flags(self) -> Flags:
"""
Returns current Flags caps.
Returns:
object of `Flags` type
"""
return self.__flags
@flags.setter
def flags(self, value: Flags):
self.__flags = value
@property
def regions(self) -> List[Region]:
"""
Returns current Regions caps.
Returns:
object of `Region` list type
"""
return self.__regions
@regions.setter
def regions(self, value: List[Region]):
self.__regions = value