Received: by 10.192.165.148 with SMTP id m20csp3105509imm; Mon, 7 May 2018 06:47:34 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoqsKb/Zak5WfgntTK98j7FEC1gWS5/DLfiH0QV1mGh0bo8kIJUzoXZ5MYE+vwBMOvcqf7N X-Received: by 2002:a17:902:758a:: with SMTP id j10-v6mr38248469pll.11.1525700854418; Mon, 07 May 2018 06:47:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525700854; cv=none; d=google.com; s=arc-20160816; b=HaQb5iQliTFpZlIj7ZtTonHCuxsapKEi3lIcqY33sTJozaBzp578aXOQGtgyJS1/ue ZkAmJB1O4S2RsgfV2Dz6l/6m0PMXFkVIiLZqRY4a/K9Sd89XAjiHIlOfBcvQaVGhZxvO SPRU7DIoQBwXeQWovTU2Gagp+n4oajfYQS4VqnekHsQapVHSv16SHBsnRBFpjrl7a4tA YenxbPGMHcUiDL/PThqQAw5u6vb1c8g6rh//dWA2bZPm4BagqHAj+JbAD1FYpwCEe4Jv 4zSpywaESicg+GAfP0aYZCiTM23q2cUYFpSRpJaWa16YkE7RQJm9BaPkf+YzZe085SMd 8Dfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=RdIfTui3DPVcmk4ODcSV/dtbN9F66IuexoH5bkxSSOg=; b=up3srUQjw/DUoAp/Tys6QfXqJIBa9DCqxWG6SA9AUFySyBr0ayQ5hlB1Bfi7Ozg4Ld zM5Jcejhrof+Z6LpPt+/Eo01oQd3k2zBQ8rT1yX2EaMp7qJfHD0mQJQVJmhLDWWwYJEy oOvNYdcQSz/VdDsmt1eNFPc8yP2SFvhKHm2z4pSb6++WS0vgTOs+w0Ko6rMUsz4Sb+Lq eqbQsG2Y8Etc+/Gq0hw7LS41ojrsHsP0BCOuCLS2ud3cPAee6hkO/pBEnSZ+/41Fx+Db EXL4nJ105qMcm5EYJTpq2X8C5iSUbFz+a/5xfYal61hdl9S7TaQEvO+Rd/zmvOY69wnL eygg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b=DUgwDoWp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d127-v6si18462844pgc.236.2018.05.07.06.47.18; Mon, 07 May 2018 06:47:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b=DUgwDoWp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752165AbeEGNqN (ORCPT + 99 others); Mon, 7 May 2018 09:46:13 -0400 Received: from mail-wm0-f54.google.com ([74.125.82.54]:50650 "EHLO mail-wm0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751884AbeEGNqH (ORCPT ); Mon, 7 May 2018 09:46:07 -0400 Received: by mail-wm0-f54.google.com with SMTP id t11so13538878wmt.0 for ; Mon, 07 May 2018 06:46:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=RdIfTui3DPVcmk4ODcSV/dtbN9F66IuexoH5bkxSSOg=; b=DUgwDoWpOKa/D1IW4EwQtJ4atpTaBpZ1lXnQtnA9d83I2VKj+JWNF71se7GNGUlngA L+XDqaJP/rPW5JGno646Zq++9lhvlf1Ni7p3bK1KwfD9pkW2IRRaVacvcDBTiOzgRrq8 ENVLdbCObm0ft4bIGjMfFP20VhL3wInM14HAc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=RdIfTui3DPVcmk4ODcSV/dtbN9F66IuexoH5bkxSSOg=; b=j1hlZ5eryUM9uU9uBlkKB4Iu8i0492+dE+lOyK4owgYn4M5xkF5pGkQs1U/xwzPMkJ GvVjhPo8WfQ3J/zUqVuRhhtSvzVQyX7WEKLoTMag3NlO5PEj++kz97GT4WDJFjq4A5/8 cMmXhfSlIVR77nFI7Clr32TndVj2BYL8zV9oXGT8wMo3HvruU6/XExXN+4tIrWgiaQfI 3qPtWJ0iaHad7ZHpNfSjqRs1tmwXtdC0p8qJbrW5a8/eXg4ptJZKdLdzGWcVNmVIPd6u EYeQ7SVkdVdDSRMgJWMTWqJlGJOh7dh9lTyCE6U2ZRfNS+DqMyKRyP6waEhO8WHLagp1 bowQ== X-Gm-Message-State: ALQs6tAiXufHhElaxMZJKjaimWY1j0jEInH1WDaCSnUeoE/uQ2v+/ND8 2OhjwBC+2bxepO+VuKD6xz8W5Q== X-Received: by 2002:a50:cb8a:: with SMTP id k10-v6mr48168879edi.205.1525700765680; Mon, 07 May 2018 06:46:05 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:5635:0:39d2:f87e:2033:9f6]) by smtp.gmail.com with ESMTPSA id b43-v6sm12958010edc.34.2018.05.07.06.46.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 May 2018 06:46:04 -0700 (PDT) Date: Mon, 7 May 2018 15:46:02 +0200 From: Daniel Vetter To: Satendra Singh Thakur Cc: linux-tegra@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-amlogic@lists.infradead.org, hemanshu.s@samsung.com, madhur.verma@samsung.com Subject: Re: [PATCH 00/13] drm/kms/mode: using helper func drm_display_mode_to/from_videomode for calculating timing parameters Message-ID: <20180507134602.GH12521@phenom.ffwll.local> Mail-Followup-To: Satendra Singh Thakur , linux-tegra@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-amlogic@lists.infradead.org, hemanshu.s@samsung.com, madhur.verma@samsung.com References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: Linux phenom 4.15.0-3-amd64 User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 03, 2018 at 01:53:55PM +0530, Satendra Singh Thakur wrote: > 1.There is a function in drm-core to calculate display timing parameters: > horizontal front porch, back porch, sync length, > vertical front porch, back porch, sync length and > clock in Hz. > However, some drivers are still calculating these parameters themselves. > Therefore, there is a duplication of the code. > This patch series replaces this redundant code with the function > drm_display_mode_to_videomode. > This removes nearly 100 redundant lines from the related drivers. > 2.For some drivers (sun4i) the reverse helper > drm_display_mode_from_videomode is used. > 3.For some drivers it replaces arithmatic operators (*, /) with shifting > operators (>>, <<). > 4.For some drivers DRM_MODE_FLAG_* are replaced with DISPLAY_FLAGS_* flags. > 5.These changes apply to following crtc and encoder drivers: > atmel-hlcdc > bridge-tc358767 > exynos-dsi > fsl-dcu > gma500-mdfld_dsi_dpi > hisilicon-kirin_dsi, ade > meson-encoder > pl111-display > sun4i-tv > ti lcdc > tegra dc > mediatek dpi dsi > bridge-adv7533 The drm_mode_to_videomode helper is meant for interop between drm and v4l, which have different internal structures to represent modes. For drivers that only use drm I think the better option would be to add these fields to struct drm_display_mode as another set of crtc_* values (the computed values are stored in crtc_ prefixed members). And compute front/back porch in drm_mode_set_crtcinfo. Then we can use these new drm_display_mode->crtc_h|vfront|back_porch fields in all the drivers you're changing. This way you avoid having to change all the drm drivers to use v4l #defines. Thanks, Daniel > > Satendra Singh Thakur (13): > drm/kms/mode/atmel-hlcdc: using helper func > drm_display_mode_to_videomode for calculating timing parameters > drm/kms/mode/bridge-tc358767: using helper func > drm_display_mode_to_videomode for calculating timing parameters > drm/kms/mode/exynos-dsi: using helper func > drm_display_mode_to_videomode for calculating timing parameters > drm/kms/mode/fsl-dcu: using helper func drm_display_mode_to_videomode > for calculating timing parameters > drm/kms/mode/gma500-mdfld_dsi_dpi: using helper function > drm_display_mode_to_videomode for calculating timing parameters > drm/kms/mode/hisilicon-kirin-dsi-ade: using helper function > drm_display_mode_to_videomode for calculating timing parameters > drm/kms/mode/meson-encoder: using helper function > drm_display_mode_to_videomode for calculating timing parameters > drm/kms/mode/pl111-display: using helper function > drm_display_mode_to_videomode for calculating timing parameters > drm/kms/mode/sun4i-tv: using helper func > drm_display_mode_from_videomode for calculating timing > parameters > drm/kms/mode/ti-lcdc: using helper func drm_display_mode_to_videomode > for calculating timing parameters > drm/kms/mode/tegra: using helper func drm_display_mode_to_videomode > for calculating timing parameters > drm/kms/mode/mtk_dpi_dsi: using helper func > drm_display_mode_to_videomode for calculating timing parameters > drm/kms/mode/bridge-adv7533: using helper func > drm_display_mode_to_videomode for calculating timing parameters > > drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 28 +++-- > drivers/gpu/drm/bridge/adv7511/adv7533.c | 35 +++--- > drivers/gpu/drm/bridge/tc358767.c | 42 +++---- > drivers/gpu/drm/exynos/exynos_drm_dsi.c | 9 +- > drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c | 29 ++--- > drivers/gpu/drm/gma500/mdfld_dsi_dpi.c | 28 ++--- > drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c | 42 ++++--- > drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 52 +++------ > drivers/gpu/drm/mediatek/mtk_dpi.c | 60 +++++----- > drivers/gpu/drm/mediatek/mtk_dsi.c | 14 +-- > drivers/gpu/drm/meson/meson_venc.c | 149 +++++++++++------------- > drivers/gpu/drm/pl111/pl111_display.c | 40 +++---- > drivers/gpu/drm/sun4i/sun4i_tv.c | 67 ++++------- > drivers/gpu/drm/tegra/dc.c | 15 ++- > drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 60 +++++----- > 15 files changed, 280 insertions(+), 390 deletions(-) > > -- > 2.7.4 > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch