aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucas Stach <l.stach@pengutronix.de>2016-02-04 04:15:10 -0500
committerPhilipp Zabel <p.zabel@pengutronix.de>2016-03-01 02:33:40 -0500
commit0bfc2b3d01feaedff65c27a36eab0d428190947d (patch)
treeee77f61606fc3efaa42e1f49679b5d768d2c5916
parentf5dca1608bc724236dd951d23420283cf59486e4 (diff)
drm/imx: track flip state explicitly
Start tracking the flip state explicitly, as opposed to inferring it from the presence if a new FB. This is a preparatory step to introduce an new immediate state, where we can wait for a fence to signal. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
-rw-r--r--drivers/gpu/drm/imx/ipuv3-crtc.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/gpu/drm/imx/ipuv3-crtc.c b/drivers/gpu/drm/imx/ipuv3-crtc.c
index 319457416042..50ccc08abec7 100644
--- a/drivers/gpu/drm/imx/ipuv3-crtc.c
+++ b/drivers/gpu/drm/imx/ipuv3-crtc.c
@@ -31,6 +31,11 @@
31 31
32#define DRIVER_DESC "i.MX IPUv3 Graphics" 32#define DRIVER_DESC "i.MX IPUv3 Graphics"
33 33
34enum ipu_flip_status {
35 IPU_FLIP_NONE,
36 IPU_FLIP_PENDING,
37};
38
34struct ipu_crtc { 39struct ipu_crtc {
35 struct device *dev; 40 struct device *dev;
36 struct drm_crtc base; 41 struct drm_crtc base;
@@ -42,8 +47,8 @@ struct ipu_crtc {
42 struct ipu_dc *dc; 47 struct ipu_dc *dc;
43 struct ipu_di *di; 48 struct ipu_di *di;
44 int enabled; 49 int enabled;
50 enum ipu_flip_status flip_state;
45 struct drm_pending_vblank_event *page_flip_event; 51 struct drm_pending_vblank_event *page_flip_event;
46 struct drm_framebuffer *newfb;
47 int irq; 52 int irq;
48 u32 bus_format; 53 u32 bus_format;
49 int di_hsync_pin; 54 int di_hsync_pin;
@@ -110,7 +115,7 @@ static int ipu_page_flip(struct drm_crtc *crtc,
110 struct ipu_crtc *ipu_crtc = to_ipu_crtc(crtc); 115 struct ipu_crtc *ipu_crtc = to_ipu_crtc(crtc);
111 int ret; 116 int ret;
112 117
113 if (ipu_crtc->newfb) 118 if (ipu_crtc->flip_state != IPU_FLIP_NONE)
114 return -EBUSY; 119 return -EBUSY;
115 120
116 ret = imx_drm_crtc_vblank_get(ipu_crtc->imx_crtc); 121 ret = imx_drm_crtc_vblank_get(ipu_crtc->imx_crtc);
@@ -121,8 +126,8 @@ static int ipu_page_flip(struct drm_crtc *crtc,
121 return ret; 126 return ret;
122 } 127 }
123 128
124 ipu_crtc->newfb = fb;
125 ipu_crtc->page_flip_event = event; 129 ipu_crtc->page_flip_event = event;
130 ipu_crtc->flip_state = IPU_FLIP_PENDING;
126 131
127 return 0; 132 return 0;
128} 133}
@@ -224,13 +229,13 @@ static irqreturn_t ipu_irq_handler(int irq, void *dev_id)
224 229
225 imx_drm_handle_vblank(ipu_crtc->imx_crtc); 230 imx_drm_handle_vblank(ipu_crtc->imx_crtc);
226 231
227 if (ipu_crtc->newfb) { 232 if (ipu_crtc->flip_state == IPU_FLIP_PENDING) {
228 struct ipu_plane *plane = ipu_crtc->plane[0]; 233 struct ipu_plane *plane = ipu_crtc->plane[0];
229 234
230 ipu_crtc->newfb = NULL;
231 ipu_plane_set_base(plane, ipu_crtc->base.primary->fb, 235 ipu_plane_set_base(plane, ipu_crtc->base.primary->fb,
232 plane->x, plane->y); 236 plane->x, plane->y);
233 ipu_crtc_handle_pageflip(ipu_crtc); 237 ipu_crtc_handle_pageflip(ipu_crtc);
238 ipu_crtc->flip_state = IPU_FLIP_NONE;
234 } 239 }
235 240
236 return IRQ_HANDLED; 241 return IRQ_HANDLED;