[PATCH 08/10] drm: Add Generic USB Display driver
Noralf Trønnes
noralf at tronnes.org
Sat May 2 17:58:05 UTC 2020
Den 29.04.2020 14.48, skrev Noralf Trønnes:
> This adds a generic USB display driver with the intention that it can be
> used with future USB interfaced low end displays/adapters. The Linux
> gadget device driver will serve as the canonical device implementation.
>
> The following DRM properties are supported:
> - Plane rotation
> - Connector TV properties
>
> There is also support for backlight brightness exposed as a backlight
> device.
>
> Display modes can be made available to the host driver either as DRM
> display modes or through EDID. If both are present, EDID is just passed
> on to userspace.
>
> Performance is preferred over color depth, so if the device supports
> RGB565, DRM_CAP_DUMB_PREFERRED_DEPTH will return 16.
>
> If the device transfer buffer can't fit an uncompressed framebuffer
> update, the update is split up into parts that do fit.
>
> Optimal user experience is achieved by providing damage reports either by
> setting FB_DAMAGE_CLIPS on pageflips or calling DRM_IOCTL_MODE_DIRTYFB.
>
> LZ4 compression is used if the device supports it.
>
> The driver supports a one bit monochrome transfer format: R1. This is not
> implemented in the gadget driver. It is added in preparation for future
> monochrome e-ink displays.
>
> The driver is MIT licensed to smooth the path for any BSD port of the
> driver.
>
> Signed-off-by: Noralf Trønnes <noralf at tronnes.org>
> ---
> diff --git a/drivers/gpu/drm/gud/gud_drm_drv.c b/drivers/gpu/drm/gud/gud_drm_drv.c
> +static int gud_drm_probe(struct usb_interface *interface,
> + const struct usb_device_id *id)
> +{
<snip>
> + gdrm = kzalloc(sizeof(*gdrm), GFP_KERNEL);
> + if (!gdrm)
> + return -ENOMEM;
> +
> + gdrm->usb = usb;
> + gdrm->ifnum = interface->cur_altsetting->desc.bInterfaceNumber;
> + gdrm->compression = desc.bCompression & GUD_DRM_COMPRESSION_LZ4;
> +
> + drm = &gdrm->drm;
> + ret = devm_drm_dev_init(dev, drm, &gud_drm_driver);
> + if (ret) {
> + kfree(gdrm);
> + return ret;
> + }
I see that Daniel's series has landed now, so I will use
devm_drm_dev_alloc() and drmm_mode_config_init() in the next version.
<snip>
> + drm_fbdev_generic_setup(drm, 16);
This should be:
drm_fbdev_generic_setup(drm, 0);
Noralf.
> +
> + return 0;
> +}
More information about the dri-devel
mailing list