hc
2024-05-10 9999e48639b3cecb08ffb37358bcba3b48161b29
kernel/drivers/gpu/drm/msm/msm_fbdev.c
....@@ -1,22 +1,12 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (C) 2013 Red Hat
34 * Author: Rob Clark <robdclark@gmail.com>
4
- *
5
- * This program is free software; you can redistribute it and/or modify it
6
- * under the terms of the GNU General Public License version 2 as published by
7
- * the Free Software Foundation.
8
- *
9
- * This program is distributed in the hope that it will be useful, but WITHOUT
10
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12
- * more details.
13
- *
14
- * You should have received a copy of the GNU General Public License along with
15
- * this program. If not, see <http://www.gnu.org/licenses/>.
165 */
176
187 #include <drm/drm_crtc.h>
198 #include <drm/drm_fb_helper.h>
9
+#include <drm/drm_fourcc.h>
2010
2111 #include "msm_drv.h"
2212 #include "msm_kms.h"
....@@ -36,7 +26,7 @@
3626 struct drm_framebuffer *fb;
3727 };
3828
39
-static struct fb_ops msm_fb_ops = {
29
+static const struct fb_ops msm_fb_ops = {
4030 .owner = THIS_MODULE,
4131 DRM_FB_HELPER_DEFAULT_OPS,
4232
....@@ -91,7 +81,7 @@
9181 sizes->surface_height, pitch, format);
9282
9383 if (IS_ERR(fb)) {
94
- dev_err(dev->dev, "failed to allocate fb\n");
84
+ DRM_DEV_ERROR(dev->dev, "failed to allocate fb\n");
9585 return PTR_ERR(fb);
9686 }
9787
....@@ -104,15 +94,15 @@
10494 * in panic (ie. lock-safe, etc) we could avoid pinning the
10595 * buffer now:
10696 */
107
- ret = msm_gem_get_iova(bo, priv->kms->aspace, &paddr);
97
+ ret = msm_gem_get_and_pin_iova(bo, priv->kms->aspace, &paddr);
10898 if (ret) {
109
- dev_err(dev->dev, "failed to get buffer obj iova: %d\n", ret);
99
+ DRM_DEV_ERROR(dev->dev, "failed to get buffer obj iova: %d\n", ret);
110100 goto fail_unlock;
111101 }
112102
113103 fbi = drm_fb_helper_alloc_fbi(helper);
114104 if (IS_ERR(fbi)) {
115
- dev_err(dev->dev, "failed to allocate fb info\n");
105
+ DRM_DEV_ERROR(dev->dev, "failed to allocate fb info\n");
116106 ret = PTR_ERR(fbi);
117107 goto fail_unlock;
118108 }
....@@ -122,13 +112,9 @@
122112 fbdev->fb = fb;
123113 helper->fb = fb;
124114
125
- fbi->par = helper;
126115 fbi->fbops = &msm_fb_ops;
127116
128
- strcpy(fbi->fix.id, "msm");
129
-
130
- drm_fb_helper_fill_fix(fbi, fb->pitches[0], fb->format->depth);
131
- drm_fb_helper_fill_var(fbi, helper, sizes->fb_width, sizes->fb_height);
117
+ drm_fb_helper_fill_info(fbi, helper, sizes);
132118
133119 dev->mode_config.fb_base = paddr;
134120
....@@ -174,15 +160,14 @@
174160
175161 drm_fb_helper_prepare(dev, helper, &msm_fb_helper_funcs);
176162
177
- ret = drm_fb_helper_init(dev, helper, priv->num_connectors);
163
+ ret = drm_fb_helper_init(dev, helper);
178164 if (ret) {
179
- dev_err(dev->dev, "could not init fbdev: ret=%d\n", ret);
165
+ DRM_DEV_ERROR(dev->dev, "could not init fbdev: ret=%d\n", ret);
180166 goto fail;
181167 }
182168
183
- ret = drm_fb_helper_single_add_all_connectors(helper);
184
- if (ret)
185
- goto fini;
169
+ /* the fw fb could be anywhere in memory */
170
+ drm_fb_helper_remove_conflicting_framebuffers(NULL, "msm", false);
186171
187172 ret = drm_fb_helper_initial_config(helper, 32);
188173 if (ret)