diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-09-06 15:07:43 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-09-06 16:06:06 +0100 |
commit | f2ed1ac7b9807106405bbc2b18159a39c2d407d0 (patch) | |
tree | cd29111ecf445b6a7407ab033e2cd1b9b5ce29bb /src/sna/sna.h | |
parent | 56f532db2c9563c6d70da388f987f26530dcd38d (diff) |
sna: Listen to ACPI events for power state notifications
When on-battery, we would prefer to use more power efficient operations.
For example, the BCS is far more economical to more data around with, but
it doesn't have quite the same throughput as the hungry RCS. (Not that
there is any reason why, the BCS is supposed to run at full memory
speed, unfortunately that is main memory speed and not the caches...)
Note: that X already listens to acpid for video switch notifications, it
would be useful if we could extend that interface to emit power
notifications as well.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna.h')
-rw-r--r-- | src/sna/sna.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/sna/sna.h b/src/sna/sna.h index 5889c5f0..a081c0e9 100644 --- a/src/sna/sna.h +++ b/src/sna/sna.h @@ -231,6 +231,8 @@ struct sna { #define SNA_FORCE_SHADOW 0x20 #define SNA_FLUSH_GTT 0x40 #define SNA_IS_HOSTED 0x80 +#define SNA_PERFORMANCE 0x100 +#define SNA_POWERSAVE 0x200 #define SNA_REPROBE 0x80000000 unsigned cpu_features; @@ -323,6 +325,13 @@ struct sna { InputHandlerProc uevent_handler; #endif + struct { + int fd; + uint8_t offset; + uint8_t remain; + char event[256]; + } acpi; + struct sna_render render; #if DEBUG_MEMORY @@ -939,6 +948,17 @@ box_intersect(BoxPtr a, const BoxRec *b) unsigned sna_cpu_detect(void); char *sna_cpu_features_to_string(unsigned features, char *line); +/* sna_acpi.c */ +int sna_acpi_open(void); +void sna_acpi_init(struct sna *sna); +void _sna_acpi_wakeup(struct sna *sna); +static inline void sna_acpi_wakeup(struct sna *sna, void *read_mask) +{ + if (sna->acpi.fd >= 0 && FD_ISSET(sna->acpi.fd, (fd_set*)read_mask)) + _sna_acpi_wakeup(sna); +} +void sna_acpi_fini(struct sna *sna); + void sna_threads_init(void); int sna_use_threads (int width, int height, int threshold); void sna_threads_run(void (*func)(void *arg), void *arg); |