public inbox for linux-rockchip@lists.infradead.org
 help / color / mirror / Atom feed
* Re: [PATCH v3 16/27] drm/rcar-du: Don't set struct drm_device.irq_enabled
       [not found] ` <20210624072916.27703-17-tzimmermann@suse.de>
@ 2021-06-24 10:47   ` Laurent Pinchart
  0 siblings, 0 replies; 3+ messages in thread
From: Laurent Pinchart @ 2021-06-24 10:47 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: daniel, airlied, alexander.deucher, christian.koenig, Xinhui.Pan,
	james.qian.wang, liviu.dudau, mihail.atanassov, brian.starkey,
	maarten.lankhorst, mripard, inki.dae, jy0922.shim, sw0312.kim,
	kyungmin.park, krzysztof.kozlowski, xinliang.liu, tiantao6,
	john.stultz, kong.kongxinwei, puck.chen, laurentiu.palcu, l.stach,
	p.zabel, shawnguo, s.hauer, kernel, festevam, linux-imx,
	chunkuang.hu, matthias.bgg, bskeggs, tomba, hjc, heiko,
	benjamin.gaignard, yannick.fertre, philippe.cornu,
	mcoquelin.stm32, alexandre.torgue, wens, jernej.skrabec,
	thierry.reding, jonathanh, jyri.sarha, emma,
	linux-graphics-maintainer, zackr, hyun.kwon, michal.simek,
	jani.nikula, rodrigo.vivi, linux, kieran.bingham+renesas,
	rodrigosiqueiramelo, melissa.srw, hamohammed.sa, amd-gfx,
	dri-devel, linux-arm-kernel, linux-samsung-soc, linux-mediatek,
	nouveau, linux-rockchip, linux-stm32, linux-sunxi, linux-tegra,
	intel-gfx

Hi Thomas,

Thank you for the patch.

