Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reloaded - Gtk3 migration #163

Open
d-j-a-y opened this issue Aug 31, 2018 · 35 comments
Open

Reloaded - Gtk3 migration #163

d-j-a-y opened this issue Aug 31, 2018 · 35 comments
Assignees

Comments

@d-j-a-y
Copy link
Collaborator

d-j-a-y commented Aug 31, 2018

https://github.com/d-j-a-y/veejay/commits/djay_gtk3

Reloaded specific

General Stuff
Preparation in GTK+ 2.x

Do not include individual headers
Do not use deprecated symbols
Use accessor functions instead of direct access
Replace GDK_ with GDK_KEY_
Use GIO for launching applications
Use cairo for drawing

Changes that need to be done at the time of the switch

Replace size_request by get_preferred_width/height
Replace GdkRegion by cairo_region_t
Replace GdkPixmap by cairo surfaces
Replace GdkColormap by GdkVisual
GdkDrawable is gone
Event filtering
Backend-specific code
GtkPlug and GtkSocket
The GtkWidget::draw signal
GtkProgressBar orientation
Check your expand and fill flags
Scrolling changes
GtkObject is gone
GtkEntryCompletion signal parameters
Resize grips
Prevent mixed linkage <--- see #163 (comment)
Install GTK+ modules in the right place

https://developer.gnome.org/gtk3/stable/gtk-migrating-2-to-3.html
https://developer.gnome.org/gtk3/stable/ch26s02.html
https://wiki.ubuntu.com/Lubuntu/Developers/GTK3Migration

After all .... TESTS!

TODO Before release

* Xorg high cpu! For instance, the program might be making resource-intensive xlib calls in a tight loop https://wiki.ubuntu.com/X/Troubleshooting/HighCPU ---- FIX issue exemple Fixed by cfa0a2e . See also #163 (comment)

  • ./Makefile.am --> review EXTRA_DIST
  • Fix Gtk-3 Minor version according api used (actually 3.0 but couldbe 3.10)
    * gtktimeselection / event_motion
    * multitrack / time line (horizontal slider) ... broken ? fixed by aacf57a
    * multitrack / opacity - chainfade (vertical n2 slider) ... broken ? fixed by bb13efe
    * fix vbox619 (stream/camera controls) scrolling fix by e60da41
    * fx and generator param's sliders don't catch mouse 3th btn roll fixed by fa890bd
    * fix feedback checkbox align fix by e60da41
    * scale value is not displayed full : change fx param widget container order : [ fx parameter value ] top hbox [ fx param description + fx param slider ] bottom vbox not ui issue, value is own by gtkscale, issue can be solved using a label out of gtkscale.
  • where the menu s gone ?
  • -a option broken
  • can't select codec when recording sample/stream (panel "Sample X" ---> "Recording to Disk" ---> drop down list "Codec")

minor

  • close veejay before reloaded --> can't close veejay_connection
  • close confirm dialog : [echap] should close dialog box not reloaded (self assign @d-j-a-y )
  • src/Makefile.am --> -lgmodule-2.0 should goto config.am
  • Purge/remove files not used stuff from reloaded and veejay
    ** gtkcolorsel (picker for ex) ... palette and other ?
    ** remove gtkhsv files
    ** Purge veejay config files
  • config.am : remove GLADE check (add GtkBuilder ?)
  • remove or update GTK_CHECK_VERSION related (ex vj-api.c)
  • Update veejay/reloaded dependencies (doc side)
  • reloaded as GtkApplication ?
  • Check if all gtk_*_new () calls have g_clear_object or g_object_unref counter part

TODO After release

  • Greetings to draekko-rand for Gtk3Curve

  • image in menu : gtkmenuitem + packing for image in menu, imagemenuitem deprecated from 3.10

    Add a status bar to connexion dialog ?
    fix gtkdialog ui def :      <child internal-child="vbox">    and     <child internal-child="action_area">
    
@d-j-a-y
Copy link
Collaborator Author

d-j-a-y commented Sep 6, 2018

Prevent mixed linkage

Gtk-ERROR **: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported

To determine how the mix is done :

for i in `ldd /usr/local/bin/reloaded | awk '{print $3}'` ; do \
        if [[ `ldd $i | grep gtk` ]] ; then \
           echo -e "$i \n `ldd $i | grep gtk` \n" ; \
        fi ; done

