mirror of
https://github.com/mpv-player/mpv
synced 2025-04-01 00:07:33 +00:00
vo_opengl: rpi: use new egl context creation helper function
Only for the "new" vo_opengl backend code.
This commit is contained in:
parent
060599ac6a
commit
5819a4e301
@ -22,6 +22,7 @@
|
|||||||
#include "osdep/atomic.h"
|
#include "osdep/atomic.h"
|
||||||
#include "video/out/win_state.h"
|
#include "video/out/win_state.h"
|
||||||
#include "context.h"
|
#include "context.h"
|
||||||
|
#include "egl_helpers.h"
|
||||||
|
|
||||||
#include "context_rpi.h"
|
#include "context_rpi.h"
|
||||||
|
|
||||||
@ -140,6 +141,15 @@ void mp_egl_rpi_destroy(struct mp_egl_rpi *p)
|
|||||||
p->gl = NULL;
|
p->gl = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void mp_egl_rpi_destroy_base(struct mp_egl_rpi *p)
|
||||||
|
{
|
||||||
|
if (p->egl_context)
|
||||||
|
eglDestroyContext(p->egl_display, p->egl_context);
|
||||||
|
p->egl_context = EGL_NO_CONTEXT;
|
||||||
|
eglReleaseThread();
|
||||||
|
p->egl_display = EGL_NO_DISPLAY;
|
||||||
|
}
|
||||||
|
|
||||||
static int mp_egl_rpi_init_base(struct mp_egl_rpi *p)
|
static int mp_egl_rpi_init_base(struct mp_egl_rpi *p)
|
||||||
{
|
{
|
||||||
p->egl_display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
p->egl_display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
||||||
@ -148,40 +158,17 @@ static int mp_egl_rpi_init_base(struct mp_egl_rpi *p)
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
eglBindAPI(EGL_OPENGL_ES_API);
|
if (!mpegl_create_context(p->egl_display, p->log, 0, &p->egl_context,
|
||||||
|
&p->egl_config))
|
||||||
p->egl_config = select_fb_config_egl(p);
|
|
||||||
if (!p->egl_config)
|
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
EGLint context_attributes[] = {
|
|
||||||
EGL_CONTEXT_CLIENT_VERSION, 2,
|
|
||||||
EGL_NONE
|
|
||||||
};
|
|
||||||
p->egl_context = eglCreateContext(p->egl_display, p->egl_config,
|
|
||||||
EGL_NO_CONTEXT, context_attributes);
|
|
||||||
|
|
||||||
if (p->egl_context == EGL_NO_CONTEXT) {
|
|
||||||
MP_FATAL(p, "Could not create EGL context!\n");
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
mp_egl_rpi_destroy(p);
|
mp_egl_rpi_destroy_base(p);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mp_egl_rpi_destroy_base(struct mp_egl_rpi *p)
|
|
||||||
{
|
|
||||||
if (p->egl_context)
|
|
||||||
eglDestroyContext(p->egl_display, p->egl_context);
|
|
||||||
p->egl_context = EGL_NO_CONTEXT;
|
|
||||||
eglReleaseThread();
|
|
||||||
p->egl_display = EGL_NO_DISPLAY;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int mp_egl_rpi_init_window(struct mp_egl_rpi *p,
|
static int mp_egl_rpi_init_window(struct mp_egl_rpi *p,
|
||||||
DISPMANX_ELEMENT_HANDLE_T window,
|
DISPMANX_ELEMENT_HANDLE_T window,
|
||||||
int w, int h)
|
int w, int h)
|
||||||
|
2
wscript
2
wscript
@ -846,7 +846,7 @@ video_output_features = [
|
|||||||
}, {
|
}, {
|
||||||
'name': 'egl-helpers',
|
'name': 'egl-helpers',
|
||||||
'desc': 'EGL helper functions',
|
'desc': 'EGL helper functions',
|
||||||
'deps_any': [ 'egl-x11', 'mali-fbdev' ],
|
'deps_any': [ 'egl-x11', 'mali-fbdev', 'rpi' ],
|
||||||
'func': check_true
|
'func': check_true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user