hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c
....@@ -1,24 +1,14 @@
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>
19
-#include <drm/drm_crtc_helper.h>
208 #include <drm/drm_flip_work.h>
219 #include <drm/drm_mode.h>
10
+#include <drm/drm_probe_helper.h>
11
+#include <drm/drm_vblank.h>
2212
2313 #include "mdp4_kms.h"
2414
....@@ -128,8 +118,8 @@
128118 struct mdp4_kms *mdp4_kms = get_kms(&mdp4_crtc->base);
129119 struct msm_kms *kms = &mdp4_kms->base.base;
130120
131
- msm_gem_put_iova(val, kms->aspace);
132
- drm_gem_object_put_unlocked(val);
121
+ msm_gem_unpin_iova(val, kms->aspace);
122
+ drm_gem_object_put(val);
133123 }
134124
135125 static void mdp4_crtc_destroy(struct drm_crtc *crtc)
....@@ -244,14 +234,8 @@
244234
245235 mode = &crtc->state->adjusted_mode;
246236
247
- DBG("%s: set mode: %d:\"%s\" %d %d %d %d %d %d %d %d %d %d 0x%x 0x%x",
248
- mdp4_crtc->name, mode->base.id, mode->name,
249
- mode->vrefresh, mode->clock,
250
- mode->hdisplay, mode->hsync_start,
251
- mode->hsync_end, mode->htotal,
252
- mode->vdisplay, mode->vsync_start,
253
- mode->vsync_end, mode->vtotal,
254
- mode->type, mode->flags);
237
+ DBG("%s: set mode: " DRM_MODE_FMT,
238
+ mdp4_crtc->name, DRM_MODE_ARG(mode));
255239
256240 mdp4_write(mdp4_kms, REG_MDP4_DMA_SRC_SIZE(dma),
257241 MDP4_DMA_SRC_SIZE_WIDTH(mode->hdisplay) |
....@@ -384,7 +368,7 @@
384368 if (next_bo) {
385369 /* take a obj ref + iova ref when we start scanning out: */
386370 drm_gem_object_get(next_bo);
387
- msm_gem_get_iova(next_bo, kms->aspace, &iova);
371
+ msm_gem_get_and_pin_iova(next_bo, kms->aspace, &iova);
388372
389373 /* enable cursor: */
390374 mdp4_write(mdp4_kms, REG_MDP4_DMA_CURSOR_SIZE(dma),
....@@ -429,7 +413,7 @@
429413 int ret;
430414
431415 if ((width > CURSOR_WIDTH) || (height > CURSOR_HEIGHT)) {
432
- dev_err(dev->dev, "bad cursor size: %dx%d\n", width, height);
416
+ DRM_DEV_ERROR(dev->dev, "bad cursor size: %dx%d\n", width, height);
433417 return -EINVAL;
434418 }
435419
....@@ -442,7 +426,7 @@
442426 }
443427
444428 if (cursor_bo) {
445
- ret = msm_gem_get_iova(cursor_bo, kms->aspace, &iova);
429
+ ret = msm_gem_get_and_pin_iova(cursor_bo, kms->aspace, &iova);
446430 if (ret)
447431 goto fail;
448432 } else {
....@@ -468,7 +452,7 @@
468452 return 0;
469453
470454 fail:
471
- drm_gem_object_put_unlocked(cursor_bo);
455
+ drm_gem_object_put(cursor_bo);
472456 return ret;
473457 }
474458
....@@ -497,6 +481,8 @@
497481 .reset = drm_atomic_helper_crtc_reset,
498482 .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
499483 .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
484
+ .enable_vblank = msm_crtc_enable_vblank,
485
+ .disable_vblank = msm_crtc_disable_vblank,
500486 };
501487
502488 static const struct drm_crtc_helper_funcs mdp4_crtc_helper_funcs = {