(from milan / https://mail.gnome.org/archives/evolution-hackers/2011-February/msg00003.html )

@d-j-a-y
Copy link
Collaborator Author

d-j-a-y commented Sep 7, 2018

Glad to share the reloaded gtk3 first run :-)

reloaded-gtk3-firstrun

At least it's running, and basic stuff is working ...

@game-stop
Copy link
Owner

game-stop commented Sep 8, 2018 via email

@d-j-a-y
Copy link
Collaborator Author

d-j-a-y commented Sep 11, 2018

after a bit of css ....finally ! :-)
reloaded-gtk3-fitscreen

@d-j-a-y
Copy link
Collaborator Author

d-j-a-y commented Sep 24, 2018

now with a bit of gtk3 theming :-O
reloaded-gtk3

pink + green buttons come from tweaks on "reloaded.css"

@game-stop
Copy link
Owner

game-stop commented Sep 24, 2018

Except for the purple it looks good!
The feedback checkbox in the top looks a bit odd
Do the widgets without a label have a tooltip ?
There are a few other windows in reloaded, have you GTK3'd them as well ? Would be nice if you can show those too!

@d-j-a-y
Copy link
Collaborator Author

d-j-a-y commented Sep 24, 2018

reloaded-gtk3-curve_ _dialog

feedback

+todolist

tooltips

yep, expect those who did't had ... ;-)

other windows gtk3

yep, but ... still ... the menu is missing and so ... can't test them.

The curve widget look nice, but maybe will need some hack about rounding because, since ever?, the curve has always had trouble with that (hit [ok] several time, the curve will tend to 0 --- #AnotherIssue --- )

@d-j-a-y
Copy link
Collaborator Author

d-j-a-y commented Sep 24, 2018

@C0ntrol
Theming by rc is broken.
Gtk3 already offers to use other theme at runtime for particular app with the environment variable GTK_THEME

Do you think it's necessary to keep the user defined gui definition feature ? (gtk3 fashion is css)

@game-stop
Copy link
Owner

No, let's not go fix that. Back then, it was more of a hack anyway. Please remove all that has to do with it

@d-j-a-y
Copy link
Collaborator Author

d-j-a-y commented Oct 18, 2018

finally ... got (bits of) the menu back ....

gotthemenuback

after unsuccessful try to declare it at runtime ... come back to ressources with gtkmenubar/ gtkmenu / gtkmenuitem /... definitions ... (where it was GtkUIManager / GtkActionGroup / GtkAction ...)

@d-j-a-y
Copy link
Collaborator Author

d-j-a-y commented Oct 24, 2018

Menus are back !

https://github.com/d-j-a-y/veejay/tree/djay_gtk3

@game-stop
Copy link
Owner

Great! Is it ready to be merged ?

@d-j-a-y
Copy link
Collaborator Author

d-j-a-y commented Oct 24, 2018

Hummm .... why not ???

some corners to polish ... but should be usable .... (reloaded -a , still broken for example)

But , please can you stress test it ?.... during let's say one week before merging ?

In fact , i really suspect performance issues !

[cpu] [mem]
 65,9 11,2  48:20.32 veejay                       
 42,6  3,0  11:06.20 Xorg                         
 28,5  2,4   0:18.61 reloaded 

and without reloaded Xorg consume quite nothing from cpu....


Also, could be a good moment to publicity at this incredible and unique piece of floss code. . . what do you think ? Publish .deb / rpm .... ? submit to packager .... ? maybe too much ... at the same time ...

@d-j-a-y
Copy link
Collaborator Author

d-j-a-y commented Oct 25, 2018

Xorg high cpu!
For instance, the program might be making resource-intensive xlib calls in a tight loop https://wiki.ubuntu.com/X/Troubleshooting/HighCPU

Has Gtk is build on top of xlib ... i think the issue come from the way reloaded update the gui status.

@game-stop
Copy link
Owner

status is usually updated at frame rate interval; every 40 ms.
is the preview image on ?
is there unnecessary redrawing of widgets ?
have you tried a profiler?
somewhere, too much work is done

@d-j-a-y
Copy link
Collaborator Author

d-j-a-y commented Oct 25, 2018

is the preview image on ?

on / off the same

is there unnecessary redrawing of widgets ?

could be ... reloaded has some homebrew widget + now gtk3curve

have you tried a profiler?

nop... i coutch it was xorg eating cpu at the time i wrote the previous comment

somewhere, too much work is done

and reloaded is not the first gtk3 app ;-) so should somehow work!

