forked from Minki/linux
9edbf1fa60
Adds files and directories to debugfs for controlling and reading frame CRCs, per CRTC: dri/0/crtc-0/crc dri/0/crtc-0/crc/control dri/0/crtc-0/crc/data Drivers can implement the set_crc_source callback() in drm_crtc_funcs to start and stop generating frame CRCs and can add entries to the output by calling drm_crtc_add_crc_entry. v2: - Lots of good fixes suggested by Thierry. - Added documentation. - Changed the debugfs layout. - Moved to allocate the entries circular queue once when frame generation gets enabled for the first time. v3: - Use the control file just to select the source, and start and stop capture when the data file is opened and closed, respectively. - Make variable the number of CRC values per entry, per source. - Allocate entries queue each time we start capturing as now there isn't a fixed number of CRC values per entry. - Store the frame counter in the data file as a 8-digit hex number. - For sources that cannot provide useful frame numbers, place XXXXXXXX in the frame field. v4: - Build only if CONFIG_DEBUG_FS is enabled. - Use memdup_user_nul. - Consolidate calculation of the size of an entry in a helper. - Add 0x prefix to hex numbers in the data file. - Remove unnecessary snprintf and strlen usage in read callback. v5: - Made the crcs array in drm_crtc_crc_entry fixed-size - Lots of other smaller improvements suggested by Emil Velikov v7: - Move definition of drm_debugfs_crtc_crc_add to drm_internal.h v8: - Call debugfs_remove_recursive when we fail to create the minor device v9: - Register the debugfs directory for a crtc from drm_crtc_register_all() v10: - Don't let debugfs failures interrupt CRTC registration (Emil Velikov) v11: - Remove extra brace that broke compilation. Sorry! Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Acked-by: Benjamin Gaignard <benjamin.gaignard@linaro.org> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1475767268-14379-3-git-send-email-tomeu.vizoso@collabora.com
139 lines
4.8 KiB
C
139 lines
4.8 KiB
C
/*
|
|
* Copyright © 2014 Intel Corporation
|
|
* Daniel Vetter <daniel.vetter@ffwll.ch>
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
* to deal in the Software without restriction, including without limitation
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be included in
|
|
* all copies or substantial portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
* OTHER DEALINGS IN THE SOFTWARE.
|
|
*/
|
|
|
|
#define DRM_IF_MAJOR 1
|
|
#define DRM_IF_MINOR 4
|
|
|
|
/* drm_irq.c */
|
|
extern unsigned int drm_timestamp_monotonic;
|
|
|
|
/* drm_fops.c */
|
|
extern struct mutex drm_global_mutex;
|
|
void drm_lastclose(struct drm_device *dev);
|
|
|
|
/* drm_pci.c */
|
|
int drm_irq_by_busid(struct drm_device *dev, void *data,
|
|
struct drm_file *file_priv);
|
|
|
|
/* drm_prime.c */
|
|
int drm_prime_handle_to_fd_ioctl(struct drm_device *dev, void *data,
|
|
struct drm_file *file_priv);
|
|
int drm_prime_fd_to_handle_ioctl(struct drm_device *dev, void *data,
|
|
struct drm_file *file_priv);
|
|
|
|
void drm_prime_init_file_private(struct drm_prime_file_private *prime_fpriv);
|
|
void drm_prime_destroy_file_private(struct drm_prime_file_private *prime_fpriv);
|
|
void drm_prime_remove_buf_handle_locked(struct drm_prime_file_private *prime_fpriv,
|
|
struct dma_buf *dma_buf);
|
|
|
|
/* drm_info.c */
|
|
int drm_name_info(struct seq_file *m, void *data);
|
|
int drm_clients_info(struct seq_file *m, void* data);
|
|
int drm_gem_name_info(struct seq_file *m, void *data);
|
|
|
|
/* drm_irq.c */
|
|
int drm_control(struct drm_device *dev, void *data,
|
|
struct drm_file *file_priv);
|
|
int drm_modeset_ctl(struct drm_device *dev, void *data,
|
|
struct drm_file *file_priv);
|
|
|
|
/* drm_auth.c */
|
|
int drm_getmagic(struct drm_device *dev, void *data,
|
|
struct drm_file *file_priv);
|
|
int drm_authmagic(struct drm_device *dev, void *data,
|
|
struct drm_file *file_priv);
|
|
int drm_setmaster_ioctl(struct drm_device *dev, void *data,
|
|
struct drm_file *file_priv);
|
|
int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
|
|
struct drm_file *file_priv);
|
|
int drm_master_open(struct drm_file *file_priv);
|
|
void drm_master_release(struct drm_file *file_priv);
|
|
|
|
/* drm_sysfs.c */
|
|
extern struct class *drm_class;
|
|
|
|
int drm_sysfs_init(void);
|
|
void drm_sysfs_destroy(void);
|
|
struct device *drm_sysfs_minor_alloc(struct drm_minor *minor);
|
|
int drm_sysfs_connector_add(struct drm_connector *connector);
|
|
void drm_sysfs_connector_remove(struct drm_connector *connector);
|
|
|
|
/* drm_gem.c */
|
|
int drm_gem_init(struct drm_device *dev);
|
|
void drm_gem_destroy(struct drm_device *dev);
|
|
int drm_gem_handle_create_tail(struct drm_file *file_priv,
|
|
struct drm_gem_object *obj,
|
|
u32 *handlep);
|
|
int drm_gem_close_ioctl(struct drm_device *dev, void *data,
|
|
struct drm_file *file_priv);
|
|
int drm_gem_flink_ioctl(struct drm_device *dev, void *data,
|
|
struct drm_file *file_priv);
|
|
int drm_gem_open_ioctl(struct drm_device *dev, void *data,
|
|
struct drm_file *file_priv);
|
|
void drm_gem_open(struct drm_device *dev, struct drm_file *file_private);
|
|
void drm_gem_release(struct drm_device *dev, struct drm_file *file_private);
|
|
|
|
/* drm_debugfs.c */
|
|
#if defined(CONFIG_DEBUG_FS)
|
|
int drm_debugfs_init(struct drm_minor *minor, int minor_id,
|
|
struct dentry *root);
|
|
int drm_debugfs_cleanup(struct drm_minor *minor);
|
|
int drm_debugfs_connector_add(struct drm_connector *connector);
|
|
void drm_debugfs_connector_remove(struct drm_connector *connector);
|
|
int drm_debugfs_crtc_add(struct drm_crtc *crtc);
|
|
void drm_debugfs_crtc_remove(struct drm_crtc *crtc);
|
|
int drm_debugfs_crtc_crc_add(struct drm_crtc *crtc);
|
|
#else
|
|
static inline int drm_debugfs_init(struct drm_minor *minor, int minor_id,
|
|
struct dentry *root)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline int drm_debugfs_cleanup(struct drm_minor *minor)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline int drm_debugfs_connector_add(struct drm_connector *connector)
|
|
{
|
|
return 0;
|
|
}
|
|
static inline void drm_debugfs_connector_remove(struct drm_connector *connector)
|
|
{
|
|
}
|
|
|
|
static inline int drm_debugfs_crtc_add(struct drm_crtc *crtc)
|
|
{
|
|
return 0;
|
|
}
|
|
static inline void drm_debugfs_crtc_remove(struct drm_crtc *crtc)
|
|
{
|
|
}
|
|
|
|
static inline int drm_debugfs_crtc_crc_add(struct drm_crtc *crtc)
|
|
{
|
|
return 0;
|
|
}
|
|
#endif
|