On Thu, Jun 24, 2021 at 09:29:05AM +0200, Thomas Zimmermann wrote:
> The field drm_device.irq_enabled is only used by legacy drivers
> with userspace modesetting. Don't set it in rcar-du.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/gpu/drm/rcar-du/rcar_du_drv.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> index bfbff90588cb..e289a66594a7 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> @@ -593,8 +593,6 @@ static int rcar_du_probe(struct platform_device *pdev)
>  		goto error;
>  	}
>  
> -	rcdu->ddev.irq_enabled = 1;
> -
>  	/*
>  	 * Register the DRM device with the core and the connectors with
>  	 * sysfs.

-- 
Regards,

Laurent Pinchart

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v3 24/27] drm/vkms: Don't set struct drm_device.irq_enabled
       [not found] ` <20210624072916.27703-25-tzimmermann@suse.de>
@ 2021-06-24 10:48   ` Laurent Pinchart
  0 siblings, 0 replies; 3+ messages in thread
From: Laurent Pinchart @ 2021-06-24 10:48 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: daniel, airlied, alexander.deucher, christian.koenig, Xinhui.Pan,
	james.qian.wang, liviu.dudau, mihail.atanassov, brian.starkey,
	maarten.lankhorst, mripard, inki.dae, jy0922.shim, sw0312.kim,
	kyungmin.park, krzysztof.kozlowski, xinliang.liu, tiantao6,
	john.stultz, kong.kongxinwei, puck.chen, laurentiu.palcu, l.stach,
	p.zabel, shawnguo, s.hauer, kernel, festevam, linux-imx,
	chunkuang.hu, matthias.bgg, bskeggs, tomba, hjc, heiko,
	benjamin.gaignard, yannick.fertre, philippe.cornu,
	mcoquelin.stm32, alexandre.torgue, wens, jernej.skrabec,
	thierry.reding, jonathanh, jyri.sarha, emma,
	linux-graphics-maintainer, zackr, hyun.kwon, michal.simek,
	jani.nikula, rodrigo.vivi, linux, kieran.bingham+renesas,
	rodrigosiqueiramelo, melissa.srw, hamohammed.sa, amd-gfx,
	dri-devel, linux-arm-kernel, linux-samsung-soc, linux-mediatek,
	nouveau, linux-rockchip, linux-stm32, linux-sunxi, linux-tegra,
	intel-gfx

Hi Thomas,

Thank you for the patch.

On Thu, Jun 24, 2021 at 09:29:13AM +0200, Thomas Zimmermann wrote:
> The field drm_device.irq_enabled is only used by legacy drivers
> with userspace modesetting. Don't set it in vkms.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/gpu/drm/vkms/vkms_drv.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
> index 027ffe759440..496de38ad983 100644
> --- a/drivers/gpu/drm/vkms/vkms_drv.c
> +++ b/drivers/gpu/drm/vkms/vkms_drv.c
> @@ -163,8 +163,6 @@ static int vkms_create(struct vkms_config *config)
>  		goto out_devres;
>  	}
>  
> -	vkms_device->drm.irq_enabled = true;
> -
>  	ret = drm_vblank_init(&vkms_device->drm, 1);
>  	if (ret) {
>  		DRM_ERROR("Failed to vblank\n");

-- 
Regards,

Laurent Pinchart

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v3 04/27] drm: Don't test for IRQ support in VBLANK ioctls
       [not found]             ` <87zgvfsalz.fsf@intel.com>
@ 2021-06-24 12:57               ` Thomas Zimmermann
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Zimmermann @ 2021-06-24 12:57 UTC (permalink / raw)
  To: Jani Nikula, Thierry Reding
  Cc: hamohammed.sa, emma, airlied, nouveau, rodrigo.vivi, liviu.dudau,
	alexandre.torgue, dri-devel, michal.simek, melissa.srw,
	linux-tegra, laurent.pinchart, benjamin.gaignard, linux,
	mihail.atanassov, linux-stm32, linux-samsung-soc, jy0922.shim,
	krzysztof.kozlowski, linux-rockchip, linux-mediatek, wens,
	jernej.skrabec, jonathanh, xinliang.liu, kong.kongxinwei,
	james.qian.wang, linux-imx, Daniel Vetter,
	linux-graphics-maintainer, intel-gfx, bskeggs, chunkuang.hu,
	puck.chen, s.hauer, rodrigosiqueiramelo, laurentiu.palcu,
	matthias.bgg, kernel, linux-arm-kernel, mcoquelin.stm32, amd-gfx,
	hyun.kwon, tomba, jyri.sarha, yannick.fertre, Xinhui.Pan,
	sw0312.kim, hjc, christian.koenig, linux-sunxi, kyungmin.park,
	kieran.bingham+renesas, philippe.cornu, alexander.deucher,
	tiantao6, shawnguo


[-- Attachment #1.1.1: Type: text/plain, Size: 3127 bytes --]

Hi

Am 24.06.21 um 14:36 schrieb Jani Nikula:
> On Thu, 24 Jun 2021, Thierry Reding <thierry.reding@gmail.com> wrote:
>> On Thu, Jun 24, 2021 at 11:07:57AM +0200, Thomas Zimmermann wrote:
>>> Hi
>>>
>>> Am 24.06.21 um 10:51 schrieb Jani Nikula:
>>>> On Thu, 24 Jun 2021, Thomas Zimmermann <tzimmermann@suse.de> wrote:
>>>>> Hi
>>>>>
>>>>> Am 24.06.21 um 10:06 schrieb Jani Nikula:
>>>>>> On Thu, 24 Jun 2021, Thomas Zimmermann <tzimmermann@suse.de> wrote:
>>>>>>> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
>>>>>>> index 3417e1ac7918..10fe16bafcb6 100644
>>>>>>> --- a/drivers/gpu/drm/drm_vblank.c
>>>>>>> +++ b/drivers/gpu/drm/drm_vblank.c
>>>>>>> @@ -1748,8 +1748,16 @@ int drm_wait_vblank_ioctl(struct drm_device *dev, void *data,
>>>>>>>     	unsigned int pipe_index;
>>>>>>>     	unsigned int flags, pipe, high_pipe;
>>>>>>> -	if (!dev->irq_enabled)
>>>>>>> -		return -EOPNOTSUPP;
>>>>>>> +#if defined(CONFIG_DRM_LEGACY)
>>>>>>> +	if  (unlikely(drm_core_check_feature(dev, DRIVER_LEGACY))) {
>>>>>>> +		if (!dev->irq_enabled)
>>>>>>> +			return -EOPNOTSUPP;
>>>>>>> +	} else /* if DRIVER_MODESET */
>>>>>>> +#endif
>>>>>>> +	{
>>>>>>> +		if (!drm_dev_has_vblank(dev))
>>>>>>> +			return -EOPNOTSUPP;
>>>>>>> +	}
>>>>>>
>>>>>> Sheesh I hate this kind of inline #ifdefs.
>>>>>>
>>>>>> Two alternate suggestions that I believe should be as just efficient:
>>>>>
>>>>> Or how about:
>>>>>
>>>>> static bool drm_wait_vblank_supported(struct drm_device *dev)
>>>>>
>>>>> {
>>>>>
>>>>> if defined(CONFIG_DRM_LEGACY)
>>>>> 	if  (unlikely(drm_core_check_feature(dev, DRIVER_LEGACY)))
>>>>>
>>>>> 		return dev->irq_enabled;
>>>>>
>>>>> #endif
>>>>> 	return drm_dev_has_vblank(dev);
>>>>>
>>>>> }
>>>>>
>>>>>
>>>>> ?
>>>>>
>>>>> It's inline, but still readable.
>>>>
>>>> It's definitely better than the original, but it's unclear to me why
>>>> you'd prefer this over option 2) below. I guess the only reason I can
>>>> think of is emphasizing the conditional compilation. However,
>>>> IS_ENABLED() is widely used in this manner specifically to avoid inline
>>>> #if, and the compiler optimizes it away.
>>>
>>> It's simply more readable to me as the condition is simpler. But option 2 is
>>> also ok.
>>
>> Perhaps do something like this, then:
>>
>> 	if (IS_ENABLED(CONFIG_DRM_LEGACY)) {
>> 		if (unlikely(drm_core_check_feature(dev, DRIVER_LEGACY)))
>> 			return dev->irq_enabled;
>> 	}
>>
>> 	return drm_dev_has_vblank(dev);
>>
>> That's about just as readable as the variant involving the preprocessor
>> but has all the benefits of not using the preprocessor.
> 
> Looks like a winner to me. :)

