From patchwork Thu Feb 11 17:20: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: 8283271 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 649D39F3CD for ; Thu, 11 Feb 2016 17:22:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DB22520172 for ; Thu, 11 Feb 2016 17:22:10 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 0EC2420351 for ; Thu, 11 Feb 2016 17:22:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1A00D7A0BA; Thu, 11 Feb 2016 09:21:04 -0800 (PST) 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-bl2on0092.outbound.protection.outlook.com [65.55.169.92]) by gabe.freedesktop.org (Postfix) with ESMTPS id 707CD720CE for ; Thu, 11 Feb 2016 09:21:01 -0800 (PST) Received: from CY1PR1201CA0028.namprd12.prod.outlook.com (10.169.17.166) by CY1PR12MB0715.namprd12.prod.outlook.com (10.163.238.21) with Microsoft SMTP Server (TLS) id 15.1.403.16; Thu, 11 Feb 2016 17:20:58 +0000 Received: from DM3NAM03FT052.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::202) by CY1PR1201CA0028.outlook.office365.com (2a01:111:e400:5b9a::38) with Microsoft SMTP Server (TLS) id 15.1.409.15 via Frontend Transport; Thu, 11 Feb 2016 17:20:58 +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 DM3NAM03FT052.mail.protection.outlook.com (10.152.83.107) with Microsoft SMTP Server id 15.1.415.6 via Frontend Transport; Thu, 11 Feb 2016 17:20:58 +0000 X-WSS-ID: 0O2E86S-08-0A1-02 X-M-MSG: Received: from satlvexedge02.amd.com (satlvexedge02.amd.com [10.177.96.29]) (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 2FE39D22F90 for ; Thu, 11 Feb 2016 12:20:51 -0500 (EST) Received: from SATLEXDAG03.amd.com (10.181.40.7) by SATLVEXEDGE02.amd.com (10.177.96.29) with Microsoft SMTP Server (TLS) id 14.3.195.1; Thu, 11 Feb 2016 11:21:28 -0600 Received: from STOREXDAG03.amd.com (10.1.13.12) by satlexdag03.amd.com (10.181.40.7) with Microsoft SMTP Server (TLS) id 14.3.266.1; Thu, 11 Feb 2016 12:20:54 -0500 Received: from cnhwentlanub.amd.com (172.29.225.36) by storexdag03.amd.com (10.1.13.12) with Microsoft SMTP Server id 14.3.266.1; Thu, 11 Feb 2016 12:20:54 -0500 From: Harry Wentland To: Subject: [PATCH 23/29] drm/amd/dal: Add empty encoder programming for virtual HW Date: Thu, 11 Feb 2016 12:20:03 -0500 Message-ID: <1455211209-26733-24-git-send-email-harry.wentland@amd.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1455211209-26733-1-git-send-email-harry.wentland@amd.com> 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)(53416004)(106466001)(1096002)(1220700001)(450100001)(50226001)(33646002)(92566002)(2351001)(2950100001)(5003600100002)(77096005)(4326007)(105586002)(189998001)(2906002)(36756003)(19580395003)(575784001)(87936001)(101416001)(19580405001)(229853001)(50466002)(76176999)(86362001)(50986999)(48376002)(5003940100001)(586003)(47776003)(11100500001)(5008740100001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR12MB0715; H:atltwp02.amd.com; FPR:; SPF:None; MLV:sfv; MX:1; A:1; LANG:en; X-MS-Office365-Filtering-Correlation-Id: da6b4a7b-d541-4abd-bfdc-08d33307b51a X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0715; 2:fL1VIuVYbNMqjEW0RLQukIKgXGI4gmpw6SYtErFT8QBfkotW3/nDKlnttnZroUwQcXTjVPgRQUPThAflg2ykWSvFGkcQESdoPs7NTl+/M5Fp+1zfp483h1NI0S4wls+zF5Wsl1YveOYUJ2Rd48XUPUd0QhkX2hIfuYICeTR2xMVXwjg/fKotm9vsZ0TzxIcI; 3:2/hWFIwx/xqOr7qLBnUzyOQBueQQzFnbeTaSa02816ugut0vNrCyf3dT61CNJMtszZj5zAXdm1tKU6Zx+OZR9cr1qLBQpIfREHE2yF6Fs10E3sbFo9tyqs4czSYi78NJ8wz8ooNRMCIJHKBgI8vaCx4m7hqYSzOFARAVzLYw4NqxUR+HSU8zo+VoSL7D0S9gMP2f6116so+6OOlhTbfj9EpKPsLDiCWGE7C6fyb77n8=; 25:u1QbvPlsXR7dTiSW3kWD277pWUIR3hi8vqEoS9bW35KEg2KWev2U6h5onEKtTxbObOn/D+0DLO+Qx3NBVNPMD5wsk27rnC+L9+84hnarFW3MHy2QiHhSbIodXuSyIKR5lXJ/LNnPRj/VRnpxsAaMdSWZMsIq7vprO+cBlytgv21m3mpw8QGRtsPEA+/jPquqFkkHfrEprRVRg8LF8ypTZ+9SZeMV6LtZ9Op7Tst2HLVUK56pTCyKowOhq5o88sbhwtr7HgoVCS9xzZ/Ajy3elH071BpFGyEsL+z3fjMyw3WHJr7pU7UgGqnHf70NF2GI X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR12MB0715; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0715; 20:ATstCQ8AZ5ooGJG9lq/2GiaWWZB6/CZgY164YCEWOy0fEfRhU2UMnGul5dCJNOlSYoWEgQ4RUVRv0n7Pd6hjk9icI+8oU+FE1b7bT65nie4IafGRNWax8zc89QBbVe+m6kTBf3TYSJYfBrjNhrc0zof12wZ7yI7CmLZ7IhZUbk4Kt+fgQTxeu1v5MpbDaYSStY79cftEHFsOgbsEJ0NgTpQJhZQIHlpUT4JIBh/hw3Ai4+xttRl5kwfQjbQbe8wrCVGZf7bW4C1IFuA2XIRQH2Mgx+OAQBmx9qnESdBFgmoohQZP4/F7iH0l/OI8fmex7MtVbKqSc5ZRWtujbTTYNrL+u7TqxPxoehaTiKSjJTOLBHp6u+AmMwkZU2ubTF1NIq1xzucqJCNIwKwUjq3ZCG1wx9JJlYRhYbZ7enHuHguRjgT9l6GL1cdmeBAKjfmOR+IexO9gyE4LZzsVYkNYew8O+6EvE5/SxzDphfL4ahBR8C6p/H0BGQLgLEDbUvLD X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13018025)(13024025)(13023025)(13017025)(13015025)(5005006)(8121501046)(3002001)(10201501046); SRVR:CY1PR12MB0715; BCL:0; PCL:0; RULEID:; SRVR:CY1PR12MB0715; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0715; 4:EvHONV3JyfRIafk6J9T8My3q0xVLPF7gzB9R/3oG0zwNEc4ftB1nvebgeWwRMBQ64K4ONeCgjyTg4D+wWAPS97LkwLQYRa1vmxA/pCkGB3OC3PrWQeEAXTelBYqU883ThnXyov0LFRT8l1QNbTd/WhvakFKq96QICzOo5Bi2yzpDJeJD/YrMBH5Os/1Wf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vjn/Z07Oi3IEZuvHn3O6NMpVNFMhhw1lMmiwGymOB1jrpZDhLKZRylAfwffGM6qPvKa2Mq/e4K SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Feb 2016 17:20:58.4026 (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: CY1PR12MB0715 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.4 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__ */