Armada DRM updates for 4.10
Subsystems (2)
Russell King - ARM Linux
maintainercover Armada DRM updates for 4.10
This series is for review only - I'll be submitting a pull request to David in due course.
These patches are based on the TDA998x MALI patch, removing the drm_connector_register() call, and:
* Add tracing support for overlay usage, so it's possible to use tracing to monitor how well we hit the frame display times.
* plane support updates which came about due to my initial investigations into converting Armada to atomic mode set. These are mostly just mechanical changes rather than anything in-depth.
* de-midlayering Armada, now that TDA998x allows for this.
drivers/gpu/drm/armada/Makefile | 2 +- drivers/gpu/drm/armada/armada_crtc.c | 121 ++++++++++------ drivers/gpu/drm/armada/armada_crtc.h | 10 ++ drivers/gpu/drm/armada/armada_drm.h | 1 + drivers/gpu/drm/armada/armada_drv.c | 236 +++++++++++++++++--------------- drivers/gpu/drm/armada/armada_overlay.c | 65 +++++---- drivers/gpu/drm/armada/armada_trace.c | 4 + drivers/gpu/drm/armada/armada_trace.h | 66 +++++++++ 8 files changed, 321 insertions(+), 184 deletions(-) create mode 100644 drivers/gpu/drm/armada/armada_trace.c create mode 100644 drivers/gpu/drm/armada/armada_trace.h
Signature · 7 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net. _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
RFC PATCH 1/7 drm/armada: add tracing support
Add tracing support to the Armada video overlay and interrupt code.
--- drivers/gpu/drm/armada/Makefile | 2 +- drivers/gpu/drm/armada/armada_crtc.c | 3 ++ drivers/gpu/drm/armada/armada_overlay.c | 7 ++++ drivers/gpu/drm/armada/armada_trace.c | 4 ++ drivers/gpu/drm/armada/armada_trace.h | 66 +++++++++++++++++++++++++++++++++ 5 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/armada/armada_trace.c create mode 100644 drivers/gpu/drm/armada/armada_trace.h
drivers/gpu/drm/armada/Makefile +1 -1
@@ -1,5 +1,5 @@ armada-y := armada_crtc.o armada_drv.o armada_fb.o armada_fbdev.o \ - armada_gem.o armada_overlay.o + armada_gem.o armada_overlay.o armada_trace.o armada-y += armada_510.o armada-$(CONFIG_DEBUG_FS) += armada_debugfs.o
drivers/gpu/drm/armada/armada_crtc.c +3 -0
@@ -18,6 +18,7 @@#include "armada_fb.h" #include "armada_gem.h" #include "armada_hw.h" +#include "armada_trace.h" struct armada_frame_work {struct armada_plane_work work;
@@ -464,6 +465,8 @@ static irqreturn_t armada_drm_irq(int irq, void *arg)*/ writel_relaxed (0 , dcrtc->base +LCD_SPU_IRQ_ISR ); +trace_armada_drm_irq (&dcrtc->crtc, stat); +/* Mask out those interrupts we haven't enabled */ v = stat & dcrtc->irq_ena;
drivers/gpu/drm/armada/armada_overlay.c +7 -0
@@ -15,6 +15,7 @@#include "armada_hw.h" #include <drm/armada_drm.h> #include "armada_ioctlP.h" +#include "armada_trace.h" struct armada_ovl_plane_properties {uint32_t colorkey_yr;
@@ -87,6 +88,8 @@ static void armada_ovl_plane_work(struct armada_crtc *dcrtc, { struct armada_ovl_plane *dplane = container_of(plane, struct armada_ovl_plane, base); +trace_armada_ovl_plane_work (&dcrtc->crtc, &plane->base); +armada_drm_crtc_update_regs (dcrtc, dplane->vbl.regs);armada_ovl_retire_fb (dplane,NULL ); }
@@ -120,6 +123,10 @@ armada_ovl_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,bool visible;int ret; +trace_armada_ovl_plane_update (plane, crtc, fb, + crtc_x, crtc_y, crtc_w, crtc_h, + src_x, src_y, src_w, src_h); + ret =drm_plane_helper_check_update (plane, crtc, fb, &src, &dest, &clip,BIT (DRM_ROTATE_0 ),0 ,INT_MAX , true, false, &visible);
drivers/gpu/drm/armada/armada_trace.c new file +4 -0
@@ -0,0 +1,4 @@ +#ifndef __CHECKER__ +#define CREATE_TRACE_POINTS +#include "armada_trace.h" +#endif
drivers/gpu/drm/armada/armada_trace.h new file +66 -0
66 lines not on this page · raw message
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH RFC 1/7] drm/armada: add tracing support
Hi Russell
I need the below fixup to make this build for me:
drivers/gpu/drm/armada/Makefile +2 -0
@@ -4,3 +4,5 @@ armada-y += armada_510.o armada-$(CONFIG_DEBUG_FS) += armada_debugfs.o obj-$(CONFIG_DRM_ARMADA) := armada.o + +CFLAGS_armada_trace.o := -I$(src)
Otherwise it fails with
CC [M] drivers/gpu/drm/armada/armada_trace.o
In file included from drivers/gpu/drm/armada/armada_trace.h:66:0,
from drivers/gpu/drm/armada/armada_trace.c:3:./include/trace/define_trace.h:88:43: fatal error: ./armada_trace.h:
No such file or directory
#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
^I've disabeld armada for now in the drm-misc defconfigs we use to build-test drm-misc patches (since I can't push stuff right now).
Cheers, Daniel
Quoted 166 lines · Russell King
Add tracing support to the Armada video overlay and interrupt code.
Signed-off-by Russell King <[email protected]>--- drivers/gpu/drm/armada/Makefile | 2 +- drivers/gpu/drm/armada/armada_crtc.c | 3 ++ drivers/gpu/drm/armada/armada_overlay.c | 7 ++++ drivers/gpu/drm/armada/armada_trace.c | 4 ++ drivers/gpu/drm/armada/armada_trace.h | 66 +++++++++++++++++++++++++++++++++ 5 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/armada/armada_trace.c create mode 100644 drivers/gpu/drm/armada/armada_trace.hdrivers/gpu/drm/armada/Makefile +1
-1@@ -1,5 +1,5 @@ armada-y := armada_crtc.o armada_drv.o armada_fb.o armada_fbdev.o \ - armada_gem.o armada_overlay.o + armada_gem.o armada_overlay.o armada_trace.o armada-y += armada_510.o armada-$(CONFIG_DEBUG_FS) += armada_debugfs.odrivers/gpu/drm/armada/armada_crtc.c +3
-0@@ -18,6 +18,7 @@#include "armada_fb.h" #include "armada_gem.h" #include "armada_hw.h" +#include "armada_trace.h" struct armada_frame_work {struct armada_plane_work work;@@ -464,6 +465,8 @@ static irqreturn_t armada_drm_irq(int irq, void *arg)*/ writel_relaxed (0 , dcrtc->base +LCD_SPU_IRQ_ISR ); +trace_armada_drm_irq (&dcrtc->crtc, stat); +/* Mask out those interrupts we haven't enabled */ v = stat & dcrtc->irq_ena;drivers/gpu/drm/armada/armada_overlay.c +7
-0@@ -15,6 +15,7 @@#include "armada_hw.h" #include <drm/armada_drm.h> #include "armada_ioctlP.h" +#include "armada_trace.h" struct armada_ovl_plane_properties {uint32_t colorkey_yr;@@ -87,6 +88,8 @@ static void armada_ovl_plane_work(struct armada_crtc *dcrtc, { struct armada_ovl_plane *dplane = container_of(plane, struct armada_ovl_plane, base); +trace_armada_ovl_plane_work (&dcrtc->crtc, &plane->base); +armada_drm_crtc_update_regs (dcrtc, dplane->vbl.regs);armada_ovl_retire_fb (dplane,NULL ); }@@ -120,6 +123,10 @@ armada_ovl_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,bool visible;int ret; +trace_armada_ovl_plane_update (plane, crtc, fb, + crtc_x, crtc_y, crtc_w, crtc_h, + src_x, src_y, src_w, src_h); + ret =drm_plane_helper_check_update (plane, crtc, fb, &src, &dest, &clip,BIT (DRM_ROTATE_0 ),0 ,INT_MAX , true, false, &visible);drivers/gpu/drm/armada/armada_trace.c new file +4
-0@@ -0,0 +1,4 @@ +#ifndef __CHECKER__ +#define CREATE_TRACE_POINTS +#include "armada_trace.h" +#endif drivers/gpu/drm/armada/armada_trace.h new file +66
-1@@ -0,0 +1,66 @@ +#if !defined(ARMADA_TRACE_H ) || defined(TRACE_HEADER_MULTI_READ ) +#define ARMADA_TRACE_H + +#include <linux/tracepoint.h> +#include <drm/drmP.h> + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM armada +#define TRACE_INCLUDE_FILE armada_trace + +TRACE_EVENT (armada_drm_irq, + TP_PROTO(struct drm_crtc *crtc, u32 stat), +TP_ARGS (crtc, stat), +TP_STRUCT__entry ( + __field(struct drm_crtc *, crtc) +__field (u32, stat) + ), +TP_fast_assign ( + __entry->crtc = crtc; + __entry->stat = stat; + ), +TP_printk ("crtc %p stat 0x%08x" , + __entry->crtc, __entry->stat) +); + +TRACE_EVENT (armada_ovl_plane_update, + TP_PROTO(struct drm_plane *plane, struct drm_crtc *crtc, + struct drm_framebuffer *fb, + int crtc_x, int crtc_y, unsigned crtc_w, unsigned crtc_h, + uint32_t src_x, uint32_t src_y, uint32_t src_w, uint32_t src_h), +TP_ARGS (plane, crtc, fb, crtc_x, crtc_y, crtc_w, crtc_h, src_x, src_y, src_w, src_h), +TP_STRUCT__entry ( + __field(struct drm_plane *, plane) + __field(struct drm_crtc *, crtc) + __field(struct drm_framebuffer *, fb) + ), +TP_fast_assign ( + __entry->plane = plane; + __entry->crtc = crtc; + __entry->fb = fb; + ), +TP_printk ("plane %p crtc %p fb %p" , + __entry->plane, __entry->crtc, __entry->fb) +); + +TRACE_EVENT (armada_ovl_plane_work, + TP_PROTO(struct drm_crtc *crtc, struct drm_plane *plane), +TP_ARGS (crtc, plane), +TP_STRUCT__entry ( + __field(struct drm_plane *, plane) + __field(struct drm_crtc *, crtc) + ), +TP_fast_assign ( + __entry->plane = plane; + __entry->crtc = crtc; + ), +TP_printk ("plane %p crtc %p" , + __entry->plane, __entry->crtc) +); + +#endif + +/* This part must be outside protection */ +#undef TRACE_INCLUDE_PATH +#define TRACE_INCLUDE_PATH . +#include <trace/define_trace.h> --2.7.4
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
RFC PATCH 2/7 drm/armada: clean up armada_drm_plane_work_run()
In reply to Russell King - ARM LinuxMake armada_drm_plane_work_run() take the drm_plane pointer rather than our private pointer. This allows us to localise the conversion between these two pointers inside armada_drm_plane_work_run(), rather than at every call site.
--- drivers/gpu/drm/armada/armada_crtc.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-)
drivers/gpu/drm/armada/armada_crtc.c +11 -16
@@ -193,17 +193,18 @@ static unsigned armada_drm_crtc_calc_fb(struct drm_framebuffer *fb, }static void armada_drm_plane_work_run (struct armada_crtc *dcrtc, -struct armada_plane *plane) +struct drm_plane *plane) { -struct armada_plane_work *work =xchg (&plane->work,NULL ); +struct armada_plane *dplane =drm_to_armada_plane (plane); +struct armada_plane_work *work =xchg (&dplane->work,NULL );/* Handle any pending frame work. */ if (work) { - work->fn (dcrtc, plane, work); + work->fn (dcrtc, dplane, work);drm_crtc_vblank_put (&dcrtc->crtc); } -wake_up (&plane->frame_wait); +wake_up (&dplane->frame_wait); } int armada_drm_plane_work_queue(struct armada_crtc *dcrtc,
@@ -308,14 +309,12 @@ static void armada_drm_crtc_finish_fb(struct armada_crtc *dcrtc,static void armada_drm_vblank_off (struct armada_crtc *dcrtc) { -struct armada_plane *plane =drm_to_armada_plane (dcrtc->crtc.primary); -/* * Tell the DRM core that vblank IRQs aren't going to happen for * a while. This cleans up any pending vblank events for us. */ drm_crtc_vblank_off (&dcrtc->crtc); -armada_drm_plane_work_run (dcrtc, plane); +armada_drm_plane_work_run (dcrtc, dcrtc->crtc.primary); } void armada_drm_crtc_gamma_set(struct drm_crtc *crtc, u16 r, u16 g, u16 b,
@@ -415,10 +414,8 @@ static void armada_drm_crtc_irq(struct armada_crtc *dcrtc, u32 stat)spin_lock (&dcrtc->irq_lock); ovl_plane = dcrtc->plane; -if (ovl_plane) { -struct armada_plane *plane =drm_to_armada_plane (ovl_plane); -armada_drm_plane_work_run (dcrtc, plane); - } +if (ovl_plane) +armada_drm_plane_work_run (dcrtc, ovl_plane);if (stat &GRA_FRAME_IRQ && dcrtc->interlaced) {int i = stat &GRA_FRAME_IRQ0 ?0 :1 ;
@@ -448,10 +445,8 @@ static void armada_drm_crtc_irq(struct armada_crtc *dcrtc, u32 stat)spin_unlock (&dcrtc->irq_lock); -if (stat &GRA_FRAME_IRQ ) { -struct armada_plane *plane =drm_to_armada_plane (dcrtc->crtc.primary); -armada_drm_plane_work_run (dcrtc, plane); - } +if (stat &GRA_FRAME_IRQ ) +armada_drm_plane_work_run (dcrtc, dcrtc->crtc.primary); }static irqreturn_t armada_drm_irq (int irq,void *arg)
@@ -1039,7 +1034,7 @@ static int armada_drm_crtc_page_flip(struct drm_crtc *crtc,* interrupt, so complete it now. */ if (dpms_blanked (dcrtc->dpms)) -armada_drm_plane_work_run (dcrtc,drm_to_armada_plane (dcrtc->crtc.primary)); +armada_drm_plane_work_run (dcrtc, dcrtc->crtc.primary);return 0 ; }
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
RFC PATCH 3/7 drm/armada: move plane state to struct armada_plane
In reply to Russell King - ARM LinuxMove more of the Armada plane state (source size, and displayed size and position) into a state structure inside struct armada_plane.
--- drivers/gpu/drm/armada/armada_crtc.c | 29 ++++++++++++++++++++--------- drivers/gpu/drm/armada/armada_crtc.h | 8 ++++++++ drivers/gpu/drm/armada/armada_overlay.c | 32 ++++++++++++++------------------ 3 files changed, 42 insertions(+), 27 deletions(-)
drivers/gpu/drm/armada/armada_crtc.c +20 -9
@@ -543,6 +543,19 @@ static int armada_drm_crtc_mode_set(struct drm_crtc *crtc, interlaced = !!(adj->flags &DRM_MODE_FLAG_INTERLACE ); + val =CFG_GRA_ENA |CFG_GRA_HSMOOTH ; + val |=CFG_GRA_FMT (drm_fb_to_armada_fb (dcrtc->crtc.primary->fb)->fmt); + val |=CFG_GRA_MOD (drm_fb_to_armada_fb (dcrtc->crtc.primary->fb)->mod); + +if (drm_fb_to_armada_fb (dcrtc->crtc.primary->fb)->fmt >CFG_420 ) + val |=CFG_PALETTE_ENA ; + +drm_to_armada_plane (crtc->primary)->state.ctrl0 = val; +drm_to_armada_plane (crtc->primary)->state.src_hw = +drm_to_armada_plane (crtc->primary)->state.dst_hw = + adj->crtc_hdisplay <<16 | adj->crtc_vdisplay; +drm_to_armada_plane (crtc->primary)->state.dst_yx =0 ; + i =armada_drm_crtc_calc_fb (dcrtc->crtc.primary->fb, x, y, regs, interlaced);
@@ -621,8 +634,12 @@ static int armada_drm_crtc_mode_set(struct drm_crtc *crtc, val = adj->crtc_vdisplay <<16 | adj->crtc_hdisplay;armada_reg_queue_set (regs, i, val,LCD_SPU_V_H_ACTIVE ); -armada_reg_queue_set (regs, i, val,LCD_SPU_GRA_HPXL_VLN ); -armada_reg_queue_set (regs, i, val,LCD_SPU_GZM_HPXL_VLN ); +armada_reg_queue_set (regs, i, +drm_to_armada_plane (crtc->primary)->state.src_hw, +LCD_SPU_GRA_HPXL_VLN ); +armada_reg_queue_set (regs, i, +drm_to_armada_plane (crtc->primary)->state.dst_hw, +LCD_SPU_GZM_HPXL_VLN );armada_reg_queue_set (regs, i, (lm <<16 ) | rm,LCD_SPU_H_PORCH );armada_reg_queue_set (regs, i, dcrtc->v[0 ].spu_v_porch,LCD_SPU_V_PORCH ); armada_reg_queue_set(regs, i, dcrtc->v[0].spu_v_h_total,
@@ -634,13 +651,7 @@ static int armada_drm_crtc_mode_set(struct drm_crtc *crtc, ADV_VSYNCOFFEN, LCD_SPU_ADV_REG); } - val =CFG_GRA_ENA |CFG_GRA_HSMOOTH ; - val |=CFG_GRA_FMT (drm_fb_to_armada_fb (dcrtc->crtc.primary->fb)->fmt); - val |=CFG_GRA_MOD (drm_fb_to_armada_fb (dcrtc->crtc.primary->fb)->mod); - -if (drm_fb_to_armada_fb (dcrtc->crtc.primary->fb)->fmt >CFG_420 ) - val |=CFG_PALETTE_ENA ; - + val =drm_to_armada_plane (crtc->primary)->state.ctrl0;if (interlaced) val |=CFG_GRA_FTOGGLE ;
drivers/gpu/drm/armada/armada_crtc.h +8 -0
@@ -41,10 +41,18 @@ struct armada_plane_work { struct armada_plane_work *); }; +struct armada_plane_state { +u32 src_hw; +u32 dst_hw; +u32 dst_yx; +u32 ctrl0; +}; +struct armada_plane {struct drm_plane base;wait_queue_head_t frame_wait;struct armada_plane_work *work; +struct armada_plane_state state; };#define drm_to_armada_plane (p) container_of(p, struct armada_plane, base)
drivers/gpu/drm/armada/armada_overlay.c +14 -18
@@ -33,10 +33,6 @@ struct armada_ovl_plane_properties {struct armada_ovl_plane {struct armada_plane base;struct drm_framebuffer *old_fb; -uint32_t src_hw; -uint32_t dst_hw; -uint32_t dst_yx; -uint32_t ctrl0;struct {struct armada_plane_work work;struct armada_regs regs[13 ];
@@ -148,22 +144,22 @@ armada_ovl_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,/* FIXME: overlay on an interlaced display */ /* Just updating the position/size? */ -if (plane->fb == fb && dplane->ctrl0 == ctrl0) { +if (plane->fb == fb && dplane->base.state.ctrl0 == ctrl0) { val = (drm_rect_height (&src) &0xffff0000 ) |drm_rect_width (&src) >>16 ; - dplane->src_hw = val; + dplane->base.state.src_hw = val;writel_relaxed (val, dcrtc->base +LCD_SPU_DMA_HPXL_VLN ); val =drm_rect_height (&dest) <<16 |drm_rect_width (&dest); - dplane->dst_hw = val; + dplane->base.state.dst_hw = val;writel_relaxed (val, dcrtc->base +LCD_SPU_DZM_HPXL_VLN ); val = dest.y1 <<16 | dest.x1; - dplane->dst_yx = val; + dplane->base.state.dst_yx = val;writel_relaxed (val, dcrtc->base +LCD_SPU_DMA_OVSA_HPXL_VLN );return 0 ; - }else if (~dplane->ctrl0 & ctrl0 &CFG_DMA_ENA ) { + }else if (~dplane->base.state.ctrl0 & ctrl0 &CFG_DMA_ENA ) {/* Power up the Y/U/V FIFOs on ENA 0->1 transitions */ armada_updatel (0 , CFG_PDWN16x66 | CFG_PDWN32x66, dcrtc->base +LCD_SPU_SRAM_PARA1 );
@@ -230,28 +226,28 @@ armada_ovl_plane_update(struct drm_plane *plane, struct drm_crtc *crtc, } val = (drm_rect_height (&src) &0xffff0000 ) |drm_rect_width (&src) >>16 ; -if (dplane->src_hw != val) { - dplane->src_hw = val; +if (dplane->base.state.src_hw != val) { + dplane->base.state.src_hw = val;armada_reg_queue_set (dplane->vbl.regs, idx, val,LCD_SPU_DMA_HPXL_VLN ); } val =drm_rect_height (&dest) <<16 |drm_rect_width (&dest); -if (dplane->dst_hw != val) { - dplane->dst_hw = val; +if (dplane->base.state.dst_hw != val) { + dplane->base.state.dst_hw = val;armada_reg_queue_set (dplane->vbl.regs, idx, val,LCD_SPU_DZM_HPXL_VLN ); } val = dest.y1 <<16 | dest.x1; -if (dplane->dst_yx != val) { - dplane->dst_yx = val; +if (dplane->base.state.dst_yx != val) { + dplane->base.state.dst_yx = val;armada_reg_queue_set (dplane->vbl.regs, idx, val,LCD_SPU_DMA_OVSA_HPXL_VLN ); } -if (dplane->ctrl0 != ctrl0) { - dplane->ctrl0 = ctrl0; +if (dplane->base.state.ctrl0 != ctrl0) { + dplane->base.state.ctrl0 = ctrl0; armada_reg_queue_mod(dplane->vbl.regs, idx, ctrl0, CFG_CBSH_ENA | CFG_DMAFORMAT | CFG_DMA_FTOGGLE | CFG_DMA_HSMOOTH | CFG_DMA_TSTMODE |
@@ -282,7 +278,7 @@ static int armada_ovl_plane_disable(struct drm_plane *plane)armada_drm_crtc_plane_disable (dcrtc, plane); dcrtc->plane =NULL ; - dplane->ctrl0 =0 ; + dplane->base.state.ctrl0 =0 ; fb =xchg (&dplane->old_fb,NULL );if (fb)
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
RFC PATCH 4/7 drm/armada: split out primary plane update
In reply to Russell King - ARM LinuxSplit out the primary plane update from the mode setting.
--- drivers/gpu/drm/armada/armada_crtc.c | 52 ++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 20 deletions(-)
drivers/gpu/drm/armada/armada_crtc.c +32 -20
@@ -527,6 +527,34 @@ static uint32_t armada_drm_crtc_calculate_csc(struct armada_crtc *dcrtc)return val; } +static void armada_drm_primary_set (struct drm_crtc *crtc, +struct drm_plane *plane,int x,int y) +{ +struct armada_plane_state *state = &drm_to_armada_plane (plane)->state; +struct armada_crtc *dcrtc =drm_to_armada_crtc (crtc); +struct armada_regs regs[7 ]; +bool interlaced = dcrtc->interlaced; +unsigned i; +uint32_t ctrl0; + + i =armada_drm_crtc_calc_fb (plane->fb, x, y, regs, interlaced); + +armada_reg_queue_set (regs, i, state->src_hw,LCD_SPU_GRA_HPXL_VLN ); +armada_reg_queue_set (regs, i, state->dst_hw,LCD_SPU_GZM_HPXL_VLN ); + + ctrl0 = state->ctrl0; +if (interlaced) + ctrl0 |=CFG_GRA_FTOGGLE ; + +armada_reg_queue_mod (regs, i, ctrl0,CFG_GRAFORMAT | +CFG_GRA_MOD (CFG_SWAPRB |CFG_SWAPUV | +CFG_SWAPYU |CFG_YUV2RGB ) | +CFG_PALETTE_ENA |CFG_GRA_FTOGGLE , +LCD_SPU_DMA_CTRL0 ); +armada_reg_queue_end (regs, i); +armada_drm_crtc_update_regs (dcrtc, regs); +} +/* The mode_config.mutex will be held for this call */ static int armada_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode, struct drm_display_mode *adj,
@@ -553,12 +581,10 @@ static int armada_drm_crtc_mode_set(struct drm_crtc *crtc,drm_to_armada_plane (crtc->primary)->state.ctrl0 = val;drm_to_armada_plane (crtc->primary)->state.src_hw =drm_to_armada_plane (crtc->primary)->state.dst_hw = - adj->crtc_hdisplay <<16 | adj->crtc_vdisplay; + adj->crtc_vdisplay <<16 | adj->crtc_hdisplay;drm_to_armada_plane (crtc->primary)->state.dst_yx =0 ; - i =armada_drm_crtc_calc_fb (dcrtc->crtc.primary->fb, - x, y, regs, interlaced); - + i =0 ; rm = adj->crtc_hsync_start - adj->crtc_hdisplay; lm = adj->crtc_htotal - adj->crtc_hsync_end; bm = adj->crtc_vsync_start - adj->crtc_vdisplay;
@@ -634,12 +660,6 @@ static int armada_drm_crtc_mode_set(struct drm_crtc *crtc, val = adj->crtc_vdisplay <<16 | adj->crtc_hdisplay;armada_reg_queue_set (regs, i, val,LCD_SPU_V_H_ACTIVE ); -armada_reg_queue_set (regs, i, -drm_to_armada_plane (crtc->primary)->state.src_hw, -LCD_SPU_GRA_HPXL_VLN ); -armada_reg_queue_set (regs, i, -drm_to_armada_plane (crtc->primary)->state.dst_hw, -LCD_SPU_GZM_HPXL_VLN );armada_reg_queue_set (regs, i, (lm <<16 ) | rm,LCD_SPU_H_PORCH );armada_reg_queue_set (regs, i, dcrtc->v[0 ].spu_v_porch,LCD_SPU_V_PORCH ); armada_reg_queue_set(regs, i, dcrtc->v[0].spu_v_h_total,
@@ -651,16 +671,6 @@ static int armada_drm_crtc_mode_set(struct drm_crtc *crtc, ADV_VSYNCOFFEN, LCD_SPU_ADV_REG); } - val =drm_to_armada_plane (crtc->primary)->state.ctrl0; -if (interlaced) - val |=CFG_GRA_FTOGGLE ; - -armada_reg_queue_mod (regs, i, val,CFG_GRAFORMAT | -CFG_GRA_MOD (CFG_SWAPRB |CFG_SWAPUV | -CFG_SWAPYU |CFG_YUV2RGB ) | -CFG_PALETTE_ENA |CFG_GRA_FTOGGLE , -LCD_SPU_DMA_CTRL0 ); - val = adj->flags &DRM_MODE_FLAG_NVSYNC ?CFG_VSYNC_INV :0 ;armada_reg_queue_mod (regs, i, val,CFG_VSYNC_INV ,LCD_SPU_DMA_CTRL1 );
@@ -669,6 +679,8 @@ static int armada_drm_crtc_mode_set(struct drm_crtc *crtc,armada_reg_queue_end (regs, i);armada_drm_crtc_update_regs (dcrtc, regs); + +armada_drm_primary_set (crtc, crtc->primary, x, y);spin_unlock_irqrestore (&dcrtc->irq_lock, flags);armada_drm_crtc_update (dcrtc);
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
RFC PATCH 5/7 drm/armada: move setting primary plane position to armada_drm_primary_set()
In reply to Russell King - ARM LinuxMove the setting of the primary plane position into armada_drm_primary_set() rather than the initialisation function.
--- drivers/gpu/drm/armada/armada_crtc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/armada/armada_crtc.c +3 -3
@@ -532,13 +532,14 @@ static void armada_drm_primary_set(struct drm_crtc *crtc, {struct armada_plane_state *state = &drm_to_armada_plane (plane)->state;struct armada_crtc *dcrtc =drm_to_armada_crtc (crtc); -struct armada_regs regs[7 ]; +struct armada_regs regs[8 ];bool interlaced = dcrtc->interlaced;unsigned i; -uint32_t ctrl0; +u32 ctrl0; i =armada_drm_crtc_calc_fb (plane->fb, x, y, regs, interlaced); +armada_reg_queue_set (regs, i, state->dst_yx,LCD_SPU_GRA_OVSA_HPXL_VLN );armada_reg_queue_set (regs, i, state->src_hw,LCD_SPU_GRA_HPXL_VLN );armada_reg_queue_set (regs, i, state->dst_hw,LCD_SPU_GZM_HPXL_VLN );
@@ -1191,7 +1192,6 @@ static int armada_drm_crtc_create(struct drm_device *drm, struct device *dev, CFG_PDWN32x32 | CFG_PDWN16x66 | CFG_PDWN32x66 | CFG_PDWN64x66, dcrtc->base + LCD_SPU_SRAM_PARA1);writel_relaxed (0x2032ff81 , dcrtc->base +LCD_SPU_DMA_CTRL1 ); -writel_relaxed (0x00000000 , dcrtc->base +LCD_SPU_GRA_OVSA_HPXL_VLN );writel_relaxed (dcrtc->irq_ena, dcrtc->base +LCD_SPU_IRQ_ENA );writel_relaxed (0 , dcrtc->base +LCD_SPU_IRQ_ISR );
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
RFC PATCH 6/7 drm/armada: use common helper for plane base address
In reply to Russell King - ARM LinuxUse a common helper to calculate the plane base address(es) for the framebuffer.
--- drivers/gpu/drm/armada/armada_crtc.c | 26 ++++++++++++++++++++++---- drivers/gpu/drm/armada/armada_crtc.h | 2 ++ drivers/gpu/drm/armada/armada_overlay.c | 26 ++++++++++---------------- 3 files changed, 34 insertions(+), 20 deletions(-)
drivers/gpu/drm/armada/armada_crtc.c +22 -4
@@ -165,19 +165,37 @@ static void armada_drm_crtc_update(struct armada_crtc *dcrtc) } } +void armada_drm_plane_calc_addrs (u32 *addrs,struct drm_framebuffer *fb, +int x,int y) +{ +u32 addr =drm_fb_obj (fb)->dev_addr; +u32 pixel_format = fb->pixel_format; +int num_planes =drm_format_num_planes (pixel_format); +int i; + +if (num_planes >3 ) + num_planes =3 ; + +for (i =0 ; i < num_planes; i++) + addrs[i] = addr + fb->offsets[i] + y * fb->pitches[i] + + x *drm_format_plane_cpp (pixel_format, i); +for (; i <3 ; i++) + addrs[i] =0 ; +} +static unsigned armada_drm_crtc_calc_fb (struct drm_framebuffer *fb,int x,int y,struct armada_regs *regs,bool interlaced) { -struct armada_gem_object *obj =drm_fb_obj (fb);unsigned pitch = fb->pitches[0 ]; -unsigned offset = y * pitch + x * fb->bits_per_pixel /8 ; -uint32_t addr_odd, addr_even; +u32 addrs[3 ], addr_odd, addr_even;unsigned i =0 ;DRM_DEBUG_DRIVER ("pitch %u x %d y %d bpp %d\n" , pitch, x, y, fb->bits_per_pixel); - addr_odd = addr_even = obj->dev_addr + offset; +armada_drm_plane_calc_addrs (addrs, fb, x, y); + + addr_odd = addr_even = addrs[0 ];if (interlaced) { addr_even += pitch;
drivers/gpu/drm/armada/armada_crtc.h +2 -0
@@ -62,6 +62,8 @@ int armada_drm_plane_work_queue(struct armada_crtc *dcrtc,int armada_drm_plane_work_wait (struct armada_plane *plane,long timeout);struct armada_plane_work *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 drm_crtc crtc;
drivers/gpu/drm/armada/armada_overlay.c +10 -16
@@ -169,9 +169,8 @@ armada_ovl_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,armada_drm_plane_work_cancel (dcrtc, &dplane->base);if (plane->fb != fb) { -struct armada_gem_object *obj =drm_fb_obj (fb); -uint32_t addr[3 ], pixel_format; -int i, num_planes, hsub; +u32 addrs[3 ], pixel_format; +int num_planes, hsub;/* * Take a reference on the new framebuffer - we want to
@@ -185,6 +184,8 @@ armada_ovl_plane_update(struct drm_plane *plane, struct drm_crtc *crtc, src_y = src.y1 >>16 ; src_x = src.x1 >>16 ; +armada_drm_plane_calc_addrs (addrs, fb, src_x, src_y); + pixel_format = fb->pixel_format; hsub =drm_format_horz_chroma_subsampling (pixel_format); num_planes =drm_format_num_planes (pixel_format);
@@ -197,24 +198,17 @@ armada_ovl_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,if (src_x & (hsub -1 ) && num_planes ==1 ) ctrl0 ^=CFG_DMA_MOD (CFG_SWAPUV ); -for (i =0 ; i < num_planes; i++) - addr[i] = obj->dev_addr + fb->offsets[i] + - src_y * fb->pitches[i] + - src_x *drm_format_plane_cpp (pixel_format, i); -for (; i <ARRAY_SIZE (addr); i++) - addr[i] =0 ; - -armada_reg_queue_set (dplane->vbl.regs, idx, addr[0 ], +armada_reg_queue_set (dplane->vbl.regs, idx, addrs[0 ],LCD_SPU_DMA_START_ADDR_Y0 ); -armada_reg_queue_set (dplane->vbl.regs, idx, addr[1 ], +armada_reg_queue_set (dplane->vbl.regs, idx, addrs[1 ],LCD_SPU_DMA_START_ADDR_U0 ); -armada_reg_queue_set (dplane->vbl.regs, idx, addr[2 ], +armada_reg_queue_set (dplane->vbl.regs, idx, addrs[2 ],LCD_SPU_DMA_START_ADDR_V0 ); -armada_reg_queue_set (dplane->vbl.regs, idx, addr[0 ], +armada_reg_queue_set (dplane->vbl.regs, idx, addrs[0 ],LCD_SPU_DMA_START_ADDR_Y1 ); -armada_reg_queue_set (dplane->vbl.regs, idx, addr[1 ], +armada_reg_queue_set (dplane->vbl.regs, idx, addrs[1 ],LCD_SPU_DMA_START_ADDR_U1 ); -armada_reg_queue_set (dplane->vbl.regs, idx, addr[2 ], +armada_reg_queue_set (dplane->vbl.regs, idx, addrs[2 ],LCD_SPU_DMA_START_ADDR_V1 ); val = fb->pitches[0 ] <<16 | fb->pitches[0 ];
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
RFC PATCH 7/7 drm/armada: de-midlayer armada
In reply to Russell King - ARM LinuxNow that the drm_connector_register() is gone from tda998x, we can remove the mid-layer from armada-drm, eliminating the load, unload, debugfs_init, and debugfs_cleanup callbacks from armada's drm_driver structure. No functional changes.
--- drivers/gpu/drm/armada/armada_drm.h | 1 + drivers/gpu/drm/armada/armada_drv.c | 236 +++++++++++++++++++----------------- 2 files changed, 129 insertions(+), 108 deletions(-)
drivers/gpu/drm/armada/armada_drm.h +1 -0
@@ -53,6 +53,7 @@ struct armada_variant {extern const struct armada_variant armada510_ops;struct armada_private { +struct drm_device drm;struct work_struct fb_unref_work; DECLARE_KFIFO(fb_unref, struct drm_framebuffer *, 8);struct drm_fb_helper *fbdev;
drivers/gpu/drm/armada/armada_drv.c +128 -108
262 lines not on this page · raw message
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel