Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 15da0950 authored by Dave Airlie's avatar Dave Airlie
Browse files

Merge branch 'drm-armada-devel' of git://git.armlinux.org.uk/~rmk/linux-arm into drm-next



This set of changes migrates Armada DRM from legacy modeset to atomic
modeset.  This is everything from the "Transition Armada DRM planes to
atomic state" and "Finish Armada DRM transition to atomic modeset"
patch sets as posted on drm-devel, excluding the "Finish Armada DRM DT
support" series.

These series did not evoke any comments - if there are any, these can
be addressed via follow up patches.

Developed and tested on Dove Cubox with xf86-video-armada including the
overlay plane, and also tested with the tools in libdrm.

Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180730110543.GA30664@rmk-PC.armlinux.org.uk
parents f8f15c34 aa595c00
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0
# SPDX-License-Identifier: GPL-2.0
armada-y	:= armada_crtc.o armada_drv.o armada_fb.o armada_fbdev.o \
armada-y	:= armada_crtc.o armada_drv.o armada_fb.o armada_fbdev.o \
		   armada_gem.o armada_overlay.o armada_trace.o
		   armada_gem.o armada_overlay.o armada_plane.o armada_trace.o
armada-y	+= armada_510.o
armada-y	+= armada_510.o
armada-$(CONFIG_DEBUG_FS) += armada_debugfs.o
armada-$(CONFIG_DEBUG_FS) += armada_debugfs.o


+23 −1
Original line number Original line Diff line number Diff line
@@ -27,6 +27,10 @@ static int armada510_crtc_init(struct armada_crtc *dcrtc, struct device *dev)
	/* Lower the watermark so to eliminate jitter at higher bandwidths */
	/* Lower the watermark so to eliminate jitter at higher bandwidths */
	armada_updatel(0x20, (1 << 11) | 0xff, dcrtc->base + LCD_CFG_RDREG4F);
	armada_updatel(0x20, (1 << 11) | 0xff, dcrtc->base + LCD_CFG_RDREG4F);


	/* Initialise SPU register */
	writel_relaxed(ADV_HWC32ENABLE | ADV_HWC32ARGB | ADV_HWC32BLEND,
		       dcrtc->base + LCD_SPU_ADV_REG);

	return 0;
	return 0;
}
}


@@ -75,9 +79,27 @@ static int armada510_crtc_compute_clock(struct armada_crtc *dcrtc,
	return 0;
	return 0;
}
}


static void armada510_crtc_disable(struct armada_crtc *dcrtc)
{
	if (!IS_ERR(dcrtc->clk)) {
		clk_disable_unprepare(dcrtc->clk);
		dcrtc->clk = ERR_PTR(-EINVAL);
	}
}

static void armada510_crtc_enable(struct armada_crtc *dcrtc,
	const struct drm_display_mode *mode)
{
	if (IS_ERR(dcrtc->clk)) {
		dcrtc->clk = dcrtc->extclk[0];
		WARN_ON(clk_prepare_enable(dcrtc->clk));
	}
}

const struct armada_variant armada510_ops = {
const struct armada_variant armada510_ops = {
	.has_spu_adv_reg = true,
	.has_spu_adv_reg = true,
	.spu_adv_reg = ADV_HWC32ENABLE | ADV_HWC32ARGB | ADV_HWC32BLEND,
	.init = armada510_crtc_init,
	.init = armada510_crtc_init,
	.compute_clock = armada510_crtc_compute_clock,
	.compute_clock = armada510_crtc_compute_clock,
	.disable = armada510_crtc_disable,
	.enable = armada510_crtc_enable,
};
};
+165 −843

File changed.

Preview size limit exceeded, changes collapsed.

