.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright © 2006-2011 Intel Corporation |
---|
3 | | - * |
---|
4 | | - * This program is free software; you can redistribute it and/or modify it |
---|
5 | | - * under the terms and conditions of the GNU General Public License, |
---|
6 | | - * version 2, as published by the Free Software Foundation. |
---|
7 | | - * |
---|
8 | | - * This program is distributed in the hope it will be useful, but WITHOUT |
---|
9 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
---|
10 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
---|
11 | | - * more details. |
---|
12 | | - * |
---|
13 | | - * You should have received a copy of the GNU General Public License along with |
---|
14 | | - * this program; if not, write to the Free Software Foundation, Inc., |
---|
15 | | - * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. |
---|
16 | 4 | * |
---|
17 | 5 | * Authors: |
---|
18 | 6 | * Eric Anholt <eric@anholt.net> |
---|
19 | 7 | * Patrik Jakobsson <patrik.r.jakobsson@gmail.com> |
---|
20 | 8 | */ |
---|
21 | 9 | |
---|
22 | | -#include <drm/drmP.h> |
---|
| 10 | +#include <linux/delay.h> |
---|
| 11 | +#include <linux/highmem.h> |
---|
| 12 | + |
---|
| 13 | +#include <drm/drm_crtc.h> |
---|
| 14 | +#include <drm/drm_fourcc.h> |
---|
| 15 | +#include <drm/drm_vblank.h> |
---|
| 16 | + |
---|
| 17 | +#include "framebuffer.h" |
---|
23 | 18 | #include "gma_display.h" |
---|
| 19 | +#include "psb_drv.h" |
---|
24 | 20 | #include "psb_intel_drv.h" |
---|
25 | 21 | #include "psb_intel_reg.h" |
---|
26 | | -#include "psb_drv.h" |
---|
27 | | -#include "framebuffer.h" |
---|
28 | 22 | |
---|
29 | 23 | /** |
---|
30 | 24 | * Returns whether any output on the specified pipe is of the specified type |
---|
.. | .. |
---|
261 | 255 | /* Give the overlay scaler a chance to enable |
---|
262 | 256 | * if it's on this pipe */ |
---|
263 | 257 | /* psb_intel_crtc_dpms_video(crtc, true); TODO */ |
---|
| 258 | + |
---|
| 259 | + drm_crtc_vblank_on(crtc); |
---|
264 | 260 | break; |
---|
265 | 261 | case DRM_MODE_DPMS_OFF: |
---|
266 | 262 | if (!gma_crtc->active) |
---|
.. | .. |
---|
355 | 351 | gt = container_of(gma_crtc->cursor_obj, |
---|
356 | 352 | struct gtt_range, gem); |
---|
357 | 353 | psb_gtt_unpin(gt); |
---|
358 | | - drm_gem_object_put_unlocked(gma_crtc->cursor_obj); |
---|
| 354 | + drm_gem_object_put(gma_crtc->cursor_obj); |
---|
359 | 355 | gma_crtc->cursor_obj = NULL; |
---|
360 | 356 | } |
---|
361 | 357 | return 0; |
---|
.. | .. |
---|
431 | 427 | if (gma_crtc->cursor_obj) { |
---|
432 | 428 | gt = container_of(gma_crtc->cursor_obj, struct gtt_range, gem); |
---|
433 | 429 | psb_gtt_unpin(gt); |
---|
434 | | - drm_gem_object_put_unlocked(gma_crtc->cursor_obj); |
---|
| 430 | + drm_gem_object_put(gma_crtc->cursor_obj); |
---|
435 | 431 | } |
---|
436 | 432 | |
---|
437 | 433 | gma_crtc->cursor_obj = obj; |
---|
.. | .. |
---|
439 | 435 | return ret; |
---|
440 | 436 | |
---|
441 | 437 | unref_cursor: |
---|
442 | | - drm_gem_object_put_unlocked(obj); |
---|
| 438 | + drm_gem_object_put(obj); |
---|
443 | 439 | return ret; |
---|
444 | 440 | } |
---|
445 | 441 | |
---|
.. | .. |
---|
507 | 503 | kfree(gma_crtc); |
---|
508 | 504 | } |
---|
509 | 505 | |
---|
| 506 | +int gma_crtc_page_flip(struct drm_crtc *crtc, |
---|
| 507 | + struct drm_framebuffer *fb, |
---|
| 508 | + struct drm_pending_vblank_event *event, |
---|
| 509 | + uint32_t page_flip_flags, |
---|
| 510 | + struct drm_modeset_acquire_ctx *ctx) |
---|
| 511 | +{ |
---|
| 512 | + struct gma_crtc *gma_crtc = to_gma_crtc(crtc); |
---|
| 513 | + struct drm_framebuffer *current_fb = crtc->primary->fb; |
---|
| 514 | + struct drm_framebuffer *old_fb = crtc->primary->old_fb; |
---|
| 515 | + const struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; |
---|
| 516 | + struct drm_device *dev = crtc->dev; |
---|
| 517 | + unsigned long flags; |
---|
| 518 | + int ret; |
---|
| 519 | + |
---|
| 520 | + if (!crtc_funcs->mode_set_base) |
---|
| 521 | + return -EINVAL; |
---|
| 522 | + |
---|
| 523 | + /* Using mode_set_base requires the new fb to be set already. */ |
---|
| 524 | + crtc->primary->fb = fb; |
---|
| 525 | + |
---|
| 526 | + if (event) { |
---|
| 527 | + spin_lock_irqsave(&dev->event_lock, flags); |
---|
| 528 | + |
---|
| 529 | + WARN_ON(drm_crtc_vblank_get(crtc) != 0); |
---|
| 530 | + |
---|
| 531 | + gma_crtc->page_flip_event = event; |
---|
| 532 | + spin_unlock_irqrestore(&dev->event_lock, flags); |
---|
| 533 | + |
---|
| 534 | + /* Call this locked if we want an event at vblank interrupt. */ |
---|
| 535 | + ret = crtc_funcs->mode_set_base(crtc, crtc->x, crtc->y, old_fb); |
---|
| 536 | + if (ret) { |
---|
| 537 | + spin_lock_irqsave(&dev->event_lock, flags); |
---|
| 538 | + if (gma_crtc->page_flip_event) { |
---|
| 539 | + gma_crtc->page_flip_event = NULL; |
---|
| 540 | + drm_crtc_vblank_put(crtc); |
---|
| 541 | + } |
---|
| 542 | + spin_unlock_irqrestore(&dev->event_lock, flags); |
---|
| 543 | + } |
---|
| 544 | + } else { |
---|
| 545 | + ret = crtc_funcs->mode_set_base(crtc, crtc->x, crtc->y, old_fb); |
---|
| 546 | + } |
---|
| 547 | + |
---|
| 548 | + /* Restore previous fb in case of failure. */ |
---|
| 549 | + if (ret) |
---|
| 550 | + crtc->primary->fb = current_fb; |
---|
| 551 | + |
---|
| 552 | + return ret; |
---|
| 553 | +} |
---|
| 554 | + |
---|
510 | 555 | int gma_crtc_set_config(struct drm_mode_set *set, |
---|
511 | 556 | struct drm_modeset_acquire_ctx *ctx) |
---|
512 | 557 | { |
---|