From patchwork Wed May 16 03:07:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodrigo Siqueira X-Patchwork-Id: 10402473 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0CB99601D4 for ; Wed, 16 May 2018 03:07:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F059A27F85 for ; Wed, 16 May 2018 03:07:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E523F286B1; Wed, 16 May 2018 03:07:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8E03D27F85 for ; Wed, 16 May 2018 03:07:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E027C6E2DB; Wed, 16 May 2018 03:07:17 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qt0-x242.google.com (mail-qt0-x242.google.com [IPv6:2607:f8b0:400d:c0d::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 286B46E2DB for ; Wed, 16 May 2018 03:07:16 +0000 (UTC) Received: by mail-qt0-x242.google.com with SMTP id q6-v6so3232311qtn.3 for ; Tue, 15 May 2018 20:07:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=RRvJD59FrvPymsHg4+FpxefV8A2ijswT6KlaI6pcAVI=; b=fV6/Yy4J0xxX3BS16SOxn12HxXQD2jenZgsCKU+267rzRXFJy9p1zh7Ld+Ki8ys7Zi NjrVYH9rhjgyrbErdwN6O8gH9C401/8ipmox6kdC3D0UJo+CnnUwYwzu6yv0kPFvUmjv CD0tkdXEFBoRckSlYvLF3EPZX3pPj/64/cccgQtTTIBuBCCEkpzOTUXL0HKhuEBqff8j s22Ua0nZ5lT7iqmzLrXrJy9QvpAwKvFKhUFGITkTs/ed0/T9twxeN4wX5g8URWBroex2 7TWufummOzFUfSene0G32BU/c3CC3J+I5Gyn2UyXzKM0cIa+aXJLaip0XC5VZXSvuUaO igZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=RRvJD59FrvPymsHg4+FpxefV8A2ijswT6KlaI6pcAVI=; b=TUR568tOCgEwxxzrN/uVEm3hB9abNOn72RTqu7ggoVKs52wcCii6C1y6MC7CYj5hpF afiG2nkq/cLYQL2t4JluEJUsI6TTwNTdtURvCbLfe2bTCnbYq5Gs9HzqJ5lxZWz0FzQ6 fVEzD/BKtQ/5SWD6sOlLxuOE6MbOj9szuC/bR0SU7q+pmBz2EAmyjBHi5jN90MTefzQb I7V/PmNI+T2WZMZAXiBUQh+pwBs9q/CcTbXVg+y902NQ1KtYeWb6l5p0GhkV7edxUgbv dYr8edC1M9HGIAqso7ZlBFJnOaOc6KBt6OixzutVmvBUCFHBNoXuShcsWDICTI8zALio bm5Q== X-Gm-Message-State: ALKqPwcHE6qPoMKiZ9lahEJ15ni/p4qy4Pf5pskR0TS63OILuDtVxnQb tgTnkIUmJCXd5x/xLhUC6HY= X-Google-Smtp-Source: AB8JxZpy/Tmd48SaBc88ki3fH0OUUok98iHB7DfFNyRAYJQVNl+HsJvBv2NE3wDjyCOgt24DanyNfA== X-Received: by 2002:a0c:996a:: with SMTP id i39-v6mr15875885qvd.236.1526440035994; Tue, 15 May 2018 20:07:15 -0700 (PDT) Received: from smtp.gmail.com ([143.107.45.1]) by smtp.gmail.com with ESMTPSA id y41-v6sm1276041qty.84.2018.05.15.20.07.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 May 2018 20:07:15 -0700 (PDT) Date: Wed, 16 May 2018 00:07:12 -0300 From: Rodrigo Siqueira To: Gustavo Padovan , Daniel Vetter , Sean Paul , Haneen Mohammed Subject: [PATCH 2/3] drm/vkms: Add encoder initialization Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180323 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP This commit adds a single and simple virtual encoder to VKMS. Signed-off-by: Rodrigo Siqueira --- drivers/gpu/drm/vkms/vkms_display.c | 25 +++++++++++++++++++++++++ drivers/gpu/drm/vkms/vkms_drv.h | 2 ++ 2 files changed, 27 insertions(+) diff --git a/drivers/gpu/drm/vkms/vkms_display.c b/drivers/gpu/drm/vkms/vkms_display.c index b20b41f9590b..d6702128b5f7 100644 --- a/drivers/gpu/drm/vkms/vkms_display.c +++ b/drivers/gpu/drm/vkms/vkms_display.c @@ -44,11 +44,16 @@ static const struct drm_connector_funcs vkms_connector_funcs = { .destroy = vkms_connector_destroy, }; +static const struct drm_encoder_funcs vkms_encoder_funcs = { + .destroy = drm_encoder_cleanup, +}; + static int vkms_output_init(struct vkms_device *vkmsdev) { struct vkms_output *output = &vkmsdev->output; struct drm_device *dev = &vkmsdev->drm; struct drm_connector *connector = &output->connector; + struct drm_encoder *encoder = &output->encoder; struct drm_crtc *crtc = &output->crtc; struct drm_plane *primary; int ret; @@ -78,10 +83,30 @@ static int vkms_output_init(struct vkms_device *vkmsdev) goto err_connector_register; } + ret = drm_encoder_init(dev, encoder, &vkms_encoder_funcs, + DRM_MODE_ENCODER_VIRTUAL, NULL); + if (ret) { + DRM_ERROR("Failed to init encoder\n"); + goto err_encoder; + } + encoder->possible_crtcs = 1; + + ret = drm_mode_connector_attach_encoder(connector, encoder); + if (ret) { + DRM_ERROR("Failed to attach connector to encoder\n"); + goto err_attach; + } + drm_mode_config_reset(dev); return 0; +err_attach: + drm_encoder_cleanup(encoder); + +err_encoder: + drm_connector_unregister(connector); + err_connector_register: drm_connector_cleanup(connector); diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h index 292bdea9c785..933eedc5b25b 100644 --- a/drivers/gpu/drm/vkms/vkms_drv.h +++ b/drivers/gpu/drm/vkms/vkms_drv.h @@ -3,6 +3,7 @@ #include #include +#include static const u32 vkms_formats[] = { DRM_FORMAT_XRGB8888, @@ -17,6 +18,7 @@ static const u32 vkms_formats[] = { struct vkms_output { struct drm_crtc crtc; + struct drm_encoder encoder; struct drm_connector connector; };