| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2013 Red Hat |
|---|
| 3 | 4 | * 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/>. |
|---|
| 16 | 5 | */ |
|---|
| 17 | 6 | |
|---|
| 18 | 7 | #include <drm/drm_crtc.h> |
|---|
| 19 | | -#include <drm/drm_crtc_helper.h> |
|---|
| 20 | 8 | #include <drm/drm_flip_work.h> |
|---|
| 21 | 9 | #include <drm/drm_mode.h> |
|---|
| 10 | +#include <drm/drm_probe_helper.h> |
|---|
| 11 | +#include <drm/drm_vblank.h> |
|---|
| 22 | 12 | |
|---|
| 23 | 13 | #include "mdp4_kms.h" |
|---|
| 24 | 14 | |
|---|
| .. | .. |
|---|
| 128 | 118 | struct mdp4_kms *mdp4_kms = get_kms(&mdp4_crtc->base); |
|---|
| 129 | 119 | struct msm_kms *kms = &mdp4_kms->base.base; |
|---|
| 130 | 120 | |
|---|
| 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); |
|---|
| 133 | 123 | } |
|---|
| 134 | 124 | |
|---|
| 135 | 125 | static void mdp4_crtc_destroy(struct drm_crtc *crtc) |
|---|
| .. | .. |
|---|
| 244 | 234 | |
|---|
| 245 | 235 | mode = &crtc->state->adjusted_mode; |
|---|
| 246 | 236 | |
|---|
| 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)); |
|---|
| 255 | 239 | |
|---|
| 256 | 240 | mdp4_write(mdp4_kms, REG_MDP4_DMA_SRC_SIZE(dma), |
|---|
| 257 | 241 | MDP4_DMA_SRC_SIZE_WIDTH(mode->hdisplay) | |
|---|
| .. | .. |
|---|
| 384 | 368 | if (next_bo) { |
|---|
| 385 | 369 | /* take a obj ref + iova ref when we start scanning out: */ |
|---|
| 386 | 370 | 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); |
|---|
| 388 | 372 | |
|---|
| 389 | 373 | /* enable cursor: */ |
|---|
| 390 | 374 | mdp4_write(mdp4_kms, REG_MDP4_DMA_CURSOR_SIZE(dma), |
|---|
| .. | .. |
|---|
| 429 | 413 | int ret; |
|---|
| 430 | 414 | |
|---|
| 431 | 415 | 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); |
|---|
| 433 | 417 | return -EINVAL; |
|---|
| 434 | 418 | } |
|---|
| 435 | 419 | |
|---|
| .. | .. |
|---|
| 442 | 426 | } |
|---|
| 443 | 427 | |
|---|
| 444 | 428 | 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); |
|---|
| 446 | 430 | if (ret) |
|---|
| 447 | 431 | goto fail; |
|---|
| 448 | 432 | } else { |
|---|
| .. | .. |
|---|
| 468 | 452 | return 0; |
|---|
| 469 | 453 | |
|---|
| 470 | 454 | fail: |
|---|
| 471 | | - drm_gem_object_put_unlocked(cursor_bo); |
|---|
| 455 | + drm_gem_object_put(cursor_bo); |
|---|
| 472 | 456 | return ret; |
|---|
| 473 | 457 | } |
|---|
| 474 | 458 | |
|---|
| .. | .. |
|---|
| 497 | 481 | .reset = drm_atomic_helper_crtc_reset, |
|---|
| 498 | 482 | .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state, |
|---|
| 499 | 483 | .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, |
|---|
| 484 | + .enable_vblank = msm_crtc_enable_vblank, |
|---|
| 485 | + .disable_vblank = msm_crtc_disable_vblank, |
|---|
| 500 | 486 | }; |
|---|
| 501 | 487 | |
|---|
| 502 | 488 | static const struct drm_crtc_helper_funcs mdp4_crtc_helper_funcs = { |
|---|