summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 83700fa)
raw | patch | inline | side by side (parent: 83700fa)
author | Vincent Stehlé <v-stehle@ti.com> | |
Tue, 28 Aug 2012 13:32:34 +0000 (15:32 +0200) | ||
committer | Vincent Stehlé <v-stehle@ti.com> | |
Tue, 28 Aug 2012 13:37:12 +0000 (15:37 +0200) |
Change the per-display close function into a proper "virtual" function
mechanism with function pointer in the display structure. This fixes the
segfault, when closing a kms display.
Signed-off-by: Vincent Stehlé <v-stehle@ti.com>
mechanism with function pointer in the display structure. This fixes the
segfault, when closing a kms display.
Signed-off-by: Vincent Stehlé <v-stehle@ti.com>
util/display-kms.c | patch | blob | history | |
util/display-x11.c | patch | blob | history | |
util/util.c | patch | blob | history | |
util/util.h | patch | blob | history |
diff --git a/util/display-kms.c b/util/display-kms.c
index 106582abbdfe72033a046373eee9d5c028e472af..c15bf79a6c8c717dcea24a83a497a1493501cbab 100644 (file)
--- a/util/display-kms.c
+++ b/util/display-kms.c
return ret;
}
+static void
+close_kms(struct display *disp)
+{
+}
+
static void
connector_find_mode(struct display *disp, struct connector *c)
{
disp->get_vid_buffers = get_vid_buffers;
disp->post_buffer = post_buffer;
disp->post_vid_buffer = post_vid_buffer;
+ disp->close = close_kms;
disp_kms->resources = drmModeGetResources(disp->fd);
if (!disp_kms->resources) {
diff --git a/util/display-x11.c b/util/display-x11.c
index 9553dc6127c35ecba204f10e826031375cbb12fa..2b244409d28ca81a5b2d91faee063aefa3cc6596 100644 (file)
--- a/util/display-x11.c
+++ b/util/display-x11.c
return 0;
}
+static void
+close_x11(struct display *disp)
+{
+ struct display_x11 *disp_x11 = to_display_x11(disp);
+ XCloseDisplay(disp_x11->dpy);
+}
+
void
disp_x11_usage(void)
{
disp->get_vid_buffers = get_vid_buffers;
disp->post_buffer = post_buffer;
disp->post_vid_buffer = post_vid_buffer;
+ disp->close = close_x11;
disp->multiplanar = false;
/* note: set args to NULL after we've parsed them so other modules know
ERROR("unimplemented");
return NULL;
}
-
-void disp_x11_close(struct display *disp)
-{
- struct display_x11 *disp_x11 = to_display_x11(disp);
- XCloseDisplay(disp_x11->dpy);
-}
diff --git a/util/util.c b/util/util.c
index 5e69cdf4c92219973c5252bd9ed9b8ef3fc0fca6..984fc904b503c8576e49a7c54ec7c9189aeecfb5 100644 (file)
--- a/util/util.c
+++ b/util/util.c
return disp;
}
-void disp_close(struct display *disp)
-{
-#ifdef HAVE_X11
- disp_x11_close(disp);
-#endif
-}
-
struct buffer **
disp_get_vid_buffers(struct display *disp, uint32_t n,
uint32_t fourcc, uint32_t w, uint32_t h)
diff --git a/util/util.h b/util/util.h
index 28a345adeefe3202c3ab88dbb6e5f5d14ed35c87..4944ac5e2f13794f24b45c944c1d7672f9bc6b37 100644 (file)
--- a/util/util.h
+++ b/util/util.h
int (*post_buffer)(struct display *disp, struct buffer *buf);
int (*post_vid_buffer)(struct display *disp, struct buffer *buf,
uint32_t x, uint32_t y, uint32_t w, uint32_t h);
+ void (*close)(struct display *disp);
bool multiplanar; /* True when Y and U/V are in separate buffers. */
};
struct display * disp_open(int argc, char **argv);
/* Close display */
-void disp_close(struct display *disp);
+static inline void
+disp_close(struct display *disp)
+{
+ disp->close(disp);
+}
/* Get normal RGB/UI buffers (ie. not scaled, not YUV) */
static inline struct buffer **