Skip to content

Commit 52611eb

Browse files
authored
Implement refresh mode switching and full refresh request from apps (#31)
2 parents 7cec6be + a00a204 commit 52611eb

File tree

4 files changed

+19
-0
lines changed

4 files changed

+19
-0
lines changed

shim/README.MD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,4 @@ Inspired by [ddvk's awesome remarkable2-framebuffer](https://github.com/ddvk/rem
4242

4343
Default: UI
4444
- QTFB_SHIM_RESPECT_APP_REFRESH_MODES: Whether or not to let the application change the refresh mode (Default: true)
45+
- QTFB_SHIM_RESPECT_FULL_REFRESH_REQUESTS: Whether or not to perform full refreshes when the application requests them (Default: false)

shim/src/fb-shim.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ struct _32_bit_fb_fix_screeninfo {
3939
#endif
4040

4141
bool respectAppRefreshMode;
42+
bool respectFullRefreshRequests;
4243

4344
int fbShimOpen(const char *file) {
4445
return strcmp(file, FILE_FB) == 0 ? shmFD : INTERNAL_SHIM_NOT_APPLICABLE;
@@ -50,8 +51,19 @@ int fbShimClose(int fd) {
5051

5152
int translateWaveformMode(int waveformMode) {
5253
switch(waveformMode) {
54+
// GC16 refresh mode
5355
case 0x02:
5456
return REFRESH_MODE_CONTENT;
57+
// GL16 refresh mode
58+
case 0x03:
59+
return REFRESH_MODE_UI;
60+
// DU refresh mode
61+
case 0x01:
62+
return REFRESH_MODE_FAST;
63+
// A2 refresh mode
64+
case 0x04:
65+
return REFRESH_MODE_ANIMATE;
66+
// Fallback to UI mode for unsupported modes
5567
default:
5668
return REFRESH_MODE_UI;
5769
}
@@ -75,6 +87,10 @@ int fbShimIoctl(int fd, unsigned long request, char *ptr) {
7587
update->update_region.height
7688
);
7789

90+
if(update->update_mode == UPDATE_MODE_FULL && respectFullRefreshRequests) {
91+
clientConnection->requestFullRefresh();
92+
}
93+
7894
return 0;
7995
} else if (request == MXCFB_SET_AUTO_UPDATE_MODE) {
8096
return 0;

shim/src/fb-shim.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22

33
extern bool respectAppRefreshMode;
4+
extern bool respectFullRefreshRequests;
45

56
int fbShimOpen(const char *file);
67
int fbShimClose(int fd);

shim/src/shim.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ void __attribute__((constructor)) __construct () {
103103
shimInput = readEnvvarBoolean("QTFB_SHIM_INPUT", true);
104104
shimFramebuffer = readEnvvarBoolean("QTFB_SHIM_FB", true);
105105
respectAppRefreshMode = readEnvvarBoolean("QTFB_SHIM_RESPECT_APP_REFRESH_MODES", true);
106+
respectFullRefreshRequests = readEnvvarBoolean("QTFB_SHIM_RESPECT_FULL_REFRESH_REQUESTS", false);
106107

107108
identDigitizer = new std::set<fileident_t>();
108109
identTouchScreen = new std::set<fileident_t>();

0 commit comments

Comments
 (0)