drm/crc: Only report a single overflow when a CRC fd is opened
This reduces the amount of spam when you debug a CRC reading program. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> [mlankhorst: Change bool overflow to was_overflow (Ville)] Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20180418125121.72081-1-maarten.lankhorst@linux.intel.com
This commit is contained in:
parent
8adbbb2e78
commit
a012024571
|
@ -139,6 +139,7 @@ static int crtc_crc_data_count(struct drm_crtc_crc *crc)
|
||||||
static void crtc_crc_cleanup(struct drm_crtc_crc *crc)
|
static void crtc_crc_cleanup(struct drm_crtc_crc *crc)
|
||||||
{
|
{
|
||||||
kfree(crc->entries);
|
kfree(crc->entries);
|
||||||
|
crc->overflow = false;
|
||||||
crc->entries = NULL;
|
crc->entries = NULL;
|
||||||
crc->head = 0;
|
crc->head = 0;
|
||||||
crc->tail = 0;
|
crc->tail = 0;
|
||||||
|
@ -391,8 +392,14 @@ int drm_crtc_add_crc_entry(struct drm_crtc *crtc, bool has_frame,
|
||||||
tail = crc->tail;
|
tail = crc->tail;
|
||||||
|
|
||||||
if (CIRC_SPACE(head, tail, DRM_CRC_ENTRIES_NR) < 1) {
|
if (CIRC_SPACE(head, tail, DRM_CRC_ENTRIES_NR) < 1) {
|
||||||
|
bool was_overflow = crc->overflow;
|
||||||
|
|
||||||
|
crc->overflow = true;
|
||||||
spin_unlock(&crc->lock);
|
spin_unlock(&crc->lock);
|
||||||
DRM_ERROR("Overflow of CRC buffer, userspace reads too slow.\n");
|
|
||||||
|
if (!was_overflow)
|
||||||
|
DRM_ERROR("Overflow of CRC buffer, userspace reads too slow.\n");
|
||||||
|
|
||||||
return -ENOBUFS;
|
return -ENOBUFS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@ struct drm_crtc_crc_entry {
|
||||||
* @lock: protects the fields in this struct
|
* @lock: protects the fields in this struct
|
||||||
* @source: name of the currently configured source of CRCs
|
* @source: name of the currently configured source of CRCs
|
||||||
* @opened: whether userspace has opened the data file for reading
|
* @opened: whether userspace has opened the data file for reading
|
||||||
|
* @overflow: whether an overflow occured.
|
||||||
* @entries: array of entries, with size of %DRM_CRC_ENTRIES_NR
|
* @entries: array of entries, with size of %DRM_CRC_ENTRIES_NR
|
||||||
* @head: head of circular queue
|
* @head: head of circular queue
|
||||||
* @tail: tail of circular queue
|
* @tail: tail of circular queue
|
||||||
|
@ -52,7 +53,7 @@ struct drm_crtc_crc_entry {
|
||||||
struct drm_crtc_crc {
|
struct drm_crtc_crc {
|
||||||
spinlock_t lock;
|
spinlock_t lock;
|
||||||
const char *source;
|
const char *source;
|
||||||
bool opened;
|
bool opened, overflow;
|
||||||
struct drm_crtc_crc_entry *entries;
|
struct drm_crtc_crc_entry *entries;
|
||||||
int head, tail;
|
int head, tail;
|
||||||
size_t values_cnt;
|
size_t values_cnt;
|
||||||
|
|
Loading…
Reference in New Issue