That's the most readable.

But I just remembered that irq_enabled will likely become legacy-only in 
the device structure. We'll need an ifdef variant then. :/

Best regards
Thomas

> 
> BR,
> Jani.
> 
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-24 12:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20210624072916.27703-1-tzimmermann@suse.de>
     [not found] ` <20210624072916.27703-17-tzimmermann@suse.de>
2021-06-24 10:47   ` [PATCH v3 16/27] drm/rcar-du: Don't set struct drm_device.irq_enabled Laurent Pinchart
     [not found] ` <20210624072916.27703-25-tzimmermann@suse.de>
2021-06-24 10:48   ` [PATCH v3 24/27] drm/vkms: " Laurent Pinchart
     [not found] ` <20210624072916.27703-5-tzimmermann@suse.de>
     [not found]   ` <87im23u1ok.fsf@intel.com>
     [not found]     ` <b5e7729f-ed11-e9ca-386e-562feb2bd2b7@suse.de>
     [not found]       ` <877dijtzl2.fsf@intel.com>
     [not found]         ` <af21db75-584f-aec0-9659-d5386f27b4ea@suse.de>
     [not found]           ` <YNR0m2DJsdIW3NAZ@orome.fritz.box>
     [not found]             ` <87zgvfsalz.fsf@intel.com>
2021-06-24 12:57               ` [PATCH v3 04/27] drm: Don't test for IRQ support in VBLANK ioctls Thomas Zimmermann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox