From patchwork Thu Jul 12 13:41:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodrigo Siqueira X-Patchwork-Id: 10521699 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 95D38602B3 for ; Thu, 12 Jul 2018 13:41:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7BA5A29A38 for ; Thu, 12 Jul 2018 13:41:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7988429A67; Thu, 12 Jul 2018 13:41:20 +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.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED 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 9F85F29A6C for ; Thu, 12 Jul 2018 13:41:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 393466EFC1; Thu, 12 Jul 2018 13:41:18 +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 996C56EFC1 for ; Thu, 12 Jul 2018 13:41:17 +0000 (UTC) Received: by mail-qt0-x242.google.com with SMTP id a5-v6so9537804qtp.2 for ; Thu, 12 Jul 2018 06:41:17 -0700 (PDT) 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=GJ2iOlxw9yA6dvTOCmvxszquc/VRJLdRBnnEkhdOXnk=; b=rRv/z4D22aaBsgPYxNn64m+n6zL6A8SZjOxXmXygcCSp41o+jx/roQCMzSjv1TyiYE whzxF4V6qfrxYW3C5wbSbNNksETKZ5c9sc64JFltol846orVllYi1lJz010g2oy3rk/s Ug684fVISZyqaRRNVg2FfO6kr9h0IM1hBicfFCErHxCpRGUiI5LzoC/O4u/PCDVIkBhs qt/N/2nK0YynwPwSw3nb3+/r2qZCDs9f7/lDl8eSyLJX40hj6dGHzhSZKsckgM1Iqx+8 W42h5Tkyv89CVvfy5P7bZ+2Mg+jjjVulMBDlYoaJ9VCXrGZDgBmt59Jzn49IN/4u1ie/ xXyQ== X-Gm-Message-State: AOUpUlHyiKvyqxLdRbX3L8c850V8T3Pw+J9RqIw0VRseJFvg7ALM9TR1 rKehbYDw2jII5f2k/iTniGgfFQ== X-Google-Smtp-Source: AAOMgpeW9tZpHtuavt7Tir6LY10zCzuwEj+CeRBKBwBSPDFN/LFE3o8DuxK99eRt6f1SUvAIdGnz2Q== X-Received: by 2002:ac8:18c4:: with SMTP id o4-v6mr1776876qtk.95.1531402876783; Thu, 12 Jul 2018 06:41:16 -0700 (PDT) Received: from smtp.gmail.com ([143.107.45.1]) by smtp.gmail.com with ESMTPSA id s39-v6sm18126347qts.42.2018.07.12.06.41.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 12 Jul 2018 06:41:16 -0700 (PDT) Date: Thu, 12 Jul 2018 10:41:13 -0300 From: Rodrigo Siqueira To: Daniel Vetter , Gustavo Padovan , Sean Paul , Haneen Mohammed Subject: [PATCH V4 3/4] drm/vkms: Add connectors helpers Message-ID: <59717118c06887292bbaccc28b30aed9fcd13e83.1531402095.git.rodrigosiqueiramelo@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180622 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 patch adds the struct drm_connector_helper_funcs with some necessary hooks. Additionally, it also adds some missing hooks at drm_connector_funcs. Changes since V1: - None Changes since V2: Daniel Vetter: - Remove vkms_conn_mode_valid Changes since V3: - None Signed-off-by: Rodrigo Siqueira --- drivers/gpu/drm/vkms/vkms_drv.c | 6 ------ drivers/gpu/drm/vkms/vkms_drv.h | 9 +++++++++ drivers/gpu/drm/vkms/vkms_output.c | 20 ++++++++++++++++++++ 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c index b5d597a42f20..0557d1d8aa5b 100644 --- a/drivers/gpu/drm/vkms/vkms_drv.c +++ b/drivers/gpu/drm/vkms/vkms_drv.c @@ -19,12 +19,6 @@ #define DRIVER_MAJOR 1 #define DRIVER_MINOR 0 -#define XRES_MIN 32 -#define YRES_MIN 32 - -#define XRES_MAX 8192 -#define YRES_MAX 8192 - static struct vkms_device *vkms_device; static const struct file_operations vkms_driver_fops = { diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h index cce4694cafb9..57d7367fd814 100644 --- a/drivers/gpu/drm/vkms/vkms_drv.h +++ b/drivers/gpu/drm/vkms/vkms_drv.h @@ -6,6 +6,15 @@ #include #include +#define XRES_MIN 32 +#define YRES_MIN 32 + +#define XRES_DEF 1024 +#define YRES_DEF 768 + +#define XRES_MAX 8192 +#define YRES_MAX 8192 + static const u32 vkms_formats[] = { DRM_FORMAT_XRGB8888, }; diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c index 48143eac3c12..a7c0ec9b643f 100644 --- a/drivers/gpu/drm/vkms/vkms_output.c +++ b/drivers/gpu/drm/vkms/vkms_output.c @@ -8,6 +8,7 @@ #include "vkms_drv.h" #include +#include static void vkms_connector_destroy(struct drm_connector *connector) { @@ -18,12 +19,29 @@ static void vkms_connector_destroy(struct drm_connector *connector) static const struct drm_connector_funcs vkms_connector_funcs = { .fill_modes = drm_helper_probe_single_connector_modes, .destroy = vkms_connector_destroy, + .reset = drm_atomic_helper_connector_reset, + .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, }; static const struct drm_encoder_funcs vkms_encoder_funcs = { .destroy = drm_encoder_cleanup, }; +static int vkms_conn_get_modes(struct drm_connector *connector) +{ + int count; + + count = drm_add_modes_noedid(connector, XRES_MAX, YRES_MAX); + drm_set_preferred_mode(connector, XRES_DEF, YRES_DEF); + + return count; +} + +static const struct drm_connector_helper_funcs vkms_conn_helper_funcs = { + .get_modes = vkms_conn_get_modes, +}; + int vkms_output_init(struct vkms_device *vkmsdev) { struct vkms_output *output = &vkmsdev->output; @@ -49,6 +67,8 @@ int vkms_output_init(struct vkms_device *vkmsdev) goto err_connector; } + drm_connector_helper_add(connector, &vkms_conn_helper_funcs); + ret = drm_connector_register(connector); if (ret) { DRM_ERROR("Failed to register connector\n");