diff options
author | Rodrigo Vivi <rodrigo.vivi@intel.com> | 2018-07-23 12:13:12 -0400 |
---|---|---|
committer | Rodrigo Vivi <rodrigo.vivi@intel.com> | 2018-07-23 12:13:12 -0400 |
commit | c74a7469f97c0f40b46e82ee979f9fb1bb6e847c (patch) | |
tree | f2690a1a916b73ef94657fbf0e0141ae57701825 /drivers/gpu/drm/i915/intel_sprite.c | |
parent | 6f15a7de86c8cf2dc09fc9e6d07047efa40ef809 (diff) | |
parent | 500775074f88d9cf5416bed2ca19592812d62c41 (diff) |
Merge drm/drm-next into drm-intel-next-queued
We need a backmerge to get DP_DPCD_REV_14 before we push other
i915 changes to dinq that could break compilation.
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_sprite.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_sprite.c | 291 |
1 files changed, 136 insertions, 155 deletions
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c index 3a4a26dd770f..f7026e887fa9 100644 --- a/drivers/gpu/drm/i915/intel_sprite.c +++ b/drivers/gpu/drm/i915/intel_sprite.c | |||
@@ -41,20 +41,6 @@ | |||
41 | #include <drm/i915_drm.h> | 41 | #include <drm/i915_drm.h> |
42 | #include "i915_drv.h" | 42 | #include "i915_drv.h" |
43 | 43 | ||
44 | bool intel_format_is_yuv(u32 format) | ||
45 | { | ||
46 | switch (format) { | ||
47 | case DRM_FORMAT_YUYV: | ||
48 | case DRM_FORMAT_UYVY: | ||
49 | case DRM_FORMAT_VYUY: | ||
50 | case DRM_FORMAT_YVYU: | ||
51 | case DRM_FORMAT_NV12: | ||
52 | return true; | ||
53 | default: | ||
54 | return false; | ||
55 | } | ||
56 | } | ||
57 | |||
58 | int intel_usecs_to_scanlines(const struct drm_display_mode *adjusted_mode, | 44 | int intel_usecs_to_scanlines(const struct drm_display_mode *adjusted_mode, |
59 | int usecs) | 45 | int usecs) |
60 | { | 46 | { |
@@ -416,7 +402,7 @@ chv_update_csc(const struct intel_plane_state *plane_state) | |||
416 | const s16 *csc = csc_matrix[plane_state->base.color_encoding]; | 402 | const s16 *csc = csc_matrix[plane_state->base.color_encoding]; |
417 | 403 | ||
418 | /* Seems RGB data bypasses the CSC always */ | 404 | /* Seems RGB data bypasses the CSC always */ |
419 | if (!intel_format_is_yuv(fb->format->format)) | 405 | if (!fb->format->is_yuv) |
420 | return; | 406 | return; |
421 | 407 | ||
422 | I915_WRITE_FW(SPCSCYGOFF(plane_id), SPCSC_OOFF(0) | SPCSC_IOFF(0)); | 408 | I915_WRITE_FW(SPCSCYGOFF(plane_id), SPCSC_OOFF(0) | SPCSC_IOFF(0)); |
@@ -451,7 +437,7 @@ vlv_update_clrc(const struct intel_plane_state *plane_state) | |||
451 | enum plane_id plane_id = plane->id; | 437 | enum plane_id plane_id = plane->id; |
452 | int contrast, brightness, sh_scale, sh_sin, sh_cos; | 438 | int contrast, brightness, sh_scale, sh_sin, sh_cos; |
453 | 439 | ||
454 | if (intel_format_is_yuv(fb->format->format) && | 440 | if (fb->format->is_yuv && |
455 | plane_state->base.color_range == DRM_COLOR_YCBCR_LIMITED_RANGE) { | 441 | plane_state->base.color_range == DRM_COLOR_YCBCR_LIMITED_RANGE) { |
456 | /* | 442 | /* |
457 | * Expand limited range to full range: | 443 | * Expand limited range to full range: |
@@ -978,22 +964,12 @@ intel_check_sprite_plane(struct intel_plane *plane, | |||
978 | struct drm_i915_private *dev_priv = to_i915(plane->base.dev); | 964 | struct drm_i915_private *dev_priv = to_i915(plane->base.dev); |
979 | struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc); | 965 | struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc); |
980 | struct drm_framebuffer *fb = state->base.fb; | 966 | struct drm_framebuffer *fb = state->base.fb; |
981 | int crtc_x, crtc_y; | ||
982 | unsigned int crtc_w, crtc_h; | ||
983 | uint32_t src_x, src_y, src_w, src_h; | ||
984 | struct drm_rect *src = &state->base.src; | ||
985 | struct drm_rect *dst = &state->base.dst; | ||
986 | struct drm_rect clip = {}; | ||
987 | int max_stride = INTEL_GEN(dev_priv) >= 9 ? 32768 : 16384; | 967 | int max_stride = INTEL_GEN(dev_priv) >= 9 ? 32768 : 16384; |
988 | int hscale, vscale; | ||
989 | int max_scale, min_scale; | 968 | int max_scale, min_scale; |
990 | bool can_scale; | 969 | bool can_scale; |
991 | int ret; | 970 | int ret; |
992 | uint32_t pixel_format = 0; | 971 | uint32_t pixel_format = 0; |
993 | 972 | ||
994 | *src = drm_plane_state_src(&state->base); | ||
995 | *dst = drm_plane_state_dest(&state->base); | ||
996 | |||
997 | if (!fb) { | 973 | if (!fb) { |
998 | state->base.visible = false; | 974 | state->base.visible = false; |
999 | return 0; | 975 | return 0; |
@@ -1032,64 +1008,19 @@ intel_check_sprite_plane(struct intel_plane *plane, | |||
1032 | min_scale = plane->can_scale ? 1 : (1 << 16); | 1008 | min_scale = plane->can_scale ? 1 : (1 << 16); |
1033 | } | 1009 | } |
1034 | 1010 | ||
1035 | /* | 1011 | ret = drm_atomic_helper_check_plane_state(&state->base, |
1036 | * FIXME the following code does a bunch of fuzzy adjustments to the | 1012 | &crtc_state->base, |
1037 | * coordinates and sizes. We probably need some way to decide whether | 1013 | min_scale, max_scale, |
1038 | * more strict checking should be done instead. | 1014 | true, true); |
1039 | */ | 1015 | if (ret) |
1040 | drm_rect_rotate(src, fb->width << 16, fb->height << 16, | 1016 | return ret; |
1041 | state->base.rotation); | ||
1042 | |||
1043 | hscale = drm_rect_calc_hscale_relaxed(src, dst, min_scale, max_scale); | ||
1044 | BUG_ON(hscale < 0); | ||
1045 | |||
1046 | vscale = drm_rect_calc_vscale_relaxed(src, dst, min_scale, max_scale); | ||
1047 | BUG_ON(vscale < 0); | ||
1048 | |||
1049 | if (crtc_state->base.enable) | ||
1050 | drm_mode_get_hv_timing(&crtc_state->base.mode, | ||
1051 | &clip.x2, &clip.y2); | ||
1052 | |||
1053 | state->base.visible = drm_rect_clip_scaled(src, dst, &clip, hscale, vscale); | ||
1054 | |||
1055 | crtc_x = dst->x1; | ||
1056 | crtc_y = dst->y1; | ||
1057 | crtc_w = drm_rect_width(dst); | ||
1058 | crtc_h = drm_rect_height(dst); | ||
1059 | 1017 | ||
1060 | if (state->base.visible) { | 1018 | if (state->base.visible) { |
1061 | /* check again in case clipping clamped the results */ | 1019 | struct drm_rect *src = &state->base.src; |
1062 | hscale = drm_rect_calc_hscale(src, dst, min_scale, max_scale); | 1020 | struct drm_rect *dst = &state->base.dst; |
1063 | if (hscale < 0) { | 1021 | unsigned int crtc_w = drm_rect_width(dst); |
1064 | DRM_DEBUG_KMS("Horizontal scaling factor out of limits\n"); | 1022 | unsigned int crtc_h = drm_rect_height(dst); |
1065 | drm_rect_debug_print("src: ", src, true); | 1023 | uint32_t src_x, src_y, src_w, src_h; |
1066 | drm_rect_debug_print("dst: ", dst, false); | ||
1067 | |||
1068 | return hscale; | ||
1069 | } | ||
1070 | |||
1071 | vscale = drm_rect_calc_vscale(src, dst, min_scale, max_scale); | ||
1072 | if (vscale < 0) { | ||
1073 | DRM_DEBUG_KMS("Vertical scaling factor out of limits\n"); | ||
1074 | drm_rect_debug_print("src: ", src, true); | ||
1075 | drm_rect_debug_print("dst: ", dst, false); | ||
1076 | |||
1077 | return vscale; | ||
1078 | } | ||
1079 | |||
1080 | /* Make the source viewport size an exact multiple of the scaling factors. */ | ||
1081 | drm_rect_adjust_size(src, | ||
1082 | drm_rect_width(dst) * hscale - drm_rect_width(src), | ||
1083 | drm_rect_height(dst) * vscale - drm_rect_height(src)); | ||
1084 | |||
1085 | drm_rect_rotate_inv(src, fb->width << 16, fb->height << 16, | ||
1086 | state->base.rotation); | ||
1087 | |||
1088 | /* sanity check to make sure the src viewport wasn't enlarged */ | ||
1089 | WARN_ON(src->x1 < (int) state->base.src_x || | ||
1090 | src->y1 < (int) state->base.src_y || | ||
1091 | src->x2 > (int) state->base.src_x + state->base.src_w || | ||
1092 | src->y2 > (int) state->base.src_y + state->base.src_h); | ||
1093 | 1024 | ||
1094 | /* | 1025 | /* |
1095 | * Hardware doesn't handle subpixel coordinates. | 1026 | * Hardware doesn't handle subpixel coordinates. |
@@ -1102,59 +1033,40 @@ intel_check_sprite_plane(struct intel_plane *plane, | |||
1102 | src_y = src->y1 >> 16; | 1033 | src_y = src->y1 >> 16; |
1103 | src_h = drm_rect_height(src) >> 16; | 1034 | src_h = drm_rect_height(src) >> 16; |
1104 | 1035 | ||
1105 | if (intel_format_is_yuv(fb->format->format) && | 1036 | src->x1 = src_x << 16; |
1106 | fb->format->format != DRM_FORMAT_NV12) { | 1037 | src->x2 = (src_x + src_w) << 16; |
1107 | src_x &= ~1; | 1038 | src->y1 = src_y << 16; |
1108 | src_w &= ~1; | 1039 | src->y2 = (src_y + src_h) << 16; |
1109 | |||
1110 | /* | ||
1111 | * Must keep src and dst the | ||
1112 | * same if we can't scale. | ||
1113 | */ | ||
1114 | if (!can_scale) | ||
1115 | crtc_w &= ~1; | ||
1116 | 1040 | ||
1117 | if (crtc_w == 0) | 1041 | if (fb->format->is_yuv && |
1118 | state->base.visible = false; | 1042 | fb->format->format != DRM_FORMAT_NV12 && |
1043 | (src_x % 2 || src_w % 2)) { | ||
1044 | DRM_DEBUG_KMS("src x/w (%u, %u) must be a multiple of 2 for YUV planes\n", | ||
1045 | src_x, src_w); | ||
1046 | return -EINVAL; | ||
1119 | } | 1047 | } |
1120 | } | ||
1121 | |||
1122 | /* Check size restrictions when scaling */ | ||
1123 | if (state->base.visible && (src_w != crtc_w || src_h != crtc_h)) { | ||
1124 | unsigned int width_bytes; | ||
1125 | int cpp = fb->format->cpp[0]; | ||
1126 | |||
1127 | WARN_ON(!can_scale); | ||
1128 | 1048 | ||
1129 | /* FIXME interlacing min height is 6 */ | 1049 | /* Check size restrictions when scaling */ |
1050 | if (src_w != crtc_w || src_h != crtc_h) { | ||
1051 | unsigned int width_bytes; | ||
1052 | int cpp = fb->format->cpp[0]; | ||
1130 | 1053 | ||
1131 | if (crtc_w < 3 || crtc_h < 3) | 1054 | WARN_ON(!can_scale); |
1132 | state->base.visible = false; | ||
1133 | 1055 | ||
1134 | if (src_w < 3 || src_h < 3) | 1056 | width_bytes = ((src_x * cpp) & 63) + src_w * cpp; |
1135 | state->base.visible = false; | ||
1136 | 1057 | ||
1137 | width_bytes = ((src_x * cpp) & 63) + src_w * cpp; | 1058 | /* FIXME interlacing min height is 6 */ |
1138 | 1059 | if (INTEL_GEN(dev_priv) < 9 && ( | |
1139 | if (INTEL_GEN(dev_priv) < 9 && (src_w > 2048 || src_h > 2048 || | 1060 | src_w < 3 || src_h < 3 || |
1140 | width_bytes > 4096 || fb->pitches[0] > 4096)) { | 1061 | src_w > 2048 || src_h > 2048 || |
1141 | DRM_DEBUG_KMS("Source dimensions exceed hardware limits\n"); | 1062 | crtc_w < 3 || crtc_h < 3 || |
1142 | return -EINVAL; | 1063 | width_bytes > 4096 || fb->pitches[0] > 4096)) { |
1064 | DRM_DEBUG_KMS("Source dimensions exceed hardware limits\n"); | ||
1065 | return -EINVAL; | ||
1066 | } | ||
1143 | } | 1067 | } |
1144 | } | 1068 | } |
1145 | 1069 | ||
1146 | if (state->base.visible) { | ||
1147 | src->x1 = src_x << 16; | ||
1148 | src->x2 = (src_x + src_w) << 16; | ||
1149 | src->y1 = src_y << 16; | ||
1150 | src->y2 = (src_y + src_h) << 16; | ||
1151 | } | ||
1152 | |||
1153 | dst->x1 = crtc_x; | ||
1154 | dst->x2 = crtc_x + crtc_w; | ||
1155 | dst->y1 = crtc_y; | ||
1156 | dst->y2 = crtc_y + crtc_h; | ||
1157 | |||
1158 | if (INTEL_GEN(dev_priv) >= 9) { | 1070 | if (INTEL_GEN(dev_priv) >= 9) { |
1159 | ret = skl_check_plane_surface(crtc_state, state); | 1071 | ret = skl_check_plane_surface(crtc_state, state); |
1160 | if (ret) | 1072 | if (ret) |
@@ -1385,8 +1297,17 @@ static const uint64_t skl_plane_format_modifiers_ccs[] = { | |||
1385 | DRM_FORMAT_MOD_INVALID | 1297 | DRM_FORMAT_MOD_INVALID |
1386 | }; | 1298 | }; |
1387 | 1299 | ||
1388 | static bool g4x_mod_supported(uint32_t format, uint64_t modifier) | 1300 | static bool g4x_sprite_format_mod_supported(struct drm_plane *_plane, |
1301 | u32 format, u64 modifier) | ||
1389 | { | 1302 | { |
1303 | switch (modifier) { | ||
1304 | case DRM_FORMAT_MOD_LINEAR: | ||
1305 | case I915_FORMAT_MOD_X_TILED: | ||
1306 | break; | ||
1307 | default: | ||
1308 | return false; | ||
1309 | } | ||
1310 | |||
1390 | switch (format) { | 1311 | switch (format) { |
1391 | case DRM_FORMAT_XRGB8888: | 1312 | case DRM_FORMAT_XRGB8888: |
1392 | case DRM_FORMAT_YUYV: | 1313 | case DRM_FORMAT_YUYV: |
@@ -1402,8 +1323,17 @@ static bool g4x_mod_supported(uint32_t format, uint64_t modifier) | |||
1402 | } | 1323 | } |
1403 | } | 1324 | } |
1404 | 1325 | ||
1405 | static bool snb_mod_supported(uint32_t format, uint64_t modifier) | 1326 | static bool snb_sprite_format_mod_supported(struct drm_plane *_plane, |
1327 | u32 format, u64 modifier) | ||
1406 | { | 1328 | { |
1329 | switch (modifier) { | ||
1330 | case DRM_FORMAT_MOD_LINEAR: | ||
1331 | case I915_FORMAT_MOD_X_TILED: | ||
1332 | break; | ||
1333 | default: | ||
1334 | return false; | ||
1335 | } | ||
1336 | |||
1407 | switch (format) { | 1337 | switch (format) { |
1408 | case DRM_FORMAT_XRGB8888: | 1338 | case DRM_FORMAT_XRGB8888: |
1409 | case DRM_FORMAT_XBGR8888: | 1339 | case DRM_FORMAT_XBGR8888: |
@@ -1420,8 +1350,17 @@ static bool snb_mod_supported(uint32_t format, uint64_t modifier) | |||
1420 | } | 1350 | } |
1421 | } | 1351 | } |
1422 | 1352 | ||
1423 | static bool vlv_mod_supported(uint32_t format, uint64_t modifier) | 1353 | static bool vlv_sprite_format_mod_supported(struct drm_plane *_plane, |
1354 | u32 format, u64 modifier) | ||
1424 | { | 1355 | { |
1356 | switch (modifier) { | ||
1357 | case DRM_FORMAT_MOD_LINEAR: | ||
1358 | case I915_FORMAT_MOD_X_TILED: | ||
1359 | break; | ||
1360 | default: | ||
1361 | return false; | ||
1362 | } | ||
1363 | |||
1425 | switch (format) { | 1364 | switch (format) { |
1426 | case DRM_FORMAT_RGB565: | 1365 | case DRM_FORMAT_RGB565: |
1427 | case DRM_FORMAT_ABGR8888: | 1366 | case DRM_FORMAT_ABGR8888: |
@@ -1443,8 +1382,26 @@ static bool vlv_mod_supported(uint32_t format, uint64_t modifier) | |||
1443 | } | 1382 | } |
1444 | } | 1383 | } |
1445 | 1384 | ||
1446 | static bool skl_mod_supported(uint32_t format, uint64_t modifier) | 1385 | static bool skl_plane_format_mod_supported(struct drm_plane *_plane, |
1386 | u32 format, u64 modifier) | ||
1447 | { | 1387 | { |
1388 | struct intel_plane *plane = to_intel_plane(_plane); | ||
1389 | |||
1390 | switch (modifier) { | ||
1391 | case DRM_FORMAT_MOD_LINEAR: | ||
1392 | case I915_FORMAT_MOD_X_TILED: | ||
1393 | case I915_FORMAT_MOD_Y_TILED: | ||
1394 | case I915_FORMAT_MOD_Yf_TILED: | ||
1395 | break; | ||
1396 | case I915_FORMAT_MOD_Y_TILED_CCS: | ||
1397 | case I915_FORMAT_MOD_Yf_TILED_CCS: | ||
1398 | if (!plane->has_ccs) | ||
1399 | return false; | ||
1400 | break; | ||
1401 | default: | ||
1402 | return false; | ||
1403 | } | ||
1404 | |||
1448 | switch (format) { | 1405 | switch (format) { |
1449 | case DRM_FORMAT_XRGB8888: | 1406 | case DRM_FORMAT_XRGB8888: |
1450 | case DRM_FORMAT_XBGR8888: | 1407 | case DRM_FORMAT_XBGR8888: |
@@ -1476,30 +1433,40 @@ static bool skl_mod_supported(uint32_t format, uint64_t modifier) | |||
1476 | } | 1433 | } |
1477 | } | 1434 | } |
1478 | 1435 | ||
1479 | static bool intel_sprite_plane_format_mod_supported(struct drm_plane *plane, | 1436 | static const struct drm_plane_funcs g4x_sprite_funcs = { |
1480 | uint32_t format, | 1437 | .update_plane = drm_atomic_helper_update_plane, |
1481 | uint64_t modifier) | 1438 | .disable_plane = drm_atomic_helper_disable_plane, |
1482 | { | 1439 | .destroy = intel_plane_destroy, |
1483 | struct drm_i915_private *dev_priv = to_i915(plane->dev); | 1440 | .atomic_get_property = intel_plane_atomic_get_property, |
1484 | 1441 | .atomic_set_property = intel_plane_atomic_set_property, | |
1485 | if (WARN_ON(modifier == DRM_FORMAT_MOD_INVALID)) | 1442 | .atomic_duplicate_state = intel_plane_duplicate_state, |
1486 | return false; | 1443 | .atomic_destroy_state = intel_plane_destroy_state, |
1444 | .format_mod_supported = g4x_sprite_format_mod_supported, | ||
1445 | }; | ||
1487 | 1446 | ||
1488 | if ((modifier >> 56) != DRM_FORMAT_MOD_VENDOR_INTEL && | 1447 | static const struct drm_plane_funcs snb_sprite_funcs = { |
1489 | modifier != DRM_FORMAT_MOD_LINEAR) | 1448 | .update_plane = drm_atomic_helper_update_plane, |
1490 | return false; | 1449 | .disable_plane = drm_atomic_helper_disable_plane, |
1450 | .destroy = intel_plane_destroy, | ||
1451 | .atomic_get_property = intel_plane_atomic_get_property, | ||
1452 | .atomic_set_property = intel_plane_atomic_set_property, | ||
1453 | .atomic_duplicate_state = intel_plane_duplicate_state, | ||
1454 | .atomic_destroy_state = intel_plane_destroy_state, | ||
1455 | .format_mod_supported = snb_sprite_format_mod_supported, | ||
1456 | }; | ||
1491 | 1457 | ||
1492 | if (INTEL_GEN(dev_priv) >= 9) | 1458 | static const struct drm_plane_funcs vlv_sprite_funcs = { |
1493 | return skl_mod_supported(format, modifier); | 1459 | .update_plane = drm_atomic_helper_update_plane, |
1494 | else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) | 1460 | .disable_plane = drm_atomic_helper_disable_plane, |
1495 | return vlv_mod_supported(format, modifier); | 1461 | .destroy = intel_plane_destroy, |
1496 | else if (INTEL_GEN(dev_priv) >= 6) | 1462 | .atomic_get_property = intel_plane_atomic_get_property, |
1497 | return snb_mod_supported(format, modifier); | 1463 | .atomic_set_property = intel_plane_atomic_set_property, |
1498 | else | 1464 | .atomic_duplicate_state = intel_plane_duplicate_state, |
1499 | return g4x_mod_supported(format, modifier); | 1465 | .atomic_destroy_state = intel_plane_destroy_state, |
1500 | } | 1466 | .format_mod_supported = vlv_sprite_format_mod_supported, |
1467 | }; | ||
1501 | 1468 | ||
1502 | static const struct drm_plane_funcs intel_sprite_plane_funcs = { | 1469 | static const struct drm_plane_funcs skl_plane_funcs = { |
1503 | .update_plane = drm_atomic_helper_update_plane, | 1470 | .update_plane = drm_atomic_helper_update_plane, |
1504 | .disable_plane = drm_atomic_helper_disable_plane, | 1471 | .disable_plane = drm_atomic_helper_disable_plane, |
1505 | .destroy = intel_plane_destroy, | 1472 | .destroy = intel_plane_destroy, |
@@ -1507,7 +1474,7 @@ static const struct drm_plane_funcs intel_sprite_plane_funcs = { | |||
1507 | .atomic_set_property = intel_plane_atomic_set_property, | 1474 | .atomic_set_property = intel_plane_atomic_set_property, |
1508 | .atomic_duplicate_state = intel_plane_duplicate_state, | 1475 | .atomic_duplicate_state = intel_plane_duplicate_state, |
1509 | .atomic_destroy_state = intel_plane_destroy_state, | 1476 | .atomic_destroy_state = intel_plane_destroy_state, |
1510 | .format_mod_supported = intel_sprite_plane_format_mod_supported, | 1477 | .format_mod_supported = skl_plane_format_mod_supported, |
1511 | }; | 1478 | }; |
1512 | 1479 | ||
1513 | bool skl_plane_has_ccs(struct drm_i915_private *dev_priv, | 1480 | bool skl_plane_has_ccs(struct drm_i915_private *dev_priv, |
@@ -1533,6 +1500,7 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv, | |||
1533 | { | 1500 | { |
1534 | struct intel_plane *intel_plane = NULL; | 1501 | struct intel_plane *intel_plane = NULL; |
1535 | struct intel_plane_state *state = NULL; | 1502 | struct intel_plane_state *state = NULL; |
1503 | const struct drm_plane_funcs *plane_funcs; | ||
1536 | unsigned long possible_crtcs; | 1504 | unsigned long possible_crtcs; |
1537 | const uint32_t *plane_formats; | 1505 | const uint32_t *plane_formats; |
1538 | const uint64_t *modifiers; | 1506 | const uint64_t *modifiers; |
@@ -1557,6 +1525,9 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv, | |||
1557 | intel_plane->can_scale = true; | 1525 | intel_plane->can_scale = true; |
1558 | state->scaler_id = -1; | 1526 | state->scaler_id = -1; |
1559 | 1527 | ||
1528 | intel_plane->has_ccs = skl_plane_has_ccs(dev_priv, pipe, | ||
1529 | PLANE_SPRITE0 + plane); | ||
1530 | |||
1560 | intel_plane->update_plane = skl_update_plane; | 1531 | intel_plane->update_plane = skl_update_plane; |
1561 | intel_plane->disable_plane = skl_disable_plane; | 1532 | intel_plane->disable_plane = skl_disable_plane; |
1562 | intel_plane->get_hw_state = skl_plane_get_hw_state; | 1533 | intel_plane->get_hw_state = skl_plane_get_hw_state; |
@@ -1570,10 +1541,12 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv, | |||
1570 | num_plane_formats = ARRAY_SIZE(skl_plane_formats); | 1541 | num_plane_formats = ARRAY_SIZE(skl_plane_formats); |
1571 | } | 1542 | } |
1572 | 1543 | ||
1573 | if (skl_plane_has_ccs(dev_priv, pipe, PLANE_SPRITE0 + plane)) | 1544 | if (intel_plane->has_ccs) |
1574 | modifiers = skl_plane_format_modifiers_ccs; | 1545 | modifiers = skl_plane_format_modifiers_ccs; |
1575 | else | 1546 | else |
1576 | modifiers = skl_plane_format_modifiers_noccs; | 1547 | modifiers = skl_plane_format_modifiers_noccs; |
1548 | |||
1549 | plane_funcs = &skl_plane_funcs; | ||
1577 | } else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) { | 1550 | } else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) { |
1578 | intel_plane->can_scale = false; | 1551 | intel_plane->can_scale = false; |
1579 | intel_plane->max_downscale = 1; | 1552 | intel_plane->max_downscale = 1; |
@@ -1585,6 +1558,8 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv, | |||
1585 | plane_formats = vlv_plane_formats; | 1558 | plane_formats = vlv_plane_formats; |
1586 | num_plane_formats = ARRAY_SIZE(vlv_plane_formats); | 1559 | num_plane_formats = ARRAY_SIZE(vlv_plane_formats); |
1587 | modifiers = i9xx_plane_format_modifiers; | 1560 | modifiers = i9xx_plane_format_modifiers; |
1561 | |||
1562 | plane_funcs = &vlv_sprite_funcs; | ||
1588 | } else if (INTEL_GEN(dev_priv) >= 7) { | 1563 | } else if (INTEL_GEN(dev_priv) >= 7) { |
1589 | if (IS_IVYBRIDGE(dev_priv)) { | 1564 | if (IS_IVYBRIDGE(dev_priv)) { |
1590 | intel_plane->can_scale = true; | 1565 | intel_plane->can_scale = true; |
@@ -1601,6 +1576,8 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv, | |||
1601 | plane_formats = snb_plane_formats; | 1576 | plane_formats = snb_plane_formats; |
1602 | num_plane_formats = ARRAY_SIZE(snb_plane_formats); | 1577 | num_plane_formats = ARRAY_SIZE(snb_plane_formats); |
1603 | modifiers = i9xx_plane_format_modifiers; | 1578 | modifiers = i9xx_plane_format_modifiers; |
1579 | |||
1580 | plane_funcs = &snb_sprite_funcs; | ||
1604 | } else { | 1581 | } else { |
1605 | intel_plane->can_scale = true; | 1582 | intel_plane->can_scale = true; |
1606 | intel_plane->max_downscale = 16; | 1583 | intel_plane->max_downscale = 16; |
@@ -1613,9 +1590,13 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv, | |||
1613 | if (IS_GEN6(dev_priv)) { | 1590 | if (IS_GEN6(dev_priv)) { |
1614 | plane_formats = snb_plane_formats; | 1591 | plane_formats = snb_plane_formats; |
1615 | num_plane_formats = ARRAY_SIZE(snb_plane_formats); | 1592 | num_plane_formats = ARRAY_SIZE(snb_plane_formats); |
1593 | |||
1594 | plane_funcs = &snb_sprite_funcs; | ||
1616 | } else { | 1595 | } else { |
1617 | plane_formats = g4x_plane_formats; | 1596 | plane_formats = g4x_plane_formats; |
1618 | num_plane_formats = ARRAY_SIZE(g4x_plane_formats); | 1597 | num_plane_formats = ARRAY_SIZE(g4x_plane_formats); |
1598 | |||
1599 | plane_funcs = &g4x_sprite_funcs; | ||
1619 | } | 1600 | } |
1620 | } | 1601 | } |
1621 | 1602 | ||
@@ -1642,14 +1623,14 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv, | |||
1642 | 1623 | ||
1643 | if (INTEL_GEN(dev_priv) >= 9) | 1624 | if (INTEL_GEN(dev_priv) >= 9) |
1644 | ret = drm_universal_plane_init(&dev_priv->drm, &intel_plane->base, | 1625 | ret = drm_universal_plane_init(&dev_priv->drm, &intel_plane->base, |
1645 | possible_crtcs, &intel_sprite_plane_funcs, | 1626 | possible_crtcs, plane_funcs, |
1646 | plane_formats, num_plane_formats, | 1627 | plane_formats, num_plane_formats, |
1647 | modifiers, | 1628 | modifiers, |
1648 | DRM_PLANE_TYPE_OVERLAY, | 1629 | DRM_PLANE_TYPE_OVERLAY, |
1649 | "plane %d%c", plane + 2, pipe_name(pipe)); | 1630 | "plane %d%c", plane + 2, pipe_name(pipe)); |
1650 | else | 1631 | else |
1651 | ret = drm_universal_plane_init(&dev_priv->drm, &intel_plane->base, | 1632 | ret = drm_universal_plane_init(&dev_priv->drm, &intel_plane->base, |
1652 | possible_crtcs, &intel_sprite_plane_funcs, | 1633 | possible_crtcs, plane_funcs, |
1653 | plane_formats, num_plane_formats, | 1634 | plane_formats, num_plane_formats, |
1654 | modifiers, | 1635 | modifiers, |
1655 | DRM_PLANE_TYPE_OVERLAY, | 1636 | DRM_PLANE_TYPE_OVERLAY, |