Add non-rectangular clip debug setting

This change also reorganizes settings a little bit. A new section
called "Hardware accelerated rendering" now hosts all the 2D/GPU
related settings.

Change-Id: Ife2d466b94d69310c2056c3dcf5c13737319f989
This commit is contained in:
Romain Guy
2013-02-25 16:21:58 -08:00
parent 1022e801ba
commit 6b24c45813
4 changed files with 114 additions and 58 deletions

View File

@@ -765,6 +765,20 @@
<item>error</item> <item>error</item>
</string-array> </string-array>
<!-- Titles for non-rectangular clipping preference. [CHAR LIMIT=35] -->
<string-array name="show_non_rect_clip_entries">
<item>Off</item>
<item>Draw non-rectangular clip region in blue</item>
<item>Highlight tested drawing commands in green</item>
</string-array>
<!-- Values for non-rectangular clipping preference. -->
<string-array name="show_non_rect_clip_values" translatable="false" >
<item>hide</item>
<item>region</item>
<item>highlight</item>
</string-array>
<!-- Titles for frame time tracking preference. [CHAR LIMIT=35] --> <!-- Titles for frame time tracking preference. [CHAR LIMIT=35] -->
<string-array name="track_frame_time_entries"> <string-array name="track_frame_time_entries">
<item>Off</item> <item>Off</item>

View File

@@ -3873,6 +3873,9 @@
<!-- Preference category for drawing debugging development settings. [CHAR LIMIT=25] --> <!-- Preference category for drawing debugging development settings. [CHAR LIMIT=25] -->
<string name="debug_drawing_category">Drawing</string> <string name="debug_drawing_category">Drawing</string>
<!-- Preference category for hardware accelerated drawing debugging development settings. [CHAR LIMIT=50] -->
<string name="debug_hw_drawing_category">Hardware accelerated rendering</string>
<!-- Preference category for monitoring debugging development settings. [CHAR LIMIT=25] --> <!-- Preference category for monitoring debugging development settings. [CHAR LIMIT=25] -->
<string name="debug_monitoring_category">Monitoring</string> <string name="debug_monitoring_category">Monitoring</string>
@@ -3940,6 +3943,9 @@
<!-- UI debug setting: force anti-aliasing summary [CHAR LIMIT=50] --> <!-- UI debug setting: force anti-aliasing summary [CHAR LIMIT=50] -->
<string name="force_msaa_summary">Enable 4x MSAA in OpenGL ES 2.0 apps</string> <string name="force_msaa_summary">Enable 4x MSAA in OpenGL ES 2.0 apps</string>
<!-- UI debug setting: show when non-rectangular clip operations are used [CHAR LIMIT=50] -->
<string name="show_non_rect_clip">Debug non-rectangular clip operations</string>
<!-- UI debug setting: profile time taken by hardware acceleration to render apps [CHAR LIMIT=25] --> <!-- UI debug setting: profile time taken by hardware acceleration to render apps [CHAR LIMIT=25] -->
<string name="track_frame_time">Profile GPU rendering</string> <string name="track_frame_time">Profile GPU rendering</string>

View File

