<div dir="ltr">In many games open source video drivers can't adjust screen brightness.It would be nice to have a way to change the brightness<div><br></div><div><div>diff --git src/gallium/auxiliary/postprocess/filters.h src/gallium/auxiliary/postprocess/filters.h</div>
<div>index 321f333..4423c2e 100644</div><div>--- src/gallium/auxiliary/postprocess/filters.h</div><div>+++ src/gallium/auxiliary/postprocess/filters.h</div><div>@@ -30,7 +30,7 @@</div><div> </div><div> #include "postprocess/postprocess.h"</div>
<div> </div><div>-#define PP_FILTERS 6            /* Increment this if you add filters */</div><div>+#define PP_FILTERS 7            /* Increment this if you add filters */</div><div> #define PP_MAX_PASSES 6</div><div> </div>
<div> </div><div>@@ -59,6 +59,7 @@ static const struct pp_filter_t pp_filters[PP_FILTERS] = {</div><div>    { "pp_celshade",<span class="" style="white-space:pre">           </span>0,<span class="" style="white-space:pre">        </span>2,<span class="" style="white-space:pre">        </span>1,<span class="" style="white-space:pre">        </span>pp_celshade_init,<span class="" style="white-space:pre"> </span>pp_nocolor,               pp_celshade_free },</div>
<div>    { "pp_jimenezmlaa",<span class="" style="white-space:pre">           </span>2,<span class="" style="white-space:pre">        </span>5,<span class="" style="white-space:pre">        </span>2,<span class="" style="white-space:pre">        </span>pp_jimenezmlaa_init,<span class="" style="white-space:pre">      </span>pp_jimenezmlaa,           pp_jimenezmlaa_free },</div>
<div>    { "pp_jimenezmlaa_color",<span class="" style="white-space:pre">     </span>2,<span class="" style="white-space:pre">        </span>5,<span class="" style="white-space:pre">        </span>2,<span class="" style="white-space:pre">        </span>pp_jimenezmlaa_init_color, pp_jimenezmlaa_color,  pp_jimenezmlaa_free },</div>
<div>+   { "pp_bright", <span class="" style="white-space:pre">               </span>0,<span class="" style="white-space:pre">        </span>2,<span class="" style="white-space:pre">        </span>1,<span class="" style="white-space:pre">        </span>pp_bright_init,<span class="" style="white-space:pre">           </span>pp_nocolor,               pp_nocolor_free },</div>
<div> };</div><div> </div><div> #endif</div><div>diff --git src/gallium/auxiliary/postprocess/postprocess.h src/gallium/auxiliary/postprocess/postprocess.h</div><div>index c72f2c4..e43241e 100644</div><div>--- src/gallium/auxiliary/postprocess/postprocess.h</div>
<div>+++ src/gallium/auxiliary/postprocess/postprocess.h</div><div>@@ -78,6 +78,7 @@ bool pp_noblue_init(struct pp_queue_t *, unsigned int, unsigned int);</div><div> bool pp_jimenezmlaa_init(struct pp_queue_t *, unsigned int, unsigned int);</div>
<div> bool pp_jimenezmlaa_init_color(struct pp_queue_t *, unsigned int,</div><div>                                unsigned int);</div><div>+bool pp_bright_init(struct pp_queue_t *, unsigned int, unsigned int);</div><div> </div>
<div> /* The filter free functions */</div><div> </div><div>diff --git src/gallium/auxiliary/postprocess/pp_colors.c src/gallium/auxiliary/postprocess/pp_colors.c</div><div>index 247e4df..9915bd1 100644</div><div>--- src/gallium/auxiliary/postprocess/pp_colors.c</div>
<div>+++ src/gallium/auxiliary/postprocess/pp_colors.c</div><div>@@ -87,6 +87,16 @@ pp_noblue_init(struct pp_queue_t *ppq, unsigned int n, unsigned int val)</div><div>    return (ppq->shaders[n][1] != NULL) ? TRUE : FALSE;</div>
<div> }</div><div> </div><div>+</div><div>+bool</div><div>+pp_bright_init(struct pp_queue_t *ppq, unsigned int n, unsigned int val)</div><div>+{</div><div>+   ppq->shaders[n][1] =</div><div>+      pp_tgsi_to_state(ppq->p->pipe, bright, false, "bright");</div>
<div>+</div><div>+   return (ppq->shaders[n][1] != NULL) ? TRUE : FALSE;</div><div>+}</div><div>+</div><div> /* Free functions */</div><div> void</div><div> pp_nocolor_free(struct pp_queue_t *ppq, unsigned int n)</div>
<div>diff --git src/gallium/auxiliary/postprocess/pp_colors.h src/gallium/auxiliary/postprocess/pp_colors.h</div><div>index a79858e..66b9690 100644</div><div>--- src/gallium/auxiliary/postprocess/pp_colors.h</div><div>+++ src/gallium/auxiliary/postprocess/pp_colors.h</div>
<div>@@ -65,5 +65,20 @@ static const char noblue[] = "FRAG\n"</div><div>    "  1: MOV TEMP[0].z, IMM[0].xxxx\n"</div><div>    "  2: MOV OUT[0], TEMP[0]\n"</div><div>    "  3: END\n";</div>
<div>-</div><div>+ </div><div>+ </div><div>+static const char bright[] = "FRAG\n"</div><div>+  "PROPERTY FS_COLOR0_WRITES_ALL_CBUFS 1\n"</div><div>+  "DCL IN[0], GENERIC[0], PERSPECTIVE\n"</div>
<div>+  "DCL OUT[0], COLOR\n"</div><div>+  "DCL SAMP[0]\n"</div><div>+  "DCL TEMP[0..1]\n"</div><div>+  "IMM FLT32 {    0.0000,     1.5000,     0.0000,     0.0000}\n"</div><div>+  "  0: MOV TEMP[0].w, IMM[0].xxxx\n"</div>
<div>+  "  1: MOV TEMP[1].xy, IN[0].xyyy\n"</div><div>+  "  2: TEX TEMP[1].xyz, TEMP[1], SAMP[0], 2D\n"</div><div>+  "  3: MUL TEMP[0].xyz, TEMP[1].xyzz, IMM[0].yyyy\n"</div><div>+  "  4: MOV OUT[0], TEMP[0]\n"</div>
<div>+  "  5: END\n";</div><div>+ </div><div> #endif</div><div>diff --git src/gallium/state_trackers/dri/common/dri_screen.c src/gallium/state_trackers/dri/common/dri_screen.c</div><div>index 7a6dcb2..66cf785 100644</div>
<div>--- src/gallium/state_trackers/dri/common/dri_screen.c</div><div>+++ src/gallium/state_trackers/dri/common/dri_screen.c</div><div>@@ -58,6 +58,7 @@ const __DRIconfigOptionsExtension gallium_config_options = {</div><div>
          DRI_CONF_PP_NORED(0)</div><div>          DRI_CONF_PP_NOGREEN(0)</div><div>          DRI_CONF_PP_NOBLUE(0)</div><div>+<span class="" style="white-space:pre">    </span> DRI_CONF_PP_BRIGHT(0)</div><div>          DRI_CONF_PP_JIMENEZMLAA(0, 0, 32)</div>
<div>          DRI_CONF_PP_JIMENEZMLAA_COLOR(0, 0, 32)</div><div>       DRI_CONF_SECTION_END</div><div>diff --git src/mesa/drivers/dri/common/xmlpool/t_options.h src/mesa/drivers/dri/common/xmlpool/t_options.h</div><div>index 3bf804a..bd428c2 100644</div>
<div>--- src/mesa/drivers/dri/common/xmlpool/t_options.h</div><div>+++ src/mesa/drivers/dri/common/xmlpool/t_options.h</div><div>@@ -195,6 +195,11 @@ DRI_CONF_OPT_BEGIN_V(pp_nored,enum,def,"0:1") \</div><div>         DRI_CONF_DESC(en,gettext("A post-processing filter to remove the red channel")) \</div>
<div> DRI_CONF_OPT_END</div><div> </div><div>+#define DRI_CONF_PP_BRIGHT(def) \</div><div>+DRI_CONF_OPT_BEGIN_V(pp_bright,enum,def,"0:1") \</div><div>+        DRI_CONF_DESC(en,gettext("A post-processing filter to adjust  brightness")) \</div>
<div>+DRI_CONF_OPT_END</div><div>+</div><div> #define DRI_CONF_PP_NOGREEN(def) \</div><div> DRI_CONF_OPT_BEGIN_V(pp_nogreen,enum,def,"0:1") \</div><div>         DRI_CONF_DESC(en,gettext("A post-processing filter to remove the green channel")) \</div>
</div></div>