From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F284FC48260 for ; Mon, 19 Feb 2024 05:25:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8E44810E0D1; Mon, 19 Feb 2024 05:25:28 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="mghve05C"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id 90DF910E0D1 for ; Mon, 19 Feb 2024 05:25:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708320328; x=1739856328; h=message-id:date:subject:to:cc:references:from: in-reply-to:mime-version; bh=Oa7T3GM4YVxqOAiTwCo5HbP7kceqNVMBc1Ykz4oStEQ=; b=mghve05CRmKlKbNMcA+VOwMfZ2vBeOHYIq/btYaV49fkEAZmNGsALt+V D817syQHMMZt7ELniKvICcyrCZfVf42/n1Ldw41Z6MJKIibmnHm6fQopU KEej00XMPWeZE3RRS27QIzGMkUQUIn0QcufxPDm7HdFLnOSGdAiSEe5Tf 11DqHYChkJnJkSokC2DUOYU2n+GnMonVwWbo7qck8jwpvRM7Ho5QZcdoM Q6pf5IDVRUTrAkmr4+IW7ZnYIWP9n/FN+x4gBmiu+my60abzOQWU0z5+o y2T0zYWdng6zm8g8AtD2zcvlMPlVJI9KiNWBwXkbnpojP6QzNAJ3ygWBC w==; X-IronPort-AV: E=McAfee;i="6600,9927,10988"; a="6207567" X-IronPort-AV: E=Sophos;i="6.06,170,1705392000"; d="scan'208,217";a="6207567" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Feb 2024 21:25:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,170,1705392000"; d="scan'208,217";a="35166195" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by orviesa002.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 18 Feb 2024 21:25:26 -0800 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Sun, 18 Feb 2024 21:25:25 -0800 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Sun, 18 Feb 2024 21:25:25 -0800 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Sun, 18 Feb 2024 21:25:25 -0800 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.40) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Sun, 18 Feb 2024 21:25:24 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cuOPqfUGQVWCgkoFQ6S1ILrzIXGkrvIHK1JOgzyhAMMQEVfi1UYrI6/+qej3Z7kbi4VzcuTDErfmnccAVErjM/VPpj004GWmR2asOzczBMibtYYinVxykPTVeuSQJ0KkDX2RBcieNiqYfUA0qbB8OmXZNY61O8IVoaqQ2Sl6R6ThpqpbHZDAXmc7Uq6OXubGFTiW8NCDmz76o3BjxUfcx+mZJmTKQH5H8GebUnMsx1b1vpEh+WlERPqmp1T5sqO2kTuDuY1mwH5Brqtaz4D6q2KlJW9N6CQ1dNR946IW7+0D8snouZC1ULQb+8DQG6Lzl04g8LI49mMMIyCOkvc6nA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Kujfo65fCaHS9eStexjspS/VsGuawiOtEEBGFfTRv1E=; b=A/P7A8oS6b9EbSkOBZ5sfSKaNze1+54y4tu/g5vepN0KB+3N2XiBlzAfSsGaZ8S17srBv0xjz7DTniqmLszjbz34ys93wh01uqMZPdIpMHapEGwDLBnvBhpnys9BwRWWgglz9PQQUT86P5ngHydVY7NYvZOHO6ICLSNWIWHKKywAuP12MeEJjedE1b+OZNikebJ7dr+p0M4X4W54HYMQe4AycsBl396icl58W3vJaumDytXoQg22LP4j6+E90KKKmy5MsmXGtcYW+sndC0rh9EiN5gNtNHy+d3/Dy4gL+iDfCHqEgJ6FmqmntE5TTX3+wwhjdd8RINDiKJrQi1p7Ug== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from CY8PR11MB6889.namprd11.prod.outlook.com (2603:10b6:930:5e::9) by BL1PR11MB5255.namprd11.prod.outlook.com (2603:10b6:208:31a::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.38; Mon, 19 Feb 2024 05:25:21 +0000 Received: from CY8PR11MB6889.namprd11.prod.outlook.com ([fe80::bf71:4b0e:6d66:e035]) by CY8PR11MB6889.namprd11.prod.outlook.com ([fe80::bf71:4b0e:6d66:e035%3]) with mapi id 15.20.7292.036; Mon, 19 Feb 2024 05:25:20 +0000 Content-Type: multipart/alternative; boundary="------------BaPfDmn2t0NR08Adpjk400gl" Message-ID: <111011c3-b33d-47c6-b888-b20ac4083b08@intel.com> Date: Mon, 19 Feb 2024 10:55:13 +0530 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH i-g-t 2/2] tests/intel/kms_psr2_sf: extend tests for panel replay sf Content-Language: en-US To: "Hogander, Jouni" , "igt-dev@lists.freedesktop.org" CC: "Murthy, Arun R" , "Manna, Animesh" References: <20240208145425.1940941-1-kunal1.joshi@intel.com> <20240208145425.1940941-3-kunal1.joshi@intel.com> From: "Joshi, Kunal1" In-Reply-To: X-ClientProxiedBy: PN2PR01CA0036.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c01:22::11) To CY8PR11MB6889.namprd11.prod.outlook.com (2603:10b6:930:5e::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR11MB6889:EE_|BL1PR11MB5255:EE_ X-MS-Office365-Filtering-Correlation-Id: b1d65cbd-df4c-43ec-12ea-08dc310b29ee X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4/X65t7KqZtza3Ym/uCFhUYoKwVnbdn0qbL1W4MqqoQxbSQ1+Q4hg8fPaRDD61P4QCZNG42HtY8WMuW0B3nhLDF05OdTkz7r5a+tH1cL6J5HnG2291DrAnhuCyB0oY11euK1vWBahHi0uWQeKnLnpHpSCdlQMWGmnaiweHoi7iKgMKhvSBt511ACfc50U0W1tkbqvLJFFN9rZbQXcGrmBRHa5EiawPEFqY6VOMP661k/hKPUR2bMwMXsrMLKy/LhCRrDDFbAaRrX/RpI47OEtIUeKhUfYY6+C8v4INovLgVFY9kUmNdnZS63mJK61w9ptiBg805WhBikuhN7BpIdykI3cXfvvtriW99aqJLRFkoyXjdOz5JDsv2vL50juhY5j1AbLncbTTIy/RSgW32/nE+VUcphfbTILLsMap27QQru0A7T4KWwL2NXJ4vYOhfL1NZZO+oL1A4AFp7XtZKNx5C0kxZsvATWH5dDvFGQu0w24b0jKuudqu06fKY9bWWFqL6J9a1NJ4q8xKldItc0JmeXIuAiAwJN8O7aHiXQ+Yb0Z8dKLvdHNPMnBhNa09DW X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR11MB6889.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366004)(136003)(396003)(346002)(376002)(39860400002)(230922051799003)(64100799003)(186009)(451199024)(1800799012)(2906002)(41300700001)(31686004)(30864003)(4326008)(8936002)(8676002)(5660300002)(38100700002)(83380400001)(82960400001)(86362001)(31696002)(26005)(107886003)(2616005)(110136005)(66946007)(53546011)(6506007)(33964004)(6666004)(66574015)(6486002)(66556008)(66476007)(54906003)(316002)(478600001)(6512007)(36756003)(559001)(579004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Si8wOFlvR0pzWG9UL2dkWnhzR2NTNVV5NkY4WEhZZmcyZ2p6K0dSc3MvdXpD?= =?utf-8?B?aGNLcmZrMGd0UW5UQ2xZUk1rUktNNEd4OUJTd1VjSW4vM0REeFNuVDBQeWtB?= =?utf-8?B?dmcya3JydUxTenQ0eE5NZ0ZEd2FrYVlMSDEyaXQ5NGQ2NnlXMEY4b0ZuYy9Z?= =?utf-8?B?WWwyekYzZDhWd0VUQXVXZ1ZVQ1BQczRRdlJBRFFNdDNDOXVkVUhHemNGeFFu?= =?utf-8?B?aVVIMHR3RVZFanhMeElUdWY2WGU2bGU4dThzWW1FYlE3NHJDNjdhZFlyQUJD?= =?utf-8?B?eng0TlNoZ3p6TVd0UURuMjgzY2x5NzZUWjhUWVN0TGNUendEZnNQNTRIZk9B?= =?utf-8?B?ZW91R3V1VHJKRUx5dXBSamZ1ZEVuNmJVNWt3VVJTT2hQbUxKak9NZ1AyWVE3?= =?utf-8?B?T0JuSi9nRXIvRlBYKzhGVGpTZ0cvSitRL3dMTFQ4cWI4d0tJRWpPMUVGcVBB?= =?utf-8?B?TGhQbEU3ZkVJQkJwd1BHUkh6aE9rQ0ZneHlFUURJUXdiYjhGaklSYXpHb3JS?= =?utf-8?B?dzlnT0RzUDBlMVBUeHpsbm9naDh5MUZEdVJKRTAwbFdncUIwL1g2dkw5VWZG?= =?utf-8?B?aDl2WWxpTGJ1c3FNb0VxanhPeW5sSmZFRzdVank1NTcweS9KMUdzdExSY05Q?= =?utf-8?B?OW15cDYxbjg1bnZ5REJJYlBrZlg2NzJNYkVMbVNxZTlCb2dzN01tcGhkcXdu?= =?utf-8?B?Tk50Q0crZy8rRy93dW5VRXBpOXR3cnNsc1Y1aWlEK3VYWVo1SWFCRlNBN3Bs?= =?utf-8?B?UmFRUVI1dFZnNVZ0VFpnOHIzNTN2TEVkc1A0bWhSRmlhQXZEY2c1dlZZbkg4?= =?utf-8?B?WC9ET3UvUUo0TTVXVEIvbGxwVkNRMzJ2ZWJaRmdoaUNwYmVwLzdNaStod2FJ?= =?utf-8?B?S01rM0NJcWdXeDBpWWxhcjVEUThaZ1gyM1hOV0htT00xZlh6U1p1cDBlTDBS?= =?utf-8?B?NXl2SWp6WXBLVUIva1ZaMjFaWDRaOVhESUJwbklrUzNLSmhOM3lrNEkyZ2ZC?= =?utf-8?B?Zkhza25RUU1ScUlKVkJNV3cyelFVOTFxME9JL0lpUW9jYStvczd2TGM0YTk5?= =?utf-8?B?MEVKeVhxa2hoZ1o0N3Z3RGdaeldLbW1OcWNMQWJPSG9zWHR0bnozVFkwWnZM?= =?utf-8?B?cEVzOU1hUjMrbGlPYVBPRFlXY01SNVRIbUFiWXl1MVNld0VHOGRwbGRDR3gr?= =?utf-8?B?ZnE4QXVIK3RLN1NhWnNQZ1FBL0I1enpwSFg4RStab3VDcnAwdXJtU0krbG1l?= =?utf-8?B?bFNLVWtaWGVsaWEvbGpSQVovY3dVS3BlZDFlT21rbC9FbExzKzB0WG5WbzFs?= =?utf-8?B?eCtsSmFTTVFya1kwK25pVUlCYzBFWGJlTkVWMk1rZlZLSTUwZTAvUnVHOWp0?= =?utf-8?B?Y1hHbFpCNEEvTlBNMWtUVFdlUGQyZisvRjFXYVZDWUpLTkdURnlaY2dQWkhE?= =?utf-8?B?Z3BEUUtuVjVyOXlQWjNiUlZRL2JmVUdaQzlCSWNvYW4zWUxCZVV1UmJYNDlz?= =?utf-8?B?bExRNFhsaUtSQU14cW5Ta3k5Rk9WR0dUODRjMHkwcGNwa0Zad3lFSHM1REpJ?= =?utf-8?B?b3ZTdXhKZjJPMmRKN1ZhaGpBQWYwL3BKd3hIbXNxRHBxQnlOcThqNjZSUVpY?= =?utf-8?B?VnZSRXd2YXVGZ2Q5VU9EVHhkd294WStja2o4amkyOGdkWXlQdDZLK1BSUUdv?= =?utf-8?B?QUNWdGFxV0daWVB3VXlTdXJiVk9DOWppR0dQNGZqbVN6bmN6SXZyVGpQMjVv?= =?utf-8?B?Ty9JWEhaU2ZUV0hIK2UvT29TL0o4cGFDenRSNHN1U1F3WGhpek04d2ZsbHpj?= =?utf-8?B?UnhEak1xRkdSMWpuRVBjOGRiUjFlbnV6b2xydDRPZXg0eHUranVaNmlWREd2?= =?utf-8?B?eVM2Vkcxa0lSTU9Rb3hGUUZEdmdhU0N3bW0xbk1nM1Y4aGwzY3g4MDJ6NmJj?= =?utf-8?B?RXJHcEt5Q2Q5MCt2NTVBS29ITjVMSnpSK3hjTWhCUGppWWhVNnE2K2dCb0VY?= =?utf-8?B?ZzFSSmhFWGxXbm0xR2JraVFTM1QzUXZzMUdmOVNadUVVM3pHcjd2MUsvS0Ey?= =?utf-8?B?ZTNibW9vWTRLY05JZUMxSXJYT3pWbHFwVjVGbE02bGo2L0k5SDlyVC9HKysx?= =?utf-8?B?NkVkWmdDNFN4ZkZLT1ZYSjFGOHhURE15MzhhTlRKUE1jKzEyYzB5SUsyaDB6?= =?utf-8?B?MFE9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: b1d65cbd-df4c-43ec-12ea-08dc310b29ee X-MS-Exchange-CrossTenant-AuthSource: CY8PR11MB6889.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Feb 2024 05:25:20.3464 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: biCDwB/QKuFn3PXbnuQFQOr4xnqRpKtdjza+xczls1g+YQdzreYhkYxX3+7BfYu7IlHOH695/c1h8F5/H0il7Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR11MB5255 X-OriginatorOrg: intel.com X-BeenThere: igt-dev@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development mailing list for IGT GPU Tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" --------------BaPfDmn2t0NR08Adpjk400gl Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit Hello Jouni, On 2/16/2024 1:55 PM, Hogander, Jouni wrote: > On Thu, 2024-02-08 at 20:24 +0530, Kunal Joshi wrote: >> Extend the tests to cover panel replay selective fetch feature. >> >> From kms_psr2_sf test point of view we have >> check_pr_psr2_sel_fetch_support >> function to check if PR/PSR2 selective fetch is supported for an >> output >> if output supports selective fetch then we check we enter DEEP_SLEEP >> mode >> in run function >> >> v2: fixed dynamic test name >> v3: use check_psr2_support (Jouni) >> v4: correct order of checks in check_pr_psr2_sel_fetch_support >> (Jouni) >>     use appropriate psr mode in psr_wait_entry (Jouni) >> >> Cc: Jouni Högander >> Cc: Animesh Manna >> Cc: Arun R Murthy >> Signed-off-by: Kunal Joshi >> --- >>  tests/intel/kms_psr2_sf.c | 147 +++++++++++++++++++++++++++++++----- >> -- >>  1 file changed, 120 insertions(+), 27 deletions(-) >> >> diff --git a/tests/intel/kms_psr2_sf.c b/tests/intel/kms_psr2_sf.c >> index 8e6a9e02c..0595c1f11 100644 >> --- a/tests/intel/kms_psr2_sf.c >> +++ b/tests/intel/kms_psr2_sf.c >> @@ -172,6 +172,7 @@ typedef struct { >>         uint32_t screen_changes; >>         int cur_x, cur_y; >>         enum pipe pipe; >> +       enum psr_mode psr_mode; >>         enum { >>                 FEATURE_NONE  = 0, >>                 FEATURE_DSC   = 1, >> @@ -179,6 +180,34 @@ typedef struct { >>         } coexist_feature; >>  } data_t; >> >> +static enum psr_mode get_sel_fetch_mode_for_output(data_t *data, >> igt_output_t *output) >> +{ >> +       enum psr_mode mode = PSR_DISABLED; >> + >> +       if (psr_sink_support(data->drm_fd, data->debugfs_fd, >> +                                                PR_MODE_SEL_FETCH, >> output)) >> +               mode = PR_MODE_SEL_FETCH; >> +       else if (psr_sink_support(data->drm_fd, data->debugfs_fd, >> +                                                         PSR_MODE_2, >> output)) >> +               mode = PSR_MODE_2; >> +       else >> +               igt_info("selective fetch not supported on output >> %s\n", output->name); >> + >> +       return mode; >> +} >> + >> +static const char *get_psr_mode_str_for_output(data_t *data, >> igt_output_t *output) >> +{ >> +       const char *psr_mode = NULL; > If you are doing it this way this variable should be static. I'm not > sure if renaming these testcases to pr-* and psr2-* gives any benefit. > I'll guess it is ok, if you want to do that change. Have addressed your comment in the next revision, kept the naming just to know test executed on PR or PSR panel. > >> + >> +       if (get_sel_fetch_mode_for_output(data, output) == >> PR_MODE_SEL_FETCH) >> +               psr_mode = "pr-"; >> +       else if (get_sel_fetch_mode_for_output(data, output) == >> PSR_MODE_2) >> +               psr_mode = "psr2-"; >> +       igt_assert_f(psr_mode, "Invalid psr mode\n"); >> +       return psr_mode; >> +} >> + >>  static const char *op_str(enum operations op) >>  { >>         static const char * const name[] = { >> @@ -688,7 +717,7 @@ static void damaged_plane_move(data_t *data) >> >>         igt_display_commit2(&data->display, COMMIT_ATOMIC); >> >> -       igt_assert(psr_wait_entry(data->debugfs_fd, PSR_MODE_2, >> NULL)); >> +       igt_assert(psr_wait_entry(data->debugfs_fd, data->psr_mode, >> data->output)); > Not really matter of this patch. I think at some point you need one > more patch to differentiate in psr_wait_entry (psr_active_check) based > on output type eDP vs. DP. See Bspec 68920 "Additional programming > considerations (registers common between eDP and DP)". > Sure will send this changes as separate later. > > BR, > > Jouni Högander > >> >>         expected_output(data); >>  } >> @@ -788,7 +817,7 @@ static void plane_move_continuous(data_t *data) >>  { >>         int target_x, target_y; >> >> -       igt_assert(psr_wait_entry(data->debugfs_fd, PSR_MODE_2, >> NULL)); >> +       igt_assert(psr_wait_entry(data->debugfs_fd, data->psr_mode, >> data->output)); >> >>         get_target_coords(data, &target_x, &target_y); >> >> @@ -865,7 +894,7 @@ static void damaged_plane_update(data_t *data) >>         igt_plane_set_position(data->test_plane, 0, 0); >>         igt_display_commit2(&data->display, COMMIT_ATOMIC); >> >> -       igt_assert(psr_wait_entry(data->debugfs_fd, PSR_MODE_2, >> NULL)); >> +       igt_assert(psr_wait_entry(data->debugfs_fd, data->psr_mode, >> data->output)); >> >>         expected_output(data); >>  } >> @@ -874,7 +903,7 @@ static void run(data_t *data) >>  { >>         int i; >> >> -       igt_assert(psr_wait_entry(data->debugfs_fd, PSR_MODE_2, >> NULL)); >> +       igt_assert(psr_wait_entry(data->debugfs_fd, data->psr_mode, >> data->output)); >> >>         if (data->fbc_flag == true && data->op_fbc_mode == >> FBC_ENABLED) >>                 igt_assert_f(intel_fbc_wait_until_enabled(data- >>> drm_fd, >> @@ -952,14 +981,24 @@ static void cleanup(data_t *data) >>         igt_remove_fb(data->drm_fd, &data->fb_test); >>  } >> >> -static int check_psr2_support(data_t *data) >> +static bool check_pr_psr2_sel_fetch_support(data_t *data) >>  { >> -       int status; >> +       bool status = false; >> +       enum psr_mode psr_mode; >> + >> +       /* Check sink supports PR/PSR2 selective fetch */ >> +       psr_mode = get_sel_fetch_mode_for_output(data, data->output); >> +       if (psr_mode == PSR_DISABLED) >> +               return false; >> + >> +       /* Check if selective fetch can be enabled */ >> +       if (!selective_fetch_check(data->debugfs_fd, data->output)) >> +               igt_assert("Selective fetch is not enabled even >> though panel should support it\n"); >> >>         prepare(data); >> -       status = psr_wait_entry(data->debugfs_fd, PSR_MODE_2, NULL); >> +       /* We enter into DEEP_SLEEP for both PSR2 and PR sel fetch */ >> +       status = psr_wait_entry(data->debugfs_fd, psr_mode, data- >>> output); >>         cleanup(data); >> - >>         return status; >>  } >> >> @@ -981,6 +1020,8 @@ pipe_output_combo_valid(igt_display_t *display, >> >>  igt_main >>  { >> +       bool output_supports_pr_psr2_sel_fetch = false; >> +       bool pr_psr2_sel_fetch_supported = false; >>         data_t data = {}; >>         igt_output_t *outputs[IGT_MAX_PIPES * IGT_MAX_PIPES]; >>         int i, j, k, y; >> @@ -1000,11 +1041,6 @@ igt_main >>                 data.debugfs_fd = igt_debugfs_dir(data.drm_fd); >>                 kmstest_set_vt_graphics_mode(); >> >> -               igt_require_f(psr_sink_support(data.drm_fd, >> -                                              data.debugfs_fd, >> PSR_MODE_2, >> -                                              NULL), >> -                             "Sink does not support PSR2\n"); >> - >>                 display_init(&data); >> >>                 if >> ((intel_display_ver(intel_get_drm_devid(data.drm_fd)) >= 20) && >> @@ -1023,7 +1059,8 @@ igt_main >> >>                 for_each_pipe_with_valid_output(&data.display, >> data.pipe, data.output) { >>                         coexist_features[n_pipes] = 0; >> -                       if (check_psr2_support(&data)) { >> +                       output_supports_pr_psr2_sel_fetch = >> check_pr_psr2_sel_fetch_support(&data); >> +                       if (output_supports_pr_psr2_sel_fetch) { >>                                 pipes[n_pipes] = data.pipe; >>                                 outputs[n_pipes] = data.output; >> >> @@ -1032,7 +1069,10 @@ igt_main >> >>                                 n_pipes++; >>                         } >> +                       pr_psr2_sel_fetch_supported |= >> output_supports_pr_psr2_sel_fetch; >>                 } >> +               igt_require_f(pr_psr2_sel_fetch_supported, >> +                                         "No output supports >> selective fetch\n"); >>         } >> >>         for (y = 0; y < ARRAY_SIZE(fbc_status); y++) { >> @@ -1053,13 +1093,17 @@ igt_main >>                                 for (j = FEATURE_NONE; j < >> FEATURE_COUNT; j++) { >>                                         if (j != FEATURE_NONE && >> !(coexist_features[i] & j)) >>                                                 continue; >> -                                       igt_dynamic_f("pipe-%s-%s%s", >> kmstest_pipe_name(pipes[i]), >> +                                       igt_dynamic_f("%s-pipe-%s- >> %s%s", get_psr_mode_str_for_output(&data, outputs[i]), >> + >> kmstest_pipe_name(pipes[i]), >> >> igt_output_name(outputs[i]), >> >> coexist_feature_str(j)) { >>                                                 data.pipe = pipes[i]; >>                                                 data.output = >> outputs[i]; >>                                                 data.test_plane_id = >> DRM_PLANE_TYPE_PRIMARY; >>                                                 data.coexist_feature >> = j; >> +                                               data.psr_mode = >> get_sel_fetch_mode_for_output(&data, data.output); >> +                                               igt_assert_f(data.psr >> _mode != PSR_DISABLED, >> + >>     "Invalid psr mode\n"); >>                                                 for (k = 1; k <= >> MAX_DAMAGE_AREAS; k++) { >>                                                         data.damage_a >> rea_count = k; >>                                                         prepare(&data >> ); >> @@ -1086,7 +1130,8 @@ igt_main >>                                         for (j = FEATURE_NONE; j < >> FEATURE_COUNT; j++) { >>                                                 if (j != FEATURE_NONE >> && !(coexist_features[i] & j)) >>                                                         continue; >> -                                               igt_dynamic_f("pipe- >> %s-%s%s", >> +                                               igt_dynamic_f("%s- >> pipe-%s-%s%s", >> + >> get_psr_mode_str_for_output(&data, outputs[i]), >> >> kmstest_pipe_name(pipes[i]), >> >> igt_output_name(outputs[i]), >> >> coexist_feature_str(j)) { >> @@ -1094,6 +1139,9 @@ igt_main >>                                                         data.output = >> outputs[i]; >>                                                         data.test_pla >> ne_id = DRM_PLANE_TYPE_PRIMARY; >>                                                         data.coexist_ >> feature = j; >> +                                                       data.psr_mode >> = get_sel_fetch_mode_for_output(&data, data.output); >> +                                                       igt_assert_f( >> data.psr_mode != PSR_DISABLED, >> + >>             "Invalid psr mode\n"); >>                                                         for (k = 1; k >> <= MAX_DAMAGE_AREAS; k++) { >>                                                                 data. >> damage_area_count = k; >>                                                                 prepa >> re(&data); >> @@ -1118,13 +1166,17 @@ igt_main >>                                 for (j = FEATURE_NONE; j < >> FEATURE_COUNT; j++) { >>                                         if (j != FEATURE_NONE && >> !(coexist_features[i] & j)) >>                                                 continue; >> -                                       igt_dynamic_f("pipe-%s-%s%s", >> kmstest_pipe_name(pipes[i]), >> +                                       igt_dynamic_f("%s-pipe-%s- >> %s%s", get_psr_mode_str_for_output(&data, outputs[i]), >> + >> kmstest_pipe_name(pipes[i]), >> >> igt_output_name(outputs[i]), >> >> coexist_feature_str(j)) { >>                                                 data.pipe = pipes[i]; >>                                                 data.output = >> outputs[i]; >>                                                 data.test_plane_id = >> DRM_PLANE_TYPE_OVERLAY; >>                                                 data.coexist_feature >> = j; >> +                                               data.psr_mode = >> get_sel_fetch_mode_for_output(&data, data.output); >> +                                               igt_assert_f(data.psr >> _mode != PSR_DISABLED, >> + >>     "Invalid psr mode\n"); >>                                                 for (k = 1; k <= >> MAX_DAMAGE_AREAS; k++) { >>                                                         data.damage_a >> rea_count = k; >>                                                         prepare(&data >> ); >> @@ -1148,13 +1200,17 @@ igt_main >>                                 for (j = FEATURE_NONE; j < >> FEATURE_COUNT; j++) { >>                                         if (j != FEATURE_NONE && >> !(coexist_features[i] & j)) >>                                                 continue; >> -                                       igt_dynamic_f("pipe-%s-%s%s", >> kmstest_pipe_name(pipes[i]), >> +                                       igt_dynamic_f("%s-pipe-%s- >> %s%s", get_psr_mode_str_for_output(&data, outputs[i]), >> + >> kmstest_pipe_name(pipes[i]), >> >> igt_output_name(outputs[i]), >> >> coexist_feature_str(j)) { >>                                                 data.pipe = pipes[i]; >>                                                 data.output = >> outputs[i]; >>                                                 data.test_plane_id = >> DRM_PLANE_TYPE_CURSOR; >>                                                 data.coexist_feature >> = j; >> +                                               data.psr_mode = >> get_sel_fetch_mode_for_output(&data, data.output); >> +                                               igt_assert_f(data.psr >> _mode != PSR_DISABLED, >> + >>     "Invalid psr mode\n"); >>                                                 prepare(&data); >>                                                 run(&data); >>                                                 cleanup(&data); >> @@ -1174,13 +1230,17 @@ igt_main >>                                 for (j = FEATURE_NONE; j < >> FEATURE_COUNT; j++) { >>                                         if (j != FEATURE_NONE && >> !(coexist_features[i] & j)) >>                                                 continue; >> -                                       igt_dynamic_f("pipe-%s-%s%s", >> kmstest_pipe_name(pipes[i]), >> +                                       igt_dynamic_f("%s-pipe-%s- >> %s%s", get_psr_mode_str_for_output(&data, outputs[i]), >> + >> kmstest_pipe_name(pipes[i]), >> >> igt_output_name(outputs[i]), >> >> coexist_feature_str(j)) { >>                                                 data.pipe = pipes[i]; >>                                                 data.output = >> outputs[i]; >>                                                 data.test_plane_id = >> DRM_PLANE_TYPE_CURSOR; >>                                                 data.coexist_feature >> = j; >> +                                               data.psr_mode = >> get_sel_fetch_mode_for_output(&data, data.output); >> +                                               igt_assert_f(data.psr >> _mode != PSR_DISABLED, >> + >>     "Invalid psr mode\n"); >>                                                 prepare(&data); >>                                                 run(&data); >>                                                 cleanup(&data); >> @@ -1201,13 +1261,17 @@ igt_main >>                                 for (j = FEATURE_NONE; j < >> FEATURE_COUNT; j++) { >>                                         if (j != FEATURE_NONE && >> !(coexist_features[i] & j)) >>                                                 continue; >> -                                       igt_dynamic_f("pipe-%s-%s%s", >> kmstest_pipe_name(pipes[i]), >> +                                       igt_dynamic_f("%s-pipe-%s- >> %s%s", get_psr_mode_str_for_output(&data, outputs[i]), >> + >> kmstest_pipe_name(pipes[i]), >> >> igt_output_name(outputs[i]), >> >> coexist_feature_str(j)) { >>                                                 data.pipe = pipes[i]; >>                                                 data.output = >> outputs[i]; >>                                                 data.test_plane_id = >> DRM_PLANE_TYPE_CURSOR; >>                                                 data.coexist_feature >> = j; >> +                                               data.psr_mode = >> get_sel_fetch_mode_for_output(&data, data.output); >> +                                               igt_assert_f(data.psr >> _mode != PSR_DISABLED, >> + >>     "Invalid psr mode\n"); >>                                                 prepare(&data); >>                                                 run(&data); >>                                                 cleanup(&data); >> @@ -1228,13 +1292,17 @@ igt_main >>                                 for (j = FEATURE_NONE; j < >> FEATURE_COUNT; j++) { >>                                         if (j != FEATURE_NONE && >> !(coexist_features[i] & j)) >>                                                 continue; >> -                                       igt_dynamic_f("pipe-%s-%s%s", >> kmstest_pipe_name(pipes[i]), >> +                                       igt_dynamic_f("%s-pipe-%s- >> %s%s", get_psr_mode_str_for_output(&data, outputs[i]), >> + >> kmstest_pipe_name(pipes[i]), >> >> igt_output_name(outputs[i]), >> >> coexist_feature_str(j)) { >>                                                 data.pipe = pipes[i]; >>                                                 data.output = >> outputs[i]; >>                                                 data.test_plane_id = >> DRM_PLANE_TYPE_CURSOR; >>                                                 data.coexist_feature >> = j; >> +                                               data.psr_mode = >> get_sel_fetch_mode_for_output(&data, data.output); >> +                                               igt_assert_f(data.psr >> _mode != PSR_DISABLED, >> + >>     "Invalid psr mode\n"); >>                                                 prepare(&data); >>                                                 run(&data); >>                                                 cleanup(&data); >> @@ -1256,13 +1324,18 @@ igt_main >>                                 for (j = FEATURE_NONE; j < >> FEATURE_COUNT; j++) { >>                                         if (j != FEATURE_NONE && >> !(coexist_features[i] & j)) >>                                                 continue; >> -                                       igt_dynamic_f("pipe-%s-%s%s", >> kmstest_pipe_name(pipes[i]), >> +                                       igt_dynamic_f("%s-pipe-%s- >> %s%s", >> + >> get_psr_mode_str_for_output(&data, outputs[i]), >> + >> kmstest_pipe_name(pipes[i]), >> >> igt_output_name(outputs[i]), >> >> coexist_feature_str(j)) { >>                                                 data.pipe = pipes[i]; >>                                                 data.output = >> outputs[i]; >>                                                 data.test_plane_id = >> DRM_PLANE_TYPE_OVERLAY; >>                                                 data.coexist_feature >> = j; >> +                                               data.psr_mode = >> get_sel_fetch_mode_for_output(&data, data.output); >> +                                               igt_assert_f(data.psr >> _mode != PSR_DISABLED, >> + >>     "Invalid psr mode\n"); >>                                                 for (k = >> POS_TOP_LEFT; k <= POS_BOTTOM_RIGHT ; k++) { >>                                                         data.pos = k; >>                                                         prepare(&data >> ); >> @@ -1285,13 +1358,17 @@ igt_main >>                                 for (j = FEATURE_NONE; j < >> FEATURE_COUNT; j++) { >>                                         if (j != FEATURE_NONE && >> !(coexist_features[i] & j)) >>                                                 continue; >> -                                       igt_dynamic_f("pipe-%s-%s%s", >> kmstest_pipe_name(pipes[i]), >> +                                       igt_dynamic_f("%s-pipe-%s- >> %s%s", get_psr_mode_str_for_output(&data, outputs[i]), >> + >> kmstest_pipe_name(pipes[i]), >> >> igt_output_name(outputs[i]), >> >> coexist_feature_str(j)) { >>                                         data.pipe = pipes[i]; >>                                         data.output = outputs[i]; >>                                         data.test_plane_id = >> DRM_PLANE_TYPE_OVERLAY; >>                                         data.coexist_feature = j; >> +                                       data.psr_mode = >> get_sel_fetch_mode_for_output(&data, data.output); >> +                                       igt_assert_f(data.psr_mode != >> PSR_DISABLED, >> + >> "Invalid psr mode\n"); >>                                         prepare(&data); >>                                         run(&data); >>                                         cleanup(&data); >> @@ -1312,13 +1389,17 @@ igt_main >>                                 for (j = FEATURE_NONE; j < >> FEATURE_COUNT; j++) { >>                                         if (j != FEATURE_NONE && >> !(coexist_features[i] & j)) >>                                                 continue; >> -                                       igt_dynamic_f("pipe-%s-%s%s", >> kmstest_pipe_name(pipes[i]), >> +                                       igt_dynamic_f("%s-pipe-%s- >> %s%s", get_psr_mode_str_for_output(&data, outputs[i]), >> + >> kmstest_pipe_name(pipes[i]), >> >> igt_output_name(outputs[i]), >> >> coexist_feature_str(j)) { >>                                                 data.pipe = pipes[i]; >>                                                 data.output = >> outputs[i]; >>                                                 data.test_plane_id = >> DRM_PLANE_TYPE_OVERLAY; >>                                                 data.coexist_feature >> = j; >> +                                               data.psr_mode = >> get_sel_fetch_mode_for_output(&data, data.output); >> +                                               igt_assert_f(data.psr >> _mode != PSR_DISABLED, >> + >>     "Invalid psr mode\n"); >>                                                 prepare(&data); >>                                                 run(&data); >>                                                 cleanup(&data); >> @@ -1339,13 +1420,17 @@ igt_main >>                                 for (j = FEATURE_NONE; j < >> FEATURE_COUNT; j++) { >>                                         if (j != FEATURE_NONE && >> !(coexist_features[i] & j)) >>                                                 continue; >> -                                       igt_dynamic_f("pipe-%s-%s%s", >> kmstest_pipe_name(pipes[i]), >> +                                       igt_dynamic_f("%s-pipe-%s- >> %s%s", get_psr_mode_str_for_output(&data, outputs[i]), >> + >> kmstest_pipe_name(pipes[i]), >> >> igt_output_name(outputs[i]), >> >> coexist_feature_str(j)) { >>                                                 data.pipe = pipes[i]; >>                                                 data.output = >> outputs[i]; >>                                                 data.test_plane_id = >> DRM_PLANE_TYPE_OVERLAY; >>                                                 data.coexist_feature >> = j; >> +                                               data.psr_mode = >> get_sel_fetch_mode_for_output(&data, data.output); >> +                                               igt_assert_f(data.psr >> _mode != PSR_DISABLED, >> + >>     "Invalid psr mode\n"); >>                                                 prepare(&data); >>                                                 run(&data); >>                                                 cleanup(&data); >> @@ -1367,7 +1452,8 @@ igt_main >>                                 for (j = FEATURE_NONE; j < >> FEATURE_COUNT; j++) { >>                                         if (j != FEATURE_NONE && >> !(coexist_features[i] & j)) >>                                                 continue; >> -                                       igt_dynamic_f("pipe-%s-%s%s", >> kmstest_pipe_name(pipes[i]), >> +                                       igt_dynamic_f("%s-pipe-%s- >> %s%s", kmstest_pipe_name(pipes[i]), >> + >> get_psr_mode_str_for_output(&data, outputs[i]), >> >> igt_output_name(outputs[i]), >> >> coexist_feature_str(j)) { >>                                                 data.pipe = pipes[i]; >> @@ -1376,6 +1462,9 @@ igt_main >>                                                         data.damage_a >> rea_count = k; >>                                                         data.test_pla >> ne_id = DRM_PLANE_TYPE_PRIMARY; >>                                                         data.coexist_ >> feature = j; >> +                                                       data.psr_mode >> = get_sel_fetch_mode_for_output(&data, data.output); >> +                                                       igt_assert_f( >> data.psr_mode != PSR_DISABLED, >> + >>             "Invalid psr mode\n"); >>                                                         prepare(&data >> ); >>                                                         run(&data); >>                                                         cleanup(&data >> ); >> @@ -1400,7 +1489,8 @@ igt_main >>                                 for (j = FEATURE_NONE; j < >> FEATURE_COUNT; j++) { >>                                         if (j != FEATURE_NONE && >> !(coexist_features[i] & j)) >>                                                 continue; >> -                                       igt_dynamic_f("pipe-%s-%s%s", >> kmstest_pipe_name(pipes[i]), >> +                                       igt_dynamic_f("%s-pipe-%s- >> %s%s", get_psr_mode_str_for_output(&data, outputs[i]), >> + >> kmstest_pipe_name(pipes[i]), >> >> igt_output_name(outputs[i]), >> >> coexist_feature_str(j)) { >>                                                 data.pipe = pipes[i]; >> @@ -1412,6 +1502,9 @@ igt_main >>                                                         data.primary_ >> format = DRM_FORMAT_NV12; >>                                                 data.test_plane_id = >> DRM_PLANE_TYPE_OVERLAY; >>                                                 data.coexist_feature >> = j; >> +                                               data.psr_mode = >> get_sel_fetch_mode_for_output(&data, data.output); >> +                                               igt_assert_f(data.psr >> _mode != PSR_DISABLED, >> + >>     "Invalid psr mode\n"); >>                                                 prepare(&data); >>                                                 run(&data); >>                                                 cleanup(&data); Regards Kunal Joshi --------------BaPfDmn2t0NR08Adpjk400gl Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: 8bit

Hello Jouni,

On 2/16/2024 1:55 PM, Hogander, Jouni wrote:
On Thu, 2024-02-08 at 20:24 +0530, Kunal Joshi wrote:
Extend the tests to cover panel replay selective fetch feature.

>From kms_psr2_sf test point of view we have
check_pr_psr2_sel_fetch_support
function to check if PR/PSR2 selective fetch is supported for an
output
if output supports selective fetch then we check we enter DEEP_SLEEP
mode
in run function

v2: fixed dynamic test name
v3: use check_psr2_support (Jouni)
v4: correct order of checks in check_pr_psr2_sel_fetch_support
(Jouni)
    use appropriate psr mode in psr_wait_entry (Jouni)

Cc: Jouni Högander <jouni.hogander@intel.com>
Cc: Animesh Manna <animesh.manna@intel.com>
Cc: Arun R Murthy <arun.r.murthy@intel.com>
Signed-off-by: Kunal Joshi <kunal1.joshi@intel.com>
---
 tests/intel/kms_psr2_sf.c | 147 +++++++++++++++++++++++++++++++-----
--
 1 file changed, 120 insertions(+), 27 deletions(-)

diff --git a/tests/intel/kms_psr2_sf.c b/tests/intel/kms_psr2_sf.c
index 8e6a9e02c..0595c1f11 100644
--- a/tests/intel/kms_psr2_sf.c
+++ b/tests/intel/kms_psr2_sf.c
@@ -172,6 +172,7 @@ typedef struct {
        uint32_t screen_changes;
        int cur_x, cur_y;
        enum pipe pipe;
+       enum psr_mode psr_mode;
        enum {
                FEATURE_NONE  = 0,
                FEATURE_DSC   = 1,
@@ -179,6 +180,34 @@ typedef struct {
        } coexist_feature;
 } data_t;
 
+static enum psr_mode get_sel_fetch_mode_for_output(data_t *data,
igt_output_t *output)
+{
+       enum psr_mode mode = PSR_DISABLED;
+
+       if (psr_sink_support(data->drm_fd, data->debugfs_fd,
+                                                PR_MODE_SEL_FETCH,
output))
+               mode = PR_MODE_SEL_FETCH;
+       else if (psr_sink_support(data->drm_fd, data->debugfs_fd,
+                                                         PSR_MODE_2,
output))
+               mode = PSR_MODE_2;
+       else
+               igt_info("selective fetch not supported on output
%s\n", output->name);
+
+       return mode;
+}
+
+static const char *get_psr_mode_str_for_output(data_t *data,
igt_output_t *output)
+{
+       const char *psr_mode = NULL;
If you are doing it this way this variable should be static. I'm not
sure if renaming these testcases to pr-* and psr2-* gives any benefit.
I'll guess it is ok, if you want to do that change.

Have addressed your comment in the next revision, kept the naming just to know
test executed on PR or PSR panel.


+
+       if (get_sel_fetch_mode_for_output(data, output) ==
PR_MODE_SEL_FETCH)
+               psr_mode = "pr-";
+       else if (get_sel_fetch_mode_for_output(data, output) ==
PSR_MODE_2)
+               psr_mode = "psr2-";
+       igt_assert_f(psr_mode, "Invalid psr mode\n");
+       return psr_mode;
+}
+
 static const char *op_str(enum operations op)
 {
        static const char * const name[] = {
@@ -688,7 +717,7 @@ static void damaged_plane_move(data_t *data)
 
        igt_display_commit2(&data->display, COMMIT_ATOMIC);
 
-       igt_assert(psr_wait_entry(data->debugfs_fd, PSR_MODE_2,
NULL));
+       igt_assert(psr_wait_entry(data->debugfs_fd, data->psr_mode,
data->output));
Not really matter of this patch. I think at some point you need one
more patch to differentiate in psr_wait_entry (psr_active_check) based
on output type eDP vs. DP. See Bspec 68920 "Additional programming
considerations (registers common between eDP and DP)".

Sure will send this changes as separate later.

BR,

Jouni Högander

 
        expected_output(data);
 }
@@ -788,7 +817,7 @@ static void plane_move_continuous(data_t *data)
 {
        int target_x, target_y;
 
-       igt_assert(psr_wait_entry(data->debugfs_fd, PSR_MODE_2,
NULL));
+       igt_assert(psr_wait_entry(data->debugfs_fd, data->psr_mode,
data->output));
 
        get_target_coords(data, &target_x, &target_y);
 
@@ -865,7 +894,7 @@ static void damaged_plane_update(data_t *data)
        igt_plane_set_position(data->test_plane, 0, 0);
        igt_display_commit2(&data->display, COMMIT_ATOMIC);
 
-       igt_assert(psr_wait_entry(data->debugfs_fd, PSR_MODE_2,
NULL));
+       igt_assert(psr_wait_entry(data->debugfs_fd, data->psr_mode,
data->output));
 
        expected_output(data);
 }
@@ -874,7 +903,7 @@ static void run(data_t *data)
 {
        int i;
 
-       igt_assert(psr_wait_entry(data->debugfs_fd, PSR_MODE_2,
NULL));
+       igt_assert(psr_wait_entry(data->debugfs_fd, data->psr_mode,
data->output));
 
        if (data->fbc_flag == true && data->op_fbc_mode ==
FBC_ENABLED)
                igt_assert_f(intel_fbc_wait_until_enabled(data-
drm_fd,
@@ -952,14 +981,24 @@ static void cleanup(data_t *data)
        igt_remove_fb(data->drm_fd, &data->fb_test);
 }
 
-static int check_psr2_support(data_t *data)
+static bool check_pr_psr2_sel_fetch_support(data_t *data)
 {
-       int status;
+       bool status = false;
+       enum psr_mode psr_mode;
+
+       /* Check sink supports PR/PSR2 selective fetch */
+       psr_mode = get_sel_fetch_mode_for_output(data, data->output);
+       if (psr_mode == PSR_DISABLED)
+               return false;
+
+       /* Check if selective fetch can be enabled */
+       if (!selective_fetch_check(data->debugfs_fd, data->output))
+               igt_assert("Selective fetch is not enabled even
though panel should support it\n");
 
        prepare(data);
-       status = psr_wait_entry(data->debugfs_fd, PSR_MODE_2, NULL);
+       /* We enter into DEEP_SLEEP for both PSR2 and PR sel fetch */
+       status = psr_wait_entry(data->debugfs_fd, psr_mode, data-
output);
        cleanup(data);
-
        return status;
 }
 
@@ -981,6 +1020,8 @@ pipe_output_combo_valid(igt_display_t *display,
 
 igt_main
 {
+       bool output_supports_pr_psr2_sel_fetch = false;
+       bool pr_psr2_sel_fetch_supported = false;
        data_t data = {};
        igt_output_t *outputs[IGT_MAX_PIPES * IGT_MAX_PIPES];
        int i, j, k, y;
@@ -1000,11 +1041,6 @@ igt_main
                data.debugfs_fd = igt_debugfs_dir(data.drm_fd);
                kmstest_set_vt_graphics_mode();
 
-               igt_require_f(psr_sink_support(data.drm_fd,
-                                              data.debugfs_fd,
PSR_MODE_2,
-                                              NULL),
-                             "Sink does not support PSR2\n");
-
                display_init(&data);
 
                if
((intel_display_ver(intel_get_drm_devid(data.drm_fd)) >= 20) &&
@@ -1023,7 +1059,8 @@ igt_main
 
                for_each_pipe_with_valid_output(&data.display,
data.pipe, data.output) {
                        coexist_features[n_pipes] = 0;
-                       if (check_psr2_support(&data)) {
+                       output_supports_pr_psr2_sel_fetch =
check_pr_psr2_sel_fetch_support(&data);
+                       if (output_supports_pr_psr2_sel_fetch) {
                                pipes[n_pipes] = data.pipe;
                                outputs[n_pipes] = data.output;
 
@@ -1032,7 +1069,10 @@ igt_main
 
                                n_pipes++;
                        }
+                       pr_psr2_sel_fetch_supported |=
output_supports_pr_psr2_sel_fetch;
                }
+               igt_require_f(pr_psr2_sel_fetch_supported,
+                                         "No output supports
selective fetch\n");
        }
 
        for (y = 0; y < ARRAY_SIZE(fbc_status); y++) {
@@ -1053,13 +1093,17 @@ igt_main
                                for (j = FEATURE_NONE; j <
FEATURE_COUNT; j++) {
                                        if (j != FEATURE_NONE &&
!(coexist_features[i] & j))
                                                continue;
-                                       igt_dynamic_f("pipe-%s-%s%s",
kmstest_pipe_name(pipes[i]),
+                                       igt_dynamic_f("%s-pipe-%s-
%s%s", get_psr_mode_str_for_output(&data, outputs[i]),
+                                                        
kmstest_pipe_name(pipes[i]),
                                                     
igt_output_name(outputs[i]),
                                                     
coexist_feature_str(j)) {
                                                data.pipe = pipes[i];
                                                data.output =
outputs[i];
                                                data.test_plane_id =
DRM_PLANE_TYPE_PRIMARY;
                                                data.coexist_feature
= j;
+                                               data.psr_mode =
get_sel_fetch_mode_for_output(&data, data.output);
+                                               igt_assert_f(data.psr
_mode != PSR_DISABLED,
+                                                                    
    "Invalid psr mode\n");
                                                for (k = 1; k <=
MAX_DAMAGE_AREAS; k++) {
                                                        data.damage_a
rea_count = k;
                                                        prepare(&data
);
@@ -1086,7 +1130,8 @@ igt_main
                                        for (j = FEATURE_NONE; j <
FEATURE_COUNT; j++) {
                                                if (j != FEATURE_NONE
&& !(coexist_features[i] & j))
                                                        continue;
-                                               igt_dynamic_f("pipe-
%s-%s%s",
+                                               igt_dynamic_f("%s-
pipe-%s-%s%s",
+                                                                
get_psr_mode_str_for_output(&data, outputs[i]),
                                                             
kmstest_pipe_name(pipes[i]),
                                                             
igt_output_name(outputs[i]),
                                                             
coexist_feature_str(j)) {
@@ -1094,6 +1139,9 @@ igt_main
                                                        data.output =
outputs[i];
                                                        data.test_pla
ne_id = DRM_PLANE_TYPE_PRIMARY;
                                                        data.coexist_
feature = j;
+                                                       data.psr_mode
= get_sel_fetch_mode_for_output(&data, data.output);
+                                                       igt_assert_f(
data.psr_mode != PSR_DISABLED,
+                                                                    
            "Invalid psr mode\n");
                                                        for (k = 1; k
<= MAX_DAMAGE_AREAS; k++) {
                                                                data.
damage_area_count = k;
                                                                prepa
re(&data);
@@ -1118,13 +1166,17 @@ igt_main
                                for (j = FEATURE_NONE; j <
FEATURE_COUNT; j++) {
                                        if (j != FEATURE_NONE &&
!(coexist_features[i] & j))
                                                continue;
-                                       igt_dynamic_f("pipe-%s-%s%s",
kmstest_pipe_name(pipes[i]),
+                                       igt_dynamic_f("%s-pipe-%s-
%s%s", get_psr_mode_str_for_output(&data, outputs[i]),
+                                                        
kmstest_pipe_name(pipes[i]),
                                                     
igt_output_name(outputs[i]),
                                                     
coexist_feature_str(j)) {
                                                data.pipe = pipes[i];
                                                data.output =
outputs[i];
                                                data.test_plane_id =
DRM_PLANE_TYPE_OVERLAY;
                                                data.coexist_feature
= j;
+                                               data.psr_mode =
get_sel_fetch_mode_for_output(&data, data.output);
+                                               igt_assert_f(data.psr
_mode != PSR_DISABLED,
+                                                                    
    "Invalid psr mode\n");
                                                for (k = 1; k <=
MAX_DAMAGE_AREAS; k++) {
                                                        data.damage_a
rea_count = k;
                                                        prepare(&data
);
@@ -1148,13 +1200,17 @@ igt_main
                                for (j = FEATURE_NONE; j <
FEATURE_COUNT; j++) {
                                        if (j != FEATURE_NONE &&
!(coexist_features[i] & j))
                                                continue;
-                                       igt_dynamic_f("pipe-%s-%s%s",
kmstest_pipe_name(pipes[i]),
+                                       igt_dynamic_f("%s-pipe-%s-
%s%s", get_psr_mode_str_for_output(&data, outputs[i]),
+                                                        
kmstest_pipe_name(pipes[i]),
                                                     
igt_output_name(outputs[i]),
                                                     
coexist_feature_str(j)) {
                                                data.pipe = pipes[i];
                                                data.output =
outputs[i];
                                                data.test_plane_id =
DRM_PLANE_TYPE_CURSOR;
                                                data.coexist_feature
= j;
+                                               data.psr_mode =
get_sel_fetch_mode_for_output(&data, data.output);
+                                               igt_assert_f(data.psr
_mode != PSR_DISABLED,
+                                                                    
    "Invalid psr mode\n");
                                                prepare(&data);
                                                run(&data);
                                                cleanup(&data);
@@ -1174,13 +1230,17 @@ igt_main
                                for (j = FEATURE_NONE; j <
FEATURE_COUNT; j++) {
                                        if (j != FEATURE_NONE &&
!(coexist_features[i] & j))
                                                continue;
-                                       igt_dynamic_f("pipe-%s-%s%s",
kmstest_pipe_name(pipes[i]),
+                                       igt_dynamic_f("%s-pipe-%s-
%s%s", get_psr_mode_str_for_output(&data, outputs[i]),
+                                                        
kmstest_pipe_name(pipes[i]),
                                                     
igt_output_name(outputs[i]),
                                                     
coexist_feature_str(j)) {
                                                data.pipe = pipes[i];
                                                data.output =
outputs[i];
                                                data.test_plane_id =
DRM_PLANE_TYPE_CURSOR;
                                                data.coexist_feature
= j;
+                                               data.psr_mode =
get_sel_fetch_mode_for_output(&data, data.output);
+                                               igt_assert_f(data.psr
_mode != PSR_DISABLED,
+                                                                    
    "Invalid psr mode\n");
                                                prepare(&data);
                                                run(&data);
                                                cleanup(&data);
@@ -1201,13 +1261,17 @@ igt_main
                                for (j = FEATURE_NONE; j <
FEATURE_COUNT; j++) {
                                        if (j != FEATURE_NONE &&
!(coexist_features[i] & j))
                                                continue;
-                                       igt_dynamic_f("pipe-%s-%s%s",
kmstest_pipe_name(pipes[i]),
+                                       igt_dynamic_f("%s-pipe-%s-
%s%s", get_psr_mode_str_for_output(&data, outputs[i]),
+                                                        
kmstest_pipe_name(pipes[i]),
                                                     
igt_output_name(outputs[i]),
                                                     
coexist_feature_str(j)) {
                                                data.pipe = pipes[i];
                                                data.output =
outputs[i];
                                                data.test_plane_id =
DRM_PLANE_TYPE_CURSOR;
                                                data.coexist_feature
= j;
+                                               data.psr_mode =
get_sel_fetch_mode_for_output(&data, data.output);
+                                               igt_assert_f(data.psr
_mode != PSR_DISABLED,
+                                                                    
    "Invalid psr mode\n");
                                                prepare(&data);
                                                run(&data);
                                                cleanup(&data);
@@ -1228,13 +1292,17 @@ igt_main
                                for (j = FEATURE_NONE; j <
FEATURE_COUNT; j++) {
                                        if (j != FEATURE_NONE &&
!(coexist_features[i] & j))
                                                continue;
-                                       igt_dynamic_f("pipe-%s-%s%s",
kmstest_pipe_name(pipes[i]),
+                                       igt_dynamic_f("%s-pipe-%s-
%s%s", get_psr_mode_str_for_output(&data, outputs[i]),
+                                                        
kmstest_pipe_name(pipes[i]),
                                                     
igt_output_name(outputs[i]),
                                                     
coexist_feature_str(j)) {
                                                data.pipe = pipes[i];
                                                data.output =
outputs[i];
                                                data.test_plane_id =
DRM_PLANE_TYPE_CURSOR;
                                                data.coexist_feature
= j;
+                                               data.psr_mode =
get_sel_fetch_mode_for_output(&data, data.output);
+                                               igt_assert_f(data.psr
_mode != PSR_DISABLED,
+                                                                    
    "Invalid psr mode\n");
                                                prepare(&data);
                                                run(&data);
                                                cleanup(&data);
@@ -1256,13 +1324,18 @@ igt_main
                                for (j = FEATURE_NONE; j <
FEATURE_COUNT; j++) {
                                        if (j != FEATURE_NONE &&
!(coexist_features[i] & j))
                                                continue;
-                                       igt_dynamic_f("pipe-%s-%s%s",
kmstest_pipe_name(pipes[i]),
+                                       igt_dynamic_f("%s-pipe-%s-
%s%s",
+                                                        
get_psr_mode_str_for_output(&data, outputs[i]),
+                                                        
kmstest_pipe_name(pipes[i]),
                                                     
igt_output_name(outputs[i]),
                                                     
coexist_feature_str(j)) {
                                                data.pipe = pipes[i];
                                                data.output =
outputs[i];
                                                data.test_plane_id =
DRM_PLANE_TYPE_OVERLAY;
                                                data.coexist_feature
= j;
+                                               data.psr_mode =
get_sel_fetch_mode_for_output(&data, data.output);
+                                               igt_assert_f(data.psr
_mode != PSR_DISABLED,
+                                                                    
    "Invalid psr mode\n");
                                                for (k =
POS_TOP_LEFT; k <= POS_BOTTOM_RIGHT ; k++) {
                                                        data.pos = k;
                                                        prepare(&data
);
@@ -1285,13 +1358,17 @@ igt_main
                                for (j = FEATURE_NONE; j <
FEATURE_COUNT; j++) {
                                        if (j != FEATURE_NONE &&
!(coexist_features[i] & j))
                                                continue;
-                                       igt_dynamic_f("pipe-%s-%s%s",
kmstest_pipe_name(pipes[i]),
+                                       igt_dynamic_f("%s-pipe-%s-
%s%s", get_psr_mode_str_for_output(&data, outputs[i]),
+                                                        
kmstest_pipe_name(pipes[i]),
                                                     
igt_output_name(outputs[i]),
                                                     
coexist_feature_str(j)) {
                                        data.pipe = pipes[i];
                                        data.output = outputs[i];
                                        data.test_plane_id =
DRM_PLANE_TYPE_OVERLAY;
                                        data.coexist_feature = j;
+                                       data.psr_mode =
get_sel_fetch_mode_for_output(&data, data.output);
+                                       igt_assert_f(data.psr_mode !=
PSR_DISABLED,
+                                                               
"Invalid psr mode\n");
                                        prepare(&data);
                                        run(&data);
                                        cleanup(&data);
@@ -1312,13 +1389,17 @@ igt_main
                                for (j = FEATURE_NONE; j <
FEATURE_COUNT; j++) {
                                        if (j != FEATURE_NONE &&
!(coexist_features[i] & j))
                                                continue;
-                                       igt_dynamic_f("pipe-%s-%s%s",
kmstest_pipe_name(pipes[i]),
+                                       igt_dynamic_f("%s-pipe-%s-
%s%s", get_psr_mode_str_for_output(&data, outputs[i]),
+                                                        
kmstest_pipe_name(pipes[i]),
                                                     
igt_output_name(outputs[i]),
                                                     
coexist_feature_str(j)) {
                                                data.pipe = pipes[i];
                                                data.output =
outputs[i];
                                                data.test_plane_id =
DRM_PLANE_TYPE_OVERLAY;
                                                data.coexist_feature
= j;
+                                               data.psr_mode =
get_sel_fetch_mode_for_output(&data, data.output);
+                                               igt_assert_f(data.psr
_mode != PSR_DISABLED,
+                                                                    
    "Invalid psr mode\n");
                                                prepare(&data);
                                                run(&data);
                                                cleanup(&data);
@@ -1339,13 +1420,17 @@ igt_main
                                for (j = FEATURE_NONE; j <
FEATURE_COUNT; j++) {
                                        if (j != FEATURE_NONE &&
!(coexist_features[i] & j))
                                                continue;
-                                       igt_dynamic_f("pipe-%s-%s%s",
kmstest_pipe_name(pipes[i]),
+                                       igt_dynamic_f("%s-pipe-%s-
%s%s", get_psr_mode_str_for_output(&data, outputs[i]),
+                                                        
kmstest_pipe_name(pipes[i]),
                                                     
igt_output_name(outputs[i]),
                                                     
coexist_feature_str(j)) {
                                                data.pipe = pipes[i];
                                                data.output =
outputs[i];
                                                data.test_plane_id =
DRM_PLANE_TYPE_OVERLAY;
                                                data.coexist_feature
= j;
+                                               data.psr_mode =
get_sel_fetch_mode_for_output(&data, data.output);
+                                               igt_assert_f(data.psr
_mode != PSR_DISABLED,
+                                                                    
    "Invalid psr mode\n");
                                                prepare(&data);
                                                run(&data);
                                                cleanup(&data);
@@ -1367,7 +1452,8 @@ igt_main
                                for (j = FEATURE_NONE; j <
FEATURE_COUNT; j++) {
                                        if (j != FEATURE_NONE &&
!(coexist_features[i] & j))
                                                continue;
-                                       igt_dynamic_f("pipe-%s-%s%s",
kmstest_pipe_name(pipes[i]),
+                                       igt_dynamic_f("%s-pipe-%s-
%s%s", kmstest_pipe_name(pipes[i]),
+                                                        
get_psr_mode_str_for_output(&data, outputs[i]),
                                                     
igt_output_name(outputs[i]),
                                                     
coexist_feature_str(j)) {
                                                data.pipe = pipes[i];
@@ -1376,6 +1462,9 @@ igt_main
                                                        data.damage_a
rea_count = k;
                                                        data.test_pla
ne_id = DRM_PLANE_TYPE_PRIMARY;
                                                        data.coexist_
feature = j;
+                                                       data.psr_mode
= get_sel_fetch_mode_for_output(&data, data.output);
+                                                       igt_assert_f(
data.psr_mode != PSR_DISABLED,
+                                                                    
            "Invalid psr mode\n");
                                                        prepare(&data
);
                                                        run(&data);
                                                        cleanup(&data
);
@@ -1400,7 +1489,8 @@ igt_main
                                for (j = FEATURE_NONE; j <
FEATURE_COUNT; j++) {
                                        if (j != FEATURE_NONE &&
!(coexist_features[i] & j))
                                                continue;
-                                       igt_dynamic_f("pipe-%s-%s%s",
kmstest_pipe_name(pipes[i]),
+                                       igt_dynamic_f("%s-pipe-%s-
%s%s", get_psr_mode_str_for_output(&data, outputs[i]),
+                                                        
kmstest_pipe_name(pipes[i]),
                                                     
igt_output_name(outputs[i]),
                                                     
coexist_feature_str(j)) {
                                                data.pipe = pipes[i];
@@ -1412,6 +1502,9 @@ igt_main
                                                        data.primary_
format = DRM_FORMAT_NV12;
                                                data.test_plane_id =
DRM_PLANE_TYPE_OVERLAY;
                                                data.coexist_feature
= j;
+                                               data.psr_mode =
get_sel_fetch_mode_for_output(&data, data.output);
+                                               igt_assert_f(data.psr
_mode != PSR_DISABLED,
+                                                                    
    "Invalid psr mode\n");
                                                prepare(&data);
                                                run(&data);
                                                cleanup(&data);

Regards
Kunal Joshi --------------BaPfDmn2t0NR08Adpjk400gl--