diff options
-rw-r--r-- | src/gtk+-2.x/ctkevent.c | 3 | ||||
-rw-r--r-- | src/gtk+-2.x/ctkimagesliders.c | 53 | ||||
-rw-r--r-- | src/gtk+-2.x/ctkimagesliders.h | 1 | ||||
-rw-r--r-- | src/libXNVCtrl/NVCtrl.h | 16 | ||||
-rw-r--r-- | src/parse.c | 3 |
5 files changed, 70 insertions, 6 deletions
diff --git a/src/gtk+-2.x/ctkevent.c b/src/gtk+-2.x/ctkevent.c index ee80605..7690933 100644 --- a/src/gtk+-2.x/ctkevent.c +++ b/src/gtk+-2.x/ctkevent.c @@ -292,6 +292,7 @@ static void ctk_event_class_init(CtkEventClass *ctk_event_class) MAKE_SIGNAL(NV_CTRL_GVI_MAX_CHANNELS_PER_JACK); MAKE_SIGNAL(NV_CTRL_GVI_MAX_STREAMS); MAKE_SIGNAL(NV_CTRL_GVI_NUM_CAPTURE_SURFACES); + MAKE_SIGNAL(NV_CTRL_OVERSCAN_COMPENSATION); #undef MAKE_SIGNAL @@ -302,7 +303,7 @@ static void ctk_event_class_init(CtkEventClass *ctk_event_class) * knows about. */ -#if NV_CTRL_LAST_ATTRIBUTE != NV_CTRL_GVI_NUM_CAPTURE_SURFACES +#if NV_CTRL_LAST_ATTRIBUTE != NV_CTRL_OVERSCAN_COMPENSATION #warning "There are attributes that do not emit signals!" #endif diff --git a/src/gtk+-2.x/ctkimagesliders.c b/src/gtk+-2.x/ctkimagesliders.c index ace90fd..761acf3 100644 --- a/src/gtk+-2.x/ctkimagesliders.c +++ b/src/gtk+-2.x/ctkimagesliders.c @@ -37,6 +37,10 @@ static const char *__digital_vibrance_help = "The Digital Vibrance slider " "alters the level of Digital Vibrance for this display device."; +static const char *__overscan_compensation_help = "The Overscan Compensation " +"slider adjusts the amount of overscan compensation applied to this display " +"device, in raster pixels."; + static const char *__image_sharpening_help = "The Image Sharpening slider " "alters the level of Image Sharpening for this display device."; @@ -147,6 +151,22 @@ GtkWidget* ctk_image_sliders_new(NvCtrlAttributeHandle *handle, gtk_box_pack_start(GTK_BOX(vbox), ctk_image_sliders->digital_vibrance, TRUE, TRUE, 0); + /* Overscan Compensation */ + + ctk_image_sliders->overscan_compensation = + add_scale(ctk_config, + NV_CTRL_OVERSCAN_COMPENSATION, "Overscan Compensation", + __overscan_compensation_help, G_TYPE_INT, + ctk_image_sliders); + + g_signal_connect(G_OBJECT(ctk_event), + CTK_EVENT_NAME(NV_CTRL_OVERSCAN_COMPENSATION), + G_CALLBACK(scale_value_received), + (gpointer) ctk_image_sliders); + + gtk_box_pack_start(GTK_BOX(vbox), ctk_image_sliders->overscan_compensation, + TRUE, TRUE, 0); + /* Image Sharpening */ ctk_image_sliders->image_sharpening = @@ -300,6 +320,12 @@ void ctk_image_sliders_reset(CtkImageSliders *ctk_image_sliders) 0); } + /* + * Reset IMAGE_SHARPENING before OVERSCAN_COMPENSATION, even though they're + * in the other order in the page, because setting OVERSCAN_COMPENSATION to + * 0 may cause IMAGE_SHARPENING to become unavailable and trying to reset it + * here would cause a BadValue error. + */ if (get_scale_active(CTK_SCALE(ctk_image_sliders->image_sharpening))) { NvCtrlSetDisplayAttribute(ctk_image_sliders->handle, ctk_image_sliders->display_device_mask, @@ -307,6 +333,13 @@ void ctk_image_sliders_reset(CtkImageSliders *ctk_image_sliders) ctk_image_sliders->default_val); } + if (get_scale_active(CTK_SCALE(ctk_image_sliders->overscan_compensation))) { + NvCtrlSetDisplayAttribute(ctk_image_sliders->handle, + ctk_image_sliders->display_device_mask, + NV_CTRL_OVERSCAN_COMPENSATION, + 0); + } + ctk_image_sliders_setup(ctk_image_sliders); } /* ctk_image_sliders_reset() */ @@ -344,6 +377,9 @@ static void scale_value_received(GtkObject *object, gpointer arg1, case NV_CTRL_DIGITAL_VIBRANCE: scale = ctk_image_sliders->digital_vibrance; break; + case NV_CTRL_OVERSCAN_COMPENSATION: + scale = ctk_image_sliders->overscan_compensation; + break; case NV_CTRL_IMAGE_SHARPENING: scale = ctk_image_sliders->image_sharpening; if (event_struct->availability == FALSE) { @@ -403,7 +439,12 @@ void add_image_sliders_help(CtkImageSliders *ctk_image_sliders, "the color saturation of an image so that all images " "including 2D, 3D, and video appear brighter and " "crisper (even on flat panels) in your applications."); - + + ctk_help_heading(b, i, "Overscan Compensation"); + ctk_help_para(b, i, "Use the Overscan Compensation slider to adjust the " + "size of the display, to adjust for the overscan behavior of " + "certain display devices."); + ctk_help_heading(b, i, "Image Sharpening"); ctk_help_para(b, i, "Use the Image Sharpening slider to adjust the " "sharpness of the image quality by amplifying high " @@ -484,7 +525,12 @@ void ctk_image_sliders_setup(CtkImageSliders *ctk_image_sliders) setup_scale(ctk_image_sliders, NV_CTRL_DIGITAL_VIBRANCE, ctk_image_sliders->digital_vibrance); - + + /* NV_CTRL_OVERSCAN_COMPENSATION */ + + setup_scale(ctk_image_sliders, NV_CTRL_OVERSCAN_COMPENSATION, + ctk_image_sliders->overscan_compensation); + /* NV_CTRL_IMAGE_SHARPENING */ setup_scale(ctk_image_sliders, NV_CTRL_IMAGE_SHARPENING, @@ -492,8 +538,9 @@ void ctk_image_sliders_setup(CtkImageSliders *ctk_image_sliders) active = get_scale_active(CTK_SCALE(ctk_image_sliders->digital_vibrance)) || + get_scale_active(CTK_SCALE(ctk_image_sliders->overscan_compensation)) || get_scale_active(CTK_SCALE(ctk_image_sliders->image_sharpening)); - + if (!active) { gtk_widget_hide(ctk_image_sliders->frame); } else { diff --git a/src/gtk+-2.x/ctkimagesliders.h b/src/gtk+-2.x/ctkimagesliders.h index 3e5da70..c55e5c7 100644 --- a/src/gtk+-2.x/ctkimagesliders.h +++ b/src/gtk+-2.x/ctkimagesliders.h @@ -67,6 +67,7 @@ struct _CtkImageSliders GtkWidget *frame; GtkWidget *digital_vibrance; + GtkWidget *overscan_compensation; GtkWidget *image_sharpening; gint default_val; }; diff --git a/src/libXNVCtrl/NVCtrl.h b/src/libXNVCtrl/NVCtrl.h index 46e2af8..a74fb42 100644 --- a/src/libXNVCtrl/NVCtrl.h +++ b/src/libXNVCtrl/NVCtrl.h @@ -2665,8 +2665,22 @@ */ #define NV_CTRL_GVI_NUM_CAPTURE_SURFACES 338 /* RW-I */ +/* + * NV_CTRL_OVERSCAN_COMPENSATION - This option specifies the amount of overscan + * compensation to apply to the current mode. It is measured in raster pixels, + * i.e. pixels as specified in the current mode's backend timings. + * + * This option is similar to NV_CTRL_TV_OVERSCAN, but can be available on + * display devices other than TVs. It also has semantics that are the opposite + * of NV_CTRL_TV_OVERSCAN: a higher NV_CTRL_OVERSCAN_COMPENSATION makes the + * screen smaller instead of bigger. NV_CTRL_OVERSCAN_COMPENSATION and + * NV_CTRL_TV_OVERSCAN will not be available on the same display device at the + * same time. + */ +#define NV_CTRL_OVERSCAN_COMPENSATION 339 /* RWDG */ + -#define NV_CTRL_LAST_ATTRIBUTE NV_CTRL_GVI_NUM_CAPTURE_SURFACES +#define NV_CTRL_LAST_ATTRIBUTE NV_CTRL_OVERSCAN_COMPENSATION /**************************************************************************/ diff --git a/src/parse.c b/src/parse.c index c1a5fba..4afd211 100644 --- a/src/parse.c +++ b/src/parse.c @@ -267,6 +267,7 @@ AttributeTableEntry attributeTable[] = { { "GPUScalingActive", NV_CTRL_GPU_SCALING_ACTIVE, N, "Returns the current state of GPU scaling. GPU scaling is mode-specific (meaning it may vary depending on which mode is currently set). GPU scaling is active if the frontend timing (current resolution) is different than the target resolution. The target resolution is either the native resolution of the flat panel or the best fit resolution supported by the flat panel. What (and how) the GPU should scale to is controlled through the GPUScaling attribute." }, { "RefreshRate", NV_CTRL_REFRESH_RATE, N|H, "Returns the refresh rate of the specified display device in cHz (Centihertz) (i.e. to get the refresh rate in Hz, divide the returned value by 100.)" }, { "RefreshRate3", NV_CTRL_REFRESH_RATE_3, N|K, "Returns the refresh rate of the specified display device in mHz (Millihertz) (i.e. to get the refresh rate in Hz, divide the returned value by 1000.)" }, + { "OverscanCompensation", NV_CTRL_OVERSCAN_COMPENSATION, 0, "Adjust the amount of overscan compensation scaling, in pixels, to apply to the specified display device." }, /* TV */ { "TVOverScan", NV_CTRL_TV_OVERSCAN, 0, "Adjusts the amount of overscan on the specified display device." }, @@ -315,7 +316,7 @@ AttributeTableEntry attributeTable[] = { * about. */ -#if NV_CTRL_LAST_ATTRIBUTE != NV_CTRL_GVI_NUM_CAPTURE_SURFACES +#if NV_CTRL_LAST_ATTRIBUTE != NV_CTRL_OVERSCAN_COMPENSATION #warning "Have you forgotten to add a new integer attribute to attributeTable?" #endif |