mirror of
https://github.com/mpv-player/mpv
synced 2025-01-18 04:51:52 +00:00
build: remove POSIX/sysv shared memory test
vo_x11 and vo_xv need this. According to the Linux manpage, all involved functions are POSIX-2001 anyway. (I just assumed they were not, because they're mostly System V UNIX legacy garbage.)
This commit is contained in:
parent
ca29a5aa9b
commit
d7a02bcb3b
@ -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,7 +131,7 @@ 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,
|
||||
@ -147,23 +142,18 @@ shmemerror:
|
||||
}
|
||||
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)
|
||||
|
@ -30,12 +30,10 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#if HAVE_SHM
|
||||
#include <sys/types.h>
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/shm.h>
|
||||
#include <X11/extensions/XShm.h>
|
||||
#endif
|
||||
|
||||
// Note: depends on the inclusion of X11/extensions/XShm.h
|
||||
#include <X11/extensions/Xv.h>
|
||||
@ -92,10 +90,8 @@ struct xvctx {
|
||||
GC f_gc; // used to paint background
|
||||
GC vo_gc; // used to paint video
|
||||
int Shmem_Flag;
|
||||
#if HAVE_SHM
|
||||
XShmSegmentInfo Shminfo[MAX_BUFFERS];
|
||||
int Shm_Warned_Slow;
|
||||
#endif
|
||||
};
|
||||
|
||||
#define MP_FOURCC(a,b,c,d) ((a) | ((b)<<8) | ((c)<<16) | ((unsigned)(d)<<24))
|
||||
@ -542,7 +538,6 @@ static bool allocate_xvimage(struct vo *vo, int foo)
|
||||
int aligned_w = FFALIGN(ctx->image_width, 32);
|
||||
// round up the height to next chroma boundary too
|
||||
int aligned_h = FFALIGN(ctx->image_height, 2);
|
||||
#if HAVE_SHM
|
||||
if (x11->display_is_local && XShmQueryExtension(x11->display)) {
|
||||
ctx->Shmem_Flag = 1;
|
||||
x11->ShmCompletionEvent = XShmGetEventBase(x11->display)
|
||||
@ -572,9 +567,7 @@ static bool allocate_xvimage(struct vo *vo, int foo)
|
||||
XShmAttach(x11->display, &ctx->Shminfo[foo]);
|
||||
XSync(x11->display, False);
|
||||
shmctl(ctx->Shminfo[foo].shmid, IPC_RMID, 0);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
} else {
|
||||
ctx->xvimage[foo] =
|
||||
(XvImage *) XvCreateImage(x11->display, ctx->xv_port,
|
||||
ctx->xv_format, NULL, aligned_w,
|
||||
@ -604,22 +597,17 @@ static bool allocate_xvimage(struct vo *vo, int foo)
|
||||
static void deallocate_xvimage(struct vo *vo, int foo)
|
||||
{
|
||||
struct xvctx *ctx = vo->priv;
|
||||
#if HAVE_SHM
|
||||
if (ctx->Shmem_Flag) {
|
||||
XShmDetach(vo->x11->display, &ctx->Shminfo[foo]);
|
||||
shmdt(ctx->Shminfo[foo].shmaddr);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
} else {
|
||||
av_free(ctx->xvimage[foo]->data);
|
||||
}
|
||||
if (ctx->xvimage[foo])
|
||||
XFree(ctx->xvimage[foo]);
|
||||
|
||||
ctx->xvimage[foo] = NULL;
|
||||
#if HAVE_SHM
|
||||
ctx->Shminfo[foo] = (XShmSegmentInfo){0};
|
||||
#endif
|
||||
|
||||
XSync(vo->x11->display, False);
|
||||
return;
|
||||
@ -633,16 +621,14 @@ static inline void put_xvimage(struct vo *vo, XvImage *xvi)
|
||||
struct mp_rect *dst = &ctx->dst_rect;
|
||||
int dw = dst->x1 - dst->x0, dh = dst->y1 - dst->y0;
|
||||
int sw = src->x1 - src->x0, sh = src->y1 - src->y0;
|
||||
#if HAVE_SHM
|
||||
|
||||
if (ctx->Shmem_Flag) {
|
||||
XvShmPutImage(x11->display, ctx->xv_port, x11->window, ctx->vo_gc, xvi,
|
||||
src->x0, src->y0, sw, sh,
|
||||
dst->x0, dst->y0, dw, dh,
|
||||
True);
|
||||
x11->ShmCompletionWaitCount++;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
} else {
|
||||
XvPutImage(x11->display, ctx->xv_port, x11->window, ctx->vo_gc, xvi,
|
||||
src->x0, src->y0, sw, sh,
|
||||
dst->x0, dst->y0, dw, dh);
|
||||
@ -677,7 +663,6 @@ static struct mp_image get_xv_buffer(struct vo *vo, int buf_index)
|
||||
|
||||
static void wait_for_completion(struct vo *vo, int max_outstanding)
|
||||
{
|
||||
#if HAVE_SHM
|
||||
struct xvctx *ctx = vo->priv;
|
||||
struct vo_x11_state *x11 = vo->x11;
|
||||
if (ctx->Shmem_Flag) {
|
||||
@ -691,7 +676,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)
|
||||
|
5
wscript
5
wscript
@ -227,11 +227,6 @@ iconv support use --disable-iconv.",
|
||||
'name': '--termios',
|
||||
'desc': 'termios',
|
||||
'func': check_headers('termios.h', 'sys/termios.h'),
|
||||
}, {
|
||||
'name': '--shm',
|
||||
'desc': 'shm',
|
||||
'func': check_statement(['sys/types.h', 'sys/ipc.h', 'sys/shm.h'],
|
||||
'shmget(0, 0, 0); shmat(0, 0, 0); shmctl(0, 0, 0)')
|
||||
}, {
|
||||
'name': 'nanosleep',
|
||||
'desc': 'nanosleep',
|
||||
|
Loading…
Reference in New Issue
Block a user