glx ply3d fixes, async_gui updates for edits, dflt vs auto kfrm fix, mask mode fix...
authorGood Guy <good1.2guy@gmail.com>
Tue, 7 Nov 2017 23:46:27 +0000 (16:46 -0700)
committerGood Guy <good1.2guy@gmail.com>
Tue, 7 Nov 2017 23:46:27 +0000 (16:46 -0700)
20 files changed:
cinelerra-5.1/cinelerra/assetpopup.C
cinelerra-5.1/cinelerra/autos.C
cinelerra-5.1/cinelerra/cwindowtool.C
cinelerra-5.1/cinelerra/mwindowedit.C
cinelerra-5.1/cinelerra/zwindow.C
cinelerra-5.1/cinelerra/zwindowgui.C
cinelerra-5.1/cinelerra/zwindowgui.h
cinelerra-5.1/guicast/bcsignals.C
cinelerra-5.1/guicast/bcsubwindow.C
cinelerra-5.1/guicast/bcsubwindow.h
cinelerra-5.1/guicast/bcsynchronous.C
cinelerra-5.1/guicast/bctrace.C
cinelerra-5.1/guicast/bctrace.h
cinelerra-5.1/guicast/bcwindow.C
cinelerra-5.1/guicast/bcwindow.h
cinelerra-5.1/guicast/bcwindow3d.C
cinelerra-5.1/guicast/bcwindowbase.C
cinelerra-5.1/guicast/bcwindowbase.h
cinelerra-5.1/guicast/bcwindowbase.inc
cinelerra-5.1/guicast/vframe.C

index f5a3be2a37627b7b27cded03c82eb14b2a59b416..175494b5a3535c0f9e94825a2f5b7d1531115af3 100644 (file)
@@ -283,6 +283,9 @@ int AssetPopupMixer::handle_event()
                ZWindow *zwindow = mwindow->get_mixer(mixer);
                while( track ) {
                        track->play = track->record = 0;
+                       if( track->data_type == TRACK_VIDEO ) {
+                               sprintf(track->title, _("Mixer %d"), zwindow->idx);
+                       }
                        mixer->mixer_ids.append(track->get_mixer_id());
                        track = track->next;
                }
index 0ca1efcf85d52a45942e3a9f376a8c17daa3c32c..b895a9049085c03a99db492cc171c90ace8fa2c3 100644 (file)
@@ -288,12 +288,11 @@ Auto* Autos::get_auto_for_editing(double position)
 
        Auto *result = 0;
        get_prev_auto(track->to_units(position, 0), PLAY_FORWARD, result);
+       if( edl->session->auto_keyframes && (!result || result->is_default ||
+              !EQUIV(track->from_units(result->position), position)) ) {
 //printf("Autos::get_auto_for_editing %p %p %p\n", default_auto, first, result);
-       if( !result || !EQUIV(track->from_units(result->position), position) ) {
-               if( edl->session->auto_keyframes ) {
-                       position = edl->align_to_frame(position, 0);
-                       result = insert_auto(track->to_units(position, 0));
-               }
+               position = edl->align_to_frame(position, 0);
+               result = insert_auto(track->to_units(position, 0));
        }
 //printf("Autos::get_auto_for_editing %p %p\n", first, default_auto);
 
index 73f1f23254a5925e7d1e4e28a8f647e4f25bd2fd..f326635636e1240070d28c29711e564457e41a85 100644 (file)
@@ -789,16 +789,13 @@ void CWindowCameraGUI::create_objects()
 
 void CWindowCameraGUI::update_preview()
 {
-       mwindow->restart_brender();
-       mwindow->sync_parameters(CHANGE_PARAMS);
-
-       mwindow->cwindow->playback_engine->que->send_command(CURRENT_FRAME,
-                       CHANGE_NONE,
-                       mwindow->edl,
-                       1);
        mwindow->gui->lock_window("CWindowCameraGUI::update_preview");
+       mwindow->restart_brender();
        mwindow->gui->draw_overlays(1);
+       mwindow->sync_parameters(CHANGE_PARAMS);
        mwindow->gui->unlock_window();
+       mwindow->cwindow->playback_engine->que->send_command(CURRENT_FRAME,
+                       CHANGE_NONE, mwindow->edl, 1);
        mwindow->cwindow->gui->lock_window("CWindowCameraGUI::update_preview");
        mwindow->cwindow->gui->canvas->draw_refresh();
        mwindow->cwindow->gui->unlock_window();
@@ -1237,16 +1234,13 @@ void CWindowProjectorGUI::create_objects()
 
 void CWindowProjectorGUI::update_preview()
 {
+       mwindow->gui->lock_window("CWindowProjectorGUI::update_preview");
        mwindow->restart_brender();
        mwindow->sync_parameters(CHANGE_PARAMS);
-       mwindow->cwindow->playback_engine->que->send_command(CURRENT_FRAME,
-                       CHANGE_NONE,
-                       mwindow->edl,
-                       1);
-       // TODO: really need to lock the main window??
-       mwindow->gui->lock_window("CWindowProjectorGUI::update_preview");
        mwindow->gui->draw_overlays(1);
        mwindow->gui->unlock_window();
+       mwindow->cwindow->playback_engine->que->send_command(CURRENT_FRAME,
+                       CHANGE_NONE, mwindow->edl, 1);
        mwindow->cwindow->gui->lock_window("CWindowProjectorGUI::update_preview");
        mwindow->cwindow->gui->canvas->draw_refresh();
        mwindow->cwindow->gui->unlock_window();
@@ -2264,12 +2258,13 @@ void CWindowMaskGUI::handle_event()
 
 void CWindowMaskGUI::update_preview()
 {
+       mwindow->gui->lock_window("CWindowMaskGUI::update_preview");
        mwindow->restart_brender();
        mwindow->sync_parameters(CHANGE_PARAMS);
+       mwindow->gui->draw_overlays(1);
+       mwindow->gui->unlock_window();
        mwindow->cwindow->playback_engine->que->send_command(CURRENT_FRAME,
-                       CHANGE_NONE,
-                       mwindow->edl,
-                       1);
+                       CHANGE_NONE, mwindow->edl, 1);
        mwindow->cwindow->gui->lock_window("CWindowMaskGUI::update_preview");
        mwindow->cwindow->gui->canvas->draw_refresh();
        mwindow->cwindow->gui->unlock_window();
index 4d77f8a96b48d18d0eeeb380a8af57d9a4e8c758..1604256d83de3f57d0a92b90e091d55369df56e2 100644 (file)
@@ -545,6 +545,7 @@ void MWindow::cut(double start, double end, double new_position)
        update_plugin_guis();
        gui->update(1, 2, 1, 1, 1, 1, 0);
        cwindow->update(1, 0, 0, 0, 1);
+       awindow->gui->async_update_assets();
        cwindow->playback_engine->que->
                send_command(CURRENT_FRAME, CHANGE_EDL, edl, 1);
 }
@@ -894,6 +895,8 @@ void MWindow::finish_modify_handles()
        sync_parameters(CHANGE_EDL);
        update_plugin_guis();
        gui->update(1, 2, 1, 1, 1, 1, 0);
+// label list can be modified
+       awindow->gui->async_update_assets();
        cwindow->update(1, 0, 0, 0, 1);
 }
 
@@ -1910,6 +1913,7 @@ void MWindow::redo_entry(BC_WindowBase *calling_window_gui)
        save_backup();
        update_plugin_states();
        update_plugin_guis();
+       awindow->gui->async_update_assets();
        restart_brender();
        gui->update(1, 2, 1, 1, 1, 1, 1);
        cwindow->update(1, 1, 1, 1, 1);
@@ -2174,6 +2178,7 @@ void MWindow::trim_selection()
        update_plugin_guis();
        gui->update(1, 2, 1, 1, 1, 1, 0);
        cwindow->update(1, 0, 0, 0, 1);
+       awindow->gui->async_update_assets();
        restart_brender();
        cwindow->playback_engine->que->
                send_command(CURRENT_FRAME, CHANGE_EDL, edl, 1);
index 29a28a1b22a52ba78162b5201622b0154c1f61f0..f3ba30f265e368f4308d87ba4f8992f965ad7339 100644 (file)
@@ -72,6 +72,7 @@ void Mixers::del_mixer(int idx)
 
 void Mixer::set_title(const char *tp)
 {
+       if( tp == title ) return;
        strncpy(title, tp, sizeof(title));
        title[sizeof(title)-1] = 0;
 }
@@ -249,8 +250,9 @@ void ZWindow::set_title(const char *tp)
        char *cp = title, *ep = cp + sizeof(title)-1;
        cp += snprintf(title, ep-cp, _("Mixer %d"), idx);
        if( tp ) cp += snprintf(cp, ep-cp, ": %s", tp);
+       else tp = title;
        Mixer *mixer = mwindow->edl->mixers.get_mixer(idx);
-       if( mixer && tp != mixer->title ) mixer->set_title(tp);
+       if( mixer ) mixer->set_title(title);
 }
 
 void ZWindow::reposition(int x, int y, int w, int h)
index 46208af42ca085f91643661534cd4315e9aff7ef..b374c2deec73c39106585f2d0c88a8658814df01 100644 (file)
 #include "mwindow.h"
 #include "mwindowgui.h"
 #include "playbackengine.h"
-#include "playtransport.h"
-#include "renderengine.h"
 #include "theme.h"
 #include "tracks.h"
-#include "transportque.h"
 #include "zwindow.h"
 #include "zwindowgui.h"
 
index ab658a91c472ab68f3c3a6e0b7f15db765765f54..9c1fed75cdc55d2427669b78d73b7cd09aa35b31 100644 (file)
@@ -25,7 +25,9 @@
 #include "bcwindow.h"
 #include "canvas.h"
 #include "mwindow.h"
-#include "renderengine.inc"
+#include "playbackengine.inc"
+#include "zwindow.inc"
+#include "zwindowgui.inc"
 
 class ZWindowGUI;
 class ZWindowCanvas;
@@ -53,9 +55,7 @@ public:
        ZWindow *zwindow;
        ZWindowCanvas *canvas;
 
-       TransportCommand *command;
        PlaybackEngine *playback_engine;
-       RenderEngine *render_engine;
        int highlighted;
 };
 
index ddb2c864b0a438b2084f215c8044c0201dc8bb80..6847fa5cabbccd7598cbf58ac129c578743d35be 100644 (file)
@@ -208,6 +208,7 @@ static void signal_entry(int signum)
        BC_Trace::dump_traces();
        BC_Trace::dump_locks();
        BC_Trace::dump_buffers();
+       BC_Trace::dump_shm_stats();
        BC_Trace::delete_temps();
 
 // Call user defined signal handler
@@ -354,7 +355,9 @@ static void handle_dump(int n, siginfo_t * info, void *sc)
        signal(SIGINT, SIG_DFL);
        // gotta be root, or the dump is worthless
        int uid = getuid();
-       if( uid != 0 ) return;
+// it is not necessary to be root if ptrace is allowed via:
+// echo 0 > /proc/sys/kernel/yama/ptrace_scope (usually set to 1)
+//     if( uid != 0 ) return;
        ucontext_t *uc = (ucontext_t *)sc;
        int pid = getpid(), tid = gettid();
        struct sigcontext *c = (struct sigcontext *)&uc->uc_mcontext;
@@ -391,6 +394,7 @@ static void handle_dump(int n, siginfo_t * info, void *sc)
        fprintf(fp,"\nTRACES:\n");   BC_Trace::dump_traces(fp);
        fprintf(fp,"\nLOCKS:\n");    BC_Trace::dump_locks(fp);
        fprintf(fp,"\nBUFFERS:\n");  BC_Trace::dump_buffers(fp);
