drm/exynos: clean up + atomic phases 1 and 2
Subsystems (7)
cover drm/exynos: clean up + atomic phases 1 and 2
From: Gustavo Padovan <[email protected]>
Hi,
In this series:
- fix to FIMD pageflips, only finish pageflips if START == START_S.
- remove struct exynos_drm_overlay and struct exynos_drm_manager. exynos_drm_overlay was merged with exynos_drm_plane and exynos_drm_manager with exynos_drm_crtc removing two extra and unnecessary abstractions levels from the exynos code. It also makes understanding of the code easier since now we talk using known names like CRTC and Planes instead of manager and overlay.
- remove DPMS operations from places where it is not need, e.g., updating planes. Only full modesets should use DPMS operations.
- unify plane update on exynos_update_plane(). Now all pieces of code that wants to update a plane should be using this function.
- atomic phase 1 and 2: set all the helpers and new callbacks needed to port drm-exynos to atomic. pahse 3 is a work in progress.
There are also some smalls fixes and clean ups.
This is rebased on dri-devel/drm-next to benefit from the lastests atomic changes.
Gustavo
---
The following changes since commit 4e0cd68115620bc3236ff4e58e4c073948629b41:
drm: sti: fix module compilation issue (2014-12-15 17:07:57 +1000)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/padovan/drm-exynos.git for-drm-next
for you to fetch changes up to 26d5e29b5613fb466b3cb04ddbdef371aa3f1596:
drm/exynos: atomic phase 2: keep track of framebuffer pointer (2014-12-18 11:30:16 -0200)
Daniel Kurtz (1):
drm/exynos/fimd: only finish pageflip if START == START_S
Gustavo Padovan (28):
drm/exynos: move to_exynos_crtc() macro to main header drm/exynos: expose struct exynos_drm_crtc
drm/exynos: remove exynos_drm_crtc_plane_* wrappers drm/exynos: remove struct exynos_drm_overlay drm/exynos/fimd: don't initialize 'ret' variable in fimd_probe() drm/exynos/vidi: remove useless ops->commit() drm/exynos: Don't touch DPMS when updating overlay planes drm/exynos: don't do any DPMS operation while updating planes drm/exynos: remove exynos_plane_commit() wrapper drm/exynos: unify plane update on exynos_update_plane() drm/exynos: call exynos_update_plane() directly on page flips drm/exynos: remove exynos_drm_crtc_mode_set_commit() drm/exynos: rename base object of struct exynos_drm_crtc to 'base' drm/exynos: add pipe param to exynos_drm_crtc_create() drm/exynos: remove pipe member of struct exynos_drm_manager drm/exynos: move 'type' from manager to crtc struct drm/exynos: remove drm_dev from struct exynos_drm_manager drm/exynos: remove struct exynos_drm_manager drm/exynos: don't duplicate drm_display_mode in fimd context drm/exynos: remove mode_set() ops from exynos_crtc drm/exynos: create exynos_check_plane()
drm/exynos: atomic phase 1: use drm_plane_helper_update() drm/exynos: make exynos_plane_mode_set() static drm/exynos: atomic phase 1: use drm_plane_helper_disable() drm/exynos: atomic phase 1: add atomic_begin()/atomic_flush() drm/exynos: atomic phase 1: add .mode_set_nofb() callback drm/exynos: atomic phase 2: wire up state reset(), duplicate() and
destroy()
drm/exynos: atomic phase 2: keep track of framebuffer pointer
drivers/gpu/drm/bridge/ptn3460.c | 4 + drivers/gpu/drm/exynos/exynos_dp_core.c | 4 + drivers/gpu/drm/exynos/exynos_drm_connector.c | 4 + drivers/gpu/drm/exynos/exynos_drm_crtc.c | 273 ++++++++++---------------- drivers/gpu/drm/exynos/exynos_drm_crtc.h | 8 +- drivers/gpu/drm/exynos/exynos_drm_dpi.c | 4 + drivers/gpu/drm/exynos/exynos_drm_drv.c | 2 + drivers/gpu/drm/exynos/exynos_drm_drv.h | 87 +++++--- drivers/gpu/drm/exynos/exynos_drm_dsi.c | 4 + drivers/gpu/drm/exynos/exynos_drm_fb.c | 2 +- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 263 ++++++++++++++----------- drivers/gpu/drm/exynos/exynos_drm_plane.c | 196 ++++++++++-------- drivers/gpu/drm/exynos/exynos_drm_plane.h | 12 +- drivers/gpu/drm/exynos/exynos_drm_vidi.c | 139 ++++++------- drivers/gpu/drm/exynos/exynos_hdmi.c | 4 + drivers/gpu/drm/exynos/exynos_mixer.c | 159 ++++++++------- include/video/samsung_fimd.h | 1 + 17 files changed, 601 insertions(+), 565 deletions(-)
Signature · 1 line
1.9.3
PATCH 1/29 drm/exynos/fimd: only finish pageflip if START == START_S
From: Daniel Kurtz <[email protected]>
A framebuffer gets committed to FIMD's default window like this:
exynos_drm_crtc_update()
exynos_plane_commit()
fimd_win_commit()
fimd_win_commit() programs BUF_START[0]. At each vblank, FIMD hardware copies the value from BUF_START to BUF_START_S (BUF_START's shadow register), starts scanning out from BUF_START_S, and asserts its irq.
This irq is handled by fimd_irq_handler(), which calls exynos_drm_crtc_finish_pageflip() to free the old buffer that FIMD just finished scanning out, and potentially commit the next pending flip.
There is a race, however, if fimd_win_commit() programs BUF_START(0) between the actual vblank irq, and its corresponding fimd_irq_handler().
=> FIMD vblank: BUF_START_S[0] := BUF_START[0], and irq asserted | => fimd_win_commit(0) writes new BUF_START[0]
| exynos_drm_crtc_try_do_flip() marks exynos_fb as prepared
=> fimd_irq_handler()
exynos_drm_crtc_finish_pageflip() sees prepared exynos_fb,
and unmaps "old" fb
==> but, since BUF_START_S[0] still points to that "old" fb... ==> FIMD iommu fault
This patch ensures that fimd_irq_handler() only calls exynos_drm_crtc_finish_pageflip() if any previously scheduled flip has really completed.
This works because exynos_drm_crtc's flip fifo ensures that fimd_win_commit() is never called more than once per exynos_drm_crtc_finish_pageflip().
--- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 26 ++++++++++++++++++++++---- include/video/samsung_fimd.h | 1 + 2 files changed, 23 insertions(+), 4 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +22 -4
@@ -55,6 +55,7 @@#define VIDOSD_D (win) (VIDOSD_BASE + 0x0C + (win) * 16)#define VIDWx_BUF_START (win, buf) (VIDW_BUF_START(buf) + (win) * 8) +#define VIDWx_BUF_START_S (win, buf) (VIDW_BUF_START_S(buf) + (win) * 8)#define VIDWx_BUF_END (win, buf) (VIDW_BUF_END(buf) + (win) * 8)#define VIDWx_BUF_SIZE (win, buf) (VIDW_BUF_SIZE(buf) + (win) * 4)
@@ -1039,6 +1040,7 @@ static irqreturn_t fimd_irq_handler(int irq, void *dev_id) {struct fimd_context *ctx = (struct fimd_context *)dev_id;u32 val, clear_bit; +u32 start, start_s; val =readl (ctx->regs +VIDINTCON1 );
@@ -1050,15 +1052,31 @@ static irqreturn_t fimd_irq_handler(int irq, void *dev_id)if (ctx->pipe <0 || !ctx->drm_dev) goto out; -if (ctx->i80_if) { +if (!ctx->i80_if) +drm_handle_vblank (ctx->drm_dev, ctx->pipe); + +/* +* Ensure finish_pageflip is called iff a pending flip has completed. +* This works around a race between a page_flip request and the latency +* between vblank interrupt and this irq_handler: +* => FIMD vblank: BUF_START_S[0] := BUF_START[0], and asserts irq +* | => fimd_win_commit(0) writes new BUF_START[0] +* | exynos_drm_crtc_try_do_flip() marks exynos_fb as prepared +* => fimd_irq_handler() +* exynos_drm_crtc_finish_pageflip() sees prepared exynos_fb, +* and unmaps "old" fb +* ==> but, since BUF_START_S[0] still points to that "old" fb... +* ==> FIMD iommu fault +*/ + start =readl (ctx->regs +VIDWx_BUF_START (0 ,0 )); + start_s =readl (ctx->regs +VIDWx_BUF_START_S (0 ,0 )); +if (start == start_s)exynos_drm_crtc_finish_pageflip (ctx->drm_dev, ctx->pipe); +if (ctx->i80_if) {/* Exits triggering mode */ atomic_set (&ctx->triggering,0 ); }else { -drm_handle_vblank (ctx->drm_dev, ctx->pipe); -exynos_drm_crtc_finish_pageflip (ctx->drm_dev, ctx->pipe); -/* set wait vsync event to zero and wake up queue. */ if (atomic_read (&ctx->wait_vsync_event)) {atomic_set (&ctx->wait_vsync_event,0 );
include/video/samsung_fimd.h +1 -0
@@ -291,6 +291,7 @@/* Video buffer addresses */ #define VIDW_BUF_START (_buff) (0xA0 + ((_buff) * 8)) +#define VIDW_BUF_START_S (_buff) (0x40A0 + ((_buff) * 8))#define VIDW_BUF_START1 (_buff) (0xA4 + ((_buff) * 8))#define VIDW_BUF_END (_buff) (0xD0 + ((_buff) * 8))#define VIDW_BUF_END1 (_buff) (0xD4 + ((_buff) * 8))
Signature · 6 lines
1.9.3 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Inki Dae
maintainerRe: [PATCH 01/29] drm/exynos/fimd: only finish pageflip if START == START_S
Quoted 64 lines · Gustavo Padovan
From: Daniel Kurtz <[email protected]>
A framebuffer gets committed to FIMD's default window like this:
exynos_drm_crtc_update()
exynos_plane_commit()
fimd_win_commit()
fimd_win_commit()programs BUF_START[0]. At each vblank, FIMD hardware copies the value fromBUF_STARTtoBUF_START_S(BUF_START's shadow register), starts scanning out fromBUF_START_S, and asserts its irq.This irq is handled by
fimd_irq_handler(), which callsexynos_drm_crtc_finish_pageflip()to free the old buffer that FIMD just finished scanning out, and potentially commit the next pending flip.There is a race, however, if
fimd_win_commit()programsBUF_START(0)between the actual vblank irq, and its correspondingfimd_irq_handler().=> FIMD vblank: BUF_START_S[0] := BUF_START[0], and irq asserted | =>
fimd_win_commit(0)writes new BUF_START[0]
|exynos_drm_crtc_try_do_flip()marksexynos_fbas prepared
=>fimd_irq_handler()
exynos_drm_crtc_finish_pageflip()sees preparedexynos_fb,
and unmaps "old" fb
==> but, since BUF_START_S[0] still points to that "old" fb... ==> FIMD iommu faultThis patch ensures that
fimd_irq_handler()only callsexynos_drm_crtc_finish_pageflip()if any previously scheduled flip has really completed.This works because exynos_drm_crtc's flip fifo ensures that
fimd_win_commit()is never called more than once perexynos_drm_crtc_finish_pageflip().Signed-off-by Daniel Kurtz <[email protected]>Reviewed-by Sean Paul <[email protected]>Signed-off-by Gustavo Padovan <[email protected]>--- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 26 ++++++++++++++++++++++---- include/video/samsung_fimd.h | 1 + 2 files changed, 23 insertions(+), 4 deletions(-)drivers/gpu/drm/exynos/exynos_drm_fimd.c +2
-0@@ -55,6 +55,7 @@#define VIDOSD_D (win) (VIDOSD_BASE + 0x0C + (win) * 16)#define VIDWx_BUF_START (win, buf) (VIDW_BUF_START(buf) + (win) * 8) +#define VIDWx_BUF_START_S (win, buf) (VIDW_BUF_START_S(buf) + (win) * 8)#define VIDWx_BUF_END (win, buf) (VIDW_BUF_END(buf) + (win) * 8)#define VIDWx_BUF_SIZE (win, buf) (VIDW_BUF_SIZE(buf) + (win) * 4)@@ -1039,6 +1040,7 @@ static irqreturn_t fimd_irq_handler(int irq, void *dev_id) {struct fimd_context *ctx = (struct fimd_context *)dev_id;u32 val, clear_bit; +u32 start, start_s; val =readl (ctx->regs +VIDINTCON1 );
drivers/gpu/drm/exynos/exynos_drm_fimd.c static irqreturn_t fimd_irq_handler(int irq, void *dev_id) · line 1059
Quoted 9 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +5
-1@@ -1050,15 +1052,31 @@ static irqreturn_t fimd_irq_handler(int irq, void *dev_id)if (ctx->pipe <0 || !ctx->drm_dev) goto out; -if (ctx->i80_if) { +if (!ctx->i80_if) +drm_handle_vblank (ctx->drm_dev, ctx->pipe); + +/* +* Ensure finish_pageflip is called iff a pending flip has completed.
Maybe s/iff/if
Quoted 5 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +5
-0+* This works around a race between a page_flip request and the latency +* between vblank interrupt and this irq_handler: +* => FIMD vblank: BUF_START_S[0] := BUF_START[0], and asserts irq +* | => fimd_win_commit(0) writes new BUF_START[0] +* | exynos_drm_crtc_try_do_flip() marks exynos_fb as prepared
drivers/gpu/drm/exynos/exynos_drm_fimd.c static irqreturn_t fimd_irq_handler(int irq, void *dev_id) · line 1074
Quoted 10 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +9
-0+* => fimd_irq_handler() +* exynos_drm_crtc_finish_pageflip() sees prepared exynos_fb, +* and unmaps "old" fb +* ==> but, since BUF_START_S[0] still points to that "old" fb... +* ==> FIMD iommu fault +*/ + start =readl (ctx->regs +VIDWx_BUF_START (0 ,0 )); + start_s =readl (ctx->regs +VIDWx_BUF_START_S (0 ,0 )); +if (start == start_s)exynos_drm_crtc_finish_pageflip (ctx->drm_dev, ctx->pipe);
As I already mentioned before, above codes should be called only in case of RGB mode until checked for i80 mode. Have you ever tested above codes on i80 mode?
And what if 'start_s' has a value different from one of 'start'? Is it ok to skip finish_pageflip request this time? Shouldn't it ensure to wait for that until 'start_s' has a value same as one of 'start'?
Thanks,
Inki Dae
Quoted 24 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +1
-3+if (ctx->i80_if) {/* Exits triggering mode */ atomic_set (&ctx->triggering,0 ); }else { -drm_handle_vblank (ctx->drm_dev, ctx->pipe); -exynos_drm_crtc_finish_pageflip (ctx->drm_dev, ctx->pipe); -/* set wait vsync event to zero and wake up queue. */ if (atomic_read (&ctx->wait_vsync_event)) {atomic_set (&ctx->wait_vsync_event,0 );include/video/samsung_fimd.h +1
-0@@ -291,6 +291,7 @@/* Video buffer addresses */ #define VIDW_BUF_START (_buff) (0xA0 + ((_buff) * 8)) +#define VIDW_BUF_START_S (_buff) (0x40A0 + ((_buff) * 8))#define VIDW_BUF_START1 (_buff) (0xA4 + ((_buff) * 8))#define VIDW_BUF_END (_buff) (0xD0 + ((_buff) * 8))#define VIDW_BUF_END1 (_buff) (0xD4 + ((_buff) * 8))
Re: [PATCH 01/29] drm/exynos/fimd: only finish pageflip if START == START_S
2014-12-30 Inki Dae <[email protected]>:
Quoted 88 lines · Gustavo Padovan
Quoted 64 lines
From: Daniel Kurtz <[email protected]>
A framebuffer gets committed to FIMD's default window like this:
exynos_drm_crtc_update()
exynos_plane_commit()
fimd_win_commit()
fimd_win_commit()programs BUF_START[0]. At each vblank, FIMD hardware copies the value fromBUF_STARTtoBUF_START_S(BUF_START's shadow register), starts scanning out fromBUF_START_S, and asserts its irq.This irq is handled by
fimd_irq_handler(), which callsexynos_drm_crtc_finish_pageflip()to free the old buffer that FIMD just finished scanning out, and potentially commit the next pending flip.There is a race, however, if
fimd_win_commit()programsBUF_START(0)between the actual vblank irq, and its correspondingfimd_irq_handler().=> FIMD vblank: BUF_START_S[0] := BUF_START[0], and irq asserted | =>
fimd_win_commit(0)writes new BUF_START[0]
|exynos_drm_crtc_try_do_flip()marksexynos_fbas prepared
=>fimd_irq_handler()
exynos_drm_crtc_finish_pageflip()sees preparedexynos_fb,
and unmaps "old" fb
==> but, since BUF_START_S[0] still points to that "old" fb... ==> FIMD iommu faultThis patch ensures that
fimd_irq_handler()only callsexynos_drm_crtc_finish_pageflip()if any previously scheduled flip has really completed.This works because exynos_drm_crtc's flip fifo ensures that
fimd_win_commit()is never called more than once perexynos_drm_crtc_finish_pageflip().Signed-off-by Daniel Kurtz <[email protected]>Reviewed-by Sean Paul <[email protected]>Signed-off-by Gustavo Padovan <[email protected]>--- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 26 ++++++++++++++++++++++---- include/video/samsung_fimd.h | 1 + 2 files changed, 23 insertions(+), 4 deletions(-)drivers/gpu/drm/exynos/exynos_drm_fimd.c +2
-0@@ -55,6 +55,7 @@#define VIDOSD_D (win) (VIDOSD_BASE + 0x0C + (win) * 16)#define VIDWx_BUF_START (win, buf) (VIDW_BUF_START(buf) + (win) * 8) +#define VIDWx_BUF_START_S (win, buf) (VIDW_BUF_START_S(buf) + (win) * 8)#define VIDWx_BUF_END (win, buf) (VIDW_BUF_END(buf) + (win) * 8)#define VIDWx_BUF_SIZE (win, buf) (VIDW_BUF_SIZE(buf) + (win) * 4)@@ -1039,6 +1040,7 @@ static irqreturn_t fimd_irq_handler(int irq, void *dev_id) {struct fimd_context *ctx = (struct fimd_context *)dev_id;u32 val, clear_bit; +u32 start, start_s; val =readl (ctx->regs +VIDINTCON1 );drivers/gpu/drm/exynos/exynos_drm_fimd.c static irqreturn_t fimd_irq_handler(int irq, void *dev_id) · line 1059
Quoted 9 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +5
-1@@ -1050,15 +1052,31 @@ static irqreturn_t fimd_irq_handler(int irq, void *dev_id)if (ctx->pipe <0 || !ctx->drm_dev) goto out; -if (ctx->i80_if) { +if (!ctx->i80_if) +drm_handle_vblank (ctx->drm_dev, ctx->pipe); + +/* +* Ensure finish_pageflip is called iff a pending flip has completed. Maybe s/iff/if
Quoted 11 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +11
-0+* This works around a race between a page_flip request and the latency +* between vblank interrupt and this irq_handler: +* => FIMD vblank: BUF_START_S[0] := BUF_START[0], and asserts irq +* | => fimd_win_commit(0) writes new BUF_START[0] +* | exynos_drm_crtc_try_do_flip() marks exynos_fb as prepared +* => fimd_irq_handler() +* exynos_drm_crtc_finish_pageflip() sees prepared exynos_fb, +* and unmaps "old" fb +* ==> but, since BUF_START_S[0] still points to that "old" fb... +* ==> FIMD iommu fault +*/
Quoted 8 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c static irqreturn_t fimd_irq_handler(int irq, void *dev_id) · line 1074
Quoted 4 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +3
-0+ start =readl (ctx->regs +VIDWx_BUF_START (0 ,0 )); + start_s =readl (ctx->regs +VIDWx_BUF_START_S (0 ,0 )); +if (start == start_s)exynos_drm_crtc_finish_pageflip (ctx->drm_dev, ctx->pipe);As I already mentioned before, above codes should be called only in case of RGB mode until checked for i80 mode. Have you ever tested above codes on i80 mode?
I haven't tested it as I don't have any hardware that does i80 mode. Let's keep this check only for !i80 then.
Quoted 4 lines
And what if '
start_s' has a value different from one of 'start'? Is it ok to skipfinish_pagefliprequest this time? Shouldn't it ensure to wait for that until 'start_s' has a value same as one of 'start'?
I think it is okay to skip finish_pageflip, but we could return directly if they are different, so we keep the wait_vsync_queue running until the next irq happens or it timeouts. How does this look to you?
Gustavo
Re: [PATCH 01/29] drm/exynos/fimd: only finish pageflip if START == START_S
Hi,
Quoted 19 lines · Gustavo Padovan
2014-12-30 Inki Dae <[email protected]>:
Quoted 2 lines · Gustavo Padovan
Quoted 1 line
+ * This works around a race between a
page_fliprequest and thelatency
Quoted 2 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ * between vblank interrupt and this irq_handler: + * => FIMD vblank: BUF_START_S[0] := BUF_START[0], and assertsirq
Quoted 12 lines
Quoted 12 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +11
-0+* | => fimd_win_commit(0) writes new BUF_START[0] +* | exynos_drm_crtc_try_do_flip() marks exynos_fb as prepared +* => fimd_irq_handler() +* exynos_drm_crtc_finish_pageflip() sees prepared exynos_fb, +* and unmaps "old" fb +* ==> but, since BUF_START_S[0] still points to that "old" fb... +* ==> FIMD iommu fault +*/ + start =readl (ctx->regs +VIDWx_BUF_START (0 ,0 )); + start_s =readl (ctx->regs +VIDWx_BUF_START_S (0 ,0 )); +if (start == start_s)exynos_drm_crtc_finish_pageflip (ctx->drm_dev, ctx->pipe);
Quoted 9 lines
Quoted 3 lines
And what if '
start_s' has a value different from one of 'start'? Is it ok to skipfinish_pagefliprequest this time? Shouldn't it ensure to wait for that until 'start_s' has a value same as one of 'start'?I think it is okay to skip
finish_pageflip, but we could return directly if they are different, so we keep thewait_vsync_queuerunning until the next
irq happens or it timeouts. How does this look to you?
Right, you'd need to keep the vblank IRQ alive until start == start_s.
As an aside, there is currently some refcounting code (e.g. in the DPMS off and/or framebuffer final-unref paths if I remember correctly) which assumes that waiting one vblank is enough to be able to unpin resources. Obviously, as this patch shows, this is not actually true. This patch doesn't make this any better or worse; just something to bear in mind. (I have WIP code which fixes this.)
Cheers,
Daniel
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/29 drm/exynos: move to_exynos_crtc() macro to main header
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
With this change we allow other pieces of the code to use this macro.
--- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 3 --- drivers/gpu/drm/exynos/exynos_drm_drv.h | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +0 -3
@@ -20,9 +20,6 @@#include "exynos_drm_encoder.h" #include "exynos_drm_plane.h" -#define to_exynos_crtc (x) container_of(x, struct exynos_drm_crtc,\ - drm_crtc) -enum exynos_crtc_mode {CRTC_MODE_NORMAL ,/* normal mode */ CRTC_MODE_BLANK ,/* The private plane of crtc is blank */
drivers/gpu/drm/exynos/exynos_drm_drv.h +3 -0
@@ -23,6 +23,9 @@#define MAX_FB_BUFFER 4#define DEFAULT_ZPOS -1 +#define to_exynos_crtc (x) container_of(x, struct exynos_drm_crtc,\ + drm_crtc) +/* This enumerates device type. */ enum exynos_drm_device_type {EXYNOS_DEVICE_TYPE_NONE ,
Signature · 6 lines
1.9.3 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/29 drm/exynos: expose struct exynos_drm_crtc
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
Let other pieces of the driver access struct exynos_drm_crtc as well.
struct exynos_drm_manager will be merged into struct exynos_drm_crtc, in the sense we will move all its members to exynos_drm_crtc, so to start this conversion exynos_drm_crtc need to be exposed as well.
--- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 30 ------------------------------ drivers/gpu/drm/exynos/exynos_drm_drv.h | 30 ++++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 30 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +0 -30
@@ -20,36 +20,6 @@#include "exynos_drm_encoder.h" #include "exynos_drm_plane.h" -enum exynos_crtc_mode { -CRTC_MODE_NORMAL ,/* normal mode */ -CRTC_MODE_BLANK ,/* The private plane of crtc is blank */ -}; - -/* -* Exynos specific crtc structure. -* -* @drm_crtc: crtc object. -* @manager: the manager associated with this crtc -* @pipe: a crtc index created at load() with a new crtc object creation -* and the crtc object would be set to private->crtc array -* to get a crtc object corresponding to this pipe from private->crtc -* array when irq interrupt occurred. the reason of using this pipe is that -* drm framework doesn't support multiple irq yet. -* we can refer to the crtc to current hardware interrupt occurred through -* this pipe value. -* @dpms: store the crtc dpms value -* @mode: store the crtc mode value -*/ -struct exynos_drm_crtc { -struct drm_crtc drm_crtc; -struct exynos_drm_manager *manager; -unsigned int pipe; -unsigned int dpms; -enum exynos_crtc_mode mode; -wait_queue_head_t pending_flip_queue; -atomic_t pending_flip; -}; -static void exynos_drm_crtc_dpms (struct drm_crtc *crtc,int mode) {struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (crtc);
drivers/gpu/drm/exynos/exynos_drm_drv.h +30 -0
@@ -215,6 +215,36 @@ struct exynos_drm_manager {struct exynos_drm_manager_ops *ops; }; +enum exynos_crtc_mode { +CRTC_MODE_NORMAL ,/* normal mode */ +CRTC_MODE_BLANK ,/* The private plane of crtc is blank */ +}; + +/* +* Exynos specific crtc structure. +* +* @drm_crtc: crtc object. +* @manager: the manager associated with this crtc +* @pipe: a crtc index created at load() with a new crtc object creation +* and the crtc object would be set to private->crtc array +* to get a crtc object corresponding to this pipe from private->crtc +* array when irq interrupt occurred. the reason of using this pipe is that +* drm framework doesn't support multiple irq yet. +* we can refer to the crtc to current hardware interrupt occurred through +* this pipe value. +* @dpms: store the crtc dpms value +* @mode: store the crtc mode value +*/ +struct exynos_drm_crtc { +struct drm_crtc drm_crtc; +struct exynos_drm_manager *manager; +unsigned int pipe; +unsigned int dpms; +enum exynos_crtc_mode mode; +wait_queue_head_t pending_flip_queue; +atomic_t pending_flip; +}; +struct exynos_drm_g2d_private {struct device *dev;struct list_head inuse_cmdlist;
Signature · 6 lines
1.9.3 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 4/29 drm/exynos: remove exynos_drm_crtc_plane_* wrappers
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
This functions were doing nothing but calling a manager op function, so remove them and call the manager directly.
--- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 33 ------------------------------- drivers/gpu/drm/exynos/exynos_drm_plane.c | 19 ++++++++++++++---- 2 files changed, 15 insertions(+), 37 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +0 -33
@@ -410,39 +410,6 @@ void exynos_drm_crtc_finish_pageflip(struct drm_device *dev, int pipe)spin_unlock_irqrestore (&dev->event_lock, flags); } -void exynos_drm_crtc_plane_mode_set (struct drm_crtc *crtc, -struct exynos_drm_overlay *overlay) -{ -struct exynos_drm_manager *manager =to_exynos_crtc (crtc)->manager; - -if (manager->ops->win_mode_set) - manager->ops->win_mode_set (manager, overlay); -} - -void exynos_drm_crtc_plane_commit (struct drm_crtc *crtc,int zpos) -{ -struct exynos_drm_manager *manager =to_exynos_crtc (crtc)->manager; - -if (manager->ops->win_commit) - manager->ops->win_commit (manager, zpos); -} - -void exynos_drm_crtc_plane_enable (struct drm_crtc *crtc,int zpos) -{ -struct exynos_drm_manager *manager =to_exynos_crtc (crtc)->manager; - -if (manager->ops->win_enable) - manager->ops->win_enable (manager, zpos); -} - -void exynos_drm_crtc_plane_disable (struct drm_crtc *crtc,int zpos) -{ -struct exynos_drm_manager *manager =to_exynos_crtc (crtc)->manager; - -if (manager->ops->win_disable) - manager->ops->win_disable (manager, zpos); -} -void exynos_drm_crtc_complete_scanout (struct drm_framebuffer *fb) {struct exynos_drm_manager *manager;
drivers/gpu/drm/exynos/exynos_drm_plane.c +15 -4
@@ -76,6 +76,7 @@ int exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc, uint32_t src_w, uint32_t src_h) {struct exynos_plane *exynos_plane =to_exynos_plane (plane); +struct exynos_drm_manager *manager =to_exynos_crtc (crtc)->manager;struct exynos_drm_overlay *overlay = &exynos_plane->overlay;unsigned int actual_w;unsigned int actual_h;
@@ -141,7 +142,8 @@ int exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc, plane->crtc = crtc; -exynos_drm_crtc_plane_mode_set (crtc, overlay); +if (manager->ops->win_mode_set) + manager->ops->win_mode_set (manager, overlay);return 0 ; }
@@ -150,26 +152,35 @@ void exynos_plane_commit(struct drm_plane *plane) {struct exynos_plane *exynos_plane =to_exynos_plane (plane);struct exynos_drm_overlay *overlay = &exynos_plane->overlay; +struct exynos_drm_manager *manager =to_exynos_crtc (plane->crtc)->manager; -exynos_drm_crtc_plane_commit (plane->crtc, overlay->zpos); +if (manager->ops->win_commit) + manager->ops->win_commit (manager, overlay->zpos); }void exynos_plane_dpms (struct drm_plane *plane,int mode) {struct exynos_plane *exynos_plane =to_exynos_plane (plane);struct exynos_drm_overlay *overlay = &exynos_plane->overlay; +struct exynos_drm_manager *manager;if (mode ==DRM_MODE_DPMS_ON ) {if (exynos_plane->enabled)return ; -exynos_drm_crtc_plane_enable (plane->crtc, overlay->zpos); + manager =to_exynos_crtc (plane->crtc)->manager; +if (manager->ops->win_enable) + manager->ops->win_enable (manager, overlay->zpos); + exynos_plane->enabled = true; }else {if (!exynos_plane->enabled)return ; -exynos_drm_crtc_plane_disable (plane->crtc, overlay->zpos); + manager =to_exynos_crtc (plane->crtc)->manager; +if (manager->ops->win_disable) + manager->ops->win_disable (manager, overlay->zpos); + exynos_plane->enabled = false; } }
Signature · 6 lines
1.9.3 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 5/29 drm/exynos: remove struct exynos_drm_overlay
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
struct exynos_drm_overlay has no practical advantage nor serves as important piece of the exynos API design. The only place it was used was inside the struct exynos_plane which was just causing a extra access overhead. Users had to access the overlay first and just then get the plane information it contains.
This patch merges struct exynos_drm_overlay into struct exynos_plane. It also renames struct exynos_plane to struct exynos_drm_plane.
The rational is to cut one step to access plane information.
--- drivers/gpu/drm/exynos/exynos_drm_crtc.h | 2 +- drivers/gpu/drm/exynos/exynos_drm_drv.h | 10 +++- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 44 ++++++++-------- drivers/gpu/drm/exynos/exynos_drm_plane.c | 85 ++++++++++++++----------------- drivers/gpu/drm/exynos/exynos_drm_vidi.c | 38 +++++++------- drivers/gpu/drm/exynos/exynos_mixer.c | 50 +++++++++--------- 6 files changed, 112 insertions(+), 117 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_crtc.h +1 -1
@@ -24,7 +24,7 @@ void exynos_drm_crtc_finish_pageflip(struct drm_device *dev, int pipe);void exynos_drm_crtc_complete_scanout (struct drm_framebuffer *fb);void exynos_drm_crtc_plane_mode_set (struct drm_crtc *crtc, -struct exynos_drm_overlay *overlay); +struct exynos_drm_plane *plane);void exynos_drm_crtc_plane_commit (struct drm_crtc *crtc,int zpos);void exynos_drm_crtc_plane_enable (struct drm_crtc *crtc,int zpos);void exynos_drm_crtc_plane_disable (struct drm_crtc *crtc,int zpos);
drivers/gpu/drm/exynos/exynos_drm_drv.h +8 -2
@@ -25,6 +25,7 @@#define to_exynos_crtc (x) container_of(x, struct exynos_drm_crtc,\ drm_crtc) +#define to_exynos_plane (x) container_of(x, struct exynos_drm_plane, base)/* This enumerates device type. */ enum exynos_drm_device_type {
@@ -47,6 +48,7 @@ enum exynos_drm_output_type {/* * Exynos drm common overlay structure. * +* @base: plane object * @fb_x: offset x on a framebuffer to be displayed. * - the unit is screen coordinates. * @fb_y: offset y on a framebuffer to be displayed.
@@ -76,11 +78,14 @@ enum exynos_drm_output_type {* @local_path: in case of lcd type, local path mode on or off. * @transparency: transparency on or off. * @activated: activated or not. +* @enabled: enabled or not. * * this structure is common to exynos SoC and its contents would be copied * to hardware specific overlay info. */ -struct exynos_drm_overlay { + +struct exynos_drm_plane { +struct drm_plane base;unsigned int fb_x;unsigned int fb_y;unsigned int fb_width;
@@ -107,6 +112,7 @@ struct exynos_drm_overlay { bool local_path:1; bool transparency:1; bool activated:1; + bool enabled:1; };/*
@@ -188,7 +194,7 @@ struct exynos_drm_manager_ops {void (*disable_vblank)(struct exynos_drm_manager *mgr);void (*wait_for_vblank)(struct exynos_drm_manager *mgr);void (*win_mode_set)(struct exynos_drm_manager *mgr, -struct exynos_drm_overlay *overlay); +struct exynos_drm_plane *plane);void (*win_commit)(struct exynos_drm_manager *mgr,int zpos);void (*win_enable)(struct exynos_drm_manager *mgr,int zpos);void (*win_disable)(struct exynos_drm_manager *mgr,int zpos);
drivers/gpu/drm/exynos/exynos_drm_fimd.c +22 -22
81 lines not on this page · raw message
drivers/gpu/drm/exynos/exynos_drm_plane.c +37 -48
173 lines not on this page · raw message
drivers/gpu/drm/exynos/exynos_drm_vidi.c +19 -19
@@ -162,43 +162,43 @@ static void vidi_disable_vblank(struct exynos_drm_manager *mgr) }static void vidi_win_mode_set (struct exynos_drm_manager *mgr, -struct exynos_drm_overlay *overlay) +struct exynos_drm_plane *plane) {struct vidi_context *ctx =manager_to_vidi (mgr);struct vidi_win_data *win_data;int win;unsigned long offset; -if (!overlay) { -DRM_ERROR ("overlay is NULL\n" ); +if (!plane) { +DRM_ERROR ("plane is NULL\n" );return ; } - win = overlay->zpos; + win = plane->zpos;if (win ==DEFAULT_ZPOS ) win = ctx->default_win;if (win <0 || win >=WINDOWS_NR )return ; - offset = overlay->fb_x * (overlay->bpp >>3 ); - offset += overlay->fb_y * overlay->pitch; + offset = plane->fb_x * (plane->bpp >>3 ); + offset += plane->fb_y * plane->pitch; -DRM_DEBUG_KMS ("offset = 0x%lx, pitch = %x\n" , offset, overlay->pitch); +DRM_DEBUG_KMS ("offset = 0x%lx, pitch = %x\n" , offset, plane->pitch); win_data = &ctx->win_data[win]; - win_data->offset_x = overlay->crtc_x; - win_data->offset_y = overlay->crtc_y; - win_data->ovl_width = overlay->crtc_width; - win_data->ovl_height = overlay->crtc_height; - win_data->fb_width = overlay->fb_width; - win_data->fb_height = overlay->fb_height; - win_data->dma_addr = overlay->dma_addr[0 ] + offset; - win_data->bpp = overlay->bpp; - win_data->buf_offsize = (overlay->fb_width - overlay->crtc_width) * - (overlay->bpp >>3 ); - win_data->line_size = overlay->crtc_width * (overlay->bpp >>3 ); + win_data->offset_x = plane->crtc_x; + win_data->offset_y = plane->crtc_y; + win_data->ovl_width = plane->crtc_width; + win_data->ovl_height = plane->crtc_height; + win_data->fb_width = plane->fb_width; + win_data->fb_height = plane->fb_height; + win_data->dma_addr = plane->dma_addr[0 ] + offset; + win_data->bpp = plane->bpp; + win_data->buf_offsize = (plane->fb_width - plane->crtc_width) * + (plane->bpp >>3 ); + win_data->line_size = plane->crtc_width * (plane->bpp >>3 );/* * some parts of win_data should be transferred to user side
@@ -211,7 +211,7 @@ static void vidi_win_mode_set(struct exynos_drm_manager *mgr, win_data->ovl_width, win_data->ovl_height);DRM_DEBUG_KMS ("paddr = 0x%lx\n" , (unsigned long )win_data->dma_addr);DRM_DEBUG_KMS ("fb_width = %d, crtc_width = %d\n" , - overlay->fb_width, overlay->crtc_width); + plane->fb_width, plane->crtc_width); }static void vidi_win_commit (struct exynos_drm_manager *mgr,int zpos)
drivers/gpu/drm/exynos/exynos_mixer.c +25 -25
76 lines not on this page · raw message
Signature · 6 lines
1.9.3 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 6/29 drm/exynos/fimd: don't initialize 'ret' variable in fimd_probe()
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
We set it in the beginning of the function, thus no need to set it at initialization.
--- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +1 -1
@@ -1126,7 +1126,7 @@ static int fimd_probe(struct platform_device *pdev)struct fimd_context *ctx;struct device_node *i80_if_timings;struct resource *res; -int ret = -EINVAL ; +int ret;if (!dev->of_node)return -ENODEV ;
Signature · 6 lines
1.9.3 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 7/29 drm/exynos/vidi: remove useless ops->commit()
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
vidi_commit does nothing, remove it and its callers.
--- drivers/gpu/drm/exynos/exynos_drm_vidi.c | 12 ------------ 1 file changed, 12 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_vidi.c +0 -12
@@ -115,17 +115,6 @@ static void vidi_apply(struct exynos_drm_manager *mgr)if (win_data->enabled && (mgr_ops && mgr_ops->win_commit)) mgr_ops->win_commit (mgr, i); } - -if (mgr_ops && mgr_ops->commit) - mgr_ops->commit (mgr); -} - -static void vidi_commit (struct exynos_drm_manager *mgr) -{ -struct vidi_context *ctx =manager_to_vidi (mgr); - -if (ctx->suspended) -return ; }static int vidi_enable_vblank (struct exynos_drm_manager *mgr)
@@ -320,7 +309,6 @@ static int vidi_mgr_initialize(struct exynos_drm_manager *mgr,static struct exynos_drm_manager_ops vidi_manager_ops = { .dpms = vidi_dpms, - .commit = vidi_commit, .enable_vblank = vidi_enable_vblank, .disable_vblank = vidi_disable_vblank, .win_mode_set = vidi_win_mode_set,
Signature · 6 lines
1.9.3 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 8/29 drm/exynos: Don't touch DPMS when updating overlay planes
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
DPMS settings should only be changed by a full modeset. exynos_plane_update() should only care about updating the planes itself and nothing else.
--- drivers/gpu/drm/exynos/exynos_drm_plane.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/exynos/exynos_drm_plane.c +0 -1
@@ -190,7 +190,6 @@ exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,return ret;exynos_plane_commit (plane); -exynos_plane_dpms (plane,DRM_MODE_DPMS_ON );return 0 ; }
Signature · 6 lines
1.9.3 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 9/29 drm/exynos: don't do any DPMS operation while updating planes
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
DPMS only makes sense when the mode changes, for plane update changes do not perform any dpms operation.
This move places the win_commit() and commit() calls directly in the code instead of calling exynos_drm_crtc_commit() thus avoiding DPMS operations.
--- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +7 -1
@@ -115,6 +115,8 @@ static int exynos_drm_crtc_mode_set_commit(struct drm_crtc *crtc, int x, int y, struct drm_framebuffer *old_fb) {struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (crtc); +struct exynos_drm_manager *manager = exynos_crtc->manager; +struct exynos_drm_plane *exynos_plane =to_exynos_plane (crtc->primary);struct drm_framebuffer *fb = crtc->primary->fb;unsigned int crtc_w;unsigned int crtc_h;
@@ -134,7 +136,11 @@ static int exynos_drm_crtc_mode_set_commit(struct drm_crtc *crtc, int x, int y,if (ret)return ret; -exynos_drm_crtc_commit (crtc); +if (manager->ops->win_commit) + manager->ops->win_commit (manager, exynos_plane->zpos); + +if (manager->ops->commit) + manager->ops->commit (manager);return 0 ; }
Signature · 1 line
1.9.3
PATCH 10/29 drm/exynos: remove exynos_plane_commit() wrapper
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
It's doing nothing but calling exynos_crtc->ops->win_commit(), so let's call this directly to avoid extra layers of abstraction.
--- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 4 +++- drivers/gpu/drm/exynos/exynos_drm_plane.c | 15 +++++---------- drivers/gpu/drm/exynos/exynos_drm_plane.h | 1 - 3 files changed, 8 insertions(+), 12 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +3 -1
@@ -59,10 +59,12 @@ static void exynos_drm_crtc_commit(struct drm_crtc *crtc) {struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (crtc);struct exynos_drm_manager *manager = exynos_crtc->manager; +struct exynos_drm_plane *exynos_plane =to_exynos_plane (crtc->primary);exynos_drm_crtc_dpms (crtc,DRM_MODE_DPMS_ON ); -exynos_plane_commit (crtc->primary); +if (manager->ops->win_commit) + manager->ops->win_commit (manager, exynos_plane->zpos);if (manager->ops->commit) manager->ops->commit (manager);
drivers/gpu/drm/exynos/exynos_drm_plane.c +5 -10
@@ -139,15 +139,6 @@ int exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc,return 0 ; } -void exynos_plane_commit (struct drm_plane *plane) -{ -struct exynos_drm_plane *exynos_plane =to_exynos_plane (plane); -struct exynos_drm_manager *manager =to_exynos_crtc (plane->crtc)->manager; - -if (manager->ops->win_commit) - manager->ops->win_commit (manager, exynos_plane->zpos); -} -void exynos_plane_dpms (struct drm_plane *plane,int mode) {struct exynos_drm_plane *exynos_plane =to_exynos_plane (plane);
@@ -181,6 +172,9 @@ exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, uint32_t src_x, uint32_t src_y, uint32_t src_w, uint32_t src_h) { + + struct exynos_drm_manager *manager = to_exynos_crtc(crtc)->manager; +struct exynos_drm_plane *exynos_plane =to_exynos_plane (plane);int ret; ret = exynos_plane_mode_set(plane, crtc, fb, crtc_x, crtc_y,
@@ -189,7 +183,8 @@ exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,if (ret <0 )return ret; -exynos_plane_commit (plane); +if (manager->ops->win_commit) + manager->ops->win_commit (manager, exynos_plane->zpos);return 0 ; }
drivers/gpu/drm/exynos/exynos_drm_plane.h +0 -1
@@ -14,7 +14,6 @@ int exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc, unsigned int crtc_w, unsigned int crtc_h, uint32_t src_x, uint32_t src_y, uint32_t src_w, uint32_t src_h); -void exynos_plane_commit (struct drm_plane *plane);void exynos_plane_dpms (struct drm_plane *plane,int mode); struct drm_plane *exynos_plane_init(struct drm_device *dev, unsigned long possible_crtcs,
Signature · 1 line
1.9.3
PATCH 11/29 drm/exynos: unify plane update on exynos_update_plane()
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
We can safely use the exynos_update_plane() to update the plane framebuffer for both the overlay and primary planes.
Note that this patch removes a call to manager->ops->commit() in exynos_drm_crtc_mode_set_commit(). The commit() call is used only by the fimd driver to set underlying timings and need only in full modeset operations. For plane update only win_commit is needed.
--- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 17 ++--------------- drivers/gpu/drm/exynos/exynos_drm_plane.c | 2 +- drivers/gpu/drm/exynos/exynos_drm_plane.h | 5 +++++ 3 files changed, 8 insertions(+), 16 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +2 -15
@@ -117,12 +117,9 @@ static int exynos_drm_crtc_mode_set_commit(struct drm_crtc *crtc, int x, int y, struct drm_framebuffer *old_fb) {struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (crtc); -struct exynos_drm_manager *manager = exynos_crtc->manager; -struct exynos_drm_plane *exynos_plane =to_exynos_plane (crtc->primary);struct drm_framebuffer *fb = crtc->primary->fb;unsigned int crtc_w;unsigned int crtc_h; -int ret;/* when framebuffer changing is requested, crtc's dpms should be on */ if (exynos_crtc->dpms >DRM_MODE_DPMS_ON ) {
@@ -133,18 +130,8 @@ static int exynos_drm_crtc_mode_set_commit(struct drm_crtc *crtc, int x, int y, crtc_w = fb->width - x; crtc_h = fb->height - y; - ret =exynos_plane_mode_set (crtc->primary, crtc, fb,0 ,0 , - crtc_w, crtc_h, x, y, crtc_w, crtc_h); -if (ret) -return ret; - -if (manager->ops->win_commit) - manager->ops->win_commit (manager, exynos_plane->zpos); - -if (manager->ops->commit) - manager->ops->commit (manager); - -return 0 ; +return exynos_update_plane (crtc->primary, crtc, fb,0 ,0 , + crtc_w, crtc_h, x, y, crtc_w, crtc_h); } static int exynos_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
drivers/gpu/drm/exynos/exynos_drm_plane.c +1 -1
@@ -165,7 +165,7 @@ void exynos_plane_dpms(struct drm_plane *plane, int mode) } } -static int +int exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, struct drm_framebuffer *fb, int crtc_x, int crtc_y, unsigned int crtc_w, unsigned int crtc_h,
drivers/gpu/drm/exynos/exynos_drm_plane.h +5 -0
@@ -14,6 +14,11 @@ int exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc, unsigned int crtc_w, unsigned int crtc_h, uint32_t src_x, uint32_t src_y, uint32_t src_w, uint32_t src_h); +int exynos_update_plane (struct drm_plane *plane,struct drm_crtc *crtc, +struct drm_framebuffer *fb,int crtc_x,int crtc_y, +unsigned int crtc_w,unsigned int crtc_h, +uint32_t src_x,uint32_t src_y, +uint32_t src_w,uint32_t src_h);void exynos_plane_dpms (struct drm_plane *plane,int mode); struct drm_plane *exynos_plane_init(struct drm_device *dev, unsigned long possible_crtcs,
Signature · 1 line
1.9.3
PATCH 12/29 drm/exynos: call exynos_update_plane() directly on page flips
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
Avoid an extra call to exynos_drm_crtc_mode_set_commit() that only calls exynos_update_plane().
--- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +6 -2
@@ -176,6 +176,7 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,struct exynos_drm_private *dev_priv = dev->dev_private;struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (crtc);struct drm_framebuffer *old_fb = crtc->primary->fb; +unsigned int crtc_w, crtc_h;int ret = -EINVAL ;/* when the page flip is requested, crtc's dpms should be on */
@@ -207,8 +208,11 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,spin_unlock_irq (&dev->event_lock); crtc->primary->fb = fb; - ret =exynos_drm_crtc_mode_set_commit (crtc, crtc->x, crtc->y, -NULL ); + crtc_w = fb->width - crtc->x; + crtc_h = fb->height - crtc->y; + ret =exynos_update_plane (crtc->primary, crtc, fb,0 ,0 , + crtc_w, crtc_h, crtc->x, crtc->y, + crtc_w, crtc_h);if (ret) { crtc->primary->fb = old_fb;
Signature · 1 line
1.9.3
PATCH 13/29 drm/exynos: remove exynos_drm_crtc_mode_set_commit()
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
This was just as extra chain in the call stack. We just rename it to _set_base() and let it do everything alone.
--- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +1 -7
@@ -113,7 +113,7 @@ exynos_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode, crtc_w, crtc_h, x, y, crtc_w, crtc_h); } -static int exynos_drm_crtc_mode_set_commit (struct drm_crtc *crtc,int x,int y, +static int exynos_drm_crtc_mode_set_base (struct drm_crtc *crtc,int x,int y,struct drm_framebuffer *old_fb) {struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (crtc);
@@ -134,12 +134,6 @@ static int exynos_drm_crtc_mode_set_commit(struct drm_crtc *crtc, int x, int y, crtc_w, crtc_h, x, y, crtc_w, crtc_h); } -static int exynos_drm_crtc_mode_set_base (struct drm_crtc *crtc,int x,int y, -struct drm_framebuffer *old_fb) -{ -return exynos_drm_crtc_mode_set_commit (crtc, x, y, old_fb); -} -static void exynos_drm_crtc_disable (struct drm_crtc *crtc) {struct drm_plane *plane;
Signature · 1 line
1.9.3
PATCH 14/29 drm/exynos: rename base object of struct exynos_drm_crtc to 'base'
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
'base' is more widely used name in the drm subsystem for the base object.
--- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 4 ++-- drivers/gpu/drm/exynos/exynos_drm_drv.h | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +2 -2
@@ -324,8 +324,8 @@ int exynos_drm_crtc_create(struct exynos_drm_manager *manager) goto err_plane; } - manager->crtc = &exynos_crtc->drm_crtc; - crtc = &exynos_crtc->drm_crtc; + manager->crtc = &exynos_crtc->base; + crtc = &exynos_crtc->base; private->crtc[manager->pipe] = crtc;
drivers/gpu/drm/exynos/exynos_drm_drv.h +3 -4
@@ -23,8 +23,7 @@#define MAX_FB_BUFFER 4#define DEFAULT_ZPOS -1 -#define to_exynos_crtc (x) container_of(x, struct exynos_drm_crtc,\ - drm_crtc) +#define to_exynos_crtc (x) container_of(x, struct exynos_drm_crtc, base)#define to_exynos_plane (x) container_of(x, struct exynos_drm_plane, base)/* This enumerates device type. */
@@ -229,7 +228,7 @@ enum exynos_crtc_mode {/* * Exynos specific crtc structure. * -* @drm_crtc: crtc object. +* @base: crtc object. * @manager: the manager associated with this crtc * @pipe: a crtc index created at load() with a new crtc object creation * and the crtc object would be set to private->crtc array
@@ -242,7 +241,7 @@ enum exynos_crtc_mode {* @mode: store the crtc mode value */ struct exynos_drm_crtc { -struct drm_crtc drm_crtc; +struct drm_crtc base;struct exynos_drm_manager *manager;unsigned int pipe;unsigned int dpms;
Signature · 6 lines
1.9.3 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 15/29 drm/exynos: add pipe param to exynos_drm_crtc_create()
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
Get the pipe value from a parameter instead of getting it from manager->pipe. We are removing manager->pipe.
--- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 8 ++++---- drivers/gpu/drm/exynos/exynos_drm_crtc.h | 2 +- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 2 +- drivers/gpu/drm/exynos/exynos_drm_vidi.c | 2 +- drivers/gpu/drm/exynos/exynos_mixer.c | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +4 -4
@@ -299,7 +299,7 @@ static void exynos_drm_crtc_attach_mode_property(struct drm_crtc *crtc)drm_object_attach_property (&crtc->base, prop,0 ); } -int exynos_drm_crtc_create (struct exynos_drm_manager *manager) +int exynos_drm_crtc_create (struct exynos_drm_manager *manager,int pipe) {struct exynos_drm_crtc *exynos_crtc;struct drm_plane *plane;
@@ -316,8 +316,8 @@ int exynos_drm_crtc_create(struct exynos_drm_manager *manager) exynos_crtc->dpms =DRM_MODE_DPMS_OFF ; exynos_crtc->manager = manager; - exynos_crtc->pipe = manager->pipe; - plane =exynos_plane_init (manager->drm_dev,1 << manager->pipe, + exynos_crtc->pipe = pipe; + plane =exynos_plane_init (manager->drm_dev,1 << pipe,DRM_PLANE_TYPE_PRIMARY );if (IS_ERR (plane)) { ret =PTR_ERR (plane);
@@ -327,7 +327,7 @@ int exynos_drm_crtc_create(struct exynos_drm_manager *manager) manager->crtc = &exynos_crtc->base; crtc = &exynos_crtc->base; - private->crtc[manager->pipe] = crtc; + private->crtc[pipe] = crtc; ret =drm_crtc_init_with_planes (manager->drm_dev, crtc, plane,NULL , &exynos_crtc_funcs);
drivers/gpu/drm/exynos/exynos_drm_crtc.h +1 -1
@@ -17,7 +17,7 @@#include "exynos_drm_drv.h" -int exynos_drm_crtc_create (struct exynos_drm_manager *manager); +int exynos_drm_crtc_create (struct exynos_drm_manager *manager,int pipe);int exynos_drm_crtc_enable_vblank (struct drm_device *dev,int pipe);void exynos_drm_crtc_disable_vblank (struct drm_device *dev,int pipe);void exynos_drm_crtc_finish_pageflip (struct drm_device *dev,int pipe);
drivers/gpu/drm/exynos/exynos_drm_fimd.c +1 -1
@@ -1094,7 +1094,7 @@ static int fimd_bind(struct device *dev, struct device *master, void *data)struct drm_device *drm_dev = data;fimd_mgr_initialize (&ctx->manager, drm_dev); -exynos_drm_crtc_create (&ctx->manager); +exynos_drm_crtc_create (&ctx->manager, ctx->pipe);if (ctx->display)exynos_drm_create_enc_conn (drm_dev, ctx->display);
drivers/gpu/drm/exynos/exynos_drm_vidi.c +1 -1
@@ -558,7 +558,7 @@ static int vidi_bind(struct device *dev, struct device *master, void *data)vidi_mgr_initialize (&ctx->manager, drm_dev); - ret =exynos_drm_crtc_create (&ctx->manager); + ret =exynos_drm_crtc_create (&ctx->manager, ctx->pipe);if (ret) {DRM_ERROR ("failed to create crtc.\n" );return ret;
drivers/gpu/drm/exynos/exynos_mixer.c +1 -1
@@ -1256,7 +1256,7 @@ static int mixer_bind(struct device *dev, struct device *manager, void *data)if (ret)return ret; - ret =exynos_drm_crtc_create (&ctx->manager); + ret =exynos_drm_crtc_create (&ctx->manager, ctx->pipe);if (ret) {mixer_mgr_remove (&ctx->manager);return ret;
Signature · 1 line
1.9.3
PATCH 16/29 drm/exynos: remove pipe member of struct exynos_drm_manager
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
It is not longer used. This is part of the process of removing struct exynos_drm_manager entirely.
--- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 2 +- drivers/gpu/drm/exynos/exynos_drm_drv.h | 2 -- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 2 +- drivers/gpu/drm/exynos/exynos_drm_vidi.c | 2 +- drivers/gpu/drm/exynos/exynos_mixer.c | 2 +- 5 files changed, 4 insertions(+), 6 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +1 -1
@@ -436,7 +436,7 @@ int exynos_drm_crtc_get_pipe_from_type(struct drm_device *drm_dev, exynos_crtc =to_exynos_crtc (crtc);if (exynos_crtc->manager->type == out_type) -return exynos_crtc->manager->pipe; +return exynos_crtc->pipe; }return -EPERM ;
drivers/gpu/drm/exynos/exynos_drm_drv.h +0 -2
@@ -207,7 +207,6 @@ struct exynos_drm_manager_ops {* @type: one of EXYNOS_DISPLAY_TYPE_LCD and HDMI. * @drm_dev: pointer to the drm device * @crtc: crtc object. -* @pipe: the pipe number for this crtc/manager * @ops: pointer to callbacks for exynos drm specific functionality * @ctx: A pointer to the manager's implementation specific context */
@@ -216,7 +215,6 @@ struct exynos_drm_manager {enum exynos_drm_output_type type;struct drm_device *drm_dev;struct drm_crtc *crtc; -int pipe;struct exynos_drm_manager_ops *ops; };
drivers/gpu/drm/exynos/exynos_drm_fimd.c +1 -1
@@ -300,7 +300,7 @@ static int fimd_mgr_initialize(struct exynos_drm_manager *mgr, priv = drm_dev->dev_private; mgr->drm_dev = ctx->drm_dev = drm_dev; - mgr->pipe = ctx->pipe = priv->pipe++; + ctx->pipe = priv->pipe++;/* attach this sub driver to iommu mapping if supported. */ if (is_drm_iommu_supported (ctx->drm_dev)) {
drivers/gpu/drm/exynos/exynos_drm_vidi.c +1 -1
@@ -302,7 +302,7 @@ static int vidi_mgr_initialize(struct exynos_drm_manager *mgr,struct exynos_drm_private *priv = drm_dev->dev_private; mgr->drm_dev = ctx->drm_dev = drm_dev; - mgr->pipe = ctx->pipe = priv->pipe++; + ctx->pipe = priv->pipe++;return 0 ; }
drivers/gpu/drm/exynos/exynos_mixer.c +1 -1
@@ -863,7 +863,7 @@ static int mixer_initialize(struct exynos_drm_manager *mgr, priv = drm_dev->dev_private; mgr->drm_dev = mixer_ctx->drm_dev = drm_dev; - mgr->pipe = mixer_ctx->pipe = priv->pipe++; + mixer_ctx->pipe = priv->pipe++;/* acquire resources: regs, irqs, clocks */ ret =mixer_resources_init (mixer_ctx);
Signature · 6 lines
1.9.3 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 17/29 drm/exynos: move 'type' from manager to crtc struct
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
'type' is now part of the struct exynos_drm_crtc. This is just another step in the struct exynos_drm_manager removal.
--- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 6 ++++-- drivers/gpu/drm/exynos/exynos_drm_crtc.h | 3 ++- drivers/gpu/drm/exynos/exynos_drm_drv.h | 4 ++-- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 6 +++--- drivers/gpu/drm/exynos/exynos_drm_vidi.c | 6 +++--- drivers/gpu/drm/exynos/exynos_mixer.c | 6 +++--- 6 files changed, 17 insertions(+), 14 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +4 -2
@@ -299,7 +299,8 @@ static void exynos_drm_crtc_attach_mode_property(struct drm_crtc *crtc)drm_object_attach_property (&crtc->base, prop,0 ); } -int exynos_drm_crtc_create (struct exynos_drm_manager *manager,int pipe) +int exynos_drm_crtc_create (struct exynos_drm_manager *manager,int pipe, +enum exynos_drm_output_type type) {struct exynos_drm_crtc *exynos_crtc;struct drm_plane *plane;
@@ -317,6 +318,7 @@ int exynos_drm_crtc_create(struct exynos_drm_manager *manager, int pipe) exynos_crtc->dpms =DRM_MODE_DPMS_OFF ; exynos_crtc->manager = manager; exynos_crtc->pipe = pipe; + exynos_crtc->type = type; plane =exynos_plane_init (manager->drm_dev,1 << pipe,DRM_PLANE_TYPE_PRIMARY );if (IS_ERR (plane)) {
@@ -435,7 +437,7 @@ int exynos_drm_crtc_get_pipe_from_type(struct drm_device *drm_dev,struct exynos_drm_crtc *exynos_crtc; exynos_crtc =to_exynos_crtc (crtc); -if (exynos_crtc->manager->type == out_type) +if (exynos_crtc->type == out_type)return exynos_crtc->pipe; }
drivers/gpu/drm/exynos/exynos_drm_crtc.h +2 -1
@@ -17,7 +17,8 @@#include "exynos_drm_drv.h" -int exynos_drm_crtc_create (struct exynos_drm_manager *manager,int pipe); +int exynos_drm_crtc_create (struct exynos_drm_manager *manager,int pipe, +enum exynos_drm_output_type type);int exynos_drm_crtc_enable_vblank (struct drm_device *dev,int pipe);void exynos_drm_crtc_disable_vblank (struct drm_device *dev,int pipe);void exynos_drm_crtc_finish_pageflip (struct drm_device *dev,int pipe);
drivers/gpu/drm/exynos/exynos_drm_drv.h +2 -2
@@ -204,7 +204,6 @@ struct exynos_drm_manager_ops {* Exynos drm common manager structure, maps 1:1 with a crtc * * @list: the list entry for this manager -* @type: one of EXYNOS_DISPLAY_TYPE_LCD and HDMI. * @drm_dev: pointer to the drm device * @crtc: crtc object. * @ops: pointer to callbacks for exynos drm specific functionality
@@ -212,7 +211,6 @@ struct exynos_drm_manager_ops {*/ struct exynos_drm_manager {struct list_head list; -enum exynos_drm_output_type type;struct drm_device *drm_dev;struct drm_crtc *crtc;struct exynos_drm_manager_ops *ops;
@@ -228,6 +226,7 @@ enum exynos_crtc_mode {* * @base: crtc object. * @manager: the manager associated with this crtc +* @type: one of EXYNOS_DISPLAY_TYPE_LCD and HDMI. * @pipe: a crtc index created at load() with a new crtc object creation * and the crtc object would be set to private->crtc array * to get a crtc object corresponding to this pipe from private->crtc
@@ -241,6 +240,7 @@ enum exynos_crtc_mode {struct exynos_drm_crtc {struct drm_crtc base;struct exynos_drm_manager *manager; +enum exynos_drm_output_type type;unsigned int pipe;unsigned int dpms;enum exynos_crtc_mode mode;
drivers/gpu/drm/exynos/exynos_drm_fimd.c +3 -3
@@ -1094,7 +1094,8 @@ static int fimd_bind(struct device *dev, struct device *master, void *data)struct drm_device *drm_dev = data;fimd_mgr_initialize (&ctx->manager, drm_dev); -exynos_drm_crtc_create (&ctx->manager, ctx->pipe); +exynos_drm_crtc_create (&ctx->manager, ctx->pipe, +EXYNOS_DISPLAY_TYPE_LCD );if (ctx->display)exynos_drm_create_enc_conn (drm_dev, ctx->display);
@@ -1135,11 +1136,10 @@ static int fimd_probe(struct platform_device *pdev)if (!ctx)return -ENOMEM ; - ctx->manager.type =EXYNOS_DISPLAY_TYPE_LCD ; ctx->manager.ops = &fimd_manager_ops; ret =exynos_drm_component_add (dev,EXYNOS_DEVICE_TYPE_CRTC , - ctx->manager.type); +EXYNOS_DISPLAY_TYPE_LCD );if (ret)return ret;
drivers/gpu/drm/exynos/exynos_drm_vidi.c +3 -3
@@ -558,7 +558,8 @@ static int vidi_bind(struct device *dev, struct device *master, void *data)vidi_mgr_initialize (&ctx->manager, drm_dev); - ret =exynos_drm_crtc_create (&ctx->manager, ctx->pipe); + ret =exynos_drm_crtc_create (&ctx->manager, ctx->pipe, +EXYNOS_DISPLAY_TYPE_VIDI );if (ret) {DRM_ERROR ("failed to create crtc.\n" );return ret;
@@ -593,7 +594,6 @@ static int vidi_probe(struct platform_device *pdev)if (!ctx)return -ENOMEM ; - ctx->manager.type =EXYNOS_DISPLAY_TYPE_VIDI ; ctx->manager.ops = &vidi_manager_ops; ctx->display.type =EXYNOS_DISPLAY_TYPE_VIDI ; ctx->display.ops = &vidi_display_ops;
@@ -601,7 +601,7 @@ static int vidi_probe(struct platform_device *pdev) ctx->pdev = pdev; ret =exynos_drm_component_add (&pdev->dev,EXYNOS_DEVICE_TYPE_CRTC , - ctx->manager.type); +EXYNOS_DISPLAY_TYPE_VIDI );if (ret)return ret;
drivers/gpu/drm/exynos/exynos_mixer.c +3 -3
@@ -1256,7 +1256,8 @@ static int mixer_bind(struct device *dev, struct device *manager, void *data)if (ret)return ret; - ret =exynos_drm_crtc_create (&ctx->manager, ctx->pipe); + ret =exynos_drm_crtc_create (&ctx->manager, ctx->pipe, +EXYNOS_DISPLAY_TYPE_HDMI );if (ret) {mixer_mgr_remove (&ctx->manager);return ret;
@@ -1296,7 +1297,6 @@ static int mixer_probe(struct platform_device *pdev)mutex_init (&ctx->mixer_mutex); - ctx->manager.type =EXYNOS_DISPLAY_TYPE_HDMI ; ctx->manager.ops = &mixer_manager_ops;if (dev->of_node) {
@@ -1320,7 +1320,7 @@ static int mixer_probe(struct platform_device *pdev)platform_set_drvdata (pdev, ctx); ret =exynos_drm_component_add (&pdev->dev,EXYNOS_DEVICE_TYPE_CRTC , - ctx->manager.type); +EXYNOS_DISPLAY_TYPE_HDMI );if (ret)return ret;
Signature · 1 line
1.9.3
PATCH 18/29 drm/exynos: remove drm_dev from struct exynos_drm_manager
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
manager-drm_dev is only accessed by exynos_drm_crtc_create() so this patch pass drm_dev as argument on exynos_drm_crtc_create() and remove it from struct exynos_drm_manager.
--- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 9 +++++---- drivers/gpu/drm/exynos/exynos_drm_crtc.h | 3 ++- drivers/gpu/drm/exynos/exynos_drm_drv.h | 1 - drivers/gpu/drm/exynos/exynos_drm_fimd.c | 4 ++-- drivers/gpu/drm/exynos/exynos_drm_vidi.c | 4 ++-- drivers/gpu/drm/exynos/exynos_mixer.c | 4 ++-- 6 files changed, 13 insertions(+), 12 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +5 -4
@@ -299,12 +299,13 @@ static void exynos_drm_crtc_attach_mode_property(struct drm_crtc *crtc)drm_object_attach_property (&crtc->base, prop,0 ); } -int exynos_drm_crtc_create (struct exynos_drm_manager *manager,int pipe, +int exynos_drm_crtc_create (struct exynos_drm_manager *manager, +struct drm_device *drm_dev,int pipe,enum exynos_drm_output_type type) {struct exynos_drm_crtc *exynos_crtc;struct drm_plane *plane; -struct exynos_drm_private *private = manager->drm_dev->dev_private; +struct exynos_drm_private *private = drm_dev->dev_private;struct drm_crtc *crtc;int ret;
@@ -319,7 +320,7 @@ int exynos_drm_crtc_create(struct exynos_drm_manager *manager, int pipe, exynos_crtc->manager = manager; exynos_crtc->pipe = pipe; exynos_crtc->type = type; - plane =exynos_plane_init (manager->drm_dev,1 << pipe, + plane =exynos_plane_init (drm_dev,1 << pipe,DRM_PLANE_TYPE_PRIMARY );if (IS_ERR (plane)) { ret =PTR_ERR (plane);
@@ -331,7 +332,7 @@ int exynos_drm_crtc_create(struct exynos_drm_manager *manager, int pipe, private->crtc[pipe] = crtc; - ret =drm_crtc_init_with_planes (manager->drm_dev, crtc, plane,NULL , + ret =drm_crtc_init_with_planes (drm_dev, crtc, plane,NULL , &exynos_crtc_funcs);if (ret <0 ) goto err_crtc;
drivers/gpu/drm/exynos/exynos_drm_crtc.h +2 -1
@@ -17,7 +17,8 @@#include "exynos_drm_drv.h" -int exynos_drm_crtc_create (struct exynos_drm_manager *manager,int pipe, +int exynos_drm_crtc_create (struct exynos_drm_manager *manager, +struct drm_device *drm_dev,int pipe,enum exynos_drm_output_type type);int exynos_drm_crtc_enable_vblank (struct drm_device *dev,int pipe);void exynos_drm_crtc_disable_vblank (struct drm_device *dev,int pipe);
drivers/gpu/drm/exynos/exynos_drm_drv.h +0 -1
@@ -211,7 +211,6 @@ struct exynos_drm_manager_ops {*/ struct exynos_drm_manager {struct list_head list; -struct drm_device *drm_dev;struct drm_crtc *crtc;struct exynos_drm_manager_ops *ops; };
drivers/gpu/drm/exynos/exynos_drm_fimd.c +2 -2
@@ -299,7 +299,7 @@ static int fimd_mgr_initialize(struct exynos_drm_manager *mgr,struct exynos_drm_private *priv; priv = drm_dev->dev_private; - mgr->drm_dev = ctx->drm_dev = drm_dev; + ctx->drm_dev = drm_dev; ctx->pipe = priv->pipe++;/* attach this sub driver to iommu mapping if supported. */
@@ -1094,7 +1094,7 @@ static int fimd_bind(struct device *dev, struct device *master, void *data)struct drm_device *drm_dev = data;fimd_mgr_initialize (&ctx->manager, drm_dev); -exynos_drm_crtc_create (&ctx->manager, ctx->pipe, +exynos_drm_crtc_create (&ctx->manager, drm_dev, ctx->pipe,EXYNOS_DISPLAY_TYPE_LCD );if (ctx->display)exynos_drm_create_enc_conn (drm_dev, ctx->display);
drivers/gpu/drm/exynos/exynos_drm_vidi.c +2 -2
@@ -301,7 +301,7 @@ static int vidi_mgr_initialize(struct exynos_drm_manager *mgr,struct vidi_context *ctx =manager_to_vidi (mgr);struct exynos_drm_private *priv = drm_dev->dev_private; - mgr->drm_dev = ctx->drm_dev = drm_dev; + ctx->drm_dev = drm_dev; ctx->pipe = priv->pipe++;return 0 ;
@@ -558,7 +558,7 @@ static int vidi_bind(struct device *dev, struct device *master, void *data)vidi_mgr_initialize (&ctx->manager, drm_dev); - ret =exynos_drm_crtc_create (&ctx->manager, ctx->pipe, + ret =exynos_drm_crtc_create (&ctx->manager, drm_dev, ctx->pipe,EXYNOS_DISPLAY_TYPE_VIDI );if (ret) {DRM_ERROR ("failed to create crtc.\n" );
drivers/gpu/drm/exynos/exynos_mixer.c +2 -2
@@ -862,7 +862,7 @@ static int mixer_initialize(struct exynos_drm_manager *mgr,struct exynos_drm_private *priv; priv = drm_dev->dev_private; - mgr->drm_dev = mixer_ctx->drm_dev = drm_dev; + mixer_ctx->drm_dev = drm_dev; mixer_ctx->pipe = priv->pipe++;/* acquire resources: regs, irqs, clocks */
@@ -1256,7 +1256,7 @@ static int mixer_bind(struct device *dev, struct device *manager, void *data)if (ret)return ret; - ret =exynos_drm_crtc_create (&ctx->manager, ctx->pipe, + ret =exynos_drm_crtc_create (&ctx->manager, drm_dev, ctx->pipe,EXYNOS_DISPLAY_TYPE_HDMI );if (ret) {mixer_mgr_remove (&ctx->manager);
Signature · 1 line
1.9.3
PATCH 19/29 drm/exynos: remove struct exynos_drm_manager
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
exynos_drm_manager was just a redundant struct to represent the crtc as well. In this commit we merge exynos_drm_manager into exynos_drm_crtc to remove an unnecessary level of indirection easing the understand of the flow on exynos.
--- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 67 ++++++++--------- drivers/gpu/drm/exynos/exynos_drm_crtc.h | 8 +- drivers/gpu/drm/exynos/exynos_drm_drv.h | 51 +++++-------- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 121 ++++++++++++++---------------- drivers/gpu/drm/exynos/exynos_drm_plane.c | 26 +++---- drivers/gpu/drm/exynos/exynos_drm_vidi.c | 79 +++++++++---------- drivers/gpu/drm/exynos/exynos_mixer.c | 103 ++++++++++++------------- 7 files changed, 211 insertions(+), 244 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +32 -35
@@ -23,7 +23,6 @@static void exynos_drm_crtc_dpms (struct drm_crtc *crtc,int mode) {struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (crtc); -struct exynos_drm_manager *manager = exynos_crtc->manager;DRM_DEBUG_KMS ("crtc[%d] mode[%d]\n" , crtc->base.id, mode);
@@ -41,8 +40,8 @@ static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode)drm_crtc_vblank_off (crtc); } -if (manager->ops->dpms) - manager->ops->dpms (manager, mode); +if (exynos_crtc->ops->dpms) + exynos_crtc->ops->dpms (exynos_crtc, mode); exynos_crtc->dpms = mode;
@@ -58,16 +57,15 @@ static void exynos_drm_crtc_prepare(struct drm_crtc *crtc)static void exynos_drm_crtc_commit (struct drm_crtc *crtc) {struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (crtc); -struct exynos_drm_manager *manager = exynos_crtc->manager;struct exynos_drm_plane *exynos_plane =to_exynos_plane (crtc->primary);exynos_drm_crtc_dpms (crtc,DRM_MODE_DPMS_ON ); -if (manager->ops->win_commit) - manager->ops->win_commit (manager, exynos_plane->zpos); +if (exynos_crtc->ops->win_commit) + exynos_crtc->ops->win_commit (exynos_crtc, exynos_plane->zpos); -if (manager->ops->commit) - manager->ops->commit (manager); +if (exynos_crtc->ops->commit) + exynos_crtc->ops->commit (exynos_crtc);exynos_plane_dpms (crtc->primary,DRM_MODE_DPMS_ON ); }
@@ -78,10 +76,10 @@ exynos_drm_crtc_mode_fixup(struct drm_crtc *crtc, struct drm_display_mode *adjusted_mode) {struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (crtc); -struct exynos_drm_manager *manager = exynos_crtc->manager; -if (manager->ops->mode_fixup) -return manager->ops->mode_fixup (manager, mode, adjusted_mode); +if (exynos_crtc->ops->mode_fixup) +return exynos_crtc->ops->mode_fixup (exynos_crtc, mode, + adjusted_mode);return true; }
@@ -92,7 +90,6 @@ exynos_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode, struct drm_framebuffer *old_fb) {struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (crtc); -struct exynos_drm_manager *manager = exynos_crtc->manager;struct drm_framebuffer *fb = crtc->primary->fb;unsigned int crtc_w;unsigned int crtc_h;
@@ -106,8 +103,8 @@ exynos_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode, crtc_w = fb->width - x; crtc_h = fb->height - y; -if (manager->ops->mode_set) - manager->ops->mode_set (manager, &crtc->mode); +if (exynos_crtc->ops->mode_set) + exynos_crtc->ops->mode_set (exynos_crtc, &crtc->mode);return exynos_plane_mode_set (crtc->primary, crtc, fb,0 ,0 , crtc_w, crtc_h, x, y, crtc_w, crtc_h);
@@ -299,9 +296,11 @@ static void exynos_drm_crtc_attach_mode_property(struct drm_crtc *crtc)drm_object_attach_property (&crtc->base, prop,0 ); } -int exynos_drm_crtc_create (struct exynos_drm_manager *manager, -struct drm_device *drm_dev,int pipe, -enum exynos_drm_output_type type) +struct exynos_drm_crtc *exynos_drm_crtc_create (struct drm_device *drm_dev, +int pipe, +enum exynos_drm_output_type type, +struct exynos_drm_crtc_ops *ops, +void *ctx) {struct exynos_drm_crtc *exynos_crtc;struct drm_plane *plane;
@@ -311,15 +310,16 @@ int exynos_drm_crtc_create(struct exynos_drm_manager *manager, exynos_crtc =kzalloc (sizeof (*exynos_crtc),GFP_KERNEL );if (!exynos_crtc) -return -ENOMEM ; +return ERR_PTR (-ENOMEM );init_waitqueue_head (&exynos_crtc->pending_flip_queue);atomic_set (&exynos_crtc->pending_flip,0 ); exynos_crtc->dpms =DRM_MODE_DPMS_OFF ; - exynos_crtc->manager = manager; exynos_crtc->pipe = pipe; exynos_crtc->type = type; + exynos_crtc->ops = ops; + exynos_crtc->ctx = ctx; plane =exynos_plane_init (drm_dev,1 << pipe,DRM_PLANE_TYPE_PRIMARY );if (IS_ERR (plane)) {
@@ -327,7 +327,6 @@ int exynos_drm_crtc_create(struct exynos_drm_manager *manager, goto err_plane; } - manager->crtc = &exynos_crtc->base; crtc = &exynos_crtc->base; private->crtc[pipe] = crtc;
@@ -341,13 +340,13 @@ int exynos_drm_crtc_create(struct exynos_drm_manager *manager,exynos_drm_crtc_attach_mode_property (crtc); -return 0 ; +return exynos_crtc; err_crtc: plane->funcs->destroy (plane); err_plane:kfree (exynos_crtc); -return ret; +return ERR_PTR (ret); }int exynos_drm_crtc_enable_vblank (struct drm_device *dev,int pipe)
@@ -355,13 +354,12 @@ int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int pipe)struct exynos_drm_private *private = dev->dev_private;struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (private->crtc[pipe]); -struct exynos_drm_manager *manager = exynos_crtc->manager;if (exynos_crtc->dpms !=DRM_MODE_DPMS_ON )return -EPERM ; -if (manager->ops->enable_vblank) - manager->ops->enable_vblank (manager); +if (exynos_crtc->ops->enable_vblank) + exynos_crtc->ops->enable_vblank (exynos_crtc);return 0 ; }
@@ -371,13 +369,12 @@ void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int pipe)struct exynos_drm_private *private = dev->dev_private;struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (private->crtc[pipe]); -struct exynos_drm_manager *manager = exynos_crtc->manager;if (exynos_crtc->dpms !=DRM_MODE_DPMS_ON )return ; -if (manager->ops->disable_vblank) - manager->ops->disable_vblank (manager); +if (exynos_crtc->ops->disable_vblank) + exynos_crtc->ops->disable_vblank (exynos_crtc); }void exynos_drm_crtc_finish_pageflip (struct drm_device *dev,int pipe)
@@ -408,7 +405,7 @@ void exynos_drm_crtc_finish_pageflip(struct drm_device *dev, int pipe)void exynos_drm_crtc_complete_scanout (struct drm_framebuffer *fb) { -struct exynos_drm_manager *manager; +struct exynos_drm_crtc *exynos_crtc;struct drm_device *dev = fb->dev;struct drm_crtc *crtc;
@@ -417,15 +414,15 @@ void exynos_drm_crtc_complete_scanout(struct drm_framebuffer *fb)* for all encoders. */ list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) { - manager =to_exynos_crtc (crtc)->manager; + exynos_crtc =to_exynos_crtc (crtc);/* * wait for vblank interrupt * - this makes sure that overlay data are updated to * real hardware. */ -if (manager->ops->wait_for_vblank) - manager->ops->wait_for_vblank (manager); +if (exynos_crtc->ops->wait_for_vblank) + exynos_crtc->ops->wait_for_vblank (exynos_crtc); } }
@@ -447,8 +444,8 @@ int exynos_drm_crtc_get_pipe_from_type(struct drm_device *drm_dev,void exynos_drm_crtc_te_handler (struct drm_crtc *crtc) { -struct exynos_drm_manager *manager =to_exynos_crtc (crtc)->manager; +struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (crtc); -if (manager->ops->te_handler) - manager->ops->te_handler (manager); +if (exynos_crtc->ops->te_handler) + exynos_crtc->ops->te_handler (exynos_crtc); }
drivers/gpu/drm/exynos/exynos_drm_crtc.h +5 -3
@@ -17,9 +17,11 @@#include "exynos_drm_drv.h" -int exynos_drm_crtc_create (struct exynos_drm_manager *manager, -struct drm_device *drm_dev,int pipe, -enum exynos_drm_output_type type); +struct exynos_drm_crtc *exynos_drm_crtc_create (struct drm_device *drm_dev, +int pipe, +enum exynos_drm_output_type type, +struct exynos_drm_crtc_ops *ops, +void *context);int exynos_drm_crtc_enable_vblank (struct drm_device *dev,int pipe);void exynos_drm_crtc_disable_vblank (struct drm_device *dev,int pipe);void exynos_drm_crtc_finish_pageflip (struct drm_device *dev,int pipe);
drivers/gpu/drm/exynos/exynos_drm_drv.h +19 -32
88 lines not on this page · raw message
drivers/gpu/drm/exynos/exynos_drm_fimd.c +58 -63
341 lines not on this page · raw message
drivers/gpu/drm/exynos/exynos_drm_plane.c +13 -13
@@ -68,7 +68,7 @@ int exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc, uint32_t src_w, uint32_t src_h) {struct exynos_drm_plane *exynos_plane =to_exynos_plane (plane); -struct exynos_drm_manager *manager =to_exynos_crtc (crtc)->manager; +struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (crtc);unsigned int actual_w;unsigned int actual_h;int nr;
@@ -133,8 +133,8 @@ int exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc, plane->crtc = crtc; -if (manager->ops->win_mode_set) - manager->ops->win_mode_set (manager, exynos_plane); +if (exynos_crtc->ops->win_mode_set) + exynos_crtc->ops->win_mode_set (exynos_crtc, exynos_plane);return 0 ; }
@@ -142,24 +142,24 @@ int exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc,void exynos_plane_dpms (struct drm_plane *plane,int mode) {struct exynos_drm_plane *exynos_plane =to_exynos_plane (plane); -struct exynos_drm_manager *manager; +struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (plane->crtc);if (mode ==DRM_MODE_DPMS_ON ) {if (exynos_plane->enabled)return ; - manager =to_exynos_crtc (plane->crtc)->manager; -if (manager->ops->win_enable) - manager->ops->win_enable (manager, exynos_plane->zpos); +if (exynos_crtc->ops->win_enable) + exynos_crtc->ops->win_enable (exynos_crtc, + exynos_plane->zpos); exynos_plane->enabled = true; }else {if (!exynos_plane->enabled)return ; - manager =to_exynos_crtc (plane->crtc)->manager; -if (manager->ops->win_disable) - manager->ops->win_disable (manager, exynos_plane->zpos); +if (exynos_crtc->ops->win_disable) + exynos_crtc->ops->win_disable (exynos_crtc, + exynos_plane->zpos); exynos_plane->enabled = false; }
@@ -173,7 +173,7 @@ exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, uint32_t src_w, uint32_t src_h) { -struct exynos_drm_manager *manager =to_exynos_crtc (crtc)->manager; +struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (crtc);struct exynos_drm_plane *exynos_plane =to_exynos_plane (plane);int ret;
@@ -183,8 +183,8 @@ exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,if (ret <0 )return ret; -if (manager->ops->win_commit) - manager->ops->win_commit (manager, exynos_plane->zpos); +if (exynos_crtc->ops->win_commit) + exynos_crtc->ops->win_commit (exynos_crtc, exynos_plane->zpos);return 0 ; }
drivers/gpu/drm/exynos/exynos_drm_vidi.c +35 -44
209 lines not on this page · raw message
drivers/gpu/drm/exynos/exynos_mixer.c +49 -54
267 lines not on this page · raw message
Signature · 1 line
1.9.3
PATCH 20/29 drm/exynos: don't duplicate drm_display_mode in fimd context
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
We can safely use the mode stored in the crtc.
--- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 5 ----- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 12 +----------- 2 files changed, 1 insertion(+), 16 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +0 -5
@@ -89,7 +89,6 @@ exynos_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode, int x, int y, struct drm_framebuffer *old_fb) { - struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc); struct drm_framebuffer *fb = crtc->primary->fb;unsigned int crtc_w;unsigned int crtc_h;
@@ -102,10 +101,6 @@ exynos_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode, crtc_w = fb->width - x; crtc_h = fb->height - y; - -if (exynos_crtc->ops->mode_set) - exynos_crtc->ops->mode_set (exynos_crtc, &crtc->mode); -return exynos_plane_mode_set (crtc->primary, crtc, fb,0 ,0 , crtc_w, crtc_h, x, y, crtc_w, crtc_h); }
drivers/gpu/drm/exynos/exynos_drm_fimd.c +1 -11
@@ -165,7 +165,6 @@ struct fimd_context {struct clk *lcd_clk;void __iomem *regs;struct regmap *sysreg; -struct drm_display_mode mode;struct fimd_win_data win_data[WINDOWS_NR ];unsigned int default_win;unsigned long irq_flags;
@@ -346,18 +345,10 @@ static bool fimd_mode_fixup(struct exynos_drm_crtc *crtc,return true; } -static void fimd_mode_set (struct exynos_drm_crtc *crtc, -const struct drm_display_mode *in_mode) -{ -struct fimd_context *ctx = crtc->ctx; - -drm_mode_copy (&ctx->mode, in_mode); -} -static void fimd_commit (struct exynos_drm_crtc *crtc) {struct fimd_context *ctx = crtc->ctx; -struct drm_display_mode *mode = &ctx->mode; +struct drm_display_mode *mode = &crtc->base.mode;struct fimd_driver_data *driver_data = ctx->driver_data;void *timing_base = ctx->regs + driver_data->timing_base;u32 val, clkdiv;
@@ -1017,7 +1008,6 @@ static void fimd_te_handler(struct exynos_drm_crtc *crtc)static struct exynos_drm_crtc_ops fimd_crtc_ops = { .dpms = fimd_dpms, .mode_fixup = fimd_mode_fixup, - .mode_set = fimd_mode_set, .commit = fimd_commit, .enable_vblank = fimd_enable_vblank, .disable_vblank = fimd_disable_vblank,
Signature · 1 line
1.9.3
PATCH 21/29 drm/exynos: remove mode_set() ops from exynos_crtc
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
It is no longer used anywhere.
--- drivers/gpu/drm/exynos/exynos_drm_drv.h | 3 --- 1 file changed, 3 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_drv.h +0 -3
@@ -167,7 +167,6 @@ struct exynos_drm_display {* * @dpms: control device power. * @mode_fixup: fix mode data before applying it -* @mode_set: set the given mode to the manager * @commit: set current hw specific display mode to hw. * @enable_vblank: specific driver callback for enabling vblank interrupt. * @disable_vblank: specific driver callback for disabling vblank interrupt.
@@ -186,8 +185,6 @@ struct exynos_drm_crtc_ops {bool (*mode_fixup)(struct exynos_drm_crtc *crtc,const struct drm_display_mode *mode,struct drm_display_mode *adjusted_mode); -void (*mode_set)(struct exynos_drm_crtc *crtc, -const struct drm_display_mode *mode);void (*commit)(struct exynos_drm_crtc *crtc);int (*enable_vblank)(struct exynos_drm_crtc *crtc);void (*disable_vblank)(struct exynos_drm_crtc *crtc);
Signature · 1 line
1.9.3
PATCH 22/29 drm/exynos: create exynos_check_plane()
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
Split update plane in two parts, an initial check part that can fail and the update part that can't fail.
This is a important step for the upcoming atomic modesetting support.
--- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 11 ++++++++-- drivers/gpu/drm/exynos/exynos_drm_plane.c | 34 +++++++++++++++++++------------ drivers/gpu/drm/exynos/exynos_drm_plane.h | 11 +++++----- 3 files changed, 36 insertions(+), 20 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +9 -2
@@ -92,6 +92,7 @@ exynos_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode,struct drm_framebuffer *fb = crtc->primary->fb;unsigned int crtc_w;unsigned int crtc_h; +int ret;/* * copy the mode data adjusted by mode_fixup() into crtc->mode
@@ -99,10 +100,16 @@ exynos_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode,*/ memcpy (&crtc->mode, adjusted_mode,sizeof (*adjusted_mode)); + ret =exynos_check_plane (crtc->primary, fb); +if (ret <0 ) +return ret; + crtc_w = fb->width - x; crtc_h = fb->height - y; -return exynos_plane_mode_set (crtc->primary, crtc, fb,0 ,0 , - crtc_w, crtc_h, x, y, crtc_w, crtc_h); +exynos_plane_mode_set (crtc->primary, crtc, fb,0 ,0 , + crtc_w, crtc_h, x, y, crtc_w, crtc_h); + +return 0 ; } static int exynos_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
drivers/gpu/drm/exynos/exynos_drm_plane.c +21 -13
@@ -12,6 +12,7 @@#include <drm/drmP.h> #include <drm/exynos_drm.h> +#include <drm/drm_plane_helper.h> #include "exynos_drm_drv.h" #include "exynos_drm_crtc.h" #include "exynos_drm_fb.h"
@@ -61,16 +62,9 @@ static int exynos_plane_get_size(int start, unsigned length, unsigned last)return size; } -int exynos_plane_mode_set (struct drm_plane *plane,struct drm_crtc *crtc, -struct drm_framebuffer *fb,int crtc_x,int crtc_y, -unsigned int crtc_w,unsigned int crtc_h, -uint32_t src_x,uint32_t src_y, -uint32_t src_w,uint32_t src_h) +int exynos_check_plane (struct drm_plane *plane,struct drm_framebuffer *fb) {struct exynos_drm_plane *exynos_plane =to_exynos_plane (plane); -struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (crtc); -unsigned int actual_w; -unsigned int actual_h;int nr;int i;
@@ -89,6 +83,20 @@ int exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc, i, (unsigned long)exynos_plane->dma_addr[i]); } +return 0 ; +} + +void exynos_plane_mode_set (struct drm_plane *plane,struct drm_crtc *crtc, +struct drm_framebuffer *fb,int crtc_x,int crtc_y, +unsigned int crtc_w,unsigned int crtc_h, +uint32_t src_x,uint32_t src_y, +uint32_t src_w,uint32_t src_h) +{ +struct exynos_drm_plane *exynos_plane =to_exynos_plane (plane); +struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (crtc); +unsigned int actual_w; +unsigned int actual_h; + actual_w =exynos_plane_get_size (crtc_x, crtc_w, crtc->mode.hdisplay); actual_h =exynos_plane_get_size (crtc_y, crtc_h, crtc->mode.vdisplay);
@@ -135,8 +143,6 @@ int exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc,if (exynos_crtc->ops->win_mode_set) exynos_crtc->ops->win_mode_set (exynos_crtc, exynos_plane); - -return 0 ; }void exynos_plane_dpms (struct drm_plane *plane,int mode)
@@ -177,12 +183,14 @@ exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,struct exynos_drm_plane *exynos_plane =to_exynos_plane (plane);int ret; - ret =exynos_plane_mode_set (plane, crtc, fb, crtc_x, crtc_y, - crtc_w, crtc_h, src_x >>16 , src_y >>16 , - src_w >>16 , src_h >>16 ); + ret =exynos_check_plane (plane, fb);if (ret <0 )return ret; +exynos_plane_mode_set (plane, crtc, fb, crtc_x, crtc_y, + crtc_w, crtc_h, src_x >>16 , src_y >>16 , + src_w >>16 , src_h >>16 ); +if (exynos_crtc->ops->win_commit) exynos_crtc->ops->win_commit (exynos_crtc, exynos_plane->zpos);
drivers/gpu/drm/exynos/exynos_drm_plane.h +6 -5
@@ -9,11 +9,12 @@* */ -int exynos_plane_mode_set (struct drm_plane *plane,struct drm_crtc *crtc, -struct drm_framebuffer *fb,int crtc_x,int crtc_y, -unsigned int crtc_w,unsigned int crtc_h, -uint32_t src_x,uint32_t src_y, -uint32_t src_w,uint32_t src_h); +int exynos_check_plane (struct drm_plane *plane,struct drm_framebuffer *fb); +void exynos_plane_mode_set (struct drm_plane *plane,struct drm_crtc *crtc, +struct drm_framebuffer *fb,int crtc_x,int crtc_y, +unsigned int crtc_w,unsigned int crtc_h, +uint32_t src_x,uint32_t src_y, +uint32_t src_w,uint32_t src_h); int exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, struct drm_framebuffer *fb, int crtc_x, int crtc_y, unsigned int crtc_w, unsigned int crtc_h,
Signature · 1 line
1.9.3
PATCH 23/29 drm/exynos: atomic phase 1: use drm_plane_helper_update()
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
Rip out the check from exynos_update_plane() and create exynos_check_plane() for the check phase enabling use to use the atomic helpers to call our check and update phases when updating planes.
Update all users of exynos_update_plane() accordingly to call exynos_check_plane() before.
--- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 32 +++++++++++++------------- drivers/gpu/drm/exynos/exynos_drm_plane.c | 37 ++++++++++++++++++++++--------- drivers/gpu/drm/exynos/exynos_drm_plane.h | 2 +- 3 files changed, 43 insertions(+), 28 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +15 -17
@@ -119,6 +119,7 @@ static int exynos_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,struct drm_framebuffer *fb = crtc->primary->fb;unsigned int crtc_w;unsigned int crtc_h; +int ret;/* when framebuffer changing is requested, crtc's dpms should be on */ if (exynos_crtc->dpms >DRM_MODE_DPMS_ON ) {
@@ -126,11 +127,16 @@ static int exynos_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,return -EPERM ; } + ret =exynos_check_plane (crtc->primary, fb); +if (ret) +return ret; + crtc_w = fb->width - x; crtc_h = fb->height - y; +exynos_update_plane (crtc->primary, crtc, fb,0 ,0 , + crtc_w, crtc_h, x, y, crtc_w, crtc_h); -return exynos_update_plane (crtc->primary, crtc, fb,0 ,0 , - crtc_w, crtc_h, x, y, crtc_w, crtc_h); +return 0 ; }static void exynos_drm_crtc_disable (struct drm_crtc *crtc)
@@ -168,7 +174,6 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,struct drm_device *dev = crtc->dev;struct exynos_drm_private *dev_priv = dev->dev_private;struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (crtc); -struct drm_framebuffer *old_fb = crtc->primary->fb;unsigned int crtc_w, crtc_h;int ret = -EINVAL ;
@@ -181,6 +186,10 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,mutex_lock (&dev->struct_mutex);if (event) { + ret =exynos_check_plane (crtc->primary, fb); +if (ret) + goto out; +/* * the pipe from user always is 0 so we can set pipe number * of current owner to event.
@@ -203,20 +212,9 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc, crtc->primary->fb = fb; crtc_w = fb->width - crtc->x; crtc_h = fb->height - crtc->y; - ret =exynos_update_plane (crtc->primary, crtc, fb,0 ,0 , - crtc_w, crtc_h, crtc->x, crtc->y, - crtc_w, crtc_h); -if (ret) { - crtc->primary->fb = old_fb; - -spin_lock_irq (&dev->event_lock); -drm_vblank_put (dev, exynos_crtc->pipe); -list_del (&event->base.link); -atomic_set (&exynos_crtc->pending_flip,0 ); -spin_unlock_irq (&dev->event_lock); - - goto out; - } +exynos_update_plane (crtc->primary, crtc, fb,0 ,0 , + crtc_w, crtc_h, crtc->x, crtc->y, + crtc_w, crtc_h); } out:mutex_unlock (&dev->struct_mutex);
drivers/gpu/drm/exynos/exynos_drm_plane.c +27 -10
@@ -171,21 +171,15 @@ void exynos_plane_dpms(struct drm_plane *plane, int mode) } } -int +void exynos_update_plane (struct drm_plane *plane,struct drm_crtc *crtc,struct drm_framebuffer *fb,int crtc_x,int crtc_y,unsigned int crtc_w,unsigned int crtc_h,uint32_t src_x,uint32_t src_y,uint32_t src_w,uint32_t src_h) { -struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (crtc);struct exynos_drm_plane *exynos_plane =to_exynos_plane (plane); -int ret; - - ret =exynos_check_plane (plane, fb); -if (ret <0 ) -return ret; exynos_plane_mode_set(plane, crtc, fb, crtc_x, crtc_y, crtc_w, crtc_h, src_x >> 16, src_y >> 16,
@@ -193,8 +187,6 @@ exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,if (exynos_crtc->ops->win_commit) exynos_crtc->ops->win_commit (exynos_crtc, exynos_plane->zpos); - -return 0 ; }static int exynos_disable_plane (struct drm_plane *plane)
@@ -230,12 +222,35 @@ static int exynos_plane_set_property(struct drm_plane *plane, }static struct drm_plane_funcs exynos_plane_funcs = { - .update_plane = exynos_update_plane, + .update_plane = drm_plane_helper_update, .disable_plane = exynos_disable_plane, .destroy = exynos_plane_destroy, .set_property = exynos_plane_set_property, }; +static int exynos_plane_atomic_check (struct drm_plane *plane, +struct drm_plane_state *state) +{ +return exynos_check_plane (plane, state->fb); +} + +static void exynos_plane_atomic_update (struct drm_plane *plane, +struct drm_plane_state *old_state) +{ +struct drm_plane_state *state = plane->state; + +exynos_update_plane (plane, state->crtc, state->fb, + state->crtc_x, state->crtc_y, + state->crtc_w, state->crtc_h, + state->src_x >>16 , state->src_y >>16 , + state->src_w >>16 , state->src_h >>16 ); +} + +static const struct drm_plane_helper_funcs plane_helper_funcs = { + .atomic_check = exynos_plane_atomic_check, + .atomic_update = exynos_plane_atomic_update, +}; +static void exynos_plane_attach_zpos_property (struct drm_plane *plane) {struct drm_device *dev = plane->dev;
@@ -275,6 +290,8 @@ struct drm_plane *exynos_plane_init(struct drm_device *dev,return ERR_PTR (err); } +drm_plane_helper_add (&exynos_plane->base, &plane_helper_funcs); +if (type ==DRM_PLANE_TYPE_PRIMARY ) exynos_plane->zpos =DEFAULT_ZPOS ;else
drivers/gpu/drm/exynos/exynos_drm_plane.h +1 -1
@@ -15,7 +15,7 @@ void exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc, unsigned int crtc_w, unsigned int crtc_h, uint32_t src_x, uint32_t src_y, uint32_t src_w, uint32_t src_h); -int exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, +void exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, struct drm_framebuffer *fb, int crtc_x, int crtc_y, unsigned int crtc_w, unsigned int crtc_h, uint32_t src_x, uint32_t src_y,
Signature · 1 line
1.9.3
PATCH 24/29 drm/exynos: make exynos_plane_mode_set() static
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
It is not used outside of the plane scope anymore.
--- drivers/gpu/drm/exynos/exynos_drm_plane.c | 11 ++++++----- drivers/gpu/drm/exynos/exynos_drm_plane.h | 5 ----- 2 files changed, 6 insertions(+), 10 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_plane.c +6 -5
@@ -86,11 +86,12 @@ int exynos_check_plane(struct drm_plane *plane, struct drm_framebuffer *fb)return 0 ; } -void exynos_plane_mode_set (struct drm_plane *plane,struct drm_crtc *crtc, -struct drm_framebuffer *fb,int crtc_x,int crtc_y, -unsigned int crtc_w,unsigned int crtc_h, -uint32_t src_x,uint32_t src_y, -uint32_t src_w,uint32_t src_h) +static void exynos_plane_mode_set (struct drm_plane *plane,struct drm_crtc *crtc, +struct drm_framebuffer *fb, +int crtc_x,int crtc_y, +unsigned int crtc_w,unsigned int crtc_h, +uint32_t src_x,uint32_t src_y, +uint32_t src_w,uint32_t src_h) {struct exynos_drm_plane *exynos_plane =to_exynos_plane (plane);struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (crtc);
drivers/gpu/drm/exynos/exynos_drm_plane.h +0 -5
@@ -10,11 +10,6 @@*/ int exynos_check_plane (struct drm_plane *plane,struct drm_framebuffer *fb); -void exynos_plane_mode_set (struct drm_plane *plane,struct drm_crtc *crtc, -struct drm_framebuffer *fb,int crtc_x,int crtc_y, -unsigned int crtc_w,unsigned int crtc_h, -uint32_t src_x,uint32_t src_y, -uint32_t src_w,uint32_t src_h); void exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, struct drm_framebuffer *fb, int crtc_x, int crtc_y, unsigned int crtc_w, unsigned int crtc_h,
Signature · 6 lines
1.9.3 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 25/29 drm/exynos: atomic phase 1: use drm_plane_helper_disable()
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
The atomic helper to disable planes also uses exynos_update_plane() to disable plane so we had to adapt it to both commit and disable planes.
A check for NULL CRTC was added to exynos_plane_mode_set() since planes to be disabled have plane_state->crtc set to NULL.
Also win_disable() callback uses plane->crtc as arg for the same reason.
exynos_drm_fb_get_buf_cnt() needs a fb check too to avoid a null pointer.
--- drivers/gpu/drm/exynos/exynos_drm_fb.c | 2 +- drivers/gpu/drm/exynos/exynos_drm_plane.c | 24 ++++++++++++++++++------ 2 files changed, 19 insertions(+), 7 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fb.c +1 -1
@@ -136,7 +136,7 @@ unsigned int exynos_drm_fb_get_buf_cnt(struct drm_framebuffer *fb) exynos_fb =to_exynos_fb (fb); -return exynos_fb->buf_cnt; +return exynos_fb ? exynos_fb->buf_cnt :0 ; } struct drm_framebuffer *
drivers/gpu/drm/exynos/exynos_drm_plane.c +18 -6
@@ -98,6 +98,9 @@ static void exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtcunsigned int actual_w;unsigned int actual_h; +if (!crtc) +return ; + actual_w =exynos_plane_get_size (crtc_x, crtc_w, crtc->mode.hdisplay); actual_h =exynos_plane_get_size (crtc_y, crtc_h, crtc->mode.vdisplay);
@@ -140,8 +143,6 @@ static void exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc exynos_plane->crtc_x, exynos_plane->crtc_y, exynos_plane->crtc_width, exynos_plane->crtc_height); - plane->crtc = crtc; -if (exynos_crtc->ops->win_mode_set) exynos_crtc->ops->win_mode_set (exynos_crtc, exynos_plane); }
@@ -179,15 +180,26 @@ exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, uint32_t src_x, uint32_t src_y, uint32_t src_w, uint32_t src_h) { - struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc); struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane); +struct exynos_drm_crtc *exynos_crtc;exynos_plane_mode_set (plane, crtc, fb, crtc_x, crtc_y, crtc_w, crtc_h, src_x >>16 , src_y >>16 , src_w >>16 , src_h >>16 ); -if (exynos_crtc->ops->win_commit) - exynos_crtc->ops->win_commit (exynos_crtc, exynos_plane->zpos); +if (fb) { + exynos_crtc =to_exynos_crtc (crtc); +if (exynos_crtc->ops->win_commit) + exynos_crtc->ops->win_commit (exynos_crtc, + exynos_plane->zpos); + }else { + exynos_crtc =to_exynos_crtc (plane->crtc); +if (exynos_crtc->ops->win_disable) + exynos_crtc->ops->win_disable (exynos_crtc, + exynos_plane->zpos); + } + + plane->crtc = crtc; }static int exynos_disable_plane (struct drm_plane *plane)
@@ -224,7 +236,7 @@ static int exynos_plane_set_property(struct drm_plane *plane,static struct drm_plane_funcs exynos_plane_funcs = { .update_plane = drm_plane_helper_update, - .disable_plane = exynos_disable_plane, + .disable_plane = drm_plane_helper_disable, .destroy = exynos_plane_destroy, .set_property = exynos_plane_set_property, };
Signature · 6 lines
1.9.3 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 25/29] drm/exynos: atomic phase 1: use drm_plane_helper_disable()
Quoted 5 lines · Gustavo Padovan
From: Gustavo Padovan <[email protected]>
The atomic helper to disable planes also uses
exynos_update_plane()to disable plane so we had to adapt it to both commit and disable planes.
Quoted 8 lines
A check for NULL CRTC was added to
exynos_plane_mode_set()since planes to be disabled haveplane_state->crtcset to NULL.Also
win_disable()callback usesplane->crtcas arg for the same reason.
exynos_drm_fb_get_buf_cnt()needs a fb check too to avoid a null pointer.Signed-off-by Gustavo Padovan <[email protected]>
Thierry has patches to add an optional atomic_disable vfunc to plane helpers, which seems useful for you too. Until that patch has landed maybe just carry Thierry's patch locally. Or undo the merge done here again later on.
-Daniel
Quoted 87 lines
--- drivers/gpu/drm/exynos/exynos_drm_fb.c | 2 +- drivers/gpu/drm/exynos/exynos_drm_plane.c | 24 ++++++++++++++++++------ 2 files changed, 19 insertions(+), 7 deletions(-)drivers/gpu/drm/exynos/exynos_drm_fb.c +1
-1@@ -136,7 +136,7 @@ unsigned int exynos_drm_fb_get_buf_cnt(struct drm_framebuffer *fb) exynos_fb =to_exynos_fb (fb); -return exynos_fb->buf_cnt; +return exynos_fb ? exynos_fb->buf_cnt :0 ; } struct drm_framebuffer *drivers/gpu/drm/exynos/exynos_drm_plane.c +18
-6@@ -98,6 +98,9 @@ static void exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtcunsigned int actual_w;unsigned int actual_h; +if (!crtc) +return ; + actual_w =exynos_plane_get_size (crtc_x, crtc_w, crtc->mode.hdisplay); actual_h =exynos_plane_get_size (crtc_y, crtc_h, crtc->mode.vdisplay);@@ -140,8 +143,6 @@ static void exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc exynos_plane->crtc_x, exynos_plane->crtc_y, exynos_plane->crtc_width, exynos_plane->crtc_height); - plane->crtc = crtc; -if (exynos_crtc->ops->win_mode_set) exynos_crtc->ops->win_mode_set (exynos_crtc, exynos_plane); }@@ -179,15 +180,26 @@ exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, uint32_t src_x, uint32_t src_y, uint32_t src_w, uint32_t src_h) { - struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc); struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane); +struct exynos_drm_crtc *exynos_crtc;exynos_plane_mode_set (plane, crtc, fb, crtc_x, crtc_y, crtc_w, crtc_h, src_x >>16 , src_y >>16 , src_w >>16 , src_h >>16 ); -if (exynos_crtc->ops->win_commit) - exynos_crtc->ops->win_commit (exynos_crtc, exynos_plane->zpos); +if (fb) { + exynos_crtc =to_exynos_crtc (crtc); +if (exynos_crtc->ops->win_commit) + exynos_crtc->ops->win_commit (exynos_crtc, + exynos_plane->zpos); + }else { + exynos_crtc =to_exynos_crtc (plane->crtc); +if (exynos_crtc->ops->win_disable) + exynos_crtc->ops->win_disable (exynos_crtc, + exynos_plane->zpos); + } + + plane->crtc = crtc; }static int exynos_disable_plane (struct drm_plane *plane)@@ -224,7 +236,7 @@ static int exynos_plane_set_property(struct drm_plane *plane,static struct drm_plane_funcs exynos_plane_funcs = { .update_plane = drm_plane_helper_update, - .disable_plane = exynos_disable_plane, + .disable_plane = drm_plane_helper_disable, .destroy = exynos_plane_destroy, .set_property = exynos_plane_set_property, };Signature · 6 lines
1.9.3 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Inki Dae
maintainerRe: [PATCH 25/29] drm/exynos: atomic phase 1: use drm_plane_helper_disable()
In reply to Gustavo PadovanQuoted 23 lines · Gustavo Padovan
From: Gustavo Padovan <[email protected]>
The atomic helper to disable planes also uses
exynos_update_plane()to disable plane so we had to adapt it to both commit and disable planes.A check for NULL CRTC was added to
exynos_plane_mode_set()since planes to be disabled haveplane_state->crtcset to NULL.Also
win_disable()callback usesplane->crtcas arg for the same reason.
exynos_drm_fb_get_buf_cnt()needs a fb check too to avoid a null pointer.Signed-off-by Gustavo Padovan <[email protected]>--- drivers/gpu/drm/exynos/exynos_drm_fb.c | 2 +- drivers/gpu/drm/exynos/exynos_drm_plane.c | 24 ++++++++++++++++++------ 2 files changed, 19 insertions(+), 7 deletions(-)drivers/gpu/drm/exynos/exynos_drm_fb.c +0
-0
drivers/gpu/drm/exynos/exynos_drm_fb.c unsigned int exynos_drm_fb_get_buf_cnt(struct drm_framebuffer *fb) · line 139
Quoted 5 lines
drivers/gpu/drm/exynos/exynos_drm_fb.c +1
-1@@ -136,7 +136,7 @@ unsigned int exynos_drm_fb_get_buf_cnt(struct drm_framebuffer *fb) exynos_fb =to_exynos_fb (fb); -return exynos_fb->buf_cnt; +return exynos_fb ? exynos_fb->buf_cnt :0 ;
This change isn't related with this patch.
drivers/gpu/drm/exynos/exynos_drm_plane.c static void exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc · line 102
Quoted 13 lines
drivers/gpu/drm/exynos/exynos_drm_fb.c +0
-0} struct drm_framebuffer *drivers/gpu/drm/exynos/exynos_drm_plane.c +2
-0@@ -98,6 +98,9 @@ static void exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtcunsigned int actual_w;unsigned int actual_h; +if (!crtc) +return ;
Ditto.
Quoted 53 lines
drivers/gpu/drm/exynos/exynos_drm_plane.c +16
-6+ actual_w =exynos_plane_get_size (crtc_x, crtc_w, crtc->mode.hdisplay); actual_h =exynos_plane_get_size (crtc_y, crtc_h, crtc->mode.vdisplay);@@ -140,8 +143,6 @@ static void exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc exynos_plane->crtc_x, exynos_plane->crtc_y, exynos_plane->crtc_width, exynos_plane->crtc_height); - plane->crtc = crtc; -if (exynos_crtc->ops->win_mode_set) exynos_crtc->ops->win_mode_set (exynos_crtc, exynos_plane); }@@ -179,15 +180,26 @@ exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, uint32_t src_x, uint32_t src_y, uint32_t src_w, uint32_t src_h) { - struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc); struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane); +struct exynos_drm_crtc *exynos_crtc;exynos_plane_mode_set (plane, crtc, fb, crtc_x, crtc_y, crtc_w, crtc_h, src_x >>16 , src_y >>16 , src_w >>16 , src_h >>16 ); -if (exynos_crtc->ops->win_commit) - exynos_crtc->ops->win_commit (exynos_crtc, exynos_plane->zpos); +if (fb) { + exynos_crtc =to_exynos_crtc (crtc); +if (exynos_crtc->ops->win_commit) + exynos_crtc->ops->win_commit (exynos_crtc, + exynos_plane->zpos); + }else { + exynos_crtc =to_exynos_crtc (plane->crtc); +if (exynos_crtc->ops->win_disable) + exynos_crtc->ops->win_disable (exynos_crtc, + exynos_plane->zpos); + } + + plane->crtc = crtc; }static int exynos_disable_plane (struct drm_plane *plane)@@ -224,7 +236,7 @@ static int exynos_plane_set_property(struct drm_plane *plane,static struct drm_plane_funcs exynos_plane_funcs = { .update_plane = drm_plane_helper_update, - .disable_plane = exynos_disable_plane, + .disable_plane = drm_plane_helper_disable, .destroy = exynos_plane_destroy, .set_property = exynos_plane_set_property, };
Re: [PATCH 25/29] drm/exynos: atomic phase 1: use drm_plane_helper_disable()
2014-12-30 Inki Dae <[email protected]>:
Quoted 25 lines · Gustavo Padovan
Quoted 24 lines
From: Gustavo Padovan <[email protected]>
The atomic helper to disable planes also uses
exynos_update_plane()to disable plane so we had to adapt it to both commit and disable planes.A check for NULL CRTC was added to
exynos_plane_mode_set()since planes to be disabled haveplane_state->crtcset to NULL.Also
win_disable()callback usesplane->crtcas arg for the same reason.
exynos_drm_fb_get_buf_cnt()needs a fb check too to avoid a null pointer.Signed-off-by Gustavo Padovan <[email protected]>--- drivers/gpu/drm/exynos/exynos_drm_fb.c | 2 +- drivers/gpu/drm/exynos/exynos_drm_plane.c | 24 ++++++++++++++++++------ 2 files changed, 19 insertions(+), 7 deletions(-)drivers/gpu/drm/exynos/exynos_drm_fb.c +0
-0@@ -136,7 +136,7 @@ unsigned int exynos_drm_fb_get_buf_cnt(struct drm_framebuffer *fb)
Quoted 6 lines
drivers/gpu/drm/exynos/exynos_drm_fb.c unsigned int exynos_drm_fb_get_buf_cnt(struct drm_framebuffer *fb) · line 139
Quoted 4 lines
drivers/gpu/drm/exynos/exynos_drm_fb.c +1
-1exynos_fb =to_exynos_fb (fb); -return exynos_fb->buf_cnt; +return exynos_fb ? exynos_fb->buf_cnt :0 ;This change isn't related with this patch.
This patch will be reworked to use atomic_disable() as suggested by Daniel Vetter in the previous comment.
Gustavo
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 26/29 drm/exynos: atomic phase 1: add atomic_begin()/atomic_flush()
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
Add CRTC callbacks .atomic_begin() .atomic_flush(). On exynos they unprotect the windows before the commit and protects it after based on a plane mask tha store which plane will be updated.
For that we create two new exynos_crtc callbacks: .win_protect() and .win_unprotect(). The only driver that implement those now is FIMD.
--- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 34 +++++++++++++++++++ drivers/gpu/drm/exynos/exynos_drm_drv.h | 4 +++ drivers/gpu/drm/exynos/exynos_drm_fimd.c | 56 ++++++++++++++++++++++--------- drivers/gpu/drm/exynos/exynos_drm_plane.c | 4 +++ 4 files changed, 82 insertions(+), 16 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +34 -0
@@ -156,6 +156,38 @@ static void exynos_drm_crtc_disable(struct drm_crtc *crtc) } } +static void exynos_crtc_atomic_begin (struct drm_crtc *crtc) +{ +struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (crtc); +struct drm_plane *plane; +int index =0 ; + +list_for_each_entry (plane, &crtc->dev->mode_config.plane_list, head) { +if (exynos_crtc->ops->win_protect && + exynos_crtc->plane_mask & (0x01 << index)) + exynos_crtc->ops->win_protect (exynos_crtc, index); + + index++; + } +} + +static void exynos_crtc_atomic_flush (struct drm_crtc *crtc) +{ +struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (crtc); +struct drm_plane *plane; +int index =0 ; + +list_for_each_entry (plane, &crtc->dev->mode_config.plane_list, head) { +if (exynos_crtc->ops->win_unprotect && + exynos_crtc->plane_mask & (0x01 << index)) + exynos_crtc->ops->win_unprotect (exynos_crtc, index); + + index++; + } + + exynos_crtc->plane_mask =0 ; +} +static struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = { .dpms = exynos_drm_crtc_dpms, .prepare = exynos_drm_crtc_prepare,
@@ -164,6 +196,8 @@ static struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = { .mode_set = exynos_drm_crtc_mode_set, .mode_set_base = exynos_drm_crtc_mode_set_base, .disable = exynos_drm_crtc_disable, + .atomic_begin = exynos_crtc_atomic_begin, + .atomic_flush = exynos_crtc_atomic_flush, }; static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,
drivers/gpu/drm/exynos/exynos_drm_drv.h +4 -0
@@ -195,6 +195,8 @@ struct exynos_drm_crtc_ops {void (*win_enable)(struct exynos_drm_crtc *crtc,int zpos);void (*win_disable)(struct exynos_drm_crtc *crtc,int zpos);void (*te_handler)(struct exynos_drm_crtc *crtc); +void (*win_protect)(struct exynos_drm_crtc *crtc,int zpos); +void (*win_unprotect)(struct exynos_drm_crtc *crtc,int zpos); };enum exynos_crtc_mode {
@@ -215,6 +217,7 @@ enum exynos_crtc_mode {* we can refer to the crtc to current hardware interrupt occurred through * this pipe value. * @dpms: store the crtc dpms value +* @plane_mask: store planes to be updated on atomic modesetting * @mode: store the crtc mode value * @ops: pointer to callbacks for exynos drm specific functionality * @ctx: A pointer to the crtc's implementation specific context
@@ -224,6 +227,7 @@ struct exynos_drm_crtc {enum exynos_drm_output_type type;unsigned int pipe;unsigned int dpms; +unsigned int plane_mask;enum exynos_crtc_mode mode;wait_queue_head_t pending_flip_queue;atomic_t pending_flip;
drivers/gpu/drm/exynos/exynos_drm_fimd.c +40 -16
86 lines not on this page · raw message
drivers/gpu/drm/exynos/exynos_drm_plane.c +4 -0
@@ -65,6 +65,7 @@ static int exynos_plane_get_size(int start, unsigned length, unsigned last)int exynos_check_plane (struct drm_plane *plane,struct drm_framebuffer *fb) {struct exynos_drm_plane *exynos_plane =to_exynos_plane (plane); +struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (plane->crtc);int nr;int i;
@@ -83,6 +84,9 @@ int exynos_check_plane(struct drm_plane *plane, struct drm_framebuffer *fb) i, (unsigned long)exynos_plane->dma_addr[i]); } +if (exynos_crtc) + exynos_crtc->plane_mask +=1 << exynos_plane->zpos; +return 0 ; }
Signature · 6 lines
1.9.3 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Inki Dae
maintainerRe: [PATCH 26/29] drm/exynos: atomic phase 1: add atomic_begin()/atomic_flush()
Quoted 5 lines · Gustavo Padovan
From: Gustavo Padovan <[email protected]>
Add CRTC callbacks .atomic_begin() .atomic_flush(). On exynos they unprotect the windows before the commit and protects it after based on a plane mask tha store which plane will be updated.
tha? Typo?
Quoted 17 lines
For that we create two new
exynos_crtccallbacks: .win_protect() and .win_unprotect(). The only driver that implement those now is FIMD.Signed-off-by Gustavo Padovan <[email protected]>--- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 34 +++++++++++++++++++ drivers/gpu/drm/exynos/exynos_drm_drv.h | 4 +++ drivers/gpu/drm/exynos/exynos_drm_fimd.c | 56 ++++++++++++++++++++++--------- drivers/gpu/drm/exynos/exynos_drm_plane.c | 4 +++ 4 files changed, 82 insertions(+), 16 deletions(-)drivers/gpu/drm/exynos/exynos_drm_crtc.c +0
-0
drivers/gpu/drm/exynos/exynos_drm_crtc.c static void exynos_drm_crtc_disable(struct drm_crtc *crtc) · line 164
Quoted 9 lines
drivers/gpu/drm/exynos/exynos_drm_crtc.c +6
-0@@ -156,6 +156,38 @@ static void exynos_drm_crtc_disable(struct drm_crtc *crtc) } } +static void exynos_crtc_atomic_begin (struct drm_crtc *crtc) +{ +struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (crtc); +struct drm_plane *plane; +int index =0 ; +
Isn't drm_modest_lock_all(dev) required? Or is this function atomic context? I didn't look into all codes yet so there may be my missing point.
Quoted 5 lines
drivers/gpu/drm/exynos/exynos_drm_crtc.c +5
-0+list_for_each_entry (plane, &crtc->dev->mode_config.plane_list, head) { +if (exynos_crtc->ops->win_protect && + exynos_crtc->plane_mask & (0x01 << index)) + exynos_crtc->ops->win_protect (exynos_crtc, index); +
drivers/gpu/drm/exynos/exynos_drm_crtc.c static void exynos_drm_crtc_disable(struct drm_crtc *crtc) · line 179
Quoted 10 lines
drivers/gpu/drm/exynos/exynos_drm_crtc.c +10
-0+ index++; + } +} + +static void exynos_crtc_atomic_flush (struct drm_crtc *crtc) +{ +struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (crtc); +struct drm_plane *plane; +int index =0 ; +
Ditto.
Quoted 79 lines
drivers/gpu/drm/exynos/exynos_drm_crtc.c +13
-0+list_for_each_entry (plane, &crtc->dev->mode_config.plane_list, head) { +if (exynos_crtc->ops->win_unprotect && + exynos_crtc->plane_mask & (0x01 << index)) + exynos_crtc->ops->win_unprotect (exynos_crtc, index); + + index++; + } + + exynos_crtc->plane_mask =0 ; +} +static struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = { .dpms = exynos_drm_crtc_dpms, .prepare = exynos_drm_crtc_prepare,@@ -164,6 +196,8 @@ static struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = { .mode_set = exynos_drm_crtc_mode_set, .mode_set_base = exynos_drm_crtc_mode_set_base, .disable = exynos_drm_crtc_disable, + .atomic_begin = exynos_crtc_atomic_begin, + .atomic_flush = exynos_crtc_atomic_flush, }; static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,drivers/gpu/drm/exynos/exynos_drm_drv.h +4
-0@@ -195,6 +195,8 @@ struct exynos_drm_crtc_ops {void (*win_enable)(struct exynos_drm_crtc *crtc,int zpos);void (*win_disable)(struct exynos_drm_crtc *crtc,int zpos);void (*te_handler)(struct exynos_drm_crtc *crtc); +void (*win_protect)(struct exynos_drm_crtc *crtc,int zpos); +void (*win_unprotect)(struct exynos_drm_crtc *crtc,int zpos); };enum exynos_crtc_mode {@@ -215,6 +217,7 @@ enum exynos_crtc_mode {* we can refer to the crtc to current hardware interrupt occurred through * this pipe value. * @dpms: store the crtc dpms value +* @plane_mask: store planes to be updated on atomic modesetting * @mode: store the crtc mode value * @ops: pointer to callbacks for exynos drm specific functionality * @ctx: A pointer to the crtc's implementation specific context @@ -224,6 +227,7 @@ struct exynos_drm_crtc {enum exynos_drm_output_type type;unsigned int pipe;unsigned int dpms; +unsigned int plane_mask;enum exynos_crtc_mode mode;wait_queue_head_t pending_flip_queue;atomic_t pending_flip;drivers/gpu/drm/exynos/exynos_drm_fimd.c +10
-2@@ -644,6 +644,16 @@ static void fimd_shadow_protect_win(struct fimd_context *ctx, {u32 reg, bits, val; +/* +* SHADOWCON/PRTCON register is used for enabling timing. +* +* for example, once only width value of a register is set, +* if the dma is started then fimd hardware could malfunction so +* with protect window setting, the register fields with prefix '_F' +* wouldn't be updated at vsync also but updated once unprotect window +* is set. +*/ +if (ctx->driver_data->has_shadowcon) { reg =SHADOWCON ; bits =SHADOWCON_WINx_PROTECT (win);@@ -686,19 +696,6 @@ static void fimd_win_commit(struct exynos_drm_crtc *crtc, int zpos)return ; } -/* -* SHADOWCON/PRTCON register is used for enabling timing.
drivers/gpu/drm/exynos/exynos_drm_fimd.c static void fimd_win_commit(struct exynos_drm_crtc *crtc, int zpos) · line 700
Quoted 10 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +0
-10-* -* for example, once only width value of a register is set, -* if the dma is started then fimd hardware could malfunction so -* with protect window setting, the register fields with prefix '_F' -* wouldn't be updated at vsync also but updated once unprotect window -* is set. -*/ - -/* protect windows */ -fimd_shadow_protect_win (ctx, win, true);
fimd_win_commit can be called by setmode, setplane or page flip request. If you remove this function call, these operations will not work correctly because the registers related to overlay should be updated together. Your patch is considered only for atomic page flip or mode setting.
Thanks,
Inki Dae
Quoted 81 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +30
-4-/* buffer start address */ val = (unsigned long )win_data->dma_addr;writel (val, ctx->regs +VIDWx_BUF_START (win,0 ));@@ -774,9 +771,6 @@ static void fimd_win_commit(struct exynos_drm_crtc *crtc, int zpos)if (ctx->driver_data->has_shadowcon)fimd_enable_shadow_channel_path (ctx, win, true); -/* Enable DMA channel and unprotect windows */ -fimd_shadow_protect_win (ctx, win, false); - win_data->enabled = true;if (ctx->i80_if)@@ -1005,6 +999,34 @@ static void fimd_te_handler(struct exynos_drm_crtc *crtc)drm_handle_vblank (ctx->drm_dev, ctx->pipe); } +static void fimd_win_protect (struct exynos_drm_crtc *crtc,int zpos) +{ +struct fimd_context *ctx = crtc->ctx; +int win = zpos; + +if (win ==DEFAULT_ZPOS ) + win = ctx->default_win; + +if (win <0 || win >=WINDOWS_NR ) +return ; + +fimd_shadow_protect_win (ctx, win, true); +} + +static void fimd_win_unprotect (struct exynos_drm_crtc *crtc,int zpos) +{ +struct fimd_context *ctx = crtc->ctx; +int win = zpos; + +if (win ==DEFAULT_ZPOS ) + win = ctx->default_win; + +if (win <0 || win >=WINDOWS_NR ) +return ; + +fimd_shadow_protect_win (ctx, win, false); +} +static struct exynos_drm_crtc_ops fimd_crtc_ops = { .dpms = fimd_dpms, .mode_fixup = fimd_mode_fixup,@@ -1016,6 +1038,8 @@ static struct exynos_drm_crtc_ops fimd_crtc_ops = { .win_commit = fimd_win_commit, .win_disable = fimd_win_disable, .te_handler = fimd_te_handler, + .win_protect = fimd_win_protect, + .win_unprotect = fimd_win_unprotect, };static irqreturn_t fimd_irq_handler (int irq,void *dev_id)drivers/gpu/drm/exynos/exynos_drm_plane.c +4
-0@@ -65,6 +65,7 @@ static int exynos_plane_get_size(int start, unsigned length, unsigned last)int exynos_check_plane (struct drm_plane *plane,struct drm_framebuffer *fb) {struct exynos_drm_plane *exynos_plane =to_exynos_plane (plane); +struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (plane->crtc);int nr;int i;@@ -83,6 +84,9 @@ int exynos_check_plane(struct drm_plane *plane, struct drm_framebuffer *fb) i, (unsigned long)exynos_plane->dma_addr[i]); } +if (exynos_crtc) + exynos_crtc->plane_mask +=1 << exynos_plane->zpos; +return 0 ; }
Re: [PATCH 26/29] drm/exynos: atomic phase 1: add atomic_begin()/atomic_flush()
2014-12-30 Inki Dae <[email protected]>:
Quoted 8 lines · Gustavo Padovan
Quoted 5 lines
From: Gustavo Padovan <[email protected]>
Add CRTC callbacks .atomic_begin() .atomic_flush(). On exynos they unprotect the windows before the commit and protects it after based on a plane mask tha store which plane will be updated.
tha? Typo?
Okay.
Quoted 21 lines
Quoted 21 lines
For that we create two new
exynos_crtccallbacks: .win_protect() and .win_unprotect(). The only driver that implement those now is FIMD.Signed-off-by Gustavo Padovan <[email protected]>--- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 34 +++++++++++++++++++ drivers/gpu/drm/exynos/exynos_drm_drv.h | 4 +++ drivers/gpu/drm/exynos/exynos_drm_fimd.c | 56 ++++++++++++++++++++++--------- drivers/gpu/drm/exynos/exynos_drm_plane.c | 4 +++ 4 files changed, 82 insertions(+), 16 deletions(-)drivers/gpu/drm/exynos/exynos_drm_crtc.c +0
-0@@ -156,6 +156,38 @@ static void exynos_drm_crtc_disable(struct drm_crtc *crtc) } }
Quoted 9 lines
drivers/gpu/drm/exynos/exynos_drm_crtc.c static void exynos_drm_crtc_disable(struct drm_crtc *crtc) · line 164
Quoted 6 lines
drivers/gpu/drm/exynos/exynos_drm_crtc.c +6
-0+static void exynos_crtc_atomic_begin (struct drm_crtc *crtc) +{ +struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (crtc); +struct drm_plane *plane; +int index =0 ; +Isn't
drm_modest_lock_all(dev)required? Or is this function atomic context? I didn't look into all codes yet so there may be my missing point.
the atomic code already protects it by calling drm_modeset_lock_all() so we are running in a safe context.
Gustavo
PATCH 27/29 drm/exynos: atomic phase 1: add .mode_set_nofb() callback
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
The new atomic infrastructure needs the .mode_set_nofb() callback to update CRTC timings before setting any plane.
--- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 61 ++++++++------------------------ 1 file changed, 14 insertions(+), 47 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +14 -47
@@ -84,15 +84,16 @@ exynos_drm_crtc_mode_fixup(struct drm_crtc *crtc,return true; } -static int -exynos_drm_crtc_mode_set (struct drm_crtc *crtc,struct drm_display_mode *mode, -struct drm_display_mode *adjusted_mode,int x,int y, -struct drm_framebuffer *old_fb) +static void +exynos_drm_crtc_mode_set_nofb (struct drm_crtc *crtc) { -struct drm_framebuffer *fb = crtc->primary->fb; -unsigned int crtc_w; -unsigned int crtc_h; -int ret; +struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (crtc); +struct drm_display_mode *adjusted_mode; + +if (WARN_ON (!crtc->state)) +return ; + + adjusted_mode = &crtc->state->adjusted_mode;/* * copy the mode data adjusted by mode_fixup() into crtc->mode
@@ -100,43 +101,8 @@ exynos_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode,*/ memcpy (&crtc->mode, adjusted_mode,sizeof (*adjusted_mode)); - ret =exynos_check_plane (crtc->primary, fb); -if (ret <0 ) -return ret; - - crtc_w = fb->width - x; - crtc_h = fb->height - y; -exynos_plane_mode_set (crtc->primary, crtc, fb,0 ,0 , - crtc_w, crtc_h, x, y, crtc_w, crtc_h); - -return 0 ; -} - -static int exynos_drm_crtc_mode_set_base (struct drm_crtc *crtc,int x,int y, -struct drm_framebuffer *old_fb) -{ -struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (crtc); -struct drm_framebuffer *fb = crtc->primary->fb; -unsigned int crtc_w; -unsigned int crtc_h; -int ret; - -/* when framebuffer changing is requested, crtc's dpms should be on */ -if (exynos_crtc->dpms >DRM_MODE_DPMS_ON ) { -DRM_ERROR ("failed framebuffer changing request.\n" ); -return -EPERM ; - } - - ret =exynos_check_plane (crtc->primary, fb); -if (ret) -return ret; - - crtc_w = fb->width - x; - crtc_h = fb->height - y; -exynos_update_plane (crtc->primary, crtc, fb,0 ,0 , - crtc_w, crtc_h, x, y, crtc_w, crtc_h); - -return 0 ; +if (exynos_crtc->ops->commit) + exynos_crtc->ops->commit (exynos_crtc); }static void exynos_drm_crtc_disable (struct drm_crtc *crtc)
@@ -193,8 +159,9 @@ static struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = { .prepare = exynos_drm_crtc_prepare, .commit = exynos_drm_crtc_commit, .mode_fixup = exynos_drm_crtc_mode_fixup, - .mode_set = exynos_drm_crtc_mode_set, - .mode_set_base = exynos_drm_crtc_mode_set_base, + .mode_set = drm_helper_crtc_mode_set, + .mode_set_nofb = exynos_drm_crtc_mode_set_nofb, + .mode_set_base = drm_helper_crtc_mode_set_base, .disable = exynos_drm_crtc_disable, .atomic_begin = exynos_crtc_atomic_begin, .atomic_flush = exynos_crtc_atomic_flush,
Signature · 1 line
1.9.3
PATCH 28/29 drm/exynos: atomic phase 2: wire up state reset(), duplicate() and destroy()
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
Set CRTC, planes and connectors to use the default implementations from the atomic helper library. The helpers will work to keep track of state for each DRM object.
--- drivers/gpu/drm/bridge/ptn3460.c | 4 ++++ drivers/gpu/drm/exynos/exynos_dp_core.c | 4 ++++ drivers/gpu/drm/exynos/exynos_drm_connector.c | 4 ++++ drivers/gpu/drm/exynos/exynos_drm_crtc.c | 5 +++++ drivers/gpu/drm/exynos/exynos_drm_dpi.c | 4 ++++ drivers/gpu/drm/exynos/exynos_drm_drv.c | 2 ++ drivers/gpu/drm/exynos/exynos_drm_dsi.c | 4 ++++ drivers/gpu/drm/exynos/exynos_drm_plane.c | 4 ++++ drivers/gpu/drm/exynos/exynos_drm_vidi.c | 4 ++++ drivers/gpu/drm/exynos/exynos_hdmi.c | 4 ++++ 10 files changed, 39 insertions(+)
drivers/gpu/drm/bridge/ptn3460.c +4 -0
@@ -24,6 +24,7 @@#include "drm_edid.h" #include "drm_crtc.h" #include "drm_crtc_helper.h" +#include "drm_atomic_helper.h" #include "bridge/ptn3460.h"
@@ -255,6 +256,9 @@ struct drm_connector_funcs ptn3460_connector_funcs = { .fill_modes = drm_helper_probe_single_connector_modes, .detect = ptn3460_detect, .destroy = ptn3460_connector_destroy, + .reset = drm_atomic_helper_connector_reset, + .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, }; int ptn3460_init(struct drm_device *dev, struct drm_encoder *encoder,
drivers/gpu/drm/exynos/exynos_dp_core.c +4 -0
@@ -27,6 +27,7 @@#include <drm/drmP.h> #include <drm/drm_crtc.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_atomic_helper.h> #include <drm/drm_panel.h> #include <drm/bridge/ptn3460.h>
@@ -951,6 +952,9 @@ static struct drm_connector_funcs exynos_dp_connector_funcs = { .fill_modes = drm_helper_probe_single_connector_modes, .detect = exynos_dp_detect, .destroy = exynos_dp_connector_destroy, + .reset = drm_atomic_helper_connector_reset, + .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };static int exynos_dp_get_modes (struct drm_connector *connector)
drivers/gpu/drm/exynos/exynos_drm_connector.c +4 -0
@@ -13,6 +13,7 @@#include <drm/drmP.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_atomic_helper.h> #include <drm/exynos_drm.h> #include "exynos_drm_drv.h"
@@ -182,6 +183,9 @@ static struct drm_connector_funcs exynos_connector_funcs = { .fill_modes = exynos_drm_connector_fill_modes, .detect = exynos_drm_connector_detect, .destroy = exynos_drm_connector_destroy, + .reset = drm_atomic_helper_connector_reset, + .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, }; struct drm_connector *exynos_drm_connector_create(struct drm_device *dev,
drivers/gpu/drm/exynos/exynos_drm_crtc.c +5 -0
@@ -14,6 +14,8 @@#include <drm/drmP.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_atomic.h> +#include <drm/drm_atomic_helper.h> #include "exynos_drm_crtc.h" #include "exynos_drm_drv.h"
@@ -271,6 +273,9 @@ static struct drm_crtc_funcs exynos_crtc_funcs = { .page_flip = exynos_drm_crtc_page_flip, .destroy = exynos_drm_crtc_destroy, .set_property = exynos_drm_crtc_set_property, + .reset = drm_atomic_helper_crtc_reset, + .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, };static const struct drm_prop_enum_list mode_names[] = {
drivers/gpu/drm/exynos/exynos_drm_dpi.c +4 -0
@@ -13,6 +13,7 @@#include <drm/drmP.h> #include <drm/drm_crtc_helper.h> #include <drm/drm_panel.h> +#include <drm/drm_atomic_helper.h> #include <linux/regulator/consumer.h>
@@ -63,6 +64,9 @@ static struct drm_connector_funcs exynos_dpi_connector_funcs = { .detect = exynos_dpi_detect, .fill_modes = drm_helper_probe_single_connector_modes, .destroy = exynos_dpi_connector_destroy, + .reset = drm_atomic_helper_connector_reset, + .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };static int exynos_dpi_get_modes (struct drm_connector *connector)
drivers/gpu/drm/exynos/exynos_drm_drv.c +2 -0
@@ -113,6 +113,8 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags)if (ret) goto err_cleanup_vblank; +drm_mode_config_reset (dev); +/* * enable drm irq mode. * - with irq_enabled = true, we can use the vblank feature.
drivers/gpu/drm/exynos/exynos_drm_dsi.c +4 -0
@@ -14,6 +14,7 @@#include <drm/drm_crtc_helper.h> #include <drm/drm_mipi_dsi.h> #include <drm/drm_panel.h> +#include <drm/drm_atomic_helper.h> #include <linux/clk.h> #include <linux/gpio/consumer.h>
@@ -1461,6 +1462,9 @@ static struct drm_connector_funcs exynos_dsi_connector_funcs = { .detect = exynos_dsi_detect, .fill_modes = drm_helper_probe_single_connector_modes, .destroy = exynos_dsi_connector_destroy, + .reset = drm_atomic_helper_connector_reset, + .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };static int exynos_dsi_get_modes (struct drm_connector *connector)
drivers/gpu/drm/exynos/exynos_drm_plane.c +4 -0
@@ -13,6 +13,7 @@#include <drm/exynos_drm.h> #include <drm/drm_plane_helper.h> +#include <drm/drm_atomic_helper.h> #include "exynos_drm_drv.h" #include "exynos_drm_crtc.h" #include "exynos_drm_fb.h"
@@ -243,6 +244,9 @@ static struct drm_plane_funcs exynos_plane_funcs = { .disable_plane = drm_plane_helper_disable, .destroy = exynos_plane_destroy, .set_property = exynos_plane_set_property, + .reset = drm_atomic_helper_plane_reset, + .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, }; static int exynos_plane_atomic_check(struct drm_plane *plane,
drivers/gpu/drm/exynos/exynos_drm_vidi.c +4 -0
@@ -20,6 +20,7 @@#include <drm/drm_edid.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_atomic_helper.h> #include "exynos_drm_drv.h" #include "exynos_drm_crtc.h"
@@ -472,6 +473,9 @@ static struct drm_connector_funcs vidi_connector_funcs = { .fill_modes = drm_helper_probe_single_connector_modes, .detect = vidi_detect, .destroy = vidi_connector_destroy, + .reset = drm_atomic_helper_connector_reset, + .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };static int vidi_get_modes (struct drm_connector *connector)
drivers/gpu/drm/exynos/exynos_hdmi.c +4 -0
@@ -17,6 +17,7 @@#include <drm/drmP.h> #include <drm/drm_edid.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_atomic_helper.h> #include "regs-hdmi.h"
@@ -1054,6 +1055,9 @@ static struct drm_connector_funcs hdmi_connector_funcs = { .fill_modes = drm_helper_probe_single_connector_modes, .detect = hdmi_detect, .destroy = hdmi_connector_destroy, + .reset = drm_atomic_helper_connector_reset, + .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };static int hdmi_get_modes (struct drm_connector *connector)
Signature · 6 lines
1.9.3 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 29/29 drm/exynos: atomic phase 2: keep track of framebuffer pointer
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
Use drm_atomic_set_fb_for_plane() in the legacy page_flip path to keep track of the framebuffer pointer and reference.
--- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +4 -0
@@ -219,6 +219,10 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc, crtc_w, crtc_h, crtc->x, crtc->y, crtc_w, crtc_h); } + +if (crtc->primary->state) +drm_atomic_set_fb_for_plane (crtc->primary->state, fb); + out:mutex_unlock (&dev->struct_mutex);return ret;
Signature · 6 lines
1.9.3 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Inki Dae
maintainerHi,
2014-12-18 22:58 GMT+09:00 Gustavo Padovan <[email protected]>:
Quoted 21 lines
From: Gustavo Padovan <[email protected]>
Hi,
In this series:
- fix to FIMD pageflips, only finish pageflips if START ==
START_S.- remove struct
exynos_drm_overlayand structexynos_drm_manager.exynos_drm_overlaywas merged withexynos_drm_planeandexynos_drm_managerwithexynos_drm_crtcremoving two extra and unnecessary abstractions levels from the exynos code. It also makes understanding of the code easier since now we talk using known names like CRTC and Planes instead of manager and overlay.- remove DPMS operations from places where it is not need, e.g., updating planes. Only full modesets should use DPMS operations.
- unify plane update on
exynos_update_plane(). Now all pieces of code that wants to update a plane should be using this function.
Quoted 7 lines
- atomic phase 1 and 2: set all the helpers and new callbacks needed to port drm-exynos to atomic. pahse 3 is a work in progress.
There are also some smalls fixes and clean ups.
This is rebased on dri-devel/drm-next to benefit from the lastests atomic changes.
Merged only cleanup parts - 2 through 21 - to exynos-drm-next. I will have pull request within a week after testing.
p.s. please keep that patch series has consistency of previous ones from next time.
Thanks,
Inki Dae
Quoted 76 lines
Gustavo
---
The following changes since commit4e0cd68115620bc3236ff4e58e4c073948629b41:drm: sti: fix module compilation issue (2014-12-15 17:07:57 +1000)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/padovan/drm-exynos.gitfor-drm-nextfor you to fetch changes up to
26d5e29b5613fb466b3cb04ddbdef371aa3f1596:drm/exynos: atomic phase 2: keep track of framebuffer pointer (2014-12-18 11:30:16 -0200)
Daniel Kurtz (1):
drm/exynos/fimd: only finish pageflip if START ==START_SGustavo Padovan (28):
drm/exynos: moveto_exynos_crtc()macro to main header drm/exynos: expose structexynos_drm_crtc
drm/exynos: remove exynos_drm_crtc_plane_* wrappers drm/exynos: remove structexynos_drm_overlaydrm/exynos/fimd: don't initialize 'ret' variable infimd_probe()drm/exynos/vidi: remove uselessops->commit()drm/exynos: Don't touch DPMS when updating overlay planes drm/exynos: don't do any DPMS operation while updating planes drm/exynos: removeexynos_plane_commit()wrapper drm/exynos: unify plane update onexynos_update_plane()drm/exynos: callexynos_update_plane()directly on page flips drm/exynos: removeexynos_drm_crtc_mode_set_commit()drm/exynos: rename base object of structexynos_drm_crtcto 'base' drm/exynos: add pipe param toexynos_drm_crtc_create()drm/exynos: remove pipe member of structexynos_drm_managerdrm/exynos: move 'type' from manager to crtc struct drm/exynos: removedrm_devfrom structexynos_drm_managerdrm/exynos: remove structexynos_drm_managerdrm/exynos: don't duplicatedrm_display_modein fimd context drm/exynos: removemode_set()ops fromexynos_crtcdrm/exynos: createexynos_check_plane()
drm/exynos: atomic phase 1: usedrm_plane_helper_update()drm/exynos: makeexynos_plane_mode_set()static drm/exynos: atomic phase 1: usedrm_plane_helper_disable()drm/exynos: atomic phase 1: add atomic_begin()/atomic_flush() drm/exynos: atomic phase 1: add .mode_set_nofb() callback drm/exynos: atomic phase 2: wire up statereset(),duplicate()and
destroy()
drm/exynos: atomic phase 2: keep track of framebuffer pointerdrivers/gpu/drm/bridge/ptn3460.c | 4 + drivers/gpu/drm/exynos/exynos_dp_core.c | 4 + drivers/gpu/drm/exynos/exynos_drm_connector.c | 4 + drivers/gpu/drm/exynos/exynos_drm_crtc.c | 273 ++++++++++---------------- drivers/gpu/drm/exynos/exynos_drm_crtc.h | 8 +- drivers/gpu/drm/exynos/exynos_drm_dpi.c | 4 + drivers/gpu/drm/exynos/exynos_drm_drv.c | 2 + drivers/gpu/drm/exynos/exynos_drm_drv.h | 87 +++++--- drivers/gpu/drm/exynos/exynos_drm_dsi.c | 4 + drivers/gpu/drm/exynos/exynos_drm_fb.c | 2 +- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 263 ++++++++++++++----------- drivers/gpu/drm/exynos/exynos_drm_plane.c | 196 ++++++++++-------- drivers/gpu/drm/exynos/exynos_drm_plane.h | 12 +- drivers/gpu/drm/exynos/exynos_drm_vidi.c | 139 ++++++------- drivers/gpu/drm/exynos/exynos_hdmi.c | 4 + drivers/gpu/drm/exynos/exynos_mixer.c | 159 ++++++++------- include/video/samsung_fimd.h | 1 + 17 files changed, 601 insertions(+), 565 deletions(-)--
1.9.3_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel