2005-04-17 06:20:36 +08:00
|
|
|
/*
|
2014-08-29 18:12:40 +08:00
|
|
|
* Internal Header for the Direct Rendering Manager
|
|
|
|
*
|
2005-04-17 06:20:36 +08:00
|
|
|
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
|
|
|
|
* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
|
2010-05-28 03:40:25 +08:00
|
|
|
* Copyright (c) 2009-2010, Code Aurora Forum.
|
2005-04-17 06:20:36 +08:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
2014-08-29 18:12:40 +08:00
|
|
|
* Author: Rickard E. (Rik) Faith <faith@valinux.com>
|
|
|
|
* Author: Gareth Hughes <gareth@valinux.com>
|
|
|
|
*
|
2005-04-17 06:20:36 +08:00
|
|
|
* 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 (including the next
|
|
|
|
* paragraph) 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
|
|
|
|
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _DRM_P_H_
|
|
|
|
#define _DRM_P_H_
|
|
|
|
|
2014-08-29 18:12:37 +08:00
|
|
|
#include <linux/agp_backend.h>
|
|
|
|
#include <linux/cdev.h>
|
|
|
|
#include <linux/dma-mapping.h>
|
|
|
|
#include <linux/file.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <linux/fs.h>
|
2014-08-29 18:12:37 +08:00
|
|
|
#include <linux/highmem.h>
|
|
|
|
#include <linux/idr.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <linux/init.h>
|
2014-08-29 18:12:37 +08:00
|
|
|
#include <linux/io.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <linux/jiffies.h>
|
2014-08-29 18:12:37 +08:00
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/kref.h>
|
|
|
|
#include <linux/miscdevice.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <linux/mm.h>
|
2006-02-02 16:37:46 +08:00
|
|
|
#include <linux/mutex.h>
|
2014-08-29 18:12:37 +08:00
|
|
|
#include <linux/platform_device.h>
|
|
|
|
#include <linux/poll.h>
|
2013-11-22 03:29:51 +08:00
|
|
|
#include <linux/ratelimit.h>
|
2014-08-29 18:12:37 +08:00
|
|
|
#include <linux/sched.h>
|
|
|
|
#include <linux/slab.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <linux/types.h>
|
2014-08-29 18:12:35 +08:00
|
|
|
#include <linux/vmalloc.h>
|
2014-08-29 18:12:37 +08:00
|
|
|
#include <linux/workqueue.h>
|
2016-10-25 20:00:45 +08:00
|
|
|
#include <linux/dma-fence.h>
|
2017-03-08 22:12:35 +08:00
|
|
|
#include <linux/module.h>
|
2014-08-29 18:12:37 +08:00
|
|
|
|
|
|
|
#include <asm/mman.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <asm/pgalloc.h>
|
2016-12-25 03:46:01 +08:00
|
|
|
#include <linux/uaccess.h>
|
2014-08-29 18:12:37 +08:00
|
|
|
|
2014-08-29 18:12:40 +08:00
|
|
|
#include <uapi/drm/drm.h>
|
|
|
|
#include <uapi/drm/drm_mode.h>
|
|
|
|
|
|
|
|
#include <drm/drm_agpsupport.h>
|
|
|
|
#include <drm/drm_crtc.h>
|
2016-06-09 17:54:08 +08:00
|
|
|
#include <drm/drm_fourcc.h>
|
2014-08-29 18:12:40 +08:00
|
|
|
#include <drm/drm_global.h>
|
2014-08-29 18:12:37 +08:00
|
|
|
#include <drm/drm_hashtab.h>
|
|
|
|
#include <drm/drm_mm.h>
|
|
|
|
#include <drm/drm_os_linux.h>
|
2012-10-03 01:01:03 +08:00
|
|
|
#include <drm/drm_sarea.h>
|
2016-11-14 19:58:19 +08:00
|
|
|
#include <drm/drm_drv.h>
|
2017-03-08 22:12:35 +08:00
|
|
|
#include <drm/drm_prime.h>
|
2017-03-08 22:12:37 +08:00
|
|
|
#include <drm/drm_pci.h>
|
2017-03-08 22:12:42 +08:00
|
|
|
#include <drm/drm_file.h>
|
2017-03-23 04:53:36 +08:00
|
|
|
#include <drm/drm_debugfs.h>
|
2017-03-23 04:54:47 +08:00
|
|
|
#include <drm/drm_ioctl.h>
|
2017-04-04 17:52:55 +08:00
|
|
|
#include <drm/drm_sysfs.h>
|
2017-05-31 17:21:46 +08:00
|
|
|
#include <drm/drm_vblank.h>
|
|
|
|
#include <drm/drm_irq.h>
|
2017-08-02 19:56:01 +08:00
|
|
|
#include <drm/drm_device.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2011-05-27 01:46:22 +08:00
|
|
|
struct module;
|
|
|
|
|
2012-10-29 01:28:06 +08:00
|
|
|
struct device_node;
|
2012-11-14 18:22:52 +08:00
|
|
|
struct videomode;
|
2014-07-01 18:57:26 +08:00
|
|
|
struct reservation_object;
|
2014-01-09 18:03:14 +08:00
|
|
|
struct dma_buf_attachment;
|
2012-11-14 18:22:52 +08:00
|
|
|
|
2017-03-08 22:12:37 +08:00
|
|
|
struct pci_dev;
|
|
|
|
struct pci_controller;
|
|
|
|
|
2009-07-20 13:48:06 +08:00
|
|
|
/*
|
2016-04-14 22:34:16 +08:00
|
|
|
* The following categories are defined:
|
2014-03-24 23:53:08 +08:00
|
|
|
*
|
|
|
|
* CORE: Used in the generic drm code: drm_ioctl.c, drm_mm.c, drm_memory.c, ...
|
|
|
|
* This is the category used by the DRM_DEBUG() macro.
|
|
|
|
*
|
|
|
|
* DRIVER: Used in the vendor specific part of the driver: i915, radeon, ...
|
|
|
|
* This is the category used by the DRM_DEBUG_DRIVER() macro.
|
2009-07-20 13:48:06 +08:00
|
|
|
*
|
2014-03-24 23:53:08 +08:00
|
|
|
* KMS: used in the modesetting code.
|
|
|
|
* This is the category used by the DRM_DEBUG_KMS() macro.
|
2009-07-20 13:48:06 +08:00
|
|
|
*
|
2014-03-24 23:53:08 +08:00
|
|
|
* PRIME: used in the prime code.
|
|
|
|
* This is the category used by the DRM_DEBUG_PRIME() macro.
|
2009-07-20 13:48:06 +08:00
|
|
|
*
|
2015-02-22 19:24:16 +08:00
|
|
|
* ATOMIC: used in the atomic code.
|
|
|
|
* This is the category used by the DRM_DEBUG_ATOMIC() macro.
|
|
|
|
*
|
2015-10-10 03:57:37 +08:00
|
|
|
* VBL: used for verbose debug message in the vblank code
|
|
|
|
* This is the category used by the DRM_DEBUG_VBL() macro.
|
|
|
|
*
|
2014-03-24 23:53:08 +08:00
|
|
|
* Enabling verbose debug messages is done through the drm.debug parameter,
|
|
|
|
* each category being enabled by a bit.
|
|
|
|
*
|
|
|
|
* drm.debug=0x1 will enable CORE messages
|
|
|
|
* drm.debug=0x2 will enable DRIVER messages
|
|
|
|
* drm.debug=0x3 will enable CORE and DRIVER messages
|
|
|
|
* ...
|
2015-10-10 03:57:37 +08:00
|
|
|
* drm.debug=0x3f will enable all messages
|
2014-03-24 23:53:08 +08:00
|
|
|
*
|
|
|
|
* An interesting feature is that it's possible to enable verbose logging at
|
|
|
|
* run-time by echoing the debug value in its sysfs node:
|
|
|
|
* # echo 0xf > /sys/module/drm/parameters/debug
|
2009-07-20 13:48:06 +08:00
|
|
|
*/
|
2016-08-16 07:18:04 +08:00
|
|
|
#define DRM_UT_NONE 0x00
|
2014-03-24 23:53:08 +08:00
|
|
|
#define DRM_UT_CORE 0x01
|
|
|
|
#define DRM_UT_DRIVER 0x02
|
|
|
|
#define DRM_UT_KMS 0x04
|
|
|
|
#define DRM_UT_PRIME 0x08
|
2015-02-22 19:24:16 +08:00
|
|
|
#define DRM_UT_ATOMIC 0x10
|
2015-10-10 03:57:37 +08:00
|
|
|
#define DRM_UT_VBL 0x20
|
2016-11-05 23:08:09 +08:00
|
|
|
#define DRM_UT_STATE 0x40
|
2017-03-18 06:33:22 +08:00
|
|
|
#define DRM_UT_LEASE 0x80
|
drm: add separate drm debugging levels
Now all the DRM debug info will be reported if the boot option of
"drm.debug=1" is added. Sometimes it is inconvenient to get the debug
info in KMS mode. We will get too much unrelated info.
This will separate several DRM debug levels and the debug level can be used
to print the different debug info. And the debug level is controlled by the
module parameter of drm.debug
In this patch it is divided into four debug levels;
drm_core, drm_driver, drm_kms, drm_mode.
At the same time we can get the different debug info by changing the debug
level. This can be done by adding the module parameter. Of course it can
be changed through the /sys/module/drm/parameters/debug after the system is
booted.
Four debug macro definitions are provided.
DRM_DEBUG(fmt, args...)
DRM_DEBUG_DRIVER(prefix, fmt, args...)
DRM_DEBUG_KMS(prefix, fmt, args...)
DRM_DEBUG_MODE(prefix, fmt, args...)
When the boot option of "drm.debug=4" is added, it will print the debug info
using DRM_DEBUG_KMS macro definition.
When the boot option of "drm.debug=6" is added, it will print the debug info
using DRM_DEBUG_KMS/DRM_DEBUG_DRIVER.
Sometimes we expect to print the value of an array.
For example: SDVO command,
In such case the following four DRM debug macro definitions are added:
DRM_LOG(fmt, args...)
DRM_LOG_DRIVER(fmt, args...)
DRM_LOG_KMS(fmt, args...)
DRM_LOG_MODE(fmt, args...)
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-06-02 14:09:47 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/***********************************************************************/
|
|
|
|
/** \name DRM template customization defaults */
|
|
|
|
/*@{*/
|
|
|
|
|
|
|
|
/***********************************************************************/
|
|
|
|
/** \name Macros to make printk easier */
|
|
|
|
/*@{*/
|
|
|
|
|
2016-08-19 01:17:22 +08:00
|
|
|
#define _DRM_PRINTK(once, level, fmt, ...) \
|
|
|
|
do { \
|
|
|
|
printk##once(KERN_##level "[" DRM_NAME "] " fmt, \
|
|
|
|
##__VA_ARGS__); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define DRM_INFO(fmt, ...) \
|
|
|
|
_DRM_PRINTK(, INFO, fmt, ##__VA_ARGS__)
|
|
|
|
#define DRM_NOTE(fmt, ...) \
|
|
|
|
_DRM_PRINTK(, NOTICE, fmt, ##__VA_ARGS__)
|
|
|
|
#define DRM_WARN(fmt, ...) \
|
|
|
|
_DRM_PRINTK(, WARNING, fmt, ##__VA_ARGS__)
|
|
|
|
|
|
|
|
#define DRM_INFO_ONCE(fmt, ...) \
|
|
|
|
_DRM_PRINTK(_once, INFO, fmt, ##__VA_ARGS__)
|
|
|
|
#define DRM_NOTE_ONCE(fmt, ...) \
|
|
|
|
_DRM_PRINTK(_once, NOTICE, fmt, ##__VA_ARGS__)
|
|
|
|
#define DRM_WARN_ONCE(fmt, ...) \
|
|
|
|
_DRM_PRINTK(_once, WARNING, fmt, ##__VA_ARGS__)
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/**
|
|
|
|
* Error output.
|
|
|
|
*
|
|
|
|
* \param fmt printf() like format string.
|
|
|
|
* \param arg arguments
|
|
|
|
*/
|
2016-08-16 07:18:04 +08:00
|
|
|
#define DRM_DEV_ERROR(dev, fmt, ...) \
|
|
|
|
drm_dev_printk(dev, KERN_ERR, DRM_UT_NONE, __func__, " *ERROR*",\
|
|
|
|
fmt, ##__VA_ARGS__)
|
|
|
|
#define DRM_ERROR(fmt, ...) \
|
2016-09-26 10:18:34 +08:00
|
|
|
drm_printk(KERN_ERR, DRM_UT_NONE, fmt, ##__VA_ARGS__)
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2013-11-22 03:29:51 +08:00
|
|
|
/**
|
|
|
|
* Rate limited error output. Like DRM_ERROR() but won't flood the log.
|
|
|
|
*
|
|
|
|
* \param fmt printf() like format string.
|
|
|
|
* \param arg arguments
|
|
|
|
*/
|
2016-08-16 07:18:04 +08:00
|
|
|
#define DRM_DEV_ERROR_RATELIMITED(dev, fmt, ...) \
|
2013-11-22 03:29:51 +08:00
|
|
|
({ \
|
|
|
|
static DEFINE_RATELIMIT_STATE(_rs, \
|
|
|
|
DEFAULT_RATELIMIT_INTERVAL, \
|
|
|
|
DEFAULT_RATELIMIT_BURST); \
|
|
|
|
\
|
|
|
|
if (__ratelimit(&_rs)) \
|
2016-08-16 07:18:04 +08:00
|
|
|
DRM_DEV_ERROR(dev, fmt, ##__VA_ARGS__); \
|
2013-11-22 03:29:51 +08:00
|
|
|
})
|
2016-08-16 07:18:04 +08:00
|
|
|
#define DRM_ERROR_RATELIMITED(fmt, ...) \
|
|
|
|
DRM_DEV_ERROR_RATELIMITED(NULL, fmt, ##__VA_ARGS__)
|
2013-11-22 03:29:51 +08:00
|
|
|
|
2016-08-16 07:18:04 +08:00
|
|
|
#define DRM_DEV_INFO(dev, fmt, ...) \
|
|
|
|
drm_dev_printk(dev, KERN_INFO, DRM_UT_NONE, __func__, "", fmt, \
|
|
|
|
##__VA_ARGS__)
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2016-08-16 07:18:04 +08:00
|
|
|
#define DRM_DEV_INFO_ONCE(dev, fmt, ...) \
|
|
|
|
({ \
|
|
|
|
static bool __print_once __read_mostly; \
|
|
|
|
if (!__print_once) { \
|
|
|
|
__print_once = true; \
|
|
|
|
DRM_DEV_INFO(dev, fmt, ##__VA_ARGS__); \
|
|
|
|
} \
|
|
|
|
})
|
2014-01-31 21:49:07 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/**
|
|
|
|
* Debug output.
|
2005-09-25 12:28:13 +08:00
|
|
|
*
|
2005-04-17 06:20:36 +08:00
|
|
|
* \param fmt printf() like format string.
|
|
|
|
* \param arg arguments
|
|
|
|
*/
|
2016-08-16 07:18:04 +08:00
|
|
|
#define DRM_DEV_DEBUG(dev, fmt, args...) \
|
|
|
|
drm_dev_printk(dev, KERN_DEBUG, DRM_UT_CORE, __func__, "", fmt, \
|
|
|
|
##args)
|
2016-09-26 10:18:34 +08:00
|
|
|
#define DRM_DEBUG(fmt, ...) \
|
|
|
|
drm_printk(KERN_DEBUG, DRM_UT_CORE, fmt, ##__VA_ARGS__)
|
drm: add separate drm debugging levels
Now all the DRM debug info will be reported if the boot option of
"drm.debug=1" is added. Sometimes it is inconvenient to get the debug
info in KMS mode. We will get too much unrelated info.
This will separate several DRM debug levels and the debug level can be used
to print the different debug info. And the debug level is controlled by the
module parameter of drm.debug
In this patch it is divided into four debug levels;
drm_core, drm_driver, drm_kms, drm_mode.
At the same time we can get the different debug info by changing the debug
level. This can be done by adding the module parameter. Of course it can
be changed through the /sys/module/drm/parameters/debug after the system is
booted.
Four debug macro definitions are provided.
DRM_DEBUG(fmt, args...)
DRM_DEBUG_DRIVER(prefix, fmt, args...)
DRM_DEBUG_KMS(prefix, fmt, args...)
DRM_DEBUG_MODE(prefix, fmt, args...)
When the boot option of "drm.debug=4" is added, it will print the debug info
using DRM_DEBUG_KMS macro definition.
When the boot option of "drm.debug=6" is added, it will print the debug info
using DRM_DEBUG_KMS/DRM_DEBUG_DRIVER.
Sometimes we expect to print the value of an array.
For example: SDVO command,
In such case the following four DRM debug macro definitions are added:
DRM_LOG(fmt, args...)
DRM_LOG_DRIVER(fmt, args...)
DRM_LOG_KMS(fmt, args...)
DRM_LOG_MODE(fmt, args...)
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-06-02 14:09:47 +08:00
|
|
|
|
2016-08-16 07:18:04 +08:00
|
|
|
#define DRM_DEV_DEBUG_DRIVER(dev, fmt, args...) \
|
|
|
|
drm_dev_printk(dev, KERN_DEBUG, DRM_UT_DRIVER, __func__, "", \
|
|
|
|
fmt, ##args)
|
2016-09-26 10:18:34 +08:00
|
|
|
#define DRM_DEBUG_DRIVER(fmt, ...) \
|
|
|
|
drm_printk(KERN_DEBUG, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
|
2016-08-16 07:18:04 +08:00
|
|
|
|
|
|
|
#define DRM_DEV_DEBUG_KMS(dev, fmt, args...) \
|
|
|
|
drm_dev_printk(dev, KERN_DEBUG, DRM_UT_KMS, __func__, "", fmt, \
|
|
|
|
##args)
|
2016-09-26 10:18:34 +08:00
|
|
|
#define DRM_DEBUG_KMS(fmt, ...) \
|
|
|
|
drm_printk(KERN_DEBUG, DRM_UT_KMS, fmt, ##__VA_ARGS__)
|
2016-08-16 07:18:04 +08:00
|
|
|
|
|
|
|
#define DRM_DEV_DEBUG_PRIME(dev, fmt, args...) \
|
|
|
|
drm_dev_printk(dev, KERN_DEBUG, DRM_UT_PRIME, __func__, "", \
|
|
|
|
fmt, ##args)
|
2016-09-26 10:18:34 +08:00
|
|
|
#define DRM_DEBUG_PRIME(fmt, ...) \
|
|
|
|
drm_printk(KERN_DEBUG, DRM_UT_PRIME, fmt, ##__VA_ARGS__)
|
2016-08-16 07:18:04 +08:00
|
|
|
|
|
|
|
#define DRM_DEV_DEBUG_ATOMIC(dev, fmt, args...) \
|
|
|
|
drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ATOMIC, __func__, "", \
|
|
|
|
fmt, ##args)
|
2016-09-26 10:18:34 +08:00
|
|
|
#define DRM_DEBUG_ATOMIC(fmt, ...) \
|
|
|
|
drm_printk(KERN_DEBUG, DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
|
2016-08-16 07:18:04 +08:00
|
|
|
|
|
|
|
#define DRM_DEV_DEBUG_VBL(dev, fmt, args...) \
|
|
|
|
drm_dev_printk(dev, KERN_DEBUG, DRM_UT_VBL, __func__, "", fmt, \
|
|
|
|
##args)
|
2016-09-26 10:18:34 +08:00
|
|
|
#define DRM_DEBUG_VBL(fmt, ...) \
|
|
|
|
drm_printk(KERN_DEBUG, DRM_UT_VBL, fmt, ##__VA_ARGS__)
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2017-03-18 06:33:22 +08:00
|
|
|
#define DRM_DEBUG_LEASE(fmt, ...) \
|
|
|
|
drm_printk(KERN_DEBUG, DRM_UT_LEASE, fmt, ##__VA_ARGS__)
|
|
|
|
|
2016-08-16 07:18:04 +08:00
|
|
|
#define _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, level, fmt, args...) \
|
|
|
|
({ \
|
|
|
|
static DEFINE_RATELIMIT_STATE(_rs, \
|
|
|
|
DEFAULT_RATELIMIT_INTERVAL, \
|
|
|
|
DEFAULT_RATELIMIT_BURST); \
|
|
|
|
if (__ratelimit(&_rs)) \
|
|
|
|
drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ ## level, \
|
|
|
|
__func__, "", fmt, ##args); \
|
|
|
|
})
|
2016-08-06 08:30:38 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Rate limited debug output. Like DRM_DEBUG() but won't flood the log.
|
|
|
|
*
|
|
|
|
* \param fmt printf() like format string.
|
|
|
|
* \param arg arguments
|
|
|
|
*/
|
2016-08-16 07:18:04 +08:00
|
|
|
#define DRM_DEV_DEBUG_RATELIMITED(dev, fmt, args...) \
|
|
|
|
DEV__DRM_DEFINE_DEBUG_RATELIMITED(dev, CORE, fmt, ##args)
|
2016-08-06 08:30:38 +08:00
|
|
|
#define DRM_DEBUG_RATELIMITED(fmt, args...) \
|
2016-08-16 07:18:04 +08:00
|
|
|
DRM_DEV_DEBUG_RATELIMITED(NULL, fmt, ##args)
|
|
|
|
#define DRM_DEV_DEBUG_DRIVER_RATELIMITED(dev, fmt, args...) \
|
|
|
|
_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, DRIVER, fmt, ##args)
|
2016-08-06 08:30:38 +08:00
|
|
|
#define DRM_DEBUG_DRIVER_RATELIMITED(fmt, args...) \
|
2016-08-16 07:18:04 +08:00
|
|
|
DRM_DEV_DEBUG_DRIVER_RATELIMITED(NULL, fmt, ##args)
|
|
|
|
#define DRM_DEV_DEBUG_KMS_RATELIMITED(dev, fmt, args...) \
|
|
|
|
_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, KMS, fmt, ##args)
|
2016-08-06 08:30:38 +08:00
|
|
|
#define DRM_DEBUG_KMS_RATELIMITED(fmt, args...) \
|
2016-08-16 07:18:04 +08:00
|
|
|
DRM_DEV_DEBUG_KMS_RATELIMITED(NULL, fmt, ##args)
|
|
|
|
#define DRM_DEV_DEBUG_PRIME_RATELIMITED(dev, fmt, args...) \
|
|
|
|
_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, PRIME, fmt, ##args)
|
2016-08-06 08:30:38 +08:00
|
|
|
#define DRM_DEBUG_PRIME_RATELIMITED(fmt, args...) \
|
2016-08-16 07:18:04 +08:00
|
|
|
DRM_DEV_DEBUG_PRIME_RATELIMITED(NULL, fmt, ##args)
|
2016-08-06 08:30:38 +08:00
|
|
|
|
2016-11-05 23:08:06 +08:00
|
|
|
/* Format strings and argument splitters to simplify printing
|
|
|
|
* various "complex" objects
|
|
|
|
*/
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/*@}*/
|
|
|
|
|
|
|
|
/***********************************************************************/
|
|
|
|
/** \name Internal types and structures */
|
|
|
|
/*@{*/
|
|
|
|
|
|
|
|
#define DRM_IF_VERSION(maj, min) (maj << 16 | min)
|
|
|
|
|
|
|
|
|
2016-12-22 16:50:42 +08:00
|
|
|
/**
|
|
|
|
* drm_drv_uses_atomic_modeset - check if the driver implements
|
|
|
|
* atomic_commit()
|
|
|
|
* @dev: DRM device
|
|
|
|
*
|
|
|
|
* This check is useful if drivers do not have DRIVER_ATOMIC set but
|
|
|
|
* have atomic modesetting internally implemented.
|
|
|
|
*/
|
|
|
|
static inline bool drm_drv_uses_atomic_modeset(struct drm_device *dev)
|
|
|
|
{
|
|
|
|
return dev->mode_config.funcs->atomic_commit != NULL;
|
|
|
|
}
|
|
|
|
|
2010-12-07 07:20:40 +08:00
|
|
|
#define DRM_SWITCH_POWER_ON 0
|
|
|
|
#define DRM_SWITCH_POWER_OFF 1
|
|
|
|
#define DRM_SWITCH_POWER_CHANGING 2
|
2012-09-12 13:55:05 +08:00
|
|
|
#define DRM_SWITCH_POWER_DYNAMIC_OFF 3
|
2010-12-07 07:20:40 +08:00
|
|
|
|
2005-09-25 12:28:13 +08:00
|
|
|
static __inline__ int drm_core_check_feature(struct drm_device *dev,
|
|
|
|
int feature)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
return ((dev->driver->driver_features & feature) ? 1 : 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************/
|
|
|
|
/** \name Internal function definitions */
|
|
|
|
/*@{*/
|
|
|
|
|
|
|
|
/* Driver support (drm_drv.h) */
|
|
|
|
|
2007-03-23 10:28:33 +08:00
|
|
|
/*
|
|
|
|
* These are exported to drivers so that they can implement fencing using
|
|
|
|
* DMA quiscent + idle. DMA quiescent usually requires the hardware lock.
|
|
|
|
*/
|
|
|
|
|
2010-12-15 01:16:38 +08:00
|
|
|
/*@}*/
|
|
|
|
|
2012-01-05 17:55:22 +08:00
|
|
|
/* returns true if currently okay to sleep */
|
|
|
|
static __inline__ bool drm_can_sleep(void)
|
|
|
|
{
|
|
|
|
if (in_atomic() || in_dbg_master() || irqs_disabled())
|
|
|
|
return false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
drm: fix potential dangling else problems in for_each_ macros
We have serious dangling else bugs waiting to happen in our for_each_
style macros with ifs. Consider, for example,
#define drm_for_each_plane_mask(plane, dev, plane_mask) \
list_for_each_entry((plane), &(dev)->mode_config.plane_list, head) \
if ((plane_mask) & (1 << drm_plane_index(plane)))
If this is used in context:
if (condition)
drm_for_each_plane_mask(plane, dev, plane_mask);
else
foo();
foo() will be called for each plane *not* in plane_mask, if condition
holds, and not at all if condition doesn't hold.
Fix this by reversing the conditions in the macros, and adding an else
branch for the "for each" block, so that other if/else blocks can't
interfere. Provide a "for_each_if" helper macro to make it easier to get
this right.
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1448392916-2281-1-git-send-email-jani.nikula@intel.com
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-11-25 03:21:55 +08:00
|
|
|
/* helper for handling conditionals in various for_each macros */
|
|
|
|
#define for_each_if(condition) if (!(condition)) {} else
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
#endif
|