Re: [Freedreno] [PATCH 15/16] drm/vblank: Simplify the get_scanout_position helper hook

2017-03-24 Thread kbuild test robot
Hi Daniel,

[auto build test WARNING on drm/drm-next]
[cannot apply to v4.11-rc3 next-20170324]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Daniel-Vetter/more-drmP-h-cleanup/20170325-030940
base:   git://people.freedesktop.org/~airlied/linux.git drm-next


coccinelle warnings: (new ones prefixed by >>)

>> drivers/gpu/drm/nouveau/nouveau_display.c:154:8-9: WARNING: return of 0/1 in 
>> function 'nouveau_display_scanoutpos' with return type bool

Please review and possibly fold the followup patch.

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation
___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


[Freedreno] [PATCH 15/16] drm/vblank: Simplify the get_scanout_position helper hook

2017-03-22 Thread Daniel Vetter
- We can drop the different return value flags, the only caller only
  cares about whether the scanout position is valid or not. Also, it's
  entirely undefined what "accurate" means, if we'd really care we
  should probably wire the max_error through. But since we never even
  report this to userspace it's kinda moot.

- Drop all the fancy input flags, there's really only the "called from
  vblank irq" one. Well except for radeon/amdgpu, which added their
  own private flags.

Since amdgpu/radoen also use the scanoutposition function internally I
just gave them a tiny wrapper, plus copies of all the old #defines
they need. Everyone else gets simplified code.

Note how we could remove a lot of error conditions if we'd move this
helper hook to drm_crtc_helper_funcs and would pass it a crtc
directly.

v2: Make it compile on arm.

Cc: Mario Kleiner 
Cc: Eric Anholt 
Cc: Rob Clark 
Cc: linux-arm-...@vger.kernel.org
Cc: freedreno@lists.freedesktop.org
Cc: Alex Deucher 
Cc: Christian König 
Cc: Ben Skeggs 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c   | 12 +++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h  |  3 +++
 drivers/gpu/drm/drm_irq.c | 16 
 drivers/gpu/drm/i915/i915_irq.c   | 19 ++-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c   | 19 +++
 drivers/gpu/drm/nouveau/nouveau_display.c | 16 +++-
 drivers/gpu/drm/nouveau/nouveau_display.h |  6 +++---
 drivers/gpu/drm/radeon/radeon_drv.c   | 12 +++-
 drivers/gpu/drm/radeon/radeon_mode.h  |  3 +++
 drivers/gpu/drm/vc4/vc4_crtc.c| 21 ++---
 drivers/gpu/drm/vc4/vc4_drv.h |  8 
 include/drm/drmP.h|  8 
 include/drm/drm_drv.h | 26 ++
 13 files changed, 83 insertions(+), 86 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index ba169a0699d5..87910850e5dc 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -678,6 +678,16 @@ static const struct file_operations amdgpu_driver_kms_fops 
= {
 #endif
 };
 
+static bool
+amdgpu_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
+bool in_vblank_irq, int *vpos, int *hpos,
+ktime_t *stime, ktime_t *etime,
+const struct drm_display_mode *mode)
+{
+   return amdgpu_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
+ stime, etime, mode);
+}
+
 static struct drm_driver kms_driver = {
.driver_features =
DRIVER_USE_AGP |
@@ -693,7 +703,7 @@ static struct drm_driver kms_driver = {
.enable_vblank = amdgpu_enable_vblank_kms,
.disable_vblank = amdgpu_disable_vblank_kms,
.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
-   .get_scanout_position = amdgpu_get_crtc_scanoutpos,
+   .get_scanout_position = amdgpu_get_crtc_scanout_position,
 #if defined(CONFIG_DEBUG_FS)
.debugfs_init = amdgpu_debugfs_init,
 #endif
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
index c12497bd3889..6b8f766a6a35 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
@@ -534,6 +534,9 @@ struct amdgpu_framebuffer {
((em) == ATOM_ENCODER_MODE_DP_MST))
 
 /* Driver internal use only flags of amdgpu_get_crtc_scanoutpos() */
+#define DRM_SCANOUTPOS_VALID(1 << 0)
+#define DRM_SCANOUTPOS_IN_VBLANK(1 << 1)
+#define DRM_SCANOUTPOS_ACCURATE (1 << 2)
 #define USE_REAL_VBLANKSTART   (1 << 30)
 #define GET_DISTANCE_TO_VBLANKSTART(1 << 31)
 
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 61d726b1f810..00e26b4312cc 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -744,13 +744,12 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct 
drm_device *dev,
 {
struct timeval tv_etime;
ktime_t stime, etime;
-   unsigned int vbl_status;
+   bool vbl_status;
struct drm_crtc *crtc;
const struct drm_display_mode *mode;
struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
int vpos, hpos, i;
int delta_ns, duration_ns;
-   unsigned flags = in_vblank_irq ? DRM_CALLED_FROM_VBLIRQ : 0;
 
if (!drm_core_check_feature(dev, DRIVER_MODESET))
return false;
@@ -793,15 +792,16 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct 
drm_device *dev,
 * Get vertical and horizontal scanout position vpos, hpos,
 * and bounding timestamps stime, etime, pre/post query.
 */
-   vbl_status = dev->driver->get_scanout_position(dev, pipe, flags,
+   vbl_status = dev->drive