Display and control your Android device
Add option --no-mipmaps
Romain Vimont11a61b2cb374
diff --git a/app/scrcpy.1 b/app/scrcpy.1index 99936732..673cd11d 100644--- a/app/scrcpy.1+++ b/app/scrcpy.1@@ -74,6 +74,10 @@ Disable device control (mirror the device in read\-only)..B \-N, \-\-no\-displayDo not display device (only when screen recording is enabled).+.TP+.B \-\-no\-mipmaps+If the renderer is OpenGL 3.0+ or OpenGL ES 2.0+, then mipmaps are automatically generated to improve downscaling quality. This option disables the generation of mipmaps.+.TP.BI "\-p, \-\-port " port[:port]Set the TCP port (range) used by the client to listen.diff --git a/app/src/cli.c b/app/src/cli.cindex 9c79eb02..13351dee 100644--- a/app/src/cli.c+++ b/app/src/cli.c@@ -75,6 +75,11 @@ scrcpy_print_usage(const char *arg0) {" Do not display device (only when screen recording is\n"" enabled).\n""\n"+ " --no-mipmaps\n"+ " If the renderer is OpenGL 3.0+ or OpenGL ES 2.0+, then\n"+ " mipmaps are automatically generated to improve downscaling\n"+ " quality. This option disables the generation of mipmaps.\n"+ "\n"" -p, --port port[:port]\n"" Set the TCP port (range) used by the client to listen.\n"" Default is %d:%d.\n"@@ -462,6 +467,7 @@ guess_record_format(const char *filename) {#define OPT_DISPLAY_ID 1014#define OPT_ROTATION 1015#define OPT_RENDER_DRIVER 1016+#define OPT_NO_MIPMAPS 1017boolscrcpy_parse_args(struct scrcpy_cli_args *args, int argc, char *argv[]) {@@ -478,6 +484,7 @@ scrcpy_parse_args(struct scrcpy_cli_args *args, int argc, char *argv[]) {{"max-size", required_argument, NULL, 'm'},{"no-control", no_argument, NULL, 'n'},{"no-display", no_argument, NULL, 'N'},+ {"no-mipmaps", no_argument, NULL, OPT_NO_MIPMAPS},{"port", required_argument, NULL, 'p'},{"push-target", required_argument, NULL, OPT_PUSH_TARGET},{"record", required_argument, NULL, 'r'},@@ -629,6 +636,9 @@ scrcpy_parse_args(struct scrcpy_cli_args *args, int argc, char *argv[]) {case OPT_RENDER_DRIVER:opts->render_driver = optarg;break;+ case OPT_NO_MIPMAPS:+ opts->mipmaps = false;+ break;default:// getopt prints the error message on stderrreturn false;diff --git a/app/src/scrcpy.c b/app/src/scrcpy.cindex 0fe3d0f0..81f8239e 100644--- a/app/src/scrcpy.c+++ b/app/src/scrcpy.c@@ -401,7 +401,7 @@ scrcpy(const struct scrcpy_options *options) {options->window_y, options->window_width,options->window_height,options->window_borderless,- options->rotation)) {+ options->rotation, options-> mipmaps)) {goto end;}diff --git a/app/src/scrcpy.h b/app/src/scrcpy.hindex a53aaa21..d6b0a0f6 100644--- a/app/src/scrcpy.h+++ b/app/src/scrcpy.h@@ -37,6 +37,7 @@ struct scrcpy_options {bool render_expired_frames;bool prefer_text;bool window_borderless;+ bool mipmaps;};#define SCRCPY_OPTIONS_DEFAULT { \@@ -70,6 +71,7 @@ struct scrcpy_options {.render_expired_frames = false, \.prefer_text = false, \.window_borderless = false, \+ .mipmaps = true, \}booldiff --git a/app/src/screen.c b/app/src/screen.cindex c982a5c8..512d7bbd 100644--- a/app/src/screen.c+++ b/app/src/screen.c@@ -199,7 +199,7 @@ screen_init_rendering(struct screen *screen, const char *window_title,struct size frame_size, bool always_on_top,int16_t window_x, int16_t window_y, uint16_t window_width,uint16_t window_height, bool window_borderless,- uint8_t rotation) {+ uint8_t rotation, bool mipmaps) {screen->frame_size = frame_size;screen->rotation = rotation;if (rotation) {@@ -266,15 +266,19 @@ screen_init_rendering(struct screen *screen, const char *window_title,LOGI("OpenGL version: %s", gl->version);- bool supports_mipmaps =- sc_opengl_version_at_least(gl, 3, 0, /* OpenGL 3.0+ */- 2, 0 /* OpenGL ES 2.0+ */);- if (supports_mipmaps) {- LOGI("Trilinear filtering enabled");- screen->mipmaps = true;+ if (mipmaps) {+ bool supports_mipmaps =+ sc_opengl_version_at_least(gl, 3, 0, /* OpenGL 3.0+ */+ 2, 0 /* OpenGL ES 2.0+ */);+ if (supports_mipmaps) {+ LOGI("Trilinear filtering enabled");+ screen->mipmaps = true;+ } else {+ LOGW("Trilinear filtering disabled "+ "(OpenGL 3.0+ or ES 2.0+ required)");+ }} else {- LOGW("Trilinear filtering disabled "- "(OpenGL 3.0+ or ES 2.0+ required)");+ LOGI("Trilinear filtering disabled");}} else {LOGW("Trilinear filtering disabled (not an OpenGL renderer)");diff --git a/app/src/screen.h b/app/src/screen.hindex 90537463..c9e019a1 100644--- a/app/src/screen.h+++ b/app/src/screen.h@@ -76,7 +76,7 @@ screen_init_rendering(struct screen *screen, const char *window_title,struct size frame_size, bool always_on_top,int16_t window_x, int16_t window_y, uint16_t window_width,uint16_t window_height, bool window_borderless,- uint8_t rotation);+ uint8_t rotation, bool mipmaps);// show the windowvoid