Linux Kernel
3.7.1
|
#include <drm/drmP.h>
#include "drm_trace.h"
#include <linux/interrupt.h>
#include <linux/slab.h>
#include <linux/vgaarb.h>
#include <linux/export.h>
Go to the source code of this file.
Macros | |
#define | vblanktimestamp(dev, crtc, count) |
#define | DRM_TIMESTAMP_MAXRETRIES 3 |
#define | DRM_REDUNDANT_VBLIRQ_THRESH_NS 1000000 |
IRQ support
Definition in file drm_irq.c.
drm_calc_timestamping_constants - Calculate and store various constants which are later needed by vblank and swap-completion timestamping, e.g, by drm_calc_vbltimestamp_from_scanoutpos(). They are derived from crtc's true scanout timing, so they take things like panel scaling or other adjustments into account.
drm_crtc whose timestamp constants should be updated.
int drm_calc_vbltimestamp_from_scanoutpos | ( | struct drm_device * | dev, |
int | crtc, | ||
int * | max_error, | ||
struct timeval * | vblank_time, | ||
unsigned | flags, | ||
struct drm_crtc * | refcrtc | ||
) |
drm_calc_vbltimestamp_from_scanoutpos - helper routine for kms drivers. Implements calculation of exact vblank timestamps from given drm_display_mode timings and current video scanout position of a crtc. This can be called from within get_vblank_timestamp() implementation of a kms driver to implement the actual timestamping.
Should return timestamps conforming to the OML_sync_control OpenML extension specification. The timestamp corresponds to the end of the vblank interval, aka start of scanout of topmost-leftmost display pixel in the following video frame.
Requires support for optional dev->driver->get_scanout_position() in kms driver, plus a bit of setup code to provide a drm_display_mode that corresponds to the true scanout timing.
The current implementation only handles standard video modes. It returns as no operation if a doublescan or interlaced video mode is active. Higher level code is expected to handle this.
: DRM device. : Which crtc's vblank timestamp to retrieve. : Desired maximum allowable error in timestamps (nanosecs). On return contains true maximum error of timestamp. : Pointer to struct timeval which should receive the timestamp. : Flags to pass to driver: 0 = Default. DRM_CALLED_FROM_VBLIRQ = If function is called from vbl irq handler. : drm_crtc* of crtc which defines scanout timing.
Returns negative value on error, failure or if not supported in current video mode:
-EINVAL - Invalid crtc. -EAGAIN - Temporary unavailable, e.g., called before initial modeset. -ENOTSUPP - Function not supported in current display mode. -EIO - Failed, e.g., due to failed scanout position query.
Returns or'ed positive status flags on success:
DRM_VBLANKTIME_SCANOUTPOS_METHOD - Signal this method used for timestamping. DRM_VBLANKTIME_INVBL - Timestamp taken while scanout was in vblank interval.
int drm_control | ( | struct drm_device * | dev, |
void * | data, | ||
struct drm_file * | file_priv | ||
) |
IRQ control ioctl.
inode | device inode. |
file_priv | DRM file private. |
cmd | command. |
arg | user argument, pointing to a drm_control structure. |
Calls irq_install() or irq_uninstall() according to arg
.
u32 drm_get_last_vbltimestamp | ( | struct drm_device * | dev, |
int | crtc, | ||
struct timeval * | tvblank, | ||
unsigned | flags | ||
) |
drm_get_last_vbltimestamp - retrieve raw timestamp for the most recent vblank interval.
: DRM device : which crtc's vblank timestamp to retrieve : Pointer to target struct timeval which should receive the timestamp : Flags to pass to driver: 0 = Default. DRM_CALLED_FROM_VBLIRQ = If function is called from vbl irq handler.
Fetches the system timestamp corresponding to the time of the most recent vblank interval on specified crtc. May call into kms-driver to compute the timestamp with a high-precision GPU specific method.
Returns zero if timestamp originates from uncorrected do_gettimeofday() call, i.e., it isn't very precisely locked to the true vblank.
Returns non-zero if timestamp is considered to be very precise.
bool drm_handle_vblank | ( | struct drm_device * | dev, |
int | crtc | ||
) |
int drm_irq_by_busid | ( | struct drm_device * | dev, |
void * | data, | ||
struct drm_file * | file_priv | ||
) |
Get interrupt from bus id.
inode | device inode. |
file_priv | DRM file private. |
cmd | command. |
arg | user argument, pointing to a drm_irq_busid structure. |
Finds the PCI device with the specified bus id and gets its IRQ number. This IOCTL is deprecated, and will now return EINVAL for any busid not equal to that of the device that this DRM instance attached to.
int drm_irq_install | ( | struct drm_device * | dev | ) |
int drm_irq_uninstall | ( | struct drm_device * | dev | ) |
int drm_modeset_ctl | ( | struct drm_device * | dev, |
void * | data, | ||
struct drm_file * | file_priv | ||
) |
drm_modeset_ctl - handle vblank event counter changes across mode switch : standard ioctl arguments
Applications should call the _DRM_PRE_MODESET and _DRM_POST_MODESET ioctls around modesetting so that any lost vblank events are accounted for.
Generally the counter will reset across mode sets. If interrupts are enabled around this call, we don't have to do anything since the counter will have already been incremented.
void drm_vblank_cleanup | ( | struct drm_device * | dev | ) |
u32 drm_vblank_count | ( | struct drm_device * | dev, |
int | crtc | ||
) |
drm_vblank_count_and_time - retrieve "cooked" vblank counter value and the system timestamp corresponding to that vblank counter value.
: DRM device : which counter to retrieve : Pointer to struct timeval to receive the vblank timestamp.
Fetches the "cooked" vblank count value that represents the number of vblank events since the system was booted, including lost events due to modesetting activity. Returns corresponding system timestamp of the time of the vblank interval that corresponds to the current value vblank counter value.
int drm_vblank_get | ( | struct drm_device * | dev, |
int | crtc | ||
) |
int drm_vblank_init | ( | struct drm_device * | dev, |
int | num_crtcs | ||
) |
void drm_vblank_post_modeset | ( | struct drm_device * | dev, |
int | crtc | ||
) |
void drm_vblank_pre_modeset | ( | struct drm_device * | dev, |
int | crtc | ||
) |
void drm_vblank_put | ( | struct drm_device * | dev, |
int | crtc | ||
) |
int drm_wait_vblank | ( | struct drm_device * | dev, |
void * | data, | ||
struct drm_file * | file_priv | ||
) |
Wait for VBLANK.
inode | device inode. |
file_priv | DRM file private. |
cmd | command. |
data | user argument, pointing to a drm_wait_vblank structure. |
This function enables the vblank interrupt on the pipe requested, then sleeps waiting for the requested sequence number to occur, and drops the vblank interrupt refcount afterwards. (vblank irq disable follows that after a timeout with no further vblank waits scheduled).
EXPORT_SYMBOL | ( | drm_vblank_cleanup | ) |
EXPORT_SYMBOL | ( | drm_vblank_init | ) |
EXPORT_SYMBOL | ( | drm_irq_install | ) |
EXPORT_SYMBOL | ( | drm_irq_uninstall | ) |
EXPORT_SYMBOL | ( | drm_calc_timestamping_constants | ) |
EXPORT_SYMBOL | ( | drm_calc_vbltimestamp_from_scanoutpos | ) |
EXPORT_SYMBOL | ( | drm_get_last_vbltimestamp | ) |
EXPORT_SYMBOL | ( | drm_vblank_count | ) |
EXPORT_SYMBOL | ( | drm_vblank_count_and_time | ) |
EXPORT_SYMBOL | ( | drm_vblank_get | ) |
EXPORT_SYMBOL | ( | drm_vblank_put | ) |
EXPORT_SYMBOL | ( | drm_vblank_off | ) |
EXPORT_SYMBOL | ( | drm_vblank_pre_modeset | ) |
EXPORT_SYMBOL | ( | drm_vblank_post_modeset | ) |
EXPORT_SYMBOL | ( | drm_handle_vblank | ) |