更新UCD-API库及文档
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import time
|
||||
from typing import Union
|
||||
from ctypes import c_int, c_uint, c_int32
|
||||
from typing import Union, List
|
||||
|
||||
from UniTAP.libs.lib_tsi.tsi_io import DeviceIO
|
||||
from UniTAP.libs.lib_tsi.tsi import *
|
||||
import UniTAP.libs.lib_tsi.tsi_types as ci
|
||||
import UniTAP.libs.lib_tsi.tsi_private_types as p_ci
|
||||
from UniTAP.dev.modules.capturer.statuses import CaptureStatus, AudioCaptureStatus, EventCaptureStatus, \
|
||||
VideoCaptureStatus, BulkCaptureStatus
|
||||
from UniTAP.common import AudioFrameData, VideoFrameDSC, create_from_pps
|
||||
@@ -12,6 +14,8 @@ from UniTAP.utils import function_scheduler
|
||||
from UniTAP.dev.ports.modules.capturer.bulk.private_bulk_types import *
|
||||
from UniTAP.dev.ports.modules.capturer.bulk.bulk_types import *
|
||||
from .types import *
|
||||
from UniTAP.utils import tsi_logging as logging
|
||||
|
||||
|
||||
|
||||
TIMEOUT = 10
|
||||
@@ -84,27 +88,27 @@ class Capturer:
|
||||
|
||||
@property
|
||||
def video_capturer_status(self) -> VideoCaptureStatus:
|
||||
return VideoCaptureStatus(self.__io.get(TSI_VIDCAP_CAPTURE_STATUS_R, c_int)[1])
|
||||
return VideoCaptureStatus(self.__io.get(p_ci.TSI_VIDCAP_CAPTURE_STATUS_R, c_int)[1])
|
||||
|
||||
@property
|
||||
def audio_capturer_status(self) -> AudioCaptureStatus:
|
||||
return AudioCaptureStatus(self.__io.get(TSI_R_AUDCAP_STATUS, c_int)[1])
|
||||
return AudioCaptureStatus(self.__io.get(ci.TSI_R_AUDCAP_STATUS, c_int)[1])
|
||||
|
||||
@property
|
||||
def event_capturer_status(self) -> EventCaptureStatus:
|
||||
return EventCaptureStatus(self.__io.get(TSI_EVCAP_CTRL, c_uint32)[1] & 0xFF)
|
||||
return EventCaptureStatus(self.__io.get(ci.TSI_EVCAP_CTRL, c_uint32)[1] & 0xFF)
|
||||
|
||||
@property
|
||||
def bulk_capturer_status(self) -> BulkCaptureStatus:
|
||||
return BulkCaptureStatus(self.__io.get(TSI_BULK_CAPTURE_STATUS_R, c_uint32)[1] & 0x3)
|
||||
return BulkCaptureStatus(self.__io.get(ci.TSI_BULK_CAPTURE_STATUS_R, c_uint32)[1] & 0x3)
|
||||
|
||||
def start_capture(self, config: CaptureConfig):
|
||||
self.__mutex.acquire()
|
||||
|
||||
self.__config.from_int(self.__current_config().to_int() | config.to_int())
|
||||
self.__io.set(TSI_CAP_CONFIG, self.__config.to_int())
|
||||
self.__io.set(ci.TSI_CAP_CONFIG, self.__config.to_int())
|
||||
|
||||
if self.__io.set(TSI_W_CAP_COMMAND, 1) == 0:
|
||||
if self.__io.set(ci.TSI_W_CAP_COMMAND, 1) == 0:
|
||||
self.__status = CaptureStatus.Running
|
||||
else:
|
||||
self.__status = CaptureStatus.Unknown
|
||||
@@ -115,9 +119,9 @@ class Capturer:
|
||||
self.__mutex.acquire()
|
||||
|
||||
self.__config.from_int(self.__current_config().to_int() & ~config.to_int())
|
||||
self.__io.set(TSI_CAP_CONFIG, self.__config.to_int())
|
||||
self.__io.set(ci.TSI_CAP_CONFIG, self.__config.to_int())
|
||||
|
||||
if self.__io.set(TSI_W_CAP_COMMAND, 2) == 0:
|
||||
if self.__io.set(ci.TSI_W_CAP_COMMAND, 2) == 0:
|
||||
self.__status = CaptureStatus.Stop
|
||||
else:
|
||||
self.__status = CaptureStatus.Unknown
|
||||
@@ -128,22 +132,22 @@ class Capturer:
|
||||
event = EventData()
|
||||
|
||||
if event_count > 0:
|
||||
event_size = self.__io.get(TSI_R_EVCAP_DATA, None, 0)[0]
|
||||
event_size = self.__io.get(ci.TSI_R_EVCAP_DATA, None, 0)[0]
|
||||
if event_size > 0:
|
||||
event.data = bytearray(self.__io.get(TSI_R_EVCAP_DATA, c_ubyte, event_size)[1])
|
||||
event.data = bytearray(self.__io.get(ci.TSI_R_EVCAP_DATA, c_ubyte, event_size)[1])
|
||||
|
||||
return event
|
||||
|
||||
def get_buffer_capacity(self, stream_number: int = None):
|
||||
if stream_number is not None:
|
||||
self.__io.set(TSI_DPRX_STREAM_SELECT, stream_number, c_uint32)
|
||||
self.__io.set(TSI_DPRX_MSA_COMMAND_W, 2, c_uint32)
|
||||
self.__io.set(ci.TSI_DPRX_STREAM_SELECT, stream_number, c_uint32)
|
||||
self.__io.set(ci.TSI_DPRX_MSA_COMMAND_W, 2, c_uint32)
|
||||
|
||||
width = self.__io.get(TSI_R_INPUT_WIDTH , c_uint32)[1]
|
||||
height = self.__io.get(TSI_R_INPUT_HEIGHT , c_uint32)[1]
|
||||
total_memory_bytes = self.__io.get(TSI_MEMORY_SIZE_R, c_uint64)[1]
|
||||
bpc = self.__io.get(TSI_INPUT_COLOR_DEPTH_R , c_uint32)[1]
|
||||
color_format = self.__io.get(TSI_INPUT_COLOR_MODE_R , c_uint32)[1]
|
||||
width = self.__io.get(ci.TSI_R_INPUT_WIDTH, c_uint32)[1]
|
||||
height = self.__io.get(ci.TSI_R_INPUT_HEIGHT, c_uint32)[1]
|
||||
total_memory_bytes = self.__io.get(ci.TSI_MEMORY_SIZE_R, c_uint64)[1]
|
||||
bpc = self.__io.get(ci.TSI_INPUT_COLOR_DEPTH_R, c_uint32)[1]
|
||||
color_format = self.__io.get(ci.TSI_INPUT_COLOR_MODE_R, c_uint32)[1]
|
||||
|
||||
bpp = self._get_bits_per_pixel(bpc, color_format)
|
||||
line_alignment = 1023
|
||||
@@ -186,7 +190,7 @@ class Capturer:
|
||||
return (value + alignment) & ~alignment
|
||||
|
||||
def get_available_events_count(self) -> int:
|
||||
return self.__io.get(TSI_R_EVCAP_COUNT, c_uint32)[1]
|
||||
return self.__io.get(ci.TSI_R_EVCAP_COUNT, c_uint32)[1]
|
||||
|
||||
def capture_n_events(self, events_count: int):
|
||||
if events_count <= 0:
|
||||
@@ -215,19 +219,21 @@ class Capturer:
|
||||
|
||||
audio_frame = AudioFrameData()
|
||||
|
||||
audio_frame.channel_count = self.__io.get(TSI_R_AUDCAP_CHANNEL_COUNT, c_int)[1]
|
||||
audio_frame.sample_size = self.__io.get(TSI_R_AUDCAP_SAMPLE_SIZE, c_int)[1] * 8
|
||||
audio_frame.sample_rate = self.__io.get(TSI_R_AUDCAP_SAMPLE_RATE, c_int)[1]
|
||||
audio_frame.timestamp = self.__io.get(TSI_R_AUDCAP_TIMESTAMP, c_uint64)[1]
|
||||
audio_frame.samples = self.__io.get(TSI_R_AUDCAP_SAMPLE_COUNT, c_int)[1]
|
||||
audio_frame.frame_counter = self.__io.get(TSI_R_AUDCAP_FRAME_COUNTER, c_int)[1]
|
||||
audio_frame.sample_format = self.__io.get(TSI_R_AUDCAP_SAMPLE_FORMAT, c_int)[1]
|
||||
audio_frame.channel_count = self.__io.get(ci.TSI_AUDCAP_CHANNEL_COUNT_R, c_int)[1]
|
||||
audio_frame.sample_size = self.__io.get(ci.TSI_AUDCAP_SAMPLE_BITS_SIZE_R, c_int)[1]
|
||||
audio_frame.sample_rate = self.__io.get(ci.TSI_R_AUDCAP_SAMPLE_RATE, c_int)[1]
|
||||
audio_frame.timestamp = self.__io.get(ci.TSI_R_AUDCAP_TIMESTAMP, c_uint64)[1]
|
||||
audio_frame.samples = self.__io.get(ci.TSI_R_AUDCAP_SAMPLE_COUNT, c_int)[1]
|
||||
audio_frame.frame_counter = self.__io.get(ci.TSI_R_AUDCAP_FRAME_COUNTER, c_int)[1]
|
||||
audio_frame.sample_format = self.__io.get(ci.TSI_R_AUDCAP_SAMPLE_FORMAT, c_int)[1]
|
||||
|
||||
min_buff_size = self.__io.get(TSI_R_AUDCAP_MIN_BUFFER_SIZE, c_uint32)[1]
|
||||
audio_frame.data = self.__io.get(TSI_R_AUDCAP_SAMPLE_DATA, c_uint8, min_buff_size)[1]
|
||||
min_buff_size = self.__io.get(ci.TSI_R_AUDCAP_MIN_BUFFER_SIZE, c_uint32)[1]
|
||||
audio_frame.data = self.__io.get(ci.TSI_R_AUDCAP_SAMPLE_DATA, c_uint8, min_buff_size)[1]
|
||||
|
||||
m_sec -= 1000 * len(audio_frame.data) / 2 / audio_frame.channel_count / audio_frame.sample_rate
|
||||
captured_sample_count = len(audio_frame.data) / (audio_frame.sample_size / 8) / audio_frame.channel_count
|
||||
captured_m_sec_count = int(captured_sample_count * 1000 / audio_frame.sample_rate)
|
||||
|
||||
m_sec -= captured_m_sec_count
|
||||
return audio_frame, m_sec
|
||||
|
||||
def capture_audio_by_n_frames(self, frames_count: int, timeout: int = None):
|
||||
@@ -263,29 +269,32 @@ class Capturer:
|
||||
raise ValueError(f"Seconds count must be more than 0.")
|
||||
|
||||
buffer = []
|
||||
time_break = False
|
||||
|
||||
while m_sec > 0 and not time_break:
|
||||
captured = 0
|
||||
last_data_time = time.time()
|
||||
while m_sec > 0:
|
||||
start_time = time.time()
|
||||
while captured < 10 and m_sec > 0:
|
||||
status = self.audio_capturer_status
|
||||
current_time = time.time()
|
||||
if current_time - start_time > TIMEOUT:
|
||||
time_break = True
|
||||
break
|
||||
if status == AudioCaptureStatus.Stop:
|
||||
continue
|
||||
while self.audio_capturer_status != AudioCaptureStatus.Running:
|
||||
if time.time() - start_time > TIMEOUT:
|
||||
logging.error(f"Audio capture device not running for {TIMEOUT} seconds. Aborting.")
|
||||
return buffer
|
||||
logging.debug(f"Audio capture device not running yet: {self.audio_capturer_status}")
|
||||
time.sleep(0.5)
|
||||
|
||||
audio_frame, m_sec = self.__capture_audio(m_sec=m_sec)
|
||||
if len(audio_frame.data) > 0:
|
||||
captured += 1
|
||||
buffer.append(audio_frame)
|
||||
audio_frame, m_sec = self.__capture_audio(m_sec=m_sec)
|
||||
if len(audio_frame.data) > 0:
|
||||
buffer.append(audio_frame)
|
||||
last_data_time = time.time()
|
||||
else:
|
||||
if time.time() - last_data_time > TIMEOUT:
|
||||
logging.error(
|
||||
f"No audio data captured within {TIMEOUT} seconds. "
|
||||
f"Interrupting capture process."
|
||||
)
|
||||
break
|
||||
|
||||
return buffer
|
||||
|
||||
def get_available_video_frame_count(self):
|
||||
return self.__io.get(TSI_VIDCAP_AVAILABLE_FRAME_COUNT, c_int)[1]
|
||||
return self.__io.get(p_ci.TSI_VIDCAP_AVAILABLE_FRAME_COUNT, c_int)[1]
|
||||
|
||||
def __check_available_video(self, timeout) -> bool:
|
||||
def is_video_available(capturer):
|
||||
@@ -322,27 +331,27 @@ class Capturer:
|
||||
f"Cannot start to capture video. Current video capture status {self.video_capturer_status.name}")
|
||||
|
||||
try:
|
||||
result = self.__io.set(TSI_VIDCAP_CAPTURE_NEXT_W, 0)
|
||||
if result == TSI_ERROR_DATA_PROTECTION_ENABLED:
|
||||
result = self.__io.set(ci.TSI_VIDCAP_CAPTURE_NEXT_W, 0)
|
||||
if result == ci.TSI_ERROR_DATA_PROTECTION_ENABLED:
|
||||
raise CaptureError("Video data is HDCP protected. Capturing is not available.")
|
||||
except AssertionError as e:
|
||||
raise CaptureError(f"Error: {e}")
|
||||
|
||||
try:
|
||||
min_buffer_size = self.__io.get(TSI_R_VIDCAP_MIN_BUFFER_SIZE, c_int)[1]
|
||||
min_buffer_size = self.__io.get(ci.TSI_R_VIDCAP_MIN_BUFFER_SIZE, c_int)[1]
|
||||
if min_buffer_size <= 0:
|
||||
raise ValueError("Minimum buffer size must be more than 0")
|
||||
except AssertionError as e:
|
||||
raise CaptureError(f"Error: {e}")
|
||||
|
||||
try:
|
||||
frame_data = bytearray(self.__io.get(TSI_R_VIDCAP_FRAME_DATA, c_uint8, min_buffer_size)[1])
|
||||
frame_data = bytearray(self.__io.get(ci.TSI_R_VIDCAP_FRAME_DATA, c_uint8, min_buffer_size)[1])
|
||||
if len(frame_data) <= 0:
|
||||
raise ValueError("Minimum length of captured data must be more than 0")
|
||||
except AssertionError as e:
|
||||
raise CaptureError(f"Error: {e}")
|
||||
|
||||
frame_attributes = self.__io.get(TSI_VIDCAP_FRAME_HEADER_R, VideoFrameHeader)[1]
|
||||
frame_attributes = self.__io.get(ci.TSI_VIDCAP_FRAME_HEADER_R, VideoFrameHeader)[1]
|
||||
|
||||
if frame_attributes.is_dsc() and len(frame_data) > 128:
|
||||
vf = VideoFrameDSC()
|
||||
@@ -397,12 +406,12 @@ class Capturer:
|
||||
|
||||
def set_video_stream_number(self, number: int):
|
||||
self.__mutex.acquire()
|
||||
self.__io.set(TSI_DPRX_STREAM_SELECT, number, c_uint32)
|
||||
self.__io.set(ci.TSI_DPRX_STREAM_SELECT, number, c_uint32)
|
||||
self.__mutex.release()
|
||||
|
||||
def __current_config(self) -> CaptureConfig:
|
||||
config = CaptureConfig()
|
||||
config.from_int(self.__io.get(TSI_CAP_CONFIG, c_uint)[1])
|
||||
config.from_int(self.__io.get(ci.TSI_CAP_CONFIG, c_uint)[1])
|
||||
return config
|
||||
|
||||
# Capture CRC
|
||||
@@ -410,7 +419,7 @@ class Capturer:
|
||||
if crc_frame_count <= 0:
|
||||
raise ValueError(f"Incorrect crc frame count: {crc_frame_count}")
|
||||
|
||||
crc_values = self.__io.get(TSI_VIDCAP_SIGNAL_CRC_R, CrcStruct, crc_frame_count)[1]
|
||||
crc_values = self.__io.get(ci.TSI_VIDCAP_SIGNAL_CRC_R, CrcStruct, crc_frame_count)[1]
|
||||
crc_list = []
|
||||
if crc_frame_count == 1:
|
||||
crc_list = [(crc_values.r, crc_values.g, crc_values.b)]
|
||||
@@ -420,15 +429,15 @@ class Capturer:
|
||||
|
||||
# Bulk Capturer
|
||||
def read_bulk_capture_caps(self) -> CaptureCaps:
|
||||
return self.__io.get(TSI_BULK_CAPTURE_CAPS_R, CaptureCaps)[1]
|
||||
return self.__io.get(ci.TSI_BULK_CAPTURE_CAPS_R, CaptureCaps)[1]
|
||||
|
||||
def read_bulk_trigger_caps(self) -> int:
|
||||
return self.__io.get(TSI_BULK_TRIGGER_CAPS_R, c_uint32)[1]
|
||||
return self.__io.get(ci.TSI_BULK_TRIGGER_CAPS_R, c_uint32)[1]
|
||||
|
||||
def write_bulk_trigger_settings(self, trigger_mask: int, trigger_config: list, trigger_config_ext: list):
|
||||
self.__io.set(TSI_BULK_TRIGGER_MASK_W, trigger_mask, c_uint32)
|
||||
self.__io.set(TSI_BULK_TRIGGER_CONFIGURATION_W, trigger_config, c_uint32, data_count=len(trigger_config))
|
||||
self.__io.set(TSI_BULK_TRIGGER_CONFIGURATION_EXT_W, trigger_config_ext, c_uint32,
|
||||
self.__io.set(ci.TSI_BULK_TRIGGER_MASK_W, trigger_mask, c_uint32)
|
||||
self.__io.set(ci.TSI_BULK_TRIGGER_CONFIGURATION_W, trigger_config, c_uint32, data_count=len(trigger_config))
|
||||
self.__io.set(ci.TSI_BULK_TRIGGER_CONFIGURATION_EXT_W, trigger_config_ext, c_uint32,
|
||||
data_count=len(trigger_config_ext))
|
||||
|
||||
def write_bulk_size(self, size: int):
|
||||
@@ -436,56 +445,56 @@ class Capturer:
|
||||
data.BLOCK = 0
|
||||
data.OFFSET = 0
|
||||
data.SIZE = size
|
||||
self.__io.set(TSI_BULK_CAPTURE_BLOCK, data, SBlock)
|
||||
self.__io.set(ci.TSI_BULK_CAPTURE_BLOCK, data, SBlock)
|
||||
|
||||
def write_encoding_type(self, value: EncodingTypeEnum):
|
||||
self.__io.set(TSI_BULK_CAPTURE_TYPE, value.value, c_uint32)
|
||||
self.__io.set(ci.TSI_BULK_CAPTURE_TYPE, value.value, c_uint32)
|
||||
|
||||
def read_encoding_type(self) -> EncodingTypeEnum:
|
||||
return EncodingTypeEnum(self.__io.get(TSI_BULK_CAPTURE_TYPE, c_uint32)[1])
|
||||
return EncodingTypeEnum(self.__io.get(ci.TSI_BULK_CAPTURE_TYPE, c_uint32)[1])
|
||||
|
||||
def write_lane_count(self, value: LaneCountEnum):
|
||||
self.__io.set(TSI_BULK_CAPTURE_LANE_COUNT, value.value, c_uint32)
|
||||
self.__io.set(ci.TSI_BULK_CAPTURE_LANE_COUNT, value.value, c_uint32)
|
||||
|
||||
def read_lane_count(self) -> LaneCountEnum:
|
||||
return LaneCountEnum(self.__io.get(TSI_BULK_CAPTURE_LANE_COUNT, c_uint32)[1])
|
||||
return LaneCountEnum(self.__io.get(ci.TSI_BULK_CAPTURE_LANE_COUNT, c_uint32)[1])
|
||||
|
||||
def write_bulk_gpio(self, gpio: bool):
|
||||
self.__io.set(TSI_BULK_CAPTURE_GPIO_W, TSI_BULK_CAPTURE_GPIO_5BIT if gpio else TSI_BULK_CAPTURE_GPIO_OFF,
|
||||
self.__io.set(ci.TSI_BULK_CAPTURE_GPIO_W, ci.TSI_BULK_CAPTURE_GPIO_5BIT if gpio else ci.TSI_BULK_CAPTURE_GPIO_OFF,
|
||||
c_uint32)
|
||||
|
||||
def write_bulk_trigger_position(self, position: int):
|
||||
self.__io.set(TSI_BULK_TRIGGER_POS, position)
|
||||
self.__io.set(ci.TSI_BULK_TRIGGER_POS, position)
|
||||
|
||||
def start_bulk_capture(self):
|
||||
|
||||
self.__mutex.acquire()
|
||||
|
||||
self.__io.set(TSI_EVCAP_CTRL, 1)
|
||||
self.__io.set(TSI_BULK_CAPTURE_CONTROL_W, TSI_BULK_CAPTURE_START)
|
||||
self.__io.set(ci.TSI_EVCAP_CTRL, 1)
|
||||
self.__io.set(ci.TSI_BULK_CAPTURE_CONTROL_W, ci.TSI_BULK_CAPTURE_START)
|
||||
|
||||
self.__mutex.release()
|
||||
|
||||
def stop_bulk_capture(self):
|
||||
self.__mutex.acquire()
|
||||
|
||||
self.__io.set(TSI_EVCAP_CTRL, 0)
|
||||
self.__io.set(TSI_BULK_CAPTURE_CONTROL_W, TSI_BULK_CAPTURE_STOP)
|
||||
self.__io.set(ci.TSI_EVCAP_CTRL, 0)
|
||||
self.__io.set(ci.TSI_BULK_CAPTURE_CONTROL_W, ci.TSI_BULK_CAPTURE_STOP)
|
||||
|
||||
self.__mutex.release()
|
||||
|
||||
def start_event_capture(self):
|
||||
self.__mutex.acquire()
|
||||
|
||||
self.__io.set(TSI_EVCAP_CTRL, 1)
|
||||
self.__io.set(TSI_EVCAP_EVENT_SRC_EN, UCD_ALL_EVENTS)
|
||||
self.__io.set(ci.TSI_EVCAP_CTRL, 1)
|
||||
self.__io.set(ci.TSI_EVCAP_EVENT_SRC_EN, ci.UCD_ALL_EVENTS)
|
||||
|
||||
self.__mutex.release()
|
||||
|
||||
def stop_event_capture(self):
|
||||
self.__mutex.acquire()
|
||||
|
||||
self.__io.set(TSI_EVCAP_CTRL, 0)
|
||||
self.__io.set(ci.TSI_EVCAP_CTRL, 0)
|
||||
|
||||
self.__mutex.release()
|
||||
|
||||
@@ -494,9 +503,9 @@ class Capturer:
|
||||
value = -1
|
||||
time_waited = time.time()
|
||||
|
||||
while value != TSI_BULK_STATUS_IDLE and time.time() - time_waited < max_time_waiting:
|
||||
self.__io.set(TSI_BULK_CAPTURE_CLEAR_W, 0)
|
||||
value = self.__io.get(TSI_BULK_CAPTURE_STATUS_R)[1]
|
||||
while value != ci.TSI_BULK_STATUS_IDLE and time.time() - time_waited < max_time_waiting:
|
||||
self.__io.set(ci.TSI_BULK_CAPTURE_CLEAR_W, 0)
|
||||
value = self.__io.get(ci.TSI_BULK_CAPTURE_STATUS_R)[1]
|
||||
|
||||
def bulk_capture(self, all_size: int, trigger_enabled: Optional[TriggerVarType]) -> list:
|
||||
buffer = []
|
||||
@@ -504,16 +513,16 @@ class Capturer:
|
||||
prev_status = 0
|
||||
last_bulk_capture_time = time.time()
|
||||
for i in range(iterations):
|
||||
event_count = self.__io.get(TSI_EVCAP_COUNT_R, c_uint32)[1]
|
||||
event_count = self.__io.get(ci.TSI_EVCAP_COUNT_R, c_uint32)[1]
|
||||
if event_count > 0:
|
||||
event_number = 0
|
||||
prev_timestamp = 0
|
||||
events_captured = 0
|
||||
while event_count > 0 and events_captured < 500:
|
||||
event_size = self.__io.get(TSI_R_EVCAP_DATA, None, 0)[0]
|
||||
event_size = self.__io.get(ci.TSI_R_EVCAP_DATA, None, 0)[0]
|
||||
if event_size > 0:
|
||||
cap_data = CapturedData()
|
||||
cap_data.data = bytearray(self.__io.get(TSI_R_EVCAP_DATA, c_ubyte, event_size)[1])
|
||||
cap_data.data = bytearray(self.__io.get(ci.TSI_R_EVCAP_DATA, c_ubyte, event_size)[1])
|
||||
cap_data.data = cap_data.data[3:]
|
||||
cap_data.type = CapturedDataType.Event
|
||||
cap_data.timestamp = int.from_bytes(bytes=cap_data.data[:8], byteorder='big')
|
||||
@@ -526,8 +535,8 @@ class Capturer:
|
||||
events_captured += 1
|
||||
event_count -= 1
|
||||
|
||||
bulk_status = self.__io.get(TSI_BULK_CAPTURE_STATUS_R, c_int32)[1]
|
||||
if bulk_status == TSI_BULK_STATUS_IDLE and prev_status == TSI_BULK_STATUS_TRANSFERRING:
|
||||
bulk_status = self.__io.get(ci.TSI_BULK_CAPTURE_STATUS_R, c_int32)[1]
|
||||
if bulk_status == ci.TSI_BULK_STATUS_IDLE and prev_status == ci.TSI_BULK_STATUS_TRANSFERRING:
|
||||
return buffer
|
||||
prev_status = bulk_status
|
||||
|
||||
@@ -538,12 +547,12 @@ class Capturer:
|
||||
if not self.__check_available_bulk_data(TIMEOUT):
|
||||
return buffer
|
||||
|
||||
self.__io.set(TSI_EVCAP_CTRL, 0)
|
||||
self.__io.set(ci.TSI_EVCAP_CTRL, 0)
|
||||
cap_data = CapturedData()
|
||||
cap_data.type = CapturedDataType.Bulk
|
||||
result, data, _ = self.__io.get(TSI_BULK_CAPTURE_DATA_R, c_ubyte, 1024 * 1024)
|
||||
result, data, _ = self.__io.get(ci.TSI_BULK_CAPTURE_DATA_R, c_ubyte, 1024 * 1024)
|
||||
cap_data.data = bytearray(data)
|
||||
if result >= TSI_SUCCESS and len(cap_data.data) > 0:
|
||||
if result >= ci.TSI_SUCCESS and len(cap_data.data) > 0:
|
||||
buffer.append(cap_data)
|
||||
last_bulk_capture_time = time.time()
|
||||
|
||||
|
||||
@@ -1996,40 +1996,6 @@
|
||||
"minValue": 0,
|
||||
"name": "Maximum refresh rate for supported Adaptive-Sync video timings, in Hz.",
|
||||
"type": 4
|
||||
},
|
||||
{
|
||||
"configId": "0x10e000d",
|
||||
"defaultValue": "0",
|
||||
"description": "Reserved for extension.",
|
||||
"bitList":
|
||||
[
|
||||
{"description": "0x10e000d", "defaultValue": "0"},
|
||||
{"description": "0x10e000f", "defaultValue": "0"},
|
||||
{"description": "0x10e001c", "defaultValue": "0"},
|
||||
{"description": "0x10e001d", "defaultValue": "0"},
|
||||
{"description": "0x10e001e", "defaultValue": "0"},
|
||||
{"description": "0x10e001f", "defaultValue": "0"},
|
||||
{"description": "0x10e002f", "defaultValue": "0"},
|
||||
{"description": "0x10e0030", "defaultValue": "0"},
|
||||
{"description": "0x10e0031", "defaultValue": "0"},
|
||||
{"description": "0x10e0032", "defaultValue": "0"},
|
||||
{"description": "0x10e0033", "defaultValue": "0"},
|
||||
{"description": "0x10e0034", "defaultValue": "0"},
|
||||
{"description": "0x10e0035", "defaultValue": "0"},
|
||||
{"description": "0x10e0036", "defaultValue": "0"},
|
||||
{"description": "0x10e0037", "defaultValue": "0"},
|
||||
{"description": "0x10e00b7", "defaultValue": "0"},
|
||||
{"description": "0x10e00b8", "defaultValue": "0"},
|
||||
{"description": "0x10e00b9", "defaultValue": "0"},
|
||||
{"description": "0x10e00ba", "defaultValue": "0"},
|
||||
{"description": "0x10e00bb", "defaultValue": "0"},
|
||||
{"description": "0x10e00bc", "defaultValue": "0"},
|
||||
{"description": "0x10e00bd", "defaultValue": "0"},
|
||||
{"description": "0x10e00be", "defaultValue": "0"}
|
||||
],
|
||||
"flag": 3,
|
||||
"id": "RESERVED",
|
||||
"type": 4
|
||||
}
|
||||
],
|
||||
"id": "0x03",
|
||||
|
||||
@@ -67,20 +67,6 @@
|
||||
"minValue": 0,
|
||||
"name": "Delay between test cycles, in milliseconds",
|
||||
"type": 4
|
||||
},
|
||||
{
|
||||
"configId": "0x10703",
|
||||
"defaultValue": "0",
|
||||
"description": "Reserved for DUT Capabilities flags and DUT Test automation capabilities flags.",
|
||||
"bitList":
|
||||
[
|
||||
{"description": "0x10703", "defaultValue": "0"},
|
||||
{"description": "0x10704", "defaultValue": "0"}
|
||||
],
|
||||
"flag": 3,
|
||||
"id": "RESERVED",
|
||||
"name": "Reserved",
|
||||
"type": 4
|
||||
}
|
||||
],
|
||||
"id": "0x04",
|
||||
|
||||
@@ -65,7 +65,11 @@
|
||||
{"mask": "0x01000000", "description": "2x1 tiled display and DisplayID Tiled Display Topology data block supported"},
|
||||
{"mask": "0x02000000", "description": "Field sequential stereo and DisplayID Tiled Stereo Display Interface data block supported"},
|
||||
{"mask": "0x04000000", "description": "Stacked frame stereo and DisplayID Tiled Stereo Display Interface data block supported"},
|
||||
{"mask": "0x08000000", "description": "Dynamic Refresh Rate with VBlank stretch with MSA_TIMING_PAR_IGNORED supported"}
|
||||
{"mask": "0x08000000", "description": "Dynamic Refresh Rate with VBlank stretch with MSA_TIMING_PAR_IGNORED supported"},
|
||||
{"mask": "0x10000000", "description": "MST transmission supported"},
|
||||
{"mask": "0x20000000", "description": "MST UP_REQUEST supported"},
|
||||
{"mask": "0x40000000", "description": "MST RSN_REQUEST supported"},
|
||||
{"mask": "0x80000000", "description": "MST POWER_UP/DOWN_PHY supported"}
|
||||
],
|
||||
"flag": 3,
|
||||
"id": "TSI_DP20_SRCCTS_DUT_CAPS",
|
||||
@@ -211,6 +215,17 @@
|
||||
"name": "Debug mode configuration.",
|
||||
"type": 12
|
||||
},
|
||||
{
|
||||
"configId": "0x119000f",
|
||||
"defaultValue": "1028",
|
||||
"description": "Includes: Maximum stream count supported and Maximum daisy chain sink count supported.",
|
||||
"flag": 3,
|
||||
"id": "TSI_DP20_SRCCTS_DUT_MST_CAPS",
|
||||
"maxValue": 2147483647,
|
||||
"minValue": 0,
|
||||
"name": "MST source DUT capabilities.",
|
||||
"type": 4
|
||||
},
|
||||
{
|
||||
"configId": "0x1190010",
|
||||
"defaultValue": "32000",
|
||||
@@ -2598,39 +2613,6 @@
|
||||
"name": "Video mode supported by Source DUT (DP2.1 video & DSC tests)",
|
||||
"type": 4
|
||||
},
|
||||
{
|
||||
"configId": "0x119000f",
|
||||
"defaultValue": "0",
|
||||
"description": "Reserved for extension.",
|
||||
"bitList":
|
||||
[
|
||||
{"description": "0x119000f", "defaultValue": "0"},
|
||||
{"description": "0x119001c", "defaultValue": "0"},
|
||||
{"description": "0x119001d", "defaultValue": "0"},
|
||||
{"description": "0x119001e", "defaultValue": "0"},
|
||||
{"description": "0x119001f", "defaultValue": "0"},
|
||||
{"description": "0x119002f", "defaultValue": "0"},
|
||||
{"description": "0x1190030", "defaultValue": "0"},
|
||||
{"description": "0x1190031", "defaultValue": "0"},
|
||||
{"description": "0x1190032", "defaultValue": "0"},
|
||||
{"description": "0x1190033", "defaultValue": "0"},
|
||||
{"description": "0x1190034", "defaultValue": "0"},
|
||||
{"description": "0x1190035", "defaultValue": "0"},
|
||||
{"description": "0x1190036", "defaultValue": "0"},
|
||||
{"description": "0x1190037", "defaultValue": "0"},
|
||||
{"description": "0x11900b7", "defaultValue": "0"},
|
||||
{"description": "0x11900b8", "defaultValue": "0"},
|
||||
{"description": "0x11900b9", "defaultValue": "0"},
|
||||
{"description": "0x11900ba", "defaultValue": "0"},
|
||||
{"description": "0x11900bb", "defaultValue": "0"},
|
||||
{"description": "0x11900bc", "defaultValue": "0"},
|
||||
{"description": "0x11900bd", "defaultValue": "0"},
|
||||
{"description": "0x11900be", "defaultValue": "0"}
|
||||
],
|
||||
"flag": 3,
|
||||
"id": "RESERVED",
|
||||
"type": 4
|
||||
},
|
||||
{
|
||||
"configId": "0x11900f4",
|
||||
"defaultValue": "1920",
|
||||
|
||||
@@ -132,7 +132,7 @@
|
||||
],
|
||||
"flag": 1,
|
||||
"id": "TSI_HDMI_SNKCTS_DSC_VIDEO_FORMAT",
|
||||
"name": "DSC Video formats 1.",
|
||||
"name": "DSC Video formats 1",
|
||||
"type": 12
|
||||
},
|
||||
{
|
||||
@@ -174,7 +174,7 @@
|
||||
],
|
||||
"flag": 1,
|
||||
"id": "TSI_HDMI_SNKCTS_DSC_VIDEO_FORMAT_2",
|
||||
"name": "DSC Video formats 2.",
|
||||
"name": "DSC Video formats 2",
|
||||
"type": 12
|
||||
},
|
||||
{
|
||||
@@ -197,7 +197,7 @@
|
||||
"id": "TSI_HDMI_SNKCTS_DSC_TOTAL_CHUNK_BYTES",
|
||||
"maxValue": 2147483647,
|
||||
"minValue": 0,
|
||||
"name": "DSC Max Slices",
|
||||
"name": "DSC TotalChunkKBytes",
|
||||
"type": 4
|
||||
}
|
||||
],
|
||||
|
||||
@@ -1,66 +1,8 @@
|
||||
{
|
||||
"descriptions": [
|
||||
{
|
||||
"configId": "0x2100",
|
||||
"defaultValue": "0",
|
||||
"description": "Does the Sink support Fast Vactive (FVA), also known as Quick Frame Transport (QFT)?",
|
||||
"flag": 3,
|
||||
"id": "TSI_HDMI_GAMING_FVA",
|
||||
"maxValue": 1,
|
||||
"minValue": 0,
|
||||
"name": "Sink_Supports_FVA",
|
||||
"type": 3,
|
||||
"enumerationVariants": "0 # NO\n1 # YES"
|
||||
},
|
||||
{
|
||||
"configId": "0x2101",
|
||||
"defaultValue": "1",
|
||||
"description": "Does the Sink support Variable Refresh Rate (VRR)",
|
||||
"flag": 3,
|
||||
"id": "TSI_HDMI_GAMING_VRR",
|
||||
"maxValue": 1,
|
||||
"minValue": 0,
|
||||
"name": "Sink_Supports_VRR",
|
||||
"type": 3,
|
||||
"enumerationVariants": "0 # NO\n1 # YES"
|
||||
},
|
||||
{
|
||||
"configId": "0x2102",
|
||||
"defaultValue": "0",
|
||||
"description": "Does the Sink support Negative Mvrr values?",
|
||||
"flag": 3,
|
||||
"id": "TSI_HDMI_GAMING_NMVRR",
|
||||
"maxValue": 1,
|
||||
"minValue": 0,
|
||||
"name": "Sink_Supports_Negative_MVRR",
|
||||
"type": 3,
|
||||
"enumerationVariants": "0 # NO\n1 # YES"
|
||||
},
|
||||
{
|
||||
"configId": "0x2103",
|
||||
"defaultValue": "40",
|
||||
"description": "What is the Sink’s supported VRR Range? Minimum value.\n",
|
||||
"flag": 3,
|
||||
"id": "TSI_HDMI_GAMING_RANGE_MIN",
|
||||
"maxValue": 480,
|
||||
"minValue": 20,
|
||||
"name": "Sink_Supported_VRR_Range VRRMIN",
|
||||
"type": 4
|
||||
},
|
||||
{
|
||||
"configId": "0x2104",
|
||||
"defaultValue": "0",
|
||||
"description": "What is the Sink’s supported VRR Range? Maximum value or BRR\n",
|
||||
"flag": 3,
|
||||
"id": "TSI_HDMI_GAMING_RANGE_MAX",
|
||||
"maxValue": 480,
|
||||
"minValue": 20,
|
||||
"name": "Sink_Supported_VRR_Range VRRMAX or 0 for BRR",
|
||||
"type": 4
|
||||
},
|
||||
{
|
||||
"configId": "0x2105",
|
||||
"defaultValue": "0",
|
||||
"defaultValue": "1",
|
||||
"description": "Does the Sink implement Auto Low-Latency Mode (ALLM)?",
|
||||
"flag": 3,
|
||||
"id": "TSI_HDMI_GAMING_ALLM",
|
||||
@@ -72,32 +14,28 @@
|
||||
},
|
||||
{
|
||||
"configId": "0x2106",
|
||||
"defaultValue": "0",
|
||||
"defaultValue": "Cinema",
|
||||
"description": "Which display processing mode is the preferred mode with normal latency?",
|
||||
"flag": 3,
|
||||
"id": "TSI_HDMI_GAMING_NLM",
|
||||
"maxValue": 2,
|
||||
"minValue": 0,
|
||||
"name": "Sink_Preferred_NLM",
|
||||
"type": 4,
|
||||
"enumerationVariants": "0 # Cinema\n1 # Vivid\n2 # Normal"
|
||||
"type": 2,
|
||||
"maxLength": 256
|
||||
},
|
||||
{
|
||||
"configId": "0x2107",
|
||||
"defaultValue": "0",
|
||||
"defaultValue": "Gaming",
|
||||
"description": "Which display processing mode is the preferred mode to minimize latency?",
|
||||
"flag": 3,
|
||||
"id": "TSI_HDMI_GAMING_LLM",
|
||||
"maxValue": 1,
|
||||
"minValue": 0,
|
||||
"name": "Sink_Preferred_LLM",
|
||||
"type": 4,
|
||||
"enumerationVariants": "0 # Game\n1 # PC"
|
||||
"type": 2,
|
||||
"maxLength": 256
|
||||
},
|
||||
{
|
||||
{
|
||||
"configId": "0x2108",
|
||||
"defaultValue": "1",
|
||||
"description": "Does the Sink DUT support QMS-VRR?",
|
||||
"description": "Does the Sink supports QMS-VRR?",
|
||||
"flag": 3,
|
||||
"id": "TSI_HDMI_GAMING_QMS",
|
||||
"maxValue": 1,
|
||||
@@ -106,29 +44,59 @@
|
||||
"type": 3,
|
||||
"enumerationVariants": "0 # NO\n1 # YES"
|
||||
},
|
||||
{
|
||||
"configId": "0x2109",
|
||||
"defaultValue": "97",
|
||||
"description": "What is the highest resolution (i.e., width x height) and base refresh rate (BRR) for which all TFRs up to Sink_QMS_Max_TFR_TMDS are supported by the Sink using TMDS?",
|
||||
{
|
||||
"configId": "0x2101",
|
||||
"defaultValue": "1",
|
||||
"description": "Does the Sink supports VRR?",
|
||||
"flag": 3,
|
||||
"id": "TSI_HDMI_GAMING_VIDEO_TMDS",
|
||||
"maxValue": 255,
|
||||
"minValue": 16,
|
||||
"name": "Sink_QMS_Video_Format_TMDS",
|
||||
"type": 4,
|
||||
"enumerationVariants": "78 # VIC=78; 1920x1080@120\n97 # VIC=97; 3840x2160@60"
|
||||
"id": "TSI_HDMI_GAMING_VRR",
|
||||
"maxValue": 1,
|
||||
"minValue": 0,
|
||||
"name": "Sink_Supports_VRR",
|
||||
"type": 3,
|
||||
"enumerationVariants": "0 # NO\n1 # YES"
|
||||
},
|
||||
{
|
||||
"configId": "0x2103",
|
||||
"defaultValue": "0",
|
||||
"description": "What is the Sink's supported VRR Range?",
|
||||
"bitList": [
|
||||
{
|
||||
"mask": "0xFFFF",
|
||||
"description": "VRR min"
|
||||
},
|
||||
{
|
||||
"mask": "0xFFFF0000",
|
||||
"description": "VRR max (0 for BRR)"
|
||||
}
|
||||
],
|
||||
"flag": 12,
|
||||
"id": "TSI_HDMI_GAMING_VRR_RANGE",
|
||||
"name": "Sink_Supported_VRR_Range",
|
||||
"type": 12
|
||||
},
|
||||
{
|
||||
"configId": "0x210A",
|
||||
"defaultValue": "118",
|
||||
"description": "What is the highest resolution (i.e., width x height) and base refresh rate (BRR) for which all TFRs up to Sink_QMS_Max_TFR_FRL are supported by the Sink using FRL?",
|
||||
"flag": 3,
|
||||
"defaultValue": "0x0003c0043800780",
|
||||
"description": "What is the highest resolution (i.e., width x height) and base refresh rate (BRR) for which all TFRs up to Sink_QMS_Max_TFR_FRL are supported by the Sink using TMDS?",
|
||||
"bitList": [
|
||||
{
|
||||
"mask": "0xFFFFF",
|
||||
"description": "Width"
|
||||
},
|
||||
{
|
||||
"mask": "0xFFFFF00000",
|
||||
"description": "Height"
|
||||
},
|
||||
{
|
||||
"mask": "0xFFFFF0000000000",
|
||||
"description": "BRR"
|
||||
}
|
||||
],
|
||||
"flag": 12,
|
||||
"id": "TSI_HDMI_GAMING_VIDEO_FRL",
|
||||
"maxValue": 255,
|
||||
"minValue": 16,
|
||||
"name": "Sink_QMS_Video_Format_FRL",
|
||||
"type": 4,
|
||||
"enumerationVariants": "0 # N/A\n78 # VIC=78; 1920x1080@120\n97 # VIC=97; 3840x2160@60\n118 # VIC=118; 3840x2160@120"
|
||||
"type": 13
|
||||
},
|
||||
{
|
||||
"configId": "0x210B",
|
||||
@@ -140,11 +108,11 @@
|
||||
"minValue": 0,
|
||||
"name": "Sink_QMS_Min_TFR",
|
||||
"type": 4,
|
||||
"enumerationVariants": "0 # N/A\n1 # TFR=1; 24/1.001\n2 # TFR=2; 24\n3 # TFR=3; 25\n4 # TFR=4; 30/1.001\n5 # TFR=5; 30\n6 # TFR=6; 48/1.001\n7 # TFR=7; 48\n8 # TFR=8; 50\n9 # TFR=9; 60/1.001\n10 # TFR=10; 60\n11 # TFR=11; 100\n12 # TFR=12; 120/1.001\n13 # TFR=13; 120"
|
||||
"enumerationVariants": "0 # N/A\n1 # 1 - 24/1.001\n2 # 2 - 24\n3 # 3 - 25\n4 # 4 - 30/1.001\n5 # 5 - 30\n6 # 6 - 48/1.001\n7 # 7 - 48\n8 # 8 - 50\n9 # 9 - 60/1.001\n10 # 10 - 60\n11 # 11 - 100\n12 # 12 - 120/1.001\n13 # 13 - 120"
|
||||
},
|
||||
{
|
||||
"configId": "0x210C",
|
||||
"defaultValue": "10",
|
||||
"defaultValue": "6",
|
||||
"description": "If the Sink DUT supports QMS-VRR, what is the maximum Next_TFR value supported using TMDS? (Refer to the Next_TFR field definition in HDMI 2.1a Table 10-37.)",
|
||||
"flag": 3,
|
||||
"id": "TSI_HDMI_GAMING_MAX_TFR_TMDS",
|
||||
@@ -152,11 +120,11 @@
|
||||
"minValue": 0,
|
||||
"name": "Sink_QMS_Max_TFR_TMDS",
|
||||
"type": 4,
|
||||
"enumerationVariants": "0 # N/A\n1 # TFR=1; 24/1.001\n2 # TFR=2; 24\n3 # TFR=3; 25\n4 # TFR=4; 30/1.001\n5 # TFR=5; 30\n6 # TFR=6; 48/1.001\n7 # TFR=7; 48\n8 # TFR=8; 50\n9 # TFR=9; 60/1.001\n10 # TFR=10; 60\n11 # TFR=11; 100\n12 # TFR=12; 120/1.001\n13 # TFR=13; 120"
|
||||
"enumerationVariants": "0 # N/A\n1 # 1 - 24/1.001\n2 # 2 - 24\n3 # 3 - 25\n4 # 4 - 30/1.001\n5 # 5 - 30\n6 # 6 - 48/1.001\n7 # 7 - 48\n8 # 8 - 50\n9 # 9 - 60/1.001\n10 # 10 - 60\n11 # 11 - 100\n12 # 12 - 120/1.001\n13 # 13 - 120"
|
||||
},
|
||||
{
|
||||
"configId": "0x210D",
|
||||
"defaultValue": "13",
|
||||
"defaultValue": "8",
|
||||
"description": "If the Sink DUT supports QMS-VRR, what is the maximum Next_TFR value supported using FRL? (Refer to the Next_TFR field definition in HDMI 2.1a Table 10-37.)",
|
||||
"flag": 3,
|
||||
"id": "TSI_HDMI_GAMING_MAX_TFR_FRL",
|
||||
@@ -164,9 +132,44 @@
|
||||
"minValue": 0,
|
||||
"name": "Sink_QMS_Max_TFR_FRL",
|
||||
"type": 4,
|
||||
"enumerationVariants": "0 # N/A\n1 # TFR=1; 24/1.001\n2 # TFR=2; 24\n3 # TFR=3; 25\n4 # TFR=4; 30/1.001\n5 # TFR=5; 30\n6 # TFR=6; 48/1.001\n7 # TFR=7; 48\n8 # TFR=8; 50\n9 # TFR=9; 60/1.001\n10 # TFR=10; 60\n11 # TFR=11; 100\n12 # TFR=12; 120/1.001\n13 # TFR=13; 120"
|
||||
"enumerationVariants": "0 # N/A\n1 # 1 - 24/1.001\n2 # 2 - 24\n3 # 3 - 25\n4 # 4 - 30/1.001\n5 # 5 - 30\n6 # 6 - 48/1.001\n7 # 7 - 48\n8 # 8 - 50\n9 # 9 - 60/1.001\n10 # 10 - 60\n11 # 11 - 100\n12 # 12 - 120/1.001\n13 # 13 - 120"
|
||||
},
|
||||
{
|
||||
"configId": "0x210E",
|
||||
"defaultValue": "1",
|
||||
"description": "What is the maximum FRL Rate that the product supports? (Set to 0 if the product does not support FRL reception.)",
|
||||
"flag": 3,
|
||||
"id": "TSI_HDMI_GAMING_MAX_FRL",
|
||||
"maxValue": 6,
|
||||
"minValue": 0,
|
||||
"name": "Sink_Max_FRL_Rate",
|
||||
"type": 4,
|
||||
"enumerationVariants": "0 # N/A\n1 # 1\n2 # 2\n3 # 3\n4 # 4\n5 # 5\n6 # 6"
|
||||
},
|
||||
{
|
||||
"configId": "0x210F",
|
||||
"defaultValue": "0x0003c0043800780",
|
||||
"description": "What is the highest resolution (i.e., width x height) and base refresh rate (BRR) for which all TFRs up to Sink_QMS_Max_TFR_TMDS are supported by the Sink using TMDS?",
|
||||
"bitList": [
|
||||
{
|
||||
"mask": "0xFFFFF",
|
||||
"description": "Width"
|
||||
},
|
||||
{
|
||||
"mask": "0xFFFFF00000",
|
||||
"description": "Height"
|
||||
},
|
||||
{
|
||||
"mask": "0xFFFFF0000000000",
|
||||
"description": "BRR"
|
||||
}
|
||||
],
|
||||
"flag": 12,
|
||||
"id": "TSI_HDMI_GAMING_VIDEO_TMDS",
|
||||
"name": "Sink_QMS_Video_Format_TMDS",
|
||||
"type": 13
|
||||
}
|
||||
],
|
||||
"id": "0x23",
|
||||
"name": "HDMI CTS MOI (VRR-QMS)"
|
||||
"name": "HDMI CTS MOI Gaming Features"
|
||||
}
|
||||
|
||||
197
UniTAP/dev/modules/dut_tests/cfg/[0x2D]src_dut_timings.json
Normal file
197
UniTAP/dev/modules/dut_tests/cfg/[0x2D]src_dut_timings.json
Normal file
@@ -0,0 +1,197 @@
|
||||
{
|
||||
"descriptions": [
|
||||
{
|
||||
"configId": "0x01260000",
|
||||
"defaultValue": "10000",
|
||||
"description": "Defines timeout for all Timings video tests, in milliseconds. Default setting is 10000ms.\n",
|
||||
"flag": 3,
|
||||
"id": "TSI_TIMINGS_TIMEOUT",
|
||||
"maxValue": 2147483647,
|
||||
"minValue": 0,
|
||||
"name": "Test timeout, in milliseconds",
|
||||
"type": 4
|
||||
},
|
||||
{
|
||||
"configId": "0x01260001",
|
||||
"defaultValue": "200",
|
||||
"description": "Total number of frames to be tested. After timings check for total number of frames test will be completed. If total number is equal to 0, then test will be executing up to test timeout. Default setting is 200.\n",
|
||||
"flag": 3,
|
||||
"id": "TSI_TIMINGS_FRAMES_TO_TEST",
|
||||
"maxValue": 2147483647,
|
||||
"minValue": 0,
|
||||
"name": "Test duration, in frames",
|
||||
"type": 4
|
||||
},
|
||||
{
|
||||
"configId": "0x01260002",
|
||||
"defaultValue": "2",
|
||||
"description": "Number of bad frames allowed in test. Default setting is 2\n",
|
||||
"flag": 3,
|
||||
"id": "TSI_TIMINGS_LIM_FRAME_MISMATCHES",
|
||||
"maxValue": 2147483647,
|
||||
"minValue": 0,
|
||||
"name": "Allowed mismatches, in frames",
|
||||
"type": 4
|
||||
},
|
||||
{
|
||||
"configId": "0x01260003",
|
||||
"defaultValue": "24",
|
||||
"description": "Defines the color depth as bits per pixel. If the input video color depth does not match this setting, the test will fail. Default setting is 24.\n",
|
||||
"enumerationVariants": "12\n15\n16\n18\n20\n21\n24\n30\n32\n36\n48",
|
||||
"flag": 3,
|
||||
"id": "TSI_TIMINGS_REF_COLORDEPTH",
|
||||
"maxValue": 2147480000,
|
||||
"minValue": 0,
|
||||
"name": "Expected color depth, as bits per pixel",
|
||||
"type": 4
|
||||
},
|
||||
{
|
||||
"configId": "0x01260004",
|
||||
"defaultValue": "0",
|
||||
"description": "Defines the required frame rate for timings test, in millihertz. Setting of zero (0) disables the frame-rate requirement. Default setting is 0.\n",
|
||||
"flag": 3,
|
||||
"id": "TSI_TIMINGS_REQUIRED_FRAME_RATE",
|
||||
"maxValue": 2147483647,
|
||||
"minValue": 0,
|
||||
"name": "Expected frame rate, in millihertz (mHz)",
|
||||
"type": 4
|
||||
},
|
||||
{
|
||||
"configId": "0x01260005",
|
||||
"defaultValue": "0",
|
||||
"description": "Defines the maximum allowed deviation of input frame-rate from the required frame rate (TSI_TIMINGS_REQUIRED_FRAME_RATE), in millihertz. When this setting is non-zero, it defines the range of allowed frame rate as requirements ± tolerance. If the frame-rate requirement is set to zero, this setting has no effect. Default setting is 0 mHz.\n",
|
||||
"flag": 3,
|
||||
"id": "TSI_TIMINGS_FRAME_RATE_TOLERANCE",
|
||||
"maxValue": 2147483647,
|
||||
"minValue": 0,
|
||||
"name": "Frame rate tolerance, in millihertz (mHz)",
|
||||
"type": 4
|
||||
},
|
||||
{
|
||||
"configId": "0x01260006",
|
||||
"defaultValue": "2200",
|
||||
"description": "Defined the expected video width, in pixels. If the video being received does not match this setting, the test will fail. Default setting is 1920.\n",
|
||||
"flag": 3,
|
||||
"id": "TSI_TIMINGS_REF_HTOTAL",
|
||||
"maxValue": 2147483647,
|
||||
"minValue": 0,
|
||||
"name": "Expected video width, in pixels",
|
||||
"type": 4
|
||||
},
|
||||
{
|
||||
"configId": "0x01260007",
|
||||
"defaultValue": "1125",
|
||||
"description": "Defined the expected total video height, in pixels. If the video being received does not match this setting, the test will fail. Default setting is 1080.\n",
|
||||
"flag": 3,
|
||||
"id": "TSI_TIMINGS_REF_VTOTAL",
|
||||
"maxValue": 2147483647,
|
||||
"minValue": 0,
|
||||
"name": "Expected total video height, in pixels",
|
||||
"type": 4
|
||||
},
|
||||
{
|
||||
"configId": "0x01260008",
|
||||
"defaultValue": "1920",
|
||||
"description": "Defined the expected active video width, in pixels. If the video being received does not match this setting, the test will fail. Default setting is 1920.\n",
|
||||
"flag": 3,
|
||||
"id": "TSI_TIMINGS_REF_HACTIVE",
|
||||
"maxValue": 2147483647,
|
||||
"minValue": 0,
|
||||
"name": "Expected active video width, in pixels",
|
||||
"type": 4
|
||||
},
|
||||
{
|
||||
"configId": "0x01260009",
|
||||
"defaultValue": "1080",
|
||||
"description": "Defined the expected active video height, in pixels. If the video being received does not match this setting, the test will fail. Default setting is 1080.\n",
|
||||
"flag": 3,
|
||||
"id": "TSI_TIMINGS_REF_VACTIVE",
|
||||
"maxValue": 2147483647,
|
||||
"minValue": 0,
|
||||
"name": "Expected active video height, in pixels",
|
||||
"type": 4
|
||||
},
|
||||
{
|
||||
"configId": "0x0126000a",
|
||||
"defaultValue": "88",
|
||||
"description": "Defined the expected horizontal front porch, in pixels. If the video being received does not match this setting, the test will fail. Default setting is 1920.\n",
|
||||
"flag": 3,
|
||||
"id": "TSI_TIMINGS_REF_HFRONT",
|
||||
"maxValue": 2147483647,
|
||||
"minValue": 0,
|
||||
"name": "Expected horizontal front porch, in pixels",
|
||||
"type": 4
|
||||
},
|
||||
{
|
||||
"configId": "0x0126000b",
|
||||
"defaultValue": "4",
|
||||
"description": "Defined the expected vertical front porch, in pixels. If the video being received does not match this setting, the test will fail. Default setting is 1080.\n",
|
||||
"flag": 3,
|
||||
"id": "TSI_TIMINGS_REF_VFRONT",
|
||||
"maxValue": 2147483647,
|
||||
"minValue": 0,
|
||||
"name": "Expected vertical front porch, in pixels",
|
||||
"type": 4
|
||||
},
|
||||
{
|
||||
"configId": "0x0126000c",
|
||||
"defaultValue": "44",
|
||||
"description": "Defined the expected horizontal sync interval, in pixels. If the video being received does not match this setting, the test will fail. Default setting is 1920.\n",
|
||||
"flag": 3,
|
||||
"id": "TSI_TIMINGS_REF_HSYNC",
|
||||
"maxValue": 2147483647,
|
||||
"minValue": 0,
|
||||
"name": "Expected horizontal sync interval, in pixels",
|
||||
"type": 4
|
||||
},
|
||||
{
|
||||
"configId": "0x0126000d",
|
||||
"defaultValue": "5",
|
||||
"description": "Defined the expected vertical sync interval, in pixels. If the video being received does not match this setting, the test will fail. Default setting is 1080.\n",
|
||||
"flag": 3,
|
||||
"id": "TSI_TIMINGS_REF_VSYNC",
|
||||
"maxValue": 2147483647,
|
||||
"minValue": 0,
|
||||
"name": "Expected vertical sync interval, in pixels",
|
||||
"type": 4
|
||||
},
|
||||
{
|
||||
"configId": "0x0126000e",
|
||||
"defaultValue": "0",
|
||||
"description": "Data transfer timeout in milliseconds. Default setting is 0.\n",
|
||||
"flag": 3,
|
||||
"id": "TSI_TIMINGS_DATA_TRANSFER_TIMEOUT",
|
||||
"maxValue": 2147483647,
|
||||
"minValue": 0,
|
||||
"name": "Data transfer timeout.",
|
||||
"type": 4
|
||||
},
|
||||
{
|
||||
"configId": "0x01260021",
|
||||
"defaultValue": "",
|
||||
"description": "Contains the full path to the folder where failed frames are to be saved without trailing backslash (‘\\’). No default. Failed frame file-name will be “Failed_<#>.ppm”, where <#> is replaced with an auto-incremented number.",
|
||||
"flag": 3,
|
||||
"id": "TSI_FAILED_FRAME_TARGET_FOLDER",
|
||||
"maxLength": 10000,
|
||||
"name": "Location where the failed frames are to be saved",
|
||||
"type": 11
|
||||
},
|
||||
{
|
||||
"configId": "0x01260022",
|
||||
"defaultValue": "0",
|
||||
"description": "Defines the number of failed frames to be exported from the video test. Default setting is 0. If the setting is 0, no frames are exported.",
|
||||
"flag": 3,
|
||||
"id": "TSI_MAX_EXPORT_FAILED",
|
||||
"maxValue": 2147483647,
|
||||
"minValue": 0,
|
||||
"name": "Maximum number of exported frames",
|
||||
"type": 4
|
||||
}
|
||||
],
|
||||
"id": "0x2d",
|
||||
"name": "Timings Video Tests",
|
||||
"shortName": "Timings Video Tests",
|
||||
"old_names": [
|
||||
"Timings Video Test Set"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"descriptions": [
|
||||
{
|
||||
"configId": "0x1270000",
|
||||
"defaultValue": "5000",
|
||||
"description": "Defines test timeout in milliseconds, default value is 5000ms.",
|
||||
"flag": 3,
|
||||
"id": "TSI_DP20_MST_BRANCH_TIMEOUT",
|
||||
"maxValue": 2147483647,
|
||||
"minValue": 0,
|
||||
"name": "Test timeout in milliseconds.",
|
||||
"reportFormat": "Test timeout = %2ms<br>",
|
||||
"type": 4
|
||||
},
|
||||
{
|
||||
"configId": "0x1270001",
|
||||
"defaultValue": "0x00000000",
|
||||
"description": "Defines the DUT capabilities as flags.",
|
||||
"bitList":
|
||||
[
|
||||
{"mask": "0x00000001", "description": "DUT supports CSN DFP broadcast", "reportFormat": "- DUT is Type-C device<br>"}
|
||||
],
|
||||
"flag": 3,
|
||||
"id": "TSI_DP20_MST_BRANCH_DUT_CAPS",
|
||||
"name": "DUT Capability flags.",
|
||||
"reportFormat": "Test DUT capabilities flags:<br>",
|
||||
"type": 12
|
||||
},
|
||||
{
|
||||
"configId": "0x1270002",
|
||||
"defaultValue": "0x00000010",
|
||||
"description": "Defines the numbers of DUT UFP and DFP ports connected to TE.",
|
||||
"bitList":
|
||||
[
|
||||
{"mask": "0x0000000f", "description": "DUT UFP port connected to TE"},
|
||||
{"mask": "0x000000f0", "description": "DUT DFP port connected to TE"}
|
||||
],
|
||||
"flag": 3,
|
||||
"id": "TSI_DP20_MST_BRANCH_DUT_UFP_DFP_PORTS",
|
||||
"name": "DUT UFP and DFP ports connected to TE",
|
||||
"reportFormat": "DUT UFP and DFP ports connected to TE:<br>",
|
||||
"type": 12
|
||||
},
|
||||
{
|
||||
"configId": "0x1270003",
|
||||
"defaultValue": "0x00005432",
|
||||
"description": "Defines the numbers of DUT DFP ports connected to external sinks.",
|
||||
"bitList":
|
||||
[
|
||||
{"mask": "0x0000000f", "description": "DUT DFP port connected to Sink 1"},
|
||||
{"mask": "0x000000f0", "description": "DUT DFP port connected to Sink 2"},
|
||||
{"mask": "0x00000f00", "description": "DUT DFP port connected to Sink 3"},
|
||||
{"mask": "0x0000f000", "description": "DUT DFP port connected to Sink 4"}
|
||||
],
|
||||
"flag": 3,
|
||||
"id": "TSI_DP20_MST_BRANCH_DUT_SINK_PORTS",
|
||||
"name": "DUT DFP ports connected to external sinks",
|
||||
"reportFormat": "DUT DFP ports connected to external sinks:<br>",
|
||||
"type": 12
|
||||
}
|
||||
],
|
||||
"id": "0x2E",
|
||||
"name": "DP 2.1 MST Branch CTS",
|
||||
"old_names": [
|
||||
"DP 2.1 MST Branch CTS"
|
||||
]
|
||||
}
|
||||
@@ -26,6 +26,13 @@ from .hdmi_sink_tests import HdmiSinkDUTTestParam, HdmiTestMode, HdmiFrlRate
|
||||
from .hdmi_source_tests import HdmiSourceDUTTestParam
|
||||
from .hdmi_sink_continuity_tests import HdmiSinkContinuityDUTTestParam
|
||||
from .hdmi_sink_cable_check_tests import HdmiSinkCableCheckTestParam
|
||||
from .hdmi_hdcp_1a_tests import HdmiHdcp1ATestParam
|
||||
from .hdmi_hdcp_1b_tests import HdmiHdcp1BTestParam
|
||||
from .hdmi_hdcp_2c_tests import HdmiHdcp2CTestParam
|
||||
from .hdmi_hdcp_3a_tests import HdmiHdcp3ATestParam
|
||||
from .hdmi_hdcp_3b_tests import HdmiHdcp3BTestParam
|
||||
from .hdmi_hdcp_3c_tests import HdmiHdcp3CTestParam
|
||||
from .dp_2_1_branch_mst import Dp21BranchMSTSourceDUTTestParam
|
||||
from ..test_group_params_types import Param, get_param_list
|
||||
|
||||
DUTTestParameters = TypeVar("DUTTestParameters",
|
||||
@@ -53,4 +60,12 @@ DUTTestParameters = TypeVar("DUTTestParameters",
|
||||
Hdr10TestParam,
|
||||
HdmiSinkDUTTestParam,
|
||||
HdmiSinkContinuityDUTTestParam,
|
||||
HdmiSinkCableCheckTestParam)
|
||||
HdmiSinkCableCheckTestParam,
|
||||
HdmiHdcp1ATestParam,
|
||||
HdmiHdcp1BTestParam,
|
||||
HdmiHdcp2CTestParam,
|
||||
HdmiHdcp3ATestParam,
|
||||
HdmiHdcp3BTestParam,
|
||||
HdmiHdcp3CTestParam,
|
||||
Dp21BranchMSTSourceDUTTestParam
|
||||
)
|
||||
|
||||
@@ -4,6 +4,7 @@ from UniTAP.dev.modules.dut_tests.dut_default_params.dp_source_adaptive_sync_tab
|
||||
from UniTAP.dev.modules.dut_tests.dut_default_params.dp_2_1_video_modes import Dp21AvailableVideoModes
|
||||
from UniTAP.dev.modules.dut_tests.dut_default_params.dp_2_1_dsc_video_modes import Dp21AvailableDscVideoModes
|
||||
from UniTAP.dev.modules.dut_tests.dut_default_params.dp_source_audio_tab import AudioSourceDp21SettingTab
|
||||
from UniTAP.dev.modules.dut_tests.dut_default_params.dp_2_1_mst import Dp21MstSettingsTab
|
||||
|
||||
|
||||
class Dp21SourceDUTTestParam:
|
||||
@@ -13,6 +14,7 @@ class Dp21SourceDUTTestParam:
|
||||
- Set and get `DisplayIdDp21ConfigTab`. Allows working with parameters from Display ID part `display_id`.
|
||||
- Set and get `AdaptiveSyncDp21ConfigTab`. Allows working with parameters from Adaptive-Sync part `adaptive_sync`.
|
||||
- Set and get `Dp21AvailableVideoModes`. Allows working with parameters from Video modes part `video_modes`.
|
||||
- Set and get `Dp21MstSettingsTab`. Allows working with parameters from MST part `mst`.
|
||||
"""
|
||||
def __init__(self, json_obj):
|
||||
self.__general_tab = GeneralSourceDUTDp21SettingTab(json_obj)
|
||||
@@ -21,6 +23,7 @@ class Dp21SourceDUTTestParam:
|
||||
self.__adaptive_sync_tab = AdaptiveSyncDp21ConfigTab(json_obj)
|
||||
self.__video_modes = Dp21AvailableVideoModes(json_obj)
|
||||
self.__dsc_video_modes = Dp21AvailableDscVideoModes(json_obj)
|
||||
self.__mst_tab = Dp21MstSettingsTab(json_obj)
|
||||
|
||||
@property
|
||||
def general(self) -> GeneralSourceDUTDp21SettingTab:
|
||||
@@ -81,3 +84,13 @@ class Dp21SourceDUTTestParam:
|
||||
object of `Dp21AvailableVideoModes` type
|
||||
"""
|
||||
return self.__dsc_video_modes
|
||||
|
||||
@property
|
||||
def mst(self) -> Dp21MstSettingsTab:
|
||||
"""
|
||||
Get object of parameters from Video modes source part.
|
||||
|
||||
Returns:
|
||||
object of `Dp21MstSettingsTab` type
|
||||
"""
|
||||
return self.__mst_tab
|
||||
|
||||
@@ -0,0 +1,210 @@
|
||||
from UniTAP.dev.modules.dut_tests.test_group_params_types import Param
|
||||
|
||||
|
||||
class DutCapsMSTBranchFlags:
|
||||
"""
|
||||
Class `DutCapsDp21Flags` defines the DUT capabilities as flags.
|
||||
|
||||
Setting:
|
||||
- DUT CSN DFP broadcast supported flag `support_csn_dfp_broadcast`.
|
||||
"""
|
||||
def __init__(self, json_obj):
|
||||
self.__value = Param(json_obj)
|
||||
|
||||
@property
|
||||
def support_csn_dfp_broadcast(self) -> bool:
|
||||
"""
|
||||
Set and get DUT CSN DFP broadcast flag support.
|
||||
|
||||
Returns:
|
||||
object of bool type
|
||||
"""
|
||||
return self.__value._get_by_bitmask(0, bool)
|
||||
|
||||
@support_csn_dfp_broadcast.setter
|
||||
def support_csn_dfp_broadcast(self, support_csn_dfp_broadcast: bool):
|
||||
self.__value._set_by_bitmask(support_csn_dfp_broadcast, 0)
|
||||
|
||||
|
||||
class PortsConnectedToTE:
|
||||
"""
|
||||
Class `PortsConnectedToTE` which defines the numbers of DUT UFP and DFP ports connected to TE.
|
||||
|
||||
Setting:
|
||||
- Number of DUT UFP ports connected to TE `ufp_ports`.
|
||||
- Number of DUT DFP ports connected to TE `dfp_ports`.
|
||||
"""
|
||||
def __init__(self, json_obj):
|
||||
self.__value = Param(json_obj)
|
||||
|
||||
@property
|
||||
def ufp_ports(self) -> int:
|
||||
"""
|
||||
Set and get number of DUT UFP ports connected to TE.
|
||||
|
||||
Returns:
|
||||
object of int type
|
||||
"""
|
||||
return self.__value._get_by_bitmask(0, int)
|
||||
|
||||
@ufp_ports.setter
|
||||
def ufp_ports(self, ufp_ports: int):
|
||||
self.__value._set_by_bitmask(ufp_ports, 0)
|
||||
|
||||
@property
|
||||
def dfp_ports(self) -> int:
|
||||
"""
|
||||
Set and get number of DUT DFP ports connected to TE.
|
||||
|
||||
Returns:
|
||||
object of int type
|
||||
"""
|
||||
return self.__value._get_by_bitmask(1, int)
|
||||
|
||||
@dfp_ports.setter
|
||||
def dfp_ports(self, dfp_ports: int):
|
||||
self.__value._set_by_bitmask(dfp_ports, 1)
|
||||
|
||||
|
||||
class PortsConnectedToExternalSink:
|
||||
"""
|
||||
Class `PortsConnectedToExternalSink` which defines the numbers of DUT DFP ports connected to external sinks.
|
||||
|
||||
Setting:
|
||||
- Number of DUT DFP ports connected to Sink 1 `sink_1`.
|
||||
- Number of DUT DFP ports connected to Sink 2 `sink_2`.
|
||||
- Number of DUT DFP ports connected to Sink 3 `sink_3`.
|
||||
- Number of DUT DFP ports connected to Sink 4 `sink_4`.
|
||||
"""
|
||||
def __init__(self, json_obj):
|
||||
self.__value = Param(json_obj)
|
||||
|
||||
@property
|
||||
def sink_1(self) -> int:
|
||||
"""
|
||||
Set and get number of DUT DFP ports connected to Sink 1.
|
||||
|
||||
Returns:
|
||||
object of int type
|
||||
"""
|
||||
return self.__value._get_by_bitmask(0, int)
|
||||
|
||||
@sink_1.setter
|
||||
def sink_1(self, ports_to_sink_1: int):
|
||||
self.__value._set_by_bitmask(ports_to_sink_1, 0)
|
||||
|
||||
@property
|
||||
def sink_2(self) -> int:
|
||||
"""
|
||||
Set and get number of DUT DFP ports connected to Sink 2.
|
||||
|
||||
Returns:
|
||||
object of int type
|
||||
"""
|
||||
return self.__value._get_by_bitmask(0, int)
|
||||
|
||||
@sink_2.setter
|
||||
def sink_2(self, ports_to_sink_2: int):
|
||||
self.__value._set_by_bitmask(ports_to_sink_2, 0)
|
||||
|
||||
@property
|
||||
def sink_3(self) -> int:
|
||||
"""
|
||||
Set and get number of DUT DFP ports connected to Sink 3.
|
||||
|
||||
Returns:
|
||||
object of int type
|
||||
"""
|
||||
return self.__value._get_by_bitmask(0, int)
|
||||
|
||||
@sink_3.setter
|
||||
def sink_3(self, ports_to_sink_3: int):
|
||||
self.__value._set_by_bitmask(ports_to_sink_3, 0)
|
||||
|
||||
@property
|
||||
def sink_4(self) -> int:
|
||||
"""
|
||||
Set and get number of DUT DFP ports connected to Sink 4.
|
||||
|
||||
Returns:
|
||||
object of int type
|
||||
"""
|
||||
return self.__value._get_by_bitmask(0, int)
|
||||
|
||||
@sink_4.setter
|
||||
def sink_4(self, ports_to_sink_1: int):
|
||||
self.__value._set_by_bitmask(ports_to_sink_1, 0)
|
||||
|
||||
|
||||
class Dp21BranchMSTSourceDUTTestParam:
|
||||
"""
|
||||
Class `Dp21BranchMSTSourceDUTTestParam` describes requirement parameters for DP 2.1 branch MST tests:
|
||||
- Set and get `timeout`. Describes test timeout, in milliseconds.
|
||||
- DUT MST Branch capabilities flags `dut_caps_flags` type `DutCapsMSTBranchFlags`.
|
||||
- DUT UFP and DFP ports connected to TE `ports_connect_to_te` type `PortsConnectedToTE`.
|
||||
- DUT DFP ports connected to external sinks `ports_connect_to_external_sink` type `PortsConnectedToExternalSink`
|
||||
"""
|
||||
def __init__(self, json_obj):
|
||||
self.__timeout = Param(json_obj["TSI_DP20_MST_BRANCH_TIMEOUT"])
|
||||
self.__dut_caps_flags = DutCapsMSTBranchFlags(json_obj["TSI_DP20_MST_BRANCH_DUT_CAPS"])
|
||||
self.__ports_connect_to_te = PortsConnectedToTE(json_obj["TSI_DP20_MST_BRANCH_DUT_UFP_DFP_PORTS"])
|
||||
self.__ports_connect_to_external_sink = PortsConnectedToExternalSink(json_obj["TSI_DP20_MST_BRANCH_DUT_SINK_PORTS"])
|
||||
|
||||
@property
|
||||
def timeout(self) -> int:
|
||||
"""
|
||||
Set and get test timeout, in milliseconds.
|
||||
|
||||
Returns:
|
||||
object of int type
|
||||
"""
|
||||
return self.__timeout.default_value
|
||||
|
||||
@timeout.setter
|
||||
def timeout(self, timeout: int):
|
||||
if not(self.__timeout.min_value < timeout < self.__timeout.max_value):
|
||||
raise ValueError(f"Timeout cannot be less than {self.__timeout.min_value} and more than "
|
||||
f"{self.__timeout.max_value}.")
|
||||
self.__timeout.default_value = timeout
|
||||
|
||||
@property
|
||||
def dut_caps_flags(self) -> DutCapsMSTBranchFlags:
|
||||
"""
|
||||
Set and get DUT capabilities flags.
|
||||
|
||||
Returns:
|
||||
object of `DutCapsMSTBranchFlags` type
|
||||
"""
|
||||
return self.__dut_caps_flags
|
||||
|
||||
@dut_caps_flags.setter
|
||||
def dut_caps_flags(self, dut_caps_flags: DutCapsMSTBranchFlags):
|
||||
self.__dut_caps_flags = dut_caps_flags
|
||||
|
||||
@property
|
||||
def ports_connect_to_te(self) -> PortsConnectedToTE:
|
||||
"""
|
||||
Set and get numbers DUT UFP and DFP ports connected to TE.
|
||||
|
||||
Returns:
|
||||
object of `PortsConnectedToTE` type
|
||||
"""
|
||||
return self.__ports_connect_to_te
|
||||
|
||||
@ports_connect_to_te.setter
|
||||
def ports_connect_to_te(self, ports_connect_to_te: PortsConnectedToTE):
|
||||
self.__ports_connect_to_te = ports_connect_to_te
|
||||
|
||||
@property
|
||||
def ports_connect_to_external_sink(self) -> PortsConnectedToExternalSink:
|
||||
"""
|
||||
Set and get numbers DUT UFP and DFP ports connected to External Sinks.
|
||||
|
||||
Returns:
|
||||
object of `PortsConnectedToExternalSink` type
|
||||
"""
|
||||
return self.__ports_connect_to_external_sink
|
||||
|
||||
@ports_connect_to_external_sink.setter
|
||||
def ports_connect_to_external_sink(self, ports_connect_to_external_sink: PortsConnectedToExternalSink):
|
||||
self.__ports_connect_to_external_sink = ports_connect_to_external_sink
|
||||
@@ -276,13 +276,11 @@ class VideoModeInfo:
|
||||
|
||||
def __init__(self, json_obj):
|
||||
self.__value = Param(json_obj)
|
||||
self.__standard = VideoModeStandard(self.__value)
|
||||
self.__colorimetry = ColorimetryModes(self.__value)
|
||||
|
||||
@property
|
||||
def standard(self) -> VideoModeStandard:
|
||||
return self.__standard
|
||||
return VideoModeStandard(self.__value)
|
||||
|
||||
@property
|
||||
def colorimetry(self) -> ColorimetryModes:
|
||||
return self.__colorimetry
|
||||
return ColorimetryModes(self.__value)
|
||||
|
||||
@@ -7,8 +7,6 @@ class Dp21AvailableDscVideoModes:
|
||||
- Set and get...
|
||||
"""
|
||||
def __init__(self, json_obj):
|
||||
self.__is_config_changed = False
|
||||
|
||||
self.__1920x1080_30hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_DSC_VMT_1920_1080_30"])
|
||||
self.__1920x1080_60hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_DSC_VMT_1920_1080_60"])
|
||||
self.__1920x1080_120hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_DSC_VMT_1920_1080_120"])
|
||||
@@ -30,12 +28,6 @@ class Dp21AvailableDscVideoModes:
|
||||
self.__10240x4320_30hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_DSC_VMT_10240_4320_30"])
|
||||
self.__10240x4320_60hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_DSC_VMT_10240_4320_60"])
|
||||
|
||||
def __getattribute__(self, name):
|
||||
attr = super().__getattribute__(name)
|
||||
if "vm_" in name or "_all" in name:
|
||||
self.__is_config_changed = True
|
||||
return attr
|
||||
|
||||
@property
|
||||
def vm_1920x1080_30hz(self) -> VideoModeInfo:
|
||||
return self.__1920x1080_30hz
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
from UniTAP.dev.modules.dut_tests.test_group_params_types import Param
|
||||
|
||||
|
||||
class Dp21MstSettingsTab:
|
||||
"""
|
||||
Class `Dp21MstSettingsTab` allows working with MST source DUT capabilities.
|
||||
- Set and get Maximum stream count
|
||||
- Set and get Maximum daisy chain sink count
|
||||
"""
|
||||
def __init__(self, json_obj):
|
||||
self.__max_stream_count = Param(json_obj["TSI_DP20_SRCCTS_DUT_MST_CAPS"])
|
||||
self.__max_daisy_chain_sink_count = Param(json_obj["TSI_DP20_SRCCTS_DUT_MST_CAPS"])
|
||||
|
||||
@property
|
||||
def max_stream_count(self) -> int:
|
||||
"""
|
||||
Set and get max stream count (1-4).
|
||||
|
||||
Returns:
|
||||
object of int type
|
||||
"""
|
||||
return self.__max_stream_count.default_value & 0xFF
|
||||
|
||||
@max_stream_count.setter
|
||||
def max_stream_count(self, max_stream_count: int):
|
||||
if not (self.__max_stream_count.min_value <= max_stream_count <= self.__max_stream_count.max_value):
|
||||
raise ValueError(f"Timeout cannot be less than {self.__max_stream_count.min_value} and more than "
|
||||
f"{self.__max_stream_count.max_value}.")
|
||||
self.__max_stream_count.direct_set_bits_value(0xFF, max_stream_count, 0)
|
||||
|
||||
@property
|
||||
def max_daisy_chain_sink_count(self) -> int:
|
||||
"""
|
||||
Set and get max daisy chain sink count (1-4).
|
||||
|
||||
Returns:
|
||||
object of int type
|
||||
"""
|
||||
return (self.__max_daisy_chain_sink_count.default_value >> 8) & 0xFF
|
||||
|
||||
@max_daisy_chain_sink_count.setter
|
||||
def max_daisy_chain_sink_count(self, max_daisy_chain_sink_count: int):
|
||||
if not (self.__max_stream_count.min_value <= max_daisy_chain_sink_count <= self.__max_stream_count.max_value):
|
||||
raise ValueError(f"Timeout cannot be less than {self.__max_daisy_chain_sink_count.min_value} and more than "
|
||||
f"{self.__max_daisy_chain_sink_count.max_value}.")
|
||||
self.__max_daisy_chain_sink_count.direct_set_bits_value(0xFF00, max_daisy_chain_sink_count, 8)
|
||||
@@ -114,7 +114,7 @@ class LinkRateDp21(Param):
|
||||
self._set_by_bitmask(support_13_5Gbps, 2)
|
||||
|
||||
|
||||
class DutCapsDp21Flags(Param):
|
||||
class DutCapsDp21Flags:
|
||||
"""
|
||||
Class `DutCapsDp21Flags` inherited of class`DutCapsFlags` which defines the DUT capabilities as flags and allows
|
||||
setting:
|
||||
@@ -123,7 +123,7 @@ class DutCapsDp21Flags(Param):
|
||||
Also has all the `DutCapsFlags` functionality.
|
||||
"""
|
||||
def __init__(self, json_obj):
|
||||
super().__init__(json_obj)
|
||||
self.__value = Param(json_obj)
|
||||
|
||||
@property
|
||||
def voltage_swing_supported(self) -> bool:
|
||||
@@ -133,11 +133,11 @@ class DutCapsDp21Flags(Param):
|
||||
Returns:
|
||||
object of bool type
|
||||
"""
|
||||
return self._get_by_bitmask(0, bool)
|
||||
return self.__value._get_by_bitmask(0, bool)
|
||||
|
||||
@voltage_swing_supported.setter
|
||||
def voltage_swing_supported(self, voltage_swing_supported: bool):
|
||||
self._set_by_bitmask(voltage_swing_supported, 0)
|
||||
self.__value._set_by_bitmask(voltage_swing_supported, 0)
|
||||
|
||||
@property
|
||||
def pre_emphasis_supported(self) -> bool:
|
||||
@@ -147,11 +147,11 @@ class DutCapsDp21Flags(Param):
|
||||
Returns:
|
||||
object of bool type
|
||||
"""
|
||||
return self._get_by_bitmask(1, bool)
|
||||
return self.__value._get_by_bitmask(1, bool)
|
||||
|
||||
@pre_emphasis_supported.setter
|
||||
def pre_emphasis_supported(self, pre_emphasis_supported: bool):
|
||||
self._set_by_bitmask(pre_emphasis_supported, 1)
|
||||
self.__value._set_by_bitmask(pre_emphasis_supported, 1)
|
||||
|
||||
@property
|
||||
def fixed_timing_dut_supported(self) -> bool:
|
||||
@@ -161,11 +161,11 @@ class DutCapsDp21Flags(Param):
|
||||
Returns:
|
||||
object of bool type
|
||||
"""
|
||||
return self._get_by_bitmask(2, bool)
|
||||
return self.__value._get_by_bitmask(2, bool)
|
||||
|
||||
@fixed_timing_dut_supported.setter
|
||||
def fixed_timing_dut_supported(self, fixed_timing_dut_supported: bool):
|
||||
self._set_by_bitmask(fixed_timing_dut_supported, 2)
|
||||
self.__value._set_by_bitmask(fixed_timing_dut_supported, 2)
|
||||
|
||||
@property
|
||||
def spread_spectrum_supported(self) -> bool:
|
||||
@@ -175,11 +175,11 @@ class DutCapsDp21Flags(Param):
|
||||
Returns:
|
||||
object of bool type
|
||||
"""
|
||||
return self._get_by_bitmask(3, bool)
|
||||
return self.__value._get_by_bitmask(3, bool)
|
||||
|
||||
@spread_spectrum_supported.setter
|
||||
def spread_spectrum_supported(self, spread_spectrum_supported: bool):
|
||||
self._set_by_bitmask(spread_spectrum_supported, 3)
|
||||
self.__value._set_by_bitmask(spread_spectrum_supported, 3)
|
||||
|
||||
@property
|
||||
def change_vf_without_lt_supported(self) -> bool:
|
||||
@@ -189,11 +189,11 @@ class DutCapsDp21Flags(Param):
|
||||
Returns:
|
||||
object of bool type
|
||||
"""
|
||||
return self._get_by_bitmask(4, bool)
|
||||
return self.__value._get_by_bitmask(4, bool)
|
||||
|
||||
@change_vf_without_lt_supported.setter
|
||||
def change_vf_without_lt_supported(self, change_vf_without_lt_supported: bool):
|
||||
self._set_by_bitmask(change_vf_without_lt_supported, 4)
|
||||
self.__value._set_by_bitmask(change_vf_without_lt_supported, 4)
|
||||
|
||||
@property
|
||||
def e_ddc_protocol_supported(self) -> bool:
|
||||
@@ -203,11 +203,11 @@ class DutCapsDp21Flags(Param):
|
||||
Returns:
|
||||
object of bool type
|
||||
"""
|
||||
return self._get_by_bitmask(5, bool)
|
||||
return self.__value._get_by_bitmask(5, bool)
|
||||
|
||||
@e_ddc_protocol_supported.setter
|
||||
def e_ddc_protocol_supported(self, e_ddc_protocol_supported: bool):
|
||||
self._set_by_bitmask(e_ddc_protocol_supported, 5)
|
||||
self.__value._set_by_bitmask(e_ddc_protocol_supported, 5)
|
||||
|
||||
@property
|
||||
def audio_transmission_supported(self) -> bool:
|
||||
@@ -217,11 +217,11 @@ class DutCapsDp21Flags(Param):
|
||||
Returns:
|
||||
object of bool type
|
||||
"""
|
||||
return self._get_by_bitmask(6, bool)
|
||||
return self.__value._get_by_bitmask(6, bool)
|
||||
|
||||
@audio_transmission_supported.setter
|
||||
def audio_transmission_supported(self, audio_transmission_supported: bool):
|
||||
self._set_by_bitmask(audio_transmission_supported, 6)
|
||||
self.__value._set_by_bitmask(audio_transmission_supported, 6)
|
||||
|
||||
@property
|
||||
def dut_is_type_c_device(self) -> bool:
|
||||
@@ -231,11 +231,11 @@ class DutCapsDp21Flags(Param):
|
||||
Returns:
|
||||
object of bool type
|
||||
"""
|
||||
return self._get_by_bitmask(7, bool)
|
||||
return self.__value._get_by_bitmask(7, bool)
|
||||
|
||||
@dut_is_type_c_device.setter
|
||||
def dut_is_type_c_device(self, dut_is_type_c_device: bool):
|
||||
self._set_by_bitmask(dut_is_type_c_device, 7)
|
||||
self.__value._set_by_bitmask(dut_is_type_c_device, 7)
|
||||
|
||||
@property
|
||||
def fec_supported(self) -> bool:
|
||||
@@ -245,11 +245,11 @@ class DutCapsDp21Flags(Param):
|
||||
Returns:
|
||||
object of bool type
|
||||
"""
|
||||
return self._get_by_bitmask(8, bool)
|
||||
return self.__value._get_by_bitmask(8, bool)
|
||||
|
||||
@fec_supported.setter
|
||||
def fec_supported(self, fec_supported: bool):
|
||||
self._set_by_bitmask(fec_supported, 8)
|
||||
self.__value._set_by_bitmask(fec_supported, 8)
|
||||
|
||||
@property
|
||||
def fec_disable_sequence_supported(self) -> bool:
|
||||
@@ -259,11 +259,11 @@ class DutCapsDp21Flags(Param):
|
||||
Returns:
|
||||
object of bool type
|
||||
"""
|
||||
return self._get_by_bitmask(9, bool)
|
||||
return self.__value._get_by_bitmask(9, bool)
|
||||
|
||||
@fec_disable_sequence_supported.setter
|
||||
def fec_disable_sequence_supported(self, fec_disable_sequence_supported: bool):
|
||||
self._set_by_bitmask(fec_disable_sequence_supported, 9)
|
||||
self.__value._set_by_bitmask(fec_disable_sequence_supported, 9)
|
||||
|
||||
@property
|
||||
def audio_without_video_supported(self) -> bool:
|
||||
@@ -273,11 +273,11 @@ class DutCapsDp21Flags(Param):
|
||||
Returns:
|
||||
object of bool type
|
||||
"""
|
||||
return self._get_by_bitmask(10, bool)
|
||||
return self.__value._get_by_bitmask(10, bool)
|
||||
|
||||
@audio_without_video_supported.setter
|
||||
def audio_without_video_supported(self, audio_without_video_supported: bool):
|
||||
self._set_by_bitmask(audio_without_video_supported, 10)
|
||||
self.__value._set_by_bitmask(audio_without_video_supported, 10)
|
||||
|
||||
@property
|
||||
def dsc_supported(self) -> bool:
|
||||
@@ -287,11 +287,11 @@ class DutCapsDp21Flags(Param):
|
||||
Returns:
|
||||
object of bool type
|
||||
"""
|
||||
return self._get_by_bitmask(11, bool)
|
||||
return self.__value._get_by_bitmask(11, bool)
|
||||
|
||||
@dsc_supported.setter
|
||||
def dsc_supported(self, dsc_supported: bool):
|
||||
self._set_by_bitmask(dsc_supported, 11)
|
||||
self.__value._set_by_bitmask(dsc_supported, 11)
|
||||
|
||||
@property
|
||||
def dsc_block_prediction_supported(self) -> bool:
|
||||
@@ -301,11 +301,11 @@ class DutCapsDp21Flags(Param):
|
||||
Returns:
|
||||
object of bool type
|
||||
"""
|
||||
return self._get_by_bitmask(12, bool)
|
||||
return self.__value._get_by_bitmask(12, bool)
|
||||
|
||||
@dsc_block_prediction_supported.setter
|
||||
def dsc_block_prediction_supported(self, dsc_block_prediction_supported: bool):
|
||||
self._set_by_bitmask(dsc_block_prediction_supported, 12)
|
||||
self.__value._set_by_bitmask(dsc_block_prediction_supported, 12)
|
||||
|
||||
@property
|
||||
def max_link_bandwidth_policy_supported(self):
|
||||
@@ -315,11 +315,11 @@ class DutCapsDp21Flags(Param):
|
||||
Returns:
|
||||
object of bool type
|
||||
"""
|
||||
return self._get_by_bitmask(13, bool)
|
||||
return self.__value._get_by_bitmask(13, bool)
|
||||
|
||||
@max_link_bandwidth_policy_supported.setter
|
||||
def max_link_bandwidth_policy_supported(self, max_link_bandwidth_policy_supported: bool):
|
||||
self._set_by_bitmask(max_link_bandwidth_policy_supported, 13)
|
||||
self.__value._set_by_bitmask(max_link_bandwidth_policy_supported, 13)
|
||||
|
||||
@property
|
||||
def use_3tap_conversion(self):
|
||||
@@ -329,11 +329,11 @@ class DutCapsDp21Flags(Param):
|
||||
Returns:
|
||||
object of bool type
|
||||
"""
|
||||
return self._get_by_bitmask(14, bool)
|
||||
return self.__value._get_by_bitmask(14, bool)
|
||||
|
||||
@use_3tap_conversion.setter
|
||||
def use_3tap_conversion(self, use_3tap_filter: bool):
|
||||
self._set_by_bitmask(use_3tap_filter, 14)
|
||||
self.__value._set_by_bitmask(use_3tap_filter, 14)
|
||||
|
||||
@property
|
||||
def usb4_tunnel_presented(self):
|
||||
@@ -343,11 +343,11 @@ class DutCapsDp21Flags(Param):
|
||||
Returns:
|
||||
object of bool type
|
||||
"""
|
||||
return self._get_by_bitmask(15, bool)
|
||||
return self.__value._get_by_bitmask(15, bool)
|
||||
|
||||
@usb4_tunnel_presented.setter
|
||||
def usb4_tunnel_presented(self, usb4_tunnel_presented: bool):
|
||||
self._set_by_bitmask(usb4_tunnel_presented, 15)
|
||||
self.__value._set_by_bitmask(usb4_tunnel_presented, 15)
|
||||
|
||||
@property
|
||||
def native_display_id_read(self) -> bool:
|
||||
@@ -357,11 +357,11 @@ class DutCapsDp21Flags(Param):
|
||||
Returns:
|
||||
object of bool type
|
||||
"""
|
||||
return self._get_by_bitmask(16, bool)
|
||||
return self.__value._get_by_bitmask(16, bool)
|
||||
|
||||
@native_display_id_read.setter
|
||||
def native_display_id_read(self, native_display_id_read: bool):
|
||||
self._set_by_bitmask(native_display_id_read, 16)
|
||||
self.__value._set_by_bitmask(native_display_id_read, 16)
|
||||
|
||||
@property
|
||||
def display_id_vii_supported(self) -> bool:
|
||||
@@ -371,11 +371,11 @@ class DutCapsDp21Flags(Param):
|
||||
Returns:
|
||||
object of bool type
|
||||
"""
|
||||
return self._get_by_bitmask(17, bool)
|
||||
return self.__value._get_by_bitmask(17, bool)
|
||||
|
||||
@display_id_vii_supported.setter
|
||||
def display_id_vii_supported(self, display_id_vii_supported: bool):
|
||||
self._set_by_bitmask(display_id_vii_supported, 17)
|
||||
self.__value._set_by_bitmask(display_id_vii_supported, 17)
|
||||
|
||||
@property
|
||||
def display_id_viii_supported(self) -> bool:
|
||||
@@ -385,12 +385,11 @@ class DutCapsDp21Flags(Param):
|
||||
Returns:
|
||||
object of bool type
|
||||
"""
|
||||
return self._get_by_bitmask(18, bool)
|
||||
return self.__value._get_by_bitmask(18, bool)
|
||||
|
||||
@display_id_viii_supported.setter
|
||||
def display_id_viii_supported(self, display_id_viii_supported: bool):
|
||||
self._set_by_bitmask(display_id_viii_supported, 18)
|
||||
|
||||
self.__value._set_by_bitmask(display_id_viii_supported, 18)
|
||||
|
||||
@property
|
||||
def display_id_ix_supported(self) -> bool:
|
||||
@@ -400,11 +399,11 @@ class DutCapsDp21Flags(Param):
|
||||
Returns:
|
||||
object of bool type
|
||||
"""
|
||||
return self._get_by_bitmask(19, bool)
|
||||
return self.__value._get_by_bitmask(19, bool)
|
||||
|
||||
@display_id_ix_supported.setter
|
||||
def display_id_ix_supported(self, display_id_ix_supported: bool):
|
||||
self._set_by_bitmask(display_id_ix_supported, 19)
|
||||
self.__value._set_by_bitmask(display_id_ix_supported, 19)
|
||||
|
||||
@property
|
||||
def display_id_x_supported(self) -> bool:
|
||||
@@ -414,11 +413,11 @@ class DutCapsDp21Flags(Param):
|
||||
Returns:
|
||||
object of bool type
|
||||
"""
|
||||
return self._get_by_bitmask(20, bool)
|
||||
return self.__value._get_by_bitmask(20, bool)
|
||||
|
||||
@display_id_x_supported.setter
|
||||
def display_id_x_supported(self, display_id_x_supported: bool):
|
||||
self._set_by_bitmask(display_id_x_supported, 20)
|
||||
self.__value._set_by_bitmask(display_id_x_supported, 20)
|
||||
|
||||
@property
|
||||
def display_id_tiled_display_topology(self) -> bool:
|
||||
@@ -428,11 +427,11 @@ class DutCapsDp21Flags(Param):
|
||||
Returns:
|
||||
object of bool type
|
||||
"""
|
||||
return self._get_by_bitmask(21, bool)
|
||||
return self.__value._get_by_bitmask(21, bool)
|
||||
|
||||
@display_id_tiled_display_topology.setter
|
||||
def display_id_tiled_display_topology(self, display_id_tiled_display_topology: bool):
|
||||
self._set_by_bitmask(display_id_tiled_display_topology, 21)
|
||||
self.__value._set_by_bitmask(display_id_tiled_display_topology, 21)
|
||||
|
||||
@property
|
||||
def display_id_tiled_stereo_display(self) -> bool:
|
||||
@@ -442,11 +441,11 @@ class DutCapsDp21Flags(Param):
|
||||
Returns:
|
||||
object of bool type
|
||||
"""
|
||||
return self._get_by_bitmask(22, bool)
|
||||
return self.__value._get_by_bitmask(22, bool)
|
||||
|
||||
@display_id_tiled_stereo_display.setter
|
||||
def display_id_tiled_stereo_display(self, display_id_tiled_stereo_display: bool):
|
||||
self._set_by_bitmask(display_id_tiled_stereo_display, 22)
|
||||
self.__value._set_by_bitmask(display_id_tiled_stereo_display, 22)
|
||||
|
||||
@property
|
||||
def stacked_frame_stereo_supported(self) -> bool:
|
||||
@@ -456,11 +455,11 @@ class DutCapsDp21Flags(Param):
|
||||
Returns:
|
||||
object of bool type
|
||||
"""
|
||||
return self._get_by_bitmask(23, bool)
|
||||
return self.__value._get_by_bitmask(23, bool)
|
||||
|
||||
@stacked_frame_stereo_supported.setter
|
||||
def stacked_frame_stereo_supported(self, stacked_frame_stereo_supported: bool):
|
||||
self._set_by_bitmask(stacked_frame_stereo_supported, 23)
|
||||
self.__value._set_by_bitmask(stacked_frame_stereo_supported, 23)
|
||||
|
||||
@property
|
||||
def dynamic_refresh_rate_support(self) -> bool:
|
||||
@@ -470,11 +469,67 @@ class DutCapsDp21Flags(Param):
|
||||
Returns:
|
||||
object of bool type
|
||||
"""
|
||||
return self._get_by_bitmask(24, bool)
|
||||
return self.__value._get_by_bitmask(24, bool)
|
||||
|
||||
@dynamic_refresh_rate_support.setter
|
||||
def dynamic_refresh_rate_support(self, dynamic_refresh_rate_support: bool):
|
||||
self._set_by_bitmask(dynamic_refresh_rate_support, 24)
|
||||
self.__value._set_by_bitmask(dynamic_refresh_rate_support, 24)
|
||||
|
||||
@property
|
||||
def mst_transmission_supported(self) -> bool:
|
||||
"""
|
||||
Set and get MST transmission supported flag supported.
|
||||
|
||||
Returns:
|
||||
object of bool type
|
||||
"""
|
||||
return self.__value._get_by_bitmask(25, bool)
|
||||
|
||||
@mst_transmission_supported.setter
|
||||
def mst_transmission_supported(self, mst_transmission_supported: bool):
|
||||
self.__value._set_by_bitmask(mst_transmission_supported, 25)
|
||||
|
||||
@property
|
||||
def mst_up_request_supported(self) -> bool:
|
||||
"""
|
||||
Set and get MST UP REQUEST supported flag supported.
|
||||
|
||||
Returns:
|
||||
object of bool type
|
||||
"""
|
||||
return self.__value._get_by_bitmask(26, bool)
|
||||
|
||||
@mst_up_request_supported.setter
|
||||
def mst_up_request_supported(self, mst_up_request_supported: bool):
|
||||
self.__value._set_by_bitmask(mst_up_request_supported, 26)
|
||||
|
||||
@property
|
||||
def mst_rsn_request_supported(self) -> bool:
|
||||
"""
|
||||
Set and get MST RSN REQUEST supported flag supported.
|
||||
|
||||
Returns:
|
||||
object of bool type
|
||||
"""
|
||||
return self.__value._get_by_bitmask(27, bool)
|
||||
|
||||
@mst_rsn_request_supported.setter
|
||||
def mst_rsn_request_supported(self, mst_rsn_request_supported: bool):
|
||||
self.__value._set_by_bitmask(mst_rsn_request_supported, 27)
|
||||
|
||||
@property
|
||||
def mst_power_up_request_supported(self) -> bool:
|
||||
"""
|
||||
Set and get MST POWER_UP DOWN_PHY supported flag supported.
|
||||
|
||||
Returns:
|
||||
object of bool type
|
||||
"""
|
||||
return self.__value._get_by_bitmask(28, bool)
|
||||
|
||||
@mst_power_up_request_supported.setter
|
||||
def mst_power_up_request_supported(self, mst_power_up_request_supported: bool):
|
||||
self.__value._set_by_bitmask(mst_power_up_request_supported, 28)
|
||||
|
||||
|
||||
class DutCapsDp21:
|
||||
@@ -487,7 +542,7 @@ class DutCapsDp21:
|
||||
def __init__(self, json_obj):
|
||||
self.__max_lanes = Param(json_obj["TSI_DP20_SRCCTS_MAX_LANES"])
|
||||
self.__max_link_rate = Param(json_obj["TSI_DP20_SRCCTS_MAX_LINK_RATE"])
|
||||
self.__dut_caps_flags = DutCapsDp21Flags(json_obj["TSI_DP20_SRCCTS_DUT_CAPS"])
|
||||
self.__dut_caps_flags_mst = DutCapsDp21Flags(json_obj["TSI_DP20_SRCCTS_DUT_CAPS"])
|
||||
|
||||
@property
|
||||
def max_lanes(self) -> int:
|
||||
@@ -529,11 +584,11 @@ class DutCapsDp21:
|
||||
Returns:
|
||||
object of `DutCapsFlags` type
|
||||
"""
|
||||
return self.__dut_caps_flags
|
||||
return self.__dut_caps_flags_mst
|
||||
|
||||
@dut_caps_flags.setter
|
||||
def dut_caps_flags(self, dut_caps_flags: DutCapsDp21Flags):
|
||||
self.__dut_caps_flags = dut_caps_flags
|
||||
self.__dut_caps_flags_mst = dut_caps_flags
|
||||
|
||||
|
||||
class DebugOptions:
|
||||
@@ -755,4 +810,3 @@ class GeneralSourceDUTDp21SettingTab:
|
||||
@debug_options.setter
|
||||
def debug_options(self, debug_config: DebugOptions):
|
||||
self.__debug_options = debug_config
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
from UniTAP.dev.modules.dut_tests.test_group_params_types import Param
|
||||
|
||||
|
||||
class HdmiHdcp1ATestParam:
|
||||
"""
|
||||
Class `HdmiHdcp1ATestParam` describes requirement parameters for HDMI HDCP 1A tests:
|
||||
- Set and get `timeout`. Describes test timeout, in milliseconds.
|
||||
"""
|
||||
def __init__(self, json_obj):
|
||||
self.__timeout = Param(json_obj["TSI_HDMI_HDCP_1A_TIMEOUT"])
|
||||
|
||||
@property
|
||||
def timeout(self) -> int:
|
||||
"""
|
||||
Set and get test timeout, in milliseconds.
|
||||
|
||||
Returns:
|
||||
object of int type
|
||||
"""
|
||||
return self.__timeout.default_value
|
||||
|
||||
@timeout.setter
|
||||
def timeout(self, timeout: int):
|
||||
if not(self.__timeout.min_value < timeout < self.__timeout.max_value):
|
||||
raise ValueError(f"Timeout cannot be less than {self.__timeout.min_value} and more than "
|
||||
f"{self.__timeout.max_value}.")
|
||||
self.__timeout.default_value = timeout
|
||||
@@ -0,0 +1,27 @@
|
||||
from UniTAP.dev.modules.dut_tests.test_group_params_types import Param
|
||||
|
||||
|
||||
class HdmiHdcp1BTestParam:
|
||||
"""
|
||||
Class `HdmiHdcp1BTestParam` describes requirement parameters for HDMI HDCP 1B tests:
|
||||
- Set and get `timeout`. Describes test timeout, in milliseconds.
|
||||
"""
|
||||
def __init__(self, json_obj):
|
||||
self.__timeout = Param(json_obj["TSI_HDMI_HDCP_1B_TIMEOUT"])
|
||||
|
||||
@property
|
||||
def timeout(self) -> int:
|
||||
"""
|
||||
Set and get test timeout, in milliseconds.
|
||||
|
||||
Returns:
|
||||
object of int type
|
||||
"""
|
||||
return self.__timeout.default_value
|
||||
|
||||
@timeout.setter
|
||||
def timeout(self, timeout: int):
|
||||
if not(self.__timeout.min_value < timeout < self.__timeout.max_value):
|
||||
raise ValueError(f"Timeout cannot be less than {self.__timeout.min_value} and more than "
|
||||
f"{self.__timeout.max_value}.")
|
||||
self.__timeout.default_value = timeout
|
||||
@@ -0,0 +1,60 @@
|
||||
from UniTAP.dev.modules.dut_tests.test_group_params_types import Param
|
||||
from .hdmi_sink_tests import HdmiFrlRate
|
||||
|
||||
|
||||
class HdmiHdcp2CTestParam:
|
||||
"""
|
||||
Class `HdmiHdcp2CTestParam` describes requirement parameters for HDMI HDCP 2C tests:
|
||||
- Set and get `timeout`. Describes test timeout, in milliseconds.
|
||||
- Set and get `lt_before_test`.
|
||||
- Set and get `link_rate`.
|
||||
"""
|
||||
def __init__(self, json_obj):
|
||||
self.__timeout = Param(json_obj["TSI_HDMI_HDCP_2C_TIMEOUT"])
|
||||
self.__lt_before_test = Param(json_obj["TSI_HDMI_HDCP_2C_LT_BEFORE_TEST"])
|
||||
self.__link_rate = Param(json_obj["TSI_HDMI_HDCP_2C_LINK_RATE"])
|
||||
|
||||
@property
|
||||
def timeout(self) -> int:
|
||||
"""
|
||||
Set and get test timeout, in milliseconds.
|
||||
|
||||
Returns:
|
||||
object of int type
|
||||
"""
|
||||
return self.__timeout.default_value
|
||||
|
||||
@timeout.setter
|
||||
def timeout(self, timeout: int):
|
||||
if not(self.__timeout.min_value < timeout < self.__timeout.max_value):
|
||||
raise ValueError(f"Timeout cannot be less than {self.__timeout.min_value} and more than "
|
||||
f"{self.__timeout.max_value}.")
|
||||
self.__timeout.default_value = timeout
|
||||
|
||||
@property
|
||||
def lt_before_test(self) -> bool:
|
||||
"""
|
||||
Set and get flag to do or not link training before starting test
|
||||
|
||||
Returns:
|
||||
object of bool type
|
||||
"""
|
||||
return bool(self.__lt_before_test.default_value)
|
||||
|
||||
@lt_before_test.setter
|
||||
def lt_before_test(self, enable: bool):
|
||||
self.__lt_before_test.default_value = int(enable)
|
||||
|
||||
@property
|
||||
def link_rate(self) -> HdmiFrlRate:
|
||||
"""
|
||||
Set and get the Link rate for link training.
|
||||
|
||||
Returns:
|
||||
object of `HdmiFrlRate` type
|
||||
"""
|
||||
return HdmiFrlRate(self.__link_rate.default_value)
|
||||
|
||||
@link_rate.setter
|
||||
def link_rate(self, link_rate: HdmiFrlRate):
|
||||
self.__link_rate.default_value = link_rate.value
|
||||
@@ -0,0 +1,27 @@
|
||||
from UniTAP.dev.modules.dut_tests.test_group_params_types import Param
|
||||
|
||||
|
||||
class HdmiHdcp3ATestParam:
|
||||
"""
|
||||
Class `HdmiHdcp3ATestParam` describes requirement parameters for HDMI HDCP 3A tests:
|
||||
- Set and get `timeout`. Describes test timeout, in milliseconds.
|
||||
"""
|
||||
def __init__(self, json_obj):
|
||||
self.__timeout = Param(json_obj["TSI_HDMI_HDCP_3A_TIMEOUT"])
|
||||
|
||||
@property
|
||||
def timeout(self) -> int:
|
||||
"""
|
||||
Set and get test timeout, in milliseconds.
|
||||
|
||||
Returns:
|
||||
object of int type
|
||||
"""
|
||||
return self.__timeout.default_value
|
||||
|
||||
@timeout.setter
|
||||
def timeout(self, timeout: int):
|
||||
if not(self.__timeout.min_value < timeout < self.__timeout.max_value):
|
||||
raise ValueError(f"Timeout cannot be less than {self.__timeout.min_value} and more than "
|
||||
f"{self.__timeout.max_value}.")
|
||||
self.__timeout.default_value = timeout
|
||||
@@ -0,0 +1,27 @@
|
||||
from UniTAP.dev.modules.dut_tests.test_group_params_types import Param
|
||||
|
||||
|
||||
class HdmiHdcp3BTestParam:
|
||||
"""
|
||||
Class `HdmiHdcp3BTestParam` describes requirement parameters for HDMI HDCP 3B tests:
|
||||
- Set and get `timeout`. Describes test timeout, in milliseconds.
|
||||
"""
|
||||
def __init__(self, json_obj):
|
||||
self.__timeout = Param(json_obj["TSI_HDMI_HDCP_3B_TIMEOUT"])
|
||||
|
||||
@property
|
||||
def timeout(self) -> int:
|
||||
"""
|
||||
Set and get test timeout, in milliseconds.
|
||||
|
||||
Returns:
|
||||
object of int type
|
||||
"""
|
||||
return self.__timeout.default_value
|
||||
|
||||
@timeout.setter
|
||||
def timeout(self, timeout: int):
|
||||
if not(self.__timeout.min_value < timeout < self.__timeout.max_value):
|
||||
raise ValueError(f"Timeout cannot be less than {self.__timeout.min_value} and more than "
|
||||
f"{self.__timeout.max_value}.")
|
||||
self.__timeout.default_value = timeout
|
||||
@@ -0,0 +1,27 @@
|
||||
from UniTAP.dev.modules.dut_tests.test_group_params_types import Param
|
||||
|
||||
|
||||
class HdmiHdcp3CTestParam:
|
||||
"""
|
||||
Class `HdmiHdcp3CTestParam` describes requirement parameters for HDMI HDCP 3C tests:
|
||||
- Set and get `timeout`. Describes test timeout, in milliseconds.
|
||||
"""
|
||||
def __init__(self, json_obj):
|
||||
self.__timeout = Param(json_obj["TSI_HDMI_HDCP_3C_TIMEOUT"])
|
||||
|
||||
@property
|
||||
def timeout(self) -> int:
|
||||
"""
|
||||
Set and get test timeout, in milliseconds.
|
||||
|
||||
Returns:
|
||||
object of int type
|
||||
"""
|
||||
return self.__timeout.default_value
|
||||
|
||||
@timeout.setter
|
||||
def timeout(self, timeout: int):
|
||||
if not(self.__timeout.min_value < timeout < self.__timeout.max_value):
|
||||
raise ValueError(f"Timeout cannot be less than {self.__timeout.min_value} and more than "
|
||||
f"{self.__timeout.max_value}.")
|
||||
self.__timeout.default_value = timeout
|
||||
@@ -142,45 +142,25 @@ class DUTTests:
|
||||
- Make report after testing `make_report`.
|
||||
- Run test from file `run_from_file` - Not implemented. Will be added later.
|
||||
"""
|
||||
__DEFAULT_TEST_PARAMETERS = None
|
||||
|
||||
def __init__(self, dev_io: DeviceIO):
|
||||
self.__io = dev_io
|
||||
self.__opf_device = None
|
||||
self.__results = []
|
||||
self.__default_parameters = {}
|
||||
self.__test_groups = {}
|
||||
self.__parser = Parser()
|
||||
|
||||
self.__io.set_test_config(0)
|
||||
cfp_path = os.path.join(os.path.dirname(__file__), 'cfg')
|
||||
files = os.listdir(cfp_path)
|
||||
for file in files:
|
||||
try:
|
||||
if not os.path.isfile(os.path.join(cfp_path, file)):
|
||||
continue
|
||||
|
||||
with open(os.path.join(cfp_path, file), encoding='UTF-8') as cfg_json:
|
||||
json_obj = json.load(cfg_json)
|
||||
item_group = MergedTestGroups(int(json_obj.get('id'), 16))
|
||||
group_type = MERGED_GROUP_PARAMS_TYPE.get(item_group, None)
|
||||
|
||||
if group_type is None:
|
||||
continue
|
||||
|
||||
group_parameters_dict = {}
|
||||
for parameter in json_obj.get('descriptions'):
|
||||
group_parameters_dict[parameter["id"]] = parameter
|
||||
|
||||
self.__default_parameters[group_type] = group_type(group_parameters_dict)
|
||||
except ValueError:
|
||||
logging.info(
|
||||
f"[UniTAP] Failed to load {os.path.join(cfp_path, file)}.\n Value {int(json_obj.get('id'), 16)} is missing in MergedTestGroups.")
|
||||
|
||||
test_list = self.__io.get_test_list()
|
||||
|
||||
for test in test_list:
|
||||
test_id = test[0] & 0xFFFF
|
||||
group_id = TestGroupId(test[0] >> 16)
|
||||
try:
|
||||
group_id = TestGroupId(test[0] >> 16)
|
||||
except BaseException as e:
|
||||
logging.info(e)
|
||||
continue
|
||||
name = test[2]
|
||||
|
||||
if test[2].find(' / ') != -1:
|
||||
@@ -201,6 +181,49 @@ class DUTTests:
|
||||
|
||||
self.__test_groups[group_id]._add_new_test(Test(name=test_name, test_id=test_id))
|
||||
|
||||
@staticmethod
|
||||
def __enumerate_and_get_default_test_parameters():
|
||||
if DUTTests.__DEFAULT_TEST_PARAMETERS is None:
|
||||
DUTTests.__DEFAULT_TEST_PARAMETERS = {}
|
||||
|
||||
cfp_path = os.path.join(os.path.dirname(__file__), 'cfg')
|
||||
files = os.listdir(cfp_path)
|
||||
for file in files:
|
||||
try:
|
||||
if not os.path.isfile(os.path.join(cfp_path, file)):
|
||||
continue
|
||||
|
||||
with open(os.path.join(cfp_path, file), encoding='UTF-8') as cfg_json:
|
||||
json_obj = json.load(cfg_json)
|
||||
item_group = MergedTestGroups(int(json_obj.get('id'), 16))
|
||||
group_type = MERGED_GROUP_PARAMS_TYPE.get(item_group, None)
|
||||
|
||||
if group_type is None:
|
||||
continue
|
||||
|
||||
group_parameters_dict = {}
|
||||
for parameter in json_obj.get('descriptions'):
|
||||
group_parameters_dict[parameter["id"]] = parameter
|
||||
|
||||
DUTTests.__DEFAULT_TEST_PARAMETERS[group_type] = group_type(group_parameters_dict)
|
||||
except ValueError:
|
||||
logging.info(
|
||||
f"[UniTAP] Failed to load {os.path.join(cfp_path, file)}.\n Value {int(json_obj.get('id'), 16)} is missing in MergedTestGroups.")
|
||||
|
||||
return DUTTests.__DEFAULT_TEST_PARAMETERS
|
||||
|
||||
@staticmethod
|
||||
def __is_dsc_parameters_changed(param: Dp21SourceDUTTestParam):
|
||||
assert isinstance(param, Dp21SourceDUTTestParam)
|
||||
|
||||
result = []
|
||||
dsc_vm_params = vars(param.dsc_video_modes)
|
||||
for key in dsc_vm_params:
|
||||
vm_param_dict = vars(dsc_vm_params[key])
|
||||
result.append(any(vm_param_dict[param_key].is_modified for param_key in vm_param_dict))
|
||||
|
||||
return any(result)
|
||||
|
||||
def run(self, group_id: TestGroupId, test_id: int, params: Optional[DUTTestParameters] = None,
|
||||
print_fw_logs: bool = True, test_delay: int = 0) -> SubTestResultObject:
|
||||
"""
|
||||
@@ -234,8 +257,11 @@ class DUTTests:
|
||||
|
||||
if params is not None:
|
||||
params_list = get_param_list(params)
|
||||
if isinstance(params, Dp21SourceDUTTestParam) and not params.dsc_video_modes._Dp21AvailableDscVideoModes__is_config_changed:
|
||||
logging.warning("Detected that used didn't change new DSC config. Copy setting from video config.")
|
||||
|
||||
#
|
||||
# Backward compatibility with old config
|
||||
#
|
||||
if isinstance(params, Dp21SourceDUTTestParam):
|
||||
dsc_dp2_ci_remapper = {
|
||||
"TSI_DP20_SRCCTS_DSC_VMT_1920_1080_30": "TSI_DP20_SRCCTS_VMT_1920_1080_30",
|
||||
"TSI_DP20_SRCCTS_DSC_VMT_1920_1080_60": "TSI_DP20_SRCCTS_VMT_1920_1080_60",
|
||||
@@ -259,27 +285,33 @@ class DUTTests:
|
||||
"TSI_DP20_SRCCTS_DSC_VMT_10240_4320_60": "TSI_DP20_SRCCTS_VMT_10240_4320_60"
|
||||
}
|
||||
|
||||
for key in dsc_dp2_ci_remapper.keys():
|
||||
dst = next((obj for obj in params_list if obj.config_id_name == key), None)
|
||||
src = next((obj for obj in params_list if obj.config_id_name == dsc_dp2_ci_remapper[key]), None)
|
||||
if not DUTTests.__is_dsc_parameters_changed(params):
|
||||
logging.warn("Detected that user didn't change new DSC config. Copy setting from video config.")
|
||||
|
||||
if dst.default_value != src.default_value:
|
||||
logging.warn(f"DSC Config missmatch detected. Apply workaround: {key}:{hex(dst.default_value)}; {dsc_dp2_ci_remapper[key]}:{hex(src.default_value)}")
|
||||
dst.default_value = src.default_value
|
||||
for key in dsc_dp2_ci_remapper.keys():
|
||||
dst = next((obj for obj in params_list if obj.config_id_name == key), None)
|
||||
src = next((obj for obj in params_list if obj.config_id_name == dsc_dp2_ci_remapper[key]), None)
|
||||
|
||||
if dst.default_value != src.default_value:
|
||||
logging.warn(
|
||||
f"DSC Config missmatch detected. Apply workaround: {key}:{hex(dst.default_value)}; {dsc_dp2_ci_remapper[key]}:{hex(src.default_value)}")
|
||||
dst.default_value = src.default_value
|
||||
else:
|
||||
logging.warn(f"DSC Config modification detected. Skip workaround.")
|
||||
else:
|
||||
params_list = self.__default_parameters[merged_group_id]
|
||||
params_list = DUTTests.__enumerate_and_get_default_test_parameters()[merged_group_id]
|
||||
|
||||
for item in params_list:
|
||||
if group_id == TestGroupId.AUDIO_TEST and item.config_id_name == "TSI_REF1_FRAME_DATA":
|
||||
if isinstance(item.default_value, str) and os.path.exists(item.default_value):
|
||||
image_data = read_image_file(item.default_value)
|
||||
image_data, file_extension = read_image_file(item.default_value)
|
||||
if len(image_data) > 0:
|
||||
item.default_value = uicl_image_preparation(image_data, params)
|
||||
# It is assumed that the bin file already contains prepared data,
|
||||
# otherwise there is no way to determine whether additional conversion is required.
|
||||
item.default_value = uicl_image_preparation(image_data, params, file_extension == ".bin")
|
||||
elif isinstance(item, bytearray):
|
||||
# TODO: add 'bytearray' support
|
||||
item.default_value = uicl_image_preparation(item.default_value, params)
|
||||
item.default_value = uicl_image_preparation(item.default_value, params, False)
|
||||
|
||||
self.__io.set(item.config_id, item.default_value, dict_types.get(item.value_type),
|
||||
item.data_length)
|
||||
@@ -315,41 +347,51 @@ class DUTTests:
|
||||
result_obj.test_delay = test_delay
|
||||
|
||||
self.__results.append(result_obj)
|
||||
|
||||
|
||||
time.sleep(test_delay)
|
||||
|
||||
return copy.deepcopy(self.__results[-1])
|
||||
|
||||
def get_params_from_file(self, path: str) -> Tuple[TestGroupId, int, DUTTestParameters]:
|
||||
@staticmethod
|
||||
def get_params_from_file(path: str) -> Tuple[TestGroupId, int, DUTTestParameters]:
|
||||
"""
|
||||
Get test parameters from transferred file: td or json (not cdf).
|
||||
|
||||
Args:
|
||||
path ('str') - full path to config file
|
||||
"""
|
||||
self.__parser.set_file_name(path)
|
||||
group_id = self.__parser.detect_group()
|
||||
test_id = self.__parser.detect_test()
|
||||
parser = Parser()
|
||||
|
||||
parser.set_file_name(path)
|
||||
group_id = parser.detect_group()
|
||||
test_id = parser.detect_test()
|
||||
group_type = group_params_dict.get(group_id)
|
||||
params = self.__parser.parse(self.get_default_parameters(group_type))
|
||||
params = parser.parse(DUTTests.get_default_parameters(group_type))
|
||||
|
||||
return group_id, test_id, params
|
||||
|
||||
# TODO - add support parsing '.td' (other test groups) file extension
|
||||
|
||||
def get_params_from_cdf_file(self, path: str) -> DUTTestParameters:
|
||||
@staticmethod
|
||||
def get_params_from_cdf_file(path: str) -> DUTTestParameters:
|
||||
"""
|
||||
Get test parameters from transferred file: json (cdf).
|
||||
|
||||
Args:
|
||||
path ('str') - full path to config file
|
||||
"""
|
||||
self.__parser.set_file_name(path)
|
||||
group_id = self.__parser.detect_merged_group()
|
||||
|
||||
parser = Parser()
|
||||
|
||||
parser.set_file_name(path)
|
||||
group_id = parser.detect_merged_group()
|
||||
group_type = MERGED_GROUP_PARAMS_TYPE.get(group_id)
|
||||
params = self.__parser.parse(self.get_default_parameters(group_type))
|
||||
params = parser.parse(DUTTests.get_default_parameters(group_type))
|
||||
|
||||
return params
|
||||
|
||||
def get_default_parameters(self, group_type: Type[DUTTestParameters]) -> DUTTestParameters:
|
||||
@staticmethod
|
||||
def get_default_parameters(group_type: Type[DUTTestParameters]) -> DUTTestParameters:
|
||||
"""
|
||||
Get predefined (default) parameters of test group.
|
||||
|
||||
@@ -359,9 +401,9 @@ class DUTTests:
|
||||
Returns:
|
||||
object of `DUTTestParameters` type
|
||||
"""
|
||||
for group_id in self.__default_parameters.keys():
|
||||
if isinstance(self.__default_parameters.get(group_id), group_type):
|
||||
return copy.deepcopy(self.__default_parameters.get(group_id))
|
||||
for group_id in DUTTests.__enumerate_and_get_default_test_parameters().keys():
|
||||
if isinstance(DUTTests.__enumerate_and_get_default_test_parameters().get(group_id), group_type):
|
||||
return copy.deepcopy(DUTTests.__enumerate_and_get_default_test_parameters().get(group_id))
|
||||
raise ValueError(f"Group {group_type} is not available.")
|
||||
|
||||
def number_tests_in_group(self, group_id: TestGroupId) -> int:
|
||||
|
||||
@@ -120,16 +120,16 @@ class ParserJson(ParserFileBase):
|
||||
CDF = 1
|
||||
|
||||
__DSC_VMT_CI_LIST = [ "TSI_DP20_SRCCTS_DSC_VMT_1920_1080_30",
|
||||
"TSI_DP20_SRCCTS_DSC_VMT_1920_1080_60",
|
||||
"TSI_DP20_SRCCTS_DSC_VMT_1920_1080_120",
|
||||
"TSI_DP20_SRCCTS_DSC_VMT_1920_1080_144",
|
||||
"TSI_DP20_SRCCTS_DSC_VMT_1920_1080_240",
|
||||
"TSI_DP20_SRCCTS_DSC_VMT_3840_2160_30",
|
||||
"TSI_DP20_SRCCTS_DSC_VMT_3840_2160_60",
|
||||
"TSI_DP20_SRCCTS_DSC_VMT_3840_2160_120",
|
||||
"TSI_DP20_SRCCTS_DSC_VMT_3840_2160_144",
|
||||
"TSI_DP20_SRCCTS_DSC_VMT_3840_2160_240",
|
||||
"TSI_DP20_SRCCTS_DSC_VMT_5120_2160_30",
|
||||
"TSI_DP20_SRCCTS_DSC_VMT_1920_1080_60",
|
||||
"TSI_DP20_SRCCTS_DSC_VMT_1920_1080_120",
|
||||
"TSI_DP20_SRCCTS_DSC_VMT_1920_1080_144",
|
||||
"TSI_DP20_SRCCTS_DSC_VMT_1920_1080_240",
|
||||
"TSI_DP20_SRCCTS_DSC_VMT_3840_2160_30",
|
||||
"TSI_DP20_SRCCTS_DSC_VMT_3840_2160_60",
|
||||
"TSI_DP20_SRCCTS_DSC_VMT_3840_2160_120",
|
||||
"TSI_DP20_SRCCTS_DSC_VMT_3840_2160_144",
|
||||
"TSI_DP20_SRCCTS_DSC_VMT_3840_2160_240",
|
||||
"TSI_DP20_SRCCTS_DSC_VMT_5120_2160_30",
|
||||
"TSI_DP20_SRCCTS_DSC_VMT_5120_2160_60",
|
||||
"TSI_DP20_SRCCTS_DSC_VMT_5120_2160_120",
|
||||
"TSI_DP20_SRCCTS_DSC_VMT_5120_2160_144",
|
||||
|
||||
@@ -31,7 +31,17 @@ class MergedTestGroups(IntEnum):
|
||||
HDRX_DSC_CTS = 0x20,
|
||||
HDTX_DSC_CTS = 0x21,
|
||||
HDTX_CONTINUITY = 0x22,
|
||||
HDTX_CABLE_CHECK = 0x24
|
||||
HDTX_CABLE_CHECK = 0x24,
|
||||
HDMI_HDCP_CTS_1A = 0x25,
|
||||
HDMI_HDCP_CTS_1B = 0x26,
|
||||
HDMI_HDCP_CTS_2C = 0x27,
|
||||
HDMI_HDCP_CTS_3A = 0x28,
|
||||
HDMI_HDCP_CTS_3B = 0x29,
|
||||
HDMI_HDCP_CTS_3C = 0x2A,
|
||||
DPRX_128b132b_LL_CTS_DEMO = 0x2B,
|
||||
DPTX_128b132b_LL_CTS_DEMO = 0x2C,
|
||||
TIMINGS_VIDEO_TEST = 0x2D,
|
||||
BRANCH_128b132b_MST_CTS = 0x2E
|
||||
|
||||
|
||||
MERGED_GROUP_PARAMS_TYPE = {
|
||||
@@ -60,7 +70,14 @@ MERGED_GROUP_PARAMS_TYPE = {
|
||||
MergedTestGroups.HDRX_DSC_CTS: HdmiSourceDUTTestParam,
|
||||
MergedTestGroups.HDTX_DSC_CTS: HdmiSinkDUTTestParam,
|
||||
MergedTestGroups.HDTX_CONTINUITY: HdmiSinkContinuityDUTTestParam,
|
||||
MergedTestGroups.HDTX_CABLE_CHECK: HdmiSinkCableCheckTestParam
|
||||
MergedTestGroups.HDTX_CABLE_CHECK: HdmiSinkCableCheckTestParam,
|
||||
MergedTestGroups.HDMI_HDCP_CTS_1A: HdmiHdcp1ATestParam,
|
||||
MergedTestGroups.HDMI_HDCP_CTS_1B: HdmiHdcp1BTestParam,
|
||||
MergedTestGroups.HDMI_HDCP_CTS_3A: HdmiHdcp3ATestParam,
|
||||
MergedTestGroups.HDMI_HDCP_CTS_3B: HdmiHdcp3BTestParam,
|
||||
MergedTestGroups.HDMI_HDCP_CTS_2C: HdmiHdcp2CTestParam,
|
||||
MergedTestGroups.HDMI_HDCP_CTS_3C: HdmiHdcp3CTestParam,
|
||||
MergedTestGroups.BRANCH_128b132b_MST_CTS: Dp21BranchMSTSourceDUTTestParam
|
||||
}
|
||||
|
||||
group_params_dict = {
|
||||
@@ -104,7 +121,25 @@ group_params_dict = {
|
||||
TestGroupId.HD_RX_DSC_CTS: HdmiSourceDUTTestParam,
|
||||
TestGroupId.HD_TX_DSC_CTS: HdmiSinkDUTTestParam,
|
||||
TestGroupId.HD_TX_CONTINUITY: HdmiSinkContinuityDUTTestParam,
|
||||
TestGroupId.HD_TX_CABLE_CHECK: HdmiSinkCableCheckTestParam
|
||||
TestGroupId.HD_TX_CABLE_CHECK: HdmiSinkCableCheckTestParam,
|
||||
TestGroupId.HDMI_HDCP_CTS_1A: HdmiHdcp1ATestParam,
|
||||
TestGroupId.HDMI_HDCP_CTS_1B: HdmiHdcp1BTestParam,
|
||||
TestGroupId.HDMI_HDCP_CTS_2C: HdmiHdcp2CTestParam,
|
||||
TestGroupId.HDMI_HDCP_CTS_3A: HdmiHdcp3ATestParam,
|
||||
TestGroupId.HDMI_HDCP_CTS_3B: HdmiHdcp3BTestParam,
|
||||
TestGroupId.HDMI_HDCP_CTS_3C: HdmiHdcp3CTestParam,
|
||||
TestGroupId.DEMO_DP_2_1_TX_DISPAYID: Dp21SinkTestParam,
|
||||
TestGroupId.DEMO_DP_2_1_RX_DISPAYID: Dp21SourceDUTTestParam,
|
||||
TestGroupId.DEMO_DP_2_1_TX_ADAPTIVESYNC: Dp21SinkTestParam,
|
||||
TestGroupId.DEMO_DP_2_1_RX_ADAPTIVESYNC: Dp21SourceDUTTestParam,
|
||||
TestGroupId.DEMO_DP_2_1_RX_LL_CTS: Dp21SourceDUTTestParam,
|
||||
TestGroupId.DEMO_DP_2_1_TX_LL_CTS: Dp21SinkTestParam,
|
||||
TestGroupId.DEMO_DP_2_1_RX_LTTPR_CTS: Dp21SourceDUTTestParam,
|
||||
TestGroupId.DEMO_DP_2_1_TX_LTTPR_CTS: Dp21SinkTestParam,
|
||||
TestGroupId.DEMO_DP_2_1_RX_DSC_CTS: Dp21SourceDUTTestParam,
|
||||
TestGroupId.DEMO_DP_2_1_TX_DSC_CTS: Dp21SinkTestParam,
|
||||
TestGroupId.DP_2_1_RX_MST_CTS: Dp21SourceDUTTestParam,
|
||||
TestGroupId.DP_2_1_BRANCH_MST_CTS: Dp21BranchMSTSourceDUTTestParam
|
||||
}
|
||||
|
||||
|
||||
@@ -127,11 +162,17 @@ def test_group_to_merged_group(fw_group: TestGroupId, test_id: int) -> MergedTes
|
||||
merged_group_id = MergedTestGroups.CRCVideoTest
|
||||
elif fw_group in [TestGroupId.DP_2_1_RX_LL_CTS, TestGroupId.DP_2_1_RX_DSC_CTS,
|
||||
TestGroupId.DP_2_1_RX_LTTPR_CTS, TestGroupId.DP_2_1_RX_DISPAYID,
|
||||
TestGroupId.DP_2_1_RX_ADAPTIVESYNC]:
|
||||
TestGroupId.DP_2_1_RX_ADAPTIVESYNC,
|
||||
TestGroupId.DEMO_DP_2_1_RX_LL_CTS, TestGroupId.DEMO_DP_2_1_RX_DSC_CTS,
|
||||
TestGroupId.DEMO_DP_2_1_RX_LTTPR_CTS, TestGroupId.DEMO_DP_2_1_RX_DISPAYID,
|
||||
TestGroupId.DEMO_DP_2_1_RX_ADAPTIVESYNC, TestGroupId.DP_2_1_RX_MST_CTS]:
|
||||
merged_group_id = MergedTestGroups.DPRX_128b132b_LL_CTS
|
||||
elif fw_group in [TestGroupId.DP_2_1_TX_LL_CTS, TestGroupId.DP_2_1_TX_DSC_CTS,
|
||||
TestGroupId.DP_2_1_TX_LTTPR_CTS, TestGroupId.DP_2_1_TX_DISPAYID,
|
||||
TestGroupId.DP_2_1_TX_ADAPTIVESYNC]:
|
||||
TestGroupId.DP_2_1_TX_ADAPTIVESYNC,
|
||||
TestGroupId.DEMO_DP_2_1_TX_LL_CTS, TestGroupId.DEMO_DP_2_1_TX_DSC_CTS,
|
||||
TestGroupId.DEMO_DP_2_1_TX_LTTPR_CTS, TestGroupId.DEMO_DP_2_1_TX_DISPAYID,
|
||||
TestGroupId.DEMO_DP_2_1_TX_ADAPTIVESYNC]:
|
||||
merged_group_id = MergedTestGroups.DPTX_128b132b_LL_CTS
|
||||
elif fw_group == TestGroupId.DP_2_1_LTTPR_CTS:
|
||||
merged_group_id = MergedTestGroups.LTTPR_128b132b_LL_CTS
|
||||
@@ -169,6 +210,20 @@ def test_group_to_merged_group(fw_group: TestGroupId, test_id: int) -> MergedTes
|
||||
merged_group_id = MergedTestGroups.HDTX_CONTINUITY
|
||||
elif fw_group == TestGroupId.HD_TX_CABLE_CHECK:
|
||||
merged_group_id = MergedTestGroups.HDTX_CABLE_CHECK
|
||||
elif fw_group == TestGroupId.HDMI_HDCP_CTS_1A:
|
||||
merged_group_id = MergedTestGroups.HDMI_HDCP_CTS_1A
|
||||
elif fw_group == TestGroupId.HDMI_HDCP_CTS_1B:
|
||||
merged_group_id = MergedTestGroups.HDMI_HDCP_CTS_1B
|
||||
elif fw_group == TestGroupId.HDMI_HDCP_CTS_2C:
|
||||
merged_group_id = MergedTestGroups.HDMI_HDCP_CTS_2C
|
||||
elif fw_group == TestGroupId.HDMI_HDCP_CTS_3A:
|
||||
merged_group_id = MergedTestGroups.HDMI_HDCP_CTS_3A
|
||||
elif fw_group == TestGroupId.HDMI_HDCP_CTS_3B:
|
||||
merged_group_id = MergedTestGroups.HDMI_HDCP_CTS_3B
|
||||
elif fw_group == TestGroupId.HDMI_HDCP_CTS_3C:
|
||||
merged_group_id = MergedTestGroups.HDMI_HDCP_CTS_3C
|
||||
elif fw_group == TestGroupId.DP_2_1_BRANCH_MST_CTS:
|
||||
merged_group_id = MergedTestGroups.BRANCH_128b132b_MST_CTS
|
||||
else:
|
||||
merged_group_id = MergedTestGroups.Unknown
|
||||
return merged_group_id
|
||||
|
||||
102
UniTAP/dev/modules/dut_tests/report/report_edid_extractor.py
Normal file
102
UniTAP/dev/modules/dut_tests/report/report_edid_extractor.py
Normal file
@@ -0,0 +1,102 @@
|
||||
import re
|
||||
|
||||
class ReportContentExtractor:
|
||||
"""
|
||||
Class `ReportContentExtractor` allows to extract content from test report.
|
||||
- Extracted EDIDs, DisplayIDs from test report.
|
||||
"""
|
||||
__EDID_LINE_PATTERN = re.compile(r"\d{4}.\d{3}.\d{3}:\s+[0-9a-f]{4}:\s+([0-9a-f]{2}\s+)+")
|
||||
|
||||
def __init__(self) -> None:
|
||||
self.__extracting = False
|
||||
self.__edid_addr = 0
|
||||
self.__edid_size = 0
|
||||
self.__edid_ready = False
|
||||
self.__data = bytearray()
|
||||
|
||||
def __start_new_edid(self):
|
||||
self.__extracting = True
|
||||
self.__edid_addr = 0
|
||||
self.__edid_size = 0
|
||||
self.__edid_ready = False
|
||||
self.__data = bytearray()
|
||||
|
||||
def extract_content_from_report(self, report):
|
||||
edids = []
|
||||
for log_line in report.fw_logs.splitlines():
|
||||
self.__parse_line(log_line)
|
||||
if self.__edid_ready and self.__edid_size > 0:
|
||||
edids.append(self.__pop_edid())
|
||||
return edids
|
||||
|
||||
def __parse_line(self, line: str):
|
||||
if not self.__extracting:
|
||||
if ("Reference Source reads Sink DUT EDID" in line
|
||||
or "EDID contents:" in line):
|
||||
self.__start_new_edid()
|
||||
return
|
||||
|
||||
if len(line) < 18:
|
||||
return
|
||||
|
||||
view = line[18:]
|
||||
|
||||
if "I2C AUX WR" in line:
|
||||
sub_strs = view.split()
|
||||
|
||||
if len(sub_strs) <= 3:
|
||||
return
|
||||
|
||||
el = sub_strs[-3]
|
||||
|
||||
if "30h" in el:
|
||||
val = int(sub_strs[-1], 16)
|
||||
self.__edid_addr = val * 0x100
|
||||
elif "50h" in el:
|
||||
val = int(sub_strs[-1], 16)
|
||||
self.__edid_addr = val
|
||||
|
||||
return
|
||||
|
||||
if "I2C AUX RD" in line:
|
||||
sub_strs = view.split()
|
||||
|
||||
if len(sub_strs) <= 3:
|
||||
return
|
||||
|
||||
count = int(sub_strs[4])
|
||||
|
||||
for i in range(count):
|
||||
byte_hex = sub_strs[5 + i]
|
||||
self.__data.append(int(byte_hex, 16))
|
||||
self.__edid_addr += 1
|
||||
|
||||
self.__edid_size = max(self.__edid_size, self.__edid_addr)
|
||||
return
|
||||
|
||||
if self.__EDID_LINE_PATTERN.search(line):
|
||||
if len(line) < 20:
|
||||
return
|
||||
|
||||
view = line[line.rfind(':') + 1:]
|
||||
sub_strs = view.split()
|
||||
|
||||
for byte_hex in sub_strs:
|
||||
self.__data.append(int(byte_hex, 16))
|
||||
self.__edid_addr += 1
|
||||
|
||||
self.__edid_size = max(self.__edid_size, self.__edid_addr)
|
||||
return
|
||||
|
||||
self.__edid_ready = True
|
||||
self.__extracting = False
|
||||
|
||||
def __pop_edid(self):
|
||||
if self.__edid_ready and self.__edid_size > 0:
|
||||
edid = self.__data[:self.__edid_size].hex()
|
||||
self.__edid_ready = False
|
||||
self.__edid_size = 0
|
||||
self.__data = bytearray()
|
||||
self.__edid_addr = 0
|
||||
return edid
|
||||
return bytearray()
|
||||
@@ -1,8 +1,10 @@
|
||||
import os
|
||||
import platform
|
||||
from datetime import datetime
|
||||
from enum import IntEnum
|
||||
|
||||
from .report_template import *
|
||||
from .report_edid_extractor import ReportContentExtractor
|
||||
|
||||
|
||||
class TestResult(IntEnum):
|
||||
@@ -59,12 +61,48 @@ def replace_additional_info(test_additional_info: TestAdditionalInfo):
|
||||
return result
|
||||
|
||||
|
||||
def to_intel_hex(edid_hex: str) -> str:
|
||||
data = bytes.fromhex(edid_hex)
|
||||
lines = []
|
||||
for offset in range(0, len(data), 16):
|
||||
chunk = data[offset:offset + 16]
|
||||
byte_count = len(chunk)
|
||||
addr_hi = (offset >> 8) & 0xFF
|
||||
addr_lo = offset & 0xFF
|
||||
record = [byte_count, addr_hi, addr_lo, 0x00] + list(chunk)
|
||||
checksum = (~sum(record) + 1) & 0xFF
|
||||
hex_str = ''.join(f'{b:02X}' for b in record) + f'{checksum:02X}'
|
||||
lines.append(f':{hex_str}')
|
||||
lines.append(':00000001FF')
|
||||
return ('\r\n'.join(lines) + '\r\n').encode('utf-8').hex().upper()
|
||||
|
||||
|
||||
def generate_html_report(path: str, test_additional_info: TestAdditionalInfo, reports: list):
|
||||
result = str()
|
||||
|
||||
head = ReportHead
|
||||
head = head.replace("#count#", str((len(reports) + 2)))
|
||||
|
||||
for index, report in enumerate(reports):
|
||||
extractor = ReportContentExtractor()
|
||||
edid_displaid_content = extractor.extract_content_from_report(report)
|
||||
|
||||
if edid_displaid_content is None or len(edid_displaid_content) <= 0:
|
||||
continue
|
||||
|
||||
formatted_edids = '["' + '",\n "'.join(edid_displaid_content).upper() + '"]'
|
||||
formatted_edids_intel_hex = '["' + '",\n "'.join(to_intel_hex(edid) for edid in edid_displaid_content) + '"]'
|
||||
test_name_formatted = report.test_name.split(' ')[0].replace('.', '_')
|
||||
|
||||
if len(edid_displaid_content) > 0:
|
||||
head = head.replace("#edid_fill#", f"testsEdidData.set({index}, {{name: \"{test_name_formatted}\", data: {formatted_edids}, dataIntelHex: {formatted_edids_intel_hex}}}); \n#edid_fill#")
|
||||
break
|
||||
|
||||
head = head.replace("#edid_fill#", "")
|
||||
head = head.replace("#jsCode#", report_js)
|
||||
head = head.replace("#count#", str(len(reports) + 2))
|
||||
head = head.replace("#fileNamePrefix#", os.path.splitext(os.path.basename(path))[0])
|
||||
|
||||
body = ReportBody
|
||||
body = body.replace("#device_description#", replace_additional_info(test_additional_info))
|
||||
|
||||
@@ -105,7 +143,7 @@ def generate_html_report(path: str, test_additional_info: TestAdditionalInfo, re
|
||||
line = OptionListLine
|
||||
line = line.replace("#number#", str(i + 2))
|
||||
line = line.replace("#test_name#", f"{reports[i].group_name} / {reports[i].test_name}")
|
||||
line = line.replace("#test_result#", dict_result_2.get(reports[i].test_result))
|
||||
line = line.replace("#test_result#", dict_result_2.get(reports[i].test_result, "UNKNOWN"))
|
||||
options_list += line + "\n"
|
||||
|
||||
body = body.replace("#optionList#", options_list)
|
||||
@@ -117,7 +155,7 @@ def generate_html_report(path: str, test_additional_info: TestAdditionalInfo, re
|
||||
line = line.replace("#handler_number#", str(i + 2))
|
||||
line = line.replace("#test_name#", reports[i].test_name)
|
||||
line = line.replace("#test_group#", reports[i].group_name)
|
||||
line = line.replace("#test_result#", dict_result_2.get(reports[i].test_result))
|
||||
line = line.replace("#test_result#", dict_result_2.get(reports[i].test_result, "UNKNOWN"))
|
||||
line = line.replace("#error#", f"{reports[i].error_code}" if reports[i].error_code != 0 else "-")
|
||||
line = line.replace("#ending#", "2" if i % 2 else "")
|
||||
test_result = dict_result_2.get(reports[i].test_result)
|
||||
@@ -153,14 +191,17 @@ def generate_html_report(path: str, test_additional_info: TestAdditionalInfo, re
|
||||
line = line.replace("#test_number#", f"{i + 1}")
|
||||
line = line.replace("#test_group#", reports[i].group_name)
|
||||
line = line.replace("#test_name#", reports[i].test_name)
|
||||
line = line.replace("#result#", dict_result_2.get(reports[i].test_result))
|
||||
line = line.replace("#result#", dict_result_2.get(reports[i].test_result, "UNKNOWN"))
|
||||
line = line.replace("#test_delay#", f"{reports[i].test_delay * 1000}")
|
||||
line = line.replace("#test_parameters#", reports[i].config_info)
|
||||
line = line.replace("#warning#", "<b>Debug options enabled!</b><br><br>" if reports[i].debug else "")
|
||||
|
||||
if reports[i].debug:
|
||||
if "demo" in reports[i].group_name.lower():
|
||||
warnings = "<b>Demo Report Only - Not valid for DP Logo Certification.</b><br><br>"
|
||||
elif reports[i].debug:
|
||||
warnings = "<b>Debug options enabled!</b><br><br>"
|
||||
|
||||
line = line.replace("#warning#", warnings)
|
||||
|
||||
line = line.replace("#test_log#", escape_html(reports[i].fw_logs))
|
||||
tables_list += line + "\n"
|
||||
|
||||
|
||||
@@ -14,23 +14,29 @@ ReportHead = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\
|
||||
" PRE.TESTBODY{margin-top: 0;margin-bottom: 0;margin-left: 1.0cm;font-weight: medium;font-family: \"Courier New\";font-size: 11pt;color: #000000;}\n" \
|
||||
" P.BODYDETAILTEXT{margin-top: 0;margin-bottom: 0;margin-left: 1.4cm;font-weight: medium;font-family: \"Arial\";font-size: 9pt;color: #000000;}\n" \
|
||||
" P.CONTENTS SELECT{font-weight: normal;font-family: \"Arial\";font-size: 11pt;width: 98%;margin-top: 0;text-align: left;}\n" \
|
||||
"P.TABLE_HEADERS{background-color: #DCFABC;margin-top: 0;margin-bottom: 0;margin-left: 1.0cm;font-weight: " \
|
||||
"medium;font-family: \"Arial\";font-size: 12pt;color: #000000;}\n" \
|
||||
" P.TABLE_HEADERS{background-color: #DCFABC;margin-top: 0;margin-bottom: 0;margin-left: 1.0cm;font-weight: medium;font-family: \"Arial\";font-size: 12pt;color: #000000;}\n" \
|
||||
" P.TABLE_LINKS{margin-top: 0;margin-bottom: 0;margin-left: 1.0cm;font-weight: medium;font-family: \"Arial\";font-size: 11pt;}\n" \
|
||||
" P.TABLE_LINKS2{margin-top: 0;margin-bottom: 0;margin-left: 1.0cm;font-weight: medium;font-family: \"Arial\";font-size: 11pt; background-color: #DDDDDD;}\n" \
|
||||
" P.FAILED{margin-top: 0;margin-bottom: 0;background-color: #FFBCBC; font-weight: bold;font-family: \"Arial\";font-size: 11pt;color: #000000;}\n" \
|
||||
" P.PASSED{margin-top: 0;margin-bottom: 0;background-color: #BCFFBC; font-weight: bold;font-family: \"Arial\";font-size: 11pt;color: #000000;}\n" \
|
||||
" P.SKIPPED{margin-top: 0;margin-bottom: 0;background-color: #BCBCBC; font-weight: bold;font-family: \"Arial\";font-size: 11pt;color: #000000;}\n" \
|
||||
" P.ERROR_CODE{margin-top: 0;margin-bottom: 0;background-color: #FFFFFF; font-weight: bold;font-family: \"Arial\";font-size: 11pt;color: #000000;}\n" \
|
||||
" P.ABORTED{margin-top: 0;margin-bottom: 0;background-color: #FFFFFF; font-weight: bold;font-family: \"Arial\";font-size: 11pt;color: #000000;}\n" \
|
||||
" .TOPBUTTON{display: none; position: fixed; bottom: 20px; right: 30px; z-index: 99; font-size: 18px; border: solid black 1px; outline: none; background-color: #DCFABC; cursor: pointer; padding: 15px; border-radius: 5px;}\n" \
|
||||
" .DBG_HIGHLIGHT { color: #ff0000;}\n" \
|
||||
" .flex-container {\n" \
|
||||
" display: flex;\n" \
|
||||
" gap: 5px;\n" \
|
||||
" }\n" \
|
||||
"</style>\n" \
|
||||
"<script src=\"https://cdn.jsdelivr.net/npm/jszip@3.10.1/dist/jszip.min.js\"></script>" \
|
||||
"<script type=\"text/javascript\">\n" \
|
||||
"var base64Content = #configInfo#;\n"\
|
||||
"var base64Content = #configInfo#;\n" \
|
||||
"window.current_index = 2;\n" \
|
||||
"window.min_value = 2;\n" \
|
||||
"window.max_value = #count# - 1;\n" \
|
||||
"window.onscroll = function() {scrollFunction()};\n" \
|
||||
"let testsEdidData = new Map();\n" \
|
||||
"#edid_fill#\n\n" \
|
||||
"function Hide(iElementIndex) { document.getElementById(\"ID\"+iElementIndex).style.display = 'none'; }\n" \
|
||||
"function Show(iElementIndex) { document.getElementById(\"ID\"+iElementIndex).style.display = 'inline'; }\n" \
|
||||
"function HideAll(iDivCount) { for(var i=0;i<iDivCount;i++) { Hide(i); }}\n" \
|
||||
@@ -38,15 +44,26 @@ ReportHead = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\
|
||||
"function SetIndex(value) { window.current_index = value; }\n" \
|
||||
"function GetIndex() { return parseInt(window.current_index, 10); }\n" \
|
||||
"function HideButtons() { document.getElementById(\"top_buttons\").style.display = 'none'; document.getElementById(\"bottom_buttons\").style.display = 'none'; }\n" \
|
||||
"function ShowButtons() { document.getElementById(\"top_buttons\").style.display = 'inline'; document.getElementById(\"bottom_buttons\").style.display = 'inline'; }\n" \
|
||||
"function UpdateButtonsState() { GetIndex() >= window.min_value && window.max_value ? ShowButtons() : HideButtons(); }\n" \
|
||||
"function ShowButtons() { document.getElementById(\"top_buttons\").style.display = 'inline'; document.getElementById(\"bottom_buttons\").style.display = 'inline';} \n" \
|
||||
"function ShowHideEdidBtn() {\n" \
|
||||
" let index = GetIndex();\n" \
|
||||
" let edidBtnVisibility = 'none';\n" \
|
||||
" if (index < window.min_value || index > window.max_value) {\n" \
|
||||
" if (testsEdidData.size > 0) edidBtnVisibility = 'inline';\n }" \
|
||||
" else if (testsEdidData.has(index)) edidBtnVisibility = 'inline';\n" \
|
||||
" document.getElementById(\"save_edid_btn\").style.display = edidBtnVisibility;\n" \
|
||||
" document.getElementById(\"save_edid_intel_hex_btn\").style.display = edidBtnVisibility;\n" \
|
||||
"}\n" \
|
||||
"function UpdateButtonsState() { GetIndex() >= window.min_value && window.max_value ? ShowButtons() : HideButtons();\n" \
|
||||
" ShowHideEdidBtn(); }\n" \
|
||||
"function ListHandler (iOptionValue) { if(iOptionValue==-1) { ShowAll(#count#); Hide(1); SetIndex(1); UpdateButtonsState(); return; } HideAll(#count#); Show(iOptionValue); SetIndex(iOptionValue > 1 ? iOptionValue : 1); UpdateButtonsState();}\n" \
|
||||
"function NextTest() { var index = GetIndex(); ListHandler ((index + 1 > window.max_value) ? (window.min_value) : (index + 1)); }\n" \
|
||||
"function PreviousTest() { var index = GetIndex(); ListHandler ((index - 1 < window.min_value) ? (window.max_value) : (index - 1)); }\n" \
|
||||
"function scrollFunction() { let topButton = document.getElementById('topBtn'); if (document.body.scrollTop > 50 || document.documentElement.scrollTop > 50) {topButton.style.display = 'block';} else {topButton.style.display = 'none';} }\n" \
|
||||
"function TopFunction() { document.body.scrollTop = 0; document.documentElement.scrollTop = 0;}\n" \
|
||||
"function SaveConfig() { var jsonData = atob(base64Content[GetIndex()-2]); var blob = new Blob([jsonData], { type: 'application/json' }); var link = document.createElement('a'); link.href = window.URL.createObjectURL(blob); var currentPageURL = window.location.href; var decodedURL = decodeURIComponent(currentPageURL); link.download = getText() + \".json\"; document.body.appendChild(link); link.click(); document.body.removeChild(link); }\n"\
|
||||
"function getText() { var index = GetIndex(); let a = document.getElementById(\"testlist\"); let option = a.options[index]; return option.text.replace('/', '').replace('>', '').replace(':', '') }\n"\
|
||||
"function SaveConfig() { var jsonData = atob(base64Content[GetIndex()-2]); var blob = new Blob([jsonData], { type: 'application/json' }); var link = document.createElement('a'); link.href = window.URL.createObjectURL(blob); var currentPageURL = window.location.href; var decodedURL = decodeURIComponent(currentPageURL); link.download = getText() + \".json\"; document.body.appendChild(link); link.click(); document.body.removeChild(link); }\n" \
|
||||
"function getText() { var index = GetIndex(); let a = document.getElementById(\"testlist\"); let option = a.options[index]; return option.text.replace('/', '').replace('>', '').replace(':', '') }\n" \
|
||||
"#jsCode#" \
|
||||
"</script>\n" \
|
||||
"</head>\n"
|
||||
|
||||
@@ -102,7 +119,7 @@ TestTable = "<br><br></p></div><div id=\"ID#number#\">\n" \
|
||||
"\n"
|
||||
|
||||
ReportBody = "<body onload='ListHandler(0);'>\n" \
|
||||
" <button class=\"TOPBUTTON\" onclick=\"TopFunction()\" id=\"topBtn\" title=\"Go to top\">↑</button>\n" \
|
||||
"<button class=\"TOPBUTTON\" onclick=\"TopFunction()\" id=\"topBtn\" title=\"Go to top\">↑</button>\n" \
|
||||
" <div><p class=\"HEADING\" id=\"top\"> Unigraf Test Report</p></div>\n" \
|
||||
" <div>\n" \
|
||||
" <table class=\"DOCUMENT\" cellpadding=\"0\" cellspacing=\"0\">\n" \
|
||||
@@ -115,16 +132,22 @@ ReportBody = "<body onload='ListHandler(0);'>\n" \
|
||||
" <option value=\"0\">Report Summary</option>\n" \
|
||||
" <option value=\"1\">Test Summary</option>\n" \
|
||||
"#optionList#\n" \
|
||||
" <option value=\"-1\">Show everything</option>\n" \
|
||||
" <option value=\"-1\">Show All</option>\n" \
|
||||
" </select>\n" \
|
||||
" </td>\n" \
|
||||
" </table>\n" \
|
||||
"<div id=\"top_buttons\" style='margin-left: 12'>\n" \
|
||||
"<button type=\"button\" onclick=\"PreviousTest()\">Previous</button>\n" \
|
||||
"<button type=\"button\" onclick=\"ListHandler(1)\">Summary</button>\n" \
|
||||
"<button type=\"button\" onclick=\"SaveConfig()\">Save Test Config</button>\n" \
|
||||
"<button type=\"button\" onclick=\"NextTest()\">Next</button>\n" \
|
||||
"<br>\n" \
|
||||
"<div class='flex-container'>" \
|
||||
" <div id=\"top_buttons\">\n" \
|
||||
" <button type=\"button\" onclick=\"PreviousTest()\">Previous</button>\n" \
|
||||
" <button type=\"button\" onclick=\"ListHandler(1)\">Summary</button>\n" \
|
||||
" <button type=\"button\" onclick=\"SaveConfig()\">Save Test Config</button>\n" \
|
||||
" <button type=\"button\" onclick=\"NextTest()\">Next</button>\n" \
|
||||
" </div>\n" \
|
||||
" <div>\n" \
|
||||
" <button type=\"button\" id=\"save_edid_btn\" onclick=\"SaveEdid()\">Save EDID as bin</button>\n" \
|
||||
" <button type=\"button\" id=\"save_edid_intel_hex_btn\" onclick=\"SaveEdidIntelHex()\">Save EDID as intel hex</button>\n" \
|
||||
" <br>\n" \
|
||||
" </div>\n" \
|
||||
"</div>\n" \
|
||||
"<br>\n" \
|
||||
"<div id=\"ID0\">\n" \
|
||||
@@ -151,3 +174,134 @@ ReportFooter = "<br><br></pre></div>\n" \
|
||||
" </p>\n" \
|
||||
"</body>\n" \
|
||||
"</html>\n"
|
||||
|
||||
report_js = """
|
||||
function hexToUint8Array(hex) {
|
||||
const clean = hex.replace(/\s+/g, '');
|
||||
const bytes = new Uint8Array(clean.length / 2);
|
||||
|
||||
for (let i = 0; i < clean.length; i += 2) {
|
||||
bytes[i / 2] = parseInt(clean.substr(i, 2), 16);
|
||||
}
|
||||
|
||||
return bytes;
|
||||
}
|
||||
|
||||
function saveBlob(blob, fileName) {
|
||||
const a = document.createElement('a');
|
||||
const url = URL.createObjectURL(blob);
|
||||
|
||||
a.href = url;
|
||||
a.download = fileName;
|
||||
a.style.display = 'none';
|
||||
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
|
||||
setTimeout(() => {
|
||||
URL.revokeObjectURL(url);
|
||||
a.remove();
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
async function saveZip(files, zipName) {
|
||||
const zip = new JSZip();
|
||||
|
||||
for (const file of files) {
|
||||
zip.file(file.name, file.data, {
|
||||
binary: true
|
||||
});
|
||||
}
|
||||
|
||||
const uint8 = await zip.generateAsync({
|
||||
type: 'uint8array',
|
||||
compression: 'STORE'
|
||||
});
|
||||
|
||||
const blob = new Blob([uint8], { type: 'application/zip' });
|
||||
saveBlob(blob, zipName);
|
||||
}
|
||||
|
||||
async function saveFiles(getFileList, zipName, mimeType) {
|
||||
const files = getFileList();
|
||||
|
||||
if (files.length === 1) {
|
||||
saveBlob(
|
||||
new Blob([files[0].data], { type: mimeType }),
|
||||
files[0].name
|
||||
);
|
||||
} else if (files.length > 1) {
|
||||
await saveZip(files, zipName);
|
||||
}
|
||||
}
|
||||
|
||||
function getEdidBinFiles() {
|
||||
let index = GetIndex();
|
||||
const files = [];
|
||||
|
||||
if (index < window.min_value || index > window.max_value) {
|
||||
for (const [key, value] of testsEdidData) {
|
||||
for (let i = 0; i < value.data.length; ++i) {
|
||||
files.push({
|
||||
name: `#fileNamePrefix#_Test${key}_${value.name}_EDID_${i}.bin`,
|
||||
data: hexToUint8Array(value.data[i])
|
||||
});
|
||||
}
|
||||
}
|
||||
} else if (testsEdidData.has(index)) {
|
||||
const testData = testsEdidData.get(index);
|
||||
|
||||
for (let i = 0; i < testData.data.length; ++i) {
|
||||
files.push({
|
||||
name: `#fileNamePrefix#_Test_${testData.name}_EDID_${i}.bin`,
|
||||
data: hexToUint8Array(testData.data[i])
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
function getEdidIntelHexFiles() {
|
||||
let index = GetIndex();
|
||||
const files = [];
|
||||
|
||||
if (index < window.min_value || index > window.max_value) {
|
||||
for (const [key, value] of testsEdidData) {
|
||||
for (let i = 0; i < value.dataIntelHex.length; ++i) {
|
||||
files.push({
|
||||
name: `#fileNamePrefix#_Test${key}_${value.name}_EDID_${i}.hex`,
|
||||
data: hexToUint8Array(value.dataIntelHex[i])
|
||||
});
|
||||
}
|
||||
}
|
||||
} else if (testsEdidData.has(index)) {
|
||||
const testData = testsEdidData.get(index);
|
||||
|
||||
for (let i = 0; i < testData.dataIntelHex.length; ++i) {
|
||||
files.push({
|
||||
name: `#fileNamePrefix#_Test_${testData.name}_EDID_${i}.hex`,
|
||||
data: hexToUint8Array(testData.dataIntelHex[i])
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
async function SaveEdid() {
|
||||
await saveFiles(
|
||||
getEdidBinFiles,
|
||||
'#fileNamePrefix#_EDID_BIN.zip',
|
||||
'application/octet-stream'
|
||||
);
|
||||
}
|
||||
|
||||
async function SaveEdidIntelHex() {
|
||||
await saveFiles(
|
||||
getEdidIntelHexFiles,
|
||||
'#fileNamePrefix#_EDID_HEX.zip',
|
||||
'application/octet-stream'
|
||||
);
|
||||
}
|
||||
"""
|
||||
|
||||
@@ -121,6 +121,8 @@ class Param:
|
||||
|
||||
self.__process_value(json_obj)
|
||||
|
||||
self.__modified = False
|
||||
|
||||
def _set_by_bitmask(self, value, bitmask_index):
|
||||
if len(self.__bit_field_list) > bitmask_index:
|
||||
mask = self.__bit_field_list[bitmask_index].mask
|
||||
@@ -149,12 +151,17 @@ class Param:
|
||||
def direct_set_def_value(self, default_value):
|
||||
self.__default_value = default_value
|
||||
|
||||
def direct_set_bits_value(self, mask: int, value: int, shift: int = 0):
|
||||
cleared = self.__default_value & ~mask
|
||||
self.__default_value = cleared | (value << shift)
|
||||
|
||||
@property
|
||||
def default_value(self):
|
||||
return self.__default_value
|
||||
|
||||
@default_value.setter
|
||||
def default_value(self, default_value):
|
||||
self.__modified = True
|
||||
if self.__enumeration_variants is not None:
|
||||
if str(default_value) in self.__enumeration_variants.available_values:
|
||||
self.__default_value = default_value
|
||||
@@ -203,6 +210,10 @@ class Param:
|
||||
else:
|
||||
return 1
|
||||
|
||||
@property
|
||||
def is_modified(self):
|
||||
return self.__modified
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.default_value if self.data_length <= 50 else self.default_value[:50]}"
|
||||
|
||||
@@ -274,25 +285,28 @@ def param_by_ci_name(json_obj, name: str) -> Param:
|
||||
return Param({})
|
||||
|
||||
|
||||
def read_image_file(full_filename: str) -> bytearray:
|
||||
def read_image_file(full_filename: str) -> [bytearray, str]:
|
||||
file_name, file_extension = os.path.splitext(full_filename)
|
||||
if file_extension.lower() == '.bin':
|
||||
with open(full_filename, 'rb') as file:
|
||||
image_data = bytearray(file.read())
|
||||
return image_data
|
||||
return image_data, file_extension
|
||||
elif file_extension.lower() in [".png", '.jpg', ".ppm", '.bmp', '.tif', '.tiff']:
|
||||
image = Image.open(full_filename)
|
||||
image = image.convert('RGB')
|
||||
image_data = bytearray(image.tobytes())
|
||||
return image_data
|
||||
return image_data, file_extension
|
||||
else:
|
||||
return bytearray()
|
||||
return bytearray(), file_extension
|
||||
|
||||
|
||||
def uicl_image_preparation(data: bytearray, params):
|
||||
def uicl_image_preparation(data: bytearray, params, is_prepared):
|
||||
ref_image = UICL_Image()
|
||||
ref_param = UICL_ImageParameters()
|
||||
|
||||
if is_prepared:
|
||||
return list(data)
|
||||
|
||||
ref_param.Width = params.image_width
|
||||
ref_param.Height = params.image_height
|
||||
# VideoPixelTestElementFormat: RGB_16BPC = 20
|
||||
|
||||
@@ -58,6 +58,26 @@ class TestGroupId(IntEnum):
|
||||
HD_TX_DSC_CTS = 0x41
|
||||
HD_TX_CONTINUITY = 0x42
|
||||
HD_TX_CABLE_CHECK = 0x43
|
||||
HDMI_HDCP_CTS_1A = 0x44
|
||||
HDMI_HDCP_CTS_1B = 0x45
|
||||
HDMI_HDCP_CTS_2C = 0x46
|
||||
HDMI_HDCP_CTS_3A = 0x47
|
||||
HDMI_HDCP_CTS_3B = 0x48
|
||||
HDMI_HDCP_CTS_3C = 0x49
|
||||
DP_2_1_RX_MST_CTS = 0x4A,
|
||||
DEMO_DP_2_1_TX_DISPAYID = 0x4B,
|
||||
DEMO_DP_2_1_RX_DISPAYID = 0x4C,
|
||||
DEMO_DP_2_1_TX_ADAPTIVESYNC = 0x4D,
|
||||
DEMO_DP_2_1_RX_ADAPTIVESYNC = 0x4E,
|
||||
DEMO_DP_2_1_RX_LL_CTS = 0x4F,
|
||||
DEMO_DP_2_1_TX_LL_CTS = 0x50,
|
||||
DEMO_DP_2_1_RX_LTTPR_CTS = 0x51,
|
||||
DEMO_DP_2_1_TX_LTTPR_CTS = 0x52,
|
||||
DEMO_DP_2_1_RX_DSC_CTS = 0x53,
|
||||
DEMO_DP_2_1_TX_DSC_CTS = 0x54,
|
||||
DP_2_1_BRANCH_MST_CTS = 0x55,
|
||||
HDMI_TIMINGS_TEST_SUIT = 0x59,
|
||||
DP_TIMINGS_TEST_SUIT = 0x5A,
|
||||
PIXEL_VIDEO_TEST = 0x3E8
|
||||
HDR10_TEST = -2
|
||||
|
||||
|
||||
@@ -2,9 +2,7 @@ from typing import List
|
||||
from ctypes import c_uint64, c_uint32, c_uint8
|
||||
from enum import IntEnum
|
||||
|
||||
from UniTAP.libs.lib_tsi.tsi_types import TSI_R_MEMORY_SIZE, TSI_MEMORY_LAYOUT,\
|
||||
TSI_MEMORY_BLOCK_INDEX, TSI_MEMORY_RESET_W, TSI_MEMORY_WRITE_W
|
||||
from UniTAP.libs.lib_tsi.tsi import TSIX_TS_GetConfigItem, TSIX_TS_SetConfigItem
|
||||
import UniTAP.libs.lib_tsi.tsi_types as ci
|
||||
from UniTAP.libs.lib_tsi.tsi_io import DeviceIO
|
||||
|
||||
|
||||
@@ -16,31 +14,31 @@ class MemoryManager:
|
||||
|
||||
MAX_BLOCK_COUNT = 4
|
||||
|
||||
DEFAULT_MEMOTY_ALLOCATION = [534600704, 534600704, 534600704]
|
||||
DEFAULT_MEMOTY_ALLOCATION = [534600704, 534600704, 2048]
|
||||
RESERVED_MEMORY_BYTES = 8192 * (5120 + 1) * 4 + 0x80000
|
||||
|
||||
def __init__(self, io: DeviceIO):
|
||||
self.__io = io
|
||||
|
||||
def get_total_memory(self) -> int:
|
||||
result = self.__io.get(TSI_R_MEMORY_SIZE, c_uint64)[1]
|
||||
result = self.__io.get(ci.TSI_R_MEMORY_SIZE, c_uint64)[1]
|
||||
return result
|
||||
|
||||
def set_memory_layout(self, layout: List[int]):
|
||||
self.__io.set(TSI_MEMORY_LAYOUT, layout, c_uint64, data_count=len(layout))
|
||||
self.__io.set(ci.TSI_MEMORY_LAYOUT, layout, c_uint64, data_count=len(layout))
|
||||
|
||||
def get_memory_layout(self) -> List[int]:
|
||||
return self.__io.get(TSI_MEMORY_LAYOUT, c_uint64, self.MAX_BLOCK_COUNT)
|
||||
return list(self.__io.get(ci.TSI_MEMORY_LAYOUT, c_uint64, self.MAX_BLOCK_COUNT)[1])
|
||||
|
||||
def set_memory_block_index(self, index: MemoryOwner):
|
||||
self.__io.set(TSI_MEMORY_BLOCK_INDEX, index.value)
|
||||
self.__io.set(ci.TSI_MEMORY_BLOCK_INDEX, index.value)
|
||||
|
||||
def make_default(self):
|
||||
self.__io.set(TSI_MEMORY_LAYOUT, self.DEFAULT_MEMOTY_ALLOCATION, c_uint64,
|
||||
self.__io.set(ci.TSI_MEMORY_LAYOUT, self.DEFAULT_MEMOTY_ALLOCATION, c_uint64,
|
||||
data_count=len(self.DEFAULT_MEMOTY_ALLOCATION))
|
||||
|
||||
def reset(self):
|
||||
self.__io.set(TSI_MEMORY_RESET_W, 0)
|
||||
self.__io.set(ci.TSI_MEMORY_RESET_W, 0)
|
||||
|
||||
def memory_write(self, data, size):
|
||||
self.__io.set(TSI_MEMORY_WRITE_W, bytearray(data), data_type=c_uint8, data_count=size)
|
||||
self.__io.set(ci.TSI_MEMORY_WRITE_W, bytearray(data), data_type=c_uint8, data_count=size)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import platform
|
||||
import warnings
|
||||
|
||||
from UniTAP.libs.lib_tsi.tsi_types import TSI_OPF_CALLBACK_STRUCT, TSI_OPF_RETURN_CODE_ABORT
|
||||
import UniTAP.libs.lib_tsi.tsi_types as ci
|
||||
from UniTAP.libs.lib_tsi.tsi_io import DeviceIO
|
||||
from UniTAP.utils import tsi_logging as logging
|
||||
from .handlers import OpfHandlerBase, OpfHandlerDefault
|
||||
@@ -9,11 +9,11 @@ from .handlers import OpfHandlerBase, OpfHandlerDefault
|
||||
if platform.system() == 'Windows':
|
||||
from ctypes import c_int, POINTER, c_void_p, WINFUNCTYPE
|
||||
|
||||
OPF_CALLBACK_TYPE = WINFUNCTYPE(c_int, POINTER(TSI_OPF_CALLBACK_STRUCT), c_void_p)
|
||||
OPF_CALLBACK_TYPE = WINFUNCTYPE(c_int, POINTER(ci.TSI_OPF_CALLBACK_STRUCT), c_void_p)
|
||||
else:
|
||||
from ctypes import c_int, POINTER, c_void_p, CFUNCTYPE
|
||||
|
||||
OPF_CALLBACK_TYPE = CFUNCTYPE(c_int, POINTER(TSI_OPF_CALLBACK_STRUCT), c_void_p)
|
||||
OPF_CALLBACK_TYPE = CFUNCTYPE(c_int, POINTER(ci.TSI_OPF_CALLBACK_STRUCT), c_void_p)
|
||||
|
||||
|
||||
class OperatorFeedbackHandler:
|
||||
@@ -33,8 +33,8 @@ class OperatorFeedbackHandler:
|
||||
self.__handler = OpfHandlerDefault()
|
||||
|
||||
def __get_callback(self):
|
||||
def ofp_impl(_struct: POINTER(TSI_OPF_CALLBACK_STRUCT), context_ptr: c_void_p):
|
||||
opf_struct: TSI_OPF_CALLBACK_STRUCT = _struct.contents
|
||||
def ofp_impl(_struct: POINTER(ci.TSI_OPF_CALLBACK_STRUCT), context_ptr: c_void_p):
|
||||
opf_struct: ci.TSI_OPF_CALLBACK_STRUCT = _struct.contents
|
||||
logging.debug(f"Received OPF dialog with ID: {opf_struct.id()}, Session: {opf_struct.session_id()}.")
|
||||
|
||||
try:
|
||||
@@ -46,7 +46,7 @@ class OperatorFeedbackHandler:
|
||||
opf_struct.parameters())
|
||||
except BaseException as e:
|
||||
warnings.warn(f"OPF Dialog {opf_struct.id()} was aborted due an exception. Exception: {e}")
|
||||
return opf_struct.write_opf_result(TSI_OPF_RETURN_CODE_ABORT)
|
||||
return opf_struct.write_opf_result(ci.TSI_OPF_RETURN_CODE_ABORT)
|
||||
|
||||
return ofp_impl
|
||||
|
||||
|
||||
@@ -30,6 +30,9 @@ class OpfHandlerInternal(OpfHandlerBase):
|
||||
19: OPFFunctions.opf_19_handler,
|
||||
20: OPFFunctions.opf_20_handler,
|
||||
21: OPFFunctions.opf_21_handler,
|
||||
22: OPFFunctions.opf_22_handler,
|
||||
23: OPFFunctions.opf_23_handler,
|
||||
24: OPFFunctions.opf_24_handler,
|
||||
101: OPFFunctions.opf_101_handler,
|
||||
102: OPFFunctions.opf_102_handler,
|
||||
103: OPFFunctions.opf_103_handler,
|
||||
@@ -37,6 +40,7 @@ class OpfHandlerInternal(OpfHandlerBase):
|
||||
105: OPFFunctions.opf_105_handler,
|
||||
106: OPFFunctions.opf_106_handler,
|
||||
107: OPFFunctions.opf_107_handler,
|
||||
108: OPFFunctions.opf_108_handler,
|
||||
120: OPFFunctions.opf_120_handler,
|
||||
121: OPFFunctions.opf_121_handler,
|
||||
122: OPFFunctions.opf_122_handler,
|
||||
@@ -47,6 +51,8 @@ class OpfHandlerInternal(OpfHandlerBase):
|
||||
143: OPFFunctions.opf_143_handler,
|
||||
144: OPFFunctions.opf_144_handler,
|
||||
145: OPFFunctions.opf_145_handler,
|
||||
146: OPFFunctions.opf_146_handler,
|
||||
147: OPFFunctions.opf_147_handler,
|
||||
150: OPFFunctions.opf_150_handler,
|
||||
161: OPFFunctions.opf_161_handler
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import copy
|
||||
import math
|
||||
import re
|
||||
import threading
|
||||
import time
|
||||
@@ -17,22 +18,19 @@ from UniTAP.utils.function_wrapper import function_scheduler
|
||||
from UniTAP.libs.lib_dscl.dscl import DSC_TOOLS_FOLDER, DSCL_ExtractPPSFromData, DSCL_Encode, DSCL_Decode
|
||||
from UniTAP.libs.lib_dscl.dscl_utils import calculate_slice_size, dscl_image_to_dsc_vf
|
||||
from UniTAP.libs.lib_pdl.pdl import generate_pattern_as_vf, PatternType
|
||||
from UniTAP.libs.lib_tsi.tsi_types import TSI_MEMORY_WRITE_W, TSI_MEMORY_BLOCK_INDEX, TSI_MEMORY_LAYOUT, \
|
||||
TSI_DP20_SINKCTS_SUPPORT_444CRC, TSI_DP14_SINKCTS_SUPPORT_444CRC
|
||||
from UniTAP.libs.lib_tsi.tsi_private_types import TSI_DSC_MEMORY_BLOCK, TSI_DSC_DATA_SIZE, \
|
||||
TSI_DSC_TX_CRC, TSI_DPRX_DSC_TEST_CRC, TSI_SELECT_SUITE
|
||||
from UniTAP.libs.lib_tsi.tsi import TSIX_TS_SetConfigItem, TSIX_TS_GetConfigItem
|
||||
import UniTAP.libs.lib_tsi.tsi as tsi
|
||||
from ctypes import c_uint64, c_uint32
|
||||
from UniTAP.libs.lib_tsi import TSI_OPF_RETURN_CODE_ABORT, TSI_OPF_RETURN_CODE_PASS, \
|
||||
TSI_OPF_RETURN_CODE_PROCEED, TSI_OPF_RETURN_CODE_FAIL, TSI_OPF_RETURN_CODE_AUTO_CLOSED
|
||||
|
||||
import UniTAP.libs.lib_tsi.tsi_private_types as p_ci
|
||||
import UniTAP.libs.lib_tsi.tsi_types as ci
|
||||
|
||||
|
||||
class OPFDialogAnswer(IntEnum):
|
||||
ABORT = TSI_OPF_RETURN_CODE_ABORT
|
||||
PASS = TSI_OPF_RETURN_CODE_PASS
|
||||
PROCEED = TSI_OPF_RETURN_CODE_PROCEED
|
||||
FAIL = TSI_OPF_RETURN_CODE_FAIL
|
||||
NOTHING = TSI_OPF_RETURN_CODE_AUTO_CLOSED
|
||||
ABORT = ci.TSI_OPF_RETURN_CODE_ABORT
|
||||
PASS = ci.TSI_OPF_RETURN_CODE_PASS
|
||||
PROCEED = ci.TSI_OPF_RETURN_CODE_PROCEED
|
||||
FAIL = ci.TSI_OPF_RETURN_CODE_FAIL
|
||||
NOTHING = ci.TSI_OPF_RETURN_CODE_AUTO_CLOSED
|
||||
|
||||
|
||||
class OPFFunctions:
|
||||
@@ -113,7 +111,7 @@ class OPFFunctions:
|
||||
def check_video(dev_rx) -> bool:
|
||||
def is_video_available(_dev_rx):
|
||||
return _dev_rx.link.status.stream(0).crc != [0, 0, 0] and \
|
||||
_dev_rx.link.status.stream(0).video_mode.timing.hactive != 0
|
||||
_dev_rx.link.status.stream(0).video_mode.timing.hactive != 0
|
||||
|
||||
return function_scheduler(is_video_available, dev_rx, interval=2, timeout=10)
|
||||
|
||||
@@ -380,7 +378,16 @@ class OPFFunctions:
|
||||
for i in range(iterations):
|
||||
|
||||
vf = capture_frame(dprx)
|
||||
vf = video_frame_to_ci(vf, vf.color_info, OPFFunctions.g_vf.data_info)
|
||||
|
||||
if OPFFunctions.g_vf is None:
|
||||
data_info = DataInfo()
|
||||
data_info.packing = DataInfo.Packing.P_PACKED
|
||||
data_info.component_order = DataInfo.ComponentOrder.CO_RGB
|
||||
data_info.alignment = DataInfo.Alignment.A_LSB
|
||||
else:
|
||||
data_info = OPFFunctions.g_vf.data_info
|
||||
|
||||
vf = video_frame_to_ci(vf, vf.color_info, data_info)
|
||||
|
||||
if vf is not None and len(vf.data) > 0:
|
||||
if OPFFunctions.g_vf is not None:
|
||||
@@ -390,11 +397,88 @@ class OPFFunctions:
|
||||
else:
|
||||
if OPFFunctions.g_vf.data in vf.data:
|
||||
return OPFDialogAnswer.PASS
|
||||
else:
|
||||
return OPFDialogAnswer.PASS
|
||||
|
||||
return OPFDialogAnswer.FAIL
|
||||
|
||||
@staticmethod
|
||||
def opf_13_handler(dptx, dprx, message: str) -> OPFDialogAnswer:
|
||||
return OPFFunctions.opf_pass_handler(dptx, dprx, message)
|
||||
audio_mode = dptx.ag.audio_mode
|
||||
|
||||
dptx.ag.setup(audio_mode, UniTAP.AudioPattern.SignalPing, 2000, 100)
|
||||
|
||||
if not dptx.ag.apply():
|
||||
return OPFDialogAnswer.FAIL
|
||||
|
||||
dprx.audio_capturer.start(m_sec=10000)
|
||||
dprx.audio_capturer.stop()
|
||||
|
||||
result = dprx.audio_capturer.capture_result
|
||||
|
||||
sample_size_bytes = int(math.ceil(result.audio_mode.bits / 8))
|
||||
|
||||
samples = {}
|
||||
for channel in range(result.audio_mode.channel_count):
|
||||
samples[channel] = []
|
||||
|
||||
for frame in result.buffer:
|
||||
frame: UniTAP.AudioFrameData
|
||||
sample_per_channel = int(len(frame.data) / sample_size_bytes / result.audio_mode.channel_count)
|
||||
|
||||
for sample_index in range(sample_per_channel):
|
||||
for channel in range(result.audio_mode.channel_count):
|
||||
sample_offset = (sample_index * sample_size_bytes * result.audio_mode.channel_count) + (
|
||||
channel * sample_size_bytes)
|
||||
sample_value = int.from_bytes(frame.data[sample_offset:sample_offset + sample_size_bytes], "little",
|
||||
signed=True)
|
||||
samples[channel].append(sample_value)
|
||||
|
||||
logging.info(f"Total samples per channel 0: {len(samples[0])}")
|
||||
|
||||
def find_next_transition(start_pos: int, sample_list: list):
|
||||
for pos in range(start_pos + 1, len(sample_list) - 1):
|
||||
previous_value = sample_list[pos - 1]
|
||||
current_value = sample_list[pos]
|
||||
next_value = sample_list[pos + 1]
|
||||
|
||||
if previous_value == 0 and current_value == 0 and next_value != 0:
|
||||
return "burst", pos + 1
|
||||
elif previous_value != 0 and current_value == 0 and next_value == 0:
|
||||
return "silence", pos + 1
|
||||
|
||||
return None, -1
|
||||
|
||||
transition_type, transition_pos = find_next_transition(0, samples[0])
|
||||
if transition_type is None:
|
||||
logging.warn("OPF 13: No transitions were found. Audio may be invalid.")
|
||||
return OPFDialogAnswer.FAIL
|
||||
|
||||
#
|
||||
# Cut beginning of captured data to start exactly with transition.
|
||||
#
|
||||
samples[0] = samples[0][transition_pos:]
|
||||
chunk_info_list = []
|
||||
transition_pos = 0
|
||||
while (t_info := find_next_transition(transition_pos, samples[0])) != (None, -1):
|
||||
chuck_size = t_info[1] - transition_pos + 1
|
||||
chunk_length_ms = int(chuck_size / result.audio_mode.sample_rate * 1000)
|
||||
logging.info(f"Chuck size: {chuck_size}")
|
||||
logging.info(f"Chuck length: {chunk_length_ms}ms")
|
||||
|
||||
chunk_info_list.append((t_info[0], chuck_size, chunk_length_ms))
|
||||
|
||||
transition_pos = t_info[1]
|
||||
|
||||
valid = True
|
||||
for chunk in chunk_info_list:
|
||||
if chunk[2] not in range(245, 255):
|
||||
valid = False
|
||||
break
|
||||
logging.info(f"Chunk validation: {'PASS' if valid else 'FAIL'}")
|
||||
logging.info(f"Chunks: {chunk_info_list}")
|
||||
|
||||
return OPFDialogAnswer.PASS if valid else OPFDialogAnswer.FAIL
|
||||
|
||||
@staticmethod
|
||||
def opf_14_handler(dptx, dprx, message: str) -> OPFDialogAnswer:
|
||||
@@ -553,10 +637,10 @@ class OPFFunctions:
|
||||
|
||||
try:
|
||||
if not OPFFunctions.check_video(dprx):
|
||||
print('Video is not available.')
|
||||
logging.error('Video is not available.')
|
||||
return OPFDialogAnswer.ABORT
|
||||
except BaseException as e:
|
||||
print(e)
|
||||
logging.error(e)
|
||||
return OPFDialogAnswer.ABORT
|
||||
|
||||
return OPFDialogAnswer.PROCEED
|
||||
@@ -582,16 +666,10 @@ class OPFFunctions:
|
||||
def opf_19_handler(dptx, dprx, use_3tap) -> OPFDialogAnswer:
|
||||
|
||||
if not OPFFunctions.check_dprx(dprx):
|
||||
return OPFDialogAnswer.ABORT
|
||||
return OPFDialogAnswer.FAIL
|
||||
|
||||
# check DSC state
|
||||
if not dprx.link.capabilities.link_caps_status().dsc:
|
||||
return OPFDialogAnswer.ABORT
|
||||
|
||||
incorrect_crc = [0xFFFF, 0xFFFF, 0xFFFF, 0x1111, 0x1111, 0x1111]
|
||||
|
||||
def load_dsc(handle: int, values: list) -> OPFDialogAnswer:
|
||||
TSIX_TS_SetConfigItem(handle, TSI_DPRX_DSC_TEST_CRC, values, data_count=6)
|
||||
return OPFDialogAnswer.FAIL
|
||||
|
||||
# TODO: Need to change on public interface. Temporary solution.
|
||||
@@ -599,140 +677,153 @@ class OPFFunctions:
|
||||
__getattribute__('_MemoryManager__io'). \
|
||||
__getattribute__('device_handle')
|
||||
|
||||
iterations = 5
|
||||
|
||||
for i in range(iterations):
|
||||
# capture frame
|
||||
try:
|
||||
dprx.video_capturer.start(frames_count=1)
|
||||
vf = dprx.video_capturer.capture_result.buffer[-1]
|
||||
dprx.video_capturer.stop()
|
||||
except BaseException:
|
||||
dprx.video_capturer.stop()
|
||||
return load_dsc(device_handle, incorrect_crc)
|
||||
|
||||
def create_reference_image(video_frame, crc_values: list):
|
||||
try:
|
||||
pps_info = DSCL_ExtractPPSFromData(video_frame.data)
|
||||
except BaseException:
|
||||
return
|
||||
|
||||
sampling = UICL_Sampling.Sampling_444
|
||||
if pps_info.is_yuv():
|
||||
if pps_info.is_420():
|
||||
sampling = UICL_Sampling.Sampling_420
|
||||
elif pps_info.is_422():
|
||||
sampling = UICL_Sampling.Sampling_422
|
||||
elif pps_info.is_simple_422():
|
||||
sampling = UICL_Sampling.Sampling_422
|
||||
|
||||
image = UICL_Image()
|
||||
parameters = UICL_ImageParameters()
|
||||
parameters.Width = pps_info.width()
|
||||
parameters.Height = pps_info.height()
|
||||
parameters.BitsPerColor = pps_info.bpc()
|
||||
parameters.Alignment = UICL_Alignment.Alignment_LSB
|
||||
parameters.IsFullRange = False
|
||||
|
||||
if pps_info.is_yuv():
|
||||
parameters.Colorspace = UICL_Colorspace.Colorspace_YCbCr
|
||||
parameters.Colorimetry = UICL_Colorimetry.Colorimetry_ITU_R_BT709
|
||||
parameters.Sampling = sampling
|
||||
parameters.ComponentOrder = UICL_ComponentOrder.Order_YCbCr
|
||||
parameters.Packing = UICL_Packing.Packing_Planar
|
||||
image.Parameters = parameters
|
||||
|
||||
try:
|
||||
image.DataSize = UICL_GetRequiredBufferSize(image)
|
||||
image.DataPtr = (c_uint8 * image.DataSize)()
|
||||
if use_3tap:
|
||||
res = UICL_GeneratePattern_3Tap(image, 1)
|
||||
else:
|
||||
res = UICL_GeneratePattern(image, 1)
|
||||
|
||||
if res < UICL_SUCCESS:
|
||||
return
|
||||
|
||||
except BaseException:
|
||||
return
|
||||
else:
|
||||
parameters.Colorspace = UICL_Colorspace.Colorspace_RGB
|
||||
parameters.Colorimetry = UICL_Colorimetry.Colorimetry_Unknown
|
||||
parameters.Sampling = sampling
|
||||
parameters.ComponentOrder = UICL_ComponentOrder.Order_RGB
|
||||
parameters.Packing = UICL_Packing.Packing_Packed
|
||||
image.Parameters = parameters
|
||||
|
||||
try:
|
||||
image.DataSize = UICL_GetRequiredBufferSize(image)
|
||||
image.DataPtr = (c_uint8 * image.DataSize)()
|
||||
if use_3tap:
|
||||
res = UICL_GeneratePattern_3Tap(image, 0)
|
||||
else:
|
||||
res = UICL_GeneratePattern(image, 0)
|
||||
|
||||
if res < UICL_SUCCESS:
|
||||
return
|
||||
|
||||
except BaseException:
|
||||
return
|
||||
|
||||
dsc_encoded_image = DSCL_Encode(image, pps_info)
|
||||
OPFFunctions.g_vf = dscl_image_to_dsc_vf(dsc_encoded_image)
|
||||
dsc_decoded_uicl_image = DSCL_Decode(dsc_encoded_image)
|
||||
|
||||
reference_image_crc = UICL_CRC16()
|
||||
try:
|
||||
res = UICL_CalculateCRC16(dsc_decoded_uicl_image, reference_image_crc)
|
||||
if res < UICL_SUCCESS:
|
||||
crc_values.extend([0xFFFF, 0xFFFF, 0xFFFF])
|
||||
else:
|
||||
crc_values.extend([reference_image_crc.R, reference_image_crc.G, reference_image_crc.B])
|
||||
except BaseException:
|
||||
return
|
||||
|
||||
def decompress_dsc(video_frame, crc_values: list):
|
||||
decoded_captured_vf = decode_video_frame(video_frame)
|
||||
uicl_decoded_image_2 = image_from_vf(decoded_captured_vf)
|
||||
decompressed_image_crc = UICL_CRC16()
|
||||
try:
|
||||
res = UICL_CalculateCRC16(uicl_decoded_image_2, decompressed_image_crc)
|
||||
if res < UICL_SUCCESS:
|
||||
crc_values.extend([0x1111, 0x1111, 0x1111])
|
||||
else:
|
||||
crc_values.extend([decompressed_image_crc.R, decompressed_image_crc.G,
|
||||
decompressed_image_crc.B])
|
||||
except BaseException:
|
||||
return
|
||||
|
||||
reference_image_crc_values = []
|
||||
decompressed_image_crc_values = []
|
||||
|
||||
thread_create_reference_image = threading.Thread(target=create_reference_image,
|
||||
args=(vf, reference_image_crc_values))
|
||||
thread_decompressed_image = threading.Thread(target=decompress_dsc,
|
||||
args=(vf, decompressed_image_crc_values))
|
||||
|
||||
thread_create_reference_image.start()
|
||||
thread_decompressed_image.start()
|
||||
|
||||
thread_create_reference_image.join()
|
||||
thread_decompressed_image.join()
|
||||
|
||||
if len(reference_image_crc_values) > 0 and len(decompressed_image_crc_values) > 0 and \
|
||||
((reference_image_crc_values == decompressed_image_crc_values) or
|
||||
(reference_image_crc_values != decompressed_image_crc_values and (i == iterations - 1))):
|
||||
# Write crc to register
|
||||
load_dsc(device_handle, [decompressed_image_crc_values[0],
|
||||
decompressed_image_crc_values[1],
|
||||
decompressed_image_crc_values[2],
|
||||
reference_image_crc_values[0],
|
||||
reference_image_crc_values[1],
|
||||
reference_image_crc_values[2]])
|
||||
|
||||
def upload_dut_and_te_crc(handle: int, values: list) -> OPFDialogAnswer:
|
||||
if tsi.TSIX_TS_SetConfigItem(handle, p_ci.TSI_DPRX_DSC_TEST_CRC, values, data_count=6) > ci.TSI_SUCCESS:
|
||||
return OPFDialogAnswer.PROCEED
|
||||
else:
|
||||
return OPFDialogAnswer.FAIL
|
||||
|
||||
return load_dsc(device_handle, incorrect_crc)
|
||||
def create_reference_image(video_frame, crc_value: list):
|
||||
try:
|
||||
pps_info = DSCL_ExtractPPSFromData(video_frame.data)
|
||||
except BaseException:
|
||||
return
|
||||
|
||||
sampling = UICL_Sampling.Sampling_444
|
||||
if pps_info.is_yuv():
|
||||
if pps_info.is_420():
|
||||
sampling = UICL_Sampling.Sampling_420
|
||||
elif pps_info.is_422():
|
||||
sampling = UICL_Sampling.Sampling_422
|
||||
elif pps_info.is_simple_422():
|
||||
sampling = UICL_Sampling.Sampling_422
|
||||
|
||||
image = UICL_Image()
|
||||
parameters = UICL_ImageParameters()
|
||||
parameters.Width = pps_info.width()
|
||||
parameters.Height = pps_info.height()
|
||||
parameters.BitsPerColor = pps_info.bpc()
|
||||
parameters.Alignment = UICL_Alignment.Alignment_LSB
|
||||
parameters.IsFullRange = False
|
||||
|
||||
if pps_info.is_yuv():
|
||||
parameters.Colorspace = UICL_Colorspace.Colorspace_YCbCr
|
||||
parameters.Colorimetry = UICL_Colorimetry.Colorimetry_ITU_R_BT709
|
||||
parameters.Sampling = sampling
|
||||
parameters.ComponentOrder = UICL_ComponentOrder.Order_YCbCr
|
||||
parameters.Packing = UICL_Packing.Packing_Planar
|
||||
image.Parameters = parameters
|
||||
|
||||
try:
|
||||
image.DataSize = UICL_GetRequiredBufferSize(image)
|
||||
image.DataPtr = (c_uint8 * image.DataSize)()
|
||||
if use_3tap:
|
||||
res = UICL_GeneratePattern_3Tap(image, 1)
|
||||
else:
|
||||
res = UICL_GeneratePattern(image, 1)
|
||||
|
||||
if res < UICL_SUCCESS:
|
||||
return
|
||||
|
||||
except BaseException:
|
||||
return
|
||||
else:
|
||||
parameters.Colorspace = UICL_Colorspace.Colorspace_RGB
|
||||
parameters.Colorimetry = UICL_Colorimetry.Colorimetry_Unknown
|
||||
parameters.Sampling = sampling
|
||||
parameters.ComponentOrder = UICL_ComponentOrder.Order_RGB
|
||||
parameters.Packing = UICL_Packing.Packing_Packed
|
||||
image.Parameters = parameters
|
||||
|
||||
try:
|
||||
image.DataSize = UICL_GetRequiredBufferSize(image)
|
||||
image.DataPtr = (c_uint8 * image.DataSize)()
|
||||
if use_3tap:
|
||||
res = UICL_GeneratePattern_3Tap(image, 0)
|
||||
else:
|
||||
res = UICL_GeneratePattern(image, 0)
|
||||
|
||||
if res < UICL_SUCCESS:
|
||||
return
|
||||
|
||||
except BaseException:
|
||||
return
|
||||
|
||||
dsc_encoded_image = DSCL_Encode(image, pps_info)
|
||||
OPFFunctions.g_vf = dscl_image_to_dsc_vf(dsc_encoded_image)
|
||||
dsc_decoded_uicl_image = DSCL_Decode(dsc_encoded_image)
|
||||
|
||||
reference_image_crc = UICL_CRC16()
|
||||
try:
|
||||
res = UICL_CalculateCRC16(dsc_decoded_uicl_image, reference_image_crc)
|
||||
if res >= UICL_SUCCESS:
|
||||
crc = [reference_image_crc.R, reference_image_crc.G, reference_image_crc.B]
|
||||
logging.info(f"TE successfully generated image from DUT's PPS and calculated CRC: {crc}")
|
||||
crc_value[:] = crc
|
||||
else:
|
||||
logging.error(f"TE failed to generate image from DUT's PPS without exception with error: {res}")
|
||||
except BaseException as exc:
|
||||
logging.error(f"TE failed to generated image fro DUT's PPS due an exception: {exc}")
|
||||
|
||||
def decompress_dsc(video_frame, crc_value: list):
|
||||
decoded_captured_vf = decode_video_frame(video_frame)
|
||||
uicl_decoded_image_2 = image_from_vf(decoded_captured_vf)
|
||||
decompressed_image_crc = UICL_CRC16()
|
||||
try:
|
||||
res = UICL_CalculateCRC16(uicl_decoded_image_2, decompressed_image_crc)
|
||||
if res >= UICL_SUCCESS:
|
||||
crc = [decompressed_image_crc.R, decompressed_image_crc.G, decompressed_image_crc.B]
|
||||
logging.info(f"DUT's DSC CRC successfully calculated: {crc}")
|
||||
crc_value[:] = crc
|
||||
else:
|
||||
logging.error(f"DUT's DSC CRC calculation failed, without exception: {res}")
|
||||
except BaseException as exc:
|
||||
logging.error(f"Failed to decompress DUT's DSC image due an exception: {exc}")
|
||||
|
||||
reference_image_crc_values = [0x0BAD, 0x0BAD, 0x0BAD]
|
||||
decompressed_image_crc_values = [0xBAD0, 0xBAD0, 0xBAD0]
|
||||
max_frames_to_validate = 5
|
||||
|
||||
try:
|
||||
dprx.video_capturer.start()
|
||||
|
||||
for frame_idx in range(1, max_frames_to_validate + 1):
|
||||
try:
|
||||
logging.info(f"Iteration {frame_idx}. Start frame capturing.")
|
||||
frame = dprx.video_capturer.pop_element()
|
||||
|
||||
thread_create_reference_image = threading.Thread(target=create_reference_image,
|
||||
args=(frame, reference_image_crc_values))
|
||||
thread_decompressed_image = threading.Thread(target=decompress_dsc,
|
||||
args=(frame, decompressed_image_crc_values))
|
||||
|
||||
thread_create_reference_image.start()
|
||||
thread_decompressed_image.start()
|
||||
|
||||
thread_create_reference_image.join()
|
||||
thread_decompressed_image.join()
|
||||
|
||||
if reference_image_crc_values == decompressed_image_crc_values:
|
||||
logging.info(f"Frame {frame_idx} is OK.")
|
||||
break
|
||||
else:
|
||||
te_crc_str = [f"0x{value:04X}" for value in reference_image_crc_values]
|
||||
dut_crc_str = [f"0x{value:04X}" for value in decompressed_image_crc_values]
|
||||
logging.info(f"Frame {frame_idx} is NOT OK. "
|
||||
f"TE CRC: {te_crc_str}. "
|
||||
f"DUT CRC: {dut_crc_str}.")
|
||||
|
||||
except BaseException as exception:
|
||||
logging.error(f"Frame {frame_idx} is NOT OK. Exception: {exception}")
|
||||
|
||||
except BaseException as exc:
|
||||
logging.error(f"Failed to process OPF 19 due an exception: {exc}")
|
||||
finally:
|
||||
dprx.video_capturer.stop()
|
||||
logging.info(f"Capturing has been stopped.")
|
||||
combined_crc_list = decompressed_image_crc_values + reference_image_crc_values
|
||||
logging.info("OPF 19 finished.")
|
||||
return upload_dut_and_te_crc(device_handle, combined_crc_list)
|
||||
|
||||
@staticmethod
|
||||
def opf_20_handler(dptx, dprx, res_x, res_y, res_frate, res_bpc, col_format, col_range, col_yc, tim_std,
|
||||
@@ -742,6 +833,14 @@ class OPFFunctions:
|
||||
|
||||
logging.info((res_x, res_y, res_frate, res_bpc, col_format, col_range, col_yc, tim_std, pattern_name))
|
||||
|
||||
if res_x == 0 and res_y == 0:
|
||||
logging.info("Received request to disable PG.")
|
||||
dptx.pg.set_pattern(pattern=UniTAP.VideoPattern.Disabled)
|
||||
res = dptx.pg.apply()
|
||||
logging.info(f"PG perform apply. Success: {res}.")
|
||||
|
||||
return UniTAP.OPFDialogAnswer.PASS if res else UniTAP.OPFDialogAnswer.FAIL
|
||||
|
||||
if pattern_name is not None:
|
||||
if pattern_name == 'No Video':
|
||||
pattern_name = VideoPattern.Disabled
|
||||
@@ -812,7 +911,7 @@ class OPFFunctions:
|
||||
audio_mode.bits = sample_size
|
||||
audio_mode.sample_rate = sample_freq
|
||||
audio_pattern_value = UniTAP.AudioPattern.SignalSawtooth if audio_pattern.find("Sawtooth") != -1 else (
|
||||
UniTAP.AudioPattern.SignalSine)
|
||||
UniTAP.AudioPattern.SignalSine)
|
||||
|
||||
dptx.ag.setup(audio_mode=audio_mode,
|
||||
audio_pattern=audio_pattern_value,
|
||||
@@ -823,6 +922,18 @@ class OPFFunctions:
|
||||
return OPFDialogAnswer.ABORT
|
||||
return OPFDialogAnswer.PROCEED
|
||||
|
||||
@staticmethod
|
||||
def opf_22_handler(dptx, dprx, message: str) -> OPFDialogAnswer:
|
||||
return OPFDialogAnswer.PROCEED
|
||||
|
||||
@staticmethod
|
||||
def opf_23_handler(dptx, dprx, message: str) -> OPFDialogAnswer:
|
||||
return OPFDialogAnswer.PROCEED
|
||||
|
||||
@staticmethod
|
||||
def opf_24_handler(dptx, dprx, message: str) -> OPFDialogAnswer:
|
||||
return OPFDialogAnswer.PROCEED
|
||||
|
||||
@staticmethod
|
||||
def opf_101_handler(dptx, dprx, message: str) -> OPFDialogAnswer:
|
||||
if not OPFFunctions.check_dprx(dprx):
|
||||
@@ -834,7 +945,7 @@ class OPFFunctions:
|
||||
return UniTAP.OPFDialogAnswer.PASS if len(
|
||||
dprx.audio_capturer.capture_result.buffer) > 0 else UniTAP.OPFDialogAnswer.FAIL
|
||||
except BaseException as e:
|
||||
print(f"Cannot capture audio. Error: {e}")
|
||||
logging.error(f"Cannot capture audio. Error: {e}")
|
||||
return UniTAP.OPFDialogAnswer.FAIL
|
||||
|
||||
@staticmethod
|
||||
@@ -894,7 +1005,7 @@ class OPFFunctions:
|
||||
if len(vf.data) > 0:
|
||||
return OPFDialogAnswer.PASS
|
||||
|
||||
return OPFDialogAnswer.FAIL
|
||||
return OPFDialogAnswer.FAIL
|
||||
|
||||
@staticmethod
|
||||
def opf_103_handler(dptx, dprx, width, height, rate, color_format, is_block_prediction_enabled, bpc,
|
||||
@@ -926,7 +1037,7 @@ class OPFFunctions:
|
||||
OPFFunctions.g_h_slice_size = h_slice_size
|
||||
OPFFunctions.g_v_slice_size = v_slice_size
|
||||
|
||||
res, suite_id = TSIX_TS_GetConfigItem(device_handle, TSI_SELECT_SUITE, c_uint32)
|
||||
res, suite_id = tsi.TSIX_TS_GetConfigItem(device_handle, p_ci.TSI_SELECT_SUITE, c_uint32)
|
||||
if res > 0:
|
||||
suite_id = TestGroupId(suite_id)
|
||||
else:
|
||||
@@ -936,10 +1047,12 @@ class OPFFunctions:
|
||||
try:
|
||||
if suite_id in [TestGroupId.DP_TX_LL_CTS, TestGroupId.DP_TX_LL_CTS_DSC,
|
||||
TestGroupId.DP_TX_DISPLAYID, TestGroupId.DP_TX_ADAPTIVESYNC]:
|
||||
res, is_simple_as_444 = TSIX_TS_GetConfigItem(device_handle, TSI_DP14_SINKCTS_SUPPORT_444CRC, c_uint32)
|
||||
res, is_simple_as_444 = tsi.TSIX_TS_GetConfigItem(device_handle, ci.TSI_DP14_SINKCTS_SUPPORT_444CRC,
|
||||
c_uint32)
|
||||
elif suite_id in [TestGroupId.DP_2_1_TX_LL_CTS, TestGroupId.DP_2_1_TX_DSC_CTS,
|
||||
TestGroupId.DP_2_1_TX_DISPAYID, TestGroupId.DP_2_1_TX_ADAPTIVESYNC]:
|
||||
res, is_simple_as_444 = TSIX_TS_GetConfigItem(device_handle, TSI_DP20_SINKCTS_SUPPORT_444CRC, c_uint32)
|
||||
res, is_simple_as_444 = tsi.TSIX_TS_GetConfigItem(device_handle, ci.TSI_DP20_SINKCTS_SUPPORT_444CRC,
|
||||
c_uint32)
|
||||
except BaseException as e:
|
||||
pass
|
||||
|
||||
@@ -964,18 +1077,18 @@ class OPFFunctions:
|
||||
|
||||
OPFFunctions.g_vm = copy.deepcopy(encoded_video_frame)
|
||||
|
||||
TSIX_TS_SetConfigItem(device_handle, TSI_MEMORY_LAYOUT, len(encoded_video_frame.data), c_uint64)
|
||||
TSIX_TS_SetConfigItem(device_handle, TSI_MEMORY_BLOCK_INDEX, 0, data_size=4)
|
||||
TSIX_TS_SetConfigItem(device_handle, TSI_MEMORY_WRITE_W, bytearray(encoded_video_frame.data),
|
||||
data_type=c_uint8,
|
||||
data_count=len(encoded_video_frame.data))
|
||||
TSIX_TS_SetConfigItem(device_handle, TSI_DSC_MEMORY_BLOCK, 0)
|
||||
TSIX_TS_SetConfigItem(device_handle, TSI_DSC_DATA_SIZE, len(encoded_video_frame.data))
|
||||
tsi.TSIX_TS_SetConfigItem(device_handle, ci.TSI_MEMORY_LAYOUT, len(encoded_video_frame.data), c_uint64)
|
||||
tsi.TSIX_TS_SetConfigItem(device_handle, ci.TSI_MEMORY_BLOCK_INDEX, 0, data_size=4)
|
||||
tsi.TSIX_TS_SetConfigItem(device_handle, ci.TSI_MEMORY_WRITE_W, bytearray(encoded_video_frame.data),
|
||||
data_type=c_uint8,
|
||||
data_count=len(encoded_video_frame.data))
|
||||
tsi.TSIX_TS_SetConfigItem(device_handle, p_ci.TSI_DSC_MEMORY_BLOCK, 0)
|
||||
tsi.TSIX_TS_SetConfigItem(device_handle, p_ci.TSI_DSC_DATA_SIZE, len(encoded_video_frame.data))
|
||||
|
||||
decoded_vf = decode_video_frame(encoded_video_frame)
|
||||
|
||||
crc0, crc1, crc2 = calculate_crc(decoded_vf)
|
||||
TSIX_TS_SetConfigItem(device_handle, TSI_DSC_TX_CRC, [crc0, crc1, crc2], data_count=3)
|
||||
tsi.TSIX_TS_SetConfigItem(device_handle, p_ci.TSI_DSC_TX_CRC, [crc0, crc1, crc2], data_count=3)
|
||||
|
||||
return OPFDialogAnswer.PROCEED
|
||||
|
||||
@@ -1020,14 +1133,17 @@ class OPFFunctions:
|
||||
vf.data[pps_size + slice_size:slice_size * 2]:
|
||||
return OPFDialogAnswer.PASS
|
||||
else:
|
||||
print(f"Frame {i + 1}: Image looks good and distortion free for slice #2. It is wrong.")
|
||||
logging.info(
|
||||
f"Frame {i + 1}: Image looks good and distortion free for slice #2. It is wrong.")
|
||||
else:
|
||||
print(
|
||||
logging.info(
|
||||
f"Frame {i + 1}: Image does not look good and distortion free for slice #4. It is wrong.")
|
||||
else:
|
||||
print(f"Frame {i + 1}: Image does not look good and distortion free for slice #3. It is wrong.")
|
||||
logging.info(
|
||||
f"Frame {i + 1}: Image does not look good and distortion free for slice #3. It is wrong.")
|
||||
else:
|
||||
print(f"Frame {i + 1}: Image does not look good and distortion free for slice #1. It is wrong.")
|
||||
logging.info(
|
||||
f"Frame {i + 1}: Image does not look good and distortion free for slice #1. It is wrong.")
|
||||
|
||||
return OPFDialogAnswer.FAIL
|
||||
|
||||
@@ -1043,6 +1159,66 @@ class OPFFunctions:
|
||||
def opf_107_handler(dptx, dprx, message: str) -> OPFDialogAnswer:
|
||||
return OPFFunctions.opf_pass_handler(dptx, dprx, message)
|
||||
|
||||
@staticmethod
|
||||
def opf_108_handler(dptx, dprx, *args) -> OPFDialogAnswer:
|
||||
if not OPFFunctions.check_dprx(dprx):
|
||||
return OPFDialogAnswer.ABORT
|
||||
|
||||
if len(args) == 4:
|
||||
audio_pattern, sample_rate, sample_size, ch_count = args
|
||||
else:
|
||||
audio_pattern, sample_rate, sample_size, ch_count = None, None, None, None
|
||||
|
||||
logging.info(audio_pattern, sample_rate, sample_size, ch_count)
|
||||
|
||||
try:
|
||||
dprx.audio_capturer.start(10)
|
||||
dprx.audio_capturer.stop()
|
||||
|
||||
if len(dprx.audio_capturer.capture_result.buffer) <= 0:
|
||||
logging.info("Audio buffer is empty")
|
||||
return UniTAP.OPFDialogAnswer.FAIL
|
||||
|
||||
if audio_pattern is None:
|
||||
logging.info("Default 108 OPF, check audio availability")
|
||||
return UniTAP.OPFDialogAnswer.PASS if len(dprx.audio_capturer.capture_result.buffer) > 0 else \
|
||||
UniTAP.OPFDialogAnswer.FAIL
|
||||
|
||||
def check_audio_frame(index, ch_count, sample_freq, sample_size) -> bool:
|
||||
|
||||
frame = dprx.audio_capturer.capture_result.buffer[index]
|
||||
_data = list(frame.data)
|
||||
length = len(_data)
|
||||
zero_count = _data.count(0)
|
||||
|
||||
is_only_zero = zero_count == length
|
||||
active_channel_count = OPFFunctions.get_active_channel_count(raw_data=frame.data,
|
||||
bit_depths=[frame.sample_size],
|
||||
channel_range=[frame.channel_count],
|
||||
expected_channels=ch_count
|
||||
)
|
||||
|
||||
logging.info(f"Frame index[{index}]: Len - {length}, Zero count - {zero_count}, "
|
||||
f"Reference channel count - {ch_count}, Captured active channel count - {active_channel_count}, "
|
||||
f"Reference sample rate - {sample_freq}, Captured sample rate - {frame.sample_rate}\n")
|
||||
return not is_only_zero and \
|
||||
active_channel_count == ch_count and \
|
||||
frame.sample_rate == sample_freq and \
|
||||
frame.sample_size == sample_size
|
||||
|
||||
buffer_len = len(dprx.audio_capturer.capture_result.buffer)
|
||||
|
||||
state = buffer_len > 0 and \
|
||||
(check_audio_frame(0, ch_count, sample_rate, sample_size) or
|
||||
check_audio_frame(int(buffer_len / 2), ch_count, sample_rate, sample_size) or
|
||||
check_audio_frame(buffer_len - 1, ch_count, sample_rate, sample_size))
|
||||
|
||||
return UniTAP.OPFDialogAnswer.PASS if state else UniTAP.OPFDialogAnswer.FAIL
|
||||
|
||||
except BaseException as e:
|
||||
logging.error(f"Cannot capture audio. Error: {e}")
|
||||
return UniTAP.OPFDialogAnswer.FAIL
|
||||
|
||||
@staticmethod
|
||||
def opf_120_handler(dptx, dprx, res_x, res_y, res_frate, res_bpc, color_format) -> OPFDialogAnswer:
|
||||
if not OPFFunctions.check_dprx(dprx):
|
||||
@@ -1256,6 +1432,38 @@ class OPFFunctions:
|
||||
else:
|
||||
return OPFDialogAnswer.ABORT
|
||||
|
||||
@staticmethod
|
||||
def opf_146_handler(dptx, dprx, res_x, res_y, rate):
|
||||
if not OPFFunctions.check_dptx(dptx):
|
||||
logging.error("DPTX is not initialized")
|
||||
return OPFDialogAnswer.ABORT
|
||||
|
||||
logging.info(res_x, res_y, rate)
|
||||
|
||||
return OPFDialogAnswer.PROCEED
|
||||
|
||||
@staticmethod
|
||||
def opf_147_handler(dptx, dprx, rate):
|
||||
if not OPFFunctions.check_dptx(dptx):
|
||||
logging.error("DPTX is not initialized")
|
||||
return OPFDialogAnswer.ABORT
|
||||
|
||||
logging.info(f"Refresh rate passed from OPF: {rate}")
|
||||
|
||||
dptx.pg.set_as_config(as_config=FixedASParams(refresh_rate=rate,
|
||||
divide_by_1_001=False,
|
||||
increase_lines=100,
|
||||
decrease_lines=100))
|
||||
res_pg = dptx.pg.apply()
|
||||
|
||||
if not res_pg:
|
||||
logging.info("DPTX pattern is not applied")
|
||||
return OPFDialogAnswer.ABORT
|
||||
|
||||
time.sleep(1)
|
||||
|
||||
return OPFDialogAnswer.PROCEED
|
||||
|
||||
@staticmethod
|
||||
def opf_150_handler(dptx, dprx, message: str) -> OPFDialogAnswer:
|
||||
return OPFFunctions.opf_pass_handler(dptx, dprx, message)
|
||||
@@ -1342,7 +1550,7 @@ class OPFFunctions:
|
||||
@staticmethod
|
||||
def check_dsc_content_library(*args):
|
||||
width, height, color_mode, is_block_prediction_enabled, bpc, bpp, h_slice_number, v_slice_number, \
|
||||
compression_info, dsc_v_major, dsc_v_minor, data_info = args
|
||||
compression_info, dsc_v_major, dsc_v_minor, data_info = args
|
||||
if OPFFunctions.dsc_content_library_path != "":
|
||||
if not os.path.exists(OPFFunctions.dsc_content_library_path):
|
||||
os.makedirs(OPFFunctions.dsc_content_library_path)
|
||||
@@ -1375,7 +1583,7 @@ class OPFFunctions:
|
||||
@staticmethod
|
||||
def get_compression_info(*args):
|
||||
v_slice_size, h_slice_size, bpp, color_mode, buffer_bit_depth, is_block_prediction_enabled, dsc_v_major, \
|
||||
dsc_v_minor, is_simple_as_444 = args
|
||||
dsc_v_minor, is_simple_as_444 = args
|
||||
|
||||
compression_info = CompressionInfo()
|
||||
compression_info.v_slice_size = v_slice_size
|
||||
@@ -1388,3 +1596,94 @@ class OPFFunctions:
|
||||
compression_info.is_simple_as_444 = is_simple_as_444
|
||||
|
||||
return compression_info
|
||||
|
||||
@staticmethod
|
||||
def read_pcm(raw_data, sample_size):
|
||||
"""
|
||||
Read raw PCM data from file into a list of int32 values.
|
||||
Handles 16, 20, and 24-bit samples (little-endian).
|
||||
"""
|
||||
if sample_size == 16:
|
||||
if len(raw_data) % 2 != 0:
|
||||
raise ValueError("File length not divisible by 2 for 16-bit audio")
|
||||
result = []
|
||||
for i in range(0, len(raw_data), 2):
|
||||
sample = int.from_bytes(raw_data[i:i + 2], byteorder='little', signed=True)
|
||||
result.append(sample)
|
||||
return result, 32767
|
||||
elif sample_size == 20 or sample_size == 24:
|
||||
if len(raw_data) % 3 != 0:
|
||||
raise ValueError("File length not divisible by 3 for 24/20-bit audio")
|
||||
result = []
|
||||
for i in range(0, len(raw_data), 3):
|
||||
val = (raw_data[i] |
|
||||
(raw_data[i + 1] << 8) |
|
||||
(raw_data[i + 2] << 16))
|
||||
sign_mask = 1 << 23
|
||||
val = (val & (sign_mask - 1)) - (val & sign_mask)
|
||||
result.append(val)
|
||||
return result, (1 << 23) - 1
|
||||
else:
|
||||
raise ValueError(f"Unsupported bit depth: {sample_size}")
|
||||
|
||||
@staticmethod
|
||||
def get_active_channel_count(raw_data, bit_depths: list, channel_range: list, expected_channels: int,
|
||||
rms_threshold=1e-3, nonzero_frac_threshold=1e-4):
|
||||
"""
|
||||
Try multiple bit depths and channel counts, report active channels.
|
||||
"""
|
||||
active_count = 0
|
||||
for bd in bit_depths:
|
||||
try:
|
||||
data, dtype_max = OPFFunctions.read_pcm(raw_data, bd)
|
||||
except Exception as e:
|
||||
logging.info(f"[{bd}-bit] Error: {e}")
|
||||
continue
|
||||
|
||||
logging.info(f"\n=== Testing bit depth {bd} ===")
|
||||
|
||||
for nch in [expected_channels] + [ch for ch in channel_range if ch != expected_channels]:
|
||||
if len(data) % nch != 0:
|
||||
logging.info(f"Skipping {nch} channels: data length {len(data)} not divisible by {nch}")
|
||||
continue
|
||||
frames = len(data) // nch
|
||||
|
||||
arr = []
|
||||
for f in range(frames):
|
||||
frame = data[f * nch:(f + 1) * nch]
|
||||
arr.append(frame)
|
||||
|
||||
rms = []
|
||||
peak = []
|
||||
nonzero_frac = []
|
||||
for ch in range(nch):
|
||||
channel_data = [arr[f][ch] for f in range(frames)]
|
||||
|
||||
mean_square = sum(x * x for x in channel_data) / frames
|
||||
rms.append(mean_square ** 0.5)
|
||||
|
||||
peak.append(max(abs(x) for x in channel_data))
|
||||
|
||||
nonzero_count = sum(1 for x in channel_data if x != 0)
|
||||
nonzero_frac.append(nonzero_count / frames)
|
||||
|
||||
norm_rms = [r / dtype_max for r in rms]
|
||||
norm_peak = [p / dtype_max for p in peak]
|
||||
|
||||
logging.info(f"\nAssuming {nch} channel(s):")
|
||||
channel_active_count = 0
|
||||
for ch in range(nch):
|
||||
active = (norm_rms[ch] > rms_threshold or
|
||||
nonzero_frac[ch] > nonzero_frac_threshold)
|
||||
if active:
|
||||
channel_active_count += 1
|
||||
logging.info(f" Ch{ch}: normRMS={norm_rms[ch]:.6f}, "
|
||||
f"normPeak={norm_peak[ch]:.6f}, "
|
||||
f"nonzero={nonzero_frac[ch]:.6f}, ACTIVE={active}")
|
||||
logging.info(f" => Detected {channel_active_count}/{nch} active channels")
|
||||
|
||||
if channel_active_count == expected_channels:
|
||||
active_count = channel_active_count
|
||||
break
|
||||
|
||||
return active_count
|
||||
|
||||
@@ -8,7 +8,7 @@ class OPFParametersParser:
|
||||
return parse_link_training(args[3])
|
||||
if opf_id in [2]:
|
||||
return parse_video_mode_2(args[3])
|
||||
if opf_id in [3, 4, 5, 7, 8, 11, 12, 13, 14, 15, 16, 17, 101, 102, 104, 105, 106, 121, 122, 123, 145, 150, 152, 161]:
|
||||
if opf_id in [3, 4, 5, 7, 8, 11, 12, 13, 14, 15, 16, 17, 22, 23, 24, 101, 102, 104, 105, 106, 121, 122, 123, 145, 150, 152, 161]:
|
||||
return parse_message(args[1])
|
||||
if opf_id in [6]:
|
||||
return parse_video_mode_6(args[1], args[3])
|
||||
@@ -26,6 +26,11 @@ class OPFParametersParser:
|
||||
return parse_opf_21(args[3])
|
||||
if opf_id in [103]:
|
||||
return parse_video_mode_103(args[3])
|
||||
if opf_id in [108]:
|
||||
if len(args) > 3:
|
||||
return parse_audio_mode_108(args[3])
|
||||
else:
|
||||
return parse_message(args[1])
|
||||
if opf_id in [120]:
|
||||
return parse_video_mode_120(args[3])
|
||||
if opf_id in [140]:
|
||||
@@ -38,6 +43,10 @@ class OPFParametersParser:
|
||||
return parse_video_mode_143(args[3])
|
||||
if opf_id in [144]:
|
||||
return parse_video_mode_144(args[3])
|
||||
if opf_id in [146]:
|
||||
return parse_video_mode_146(args[3])
|
||||
if opf_id in [147]:
|
||||
return parse_video_mode_147(args[3])
|
||||
if opf_id in [151]:
|
||||
return parse_video_mode_103(args[3])
|
||||
else:
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import re
|
||||
from typing import List, Optional
|
||||
|
||||
from UniTAP.libs.lib_tsi.tsi_types import TSI_OPF_PARAMETER
|
||||
import UniTAP.libs.lib_tsi.tsi_types as ci
|
||||
|
||||
|
||||
def parse_link_training(parameters_list: List[TSI_OPF_PARAMETER]):
|
||||
def parse_link_training(parameters_list: List[ci.TSI_OPF_PARAMETER]):
|
||||
dp_lanes = 0
|
||||
dp_link_rate = 0
|
||||
encoding = None
|
||||
@@ -29,7 +29,7 @@ def parse_link_training(parameters_list: List[TSI_OPF_PARAMETER]):
|
||||
return int(dp_lanes), float(dp_link_rate), encoding
|
||||
|
||||
|
||||
def parse_video_mode_2(parameters_list: List[TSI_OPF_PARAMETER]):
|
||||
def parse_video_mode_2(parameters_list: List[ci.TSI_OPF_PARAMETER]):
|
||||
res_x = 0
|
||||
res_y = 0
|
||||
res_frate = 0
|
||||
@@ -48,7 +48,7 @@ def parse_video_mode_2(parameters_list: List[TSI_OPF_PARAMETER]):
|
||||
return int(res_x), int(res_y), int(float(res_frate) * 1000), int(res_bpc), tim_std, tim_rb
|
||||
|
||||
|
||||
def parse_video_mode_6(pattern_request: str, parameters_list: List[TSI_OPF_PARAMETER]):
|
||||
def parse_video_mode_6(pattern_request: str, parameters_list: List[ci.TSI_OPF_PARAMETER]):
|
||||
res_x = 0
|
||||
res_y = 0
|
||||
res_frate = 0
|
||||
@@ -79,7 +79,7 @@ def parse_video_mode_6(pattern_request: str, parameters_list: List[TSI_OPF_PARAM
|
||||
res_bpc), timing_standard, col_format, col_range, col_yc, pattern_name
|
||||
|
||||
|
||||
def parse_video_mode_9(parameters_list: List[TSI_OPF_PARAMETER], pattern_request: Optional[str] = None):
|
||||
def parse_video_mode_9(parameters_list: List[ci.TSI_OPF_PARAMETER], pattern_request: Optional[str] = None):
|
||||
res_x = 0
|
||||
res_y = 0
|
||||
res_frate = 0
|
||||
@@ -101,7 +101,7 @@ def parse_video_mode_9(parameters_list: List[TSI_OPF_PARAMETER], pattern_request
|
||||
return int(res_x), int(res_y), int(float(res_frate) * 1000), int(res_bpc), tim_std, pattern_name
|
||||
|
||||
|
||||
def parse_opf_10(parameters_list: List[TSI_OPF_PARAMETER]):
|
||||
def parse_opf_10(parameters_list: List[ci.TSI_OPF_PARAMETER]):
|
||||
res_x, res_y, res_frate, res_bpc, timing_standard = [0] * 5
|
||||
|
||||
audio_pattern = ''
|
||||
@@ -136,7 +136,7 @@ def parse_message(message: str):
|
||||
return [str(message)]
|
||||
|
||||
|
||||
def parse_video_mode_19(parameters_list: List[TSI_OPF_PARAMETER]):
|
||||
def parse_video_mode_19(parameters_list: List[ci.TSI_OPF_PARAMETER]):
|
||||
use_3tap = False
|
||||
for param in parameters_list:
|
||||
if param.name == 'Conversion type filter':
|
||||
@@ -144,7 +144,7 @@ def parse_video_mode_19(parameters_list: List[TSI_OPF_PARAMETER]):
|
||||
return [use_3tap]
|
||||
|
||||
|
||||
def parse_video_mode_18(parameters_list: List[TSI_OPF_PARAMETER]):
|
||||
def parse_video_mode_18(parameters_list: List[ci.TSI_OPF_PARAMETER]):
|
||||
res_x = 0
|
||||
res_y = 0
|
||||
res_frate = 0
|
||||
@@ -166,7 +166,7 @@ def parse_video_mode_18(parameters_list: List[TSI_OPF_PARAMETER]):
|
||||
return int(res_x), int(res_y), int(float(res_frate) * 1000), int(res_bpc), col_format, col_range, col_yc, tim_std
|
||||
|
||||
|
||||
def parse_video_mode_20(parameters_list: List[TSI_OPF_PARAMETER], pattern_request: Optional[str] = None):
|
||||
def parse_video_mode_20(parameters_list: List[ci.TSI_OPF_PARAMETER], pattern_request: Optional[str] = None):
|
||||
pattern_name = None
|
||||
res_x = 0
|
||||
res_y = 0
|
||||
@@ -186,10 +186,10 @@ def parse_video_mode_20(parameters_list: List[TSI_OPF_PARAMETER], pattern_reques
|
||||
enable_dsc = False
|
||||
|
||||
for param in parameters_list:
|
||||
if param.name == 'Video Mode':
|
||||
line = param.description.split("Hz")
|
||||
res_x, res_y, res_frate = re.findall(r'\d+', line[0])
|
||||
tim_std = re.findall(r'VIC \d+|DMT \w+|UFG \d+|CVT RB\d+|CVT|OVT', line[1])
|
||||
if param.name == 'Video Mode' and param.description != "Disable Video":
|
||||
line = param.description.split("Hz")
|
||||
res_x, res_y, res_frate = re.findall(r'\d+', line[0])
|
||||
tim_std = re.findall(r'VIC \d+|DMT \w+|UFG \d+|CVT RB\d+|CVT|OVT', line[1])
|
||||
elif param.name == 'Color Format':
|
||||
color_format_str = param.description
|
||||
result = re.findall(r'RGB|YCbCr 4:2:2|YCbCr 4:4:4|YCbCr 4:2:0|Simple 4:2:2|ITU-601|ITU-709|\d+|VESA|CTA',
|
||||
@@ -203,7 +203,7 @@ def parse_video_mode_20(parameters_list: List[TSI_OPF_PARAMETER], pattern_reques
|
||||
pattern_name, enable_dsc
|
||||
|
||||
|
||||
def parse_opf_21(parameters_list: List[TSI_OPF_PARAMETER]):
|
||||
def parse_opf_21(parameters_list: List[ci.TSI_OPF_PARAMETER]):
|
||||
audio_pattern = ''
|
||||
ch_count = 0
|
||||
sample_freq = 0
|
||||
@@ -230,7 +230,7 @@ def parse_opf_21(parameters_list: List[TSI_OPF_PARAMETER]):
|
||||
ch_info if len(ch_info) > 0 else None)
|
||||
|
||||
|
||||
def parse_video_mode_103(parameters_list: List[TSI_OPF_PARAMETER]):
|
||||
def parse_video_mode_103(parameters_list: List[ci.TSI_OPF_PARAMETER]):
|
||||
width = 0
|
||||
height = 0
|
||||
res_frate = 60000
|
||||
@@ -268,7 +268,26 @@ def parse_video_mode_103(parameters_list: List[TSI_OPF_PARAMETER]):
|
||||
int(h_slice_number), int(buffer_bit_depth), int(v_slice_number), int(dsc_v_major), int(dsc_v_minor)
|
||||
|
||||
|
||||
def parse_video_mode_120(parameters_list: List[TSI_OPF_PARAMETER]):
|
||||
def parse_audio_mode_108(parameters_list: List[ci.TSI_OPF_PARAMETER]):
|
||||
audio_pattern = ''
|
||||
ch_count = 0
|
||||
sample_rate = 0
|
||||
sample_size = 0
|
||||
|
||||
for ind, param in enumerate(parameters_list):
|
||||
if param.name == 'Audio test pattern':
|
||||
audio_pattern = param.description
|
||||
elif param.name == 'Sample rate':
|
||||
sample_rate, = re.findall(r'\d+', param.description)
|
||||
elif param.name == 'Sample size':
|
||||
sample_size, = re.findall(r'\d+', param.description)
|
||||
elif param.name == 'Channels count':
|
||||
ch_count, = re.findall(r'\d+', param.description)
|
||||
|
||||
return audio_pattern, int(sample_rate), int(sample_size), int(ch_count)
|
||||
|
||||
|
||||
def parse_video_mode_120(parameters_list: List[ci.TSI_OPF_PARAMETER]):
|
||||
res_x = 0
|
||||
res_y = 0
|
||||
res_frate = 0
|
||||
@@ -282,7 +301,7 @@ def parse_video_mode_120(parameters_list: List[TSI_OPF_PARAMETER]):
|
||||
return int(res_x), int(res_y), int(float(res_frate) * 1000), int(res_bpc), color_format
|
||||
|
||||
|
||||
def parse_video_mode_140(parameters_list: List[TSI_OPF_PARAMETER]):
|
||||
def parse_video_mode_140(parameters_list: List[ci.TSI_OPF_PARAMETER]):
|
||||
res_x = 0
|
||||
res_y = 0
|
||||
res_frate = 0
|
||||
@@ -300,7 +319,7 @@ def parse_video_mode_140(parameters_list: List[TSI_OPF_PARAMETER]):
|
||||
return int(res_x), int(res_y), int(float(res_frate) * 1000), tim_std, tim_std_num
|
||||
|
||||
|
||||
def parse_video_mode_141(parameters_list: List[TSI_OPF_PARAMETER]):
|
||||
def parse_video_mode_141(parameters_list: List[ci.TSI_OPF_PARAMETER]):
|
||||
audio_format = ''
|
||||
channels = 0
|
||||
size = 0
|
||||
@@ -313,7 +332,7 @@ def parse_video_mode_141(parameters_list: List[TSI_OPF_PARAMETER]):
|
||||
return audio_format, int(channels), int(size), int(float(rate) * 1000)
|
||||
|
||||
|
||||
def parse_video_mode_143(parameters_list: List[TSI_OPF_PARAMETER]):
|
||||
def parse_video_mode_143(parameters_list: List[ci.TSI_OPF_PARAMETER]):
|
||||
res_frate = 0
|
||||
|
||||
for param in parameters_list:
|
||||
@@ -323,5 +342,23 @@ def parse_video_mode_143(parameters_list: List[TSI_OPF_PARAMETER]):
|
||||
return [int(float(res_frate))]
|
||||
|
||||
|
||||
def parse_video_mode_144(parameters_list: List[TSI_OPF_PARAMETER]):
|
||||
def parse_video_mode_144(parameters_list: List[ci.TSI_OPF_PARAMETER]):
|
||||
return [parameters_list[0].description]
|
||||
|
||||
def parse_video_mode_146(parameters_list: List[ci.TSI_OPF_PARAMETER]):
|
||||
res_x = 0
|
||||
res_y = 0
|
||||
rate = 0
|
||||
for param in parameters_list:
|
||||
if param.name == "Resolution":
|
||||
res_x, res_y = re.findall(r'\d+', param.description)
|
||||
if param.name == 'Refresh rate':
|
||||
rate = re.findall(r'\d+', param.description)[0]
|
||||
return int(res_x), int(res_y), int(float(rate) * 1000)
|
||||
|
||||
def parse_video_mode_147(parameters_list: List[ci.TSI_OPF_PARAMETER]):
|
||||
refresh_rate = 0
|
||||
for param in parameters_list:
|
||||
if param.name == 'Refresh rate':
|
||||
refresh_rate = re.findall(r'\d+', param.description)[0]
|
||||
return int(refresh_rate)
|
||||
@@ -1,7 +1,7 @@
|
||||
import time
|
||||
from UniTAP.libs.lib_tsi.tsi_io import DeviceIO
|
||||
from UniTAP.libs.lib_tsi.tsi import TSI_TERMINAL_RW
|
||||
from ctypes import c_char
|
||||
import UniTAP.libs.lib_tsi.tsi_private_types as p_ci
|
||||
|
||||
|
||||
class Terminal:
|
||||
@@ -30,7 +30,7 @@ class Terminal:
|
||||
def __execute(self, command):
|
||||
command += '\r'
|
||||
str_len = (len(command) / 4 + (1 if len(command) % 4 else 0)) * 4
|
||||
self.__io.set(config_id=TSI_TERMINAL_RW,
|
||||
self.__io.set(config_id=p_ci.TSI_TERMINAL_RW,
|
||||
data=command,
|
||||
data_type=c_char,
|
||||
data_count=len(command),
|
||||
@@ -41,7 +41,7 @@ class Terminal:
|
||||
start = time.time()
|
||||
result = []
|
||||
while time.time() - start < timeout:
|
||||
result = self.__io.get(TSI_TERMINAL_RW, c_char, 1024)[1]
|
||||
result = self.__io.get(p_ci.TSI_TERMINAL_RW, c_char, 1024)[1]
|
||||
if result[0] != b'\x00':
|
||||
break
|
||||
|
||||
|
||||
Reference in New Issue
Block a user