From 1dffba0be4eacc34e285a2f2c74e0bda5399a353 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=AF=E6=AD=8C?= Date: Mon, 7 Mar 2022 18:54:06 +0800 Subject: [PATCH] improve x86 xlib performance --- src/gui/core/velocitytracker.cc | 2 +- src/gui/meson.build | 77 ++++++++++++++++++++++++++++ src/gui/meson_options.txt | 13 +++++ src/gui/widget/abslistview.cc | 2 +- src/gui/widget/viewgroup.cc | 4 +- src/porting/allwinner/CMakeLists.txt | 5 +- src/porting/allwinner/graph_nx5fb.c | 3 +- src/porting/x86/graph_xlib.c | 4 +- 8 files changed, 98 insertions(+), 12 deletions(-) create mode 100755 src/gui/meson.build create mode 100755 src/gui/meson_options.txt diff --git a/src/gui/core/velocitytracker.cc b/src/gui/core/velocitytracker.cc index 3953d84f..1089753b 100755 --- a/src/gui/core/velocitytracker.cc +++ b/src/gui/core/velocitytracker.cc @@ -120,7 +120,7 @@ private: static VelocityTrackerStrategy* createStrategy(const char* strategy); }; -const char* VelocityTrackerImpl::DEFAULT_STRATEGY = "lsq2"; +const char* VelocityTrackerImpl::DEFAULT_STRATEGY = "impulse";//"lsq2"; VelocityTrackerImpl::VelocityTrackerImpl(const char* strategy) : mLastEventTime(0), mCurrentPointerIdBits(0), mActivePointerId(-1) { diff --git a/src/gui/meson.build b/src/gui/meson.build new file mode 100755 index 00000000..fae29cdb --- /dev/null +++ b/src/gui/meson.build @@ -0,0 +1,77 @@ +project('gui', 'c++', + version: '2.0', + meson_version : '>= 0.56.0', + default_options: [ 'buildtype=debugoptimized'], +) + +fc_version = meson.project_version() +version_arr = fc_version.split('.') + +cc = meson.get_compiler('c') + + +freetype_dep = dependency('freetype2', method: 'pkg-config', version: freetype_req, required: false) + +fonts_conf = configuration_data() + + +if not get_option('tools').disabled() + subdir('fc-cache') + subdir('fc-cat') + subdir('fc-conflist') + subdir('fc-list') + subdir('fc-match') + subdir('fc-pattern') + subdir('fc-query') + subdir('fc-scan') + subdir('fc-validate') +endif + +if not get_option('tests').disabled() + subdir('test') +endif + +subdir('conf.d') +subdir('its') + +# xgettext is optional (on Windows for instance) +if find_program('xgettext', required : get_option('nls')).found() + subdir('po') + subdir('po-conf') +endif + +if not get_option('doc').disabled() + subdir('doc') +endif + +configure_file(output: 'config.h', configuration: conf) + +configure_file(output: 'fonts.conf', + input: 'fonts.conf.in', + configuration: fonts_conf, + install_dir: fc_baseconfigdir, + install: true) + +install_data('fonts.dtd', + install_dir: join_paths(get_option('prefix'), get_option('datadir'), 'xml/fontconfig') +) + +fc_headers = [ + 'fontconfig/fontconfig.h', + 'fontconfig/fcfreetype.h', + 'fontconfig/fcprivate.h', +] + +install_headers(fc_headers, subdir: meson.project_name()) + +# Summary +if meson.version().version_compare('>= 0.53') + doc_targets = get_variable('doc_targets', []) + + summary({ + 'Documentation': (doc_targets.length() > 0 ? doc_targets : false), + 'NLS': not get_option('nls').disabled(), + 'Tests': not get_option('tests').disabled(), + 'Tools': not get_option('tools').disabled(), + }, section: 'General', bool_yn: true, list_sep: ', ') +endif diff --git a/src/gui/meson_options.txt b/src/gui/meson_options.txt new file mode 100755 index 00000000..d6030495 --- /dev/null +++ b/src/gui/meson_options.txt @@ -0,0 +1,13 @@ +# Common feature options +option('doc', type : 'feature', value : 'auto', yield: true, + description: 'Build documentation') +option('doc-txt', type: 'feature', value: 'auto') +option('doc-man', type: 'feature', value: 'auto') +option('doc-pdf', type: 'feature', value: 'auto') +option('doc-html', type: 'feature', value: 'auto') +option('nls', type : 'feature', value : 'auto', yield: true, + description : 'Enable native language support (translations)') +option('tests', type : 'feature', value : 'auto', yield : true, + description: 'Enable unit tests') +option('tools', type : 'feature', value : 'auto', yield : true, + description: 'Build command-line tools (fc-list, fc-query, etc.)') diff --git a/src/gui/widget/abslistview.cc b/src/gui/widget/abslistview.cc index 286d2247..4603d42d 100755 --- a/src/gui/widget/abslistview.cc +++ b/src/gui/widget/abslistview.cc @@ -2851,7 +2851,7 @@ void AbsListView::onTouchUp(MotionEvent&ev) { // Since we can potentially overfling more than we can overscroll, don't // allow the weird behavior where you can scroll to a boundary then // fling further. - LOGD("Velocity [%d]%d:(%d,%d)",mActivePointerId,initialVelocity,mMinimumVelocity,mMaximumVelocity); + LOGV("Velocity [%d]%d:(%d,%d)",mActivePointerId,initialVelocity,mMinimumVelocity,mMaximumVelocity); bool flingVelocity = std::abs(initialVelocity) > mMinimumVelocity; if (flingVelocity && !((mFirstPosition == 0 && firstChildTop == contentTop - mOverscrollDistance) || diff --git a/src/gui/widget/viewgroup.cc b/src/gui/widget/viewgroup.cc index 00994432..dfadf19a 100755 --- a/src/gui/widget/viewgroup.cc +++ b/src/gui/widget/viewgroup.cc @@ -2084,10 +2084,10 @@ void ViewGroup::addFocusables(std::vector& views, int direction, int focu } std::vector children; - for_each(mChildren.begin(),mChildren.end(),[&children](View*c){ + for(auto c:mChildren){ if(c->getVisibility()==View::VISIBLE) children.push_back(c); - }); + }; FocusFinder::sort(children, 0, children.size(), this, isLayoutRtl()); for (int i = 0; i < children.size(); ++i) { children[i]->addFocusables(views, direction, focusableMode); diff --git a/src/porting/allwinner/CMakeLists.txt b/src/porting/allwinner/CMakeLists.txt index f1b854c3..7338fbee 100755 --- a/src/porting/allwinner/CMakeLists.txt +++ b/src/porting/allwinner/CMakeLists.txt @@ -1,9 +1,6 @@ -project (allwinner C CXX ASM) +project (allwinner C CXX) set(ALLWINNER_SRCS input_linux.cc - new_arm.S - arm_asm.S - memcpy-hybrid.S graph_nx5fb.c ) include(CheckIncludeFile) diff --git a/src/porting/allwinner/graph_nx5fb.c b/src/porting/allwinner/graph_nx5fb.c index c939c0d3..2d0c411b 100755 --- a/src/porting/allwinner/graph_nx5fb.c +++ b/src/porting/allwinner/graph_nx5fb.c @@ -6,7 +6,6 @@ #include #include #include -#include #ifdef ENABLE_RFB #include #include @@ -346,7 +345,7 @@ DWORD GFXBlit(HANDLE dstsurface,int dx,int dy,HANDLE srcsurface,const GFXRect*sr pbd+=dy*ndst->pitch+dx*4; const int cpw=rs.w<<2; for(y=0;ypitch; pbd+=ndst->pitch; } diff --git a/src/porting/x86/graph_xlib.c b/src/porting/x86/graph_xlib.c index 96f4569a..632c456c 100755 --- a/src/porting/x86/graph_xlib.c +++ b/src/porting/x86/graph_xlib.c @@ -173,9 +173,9 @@ DWORD GFXFlip(HANDLE surface){ XImage *img=(XImage*)surface; if(mainSurface==surface){ GFXRect rect={0,0,img->width,img->height}; - X11Expose(0,0,img->width,img->height); + //X11Expose(0,0,img->width,img->height); #if ENABLE_RFB - rfbMarkRectAsModified(rfbScreen,rect.x,rect.y,rect.w,rect.h); + //rfbMarkRectAsModified(rfbScreen,rect.x,rect.y,rect.w,rect.h); #endif }