From patchwork Tue Aug 14 03:01:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kumar, Mahesh" X-Patchwork-Id: 10565003 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 759C11057 for ; Tue, 14 Aug 2018 02:58:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C0D52944B for ; Tue, 14 Aug 2018 02:58:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4EEFA29453; Tue, 14 Aug 2018 02:58:55 +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,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 EA6952944B for ; Tue, 14 Aug 2018 02:58:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7A79189C7F; Tue, 14 Aug 2018 02:58:53 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4B49389C6E for ; Tue, 14 Aug 2018 02:58:52 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Aug 2018 19:58:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,236,1531810800"; d="scan'208";a="81509918" Received: from unknown (HELO localhost.localdomain) ([10.223.25.241]) by orsmga001.jf.intel.com with ESMTP; 13 Aug 2018 19:58:49 -0700 From: Mahesh Kumar To: intel-gfx@lists.freedesktop.org Date: Tue, 14 Aug 2018 08:31:03 +0530 Message-Id: <20180814030103.11215-1-mahesh1.kumar@intel.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180813151122.25852-2-mahesh1.kumar@intel.com> References: <20180813151122.25852-2-mahesh1.kumar@intel.com> Subject: [Intel-gfx] [PATCH V2 1/3] drm/vkms/crc: Implement verify_crc_source callback X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Haneen Mohammed MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP This patch implements "verify_crc_source" callback function for Virtual KMS drm driver. Changes Since V1: - update values_cnt in verify_crc_source Cc: Haneen Mohammed Signed-off-by: Mahesh Kumar --- drivers/gpu/drm/vkms/vkms_crc.c | 38 ++++++++++++++++++++++++++++++++++---- drivers/gpu/drm/vkms/vkms_crtc.c | 1 + drivers/gpu/drm/vkms/vkms_drv.h | 2 ++ 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/vkms/vkms_crc.c b/drivers/gpu/drm/vkms/vkms_crc.c index 37d717f38e3c..b2a484b4e2ad 100644 --- a/drivers/gpu/drm/vkms/vkms_crc.c +++ b/drivers/gpu/drm/vkms/vkms_crc.c @@ -70,6 +70,37 @@ void vkms_crc_work_handle(struct work_struct *work) drm_crtc_add_crc_entry(crtc, true, crtc_state->n_frame, &crc32); } +static int vkms_crc_parse_source(const char *src_name, bool *enabled) +{ + int ret = 0; + + if (!src_name) { + *enabled = false; + } else if (strcmp(src_name, "auto") == 0) { + *enabled = true; + } else { + *enabled = false; + ret = -EINVAL; + } + + return ret; +} + +int vkms_verify_crc_source(struct drm_crtc *crtc, const char *src_name, + size_t *values_cnt) +{ + bool enabled; + + if (vkms_crc_parse_source(src_name, &enabled) < 0) { + DRM_DEBUG_DRIVER("unknown source %s\n", src_name); + return -EINVAL; + } + + *values_cnt = 1; + + return 0; +} + int vkms_set_crc_source(struct drm_crtc *crtc, const char *src_name, size_t *values_cnt) { @@ -78,10 +109,9 @@ int vkms_set_crc_source(struct drm_crtc *crtc, const char *src_name, unsigned long flags; int ret = 0; - if (src_name && strcmp(src_name, "auto") == 0) - enabled = true; - else if (src_name) - ret = -EINVAL; + ret = vkms_crc_parse_source(src_name, &enabled); + if (ret) + return ret; *values_cnt = 1; diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c index bfe6e0312cc4..9d0b1a325a78 100644 --- a/drivers/gpu/drm/vkms/vkms_crtc.c +++ b/drivers/gpu/drm/vkms/vkms_crtc.c @@ -140,6 +140,7 @@ static const struct drm_crtc_funcs vkms_crtc_funcs = { .enable_vblank = vkms_enable_vblank, .disable_vblank = vkms_disable_vblank, .set_crc_source = vkms_set_crc_source, + .verify_crc_source = vkms_verify_crc_source, }; static void vkms_crtc_atomic_enable(struct drm_crtc *crtc, diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h index f156c930366a..090c5e4f5544 100644 --- a/drivers/gpu/drm/vkms/vkms_drv.h +++ b/drivers/gpu/drm/vkms/vkms_drv.h @@ -125,6 +125,8 @@ void vkms_gem_vunmap(struct drm_gem_object *obj); /* CRC Support */ int vkms_set_crc_source(struct drm_crtc *crtc, const char *src_name, size_t *values_cnt); +int vkms_verify_crc_source(struct drm_crtc *crtc, const char *source_name, + size_t *values_cnt); void vkms_crc_work_handle(struct work_struct *work); #endif /* _VKMS_DRV_H_ */