Skip to content

Commit aaab3bb

Browse files
committed
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
2 parents e1e50e1 + 0915da7 commit aaab3bb

File tree

3 files changed

+38
-15
lines changed

3 files changed

+38
-15
lines changed

drivers/gpu/drm/rockchip/rockchip_drm_drv.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,6 @@ static struct platform_driver rockchip_drm_platform_driver = {
555555
.probe = rockchip_drm_platform_probe,
556556
.remove = rockchip_drm_platform_remove,
557557
.driver = {
558-
.owner = THIS_MODULE,
559558
.name = "rockchip-drm",
560559
.of_match_table = rockchip_drm_dt_ids,
561560
.pm = &rockchip_drm_pm_ops,

drivers/gpu/drm/rockchip/rockchip_drm_fb.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@ static void rockchip_drm_output_poll_changed(struct drm_device *dev)
162162
struct rockchip_drm_private *private = dev->dev_private;
163163
struct drm_fb_helper *fb_helper = &private->fbdev_helper;
164164

165-
drm_fb_helper_hotplug_event(fb_helper);
165+
if (fb_helper)
166+
drm_fb_helper_hotplug_event(fb_helper);
166167
}
167168

168169
static const struct drm_mode_config_funcs rockchip_drm_mode_config_funcs = {

drivers/gpu/drm/rockchip/rockchip_drm_vop.c

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ struct vop_win_phy {
170170

171171
struct vop_reg enable;
172172
struct vop_reg format;
173+
struct vop_reg rb_swap;
173174
struct vop_reg act_info;
174175
struct vop_reg dsp_info;
175176
struct vop_reg dsp_st;
@@ -199,8 +200,12 @@ struct vop_data {
199200
static const uint32_t formats_01[] = {
200201
DRM_FORMAT_XRGB8888,
201202
DRM_FORMAT_ARGB8888,
203+
DRM_FORMAT_XBGR8888,
204+
DRM_FORMAT_ABGR8888,
202205
DRM_FORMAT_RGB888,
206+
DRM_FORMAT_BGR888,
203207
DRM_FORMAT_RGB565,
208+
DRM_FORMAT_BGR565,
204209
DRM_FORMAT_NV12,
205210
DRM_FORMAT_NV16,
206211
DRM_FORMAT_NV24,
@@ -209,15 +214,20 @@ static const uint32_t formats_01[] = {
209214
static const uint32_t formats_234[] = {
210215
DRM_FORMAT_XRGB8888,
211216
DRM_FORMAT_ARGB8888,
217+
DRM_FORMAT_XBGR8888,
218+
DRM_FORMAT_ABGR8888,
212219
DRM_FORMAT_RGB888,
220+
DRM_FORMAT_BGR888,
213221
DRM_FORMAT_RGB565,
222+
DRM_FORMAT_BGR565,
214223
};
215224

216225
static const struct vop_win_phy win01_data = {
217226
.data_formats = formats_01,
218227
.nformats = ARRAY_SIZE(formats_01),
219228
.enable = VOP_REG(WIN0_CTRL0, 0x1, 0),
220229
.format = VOP_REG(WIN0_CTRL0, 0x7, 1),
230+
.rb_swap = VOP_REG(WIN0_CTRL0, 0x1, 12),
221231
.act_info = VOP_REG(WIN0_ACT_INFO, 0x1fff1fff, 0),
222232
.dsp_info = VOP_REG(WIN0_DSP_INFO, 0x0fff0fff, 0),
223233
.dsp_st = VOP_REG(WIN0_DSP_ST, 0x1fff1fff, 0),
@@ -234,6 +244,7 @@ static const struct vop_win_phy win23_data = {
234244
.nformats = ARRAY_SIZE(formats_234),
235245
.enable = VOP_REG(WIN2_CTRL0, 0x1, 0),
236246
.format = VOP_REG(WIN2_CTRL0, 0x7, 1),
247+
.rb_swap = VOP_REG(WIN2_CTRL0, 0x1, 12),
237248
.dsp_info = VOP_REG(WIN2_DSP_INFO0, 0x0fff0fff, 0),
238249
.dsp_st = VOP_REG(WIN2_DSP_ST0, 0x1fff1fff, 0),
239250
.yrgb_mst = VOP_REG(WIN2_MST0, 0xffffffff, 0),
@@ -242,15 +253,6 @@ static const struct vop_win_phy win23_data = {
242253
.dst_alpha_ctl = VOP_REG(WIN2_DST_ALPHA_CTRL, 0xff, 0),
243254
};
244255

245-
static const struct vop_win_phy cursor_data = {
246-
.data_formats = formats_234,
247-
.nformats = ARRAY_SIZE(formats_234),
248-
.enable = VOP_REG(HWC_CTRL0, 0x1, 0),
249-
.format = VOP_REG(HWC_CTRL0, 0x7, 1),
250-
.dsp_st = VOP_REG(HWC_DSP_ST, 0x1fff1fff, 0),
251-
.yrgb_mst = VOP_REG(HWC_MST, 0xffffffff, 0),
252-
};
253-
254256
static const struct vop_ctrl ctrl_data = {
255257
.standby = VOP_REG(SYS_CTRL, 0x1, 22),
256258
.gate_en = VOP_REG(SYS_CTRL, 0x1, 23),
@@ -282,14 +284,14 @@ static const struct vop_reg_data vop_init_reg_table[] = {
282284
/*
283285
* Note: rk3288 has a dedicated 'cursor' window, however, that window requires
284286
* special support to get alpha blending working. For now, just use overlay
285-
* window 1 for the drm cursor.
287+
* window 3 for the drm cursor.
288+
*
286289
*/
287290
static const struct vop_win_data rk3288_vop_win_data[] = {
288291
{ .base = 0x00, .phy = &win01_data, .type = DRM_PLANE_TYPE_PRIMARY },
289-
{ .base = 0x40, .phy = &win01_data, .type = DRM_PLANE_TYPE_CURSOR },
292+
{ .base = 0x40, .phy = &win01_data, .type = DRM_PLANE_TYPE_OVERLAY },
290293
{ .base = 0x00, .phy = &win23_data, .type = DRM_PLANE_TYPE_OVERLAY },
291-
{ .base = 0x50, .phy = &win23_data, .type = DRM_PLANE_TYPE_OVERLAY },
292-
{ .base = 0x00, .phy = &cursor_data, .type = DRM_PLANE_TYPE_OVERLAY },
294+
{ .base = 0x50, .phy = &win23_data, .type = DRM_PLANE_TYPE_CURSOR },
293295
};
294296

295297
static const struct vop_data rk3288_vop = {
@@ -352,15 +354,32 @@ static inline void vop_mask_write_relaxed(struct vop *vop, uint32_t offset,
352354
}
353355
}
354356

357+
static bool has_rb_swapped(uint32_t format)
358+
{
359+
switch (format) {
360+
case DRM_FORMAT_XBGR8888:
361+
case DRM_FORMAT_ABGR8888:
362+
case DRM_FORMAT_BGR888:
363+
case DRM_FORMAT_BGR565:
364+
return true;
365+
default:
366+
return false;
367+
}
368+
}
369+
355370
static enum vop_data_format vop_convert_format(uint32_t format)
356371
{
357372
switch (format) {
358373
case DRM_FORMAT_XRGB8888:
359374
case DRM_FORMAT_ARGB8888:
375+
case DRM_FORMAT_XBGR8888:
376+
case DRM_FORMAT_ABGR8888:
360377
return VOP_FMT_ARGB8888;
361378
case DRM_FORMAT_RGB888:
379+
case DRM_FORMAT_BGR888:
362380
return VOP_FMT_RGB888;
363381
case DRM_FORMAT_RGB565:
382+
case DRM_FORMAT_BGR565:
364383
return VOP_FMT_RGB565;
365384
case DRM_FORMAT_NV12:
366385
return VOP_FMT_YUV420SP;
@@ -378,6 +397,7 @@ static bool is_alpha_support(uint32_t format)
378397
{
379398
switch (format) {
380399
case DRM_FORMAT_ARGB8888:
400+
case DRM_FORMAT_ABGR8888:
381401
return true;
382402
default:
383403
return false;
@@ -588,6 +608,7 @@ static int vop_update_plane_event(struct drm_plane *plane,
588608
enum vop_data_format format;
589609
uint32_t val;
590610
bool is_alpha;
611+
bool rb_swap;
591612
bool visible;
592613
int ret;
593614
struct drm_rect dest = {
@@ -621,6 +642,7 @@ static int vop_update_plane_event(struct drm_plane *plane,
621642
return 0;
622643

623644
is_alpha = is_alpha_support(fb->pixel_format);
645+
rb_swap = has_rb_swapped(fb->pixel_format);
624646
format = vop_convert_format(fb->pixel_format);
625647
if (format < 0)
626648
return format;
@@ -689,6 +711,7 @@ static int vop_update_plane_event(struct drm_plane *plane,
689711
val = (dsp_sty - 1) << 16;
690712
val |= (dsp_stx - 1) & 0xffff;
691713
VOP_WIN_SET(vop, win, dsp_st, val);
714+
VOP_WIN_SET(vop, win, rb_swap, rb_swap);
692715

693716
if (is_alpha) {
694717
VOP_WIN_SET(vop, win, dst_alpha_ctl,

0 commit comments

Comments
 (0)