@@ -103,31 +103,16 @@
<PreferenceCategory android:key="debug_drawing_category" <PreferenceCategory android:key="debug_drawing_category"
android:title="@string/debug_drawing_category"> android:title="@string/debug_drawing_category">
<CheckBoxPreference
android:key="debug_layout"
android:title="@string/debug_layout"
android:summary="@string/debug_layout_summary"/>
<CheckBoxPreference
android:key="show_hw_screen_udpates"
android:title="@string/show_hw_screen_updates"
android:summary="@string/show_hw_screen_updates_summary"/>
<CheckBoxPreference
android:key="show_hw_layers_udpates"
android:title="@string/show_hw_layers_updates"
android:summary="@string/show_hw_layers_updates_summary"/>
<CheckBoxPreference
android:key="show_hw_overdraw"
android:title="@string/show_hw_overdraw"
android:summary="@string/show_hw_overdraw_summary"/>
<CheckBoxPreference <CheckBoxPreference
android:key="show_screen_updates" android:key="show_screen_updates"
android:title="@string/show_screen_updates" android:title="@string/show_screen_updates"
android:summary="@string/show_screen_updates_summary"/> android:summary="@string/show_screen_updates_summary"/>
<CheckBoxPreference
android:key="debug_layout"
android:title="@string/debug_layout"
android:summary="@string/debug_layout_summary"/>
<ListPreference <ListPreference
android:key="window_animation_scale" android:key="window_animation_scale"
android:title="@string/window_animation_scale_title" android:title="@string/window_animation_scale_title"
@@ -149,21 +134,6 @@
android:entries="@array/animator_duration_scale_entries" android:entries="@array/animator_duration_scale_entries"
android:entryValues="@array/animator_duration_scale_values" /> android:entryValues="@array/animator_duration_scale_values" />
<CheckBoxPreference
android:key="disable_overlays"
android:title="@string/disable_overlays"
android:summary="@string/disable_overlays_summary"/>
<CheckBoxPreference
android:key="force_hw_ui"
android:title="@string/force_hw_ui"
android:summary="@string/force_hw_ui_summary"/>
<CheckBoxPreference
android:key="force_msaa"
android:title="@string/force_msaa"
android:summary="@string/force_msaa_summary"/>
<ListPreference <ListPreference
android:key="overlay_display_devices" android:key="overlay_display_devices"
android:title="@string/overlay_display_devices_title" android:title="@string/overlay_display_devices_title"
@@ -173,6 +143,48 @@
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory android:key="debug_hw_drawing_category"
android:title="@string/debug_hw_drawing_category">
<CheckBoxPreference
android:key="force_hw_ui"
android:title="@string/force_hw_ui"
android:summary="@string/force_hw_ui_summary"/>
<CheckBoxPreference
android:key="show_hw_screen_udpates"
android:title="@string/show_hw_screen_updates"
android:summary="@string/show_hw_screen_updates_summary"/>
<CheckBoxPreference
android:key="show_hw_layers_udpates"
android:title="@string/show_hw_layers_updates"
android:summary="@string/show_hw_layers_updates_summary"/>
<CheckBoxPreference
android:key="show_hw_overdraw"
android:title="@string/show_hw_overdraw"
android:summary="@string/show_hw_overdraw_summary"/>
<ListPreference
android:key="show_non_rect_clip"
android:title="@string/show_non_rect_clip"
android:persistent="false"
android:entries="@array/show_non_rect_clip_entries"
android:entryValues="@array/show_non_rect_clip_values" />
<CheckBoxPreference
android:key="force_msaa"
android:title="@string/force_msaa"
android:summary="@string/force_msaa_summary"/>
<CheckBoxPreference
android:key="disable_overlays"
android:title="@string/disable_overlays"
android:summary="@string/disable_overlays_summary"/>
</PreferenceCategory>
<PreferenceCategory android:key="debug_monitoring_category" <PreferenceCategory android:key="debug_monitoring_category"
android:title="@string/debug_monitoring_category"> android:title="@string/debug_monitoring_category">

View File