About building package for distribution, do you know https://build.opensuse.org/ ? a generic system to build and distribute packages from sources

@d-j-a-y
Copy link
Collaborator Author

d-j-a-y commented Oct 27, 2018

After fighting against gprof , configure.ac and Makefile.am i'm now able to profile reloaded ....

and

is there unnecessary redrawing of widgets ?

Yep look like it's exactly that ... and coming from gtk3curve :-( ...

hoping it not so hard to fix!!! I have started this work after i found this widget !!!!

@d-j-a-y
Copy link
Collaborator Author

d-j-a-y commented Oct 29, 2018

Yep look like it's exactly that ... and coming from gtk3curve :-( ...

Hummm ... i have built and ran reloaded without gtk3curve .... xorg still > 50 % ! :-(

@game-stop
Copy link
Owner

Please try:

  • start veejay headless (no video window output) and with a low framerate (say, FPS=2)
  • start reloaded and move the mouse out of the window
  • measure Xorg cpu load
  • see if the problem is with the video timeline drawing (or with any of the other custom gtk widgets that reloaded uses)

just an update on gtk3curve:

in your djay_gtk3 branch, the gtk3_curve_motion_notify_event implementation does not set a return value at the end of the function, possibly this gives unexpected problems.

Also, the implementation of gtk3curve does not seem to follow the recommendations on https://developer.gnome.org/gtk3/stable/ch01s05.html to use a backing surface for redrawing (gdk_window_create_similar_surface ) but I could be wrong (only glimpsed at it)

@d-j-a-y
Copy link
Collaborator Author

d-j-a-y commented Oct 30, 2018

(last edit 01/11 - 19h)
Starting veejay $veejay -f 2 -g my_video.avi (great tips thanks!) , i have found something very interesting !!!! :

  • When liveview is ENABLEd ... xorg AND reloaded cpu usage is near 5% each - (has should be) !!!!!!!

Finding where and why could solve most part of the performances issue :-)

Nota : i still suspect some leak of performances from gtk3curve __ i already remove some gtk_widget_queue_draw __ and possibly also from gtktimeselection.

@d-j-a-y
Copy link
Collaborator Author

d-j-a-y commented Nov 1, 2018

A(nother) cguru just gave me a fresh look to cpu issue... going deep //// quite to the roots .

We found wired behaviour in time calculation when preview is not enabled . And actually i have the feeling that the wired behaviour start to happen after the sequencer get a preview image (or multitrack).

I share a branch with some printf to have a look ...

veejay -f 2 -g myvideo.avi &
First
reloaded -P 2 -p 3490
wait 30 seconds , then
reloaded -p 3490
wait 30s and compare the output.

Wired behaviour isn't it ?

@game-stop
Copy link
Owner

game-stop commented Nov 2, 2018

This behaviour, that is with the gtk3 reloaded ? Please elaborate on the weird behaviour, what are you expecting?

the gveejay_time_to_sync function should return a 1 when its time to pull data from veejay. how to fix this, I will need to dive in it - haven't visited that code in a long time. It could be that, there is a lag due to the amount of data veejay sends (veejay creates the preview image, in raw format (?) , in JPEG ? and sends that over the socket)

If i remember correctly, the sequencer is another thread that pulls data from veejay , it is possible something stupid is happening there

@d-j-a-y
Copy link
Collaborator Author

d-j-a-y commented Nov 2, 2018

Xorg eating cpu!

cfa0a2e did it !

When preview is on, only one printf each 0.5s (fps=2) ... when preview off , after 2s the console is flooded each 0.5s

The cause of the problem is that, after sleeping for a short time, a call to gveejay_update() happens and this flow triggers
(unnessary?) updating of the UI

I cleaned up the function and put some comments in it

The function gveejay_to_time_sync should actually throttle the number of times the UI is updated. It is supposed to go into sleep, when it is not yet time to update the UI

