[PATCH v2 13/16] drm/vmwgfx: Port the framebuffer code to drm fb helpers

Thomas Zimmermann tzimmermann at suse.de
Thu Oct 20 09:06:40 UTC 2022


Hi Zack

Am 20.10.22 um 05:41 schrieb Zack Rusin:
> From: Zack Rusin <zackr at vmware.com>
[...]
> @@ -1670,6 +1640,10 @@ static int vmw_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>   	if (ret)
>   		goto out_unload;
>   
> +	vmw_fifo_resource_inc(vmw);
> +	vmw_svga_enable(vmw);
> +	drm_fbdev_generic_setup(&vmw->drm,  vmw->assume_16bpp ? 16 : 32);

The preferred way of setting the color depth is with struct 
drm_mode_config.preferred_depth. [1] Note that it is the color depth; 
not the pixel size. In your case:

if (vmw->assume_16bpp)
	dev->mode_config.preferred_depth = 16;
else
	dev->mode_config.preferred_depth = 24;

It's also a hint to userspace. [2]

The prefer_bpp parameter of drm_fbdev_generic_setup() should be 0. It is 
a fallback to force a certain pixel size, as preferred_depth fails.

[1] 
https://elixir.bootlin.com/linux/v6.1-rc1/source/include/drm/drm_mode_config.h#L883
[2] 
https://elixir.bootlin.com/linux/v6.1-rc1/source/drivers/gpu/drm/drm_ioctl.c#L272

> +
>   	vmw_debugfs_gem_init(vmw);
>   	vmw_debugfs_resource_managers_init(vmw);
>   
[...]
> -
> -/**
> - * vmw_fb_dirty_flush - flush dirty regions to the kms framebuffer
> - *
> - * @work: The struct work_struct associated with this task.
> - *
> - * This function flushes the dirty regions of the vmalloc framebuffer to the
> - * kms framebuffer, and if the kms framebuffer is visible, also updated the
> - * corresponding displays. Note that this function runs even if the kms
> - * framebuffer is not bound to a crtc and thus not visible, but it's turned
> - * off during hibernation using the par->dirty.active bool.
> - */
> -static void vmw_fb_dirty_flush(struct work_struct *work)

This is the flush function for vmwgfx' deferred I/O. If you want to 
implement deferred I/O with the generic fbdev emulation, you have to set 
struct drm_mode_config.prefer_shadow_fbdev to true. [3]

[3] 
https://elixir.bootlin.com/linux/v6.1-rc1/source/include/drm/drm_mode_config.h#L890

Best regards
Thomas


-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20221020/e3a55442/attachment.sig>


More information about the dri-devel mailing list