From patchwork Tue Feb 16 22:28:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harry Wentland X-Patchwork-Id: 8332971 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 400329F6E7 for ; Tue, 16 Feb 2016 22:30:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B735A2034A for ; Tue, 16 Feb 2016 22:30:14 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 7DABD202EB for ; Tue, 16 Feb 2016 22:30:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0EA076E8C2; Tue, 16 Feb 2016 22:29:06 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from na01-bl2-obe.outbound.protection.outlook.com (mail-bl2on0084.outbound.protection.outlook.com [65.55.169.84]) by gabe.freedesktop.org (Postfix) with ESMTPS id 65F966E8E1 for ; Tue, 16 Feb 2016 22:28:56 +0000 (UTC) Received: from BY2PR12CA0029.namprd12.prod.outlook.com (10.160.121.39) by BLUPR12MB0705.namprd12.prod.outlook.com (10.163.218.143) with Microsoft SMTP Server (TLS) id 15.1.409.15; Tue, 16 Feb 2016 22:28:53 +0000 Received: from BY2NAM03FT058.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e4a::205) by BY2PR12CA0029.outlook.office365.com (2a01:111:e400:2c84::39) with Microsoft SMTP Server (TLS) id 15.1.409.15 via Frontend Transport; Tue, 16 Feb 2016 22:28:53 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.222) smtp.mailfrom=amd.com; lists.freedesktop.org; dkim=none (message not signed) header.d=none;lists.freedesktop.org; dmarc=permerror action=none header.from=amd.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from atltwp02.amd.com (165.204.84.222) by BY2NAM03FT058.mail.protection.outlook.com (10.152.85.184) with Microsoft SMTP Server id 15.1.415.6 via Frontend Transport; Tue, 16 Feb 2016 22:28:52 +0000 X-WSS-ID: 0O2NVRZ-08-5UE-02 X-M-MSG: Received: from satlvexedge01.amd.com (satlvexedge01.amd.com [10.177.96.28]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by atltwp02.amd.com (Axway MailGate 5.3.1) with ESMTPS id 2BAD6BD8974 for ; Tue, 16 Feb 2016 17:28:46 -0500 (EST) Received: from SATLEXDAG01.amd.com (10.181.40.3) by satlvexedge01.amd.com (10.177.96.28) with Microsoft SMTP Server (TLS) id 14.3.195.1; Tue, 16 Feb 2016 16:28:53 -0600 Received: from STOREXDAG02.amd.com (10.1.13.11) by SATLEXDAG01.amd.com (10.181.40.3) with Microsoft SMTP Server (TLS) id 14.3.266.1; Tue, 16 Feb 2016 17:28:48 -0500 Received: from cnhwentlanub.amd.com (172.29.225.36) by storexdag02.amd.com (10.1.13.11) with Microsoft SMTP Server id 14.3.266.1; Tue, 16 Feb 2016 17:28:49 -0500 From: Harry Wentland To: Subject: [PATCH v2 23/26] drm/amd/dal: Add empty encoder programming for virtual HW Date: Tue, 16 Feb 2016 17:28:03 -0500 Message-ID: <16c71159fc0d667008109287e534a2a17b099b25.1455660367.git.harry.wentland@amd.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: <1455211209-26733-1-git-send-email-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:165.204.84.222; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(428002)(189002)(199003)(101416001)(5003600100002)(92566002)(2906002)(1096002)(1220700001)(48376002)(76176999)(50986999)(450100001)(2950100001)(586003)(4326007)(118296001)(47776003)(5003940100001)(77096005)(33646002)(11100500001)(5008740100001)(19580405001)(86362001)(50466002)(575784001)(19580395003)(105586002)(189998001)(36756003)(110136002)(2351001)(53416004)(229853001)(87936001)(50226001)(106466001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR12MB0705; H:atltwp02.amd.com; FPR:; SPF:None; MLV:sfv; MX:1; A:1; LANG:en; X-MS-Office365-Filtering-Correlation-Id: 7201dd51-4039-4ee9-7521-08d337208cce X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0705; 2:Z1FjUNlbVevrO3L8CqM5F3cmF4TZVAk9AogqJIdCY8qRfa+n7nOuwPDevvmyZMwgtM1oPBM6F9j9htUrFUy29/UEOpzAAzCPXftMenC7n15CwzLimqs7VP1YPOyEaIzZI63In0GsuWpkQyjCt200jWeOCa8LsiT7ofhHIC4FXdYkSjnlEU3xyvcvhETgrrkj; 3:YNa7N6lqbmkzVplbGTo16Ko6kDJG/E8CnhIMiF+krU6KE8ZyNNwkVPCLUCNJjoxq0CHGZ2f0guC6rEvx7Zke/7RjMjpRQPS5NfvKYVEKRHKrJy678HA+M1zP++q3dk/6YlS1IJHkR7441+/ZWZBqgdSR73YUEe0PXUp+0mthTAekNoYQSZYVWv1DxBrGAy2+N0aowQA2lTyzLK+Nvx26ZXHGasuHPlGBsqkg1gXStg4=; 25:fOzOAZ17YKbcXsuSOvxKcG6zPem61qxfGIwrZ+ff/2bpDouEtDIFdVxgUEvmWnWRqmjAptDrkQod6ToGCejh+sCoADUDhwghRC3sELovq2HYOPUjOumm0FiYcY1xwIwcDMWj4k//Ns+o0TYqY1ddlfZwt77oWKkmQRWP4t19dkcWyUx4nVLMD9fdvPmM6C7xIeuRicGLyUqHq82KvRldRCr3u7ZsTid6lNXHtLAKROsJ1uWOLHL34UdWSwJcrEmAq6A/1b6NPStbnN/uTzLq2yt/3Jkywr0dEOdhPu7cx6AN5NQpNRgHT7Ai0bpsGm06 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR12MB0705; X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0705; 20:RQOX+3nXdPqwFQLCGpB8mfCvplHf+1VoppXlLyGShYqoM5/zmG+x+dLzGtm3HsIfrafzGkm7Nd4q/g5wYXlPi+/bGD/ng3ojhi/v+mJsRb0J9Rcjsg+GOXCR3LD8ThUuSicmN75KtKxhc38xcO9eYoosPwGyxGtifLPlDXOdjAfTdfoMUHAmIwEzf2A0t/yHgGNLihj3XYnSgtfW7PrAnksproJfA76FUp9uNdsdZec2fwm7JLKRhpYCt9yRZifHCT6qWn3gNQoyAmpHJ204dkkgFaMfmsoZTRmJ4qiTb81H9KEgZg2wVzgjOfCJgG7LNNVc/e99BUV1bodaHYhYkySv2p7P3sXV/3AQUOZT4y4RN9MtfdB5AKNW1LK1uJ816A8NfMomR9+ZP/44QmH1OjXwO2uH0zqKYRIjYVKwLQRpu7B/Gc7jtk+u4O4st8xz6uQLANo/+xSvBtZ63hv5/zC4MJauvvYTxbZai0TYUFQ7urcaNjR7zpP/91kqhbZv X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13017025)(13015025)(5005006)(13018025)(13023025)(13024025)(8121501046)(10201501046)(3002001); SRVR:BLUPR12MB0705; BCL:0; PCL:0; RULEID:; SRVR:BLUPR12MB0705; X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0705; 4:+HISUuSDoswdih88391SMNvhD7Lkpb/cdG/SGZAEwRNTsHczpbQbMQLHKqw5bwDHQtq2MzumG4Qz3t8Au9TAJ52nH94v97n8wTQDkrWwYYBVIDz8wHQSSdW+inOoscJonrlMz0aq4ZIoVx+pcD2zH5dR9KDYN1fLv+FzfrKP7diyczvo07rlLmY/LY8B9Z0B6U2ZZmSFMkBU/bcANrm8EJACW0ZldrgxikzMcavCRKR+8RGnQVHG2MUdFmpBxoUDGwpmXKDyY0PU/a10BYP002yTDQ2JD92TU8bRkJ7e4oADO+TW58tf/A/irjvDkQzcBch+ZDb5zOVLqID62B83BR8tM3wdVz6Vcdm9yLs/qEFUDHiLDGlN3h6lbfDoioC0PnUW8oxm56k1N9ERPBoc0CM9jK4jbGGiGsVRqrNOUnUKEcChtIMANYo3gYRHetptMazL0D1+SdsQiHLlV6nwX7cS2/S2ecZRuf0Pk11BhYoHFfZAPCFTGGJo+2OXoRHH X-Forefront-PRVS: 0854128AF0 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR12MB0705; 23:eioctLcrIs+1PqAT0m6TIw3CsW4o5xELm0c3JoeI4?= =?us-ascii?Q?Ds7wDZJUyXpSLkNnRhSETTD26IGqZYhu478/DJkheRm7XUUWeLbpJTvZY3Qr?= =?us-ascii?Q?enzISBp7WYrQPS6IXwjhCFstWmRIWo2xoMYiKVlBMiynXaRzc2VEMoW1IMWJ?= =?us-ascii?Q?EcQ7COp4SB/1B6U0vrvNbQ2wnTeUcUIX1D/4xSLkcmJe4oyb7Isytb+26SxV?= =?us-ascii?Q?59KdQEe5l4J/7iCrp7BlIeL8nZYOOWX5YhisOKHORTjPRGkaT4ucizV/LMwy?= =?us-ascii?Q?C5dJSHMJ4fvz11XGptmnOqbrX4Vs6kjtGIfYMFaL6BwM77nuXIcA9iokJSJ7?= =?us-ascii?Q?ZoLD3tugv97GTVOVnqa5LirdEcNKON0gOC0k0Rk55qf1OLg9qzPZXDGVHZ3e?= =?us-ascii?Q?vOAELPPxSaWScGDW4fBEVTvgKYmBbJiNAS6TP3lUW6BhfvUwIp7q7dFJKl9U?= =?us-ascii?Q?s/FWuBI5B6en1xpBgIJ3lPn5kW9wsKi/9Q0jHNk4P1jfxXqe5U887/UEEi19?= =?us-ascii?Q?L6M9B7zQFbQYvm54AK0R99ns0rbamSb3mlRVRNFib534H/UghewzMEJ9UpCZ?= =?us-ascii?Q?++xMYM8gN2ALrVu0fBOj8F14TLEMAXd86lwv1whOBV6dKIvX5YV3WnAu7Kc5?= =?us-ascii?Q?wa839TKr57pAoZ+seYz/LueuwYaMH2ZS5E1GBtqDxY5d/UfvrAqvYCZkBvD8?= =?us-ascii?Q?GIKibqrDS8N9y2FRlNSZfhvolyjHd4SLZBbIf7Ch8i6P+YPDbommbiQwKdh1?= =?us-ascii?Q?ryKXdkB434H/XyW3HEUnP/d+ub/uzwbda3hw2HBjAShooO3H+1guzpwe/qYL?= =?us-ascii?Q?dbbbMv09URSYapzB9GlhDiR9APg5yhFDVWlIsJ3T0GAq++661n2cRCZb/KLc?= =?us-ascii?Q?oEqk6w8VjvZtbfk+e1q9I0asnAWhh9pyDcOlcJgkZZPEJlHCHOEAL1NkkfbU?= =?us-ascii?Q?kqrFw2Uh7t8A+rXGgTE1YmLKU6+nzx9hL8NtabmnG8ZSJiLAs/cjW5RF94WE?= =?us-ascii?Q?McOraDDhxP2qIOH4lbsyS4UYpyRoWgKXdNY360Vgy9nHEtqxAaLLeHWos0Yn?= =?us-ascii?Q?w0plAk=3D?= X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0705; 5:Hl8zwjgkDoQkAyQjunxHTIIo3zhqJ+UnRGo/fW0MOAbNeFKUx5i+oEQTaHq4oMxm3q5KyF1d7/4BmLZCUtKCxn17EayZSsYjqxJggomt3I5/+Ljp60iHKloBLCpE0NBXjK++x4DTuicz5nMVPOPM+g==; 24:h7ANFKfE4WJa6nm2Vc7jK74OKPZe7nlws4t/GzVEhvu+GY8THywDrWplSdBmMKsWwXaHNHdVdqY9LnwVbBskGJZUF08U755KR/ulWet6M68=; 20:10/V2HnVak1e+B4iZTCVEyWZmQ/+TpVaEosQzEDax6BEj952C//Qa899S8yz/HU2Zy+feSgm15O4n2QRVtGB8h2yTjyb5sSdO1RwuWl2AFGJfBSz00++nq5NSw7+LjaFmWQ311Xs/Sqb2Mv0RcEw51+XJVFva2v62GvSifeBYFV3lT/nKzeFWojU67EuOSrNXM7Hvn9psgd0ei/wvdMyarOCpRnhhKatLqiSj8z/roiXmNW5mt4U4+FGQS8+j+8Q SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2016 22:28:52.7849 (UTC) X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.222]; Helo=[atltwp02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR12MB0705 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Adds empty encoder HW programming functions to support enablement of virtual pipes (i.e. pipes without actual display output). Signed-off-by: Harry Wentland Reviewed-by: Alex Deucher --- drivers/gpu/drm/amd/dal/dc/virtual/Makefile | 9 ++ .../drm/amd/dal/dc/virtual/virtual_link_encoder.c | 133 +++++++++++++++++++++ .../drm/amd/dal/dc/virtual/virtual_link_encoder.h | 35 ++++++ .../amd/dal/dc/virtual/virtual_stream_encoder.c | 124 +++++++++++++++++++ .../amd/dal/dc/virtual/virtual_stream_encoder.h | 39 ++++++ 5 files changed, 340 insertions(+) create mode 100644 drivers/gpu/drm/amd/dal/dc/virtual/Makefile create mode 100644 drivers/gpu/drm/amd/dal/dc/virtual/virtual_link_encoder.c create mode 100644 drivers/gpu/drm/amd/dal/dc/virtual/virtual_link_encoder.h create mode 100644 drivers/gpu/drm/amd/dal/dc/virtual/virtual_stream_encoder.c create mode 100644 drivers/gpu/drm/amd/dal/dc/virtual/virtual_stream_encoder.h diff --git a/drivers/gpu/drm/amd/dal/dc/virtual/Makefile b/drivers/gpu/drm/amd/dal/dc/virtual/Makefile new file mode 100644 index 000000000000..0e2cbc0bb532 --- /dev/null +++ b/drivers/gpu/drm/amd/dal/dc/virtual/Makefile @@ -0,0 +1,9 @@ +# +# Makefile for the virtual sub-component of DAL. +# It provides the control and status of HW CRTC block. + +VIRTUAL = virtual_link_encoder.o virtual_stream_encoder.o + +AMD_DAL_VIRTUAL = $(addprefix $(AMDDALPATH)/dc/virtual/,$(VIRTUAL)) + +AMD_DAL_FILES += $(AMD_DAL_VIRTUAL) diff --git a/drivers/gpu/drm/amd/dal/dc/virtual/virtual_link_encoder.c b/drivers/gpu/drm/amd/dal/dc/virtual/virtual_link_encoder.c new file mode 100644 index 000000000000..ade443d79c02 --- /dev/null +++ b/drivers/gpu/drm/amd/dal/dc/virtual/virtual_link_encoder.c @@ -0,0 +1,133 @@ +/* + * Copyright 2012-15 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: AMD + * + */ + +#include "dm_services_types.h" + +#include "virtual_link_encoder.h" + +#define VIRTUAL_MAX_PIXEL_CLK_IN_KHZ 600000 + +static bool virtual_link_encoder_validate_output_with_stream( + struct link_encoder *enc, + struct core_stream *stream) { return true; } + +static void virtual_link_encoder_hw_init(struct link_encoder *enc) {} + +static void virtual_link_encoder_setup( + struct link_encoder *enc, + enum signal_type signal) {} + +static void virtual_link_encoder_enable_tmds_output( + struct link_encoder *enc, + enum clock_source_id clock_source, + enum dc_color_depth color_depth, + bool hdmi, + bool dual_link, + uint32_t pixel_clock) {} + +static void virtual_link_encoder_enable_dp_output( + struct link_encoder *enc, + const struct link_settings *link_settings, + enum clock_source_id clock_source) {} + +static void virtual_link_encoder_enable_dp_mst_output( + struct link_encoder *enc, + const struct link_settings *link_settings, + enum clock_source_id clock_source) {} + +static void virtual_link_encoder_disable_output( + struct link_encoder *link_enc, + enum signal_type signal) {} + +static void virtual_link_encoder_dp_set_lane_settings( + struct link_encoder *enc, + const struct link_training_settings *link_settings) {} + +static void virtual_link_encoder_dp_set_phy_pattern( + struct link_encoder *enc, + const struct encoder_set_dp_phy_pattern_param *param) {} + +static void virtual_link_encoder_update_mst_stream_allocation_table( + struct link_encoder *enc, + const struct link_mst_stream_allocation_table *table) {} + +static void virtual_link_encoder_set_lcd_backlight_level( + struct link_encoder *enc, + uint32_t level) {} + +static void virtual_link_encoder_edp_backlight_control( + struct link_encoder *enc, + bool enable) {} + +static void virtual_link_encoder_edp_power_control( + struct link_encoder *enc, + bool power_up) {} + +static void virtual_link_encoder_connect_dig_be_to_fe( + struct link_encoder *enc, + enum engine_id engine, + bool connect) {} + +static struct link_encoder_funcs virtual_lnk_enc_funcs = { + .validate_output_with_stream = + virtual_link_encoder_validate_output_with_stream, + .hw_init = virtual_link_encoder_hw_init, + .setup = virtual_link_encoder_setup, + .enable_tmds_output = virtual_link_encoder_enable_tmds_output, + .enable_dp_output = virtual_link_encoder_enable_dp_output, + .enable_dp_mst_output = virtual_link_encoder_enable_dp_mst_output, + .disable_output = virtual_link_encoder_disable_output, + .dp_set_lane_settings = virtual_link_encoder_dp_set_lane_settings, + .dp_set_phy_pattern = virtual_link_encoder_dp_set_phy_pattern, + .update_mst_stream_allocation_table = + virtual_link_encoder_update_mst_stream_allocation_table, + .set_lcd_backlight_level = virtual_link_encoder_set_lcd_backlight_level, + .backlight_control = virtual_link_encoder_edp_backlight_control, + .power_control = virtual_link_encoder_edp_power_control, + .connect_dig_be_to_fe = virtual_link_encoder_connect_dig_be_to_fe +}; + +bool virtual_link_encoder_construct( + struct link_encoder *enc, const struct encoder_init_data *init_data) +{ + enc->funcs = &virtual_lnk_enc_funcs; + enc->ctx = init_data->ctx; + enc->id = init_data->encoder; + + enc->hpd_source = init_data->hpd_source; + enc->connector = init_data->connector; + + enc->adapter_service = init_data->adapter_service; + + enc->transmitter = init_data->transmitter; + + enc->features.max_pixel_clock = VIRTUAL_MAX_PIXEL_CLK_IN_KHZ; + + enc->output_signals = SIGNAL_TYPE_VIRTUAL; + + enc->preferred_engine = ENGINE_ID_VIRTUAL; + + return true; +} diff --git a/drivers/gpu/drm/amd/dal/dc/virtual/virtual_link_encoder.h b/drivers/gpu/drm/amd/dal/dc/virtual/virtual_link_encoder.h new file mode 100644 index 000000000000..c34bd0421c9b --- /dev/null +++ b/drivers/gpu/drm/amd/dal/dc/virtual/virtual_link_encoder.h @@ -0,0 +1,35 @@ +/* + * Copyright 2012-15 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: AMD + * + */ + +#ifndef __DC_VIRTUAL_LINK_ENCODER_H__ +#define __DC_VIRTUAL_LINK_ENCODER_H__ + +#include "inc/link_encoder.h" + +bool virtual_link_encoder_construct( + struct link_encoder *enc, const struct encoder_init_data *init_data); + + +#endif /* __DC_VIRTUAL_LINK_ENCODER_H__ */ diff --git a/drivers/gpu/drm/amd/dal/dc/virtual/virtual_stream_encoder.c b/drivers/gpu/drm/amd/dal/dc/virtual/virtual_stream_encoder.c new file mode 100644 index 000000000000..4f5271bec369 --- /dev/null +++ b/drivers/gpu/drm/amd/dal/dc/virtual/virtual_stream_encoder.c @@ -0,0 +1,124 @@ +/* + * Copyright 2012-15 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: AMD + * + */ + +#include "dm_services.h" +#include "virtual_stream_encoder.h" + +static void virtual_stream_encoder_dp_set_stream_attribute( + struct stream_encoder *enc, + struct dc_crtc_timing *crtc_timing) {} + +static void virtual_stream_encoder_hdmi_set_stream_attribute( + struct stream_encoder *enc, + struct dc_crtc_timing *crtc_timing, + bool enable_audio) {} + +static void virtual_stream_encoder_dvi_set_stream_attribute( + struct stream_encoder *enc, + struct dc_crtc_timing *crtc_timing, + bool is_dual_link) {} + +static void virtual_stream_encoder_set_mst_bandwidth( + struct stream_encoder *enc, + struct fixed31_32 avg_time_slots_per_mtp) {} + +static void virtual_stream_encoder_update_hdmi_info_packets( + struct stream_encoder *enc, + const struct encoder_info_frame *info_frame) {} + +static void virtual_stream_encoder_stop_hdmi_info_packets( + struct stream_encoder *enc) {} + +static void virtual_stream_encoder_update_dp_info_packets( + struct stream_encoder *enc, + const struct encoder_info_frame *info_frame) {} + +static void virtual_stream_encoder_stop_dp_info_packets( + struct stream_encoder *enc) {} + +static void virtual_stream_encoder_dp_blank( + struct stream_encoder *enc) {} + +static void virtual_stream_encoder_dp_unblank( + struct stream_encoder *enc, + const struct encoder_unblank_param *param) {} + +static struct stream_encoder_funcs virtual_str_enc_funcs = { + .dp_set_stream_attribute = + virtual_stream_encoder_dp_set_stream_attribute, + .hdmi_set_stream_attribute = + virtual_stream_encoder_hdmi_set_stream_attribute, + .dvi_set_stream_attribute = + virtual_stream_encoder_dvi_set_stream_attribute, + .set_mst_bandwidth = + virtual_stream_encoder_set_mst_bandwidth, + .update_hdmi_info_packets = + virtual_stream_encoder_update_hdmi_info_packets, + .stop_hdmi_info_packets = + virtual_stream_encoder_stop_hdmi_info_packets, + .update_dp_info_packets = + virtual_stream_encoder_update_dp_info_packets, + .stop_dp_info_packets = + virtual_stream_encoder_stop_dp_info_packets, + .dp_blank = + virtual_stream_encoder_dp_blank, + .dp_unblank = + virtual_stream_encoder_dp_unblank, +}; + +bool virtual_stream_encoder_construct( + struct stream_encoder *enc, + struct dc_context *ctx, + struct dc_bios *bp) +{ + if (!enc) + return false; + if (!bp) + return false; + + enc->funcs = &virtual_str_enc_funcs; + enc->ctx = ctx; + enc->id = ENGINE_ID_VIRTUAL; + enc->bp = bp; + + return true; +} + +struct stream_encoder *virtual_stream_encoder_create( + struct dc_context *ctx, struct dc_bios *bp) +{ + struct stream_encoder *enc = dm_alloc(ctx, sizeof(*enc)); + + if (!enc) + return NULL; + + if (virtual_stream_encoder_construct(enc, ctx, bp)) + return enc; + + BREAK_TO_DEBUGGER(); + dm_free(ctx, enc); + return NULL; +} + diff --git a/drivers/gpu/drm/amd/dal/dc/virtual/virtual_stream_encoder.h b/drivers/gpu/drm/amd/dal/dc/virtual/virtual_stream_encoder.h new file mode 100644 index 000000000000..dce8425ea88e --- /dev/null +++ b/drivers/gpu/drm/amd/dal/dc/virtual/virtual_stream_encoder.h @@ -0,0 +1,39 @@ +/* + * Copyright 2012-15 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: AMD + * + */ + +#ifndef __DC_VIRTUAL_STREAM_ENCODER_H__ +#define __DC_VIRTUAL_STREAM_ENCODER_H__ + +#include "inc/stream_encoder.h" + +struct stream_encoder *virtual_stream_encoder_create( + struct dc_context *ctx, struct dc_bios *bp); + +bool virtual_stream_encoder_construct( + struct stream_encoder *enc, + struct dc_context *ctx, + struct dc_bios *bp); + +#endif /* __DC_VIRTUAL_STREAM_ENCODER_H__ */