Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp8993052ybi; Fri, 7 Jun 2019 01:30:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqzTx+ZdPxEfOzS+29uwcQEIV1azt4zBoO2m1wnxZO8WfkiTcQOwD98t8ZVaLoB8NOWNi9jU X-Received: by 2002:a17:90a:d582:: with SMTP id v2mr4072174pju.22.1559896227666; Fri, 07 Jun 2019 01:30:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559896227; cv=none; d=google.com; s=arc-20160816; b=iZbIi5ybXgpaydn5j7vgyDds7fVxkN8DEiAYun92Z3CPf6kzVWbrVVYaKkR69WIAzz /9WV8Zb0cbKDpcbwMv833OhYHiQpSWQglblaDInrqfogh2gqQ7JRTzu+TD+F9+fm9Bsy i9SVm4GEI2XuY6oT5S6Ge2N990wJAsNIgwez81Ybkqgcv1Y3UiJ9pCJmUuABV5J37GGS AUiZmlw2GXkssrJLd+L+cy66a0HvTWrp9e0brAlSquAvc5OVBwUCJjOGIqBMuLnAHHeV 4N2cX7Dpktfahbwf3SxSDwdpxk0hThqmh5Q26mNjXxW7wIAuQIL2sAfH7CS2t+pAOmrf VIfg== 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; bh=AIFP2DYtX9Gl8U6x7V5zWoqYM6apBAgsstaP/BgvhgE=; b=0LQ6ySQLiKYAIBn5kzluxrTNgXltw0UbH8wOz3QR+0hlG2SeXSXRC5oVelnOuM4Fot tpXm4lTKhednT/VA/JnrS2+uM90EKoDODbDnuDwX95ZuFLc249Ozl7i6+LISOj04DlYb knN1U3MVGSp5s2BYEYlmix7BOenNRdVAm2bsmufYRSWK9DBZBhXbIFbl/JJNZ+CsrlLt EnfS6WaDsGBPh04Ih58Fg6iEUGcgsGKHgKPhLyY9wS3CYj1/c/dE8Wh9ij2m3z3op4VM Vh1uDgCnIMwveuwsUYqAS+LVUG67ajCmKtnPxBWRmSGj/95XtwaklNvu1NhSPsAOu183 7J8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b=KlZS2HiG; 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 g14si1237943pgh.98.2019.06.07.01.30.09; Fri, 07 Jun 2019 01:30:27 -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=KlZS2HiG; 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 S1727624AbfFGHkD (ORCPT + 99 others); Fri, 7 Jun 2019 03:40:03 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:39934 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725497AbfFGHkD (ORCPT ); Fri, 7 Jun 2019 03:40:03 -0400 Received: by mail-ed1-f65.google.com with SMTP id m10so1644791edv.6 for ; Fri, 07 Jun 2019 00:40:01 -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=AIFP2DYtX9Gl8U6x7V5zWoqYM6apBAgsstaP/BgvhgE=; b=KlZS2HiGz0OexPES4/ehlB6xYnxIzO6a9O1KU8ivBrcX6+i1omdzgtehQXcvdaJq33 aIOXmbI6Q8rL77ukFROgIIMvb7Q3EvYH5ak+fKaNYXeL75S0CPwKxNhtMShtkPDhTBHU xRPVOu+pZjrpJ5nY1mJXbk9K8g11r3iIMmnB4= 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=AIFP2DYtX9Gl8U6x7V5zWoqYM6apBAgsstaP/BgvhgE=; b=cyZ1yysSfgkMGT7esd6yRcBulpGSBv9KwmXB0Ot1T+WCOZLhrh8Ovz3UlLaw75k35w mNrfZIRW+cl3YPk7AteqMeUP5Ibw0kEUv2C4SuyAaXvxvzcGgyHl1X2SG0nvQ2zrJqN+ SsJlN8YmW9NyaxzMbzpgU+9VwtHltAsF5x3YZnphQASetWEnxQSv+OjryoQp+RSFcF1X ecthEohEvDhjgkfkNzdxAzzHQsb+Bh0R6FfUsSaO3tVFBM6f3FU1mo3pMttVv50spP+t LSxYo+4xSbQmkjCdkkcjrmVjmVIVsCsPu8Kwk7zEb/iUro79KFcB+essNiYfQp9Q8K8L eXaA== X-Gm-Message-State: APjAAAXvvvCgy1REzSYpiW6Djq5PFLdZF9DmFTuYihWSCkhvqVCnHEwu bsvrJKo62oneSc6FF7ZigolPvA== X-Received: by 2002:a50:9871:: with SMTP id h46mr36057994edb.69.1559893201061; Fri, 07 Jun 2019 00:40:01 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id 17sm319179edu.21.2019.06.07.00.39.59 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 00:39:59 -0700 (PDT) Date: Fri, 7 Jun 2019 09:39:58 +0200 From: Daniel Vetter To: Rodrigo Siqueira Cc: Brian Starkey , Liviu Dudau , Daniel Vetter , Haneen Mohammed , Simon Ser , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] drm/vkms: Use index instead of 0 in possible crtc Message-ID: <20190607073957.GB21222@phenom.ffwll.local> Mail-Followup-To: Rodrigo Siqueira , Brian Starkey , Liviu Dudau , Haneen Mohammed , Simon Ser , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: Linux phenom 4.14.0-3-amd64 User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 06, 2019 at 07:40:38PM -0300, Rodrigo Siqueira wrote: > When vkms calls drm_universal_plane_init(), it sets 0 for the > possible_crtcs parameter which works well for a single encoder and > connector; however, this approach is not flexible and does not fit well > for vkms. This commit adds an index parameter for vkms_plane_init() > which makes code flexible and enables vkms to support other DRM features. > > Signed-off-by: Rodrigo Siqueira I think a core patch to WARN_ON if this is NULL would be good. Since that's indeed a bit broken ... We'd need to check all callers to make sure there's not other such bugs anywhere ofc. -Daniel > --- > drivers/gpu/drm/vkms/vkms_drv.c | 2 +- > drivers/gpu/drm/vkms/vkms_drv.h | 4 ++-- > drivers/gpu/drm/vkms/vkms_output.c | 6 +++--- > drivers/gpu/drm/vkms/vkms_plane.c | 4 ++-- > 4 files changed, 8 insertions(+), 8 deletions(-) > > diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c > index 738dd6206d85..92296bd8f623 100644 > --- a/drivers/gpu/drm/vkms/vkms_drv.c > +++ b/drivers/gpu/drm/vkms/vkms_drv.c > @@ -92,7 +92,7 @@ static int vkms_modeset_init(struct vkms_device *vkmsdev) > dev->mode_config.max_height = YRES_MAX; > dev->mode_config.preferred_depth = 24; > > - return vkms_output_init(vkmsdev); > + return vkms_output_init(vkmsdev, 0); > } > > static int __init vkms_init(void) > diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h > index 81f1cfbeb936..e81073dea154 100644 > --- a/drivers/gpu/drm/vkms/vkms_drv.h > +++ b/drivers/gpu/drm/vkms/vkms_drv.h > @@ -113,10 +113,10 @@ bool vkms_get_vblank_timestamp(struct drm_device *dev, unsigned int pipe, > int *max_error, ktime_t *vblank_time, > bool in_vblank_irq); > > -int vkms_output_init(struct vkms_device *vkmsdev); > +int vkms_output_init(struct vkms_device *vkmsdev, int index); > > struct drm_plane *vkms_plane_init(struct vkms_device *vkmsdev, > - enum drm_plane_type type); > + enum drm_plane_type type, int index); > > /* Gem stuff */ > struct drm_gem_object *vkms_gem_create(struct drm_device *dev, > diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c > index 3b162b25312e..1442b447c707 100644 > --- a/drivers/gpu/drm/vkms/vkms_output.c > +++ b/drivers/gpu/drm/vkms/vkms_output.c > @@ -36,7 +36,7 @@ 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) > +int vkms_output_init(struct vkms_device *vkmsdev, int index) > { > struct vkms_output *output = &vkmsdev->output; > struct drm_device *dev = &vkmsdev->drm; > @@ -46,12 +46,12 @@ int vkms_output_init(struct vkms_device *vkmsdev) > struct drm_plane *primary, *cursor = NULL; > int ret; > > - primary = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_PRIMARY); > + primary = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_PRIMARY, index); > if (IS_ERR(primary)) > return PTR_ERR(primary); > > if (enable_cursor) { > - cursor = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_CURSOR); > + cursor = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_CURSOR, index); > if (IS_ERR(cursor)) { > ret = PTR_ERR(cursor); > goto err_cursor; > diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_plane.c > index 0e67d2d42f0c..20ffc52f9194 100644 > --- a/drivers/gpu/drm/vkms/vkms_plane.c > +++ b/drivers/gpu/drm/vkms/vkms_plane.c > @@ -168,7 +168,7 @@ static const struct drm_plane_helper_funcs vkms_primary_helper_funcs = { > }; > > struct drm_plane *vkms_plane_init(struct vkms_device *vkmsdev, > - enum drm_plane_type type) > + enum drm_plane_type type, int index) > { > struct drm_device *dev = &vkmsdev->drm; > const struct drm_plane_helper_funcs *funcs; > @@ -190,7 +190,7 @@ struct drm_plane *vkms_plane_init(struct vkms_device *vkmsdev, > funcs = &vkms_primary_helper_funcs; > } > > - ret = drm_universal_plane_init(dev, plane, 0, > + ret = drm_universal_plane_init(dev, plane, 1 << index, > &vkms_plane_funcs, > formats, nformats, > NULL, type, NULL); > -- > 2.21.0 -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch