~glmark2-dev/glmark2/canvas-drm-rebranch

« back to all changes in this revision

Viewing changes to src/canvas-drm.h

  • Committer: Jesse Barker
  • Date: 2012-12-17 19:11:54 UTC
  • Revision ID: jesse.barker@linaro.org-20121217191154-xbfthu2i1fzsqv75
CanvasDRM: Fix handling of Ctrl-C.  Because the Ctrl-C was being handled by
CanvasDRM directly, DRMState had no knowledge of the event, and wasn't able
to detect it properly when select() came back with an error.  Move the
quit handler into DRMState, and give it a public should_quit() method that
CanvasDRM can call.  This is better encapsulation, and allows DRMState to
properly detect the user interrupt and release the GBM resources so the
console isn't hung when the application exits.

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
    static void page_flip_handler(int fd, unsigned int frame, unsigned int sec,
45
45
                                  unsigned int usec, void* data);
46
46
    static void fb_destroy_callback(gbm_bo* bo, void* data);
 
47
    static void quit_handler(int signum);
 
48
    static bool should_quit_;
47
49
    DRMFBState* fb_get_from_bo(gbm_bo* bo);
48
50
    bool init_gbm();
49
51
    int fd_;
73
75
    bool init();
74
76
    bool reset();
75
77
    void do_flip();
 
78
    bool should_quit() const { return should_quit_; }
76
79
    gbm_device* device() const { return dev_; }
77
80
    gbm_surface* surface() const { return surface_; }
78
81
    unsigned int mode_width() const
124
127
 
125
128
    void resize_no_viewport(int width, int height);
126
129
    void init_gl_extensions();
127
 
 
128
 
    static void quit_handler(int signum);
129
 
    static bool should_quit_;
130
130
};
131
131
 
132
132
#endif