| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
|---|
| 1 | 2 | /* exynos_drm_drv.h |
|---|
| 2 | 3 | * |
|---|
| 3 | 4 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. |
|---|
| .. | .. |
|---|
| 5 | 6 | * Inki Dae <inki.dae@samsung.com> |
|---|
| 6 | 7 | * Joonyoung Shim <jy0922.shim@samsung.com> |
|---|
| 7 | 8 | * Seung-Woo Kim <sw0312.kim@samsung.com> |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 10 | | - * under the terms of the GNU General Public License as published by the |
|---|
| 11 | | - * Free Software Foundation; either version 2 of the License, or (at your |
|---|
| 12 | | - * option) any later version. |
|---|
| 13 | 9 | */ |
|---|
| 14 | 10 | |
|---|
| 15 | 11 | #ifndef _EXYNOS_DRM_DRV_H_ |
|---|
| 16 | 12 | #define _EXYNOS_DRM_DRV_H_ |
|---|
| 17 | 13 | |
|---|
| 18 | | -#include <drm/drmP.h> |
|---|
| 19 | 14 | #include <linux/module.h> |
|---|
| 15 | + |
|---|
| 16 | +#include <drm/drm_crtc.h> |
|---|
| 17 | +#include <drm/drm_device.h> |
|---|
| 18 | +#include <drm/drm_plane.h> |
|---|
| 20 | 19 | |
|---|
| 21 | 20 | #define MAX_CRTC 3 |
|---|
| 22 | 21 | #define MAX_PLANE 5 |
|---|
| 23 | 22 | #define MAX_FB_BUFFER 4 |
|---|
| 24 | 23 | |
|---|
| 25 | 24 | #define DEFAULT_WIN 0 |
|---|
| 25 | + |
|---|
| 26 | +struct drm_crtc_state; |
|---|
| 27 | +struct drm_display_mode; |
|---|
| 26 | 28 | |
|---|
| 27 | 29 | #define to_exynos_crtc(x) container_of(x, struct exynos_drm_crtc, base) |
|---|
| 28 | 30 | #define to_exynos_plane(x) container_of(x, struct exynos_drm_plane, base) |
|---|
| .. | .. |
|---|
| 92 | 94 | #define EXYNOS_DRM_PLANE_CAP_SCALE (1 << 1) |
|---|
| 93 | 95 | #define EXYNOS_DRM_PLANE_CAP_ZPOS (1 << 2) |
|---|
| 94 | 96 | #define EXYNOS_DRM_PLANE_CAP_TILE (1 << 3) |
|---|
| 97 | +#define EXYNOS_DRM_PLANE_CAP_PIX_BLEND (1 << 4) |
|---|
| 98 | +#define EXYNOS_DRM_PLANE_CAP_WIN_BLEND (1 << 5) |
|---|
| 95 | 99 | |
|---|
| 96 | 100 | /* |
|---|
| 97 | 101 | * Exynos DRM plane configuration structure. |
|---|
| .. | .. |
|---|
| 114 | 118 | /* |
|---|
| 115 | 119 | * Exynos drm crtc ops |
|---|
| 116 | 120 | * |
|---|
| 117 | | - * @enable: enable the device |
|---|
| 118 | | - * @disable: disable the device |
|---|
| 121 | + * @atomic_enable: enable the device |
|---|
| 122 | + * @atomic_disable: disable the device |
|---|
| 119 | 123 | * @enable_vblank: specific driver callback for enabling vblank interrupt. |
|---|
| 120 | 124 | * @disable_vblank: specific driver callback for disabling vblank interrupt. |
|---|
| 121 | 125 | * @mode_valid: specific driver callback for mode validation |
|---|
| .. | .. |
|---|
| 129 | 133 | */ |
|---|
| 130 | 134 | struct exynos_drm_crtc; |
|---|
| 131 | 135 | struct exynos_drm_crtc_ops { |
|---|
| 132 | | - void (*enable)(struct exynos_drm_crtc *crtc); |
|---|
| 133 | | - void (*disable)(struct exynos_drm_crtc *crtc); |
|---|
| 136 | + void (*atomic_enable)(struct exynos_drm_crtc *crtc); |
|---|
| 137 | + void (*atomic_disable)(struct exynos_drm_crtc *crtc); |
|---|
| 134 | 138 | int (*enable_vblank)(struct exynos_drm_crtc *crtc); |
|---|
| 135 | 139 | void (*disable_vblank)(struct exynos_drm_crtc *crtc); |
|---|
| 136 | 140 | enum drm_mode_status (*mode_valid)(struct exynos_drm_crtc *crtc, |
|---|
| .. | .. |
|---|
| 194 | 198 | */ |
|---|
| 195 | 199 | struct exynos_drm_private { |
|---|
| 196 | 200 | struct drm_fb_helper *fb_helper; |
|---|
| 197 | | - struct drm_atomic_state *suspend_state; |
|---|
| 198 | 201 | |
|---|
| 199 | 202 | struct device *g2d_dev; |
|---|
| 200 | 203 | struct device *dma_dev; |
|---|
| .. | .. |
|---|
| 213 | 216 | return priv->dma_dev; |
|---|
| 214 | 217 | } |
|---|
| 215 | 218 | |
|---|
| 219 | +static inline bool is_drm_iommu_supported(struct drm_device *drm_dev) |
|---|
| 220 | +{ |
|---|
| 221 | + struct exynos_drm_private *priv = drm_dev->dev_private; |
|---|
| 222 | + |
|---|
| 223 | + return priv->mapping ? true : false; |
|---|
| 224 | +} |
|---|
| 225 | + |
|---|
| 226 | +int exynos_drm_register_dma(struct drm_device *drm, struct device *dev, |
|---|
| 227 | + void **dma_priv); |
|---|
| 228 | +void exynos_drm_unregister_dma(struct drm_device *drm, struct device *dev, |
|---|
| 229 | + void **dma_priv); |
|---|
| 230 | +void exynos_drm_cleanup_dma(struct drm_device *drm); |
|---|
| 231 | + |
|---|
| 216 | 232 | #ifdef CONFIG_DRM_EXYNOS_DPI |
|---|
| 217 | 233 | struct drm_encoder *exynos_dpi_probe(struct device *dev); |
|---|
| 218 | 234 | int exynos_dpi_remove(struct drm_encoder *encoder); |
|---|