When the preview is enabled, it is ALWAYS time to update the UI (it always hits the return 1)
When the preview is disabled, it is ALWAYS time to sleep and as it didnt sleep very long, a call to gveejay_update() happens immediately after, causing the xorg cpu usage.

Every (seconds per video frame) a new status line is available, but due to bad timing info in the gveejay_time_to_sync function, the UI is updated twice, or thrice, or even more often using the same status lines as before.
So, that is unncessary redrawing of widgets

What follows is that, the gveejay_update() may do too much work. It also updates widgets that are currently not visible and/or it may update widgets that have not changed

@d-j-a-y
Copy link
Collaborator Author

d-j-a-y commented Nov 9, 2018

cfa0a2e did it !

But ... as side effect, when the video is normal fps, the time bar is not moving smoothly ... :-(

@game-stop
Copy link
Owner

nsec (time to wait before next update) must be calculated more precisely, i can take a look at this sometime this weekend

@d-j-a-y
Copy link
Collaborator Author

d-j-a-y commented Feb 2, 2019

https://github.com/d-j-a-y/veejay/tree/djay_gtk3 Updated !

This branch is 52 commits ahead of c0ntrol:master
Latest commit b6a42f7 an hour ago

@game-stop
Copy link
Owner

Reloaded GTK3 has been refactored

Most important changes:

  • Reorganized UI widgets
  • Extended GtkCurve widget
  • Backport of reloaded theme
  • New commandline option '-S' (small-as-possible)
  • Removal of obsolete properties
  • Samplebank refactor
  • Bugfixes

Issue need to be reviewed to see what work is left

@game-stop game-stop self-assigned this May 16, 2019
@game-stop
Copy link
Owner

Updated issue:

  • Codec selection OK
  • Fix auto-connect commandline option
  • Extended GtkTimeline widget (fix drawing, added label)
  • Added marker in/out point labels
  • Replaced another GtkTable for GtkGrid

@game-stop
Copy link
Owner

Refactor how widgets are updated. Currently, there are too many unnecessary updates happening initiated from the periodic update flow. Especially visible in top when the FX tab is open, compared to when SEQ tab is open.

@game-stop
Copy link
Owner

game-stop commented May 17, 2019

Another issue is that drawing 16 GtkScale widgets in the FX panel causes 30% CPU usage (even when these GtkScale widgets are not sensitive) in combination with the reloaded CSS

This issue is in GTK, different versions, different results. Added optional '--faster-ui' commandline option if your GTK version has this special feature.

@game-stop
Copy link
Owner

game-stop commented May 18, 2019

Update issue:

  • clear timeline selection marker when copying/cropping/deleting EDL
  • add new button to set the current frame position as destination point in EDL
  • select entry in fx chain when changing fx entry by spin button
  • update minimum record duration based on loop or frame status to prevent 'Cowardly refusing to record' message in veejay
  • keep dialogs above main window (self assigned to @d-j-a-y )
  • draw label with frame position on mouse over timeline
  • rename some reloaded command-line options,
  • fix multi-track mix list
  • periodically pull information from veejay,
  • only update widgets when needed,
  • calculate and compare check-sums before entering update logic,
  • reworked fx entry, fx chain and fx anim
  • draw border arround sample slot on selection and activation
  • approximate best image size for sample slot
  • remove old code

@game-stop
Copy link
Owner

Screenshots:
image
image
image
image

@game-stop
Copy link
Owner

image
image
image

d-j-a-y added a commit to d-j-a-y/veejay that referenced this issue May 21, 2019
Fix the following error :
Gtk-ERROR **: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported

game-stop#163
d-j-a-y added a commit to d-j-a-y/veejay that referenced this issue May 21, 2019
Fix the following error :
Gtk-ERROR **: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported

game-stop#163
@game-stop
Copy link
Owner

issue can be closed ?

@d-j-a-y
Copy link
Collaborator Author

d-j-a-y commented Jun 14, 2019

still some minor stuff ...

  • config.am : remove GLADE check (add GtkBuilder ?)
  • remove or update GTK_CHECK_VERSION related (ex vj-api.c)
  • Update veejay/reloaded dependencies (doc side)
  • rc/Makefile.am --> -lgmodule-2.0 should goto config.am
  • Purge/remove files not used stuff from reloaded and veejay
  • Check if all gtk_*_new () calls have g_clear_object or g_object_unref counter part

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants