Commit e5f75aca authored by Damien Lespiau's avatar Damien Lespiau Committed by Daniel Vetter

drm/i915: Dynamically allocate the CRC circular buffer

So we don't eat that memory when not needed.
Signed-off-by: default avatarDamien Lespiau <damien.lespiau@intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 4b584369
...@@ -1822,6 +1822,12 @@ static int pipe_crc_set_source(struct drm_device *dev, enum pipe pipe, ...@@ -1822,6 +1822,12 @@ static int pipe_crc_set_source(struct drm_device *dev, enum pipe pipe,
/* none -> real source transition */ /* none -> real source transition */
if (source) { if (source) {
pipe_crc->entries = kzalloc(sizeof(*pipe_crc->entries) *
INTEL_PIPE_CRC_ENTRIES_NR,
GFP_KERNEL);
if (!pipe_crc->entries)
return -ENOMEM;
atomic_set(&pipe_crc->head, 0); atomic_set(&pipe_crc->head, 0);
atomic_set(&pipe_crc->tail, 0); atomic_set(&pipe_crc->tail, 0);
} }
...@@ -1847,6 +1853,12 @@ static int pipe_crc_set_source(struct drm_device *dev, enum pipe pipe, ...@@ -1847,6 +1853,12 @@ static int pipe_crc_set_source(struct drm_device *dev, enum pipe pipe,
I915_WRITE(PIPE_CRC_CTL(pipe), val); I915_WRITE(PIPE_CRC_CTL(pipe), val);
POSTING_READ(PIPE_CRC_CTL(pipe)); POSTING_READ(PIPE_CRC_CTL(pipe));
/* real source -> none transition */
if (source == INTEL_PIPE_CRC_SOURCE_NONE) {
kfree(pipe_crc->entries);
pipe_crc->entries = NULL;
}
return 0; return 0;
} }
......
...@@ -1232,7 +1232,7 @@ struct intel_pipe_crc_entry { ...@@ -1232,7 +1232,7 @@ struct intel_pipe_crc_entry {
#define INTEL_PIPE_CRC_ENTRIES_NR 128 #define INTEL_PIPE_CRC_ENTRIES_NR 128
struct intel_pipe_crc { struct intel_pipe_crc {
struct intel_pipe_crc_entry entries[INTEL_PIPE_CRC_ENTRIES_NR]; struct intel_pipe_crc_entry *entries;
enum intel_pipe_crc_source source; enum intel_pipe_crc_source source;
atomic_t head, tail; atomic_t head, tail;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment