summaryrefslogtreecommitdiffstats
path: root/video/out/vo_x11.c
diff options
context:
space:
mode:
Diffstat (limited to 'video/out/vo_x11.c')
-rw-r--r--video/out/vo_x11.c41
1 files changed, 13 insertions, 28 deletions
diff --git a/video/out/vo_x11.c b/video/out/vo_x11.c
index dd2d942c9a..f29d06ad16 100644
--- a/video/out/vo_x11.c
+++ b/video/out/vo_x11.c
@@ -37,11 +37,9 @@
#include "x11_common.h"
-#if HAVE_SHM
#include <sys/ipc.h>
#include <sys/shm.h>
#include <X11/extensions/XShm.h>
-#endif
#include "sub/osd.h"
#include "sub/draw_bmp.h"
@@ -79,11 +77,9 @@ struct priv {
int current_buf;
bool reset_view;
-#if HAVE_SHM
int Shmem_Flag;
XShmSegmentInfo Shminfo[2];
int Shm_Warned_Slow;
-#endif
};
static bool resize(struct vo *vo);
@@ -91,7 +87,6 @@ static bool resize(struct vo *vo);
static bool getMyXImage(struct priv *p, int foo)
{
struct vo *vo = p->vo;
-#if HAVE_SHM
if (vo->x11->display_is_local && XShmQueryExtension(vo->x11->display)) {
p->Shmem_Flag = 1;
vo->x11->ShmCompletionEvent = XShmGetEventBase(vo->x11->display)
@@ -136,34 +131,29 @@ static bool getMyXImage(struct priv *p, int foo)
} else {
shmemerror:
p->Shmem_Flag = 0;
-#endif
- MP_VERBOSE(vo, "Not using SHM.\n");
- p->myximage[foo] =
- XCreateImage(vo->x11->display, p->vinfo.visual, p->depth, ZPixmap,
- 0, NULL, p->image_width, p->image_height, 8, 0);
- if (!p->myximage[foo]) {
- MP_WARN(vo, "could not allocate image");
- return false;
+
+ MP_VERBOSE(vo, "Not using SHM.\n");
+ p->myximage[foo] =
+ XCreateImage(vo->x11->display, p->vinfo.visual, p->depth, ZPixmap,
+ 0, NULL, p->image_width, p->image_height, 8, 0);
+ if (!p->myximage[foo]) {
+ MP_WARN(vo, "could not allocate image");
+ return false;
+ }
+ p->myximage[foo]->data =
+ calloc(1, p->myximage[foo]->bytes_per_line * p->image_height + 32);
}
- p->myximage[foo]->data =
- calloc(1, p->myximage[foo]->bytes_per_line * p->image_height + 32);
-#if HAVE_SHM
-}
-#endif
return true;
}
static void freeMyXImage(struct priv *p, int foo)
{
-#if HAVE_SHM
struct vo *vo = p->vo;
if (p->Shmem_Flag) {
XShmDetach(vo->x11->display, &p->Shminfo[foo]);
XDestroyImage(p->myximage[foo]);
shmdt(p->Shminfo[foo].shmaddr);
- } else
-#endif
- {
+ } else {
if (p->myximage[foo])
XDestroyImage(p->myximage[foo]);
}
@@ -284,15 +274,12 @@ static void Display_Image(struct priv *p, XImage *myximage)
p->reset_view = false;
}
-#if HAVE_SHM
if (p->Shmem_Flag) {
XShmPutImage(vo->x11->display, vo->x11->window, p->gc, x_image,
0, 0, p->dst.x0, p->dst.y0, p->dst_w, p->dst_h,
True);
vo->x11->ShmCompletionWaitCount++;
- } else
-#endif
- {
+ } else {
XPutImage(vo->x11->display, vo->x11->window, p->gc, x_image,
0, 0, p->dst.x0, p->dst.y0, p->dst_w, p->dst_h);
}
@@ -312,7 +299,6 @@ static struct mp_image get_x_buffer(struct priv *p, int buf_index)
static void wait_for_completion(struct vo *vo, int max_outstanding)
{
-#if HAVE_SHM
struct priv *ctx = vo->priv;
struct vo_x11_state *x11 = vo->x11;
if (ctx->Shmem_Flag) {
@@ -326,7 +312,6 @@ static void wait_for_completion(struct vo *vo, int max_outstanding)
vo_x11_check_events(vo);
}
}
-#endif
}
static void flip_page(struct vo *vo)