Joonyoung Shim | 864ee9e | 2011-12-08 17:54:07 +0900 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 Samsung Electronics Co.Ltd |
| 3 | * Authors: Joonyoung Shim <jy0922.shim@samsung.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 as published by the |
| 7 | * Free Software Foundation; either version 2 of the License, or (at your |
| 8 | * option) any later version. |
| 9 | * |
| 10 | */ |
| 11 | |
David Howells | 760285e | 2012-10-02 18:01:07 +0100 | [diff] [blame] | 12 | #include <drm/drmP.h> |
Joonyoung Shim | 864ee9e | 2011-12-08 17:54:07 +0900 | [diff] [blame] | 13 | |
Andrzej Hajda | 81e50bc | 2016-03-15 12:38:02 +0100 | [diff] [blame] | 14 | #include <drm/drm_atomic.h> |
Gustavo Padovan | 4ea9526 | 2015-06-01 12:04:44 -0300 | [diff] [blame] | 15 | #include <drm/drm_atomic_helper.h> |
Andrzej Hajda | 81e50bc | 2016-03-15 12:38:02 +0100 | [diff] [blame] | 16 | #include <drm/drm_plane_helper.h> |
| 17 | #include <drm/exynos_drm.h> |
Joonyoung Shim | 864ee9e | 2011-12-08 17:54:07 +0900 | [diff] [blame] | 18 | #include "exynos_drm_drv.h" |
Sean Paul | 080be03d | 2014-02-19 21:02:55 +0900 | [diff] [blame] | 19 | #include "exynos_drm_crtc.h" |
Joonyoung Shim | 4070d21 | 2012-06-27 14:27:05 +0900 | [diff] [blame] | 20 | #include "exynos_drm_fb.h" |
| 21 | #include "exynos_drm_gem.h" |
Mark Brown | e30655d | 2013-08-13 00:46:40 +0100 | [diff] [blame] | 22 | #include "exynos_drm_plane.h" |
Joonyoung Shim | 864ee9e | 2011-12-08 17:54:07 +0900 | [diff] [blame] | 23 | |
Joonyoung Shim | 2ab9792 | 2012-09-27 19:25:21 +0900 | [diff] [blame] | 24 | /* |
| 25 | * This function is to get X or Y size shown via screen. This needs length and |
| 26 | * start position of CRTC. |
| 27 | * |
| 28 | * <--- length ---> |
| 29 | * CRTC ---------------- |
| 30 | * ^ start ^ end |
| 31 | * |
Joonyoung Shim | 60a705a | 2012-12-14 15:48:22 +0900 | [diff] [blame] | 32 | * There are six cases from a to f. |
Joonyoung Shim | 2ab9792 | 2012-09-27 19:25:21 +0900 | [diff] [blame] | 33 | * |
| 34 | * <----- SCREEN -----> |
| 35 | * 0 last |
| 36 | * ----------|------------------|---------- |
| 37 | * CRTCs |
| 38 | * a ------- |
| 39 | * b ------- |
| 40 | * c -------------------------- |
| 41 | * d -------- |
| 42 | * e ------- |
| 43 | * f ------- |
| 44 | */ |
| 45 | static int exynos_plane_get_size(int start, unsigned length, unsigned last) |
| 46 | { |
| 47 | int end = start + length; |
| 48 | int size = 0; |
| 49 | |
| 50 | if (start <= 0) { |
| 51 | if (end > 0) |
| 52 | size = min_t(unsigned, end, last); |
| 53 | } else if (start <= last) { |
| 54 | size = min_t(unsigned, last - start, length); |
| 55 | } |
| 56 | |
| 57 | return size; |
| 58 | } |
| 59 | |
Marek Szyprowski | 0114f40 | 2015-11-30 14:53:22 +0100 | [diff] [blame] | 60 | static void exynos_plane_mode_set(struct exynos_drm_plane_state *exynos_state) |
Gustavo Padovan | adf5691 | 2014-11-27 14:56:09 -0200 | [diff] [blame] | 61 | { |
Marek Szyprowski | 0114f40 | 2015-11-30 14:53:22 +0100 | [diff] [blame] | 62 | struct drm_plane_state *state = &exynos_state->base; |
Andrzej Hajda | 81e50bc | 2016-03-15 12:38:02 +0100 | [diff] [blame] | 63 | struct drm_crtc *crtc = state->crtc; |
| 64 | struct drm_crtc_state *crtc_state = |
| 65 | drm_atomic_get_existing_crtc_state(state->state, crtc); |
| 66 | struct drm_display_mode *mode = &crtc_state->adjusted_mode; |
Marek Szyprowski | 0114f40 | 2015-11-30 14:53:22 +0100 | [diff] [blame] | 67 | int crtc_x, crtc_y; |
| 68 | unsigned int crtc_w, crtc_h; |
| 69 | unsigned int src_x, src_y; |
| 70 | unsigned int src_w, src_h; |
Gustavo Padovan | adf5691 | 2014-11-27 14:56:09 -0200 | [diff] [blame] | 71 | unsigned int actual_w; |
| 72 | unsigned int actual_h; |
| 73 | |
Marek Szyprowski | 0114f40 | 2015-11-30 14:53:22 +0100 | [diff] [blame] | 74 | /* |
| 75 | * The original src/dest coordinates are stored in exynos_state->base, |
| 76 | * but we want to keep another copy internal to our driver that we can |
| 77 | * clip/modify ourselves. |
| 78 | */ |
| 79 | |
| 80 | crtc_x = state->crtc_x; |
| 81 | crtc_y = state->crtc_y; |
| 82 | crtc_w = state->crtc_w; |
| 83 | crtc_h = state->crtc_h; |
| 84 | |
| 85 | src_x = state->src_x >> 16; |
| 86 | src_y = state->src_y >> 16; |
| 87 | src_w = state->src_w >> 16; |
| 88 | src_h = state->src_h >> 16; |
| 89 | |
Marek Szyprowski | d16a11a | 2015-11-30 14:53:28 +0100 | [diff] [blame] | 90 | /* set ratio */ |
| 91 | exynos_state->h_ratio = (src_w << 16) / crtc_w; |
| 92 | exynos_state->v_ratio = (src_h << 16) / crtc_h; |
| 93 | |
| 94 | /* clip to visible area */ |
Joonyoung Shim | 020e79d | 2015-06-02 21:04:42 +0900 | [diff] [blame] | 95 | actual_w = exynos_plane_get_size(crtc_x, crtc_w, mode->hdisplay); |
| 96 | actual_h = exynos_plane_get_size(crtc_y, crtc_h, mode->vdisplay); |
Joonyoung Shim | 2ab9792 | 2012-09-27 19:25:21 +0900 | [diff] [blame] | 97 | |
| 98 | if (crtc_x < 0) { |
| 99 | if (actual_w) |
Marek Szyprowski | d16a11a | 2015-11-30 14:53:28 +0100 | [diff] [blame] | 100 | src_x += ((-crtc_x) * exynos_state->h_ratio) >> 16; |
Joonyoung Shim | 2ab9792 | 2012-09-27 19:25:21 +0900 | [diff] [blame] | 101 | crtc_x = 0; |
| 102 | } |
| 103 | |
| 104 | if (crtc_y < 0) { |
| 105 | if (actual_h) |
Marek Szyprowski | d16a11a | 2015-11-30 14:53:28 +0100 | [diff] [blame] | 106 | src_y += ((-crtc_y) * exynos_state->v_ratio) >> 16; |
Joonyoung Shim | 2ab9792 | 2012-09-27 19:25:21 +0900 | [diff] [blame] | 107 | crtc_y = 0; |
| 108 | } |
Joonyoung Shim | 4070d21 | 2012-06-27 14:27:05 +0900 | [diff] [blame] | 109 | |
| 110 | /* set drm framebuffer data. */ |
Marek Szyprowski | 0114f40 | 2015-11-30 14:53:22 +0100 | [diff] [blame] | 111 | exynos_state->src.x = src_x; |
| 112 | exynos_state->src.y = src_y; |
| 113 | exynos_state->src.w = (actual_w * exynos_state->h_ratio) >> 16; |
| 114 | exynos_state->src.h = (actual_h * exynos_state->v_ratio) >> 16; |
Joonyoung Shim | 4070d21 | 2012-06-27 14:27:05 +0900 | [diff] [blame] | 115 | |
Gustavo Padovan | 8837dee | 2014-11-03 18:13:27 -0200 | [diff] [blame] | 116 | /* set plane range to be displayed. */ |
Marek Szyprowski | 0114f40 | 2015-11-30 14:53:22 +0100 | [diff] [blame] | 117 | exynos_state->crtc.x = crtc_x; |
| 118 | exynos_state->crtc.y = crtc_y; |
| 119 | exynos_state->crtc.w = actual_w; |
| 120 | exynos_state->crtc.h = actual_h; |
Gustavo Padovan | d88d246 | 2015-07-16 12:23:38 -0300 | [diff] [blame] | 121 | |
Gustavo Padovan | 8837dee | 2014-11-03 18:13:27 -0200 | [diff] [blame] | 122 | DRM_DEBUG_KMS("plane : offset_x/y(%d,%d), width/height(%d,%d)", |
Marek Szyprowski | 0114f40 | 2015-11-30 14:53:22 +0100 | [diff] [blame] | 123 | exynos_state->crtc.x, exynos_state->crtc.y, |
| 124 | exynos_state->crtc.w, exynos_state->crtc.h); |
| 125 | } |
Joonyoung Shim | 4070d21 | 2012-06-27 14:27:05 +0900 | [diff] [blame] | 126 | |
Marek Szyprowski | 0114f40 | 2015-11-30 14:53:22 +0100 | [diff] [blame] | 127 | static void exynos_drm_plane_reset(struct drm_plane *plane) |
| 128 | { |
Marek Szyprowski | 0ea7240 | 2015-12-16 13:21:43 +0100 | [diff] [blame] | 129 | struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane); |
Marek Szyprowski | 0114f40 | 2015-11-30 14:53:22 +0100 | [diff] [blame] | 130 | struct exynos_drm_plane_state *exynos_state; |
| 131 | |
| 132 | if (plane->state) { |
| 133 | exynos_state = to_exynos_plane_state(plane->state); |
Christoph Manszewski | a977726 | 2018-09-21 14:24:36 +0200 | [diff] [blame] | 134 | __drm_atomic_helper_plane_destroy_state(plane->state); |
Marek Szyprowski | 0114f40 | 2015-11-30 14:53:22 +0100 | [diff] [blame] | 135 | kfree(exynos_state); |
| 136 | plane->state = NULL; |
| 137 | } |
| 138 | |
| 139 | exynos_state = kzalloc(sizeof(*exynos_state), GFP_KERNEL); |
| 140 | if (exynos_state) { |
Christoph Manszewski | a977726 | 2018-09-21 14:24:36 +0200 | [diff] [blame] | 141 | __drm_atomic_helper_plane_reset(plane, &exynos_state->base); |
Marek Szyprowski | e47726a | 2016-05-11 17:16:06 +0200 | [diff] [blame] | 142 | plane->state->zpos = exynos_plane->config->zpos; |
Marek Szyprowski | 0114f40 | 2015-11-30 14:53:22 +0100 | [diff] [blame] | 143 | } |
| 144 | } |
| 145 | |
| 146 | static struct drm_plane_state * |
| 147 | exynos_drm_plane_duplicate_state(struct drm_plane *plane) |
| 148 | { |
| 149 | struct exynos_drm_plane_state *exynos_state; |
| 150 | struct exynos_drm_plane_state *copy; |
| 151 | |
| 152 | exynos_state = to_exynos_plane_state(plane->state); |
| 153 | copy = kzalloc(sizeof(*exynos_state), GFP_KERNEL); |
| 154 | if (!copy) |
| 155 | return NULL; |
| 156 | |
| 157 | __drm_atomic_helper_plane_duplicate_state(plane, ©->base); |
| 158 | return ©->base; |
| 159 | } |
| 160 | |
| 161 | static void exynos_drm_plane_destroy_state(struct drm_plane *plane, |
| 162 | struct drm_plane_state *old_state) |
| 163 | { |
| 164 | struct exynos_drm_plane_state *old_exynos_state = |
| 165 | to_exynos_plane_state(old_state); |
Daniel Vetter | 2f70169 | 2016-05-09 16:34:10 +0200 | [diff] [blame] | 166 | __drm_atomic_helper_plane_destroy_state(old_state); |
Marek Szyprowski | 0114f40 | 2015-11-30 14:53:22 +0100 | [diff] [blame] | 167 | kfree(old_exynos_state); |
Joonyoung Shim | 4070d21 | 2012-06-27 14:27:05 +0900 | [diff] [blame] | 168 | } |
| 169 | |
Joonyoung Shim | 864ee9e | 2011-12-08 17:54:07 +0900 | [diff] [blame] | 170 | static struct drm_plane_funcs exynos_plane_funcs = { |
Gustavo Padovan | 910874a | 2015-06-01 12:04:46 -0300 | [diff] [blame] | 171 | .update_plane = drm_atomic_helper_update_plane, |
| 172 | .disable_plane = drm_atomic_helper_disable_plane, |
Gustavo Padovan | 97464d7 | 2015-04-01 13:02:10 -0300 | [diff] [blame] | 173 | .destroy = drm_plane_cleanup, |
Marek Szyprowski | 0114f40 | 2015-11-30 14:53:22 +0100 | [diff] [blame] | 174 | .reset = exynos_drm_plane_reset, |
| 175 | .atomic_duplicate_state = exynos_drm_plane_duplicate_state, |
| 176 | .atomic_destroy_state = exynos_drm_plane_destroy_state, |
Joonyoung Shim | 864ee9e | 2011-12-08 17:54:07 +0900 | [diff] [blame] | 177 | }; |
| 178 | |
Marek Szyprowski | 6178d3d | 2015-11-30 14:53:26 +0100 | [diff] [blame] | 179 | static int |
Tobias Jakobi | f40031c | 2017-08-22 16:19:37 +0200 | [diff] [blame] | 180 | exynos_drm_plane_check_format(const struct exynos_drm_plane_config *config, |
| 181 | struct exynos_drm_plane_state *state) |
| 182 | { |
| 183 | struct drm_framebuffer *fb = state->base.fb; |
| 184 | |
| 185 | switch (fb->modifier) { |
| 186 | case DRM_FORMAT_MOD_SAMSUNG_64_32_TILE: |
| 187 | if (!(config->capabilities & EXYNOS_DRM_PLANE_CAP_TILE)) |
| 188 | return -ENOTSUPP; |
| 189 | break; |
| 190 | |
| 191 | case DRM_FORMAT_MOD_LINEAR: |
| 192 | break; |
| 193 | |
| 194 | default: |
| 195 | DRM_ERROR("unsupported pixel format modifier"); |
| 196 | return -ENOTSUPP; |
| 197 | } |
| 198 | |
| 199 | return 0; |
| 200 | } |
| 201 | |
| 202 | static int |
Marek Szyprowski | 6178d3d | 2015-11-30 14:53:26 +0100 | [diff] [blame] | 203 | exynos_drm_plane_check_size(const struct exynos_drm_plane_config *config, |
| 204 | struct exynos_drm_plane_state *state) |
| 205 | { |
| 206 | bool width_ok = false, height_ok = false; |
| 207 | |
| 208 | if (config->capabilities & EXYNOS_DRM_PLANE_CAP_SCALE) |
| 209 | return 0; |
| 210 | |
| 211 | if (state->src.w == state->crtc.w) |
| 212 | width_ok = true; |
| 213 | |
| 214 | if (state->src.h == state->crtc.h) |
| 215 | height_ok = true; |
| 216 | |
| 217 | if ((config->capabilities & EXYNOS_DRM_PLANE_CAP_DOUBLE) && |
| 218 | state->h_ratio == (1 << 15)) |
| 219 | width_ok = true; |
| 220 | |
| 221 | if ((config->capabilities & EXYNOS_DRM_PLANE_CAP_DOUBLE) && |
| 222 | state->v_ratio == (1 << 15)) |
| 223 | height_ok = true; |
| 224 | |
Tobias Jakobi | 39bf86092 | 2016-05-25 14:30:07 +0200 | [diff] [blame] | 225 | if (width_ok && height_ok) |
Marek Szyprowski | 6178d3d | 2015-11-30 14:53:26 +0100 | [diff] [blame] | 226 | return 0; |
| 227 | |
| 228 | DRM_DEBUG_KMS("scaling mode is not supported"); |
| 229 | return -ENOTSUPP; |
| 230 | } |
| 231 | |
Gustavo Padovan | 43dbdad | 2015-06-01 12:04:41 -0300 | [diff] [blame] | 232 | static int exynos_plane_atomic_check(struct drm_plane *plane, |
| 233 | struct drm_plane_state *state) |
| 234 | { |
Gustavo Padovan | d5f5223 | 2015-06-01 12:04:49 -0300 | [diff] [blame] | 235 | struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane); |
Marek Szyprowski | 0114f40 | 2015-11-30 14:53:22 +0100 | [diff] [blame] | 236 | struct exynos_drm_plane_state *exynos_state = |
| 237 | to_exynos_plane_state(state); |
| 238 | int ret = 0; |
Gustavo Padovan | d5f5223 | 2015-06-01 12:04:49 -0300 | [diff] [blame] | 239 | |
Marek Szyprowski | 0114f40 | 2015-11-30 14:53:22 +0100 | [diff] [blame] | 240 | if (!state->crtc || !state->fb) |
Gustavo Padovan | d5f5223 | 2015-06-01 12:04:49 -0300 | [diff] [blame] | 241 | return 0; |
| 242 | |
Marek Szyprowski | 0114f40 | 2015-11-30 14:53:22 +0100 | [diff] [blame] | 243 | /* translate state into exynos_state */ |
| 244 | exynos_plane_mode_set(exynos_state); |
Gustavo Padovan | d5f5223 | 2015-06-01 12:04:49 -0300 | [diff] [blame] | 245 | |
Tobias Jakobi | f40031c | 2017-08-22 16:19:37 +0200 | [diff] [blame] | 246 | ret = exynos_drm_plane_check_format(exynos_plane->config, exynos_state); |
| 247 | if (ret) |
| 248 | return ret; |
| 249 | |
Marek Szyprowski | 6178d3d | 2015-11-30 14:53:26 +0100 | [diff] [blame] | 250 | ret = exynos_drm_plane_check_size(exynos_plane->config, exynos_state); |
Marek Szyprowski | 0114f40 | 2015-11-30 14:53:22 +0100 | [diff] [blame] | 251 | return ret; |
Gustavo Padovan | 43dbdad | 2015-06-01 12:04:41 -0300 | [diff] [blame] | 252 | } |
| 253 | |
| 254 | static void exynos_plane_atomic_update(struct drm_plane *plane, |
| 255 | struct drm_plane_state *old_state) |
| 256 | { |
| 257 | struct drm_plane_state *state = plane->state; |
Gustavo Padovan | d5f5223 | 2015-06-01 12:04:49 -0300 | [diff] [blame] | 258 | struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(state->crtc); |
| 259 | struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane); |
Gustavo Padovan | 43dbdad | 2015-06-01 12:04:41 -0300 | [diff] [blame] | 260 | |
| 261 | if (!state->crtc) |
| 262 | return; |
| 263 | |
Gustavo Padovan | 9cc7610 | 2015-08-03 14:38:05 +0900 | [diff] [blame] | 264 | if (exynos_crtc->ops->update_plane) |
Gustavo Padovan | 1e1d139 | 2015-08-03 14:39:36 +0900 | [diff] [blame] | 265 | exynos_crtc->ops->update_plane(exynos_crtc, exynos_plane); |
Gustavo Padovan | 43dbdad | 2015-06-01 12:04:41 -0300 | [diff] [blame] | 266 | } |
| 267 | |
Gustavo Padovan | b744868 | 2015-06-01 12:04:42 -0300 | [diff] [blame] | 268 | static void exynos_plane_atomic_disable(struct drm_plane *plane, |
| 269 | struct drm_plane_state *old_state) |
| 270 | { |
| 271 | struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane); |
| 272 | struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(old_state->crtc); |
| 273 | |
| 274 | if (!old_state->crtc) |
| 275 | return; |
| 276 | |
Gustavo Padovan | 9cc7610 | 2015-08-03 14:38:05 +0900 | [diff] [blame] | 277 | if (exynos_crtc->ops->disable_plane) |
Marek Szyprowski | 0114f40 | 2015-11-30 14:53:22 +0100 | [diff] [blame] | 278 | exynos_crtc->ops->disable_plane(exynos_crtc, exynos_plane); |
Gustavo Padovan | b744868 | 2015-06-01 12:04:42 -0300 | [diff] [blame] | 279 | } |
| 280 | |
Gustavo Padovan | 43dbdad | 2015-06-01 12:04:41 -0300 | [diff] [blame] | 281 | static const struct drm_plane_helper_funcs plane_helper_funcs = { |
| 282 | .atomic_check = exynos_plane_atomic_check, |
| 283 | .atomic_update = exynos_plane_atomic_update, |
Gustavo Padovan | b744868 | 2015-06-01 12:04:42 -0300 | [diff] [blame] | 284 | .atomic_disable = exynos_plane_atomic_disable, |
Gustavo Padovan | 43dbdad | 2015-06-01 12:04:41 -0300 | [diff] [blame] | 285 | }; |
| 286 | |
Gustavo Padovan | 6e2a3b6 | 2015-04-03 21:05:52 +0900 | [diff] [blame] | 287 | static void exynos_plane_attach_zpos_property(struct drm_plane *plane, |
Marek Szyprowski | e9dfe83 | 2018-05-23 12:15:50 +0200 | [diff] [blame] | 288 | int zpos, bool immutable) |
Joonyoung Shim | 00ae67c | 2012-06-27 14:27:06 +0900 | [diff] [blame] | 289 | { |
Marek Szyprowski | e47726a | 2016-05-11 17:16:06 +0200 | [diff] [blame] | 290 | if (immutable) |
Marek Szyprowski | e9dfe83 | 2018-05-23 12:15:50 +0200 | [diff] [blame] | 291 | drm_plane_create_zpos_immutable_property(plane, zpos); |
Marek Szyprowski | e47726a | 2016-05-11 17:16:06 +0200 | [diff] [blame] | 292 | else |
Marek Szyprowski | e9dfe83 | 2018-05-23 12:15:50 +0200 | [diff] [blame] | 293 | drm_plane_create_zpos_property(plane, zpos, 0, MAX_PLANE - 1); |
Joonyoung Shim | 00ae67c | 2012-06-27 14:27:06 +0900 | [diff] [blame] | 294 | } |
| 295 | |
Gustavo Padovan | 7ee14cd | 2015-04-03 21:03:40 +0900 | [diff] [blame] | 296 | int exynos_plane_init(struct drm_device *dev, |
Andrzej Hajda | 2c82607 | 2017-03-15 15:41:05 +0100 | [diff] [blame] | 297 | struct exynos_drm_plane *exynos_plane, unsigned int index, |
Marek Szyprowski | fd2d2fc | 2015-11-30 14:53:25 +0100 | [diff] [blame] | 298 | const struct exynos_drm_plane_config *config) |
Joonyoung Shim | 864ee9e | 2011-12-08 17:54:07 +0900 | [diff] [blame] | 299 | { |
Joonyoung Shim | b5d2eb3 | 2012-06-27 14:27:04 +0900 | [diff] [blame] | 300 | int err; |
Christoph Manszewski | 482582c | 2018-09-21 14:24:37 +0200 | [diff] [blame^] | 301 | unsigned int supported_modes = BIT(DRM_MODE_BLEND_PIXEL_NONE) | |
| 302 | BIT(DRM_MODE_BLEND_PREMULTI) | |
| 303 | BIT(DRM_MODE_BLEND_COVERAGE); |
| 304 | struct drm_plane *plane = &exynos_plane->base; |
Joonyoung Shim | 864ee9e | 2011-12-08 17:54:07 +0900 | [diff] [blame] | 305 | |
Marek Szyprowski | fd2d2fc | 2015-11-30 14:53:25 +0100 | [diff] [blame] | 306 | err = drm_universal_plane_init(dev, &exynos_plane->base, |
Andrzej Hajda | 2c82607 | 2017-03-15 15:41:05 +0100 | [diff] [blame] | 307 | 1 << dev->mode_config.num_crtc, |
Marek Szyprowski | fd2d2fc | 2015-11-30 14:53:25 +0100 | [diff] [blame] | 308 | &exynos_plane_funcs, |
| 309 | config->pixel_formats, |
| 310 | config->num_pixel_formats, |
Ben Widawsky | e6fc3b6 | 2017-07-23 20:46:38 -0700 | [diff] [blame] | 311 | NULL, config->type, NULL); |
Joonyoung Shim | b5d2eb3 | 2012-06-27 14:27:04 +0900 | [diff] [blame] | 312 | if (err) { |
| 313 | DRM_ERROR("failed to initialize plane\n"); |
Gustavo Padovan | 7ee14cd | 2015-04-03 21:03:40 +0900 | [diff] [blame] | 314 | return err; |
Joonyoung Shim | b5d2eb3 | 2012-06-27 14:27:04 +0900 | [diff] [blame] | 315 | } |
| 316 | |
Gustavo Padovan | 43dbdad | 2015-06-01 12:04:41 -0300 | [diff] [blame] | 317 | drm_plane_helper_add(&exynos_plane->base, &plane_helper_funcs); |
| 318 | |
Marek Szyprowski | 40bdfb0 | 2015-12-16 13:21:42 +0100 | [diff] [blame] | 319 | exynos_plane->index = index; |
Marek Szyprowski | fd2d2fc | 2015-11-30 14:53:25 +0100 | [diff] [blame] | 320 | exynos_plane->config = config; |
Gustavo Padovan | 6e2a3b6 | 2015-04-03 21:05:52 +0900 | [diff] [blame] | 321 | |
Marek Szyprowski | e9dfe83 | 2018-05-23 12:15:50 +0200 | [diff] [blame] | 322 | exynos_plane_attach_zpos_property(&exynos_plane->base, config->zpos, |
Marek Szyprowski | e47726a | 2016-05-11 17:16:06 +0200 | [diff] [blame] | 323 | !(config->capabilities & EXYNOS_DRM_PLANE_CAP_ZPOS)); |
Joonyoung Shim | 00ae67c | 2012-06-27 14:27:06 +0900 | [diff] [blame] | 324 | |
Christoph Manszewski | 482582c | 2018-09-21 14:24:37 +0200 | [diff] [blame^] | 325 | if (config->capabilities & EXYNOS_DRM_PLANE_CAP_PIX_BLEND) |
| 326 | drm_plane_create_blend_mode_property(plane, supported_modes); |
| 327 | |
Gustavo Padovan | 7ee14cd | 2015-04-03 21:03:40 +0900 | [diff] [blame] | 328 | return 0; |
Joonyoung Shim | 864ee9e | 2011-12-08 17:54:07 +0900 | [diff] [blame] | 329 | } |