mdpy-fb.c (8dd06ef34b6e2f41b29fbf5fc1663780f2524285) mdpy-fb.c (752774ce7793a1f8baa55aae31f3b4caac49cbe4)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Framebuffer driver for mdpy (mediated virtual pci display device).
4 *
5 * See mdpy-defs.h for device specs
6 *
7 * (c) Gerd Hoffmann <kraxel@redhat.com>
8 *

--- 103 unchanged lines hidden (view full) ---

112 return ret;
113
114 pci_read_config_dword(pdev, MDPY_FORMAT_OFFSET, &format);
115 pci_read_config_dword(pdev, MDPY_WIDTH_OFFSET, &width);
116 pci_read_config_dword(pdev, MDPY_HEIGHT_OFFSET, &height);
117 if (format != DRM_FORMAT_XRGB8888) {
118 pci_err(pdev, "format mismatch (0x%x != 0x%x)\n",
119 format, DRM_FORMAT_XRGB8888);
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Framebuffer driver for mdpy (mediated virtual pci display device).
4 *
5 * See mdpy-defs.h for device specs
6 *
7 * (c) Gerd Hoffmann <kraxel@redhat.com>
8 *

--- 103 unchanged lines hidden (view full) ---

112 return ret;
113
114 pci_read_config_dword(pdev, MDPY_FORMAT_OFFSET, &format);
115 pci_read_config_dword(pdev, MDPY_WIDTH_OFFSET, &width);
116 pci_read_config_dword(pdev, MDPY_HEIGHT_OFFSET, &height);
117 if (format != DRM_FORMAT_XRGB8888) {
118 pci_err(pdev, "format mismatch (0x%x != 0x%x)\n",
119 format, DRM_FORMAT_XRGB8888);
120 return -EINVAL;
120 ret = -EINVAL;
121 goto err_release_regions;
121 }
122 if (width < 100 || width > 10000) {
123 pci_err(pdev, "width (%d) out of range\n", width);
122 }
123 if (width < 100 || width > 10000) {
124 pci_err(pdev, "width (%d) out of range\n", width);
124 return -EINVAL;
125 ret = -EINVAL;
126 goto err_release_regions;
125 }
126 if (height < 100 || height > 10000) {
127 pci_err(pdev, "height (%d) out of range\n", height);
127 }
128 if (height < 100 || height > 10000) {
129 pci_err(pdev, "height (%d) out of range\n", height);
128 return -EINVAL;
130 ret = -EINVAL;
131 goto err_release_regions;
129 }
130 pci_info(pdev, "mdpy found: %dx%d framebuffer\n",
131 width, height);
132
133 info = framebuffer_alloc(sizeof(struct mdpy_fb_par), &pdev->dev);
132 }
133 pci_info(pdev, "mdpy found: %dx%d framebuffer\n",
134 width, height);
135
136 info = framebuffer_alloc(sizeof(struct mdpy_fb_par), &pdev->dev);
134 if (!info)
137 if (!info) {
138 ret = -ENOMEM;
135 goto err_release_regions;
139 goto err_release_regions;
140 }
136 pci_set_drvdata(pdev, info);
137 par = info->par;
138
139 info->fix = mdpy_fb_fix;
140 info->fix.smem_start = pci_resource_start(pdev, 0);
141 info->fix.smem_len = pci_resource_len(pdev, 0);
142 info->fix.line_length = width * 4;
143

--- 89 unchanged lines hidden ---
141 pci_set_drvdata(pdev, info);
142 par = info->par;
143
144 info->fix = mdpy_fb_fix;
145 info->fix.smem_start = pci_resource_start(pdev, 0);
146 info->fix.smem_len = pci_resource_len(pdev, 0);
147 info->fix.line_length = width * 4;
148

--- 89 unchanged lines hidden ---