Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'drm-rockchip-2015-07-13' of https://github.com/markyzq/kernel-drm-rockchip into drm-fixes

misc rockchip fixes.

* 'drm-rockchip-2015-07-13' of https://github.com/markyzq/kernel-drm-rockchip:
drm/rockchip: vop: remove hardware cursor window
drm/rockchip: vop: switch cursor plane to window 3
drm/rockchip: Drop owner assignment from platform_driver
drm/rockchip: use drm_gem_mmap helpers
drm/rockchip: only call drm_fb_helper_hotplug_event if fb_helper present
drm/rockchip: Add BGR formats to VOP

+38 -15
-1
drivers/gpu/drm/rockchip/rockchip_drm_drv.c
··· 555 555 .probe = rockchip_drm_platform_probe, 556 556 .remove = rockchip_drm_platform_remove, 557 557 .driver = { 558 - .owner = THIS_MODULE, 559 558 .name = "rockchip-drm", 560 559 .of_match_table = rockchip_drm_dt_ids, 561 560 .pm = &rockchip_drm_pm_ops,
+2 -1
drivers/gpu/drm/rockchip/rockchip_drm_fb.c
··· 162 162 struct rockchip_drm_private *private = dev->dev_private; 163 163 struct drm_fb_helper *fb_helper = &private->fbdev_helper; 164 164 165 - drm_fb_helper_hotplug_event(fb_helper); 165 + if (fb_helper) 166 + drm_fb_helper_hotplug_event(fb_helper); 166 167 } 167 168 168 169 static const struct drm_mode_config_funcs rockchip_drm_mode_config_funcs = {
+36 -13
drivers/gpu/drm/rockchip/rockchip_drm_vop.c
··· 170 170 171 171 struct vop_reg enable; 172 172 struct vop_reg format; 173 + struct vop_reg rb_swap; 173 174 struct vop_reg act_info; 174 175 struct vop_reg dsp_info; 175 176 struct vop_reg dsp_st; ··· 200 199 static const uint32_t formats_01[] = { 201 200 DRM_FORMAT_XRGB8888, 202 201 DRM_FORMAT_ARGB8888, 202 + DRM_FORMAT_XBGR8888, 203 + DRM_FORMAT_ABGR8888, 203 204 DRM_FORMAT_RGB888, 205 + DRM_FORMAT_BGR888, 204 206 DRM_FORMAT_RGB565, 207 + DRM_FORMAT_BGR565, 205 208 DRM_FORMAT_NV12, 206 209 DRM_FORMAT_NV16, 207 210 DRM_FORMAT_NV24, ··· 214 209 static const uint32_t formats_234[] = { 215 210 DRM_FORMAT_XRGB8888, 216 211 DRM_FORMAT_ARGB8888, 212 + DRM_FORMAT_XBGR8888, 213 + DRM_FORMAT_ABGR8888, 217 214 DRM_FORMAT_RGB888, 215 + DRM_FORMAT_BGR888, 218 216 DRM_FORMAT_RGB565, 217 + DRM_FORMAT_BGR565, 219 218 }; 220 219 221 220 static const struct vop_win_phy win01_data = { ··· 227 218 .nformats = ARRAY_SIZE(formats_01), 228 219 .enable = VOP_REG(WIN0_CTRL0, 0x1, 0), 229 220 .format = VOP_REG(WIN0_CTRL0, 0x7, 1), 221 + .rb_swap = VOP_REG(WIN0_CTRL0, 0x1, 12), 230 222 .act_info = VOP_REG(WIN0_ACT_INFO, 0x1fff1fff, 0), 231 223 .dsp_info = VOP_REG(WIN0_DSP_INFO, 0x0fff0fff, 0), 232 224 .dsp_st = VOP_REG(WIN0_DSP_ST, 0x1fff1fff, 0), ··· 244 234 .nformats = ARRAY_SIZE(formats_234), 245 235 .enable = VOP_REG(WIN2_CTRL0, 0x1, 0), 246 236 .format = VOP_REG(WIN2_CTRL0, 0x7, 1), 237 + .rb_swap = VOP_REG(WIN2_CTRL0, 0x1, 12), 247 238 .dsp_info = VOP_REG(WIN2_DSP_INFO0, 0x0fff0fff, 0), 248 239 .dsp_st = VOP_REG(WIN2_DSP_ST0, 0x1fff1fff, 0), 249 240 .yrgb_mst = VOP_REG(WIN2_MST0, 0xffffffff, 0), 250 241 .yrgb_vir = VOP_REG(WIN2_VIR0_1, 0x1fff, 0), 251 242 .src_alpha_ctl = VOP_REG(WIN2_SRC_ALPHA_CTRL, 0xff, 0), 252 243 .dst_alpha_ctl = VOP_REG(WIN2_DST_ALPHA_CTRL, 0xff, 0), 253 - }; 254 - 255 - static const struct vop_win_phy cursor_data = { 256 - .data_formats = formats_234, 257 - .nformats = ARRAY_SIZE(formats_234), 258 - .enable = VOP_REG(HWC_CTRL0, 0x1, 0), 259 - .format = VOP_REG(HWC_CTRL0, 0x7, 1), 260 - .dsp_st = VOP_REG(HWC_DSP_ST, 0x1fff1fff, 0), 261 - .yrgb_mst = VOP_REG(HWC_MST, 0xffffffff, 0), 262 244 }; 263 245 264 246 static const struct vop_ctrl ctrl_data = { ··· 284 282 /* 285 283 * Note: rk3288 has a dedicated 'cursor' window, however, that window requires 286 284 * special support to get alpha blending working. For now, just use overlay 287 - * window 1 for the drm cursor. 285 + * window 3 for the drm cursor. 286 + * 288 287 */ 289 288 static const struct vop_win_data rk3288_vop_win_data[] = { 290 289 { .base = 0x00, .phy = &win01_data, .type = DRM_PLANE_TYPE_PRIMARY }, 291 - { .base = 0x40, .phy = &win01_data, .type = DRM_PLANE_TYPE_CURSOR }, 290 + { .base = 0x40, .phy = &win01_data, .type = DRM_PLANE_TYPE_OVERLAY }, 292 291 { .base = 0x00, .phy = &win23_data, .type = DRM_PLANE_TYPE_OVERLAY }, 293 - { .base = 0x50, .phy = &win23_data, .type = DRM_PLANE_TYPE_OVERLAY }, 294 - { .base = 0x00, .phy = &cursor_data, .type = DRM_PLANE_TYPE_OVERLAY }, 292 + { .base = 0x50, .phy = &win23_data, .type = DRM_PLANE_TYPE_CURSOR }, 295 293 }; 296 294 297 295 static const struct vop_data rk3288_vop = { ··· 354 352 } 355 353 } 356 354 355 + static bool has_rb_swapped(uint32_t format) 356 + { 357 + switch (format) { 358 + case DRM_FORMAT_XBGR8888: 359 + case DRM_FORMAT_ABGR8888: 360 + case DRM_FORMAT_BGR888: 361 + case DRM_FORMAT_BGR565: 362 + return true; 363 + default: 364 + return false; 365 + } 366 + } 367 + 357 368 static enum vop_data_format vop_convert_format(uint32_t format) 358 369 { 359 370 switch (format) { 360 371 case DRM_FORMAT_XRGB8888: 361 372 case DRM_FORMAT_ARGB8888: 373 + case DRM_FORMAT_XBGR8888: 374 + case DRM_FORMAT_ABGR8888: 362 375 return VOP_FMT_ARGB8888; 363 376 case DRM_FORMAT_RGB888: 377 + case DRM_FORMAT_BGR888: 364 378 return VOP_FMT_RGB888; 365 379 case DRM_FORMAT_RGB565: 380 + case DRM_FORMAT_BGR565: 366 381 return VOP_FMT_RGB565; 367 382 case DRM_FORMAT_NV12: 368 383 return VOP_FMT_YUV420SP; ··· 397 378 { 398 379 switch (format) { 399 380 case DRM_FORMAT_ARGB8888: 381 + case DRM_FORMAT_ABGR8888: 400 382 return true; 401 383 default: 402 384 return false; ··· 608 588 enum vop_data_format format; 609 589 uint32_t val; 610 590 bool is_alpha; 591 + bool rb_swap; 611 592 bool visible; 612 593 int ret; 613 594 struct drm_rect dest = { ··· 642 621 return 0; 643 622 644 623 is_alpha = is_alpha_support(fb->pixel_format); 624 + rb_swap = has_rb_swapped(fb->pixel_format); 645 625 format = vop_convert_format(fb->pixel_format); 646 626 if (format < 0) 647 627 return format; ··· 711 689 val = (dsp_sty - 1) << 16; 712 690 val |= (dsp_stx - 1) & 0xffff; 713 691 VOP_WIN_SET(vop, win, dsp_st, val); 692 + VOP_WIN_SET(vop, win, rb_swap, rb_swap); 714 693 715 694 if (is_alpha) { 716 695 VOP_WIN_SET(vop, win, dst_alpha_ctl,