@@ -46,11 +46,9 @@ import android.os.RemoteException;
import android.os.ServiceManager; import android.os.ServiceManager;
import android.os.StrictMode; import android.os.StrictMode;
import android.os.SystemProperties; import android.os.SystemProperties;
import android.os.Trace;
import android.os.UserHandle; import android.os.UserHandle;
import android.preference.CheckBoxPreference; import android.preference.CheckBoxPreference;
import android.preference.ListPreference; import android.preference.ListPreference;
import android.preference.MultiCheckPreference;
import android.preference.Preference; import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener; import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.PreferenceFragment; import android.preference.PreferenceFragment;
@@ -114,6 +112,7 @@ public class DevelopmentSettings extends PreferenceFragment
private static final String FORCE_HARDWARE_UI_KEY = "force_hw_ui"; private static final String FORCE_HARDWARE_UI_KEY = "force_hw_ui";
private static final String FORCE_MSAA_KEY = "force_msaa"; private static final String FORCE_MSAA_KEY = "force_msaa";
private static final String TRACK_FRAME_TIME_KEY = "track_frame_time"; private static final String TRACK_FRAME_TIME_KEY = "track_frame_time";
private static final String SHOW_NON_RECTANGULAR_CLIP_KEY = "show_non_rect_clip";
private static final String SHOW_HW_SCREEN_UPDATES_KEY = "show_hw_screen_udpates"; private static final String SHOW_HW_SCREEN_UPDATES_KEY = "show_hw_screen_udpates";
private static final String SHOW_HW_LAYERS_UPDATES_KEY = "show_hw_layers_udpates"; private static final String SHOW_HW_LAYERS_UPDATES_KEY = "show_hw_layers_udpates";
private static final String SHOW_HW_OVERDRAW_KEY = "show_hw_overdraw"; private static final String SHOW_HW_OVERDRAW_KEY = "show_hw_overdraw";
@@ -173,6 +172,7 @@ public class DevelopmentSettings extends PreferenceFragment
private CheckBoxPreference mShowHwOverdraw; private CheckBoxPreference mShowHwOverdraw;
private CheckBoxPreference mDebugLayout; private CheckBoxPreference mDebugLayout;
private ListPreference mTrackFrameTime; private ListPreference mTrackFrameTime;
private ListPreference mShowNonRectClip;
private ListPreference mWindowAnimationScale; private ListPreference mWindowAnimationScale;
private ListPreference mTransitionAnimationScale; private ListPreference mTransitionAnimationScale;
private ListPreference mAnimatorDurationScale; private ListPreference mAnimatorDurationScale;
@@ -252,36 +252,23 @@ public class DevelopmentSettings extends PreferenceFragment
mShowCpuUsage = findAndInitCheckboxPref(SHOW_CPU_USAGE_KEY); mShowCpuUsage = findAndInitCheckboxPref(SHOW_CPU_USAGE_KEY);
mForceHardwareUi = findAndInitCheckboxPref(FORCE_HARDWARE_UI_KEY); mForceHardwareUi = findAndInitCheckboxPref(FORCE_HARDWARE_UI_KEY);
mForceMsaa = findAndInitCheckboxPref(FORCE_MSAA_KEY); mForceMsaa = findAndInitCheckboxPref(FORCE_MSAA_KEY);
mTrackFrameTime = (ListPreference) findPreference(TRACK_FRAME_TIME_KEY); mTrackFrameTime = addListPreference(TRACK_FRAME_TIME_KEY);
mAllPrefs.add(mTrackFrameTime); mShowNonRectClip = addListPreference(SHOW_NON_RECTANGULAR_CLIP_KEY);
mTrackFrameTime.setOnPreferenceChangeListener(this);
mShowHwScreenUpdates = findAndInitCheckboxPref(SHOW_HW_SCREEN_UPDATES_KEY); mShowHwScreenUpdates = findAndInitCheckboxPref(SHOW_HW_SCREEN_UPDATES_KEY);
mShowHwLayersUpdates = findAndInitCheckboxPref(SHOW_HW_LAYERS_UPDATES_KEY); mShowHwLayersUpdates = findAndInitCheckboxPref(SHOW_HW_LAYERS_UPDATES_KEY);
mShowHwOverdraw = findAndInitCheckboxPref(SHOW_HW_OVERDRAW_KEY); mShowHwOverdraw = findAndInitCheckboxPref(SHOW_HW_OVERDRAW_KEY);
mDebugLayout = findAndInitCheckboxPref(DEBUG_LAYOUT_KEY); mDebugLayout = findAndInitCheckboxPref(DEBUG_LAYOUT_KEY);
mWindowAnimationScale = (ListPreference) findPreference(WINDOW_ANIMATION_SCALE_KEY); mWindowAnimationScale = addListPreference(WINDOW_ANIMATION_SCALE_KEY);
mAllPrefs.add(mWindowAnimationScale); mTransitionAnimationScale = addListPreference(TRANSITION_ANIMATION_SCALE_KEY);
mWindowAnimationScale.setOnPreferenceChangeListener(this); mAnimatorDurationScale = addListPreference(ANIMATOR_DURATION_SCALE_KEY);
mTransitionAnimationScale = (ListPreference) findPreference(TRANSITION_ANIMATION_SCALE_KEY); mOverlayDisplayDevices = addListPreference(OVERLAY_DISPLAY_DEVICES_KEY);
mAllPrefs.add(mTransitionAnimationScale); mOpenGLTraces = addListPreference(OPENGL_TRACES_KEY);
mTransitionAnimationScale.setOnPreferenceChangeListener(this);
mAnimatorDurationScale = (ListPreference) findPreference(ANIMATOR_DURATION_SCALE_KEY);
mAllPrefs.add(mAnimatorDurationScale);
mAnimatorDurationScale.setOnPreferenceChangeListener(this);
mOverlayDisplayDevices = (ListPreference) findPreference(OVERLAY_DISPLAY_DEVICES_KEY);
mAllPrefs.add(mOverlayDisplayDevices);
mOverlayDisplayDevices.setOnPreferenceChangeListener(this);
mOpenGLTraces = (ListPreference) findPreference(OPENGL_TRACES_KEY);
mAllPrefs.add(mOpenGLTraces);
mOpenGLTraces.setOnPreferenceChangeListener(this);
mImmediatelyDestroyActivities = (CheckBoxPreference) findPreference( mImmediatelyDestroyActivities = (CheckBoxPreference) findPreference(
IMMEDIATELY_DESTROY_ACTIVITIES_KEY); IMMEDIATELY_DESTROY_ACTIVITIES_KEY);
mAllPrefs.add(mImmediatelyDestroyActivities); mAllPrefs.add(mImmediatelyDestroyActivities);
mResetCbPrefs.add(mImmediatelyDestroyActivities); mResetCbPrefs.add(mImmediatelyDestroyActivities);
mAppProcessLimit = (ListPreference) findPreference(APP_PROCESS_LIMIT_KEY); mAppProcessLimit = addListPreference(APP_PROCESS_LIMIT_KEY);
mAllPrefs.add(mAppProcessLimit);
mAppProcessLimit.setOnPreferenceChangeListener(this);
mShowAllANRs = (CheckBoxPreference) findPreference( mShowAllANRs = (CheckBoxPreference) findPreference(
SHOW_ALL_ANRS_KEY); SHOW_ALL_ANRS_KEY);
@@ -295,6 +282,13 @@ public class DevelopmentSettings extends PreferenceFragment
removeHdcpOptionsForProduction(); removeHdcpOptionsForProduction();
} }
private ListPreference addListPreference(String prefKey) {
ListPreference pref = (ListPreference) findPreference(prefKey);
mAllPrefs.add(pref);
pref.setOnPreferenceChangeListener(this);
return pref;
}
private void disableForUser(Preference pref) { private void disableForUser(Preference pref) {
if (pref != null) { if (pref != null) {
pref.setEnabled(false); pref.setEnabled(false);
@@ -426,6 +420,7 @@ public class DevelopmentSettings extends PreferenceFragment
updateHardwareUiOptions(); updateHardwareUiOptions();
updateMsaaOptions(); updateMsaaOptions();
updateTrackFrameTimeOptions(); updateTrackFrameTimeOptions();
updateShowNonRectClipOptions();
updateShowHwScreenUpdatesOptions(); updateShowHwScreenUpdatesOptions();
updateShowHwLayersUpdatesOptions(); updateShowHwLayersUpdatesOptions();
updateShowHwOverdrawOptions(); updateShowHwOverdrawOptions();
@@ -735,6 +730,32 @@ public class DevelopmentSettings extends PreferenceFragment
updateTrackFrameTimeOptions(); updateTrackFrameTimeOptions();
} }
private void updateShowNonRectClipOptions() {
String value = SystemProperties.get(
HardwareRenderer.DEBUG_SHOW_NON_RECTANGULAR_CLIP_PROPERTY);
if (value == null) {
value = "hide";
}
CharSequence[] values = mShowNonRectClip.getEntryValues();
for (int i = 0; i < values.length; i++) {
if (value.contentEquals(values[i])) {
mShowNonRectClip.setValueIndex(i);
mShowNonRectClip.setSummary(mShowNonRectClip.getEntries()[i]);
return;
}
}
mShowNonRectClip.setValueIndex(0);
mShowNonRectClip.setSummary(mShowNonRectClip.getEntries()[0]);
}
private void writeShowNonRectClipOptions(Object newValue) {
SystemProperties.set(HardwareRenderer.DEBUG_SHOW_NON_RECTANGULAR_CLIP_PROPERTY,
newValue == null ? "" : newValue.toString());
pokeSystemProperties();
updateShowNonRectClipOptions();
}
private void updateShowHwScreenUpdatesOptions() { private void updateShowHwScreenUpdatesOptions() {
updateCheckBox(mShowHwScreenUpdates, updateCheckBox(mShowHwScreenUpdates,
SystemProperties.getBoolean(HardwareRenderer.DEBUG_DIRTY_REGIONS_PROPERTY, false)); SystemProperties.getBoolean(HardwareRenderer.DEBUG_DIRTY_REGIONS_PROPERTY, false));
@@ -1092,6 +1113,9 @@ public class DevelopmentSettings extends PreferenceFragment
} else if (preference == mTrackFrameTime) { } else if (preference == mTrackFrameTime) {
writeTrackFrameTimeOptions(newValue); writeTrackFrameTimeOptions(newValue);
return true; return true;
} else if (preference == mShowNonRectClip) {
writeShowNonRectClipOptions(newValue);
return true;
} else if (preference == mAppProcessLimit) { } else if (preference == mAppProcessLimit) {
writeAppProcessLimitOptions(newValue); writeAppProcessLimitOptions(newValue);
return true; return true;