// SPDX-License-Identifier: GPL-2.0 /* * Framebuffer driver for mdpy (mediated virtual pci display device). * * See mdpy-defs.h for device specs * * (c) Gerd Hoffmann <kraxel@redhat.com> * * Using some code snippets from simplefb and cirrusfb. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details.
*/ #include <linux/errno.h> #include <linux/fb.h> #include <linux/io.h> #include <linux/pci.h> #include <linux/module.h> #include <drm/drm_fourcc.h> #include"mdpy-defs.h"
staticint mdpy_fb_probe(struct pci_dev *pdev, conststruct pci_device_id *ent)
{ struct fb_info *info; struct mdpy_fb_par *par;
u32 format, width, height; int ret;
ret = pci_enable_device(pdev); if (ret < 0) return ret;
ret = pci_request_regions(pdev, "mdpy-fb"); if (ret < 0) goto err_disable_dev;
pci_read_config_dword(pdev, MDPY_FORMAT_OFFSET, &format);
pci_read_config_dword(pdev, MDPY_WIDTH_OFFSET, &width);
pci_read_config_dword(pdev, MDPY_HEIGHT_OFFSET, &height); if (format != DRM_FORMAT_XRGB8888) {
pci_err(pdev, "format mismatch (0x%x != 0x%x)\n",
format, DRM_FORMAT_XRGB8888);
ret = -EINVAL; goto err_release_regions;
} if (width < 100 || width > 10000) {
pci_err(pdev, "width (%d) out of range\n", width);
ret = -EINVAL; goto err_release_regions;
} if (height < 100 || height > 10000) {
pci_err(pdev, "height (%d) out of range\n", height);
ret = -EINVAL; goto err_release_regions;
}
pci_info(pdev, "mdpy found: %dx%d framebuffer\n",
width, height);
info = framebuffer_alloc(sizeof(struct mdpy_fb_par), &pdev->dev); if (!info) {
ret = -ENOMEM; goto err_release_regions;
}
pci_set_drvdata(pdev, info);
par = info->par;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.