+6 −50
Original line number Original line Diff line number Diff line
@@ -32,49 +32,8 @@ struct armada_regs {
	armada_reg_queue_mod(_r, _i, 0, 0, ~0)
	armada_reg_queue_mod(_r, _i, 0, 0, ~0)


struct armada_crtc;
struct armada_crtc;
struct armada_plane;
struct armada_variant;
struct armada_variant;


struct armada_plane_work {
	void (*fn)(struct armada_crtc *, struct armada_plane_work *);
	void (*cancel)(struct armada_crtc *, struct armada_plane_work *);
	bool need_kfree;
	struct drm_plane *plane;
	struct drm_framebuffer *old_fb;
	struct drm_pending_vblank_event *event;
	struct armada_regs regs[14];
};

struct armada_plane_state {
	u16 src_x;
	u16 src_y;
	u32 src_hw;
	u32 dst_hw;
	u32 dst_yx;
	u32 ctrl0;
	bool changed;
	bool vsync_update;
};

struct armada_plane {
	struct drm_plane	base;
	wait_queue_head_t	frame_wait;
	bool			next_work;
	struct armada_plane_work works[2];
	struct armada_plane_work *work;
	struct armada_plane_state state;
};
#define drm_to_armada_plane(p) container_of(p, struct armada_plane, base)

int armada_drm_plane_init(struct armada_plane *plane);
int armada_drm_plane_work_queue(struct armada_crtc *dcrtc,
	struct armada_plane_work *work);
int armada_drm_plane_work_wait(struct armada_plane *plane, long timeout);
void armada_drm_plane_work_cancel(struct armada_crtc *dcrtc,
	struct armada_plane *plane);
void armada_drm_plane_calc_addrs(u32 *addrs, struct drm_framebuffer *fb,
	int x, int y);

struct armada_crtc {
struct armada_crtc {
	struct drm_crtc		crtc;
	struct drm_crtc		crtc;
	const struct armada_variant *variant;
	const struct armada_variant *variant;
@@ -89,10 +48,6 @@ struct armada_crtc {
	} v[2];
	} v[2];
	bool			interlaced;
	bool			interlaced;
	bool			cursor_update;
	bool			cursor_update;
	uint8_t			csc_yuv_mode;
	uint8_t			csc_rgb_mode;

	struct drm_plane	*plane;


	struct armada_gem_object	*cursor_obj;
	struct armada_gem_object	*cursor_obj;
	int			cursor_x;
	int			cursor_x;
@@ -102,21 +57,22 @@ struct armada_crtc {
	uint32_t		cursor_w;
	uint32_t		cursor_w;
	uint32_t		cursor_h;
	uint32_t		cursor_h;


	int			dpms;
	uint32_t		cfg_dumb_ctrl;
	uint32_t		cfg_dumb_ctrl;
	uint32_t		dumb_ctrl;
	uint32_t		spu_iopad_ctrl;
	uint32_t		spu_iopad_ctrl;


	spinlock_t		irq_lock;
	spinlock_t		irq_lock;
	uint32_t		irq_ena;
	uint32_t		irq_ena;

	bool			update_pending;
	struct drm_pending_vblank_event *event;
	struct armada_regs	atomic_regs[32];
	struct armada_regs	*regs;
	unsigned int		regs_idx;
};
};
#define drm_to_armada_crtc(c) container_of(c, struct armada_crtc, crtc)
#define drm_to_armada_crtc(c) container_of(c, struct armada_crtc, crtc)


void armada_drm_crtc_update_regs(struct armada_crtc *, struct armada_regs *);
void armada_drm_crtc_update_regs(struct armada_crtc *, struct armada_regs *);


int armada_drm_plane_disable(struct drm_plane *plane,
			     struct drm_modeset_acquire_ctx *ctx);

extern struct platform_driver armada_lcd_platform_driver;
extern struct platform_driver armada_lcd_platform_driver;


#endif
#endif
+2 −12
Original line number Original line Diff line number Diff line
@@ -42,11 +42,12 @@ struct armada_private;


struct armada_variant {
struct armada_variant {
	bool has_spu_adv_reg;
	bool has_spu_adv_reg;
	uint32_t spu_adv_reg;
	int (*init)(struct armada_crtc *, struct device *);
	int (*init)(struct armada_crtc *, struct device *);
	int (*compute_clock)(struct armada_crtc *,
	int (*compute_clock)(struct armada_crtc *,
			     const struct drm_display_mode *,
			     const struct drm_display_mode *,
			     uint32_t *);
			     uint32_t *);
	void (*disable)(struct armada_crtc *);
	void (*enable)(struct armada_crtc *, const struct drm_display_mode *);
};
};


/* Variant ops */
/* Variant ops */
@@ -54,14 +55,10 @@ extern const struct armada_variant armada510_ops;


struct armada_private {
struct armada_private {
	struct drm_device	drm;
	struct drm_device	drm;
	struct work_struct	fb_unref_work;
	DECLARE_KFIFO(fb_unref, struct drm_framebuffer *, 8);
	struct drm_fb_helper	*fbdev;
	struct drm_fb_helper	*fbdev;
	struct armada_crtc	*dcrtc[2];
	struct armada_crtc	*dcrtc[2];
	struct drm_mm		linear; /* protected by linear_lock */
	struct drm_mm		linear; /* protected by linear_lock */
	struct mutex		linear_lock;
	struct mutex		linear_lock;
	struct drm_property	*csc_yuv_prop;
	struct drm_property	*csc_rgb_prop;
	struct drm_property	*colorkey_prop;
	struct drm_property	*colorkey_prop;
	struct drm_property	*colorkey_min_prop;
	struct drm_property	*colorkey_min_prop;
	struct drm_property	*colorkey_max_prop;
	struct drm_property	*colorkey_max_prop;
@@ -76,13 +73,6 @@ struct armada_private {
#endif
#endif
};
};


void __armada_drm_queue_unref_work(struct drm_device *,
	struct drm_framebuffer *);
void armada_drm_queue_unref_work(struct drm_device *,
	struct drm_framebuffer *);

extern const struct drm_mode_config_funcs armada_drm_mode_config_funcs;

int armada_fbdev_init(struct drm_device *);
int armada_fbdev_init(struct drm_device *);
void armada_fbdev_fini(struct drm_device *);
void armada_fbdev_fini(struct drm_device *);


Loading