Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh #277 dsVideoPort L3 for an API dsSetAllmEnabled #279

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from
Empty file added .lastlogin
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Below are top test use-case for the video port.
|7|Resets the video output to `SDR` for Source |Play the `HDR` stream and verify the video content formats|`dsResetOutputToSDR()`|`Y`|`NA`|1|
|8|Select preferred color depth for Source|Select the Color depth from Supported list & verify|`dsSetPreferredColorDepth()`|`Y`|`NA`|`NA`|
|9|sets the background color for Source |Select the background color form supported list & verify|`dsSetBackgroundColor()`|`Y`|`NA`|`NA`|
|10|Enables/Disables ALLM mode for HDMI output video port |Select the ALLM mode for HDMI output video port and verify|`dsSetAllmEnabled()`|`Y`|`NA`|`NA`|
hari22yuva marked this conversation as resolved.
Show resolved Hide resolved

## Level 3 Python Test Cases High Level Overview

Expand Down
40 changes: 40 additions & 0 deletions docs/pages/dsVideoPort/ds-video-port_L3_Test-Procedure.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- [dsVideoPort_test7_ResetToSDRMode.py](#dsvideoport_test7_resettosdrmodepy)
- [dsVideoPort_test8_VerifyColorDepth.py](#dsvideoport_test8_verifycolordepthpy)
- [dsVideoPort_test9_VerifyBackgroundColor.py](#dsvideoport_test9_verifybackgroundcolorpy)
- [dsVideoPort_test10_VerifyALLM_Mode.py](#dsvideoport_test10_verifyallm_modepy)

## Overview

Expand All @@ -32,6 +33,7 @@ This document describes the L3 Test case Procedure Documentation for the Device
- `HDR` \- High Dynamic Range
- `HLG` \- Hybrid Log-Gamma
- `SDR` \- Standard Dynamic Range
- `ALLM` \- Auto Low Latency Mode
- `Y` \- yes supported
- `NA` \- Not Supported

Expand Down Expand Up @@ -496,3 +498,41 @@ dsVideoPort_test9_VerifyBackgroundColor.py --config /host/tests/configs/example_
- Is dsVIDEO_BGCOLOR_BLACK displayed on the Analyzer (Y/N)?
- Is dsVIDEO_BGCOLOR_NONE displayed on the Analyzer (Y/N)?
- If the answers to all three questions are "Yes," the test will pass.

### dsVideoPort_test10_VerifyALLM_Mode.py

**Overview:**

This test is designed to verify the functionality of the dsSetAllmEnabled API in enabling or disabling Auto Low Latency Mode (`ALLM`) for an HDMI output port. The test will check the API's ability to correctly toggle ALLM based on the sink device's compatibility with HDMI 2.1 specifications. Users will validate the `ALLM` status using an AV analyzer.

**Platform Supported:**

Source

**User Input Required:**

Yes: The user is required to verify the `ALLM` mode on an external AV analyzer connected to the device. (This will be automated later).

**Acceptance Criteria:**

The test must successfully enable/disable ALLM mode, and the user must confirm that respective mode is displayed on the AV analyzer for the test to pass.

**Expected Results:**

The test will enable/disable ALLM mode on the HDMI output video port. The user will confirm the correct ALLM mode using a supported AV analyzer.

**Test Steps:**

- Run the Python file `dsVideoPort_test10_VerifyALLM_Mode.py` with the appropriate configuration:

```bash
dsVideoPort_test10_VerifyALLM_Mode.py --config /host/tests/configs/example_rack_config.yml --deviceConfig /host/tests/configs/deviceConfig.yml
```

- Download and copy all required assets to the target directory.
- Enable ALLM mode.
- Prompt the user to verify that respective ALLM mode is displayed on the AV analyzer.
- The test will pass if the user confirms that the ALLM mode is enabled.
- Disable ALLM mode.
- Prompt the user to verify that respective ALLM mode is displayed on the AV analyzer.
- The test will pass if the user confirms that the ALLM mode is disabled.
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,6 @@ dsVideoPort: # Prefix must always exist
test8_VerifyColorDepth:
streams: #list of streams to be copied
test9_VerifyBackgroundColor:
streams: #list of streams to be copied
test10_VerifyALLM_Mode:
streams: #list of streams to be copied
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
#!/usr/bin/env python3
#** *****************************************************************************
# *
# * If not stated otherwise in this file or this component's LICENSE file the
hari22yuva marked this conversation as resolved.
Show resolved Hide resolved
# * following copyright and licenses apply:
# *
# * Copyright 2024 RDK Management
# *
# * Licensed under the Apache License, Version 2.0 (the "License");
# * you may not use this file except in compliance with the License.
# * You may obtain a copy of the License at
# *
# *
# http://www.apache.org/licenses/LICENSE-2.0
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *
#* ******************************************************************************

import os
import sys

# Get directory path and append to system path
dir_path = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(dir_path, "../../"))

# Import required classes from modules
from dsVideoPortHelperClass import dsVideoPortHelperClass
from raft.framework.core.logModule import logModule

class dsVideoPort_test10_VerifyALLM_Mode(dsVideoPortHelperClass):
"""
A class to test and verify Enables/Disables ALLM mode for HDMI output video port.

Attributes:
testName (str): Name of the test.
testSetupPath (str): Path to the test setup configuration file.
moduleName (str): Name of the module being tested.
rackDevice (str): Device under test (DUT).
"""

def __init__(self, log:logModule=None):
"""
Initializes the test10_VerifyALLM_Mode test setup and configuration.

Initializes sessions, reads the test setup, and prepares the user response.
"""
self.testName = "test10_VerifyALLM_Mode"
self.qcID = '10'

super().__init__(self.testName, self.qcID, log)


#TODO: Current version supports only manual verification.
def testVerifyAllmMode(self, manual=False):
"""
Verifies Enables/Disables ALLM mode for HDMI output video port..

Args:
manual (bool, optional): If True, manual verification is done using user response; otherwise,
automated verification is used (yet to be implemented).

Returns:
bool: Result of the ALLM mode verification.
"""
if manual == True:
#hdcpVersion = self.testdsVideoPort.getHDCPVersion()
ishthiyaqahmed marked this conversation as resolved.
Show resolved Hide resolved
return self.testUserResponse.getUserYN(f'Is ALLM Mode (Enable/Disable) is displayed on Analyzer (Y/N): ')
hari22yuva marked this conversation as resolved.
Show resolved Hide resolved
else :
#TODO: Add automation verification methods
return False

def testFunction(self):
"""
Main test function that enables video ports and verifies the ALLM Mode.

Downloads assets, runs prerequisites, enables/disables ports, and verifies ALLM Mode.

Returns:
bool: Final result of the ALLM Mode verification.
"""

# Loop through supported video ports and verify ALLM Mode
for port, index in self.testdsVideoPort.getSupportedPorts():
self.testEnablePort(port, index)
# Set the ALLM Mode as Enable
ishthiyaqahmed marked this conversation as resolved.
Show resolved Hide resolved
self.testdsVideoPort.setAllmMode(port, index, 'Enable')
ishthiyaqahmed marked this conversation as resolved.
Show resolved Hide resolved

# Verify ALLM Mode when enabled
self.log.stepStart(f'Verify ALLM mode Enabled')
result = self.testVerifyAllmMode(True)
self.log.stepResult(result, f'Verified ALLM mode Enabled')

# Set the ALLM Mode as Disable
self.testdsVideoPort.setAllmMode(port, index, 'Disable')

# Verify ALLM Mode when disabled
self.log.stepStart(f'Verify ALLM mode Disabled')
result = self.testVerifyAllmMode(True)
self.log.stepResult(result, f'Verified ALLM mode Disabled')

return result

if __name__ == '__main__':
summerLogName = os.path.splitext(os.path.basename(__file__))[0] + "_summery"
summeryLog = logModule(summerLogName, level=logModule.INFO)
test = dsVideoPort_test10_VerifyALLM_Mode(summeryLog)
test.run(False)
47 changes: 47 additions & 0 deletions host/tests/dsClasses/dsVideoPort.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,53 @@ def resetOutputToSDR(self,video_port:int, port_index:int=0):

result = self.utMenu.select(self.testSuite, "ResetOutputToSDR", promptWithAnswers)

def setAllmMode(self, video_port:int, port_index:int=0, mode:str="Disable"):
"""
Resets the video output to Standard Dynamic Range (SDR) for the specified video port.

This method allows you to This method allows you to enables or disables the Auto Low Latency Mode (ALLM)
for a HDMI output video port on source devices, as per the HDMI 2.1 specification.


Args:
video_port (int): The enumeration value representing the video port.
Refer to the dsVideoPortType enum for valid options.
port_index (int, optional): The index of the specific port to reset. Defaults to 0.
mode (str, optional) : ALLM mode, defaults to "Disable"

Returns:
None

Example:
setAllmMode(video_port=dsVIDEOPORT_TYPE_HDMI, port_index=0, mode:str="Disable")
"""
promptWithAnswers = [
{
"query_type": "list",
"query": "Select the Video Port",
"input": "dsVIDEOPORT_TYPE_HDMI"
},
{
"query_type": "direct",
"query": "Select the Video Port Index[0-9]:",
"input": "0"
},
{
"query_type": "list",
"query": "Choose ALLM mode to be Enable/Disable:",
"input": "Disable"
}
]

# Convert input arguments to strings and update the prompts
promptWithAnswers[0]["input"] = str(video_port)
ishthiyaqahmed marked this conversation as resolved.
Show resolved Hide resolved
promptWithAnswers[1]["input"] = str(port_index)
promptWithAnswers[2]["input"] = str(mode)


result = self.utMenu.select(self.testSuite, "Set AllmMode", promptWithAnswers)


hari22yuva marked this conversation as resolved.
Show resolved Hide resolved
def select_PreferredColorDepth(self,video_port:int, port_index:int=0,color_depth:int=0):
"""
Sets the preferred color depth for the specified video port.
Expand Down
3 changes: 2 additions & 1 deletion host/tests/dsClasses/dsVideoPort_testConfig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,5 @@ dsVideoPort: # Prefix must always exist
- "Get ColorDepth"
- "Get HDCPReceiverProtocol"
- "Get IgnoreEDIDStatus"
- "Get PreferredColorDepth"
- "Get PreferredColorDepth"
- "Set AllmMode"
16 changes: 16 additions & 0 deletions skeletons/src/dsVideoPort.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,22 @@ dsError_t dsIsVideoPortActive(intptr_t handle, bool* active)
return (dsError_t)0;
}

dsError_t dsSetAllmEnabled (intptr_t handle, bool enabled)
{
/*TODO: Implement Me!*/
(void)handle;
(void)enabled;
return (dsError_t)0;
}

dsError_t dsGetAllmEnabled (intptr_t handle, bool *enabled)
{
/*TODO: Implement Me!*/
(void)handle;
(void)enabled;
return (dsError_t)0;
}

dsError_t dsEnableHDCP(intptr_t handle, bool contentProtect, char* hdcpKey, size_t keySize)
{
/*TODO: Implement Me!*/
Expand Down
56 changes: 56 additions & 0 deletions src/test_l3_dsVideoPort.c
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,60 @@ void dsVideoPort_GetVideoEOTF()
UT_LOG_INFO("OUT %s ",__FUNCTION__);
}

void dsVideoPort_SetAllmEnabled()
{
dsError_t status = dsERR_NONE;
int32_t choice = 0;
int32_t j = 0;

UT_LOG_INFO("IN %s gTestGroup:%d ",__FUNCTION__,UT_TESTS_L3);

dsVideoPort_getHandle();
UT_LOG_INFO(" \t Supported ALLM Modes are:");
for (j = 0; j < 2; j++)
{
UT_LOG_INFO("\t%d. %-20s", j,((j==0)?"Disable":"Enable"));
}

UT_LOG_INFO("------------------------------------------");
UT_LOG_INFO(" Choose ALLM mode to be Enable/Disable:");
scanf("%d", &choice);
readAndDiscardRestOfLine(stdin);

if(choice < 0 || choice > 1)
{
UT_LOG_ERROR("\nInvalid ALLM mode selected\n");
goto exit;
hari22yuva marked this conversation as resolved.
Show resolved Hide resolved
}

UT_LOG_INFO("Calling dsSetAllmEnabled(IN:Handle:[0x%0X],IN:ALLM_Status:[]) ", gHandle);
status = dsSetAllmEnabled(gHandle, choice);
hari22yuva marked this conversation as resolved.
Show resolved Hide resolved
UT_LOG_INFO("Result dsSetAllmEnabled(IN:Handle:[0x%0X],IN:ALLM_Status:[%s]) ,dsError_t=[%s]",gHandle, UT_Control_GetMapString(boolMappingTable, choice),\
ishthiyaqahmed marked this conversation as resolved.
Show resolved Hide resolved
UT_Control_GetMapString(dsErrorMappingTable, status));
exit:
UT_LOG_INFO("OUT %s ",__FUNCTION__);

}

void dsVideoPort_GetAllmEnabled()
{
dsError_t status = dsERR_NONE;
bool AllmMode;
ishthiyaqahmed marked this conversation as resolved.
Show resolved Hide resolved

UT_LOG_INFO("IN %s gTestGroup:%d ",__FUNCTION__,UT_TESTS_L3);

dsVideoPort_getHandle();

UT_LOG_INFO("Calling dsGetAllmEnabled(IN:Handle:[0x%0X],OUT:ALLM_Status:[]) ", gHandle);
status = dsGetAllmEnabled(gHandle, &AllmMode);
hari22yuva marked this conversation as resolved.
Show resolved Hide resolved
UT_LOG_INFO("Result dsGetAllmEnabled(IN:Handle:[0x%0X],OUT:ALLM_Status:[%s]) ,dsError_t=[%s]",gHandle, AllmMode,\
ishthiyaqahmed marked this conversation as resolved.
Show resolved Hide resolved
hari22yuva marked this conversation as resolved.
Show resolved Hide resolved
UT_Control_GetMapString(dsErrorMappingTable, status));
exit:
UT_LOG_INFO("OUT %s ",__FUNCTION__);

}


void dsVideoPort_IsOutputHDR()
{
dsError_t status = dsERR_NONE;
Expand Down Expand Up @@ -992,6 +1046,8 @@ int test_l3_dsVideoPort_register(void)
UT_add_test( pSuite, "Get HDCPReceiverProtocol",dsVideoPort_GetHDCPReceiverProtocol);
UT_add_test( pSuite, "Get IgnoreEDIDStatus",dsVideoPort_GetIgnoreEDIDStatus);
UT_add_test( pSuite, "Get PreferredColorDepth",dsVideoPort_GetPreferredColorDepth);
UT_add_test( pSuite, "Set AllmMode",dsVideoPort_SetAllmEnabled);
UT_add_test( pSuite, "Get AllmMode",dsVideoPort_GetAllmEnabled);

return 0;
}
Expand Down