[PATCH xrandr] Adding a "--filter" flag

pdelagarza pdelagarza at nvidia.com
Wed Apr 5 00:57:29 UTC 2017


ping :)

Thanks,

Pablo

On Thu, 23 Mar 2017, Pablo De La Garza wrote:

> From: pdelagarza <pdelagarza at nvidia.com>
> 
> Flag can be set to "nearest" or "bilinear"
> 
> Signed-off-by: Pablo De La Garza <pdelagarza at nvidia.com>
> ---
>  xrandr.c | 35 +++++++++++++++++++++++++++++++++++
>  1 file changed, 35 insertions(+)
> 
> diff --git a/xrandr.c b/xrandr.c
> index dcfdde0..c2cc82e 100644
> --- a/xrandr.c
> +++ b/xrandr.c
> @@ -54,6 +54,12 @@ static Bool	automatic = False;
>  static Bool	properties = False;
>  static Bool	grab_server = True;
>  static Bool	no_primary = False;
> +static int      filterType = -1;
> +
> +static const char *filterTypeList[2] = {
> +    "bilinear",
> +    "nearest"};
> +
>  
>  static const char *direction[5] = {
>      "normal", 
> @@ -118,6 +124,7 @@ usage(void)
>             "  --fb <width>x<height>\n"
>             "  --fbmm <width>x<height>\n"
>             "  --dpi <dpi>/<output>\n"
> +           "  --filter <filterType>,    filterType: nearest, bilinear\n"
>             "  --output <output>\n"
>             "      --auto\n"
>             "      --mode <mode>\n"
> @@ -285,6 +292,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 +1319,11 @@ set_output_info (output_t *output, RROutput xid, XRROutputInfo *output_info)
>  	    output->transform.params = NULL;
>  	}
>      }
> +    if (output->changes & changes_filter)
> +    {
> +        output->transform.filter = filterTypeList[filterType];
> +    }
> +
>  
>      /* set primary */
>      if (!(output->changes & changes_primary))
> @@ -2808,6 +2821,28 @@ main (int argc, char **argv)
>  	    action_requested = True;
>  	    continue;
>  	}
> +
> +        if (!strcmp("--filter", 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]);
> +
> +            for (int t=0;t < sizeof(filterTypeList)/sizeof(filterTypeList[0]);t++)
> +            {
> +                if (!strcmp(filterTypeList[t],argv[i]))
> +                {
> +                    filterType = t;
> +                    break;
> +                }
> +            }
> +
> +            if (filterType==-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]);
> -- 
> 2.7.4
> 
> 


More information about the xorg-devel mailing list