summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo De La Garza <pdelagarza@nvidia.com>2017-03-23 16:05:02 -0700
committerAaron Plattner <aplattner@nvidia.com>2017-06-01 13:04:53 -0700
commit6ac2afc0d7d8d51d4085767b901667393c11061b (patch)
treeed76382410d5ef2bf750af934490bf1a81a246e2
parent5d5db88d106a49d7560a8042fa054df8b609f00a (diff)
xrandr: Add a "--filter" flag
Flag can be set to "nearest" or "bilinear" Signed-off-by: Pablo De La Garza <pdelagarza@nvidia.com> [aplattner@nvidia.com: Fixed style and whitespace] Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
-rw-r--r--xrandr.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/xrandr.c b/xrandr.c
index 2aad946..2d4cb72 100644
--- a/xrandr.c
+++ b/xrandr.c
@@ -54,6 +54,11 @@ static Bool automatic = False;
static Bool properties = False;
static Bool grab_server = True;
static Bool no_primary = False;
+static int filter_type = -1;
+
+static const char *filter_names[2] = {
+ "bilinear",
+ "nearest"};
static const char *direction[5] = {
"normal",
@@ -135,6 +140,7 @@ usage(void)
" --scale <x>x<y>\n"
" --scale-from <w>x<h>\n"
" --transform <a>,<b>,<c>,<d>,<e>,<f>,<g>,<h>,<i>\n"
+ " --filter nearest,bilinear\n"
" --off\n"
" --crtc <crtc>\n"
" --panning <w>x<h>[+<x>+<y>[/<track:w>x<h>+<x>+<y>[/<border:l>/<t>/<r>/<b>]]]\n"
@@ -285,6 +291,7 @@ typedef enum _changes {
changes_panning = (1 << 10),
changes_gamma = (1 << 11),
changes_primary = (1 << 12),
+ changes_filter = (1 << 13),
} changes_t;
typedef enum _name_kind {
@@ -1311,6 +1318,10 @@ set_output_info (output_t *output, RROutput xid, XRROutputInfo *output_info)
output->transform.params = NULL;
}
}
+ if (output->changes & changes_filter)
+ {
+ output->transform.filter = filter_names[filter_type];
+ }
/* set primary */
if (!(output->changes & changes_primary))
@@ -2808,6 +2819,28 @@ main (int argc, char **argv)
action_requested = True;
continue;
}
+ if (!strcmp("--filter", argv[i])) {
+ int t;
+
+ if (!config_output) argerr ("%s must be used after --output\n", argv[i]);
+ if (++i >= argc) argerr("%s requires an argument\n", argv[i-1]);
+
+ filter_type = -1;
+ for (t = 0; t < sizeof(filter_names) / sizeof(filter_names[0]); t++)
+ {
+ if (!strcmp(filter_names[t], argv[i]))
+ {
+ filter_type = t;
+ break;
+ }
+ }
+
+ if (filter_type == -1) argerr("Bad argument: %s, for a filter\n", argv[i]);
+
+ config_output->changes |= changes_filter;
+ action_requested = True;
+ continue;
+ }
if (!strcmp ("--crtc", argv[i])) {
if (!config_output) argerr ("%s must be used after --output\n", argv[i]);
if (++i >= argc) argerr ("%s requires an argument\n", argv[i-1]);