Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge many vc4 changes from drm-vc4-next-2016-07-15 #1596

Merged
merged 13 commits into from
Aug 13, 2016

Conversation

anholt
Copy link
Contributor

@anholt anholt commented Aug 12, 2016

This mostly brings downstream vc4 up to date except for the getparam ioctl and looping. Getparam depends on the runtime power management, which needs backporting.

Peter Chen and others added 13 commits August 10, 2016 15:51
…andle

of_node_put needs to be called when the device node which is got
from of_parse_phandle has finished using.

Signed-off-by: Peter Chen <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
(cherry picked from commit 027a697)
We want to hide drm_atomic_stat internals a bit better.

Cc: Eric Anholt <[email protected]>
Reviewed-by: Maarten Lankhorst <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
(cherry picked from commit 833cd78)
Contrary to other flags to DRM_IOCTL_DEF_DRV(), which restrict usage,
the flag for render node is an enabler (the IOCTL can't be used from
render node if it's not present).  So DRM_RENDER_ALLOW needs to be
added to all the flags that were previously 0.

Signed-off-by: Herve Jourdain <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
Fixes: 0cd3e27 ("drm/vc4: Add missing render node support")
(cherry picked from commit b10c22e)
Protect both the setup of the pageflip event and the
latching of the new requested displaylist head pointer
by the event lock, so we can't get into a situation
where vc4_atomic_flush latches the new display list via
HVS_WRITE, then immediately gets preempted before queueing
the pageflip event, then the page-flip completes in hw and
the vc4_crtc_handle_page_flip() runs and no-ops due to
lack of a pending pageflip event, then vc4_atomic_flush
continues and only then queues the pageflip event - after
the page flip handling already no-oped. This would cause
flip completion handling only at the next vblank - one
frame too late.

In vc4_crtc_handle_page_flip() check the actual DL head
pointer in SCALER_DISPLACTX against the requested pointer
for page flip to make sure that the flip actually really
completed in the current vblank and doesn't get deferred
to the next one because the DL head pointer was written
a bit too late into SCALER_DISPLISTX, after start of
vblank, and missed the boat. This avoids handling a
pageflip completion too early - one frame too early.

According to Eric, DL head pointer updates which were
written into the HVS DISPLISTX reg get committed to hardware
at the last pixel of active scanout. Our vblank interrupt
handler, as triggered by PV_INT_VFP_START irq, gets to run
earliest at the first pixel of HBLANK at the end of the
last scanline of active scanout, ie. vblank irq handling
runs at least 1 pixel duration after a potential pageflip
completion happened in hardware.

This ordering of events in the hardware, together with the
lock protection and SCALER_DISPLACTX sampling of this patch,
guarantees that pageflip completion handling only runs at
exactly the vblank irq of actual pageflip completion in all
cases.

Background info from Eric about the relative timing of
HVS, PV's and trigger points for interrupts, DL updates:

https://lists.freedesktop.org/archives/dri-devel/2016-May/107510.html

Tested on RPi 2B with hardware timing measurement equipment
and shown to no longer complete flips too early or too late.

Signed-off-by: Mario Kleiner <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
(cherry picked from commit 56d1fe0)
There is redundant code in the clean up exit path when dpi_connector
fails to be allocated.  The current code checks if connector is NULL
before destroying it, in fact, connector is NULL at this point so
the check is redundant and can be removed. The final clean up is
that we can remove the goto fail with a simple return and the unused
variable ret.

Signed-off-by: Colin Ian King <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
(cherry picked from commit a9402df)
DRM_FORMAT_XBGR8888 and DRM_FORMAT_ABGR8888 are 2 of the native formats
used in Android, so enable them for VC4. There seems to be no logic behind
HVS_PIXEL_ORDER_xxxx naming, but HVS_PIXEL_ORDER_ARGB seems to work
correctly.

Signed-off-by: Rob Herring <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
(cherry picked from commit 9397776)
We need to be able to look at the CRTC's registers in the HVS as part
of initialization, while the HVS doesn't need to look at the PV
registers.

Signed-off-by: Eric Anholt <[email protected]>
Reviewed-and-tested-by: Mario Kleiner <[email protected]>
(cherry picked from commit 7a10096)
Precise vblank timestamping is implemented via the
usual scanout position based method. On VC4 the
pixelvalves PV do not have a scanout position
register. Only the hardware video scaler HVS has a
similar register which describes which scanline for
the output is currently composited and stored in the
HVS fifo for later consumption by the PV.

This causes a problem in that the HVS runs at a much
faster clock (system clock / audio gate) than the PV
which runs at video mode dot clock, so the unless the
fifo between HVS and PV is full, the HVS will progress
faster in its observable read line position than video
scan rate, so the HVS position reading can't be directly
translated into a scanout position for timestamp correction.

Additionally when the PV is in vblank, it doesn't consume
from the fifo, so the fifo gets full very quickly and then
the HVS stops compositing until the PV enters active scanout
and starts consuming scanlines from the fifo again, making
new space for the HVS to composite.

Therefore a simple translation of HVS read position into
elapsed time since (or to) start of active scanout does
not work, but for the most interesting cases we can still
get useful and sufficiently accurate results:

1. The PV enters active scanout of a new frame with the
   fifo of the HVS completely full, and the HVS can refill
   any fifo line which gets consumed and thereby freed up by
   the PV during active scanout very quickly. Therefore the
   PV and HVS work effectively in lock-step during active
   scanout with the fifo never having more than 1 scanline
   freed up by the PV before it gets refilled. The PV's
   real scanout position is therefore trailing the HVS
   compositing position as scanoutpos = hvspos - fifosize
   and we can get the true scanoutpos as HVS readpos minus
   fifo size, so precise timestamping works while in active
   scanout, except for the last few scanlines of the frame,
   when the HVS reaches end of frame, stops compositing and
   the PV catches up and drains the fifo. This special case
   would only introduce minor errors though.

2. If we are in vblank, then we can only guess something
   reasonable. If called from vblank irq, we assume the irq is
   usually dispatched with minimum delay, so we can take a
   timestamp taken at entry into the vblank irq handler as a
   baseline and then add a full vblank duration until the
   guessed start of active scanout. As irq dispatch is usually
   pretty low latency this works with relatively low jitter and
   good results.

   If we aren't called from vblank then we could be anywhere
   within the vblank interval, so we return a neutral result,
   simply the current system timestamp, and hope for the best.

Measurement shows the generated timestamps to be rather precise,
and at least never off more than 1 vblank duration worst-case.

Limitations: Doesn't work well yet for interlaced video modes,
             therefore disabled in interlaced mode for now.

v2: Use the DISPBASE registers to determine the FIFO size (changes
    by anholt)

Signed-off-by: Mario Kleiner <[email protected]>
Signed-off-by: Eric Anholt <[email protected]>
Reviewed-and-tested-by: Mario Kleiner <[email protected]> (v2)
(cherry picked from commit 1bf59f1)
At the current point where ret is being checked for non-zero it has
not changed since it was initialized to zero, hence the check and the
label unref are redundant and can be removed.

Signed-off-by: Colin Ian King <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
(cherry picked from commit deb4765)
Cc: Eric Anholt <[email protected]>
Signed-off-by: Emil Velikov <[email protected]>
(cherry picked from commit 6a98235)
We don't use it in shader validation currently, so it had no effect,
but best to fix it anyway in case we do some day.

Signed-off-by: Eric Anholt <[email protected]>
(cherry picked from commit 20e48fd)
Signed-off-by: Eric Anholt <[email protected]>
(cherry picked from commit a20d5fa)
As per the documentation in drm_crtc.h, atomic_commit should return
-EBUSY if an asynchronous update is requested and there is an earlier
update pending.

v2: Rebase on the s/async/nonblock/ change.

Signed-off-by: Robert Foss <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
(cherry picked from commit e7c31f6)
@popcornmix
Copy link
Collaborator

Only affects drm/vc4 and still builds so no objections from me.
@pelwell okay with you?

@pelwell pelwell merged commit e780e44 into raspberrypi:rpi-4.4.y Aug 13, 2016
popcornmix added a commit to raspberrypi/firmware that referenced this pull request Aug 16, 2016
See: raspberrypi/linux#1596

kernel: drm/vc4: vc4 loops support
See: raspberrypi/linux#1597

kernel: Add cm3 dts file
See: raspberrypi/linux#1595

kernel: net: ethernet: enc28j60: add device tree support

kernel: enc28j60: Fix race condition in enc28j60 driver
See: raspberrypi/linux#1385

firmware: platform: Don't swap audio L&R if using GPIOs 12&13
See: http://github.com/raspberrypi/linux/issues/1473

firmware: hdmi: Increase muting before resolution change

firmware: board_info: Add cm3-specific dtb file

firmware: Ensure extended part of vg_spath is zeroed
See: raspberrypi/linux#943
popcornmix added a commit to Hexxeh/rpi-firmware that referenced this pull request Aug 16, 2016
See: raspberrypi/linux#1596

kernel: drm/vc4: vc4 loops support
See: raspberrypi/linux#1597

kernel: Add cm3 dts file
See: raspberrypi/linux#1595

kernel: net: ethernet: enc28j60: add device tree support

kernel: enc28j60: Fix race condition in enc28j60 driver
See: raspberrypi/linux#1385

firmware: platform: Don't swap audio L&R if using GPIOs 12&13
See: http://github.com/raspberrypi/linux/issues/1473

firmware: hdmi: Increase muting before resolution change

firmware: board_info: Add cm3-specific dtb file

firmware: Ensure extended part of vg_spath is zeroed
See: raspberrypi/linux#943
mkreisl added a commit to xbianonpi/xbian-package-firmware that referenced this pull request Sep 16, 2016
- kernel: config: Enable SENSORS_LM75
  See: #508

- kernel: config: Enable SERIAL_SC16IS7XX
  See: raspberrypi/linux#1594

- kernel: snd-bcm2835: Don't allow responses from VC to be interrupted by user signals
  See: raspberrypi/linux#1560

- kernel: Merge many vc4 changes from drm-vc4-next-2016-07-15
  See: raspberrypi/linux#1596

- kernel: drm/vc4: vc4 loops support
  See: raspberrypi/linux#1597

- kernel: Add cm3 dts file
  See: raspberrypi/linux#1595

- kernel: net: ethernet: enc28j60: add device tree support

- kernel: enc28j60: Fix race condition in enc28j60 driver
  See: raspberrypi/linux#1385

- firmware: platform: Don't swap audio L&R if using GPIOs 12&13
  See: http://github.com/raspberrypi/linux/issues/1473

- firmware: hdmi: Increase muting before resolution change

- firmware: board_info: Add cm3-specific dtb file

- firmware: Ensure extended part of vg_spath is zeroed
  See: raspberrypi/linux#943

- kernel: config: Enable SERIAL_SC16IS7XX_SPI
  See: raspberrypi/linux#1594

- kernel: Added Overlay for Microchip MCP23S08/17 SPI gpio expanders
  See: raspberrypi/linux#1566

- kernel: BCM270X_DT: Add audio_pins to CM dtb
- kernel: BCM270X_DT: Don't enable UART0 in CM3 dtb

- kernel: overlays: Add audremap overlay
- kernel: overlays: Add swap_lr and enable_jack to audremap
  See: raspberrypi/linux#1473

- firmware: Raspi[Still|Vid]Yuv: Add option for just saving luma
  See: raspberrypi/userland#170

- firmware: RaspiVidYuv: Add option of saving RGB data

- firmware: Only change I2C/GPIO pin functions when needed

- firmware: platform: Redo the audio remapping logic
  See: raspberrypi/linux#1473

- kernel: overlays: added sc16is750 UART over I2C
  See: raspberrypi/linux#1617

- kernel: config: Add CONFIG_IPVLAN module
  See: raspberrypi/linux#1612

- kernel: config: Add CONFIG_VXLAN module
  See: raspberrypi/linux#1614

- firmware: platform: Make the default UART0 clock 48MHz for all Pis
  See: raspberrypi/linux#1601
  See: #643

- firmware: cacheasm: Enable workaround for unwanted sdram write after flush/invalidate
  See: raspberrypi/linux#943

- firmware: vchiq_arm: Fix return value of vchiq_initialise
  See: raspberrypi/userland#331

- firmware: Revert temp: Ensure extended part of vg_spath is zeroed
  See: raspberrypi/linux#943

- firmware: MMAL: Support MMAL_ENCODING_xxx_SLICE formats

- firmware: arm_display: Add bitmapped icons for warning conditions
  See: #367

- firmware: deinterlace: Avoid frame doubling with progressive frames
  See: http://forum.kodi.tv/showthread.php?tid=269814&pid=2412845#pid2412845

- kernel: config: Enable SENSORS_INA2XX module
  See: raspberrypi/linux#1632

- kernel: overlays: Add dpi18 overlay
  See: raspberrypi/linux#1634

- kernel: brcmfmac: do not use internal roaming engine by default
  See: http://projectable.me/optimize-my-pi-wi-fi/

- firmware: arm_display: Fix alpha of warning icons
  See: #367

- firmware: mmal: Advertise sliced formats in MMAL_PARAMETER_SUPPORTED_ENCODINGS
- firmware: IL Resize: Accept strides greater than the minimum

- firmware: vmcs_host: Poll for multiple dispmanx messages
- firmware: VCHI clients: Poll for messages until empty
  See: https://discourse.osmc.tv/t/april-update-causes-system-freezes/15361/183

- firmware: tvservice/cecservice: Make unexpected messages more fatal

- kernel: drm/vc4: Allow some more signals to be packed with uniform resets
  See: raspberrypi/linux#1636

- kernel: Rpi 4.4.y firmware kms
  See: raspberrypi/linux#1637

- firmware: tvservice/cecservice: We only care about unexpected message sizes

- firmware: khronos: Avoid starting khronos service when vc4-kms-v3d is active
- firmeare: arm_loader: Enable fake_vsync_isr when fkms overlay is used
  See: raspberrypi/linux#1637

- firmware: vcdbg: Add support for vchiq debugging
neuschaefer pushed a commit to neuschaefer/raspi-binary-firmware that referenced this pull request Feb 27, 2017
See: raspberrypi/linux#1596

kernel: drm/vc4: vc4 loops support
See: raspberrypi/linux#1597

kernel: Add cm3 dts file
See: raspberrypi/linux#1595

kernel: net: ethernet: enc28j60: add device tree support

kernel: enc28j60: Fix race condition in enc28j60 driver
See: raspberrypi/linux#1385

firmware: platform: Don't swap audio L&R if using GPIOs 12&13
See: http://github.com/raspberrypi/linux/issues/1473

firmware: hdmi: Increase muting before resolution change

firmware: board_info: Add cm3-specific dtb file

firmware: Ensure extended part of vg_spath is zeroed
See: raspberrypi/linux#943
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants