aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/vc4/vc4_crtc.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2017-05-17 22:57:06 -0400
committerDave Airlie <airlied@redhat.com>2017-05-17 22:57:06 -0400
commite98c58e55f68f8785aebfab1f8c9a03d8de0afe1 (patch)
tree8357e8fda6efb0867ac39fc6b9211a579721d00a /drivers/gpu/drm/vc4/vc4_crtc.c
parent2ea659a9ef488125eb46da6eb571de5eae5c43f6 (diff)
parent9cf8f5802f39d9991158b29033c852bccfc3a4d4 (diff)
Merge tag 'drm-misc-next-2017-05-16' of git://anongit.freedesktop.org/git/drm-misc into drm-next
UAPI Changes: - Return -ENODEV instead of -ENXIO when creating cma fb w/o valid gem (Daniel) - Add aspect ratio and custom scaling propertis to connector state (Maarten) Cross-subsystem Changes: - None Core Changes: - Add Laurent as bridge reviewer and Andrzej as bridge maintainer (Archit) - Maintain new STM driver through -misc (Yannick) - Misc doc improvements (as is tradition) (Daniel) - Add driver-private objects to atomic state (Dhinakaran) - Deprecate preclose hook in modern drivers (use postclose) (Daniel) - Add hwmode to vblank struct. This fixes mode access in irq context and reduced a bunch of boilerplate (Daniel) Driver Changes: - vc4: Add out-fence support to vc4 V3D rendering (Eric) - stm: Add stm32f429 display hw and am-480272h3tmqw-t01h panel support (Yannick) - vc4: Remove 256MB cma limit from vc4 (Eric) - dw-hdmi: Disable audio when inactive, instead of always enabled (Romain) - zte: Add support for VGA to the ZTE driver (Shawn) - i915: Track DP MST bandwidth and check it in atomic_check (Dhinakaran) - vgem: Enable gem dmabuf import iface to facilitate ion testing (Laura) - vc4: Add support for Cygnus (new dt compat string + couple bug fixes) (Eric) - pl111: Add driver for pl111 CLCD display controller (Eric/Tom) - vgem: Subclass drm_device instead of standalone platform device (Chris) Cc: Archit Taneja <architt@codeaurora.org> Cc: Eric Anholt <eric@anholt.net> Cc: Yannick Fertre <yannick.fertre@st.com> Cc: Romain Perier <romain.perier@collabora.com> Cc: Navare, Manasi D <manasi.d.navare@intel.com> Cc: Shawn Guo <shawn.guo@linaro.org> Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Cc: Laura Abbott <labbott@redhat.com> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Tom Cooksey <tom.cooksey@arm.com> Cc: Daniel Vetter <daniel.vetter@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> * tag 'drm-misc-next-2017-05-16' of git://anongit.freedesktop.org/git/drm-misc: (72 commits) drm: add missing declaration to drm_blend.h drm/dp: Wait up all outstanding tx waiters drm/dp: Read the tx msg state once after checking for an event drm/prime: Forward declare struct device drm/vblank: Lock down vblank->hwmode more drm/vblank: drop the mode argument from drm_calc_vbltimestamp_from_scanoutpos drm/vblank: Add FIXME comments about moving the vblank ts hooks drm/vblank: Switch to bool in_vblank_irq in get_vblank_timestamp drm/vblank: Switch drm_driver->get_vblank_timestamp to return a bool drm/vgem: Convert to a struct drm_device subclass gpu: drm: gma500: remove dead code drm/sti: Adjust two checks for null pointers in sti_hqvdp_probe() drm/sti: Fix typos in a comment line drm/sti: Fix a typo in a comment line drm/sti: Replace 17 seq_puts() calls by seq_putc() drm/sti: Reduce function calls for sequence output at five places drm/sti: use seq_puts to display a string drm: Nerf the preclose callback for modern drivers drm/exynos: Merge pre/postclose hooks drm/tegra: switch to postclose ...
Diffstat (limited to 'drivers/gpu/drm/vc4/vc4_crtc.c')
-rw-r--r--drivers/gpu/drm/vc4/vc4_crtc.c34
1 files changed, 10 insertions, 24 deletions
diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
index d86c8cce3182..1b4dbe9e1c6d 100644
--- a/drivers/gpu/drm/vc4/vc4_crtc.c
+++ b/drivers/gpu/drm/vc4/vc4_crtc.c
@@ -151,10 +151,10 @@ int vc4_crtc_debugfs_regs(struct seq_file *m, void *unused)
151} 151}
152#endif 152#endif
153 153
154int vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id, 154bool vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id,
155 unsigned int flags, int *vpos, int *hpos, 155 bool in_vblank_irq, int *vpos, int *hpos,
156 ktime_t *stime, ktime_t *etime, 156 ktime_t *stime, ktime_t *etime,
157 const struct drm_display_mode *mode) 157 const struct drm_display_mode *mode)
158{ 158{
159 struct vc4_dev *vc4 = to_vc4_dev(dev); 159 struct vc4_dev *vc4 = to_vc4_dev(dev);
160 struct drm_crtc *crtc = drm_crtc_from_index(dev, crtc_id); 160 struct drm_crtc *crtc = drm_crtc_from_index(dev, crtc_id);
@@ -162,7 +162,7 @@ int vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id,
162 u32 val; 162 u32 val;
163 int fifo_lines; 163 int fifo_lines;
164 int vblank_lines; 164 int vblank_lines;
165 int ret = 0; 165 bool ret = false;
166 166
167 /* preempt_disable_rt() should go right here in PREEMPT_RT patchset. */ 167 /* preempt_disable_rt() should go right here in PREEMPT_RT patchset. */
168 168
@@ -198,7 +198,7 @@ int vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id,
198 fifo_lines = vc4_crtc->cob_size / mode->crtc_hdisplay; 198 fifo_lines = vc4_crtc->cob_size / mode->crtc_hdisplay;
199 199
200 if (fifo_lines > 0) 200 if (fifo_lines > 0)
201 ret |= DRM_SCANOUTPOS_VALID; 201 ret = true;
202 202
203 /* HVS more than fifo_lines into frame for compositing? */ 203 /* HVS more than fifo_lines into frame for compositing? */
204 if (*vpos > fifo_lines) { 204 if (*vpos > fifo_lines) {
@@ -216,7 +216,6 @@ int vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id,
216 */ 216 */
217 *vpos -= fifo_lines + 1; 217 *vpos -= fifo_lines + 1;
218 218
219 ret |= DRM_SCANOUTPOS_ACCURATE;
220 return ret; 219 return ret;
221 } 220 }
222 221
@@ -229,10 +228,9 @@ int vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id,
229 * We can't get meaningful readings wrt. scanline position of the PV 228 * We can't get meaningful readings wrt. scanline position of the PV
230 * and need to make things up in a approximative but consistent way. 229 * and need to make things up in a approximative but consistent way.
231 */ 230 */
232 ret |= DRM_SCANOUTPOS_IN_VBLANK;
233 vblank_lines = mode->vtotal - mode->vdisplay; 231 vblank_lines = mode->vtotal - mode->vdisplay;
234 232
235 if (flags & DRM_CALLED_FROM_VBLIRQ) { 233 if (in_vblank_irq) {
236 /* 234 /*
237 * Assume the irq handler got called close to first 235 * Assume the irq handler got called close to first
238 * line of vblank, so PV has about a full vblank 236 * line of vblank, so PV has about a full vblank
@@ -254,9 +252,10 @@ int vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id,
254 * we are at the very beginning of vblank, as the hvs just 252 * we are at the very beginning of vblank, as the hvs just
255 * started refilling, and the stime and etime timestamps 253 * started refilling, and the stime and etime timestamps
256 * truly correspond to start of vblank. 254 * truly correspond to start of vblank.
255 *
256 * Unfortunately there's no way to report this to upper levels
257 * and make it more useful.
257 */ 258 */
258 if ((val & SCALER_DISPSTATX_FULL) != SCALER_DISPSTATX_FULL)
259 ret |= DRM_SCANOUTPOS_ACCURATE;
260 } else { 259 } else {
261 /* 260 /*
262 * No clue where we are inside vblank. Return a vpos of zero, 261 * No clue where we are inside vblank. Return a vpos of zero,
@@ -270,19 +269,6 @@ int vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id,
270 return ret; 269 return ret;
271} 270}
272 271
273int vc4_crtc_get_vblank_timestamp(struct drm_device *dev, unsigned int crtc_id,
274 int *max_error, struct timeval *vblank_time,
275 unsigned flags)
276{
277 struct drm_crtc *crtc = drm_crtc_from_index(dev, crtc_id);
278 struct drm_crtc_state *state = crtc->state;
279
280 /* Helper routine in DRM core does all the work: */
281 return drm_calc_vbltimestamp_from_scanoutpos(dev, crtc_id, max_error,
282 vblank_time, flags,
283 &state->adjusted_mode);
284}
285
286static void vc4_crtc_destroy(struct drm_crtc *crtc) 272static void vc4_crtc_destroy(struct drm_crtc *crtc)
287{ 273{
288 drm_crtc_cleanup(crtc); 274 drm_crtc_cleanup(crtc);