+       fprintf(fp,"\nSHMMEM:\n");   BC_Trace::dump_shm_stats(fp);
        if( BC_Signals::trap_hook ) {
                fprintf(fp,"\nMAIN HOOK:\n");
                BC_Signals::trap_hook(fp, BC_Signals::trap_data);
index f34a2d50e03b01a8160ecae1e5c92d70c21b99b7..40c5e2f6c62ac9cc3a2e5818f77006e24a11af5d 100644 (file)
@@ -23,8 +23,7 @@
 
 
 
-BC_SubWindow::BC_SubWindow(int x, int y, int w, int h, int bg_color, int opts)
- : BC_WindowBase(opts)
+BC_SubWindow::BC_SubWindow(int x, int y, int w, int h, int bg_color)
 {
        this->x = x;
        this->y = y;
index b99deed20c23346e4fe6ec2a635e4b1e9307e901..b90c8a34fdfa8bc47b71c018230d11fb72ddfd15 100644 (file)
@@ -28,9 +28,7 @@
 class BC_SubWindow : public BC_WindowBase
 {
 public:
-       BC_SubWindow(int x, int y, int w, int h,
-                       int bg_color=-1,
-                       int opts=0);
+       BC_SubWindow(int x, int y, int w, int h, int bg_color=-1);
        virtual ~BC_SubWindow();
 
        virtual int initialize();
index 54f5eec2c5ca500e675ef58fb150845abaf9effc..3c0e601df008fe5cbe5cbc78d1448426ce6315a0 100644 (file)
@@ -158,12 +158,9 @@ void BC_Synchronous::quit()
 {
        if( !is_started ) return;
        is_started = 0;
-       BC_SynchronousCommand *command = new_command();
+       BC_SynchronousCommand *command = BC_Synchronous::new_command();
        command->command = BC_SynchronousCommand::QUIT;
-       command_lock->lock("BC_Synchronous::quit");
-       commands.append(command);
-       command_lock->unlock();
-       next_command->unlock();
+       send_garbage(command);
        command->command_done->lock("BC_Synchronous::quit");
        delete command;
 }
@@ -218,7 +215,8 @@ void BC_Synchronous::handle_command_base(BC_SynchronousCommand *command)
 
        case BC_SynchronousCommand::DELETE_WINDOW:
                delete_window_sync(command);
-               break;
+               command->command_done->unlock();
+               return;
 
        case BC_SynchronousCommand::DELETE_PIXMAP:
                delete_pixmap_sync(command);
@@ -367,7 +365,7 @@ void BC_Synchronous::dump_shader(unsigned int handle)
 void BC_Synchronous::delete_window(BC_WindowBase *window)
 {
 #ifdef HAVE_GL
-       BC_SynchronousCommand *command = new_command();
+       BC_SynchronousCommand *command = BC_Synchronous::new_command();
        command->command = BC_SynchronousCommand::DELETE_WINDOW;
        command->window_id = window->get_id();
        command->display = window->get_display();
@@ -376,6 +374,8 @@ void BC_Synchronous::delete_window(BC_WindowBase *window)
        command->glx_context = window->glx_win_context;
 
        send_garbage(command);
+       command->command_done->lock("BC_Synchronous::quit");
+       delete command;
 #endif
 }
 
@@ -384,7 +384,7 @@ void BC_Synchronous::delete_window_sync(BC_SynchronousCommand *command)
 #ifdef HAVE_GL
        int window_id = command->window_id;
        Display *display = command->display;
-       Window win = command->win;
+//     Window win = command->win;
        GLXWindow glx_win = command->glx_win;
        GLXContext glx_context = command->glx_context;
        XLockDisplay(display);
@@ -435,10 +435,12 @@ void BC_Synchronous::delete_window_sync(BC_SynchronousCommand *command)
 
        table_lock->unlock();
 
-       XDestroyWindow(display, win);
+       glXMakeContextCurrent(display, None, None, 0);
        if( glx_context )
                glXDestroyContext(display, glx_context);
-       command->command_done->unlock();
+// causes xerror BadWindow (invalid Window parameter)
+//     XDestroyWindow(display, glx_win);
+// win destroyed in bcwindowbase
        XUnlockDisplay(display);
 #endif
 }
@@ -446,7 +448,7 @@ void BC_Synchronous::delete_window_sync(BC_SynchronousCommand *command)
 void BC_Synchronous::delete_display(BC_WindowBase *window)
 {
 #ifdef HAVE_GL
-       BC_SynchronousCommand *command = new_command();
+       BC_SynchronousCommand *command = BC_Synchronous::new_command();
        command->command = BC_SynchronousCommand::DELETE_DISPLAY;
        command->display = window->get_display();
 
@@ -520,7 +522,7 @@ void BC_Synchronous::release_pbuffer(int window_id, GLXPbuffer pbuffer)
 void BC_Synchronous::delete_pixmap(BC_WindowBase *window,
        GLXPixmap glx_pixmap, GLXContext glx_context)
 {
-       BC_SynchronousCommand *command = new_command();
+       BC_SynchronousCommand *command = BC_Synchronous::new_command();
        command->command = BC_SynchronousCommand::DELETE_PIXMAP;
        command->window_id = window->get_id();
        command->display = window->get_display();
index b15cfea17fba633b6f087dfdabefc537318a2c39..c50fff5f45acd2ce4681f222374fe77ebac9c753 100644 (file)
@@ -399,3 +399,49 @@ void BC_Trace::dump_threads(FILE *fp)
 }
 
 
+void BC_Trace::dump_shm_stat(const char *fn, FILE *fp)
+{
+       char path[BCTEXTLEN];
+       sprintf(path, "/proc/sys/kernel/%s",fn);
+       FILE *sfp = fopen(path,"r");
+       if( !sfp ) return;
+       uint64_t v = 0;
+       fscanf(sfp, "%ju", &v);
+       fclose(sfp);
+       fprintf(fp, "%s = %ju\n", fn, v);
+}
+
+void BC_Trace::dump_shm_stats(FILE *fp)
+{
+       dump_shm_stat("shmall", fp);
+       dump_shm_stat("shmmax", fp);
+       dump_shm_stat("shmmni", fp);
+       FILE *sfp = fopen("/proc/sysvipc/shm","r");
+       if( !sfp ) return;
+       char line[BCTEXTLEN];
+       int pid = getpid();
+       if( !fgets(line,sizeof(line), sfp) ) return;
+       int64_t used = 0, other = 0;
+       int n_used = 0, n_other = 0;
+       while( fgets(line,sizeof(line), sfp) ) {
+               int key, shmid, perms, cpid, lpid, uid, gid, cuid, cgid;
+               int64_t size, nattch, atime, dtime, ctime, rss, swap;
+               if( sscanf(line,
+                       "%d %d %o %ju %u %u %ju %u %u %u %u %ju %ju %ju %ju %ju",
+                       &key, &shmid, &perms, &size, &cpid, &lpid, &nattch,
+                       &uid, &gid, &cuid, &cgid, &atime, &dtime, &ctime,
+                       &rss, &swap) != 16 ) break;
+               if( cpid == pid ) {
+                       used += size;
+                       ++n_used;
+               }
+               else {
+                       other += size;
+                       ++n_other;
+               }
+       }
+       fclose(sfp);
+       fprintf(fp, "shmused = %jd (%d items)\n", used, n_used);
+       fprintf(fp, "shmother = %jd (%d items)\n", other, n_other);
+}
+
index e92c09760ff74c497e20daefb0c1dab95169a502..fc35817eadd1405f4951589f37bc7ad80db2915b 100644 (file)
@@ -48,6 +48,9 @@ public:
        static void dump_locks(FILE *fp=stdout);
        static void dump_buffers(FILE *fp=stdout);
        static void dump_threads(FILE *fp=stdout);
+
+       static void dump_shm_stat(const char *fn, FILE *fp=stdout);
+       static void dump_shm_stats(FILE *fp=stdout);
 };
 
 class bc_trace_list : public List<trace_item> {
index 6992bc9b3d10abdece45babb01ae6e76c4608ab6..666866864174dbc8b8ffe1daedc35f5c88399f81 100644 (file)
@@ -30,8 +30,7 @@ char BC_Window::default_x11_host[BCTEXTLEN] = "";
 BC_Window::BC_Window(const char *title,
                int x, int y, int w, int h, int minw, int minh, int allow_resize,
                int private_color, int hide, int bg_color, const char *display_name,
-               int group_it, int options)
- : BC_WindowBase(options)
+               int group_it)
 {
        create_window(0, title, x, y, w, h,
                (minw < 0) ? w : minw, (minh < 0) ? h : minh,
index c91df3628e1358d2601d84bae85f212bdc117820..2fec0ccc26aa04697f7ce8e785965fc48d81ad07 100644 (file)
@@ -28,20 +28,11 @@ class BC_Window : public BC_WindowBase
 {
        static char default_x11_host[BCTEXTLEN];
 public:
-       BC_Window(const char *title,
-                               int x,
-                               int y,
-                               int w,
-                               int h,
-                               int minw = -1,
-                               int minh = -1,
-                               int allow_resize = 1,
-                               int private_color = 0,
-                               int hide = 0,
-                               int bg_color = -1,
-                               const char *display_name = 0,
-                               int group_it = 1,
-                               int options = 0);
+       BC_Window(const char *title, int x, int y, int w, int h,
+               int minw = -1, int minh = -1, int allow_resize = 1,
+               int private_color = 0, int hide = 0, int bg_color = -1,
+               const char *display_name = 0, int group_it = 1);
+
        virtual ~BC_Window();
 
        static void set_default_x11_host(const char *host);
index d3da09ea2bbb80d240be0b3f6545b5b7cf64eb43..57118e7421bba74dedbb056bc039ef5e850155d8 100644 (file)
@@ -182,7 +182,6 @@ void BC_WindowBase::sync_unlock()
 GLXWindow BC_WindowBase::glx_window()
 {
        if( !glx_win ) {
-               top_level->options |= GLX_DISPLAY;
                glx_win = glXCreateWindow(top_level->display, top_level->glx_fb_config, win, 0);
        }
        return glx_win;
index 54a147966c96618fc4c96ceffe6739c73170baf8..a3719e59b1fab9160bf3da3a98a9e7bd652ebabe 100644 (file)
@@ -85,9 +85,8 @@ Window XGroupLeader = 0;
 Mutex BC_KeyboardHandlerLock::keyboard_listener_mutex("keyboard_listener",0);
 ArrayList<BC_KeyboardHandler*> BC_KeyboardHandler::listeners;
 
-BC_WindowBase::BC_WindowBase(int opts)
+BC_WindowBase::BC_WindowBase()
 {
-       this->options = opts;
 //printf("BC_WindowBase::BC_WindowBase 1\n");
        BC_WindowBase::initialize();
 }
@@ -147,13 +146,13 @@ BC_WindowBase::~BC_WindowBase()
 
        delete pixmap;
 
+//printf("delete glx=%08x, win=%08x %s\n", (unsigned)glx_win, (unsigned)win, title);
 #ifdef HAVE_GL
-       if( get_resources()->get_synchronous() &&
-               (top_level->options & GLX_WINDOW) && glx_win != 0 )
+       if( get_resources()->get_synchronous() && glx_win != 0 ) {
                get_resources()->get_synchronous()->delete_window(this);
-       else
+       }
 #endif
-               XDestroyWindow(top_level->display, win);
+       XDestroyWindow(top_level->display, win);
 
        if(bg_pixmap && !shared_bg_pixmap) delete bg_pixmap;
        if(icon_pixmap) delete icon_pixmap;
@@ -213,28 +212,15 @@ BC_WindowBase::~BC_WindowBase()
                        XvUngrabPort(display, xvideo_port_id, CurrentTime);
 
                unlock_window();
-// Can't close display if another thread is waiting for events.
-// Synchronous thread must delete display it owns a GLX_WINDOW
 // Must be last reference to display.
-#ifndef SINGLE_THREAD
-#ifdef HAVE_GL
-               if( (options & GLX_DISPLAY) != 0 && get_resources()->get_synchronous() ) {
-                       printf(_("BC_WindowBase::~BC_WindowBase window deleted but opengl deletion is not\n"
-                               "implemented for BC_Pixmap.\n"));
-                       get_resources()->get_synchronous()->delete_display(this);
-               }
-               else
-#endif
-               {
 // _XftDisplayInfo needs a lock.
-                       get_resources()->create_window_lock->lock("BC_WindowBase::~BC_WindowBase");
-                       XCloseDisplay(display);
-                       get_resources()->create_window_lock->unlock();
-               }
+               get_resources()->create_window_lock->lock("BC_WindowBase::~BC_WindowBase");
+               XCloseDisplay(display);
+               get_resources()->create_window_lock->unlock();
+
 // clipboard uses a different display connection
                clipboard->stop_clipboard();
                delete clipboard;
-#endif // SINGLE_THREAD
        }
 
        resize_history.remove_all_objects();
index c765b2822207d88d34f606136d64501c63afbe65..717f254507f81adb4e5151846c166263e1519258 100644 (file)
@@ -129,7 +129,7 @@ public:
 class BC_WindowBase : public trace_info
 {
 public:
-       BC_WindowBase(int opts=0);
+       BC_WindowBase();
        virtual ~BC_WindowBase();
 
        friend class BC_Bar;
@@ -738,7 +738,6 @@ private:
 // Popup window for tooltip
        BC_Popup *tooltip_popup;
 // If this subwindow has already shown a tooltip since the last EnterNotify
-       int options;
        int flash_enabled;
 
 
index c0bcff5abff3a3e60d78acbf12db2c7703e9c599..e3f68802581821b57f9441d544693d9a52cd516c 100644 (file)
@@ -31,11 +31,6 @@ class BC_WindowList;
 // Milliseconds before cursor disappears during video playback
 #define VIDEO_CURSOR_TIMEOUT 2000
 
-// Window options
-#define WINDOW_UTF8    0x0001
-//used to flag top_level window in glx_window / glXCreateWindow
-#define GLX_DISPLAY    0x0002
-
 // mouse wheel
 #define WHEEL_UP 4
 #define WHEEL_DOWN 5
index 2573e56b334af163db07d684965901fbf49c3248..d05ff849307050228459fa93e2767774286b14f9 100644 (file)
@@ -499,27 +499,29 @@ int VFrame::allocate_data(unsigned char *data, int shmid,
        }
        else {
                memory_type = VFrame::PRIVATE;
+               this->data = 0;
                int size = calculate_data_size(this->w, this->h,
                        this->bytes_per_line, this->color_model);
                if(BC_WindowBase::get_resources()->use_vframe_shm() && use_shm) {
                        this->shmid = shmget(IPC_PRIVATE, size, IPC_CREAT | 0777);
-                       if(this->shmid < 0) {
-                               printf("VFrame::allocate_data %d could not allocate shared memory\n", __LINE__);
-                       }
-
-                       this->data = (unsigned char*)shmat(this->shmid, NULL, 0);
-//printf("VFrame::allocate_data %d %d %d\n", __LINE__, size, this->shmid);
-
-//printf("VFrame::allocate_data %d %p\n", __LINE__, this->data);
+                       if( this->shmid >= 0 ) {
+                               this->data = (unsigned char*)shmat(this->shmid, NULL, 0);
+//printf("VFrame::allocate_data %d %d %d %p\n", __LINE__, size, this->shmid, this->data);
 // This causes it to automatically delete when the program exits.
-                       shmctl(this->shmid, IPC_RMID, 0);
+                               shmctl(this->shmid, IPC_RMID, 0);
+                       }
+                       else {
+                               printf("VFrame::allocate_data %d could not allocate"
+                                       " shared memory, %dx%d (model %d) size=0x%08x\n",
+                                       __LINE__, w, h, color_model, size);
+                               BC_Trace::dump_shm_stats(stdout);
+                       }
                }
-               else {
 // Have to use malloc for libpng
-//printf("==vframe %d from %p\n", size, __builtin_return_address(0));
+               if( !data ) {
                        this->data = (unsigned char *)malloc(size);
+                       this->shmid = -1;
                }
-
 // Memory check
 // if(this->w * this->h > 1500 * 1100)
 // printf("VFrame::allocate_data 2 this=%p w=%d h=%d this->data=%p\n",