2015-04-15 16:14:14 +00:00
|
|
|
/*
|
|
|
|
* This file is part of mpv.
|
|
|
|
*
|
2016-01-19 17:36:34 +00:00
|
|
|
* mpv is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2015-04-15 16:14:14 +00:00
|
|
|
*
|
|
|
|
* mpv is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2016-01-19 17:36:34 +00:00
|
|
|
* GNU Lesser General Public License for more details.
|
2015-11-07 22:22:38 +00:00
|
|
|
*
|
2016-01-19 17:36:34 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
|
2015-04-15 16:14:14 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <stdbool.h>
|
2015-04-19 07:09:37 +00:00
|
|
|
#include <sys/mman.h>
|
2017-01-09 15:21:28 +00:00
|
|
|
#include <poll.h>
|
2015-04-17 17:59:31 +00:00
|
|
|
#include <unistd.h>
|
2015-04-19 07:09:37 +00:00
|
|
|
|
2019-12-07 18:17:21 +00:00
|
|
|
#include <drm_fourcc.h>
|
2015-04-15 16:14:14 +00:00
|
|
|
#include <libswscale/swscale.h>
|
|
|
|
|
2015-04-19 07:39:58 +00:00
|
|
|
#include "drm_common.h"
|
|
|
|
|
2015-04-15 16:14:14 +00:00
|
|
|
#include "common/msg.h"
|
2015-04-19 07:39:58 +00:00
|
|
|
#include "osdep/timer.h"
|
2015-04-15 16:14:14 +00:00
|
|
|
#include "sub/osd.h"
|
|
|
|
#include "video/fmt-conversion.h"
|
|
|
|
#include "video/mp_image.h"
|
|
|
|
#include "video/sws_utils.h"
|
|
|
|
#include "vo.h"
|
|
|
|
|
2018-02-19 18:23:44 +00:00
|
|
|
#define IMGFMT_XRGB8888 IMGFMT_BGR0
|
|
|
|
#if BYTE_ORDER == BIG_ENDIAN
|
|
|
|
#define IMGFMT_XRGB2101010 pixfmt2imgfmt(AV_PIX_FMT_GBRP10BE)
|
|
|
|
#else
|
|
|
|
#define IMGFMT_XRGB2101010 pixfmt2imgfmt(AV_PIX_FMT_GBRP10LE)
|
|
|
|
#endif
|
|
|
|
|
2015-05-29 15:49:51 +00:00
|
|
|
#define BYTES_PER_PIXEL 4
|
|
|
|
#define BITS_PER_PIXEL 32
|
2015-04-17 17:59:31 +00:00
|
|
|
#define USE_MASTER 0
|
2015-04-15 16:14:14 +00:00
|
|
|
|
2015-11-07 12:41:40 +00:00
|
|
|
struct framebuffer {
|
2015-04-15 16:14:14 +00:00
|
|
|
uint32_t width;
|
|
|
|
uint32_t height;
|
|
|
|
uint32_t stride;
|
|
|
|
uint32_t size;
|
|
|
|
uint32_t handle;
|
|
|
|
uint8_t *map;
|
|
|
|
uint32_t fb;
|
|
|
|
};
|
|
|
|
|
2019-04-11 21:26:06 +00:00
|
|
|
struct kms_frame {
|
|
|
|
struct framebuffer *fb;
|
|
|
|
struct drm_vsync_tuple vsync;
|
|
|
|
};
|
|
|
|
|
2015-04-15 16:14:14 +00:00
|
|
|
struct priv {
|
2016-10-04 20:07:19 +00:00
|
|
|
char *connector_spec;
|
2015-05-28 18:53:14 +00:00
|
|
|
int mode_id;
|
2015-04-20 16:57:24 +00:00
|
|
|
|
2015-11-07 12:41:40 +00:00
|
|
|
struct kms *kms;
|
2015-04-15 16:14:14 +00:00
|
|
|
drmModeCrtc *old_crtc;
|
2015-04-20 16:57:24 +00:00
|
|
|
drmEventContext ev;
|
2015-04-15 16:14:14 +00:00
|
|
|
|
2015-06-28 14:02:22 +00:00
|
|
|
bool vt_switcher_active;
|
|
|
|
struct vt_switcher vt_switcher;
|
|
|
|
|
2019-09-28 09:17:48 +00:00
|
|
|
int swapchain_depth;
|
|
|
|
unsigned int buf_count;
|
|
|
|
struct framebuffer *bufs;
|
2015-11-07 12:41:40 +00:00
|
|
|
int front_buf;
|
2015-04-17 17:59:31 +00:00
|
|
|
bool active;
|
2019-04-11 21:26:06 +00:00
|
|
|
bool waiting_for_flip;
|
|
|
|
bool still;
|
|
|
|
bool paused;
|
|
|
|
|
|
|
|
struct kms_frame **fb_queue;
|
|
|
|
unsigned int fb_queue_len;
|
|
|
|
struct framebuffer *cur_fb;
|
2015-04-15 16:14:14 +00:00
|
|
|
|
2019-12-07 18:17:21 +00:00
|
|
|
uint32_t drm_format;
|
2018-02-19 18:23:44 +00:00
|
|
|
enum mp_imgfmt imgfmt;
|
|
|
|
|
2016-10-04 20:07:19 +00:00
|
|
|
int32_t screen_w;
|
|
|
|
int32_t screen_h;
|
2015-04-15 16:14:14 +00:00
|
|
|
struct mp_image *last_input;
|
|
|
|
struct mp_image *cur_frame;
|
vo_drm: make the osd as large as the screen
Before this commit, the drm vo drew the osd over the scaled image, and
then copied the result onto the framebuffer, shifted. This made the
frame centered, but forced the osd to be only as large as the image.
This was inconsistent with other vo's, covered the image with the
progress indicator even when a black band was at the top of the screen,
made the progress indicator wrap on narrow videos, etc.
The change is to always use an image as large as the screen. The frame
is copied scaled and shifted to it, and the osd drawn over it. The
result is finally copied to the framebuffer without any shift, since it
is already as large as it.
Technically, cur_frame is an image as large as the screen and
cur_frame_cropped is a dummy reference to it, cropped to the size of
the scaled video. This way, copying the scaled image to
cur_frame_cropped positions the image in the right place in cur_frame,
which can then have the osd added to it and copied to the framebuffer.
2018-01-24 13:19:40 +00:00
|
|
|
struct mp_image *cur_frame_cropped;
|
2015-04-15 16:14:14 +00:00
|
|
|
struct mp_rect src;
|
|
|
|
struct mp_rect dst;
|
|
|
|
struct mp_osd_res osd;
|
|
|
|
struct mp_sws_context *sws;
|
2019-04-11 21:26:06 +00:00
|
|
|
|
|
|
|
struct drm_vsync_tuple vsync;
|
|
|
|
struct vo_vsync_info vsync_info;
|
2015-04-15 16:14:14 +00:00
|
|
|
};
|
|
|
|
|
2015-11-07 12:41:40 +00:00
|
|
|
static void fb_destroy(int fd, struct framebuffer *buf)
|
2015-04-15 16:14:14 +00:00
|
|
|
{
|
|
|
|
if (buf->map) {
|
|
|
|
munmap(buf->map, buf->size);
|
|
|
|
}
|
|
|
|
if (buf->fb) {
|
|
|
|
drmModeRmFB(fd, buf->fb);
|
|
|
|
}
|
|
|
|
if (buf->handle) {
|
|
|
|
struct drm_mode_destroy_dumb dreq = {
|
|
|
|
.handle = buf->handle,
|
|
|
|
};
|
|
|
|
drmIoctl(fd, DRM_IOCTL_MODE_DESTROY_DUMB, &dreq);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-07 20:11:04 +00:00
|
|
|
static bool fb_setup_single(struct vo *vo, int fd, struct framebuffer *buf)
|
2015-04-15 16:14:14 +00:00
|
|
|
{
|
2018-02-19 18:23:44 +00:00
|
|
|
struct priv *p = vo->priv;
|
|
|
|
|
2015-04-15 16:14:14 +00:00
|
|
|
buf->handle = 0;
|
|
|
|
|
|
|
|
// create dumb buffer
|
|
|
|
struct drm_mode_create_dumb creq = {
|
|
|
|
.width = buf->width,
|
|
|
|
.height = buf->height,
|
2015-05-29 15:49:51 +00:00
|
|
|
.bpp = BITS_PER_PIXEL,
|
2015-04-15 16:14:14 +00:00
|
|
|
};
|
2015-11-07 20:11:04 +00:00
|
|
|
if (drmIoctl(fd, DRM_IOCTL_MODE_CREATE_DUMB, &creq) < 0) {
|
2015-04-15 16:14:14 +00:00
|
|
|
MP_ERR(vo, "Cannot create dumb buffer: %s\n", mp_strerror(errno));
|
2015-11-07 20:11:04 +00:00
|
|
|
goto err;
|
2015-04-15 16:14:14 +00:00
|
|
|
}
|
|
|
|
buf->stride = creq.pitch;
|
|
|
|
buf->size = creq.size;
|
|
|
|
buf->handle = creq.handle;
|
|
|
|
|
|
|
|
// create framebuffer object for the dumb-buffer
|
2019-12-07 18:17:21 +00:00
|
|
|
int ret = drmModeAddFB2(fd, buf->width, buf->height,
|
|
|
|
p->drm_format,
|
|
|
|
(uint32_t[4]){buf->handle, 0, 0, 0},
|
|
|
|
(uint32_t[4]){buf->stride, 0, 0, 0},
|
|
|
|
(uint32_t[4]){0, 0, 0, 0},
|
|
|
|
&buf->fb, 0);
|
|
|
|
if (ret) {
|
2015-04-15 16:14:14 +00:00
|
|
|
MP_ERR(vo, "Cannot create framebuffer: %s\n", mp_strerror(errno));
|
2015-11-07 20:11:04 +00:00
|
|
|
goto err;
|
2015-04-15 16:14:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// prepare buffer for memory mapping
|
|
|
|
struct drm_mode_map_dumb mreq = {
|
|
|
|
.handle = buf->handle,
|
|
|
|
};
|
2015-11-07 20:11:04 +00:00
|
|
|
if (drmIoctl(fd, DRM_IOCTL_MODE_MAP_DUMB, &mreq)) {
|
2015-04-15 16:14:14 +00:00
|
|
|
MP_ERR(vo, "Cannot map dumb buffer: %s\n", mp_strerror(errno));
|
2015-11-07 20:11:04 +00:00
|
|
|
goto err;
|
2015-04-15 16:14:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// perform actual memory mapping
|
|
|
|
buf->map = mmap(0, buf->size, PROT_READ | PROT_WRITE, MAP_SHARED,
|
|
|
|
fd, mreq.offset);
|
|
|
|
if (buf->map == MAP_FAILED) {
|
|
|
|
MP_ERR(vo, "Cannot map dumb buffer: %s\n", mp_strerror(errno));
|
2015-11-07 20:11:04 +00:00
|
|
|
goto err;
|
2015-04-15 16:14:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
memset(buf->map, 0, buf->size);
|
2015-11-07 20:11:04 +00:00
|
|
|
return true;
|
2015-04-15 16:14:14 +00:00
|
|
|
|
2015-11-07 20:11:04 +00:00
|
|
|
err:
|
2015-11-07 12:41:40 +00:00
|
|
|
fb_destroy(fd, buf);
|
2015-11-07 20:11:04 +00:00
|
|
|
return false;
|
2015-04-15 16:14:14 +00:00
|
|
|
}
|
|
|
|
|
2019-04-11 21:26:06 +00:00
|
|
|
static bool fb_setup_buffers(struct vo *vo)
|
2015-04-15 16:14:14 +00:00
|
|
|
{
|
2015-11-07 12:41:40 +00:00
|
|
|
struct priv *p = vo->priv;
|
2015-05-28 18:53:14 +00:00
|
|
|
|
2019-09-28 09:17:48 +00:00
|
|
|
p->bufs = talloc_zero_array(p, struct framebuffer, p->buf_count);
|
|
|
|
|
2015-11-07 12:41:40 +00:00
|
|
|
p->front_buf = 0;
|
2019-09-28 09:17:48 +00:00
|
|
|
for (unsigned int i = 0; i < p->buf_count; i++) {
|
2018-06-02 10:53:54 +00:00
|
|
|
p->bufs[i].width = p->kms->mode.mode.hdisplay;
|
|
|
|
p->bufs[i].height = p->kms->mode.mode.vdisplay;
|
2015-04-15 16:14:14 +00:00
|
|
|
}
|
|
|
|
|
2019-09-28 09:17:48 +00:00
|
|
|
for (unsigned int i = 0; i < p->buf_count; i++) {
|
2015-11-07 20:11:04 +00:00
|
|
|
if (!fb_setup_single(vo, p->kms->fd, &p->bufs[i])) {
|
2016-10-04 20:07:19 +00:00
|
|
|
MP_ERR(vo, "Cannot create framebuffer\n");
|
2015-04-15 16:14:14 +00:00
|
|
|
for (unsigned int j = 0; j < i; j++) {
|
2015-11-07 12:41:40 +00:00
|
|
|
fb_destroy(p->kms->fd, &p->bufs[j]);
|
2015-04-15 16:14:14 +00:00
|
|
|
}
|
2015-11-07 20:11:04 +00:00
|
|
|
return false;
|
2015-04-15 16:14:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-11 21:26:06 +00:00
|
|
|
p->cur_fb = &p->bufs[0];
|
|
|
|
|
2015-11-07 20:11:04 +00:00
|
|
|
return true;
|
2015-04-15 16:14:14 +00:00
|
|
|
}
|
|
|
|
|
2019-04-11 21:26:06 +00:00
|
|
|
static void get_vsync(struct vo *vo, struct vo_vsync_info *info)
|
|
|
|
{
|
|
|
|
struct priv *p = vo->priv;
|
|
|
|
*info = p->vsync_info;
|
2015-04-20 16:57:24 +00:00
|
|
|
}
|
|
|
|
|
2015-11-07 20:11:04 +00:00
|
|
|
static bool crtc_setup(struct vo *vo)
|
2015-04-17 17:59:31 +00:00
|
|
|
{
|
|
|
|
struct priv *p = vo->priv;
|
2015-04-21 09:50:44 +00:00
|
|
|
if (p->active)
|
2015-11-07 20:11:04 +00:00
|
|
|
return true;
|
2015-11-07 12:41:40 +00:00
|
|
|
p->old_crtc = drmModeGetCrtc(p->kms->fd, p->kms->crtc_id);
|
|
|
|
int ret = drmModeSetCrtc(p->kms->fd, p->kms->crtc_id,
|
2019-04-11 21:26:06 +00:00
|
|
|
p->cur_fb->fb,
|
2016-10-04 20:07:19 +00:00
|
|
|
0, 0, &p->kms->connector->connector_id, 1,
|
2018-06-02 10:53:54 +00:00
|
|
|
&p->kms->mode.mode);
|
2015-04-17 17:59:31 +00:00
|
|
|
p->active = true;
|
2015-11-07 20:11:04 +00:00
|
|
|
return ret == 0;
|
2015-04-17 17:59:31 +00:00
|
|
|
}
|
|
|
|
|
2015-11-07 12:41:40 +00:00
|
|
|
static void crtc_release(struct vo *vo)
|
2015-04-17 17:59:31 +00:00
|
|
|
{
|
|
|
|
struct priv *p = vo->priv;
|
2015-04-20 16:57:24 +00:00
|
|
|
|
2015-04-21 09:50:44 +00:00
|
|
|
if (!p->active)
|
|
|
|
return;
|
2015-04-17 17:59:31 +00:00
|
|
|
p->active = false;
|
2015-04-20 16:57:24 +00:00
|
|
|
|
|
|
|
// wait for current page flip
|
2019-04-11 21:26:06 +00:00
|
|
|
while (p->waiting_for_flip) {
|
2015-11-07 12:41:40 +00:00
|
|
|
int ret = drmHandleEvent(p->kms->fd, &p->ev);
|
2015-04-20 16:57:24 +00:00
|
|
|
if (ret) {
|
|
|
|
MP_ERR(vo, "drmHandleEvent failed: %i\n", ret);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-04-17 17:59:31 +00:00
|
|
|
if (p->old_crtc) {
|
2016-10-04 20:07:19 +00:00
|
|
|
drmModeSetCrtc(p->kms->fd, p->old_crtc->crtc_id,
|
2015-04-17 17:59:31 +00:00
|
|
|
p->old_crtc->buffer_id,
|
2016-10-04 20:07:19 +00:00
|
|
|
p->old_crtc->x, p->old_crtc->y,
|
|
|
|
&p->kms->connector->connector_id, 1,
|
2015-05-28 19:06:53 +00:00
|
|
|
&p->old_crtc->mode);
|
2015-04-17 17:59:31 +00:00
|
|
|
drmModeFreeCrtc(p->old_crtc);
|
2015-04-20 19:30:26 +00:00
|
|
|
p->old_crtc = NULL;
|
2015-04-17 17:59:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-04-19 07:39:58 +00:00
|
|
|
static void release_vt(void *data)
|
|
|
|
{
|
|
|
|
struct vo *vo = data;
|
2015-11-07 12:41:40 +00:00
|
|
|
crtc_release(vo);
|
2015-04-19 07:39:58 +00:00
|
|
|
if (USE_MASTER) {
|
|
|
|
//this function enables support for switching to x, weston etc.
|
|
|
|
//however, for whatever reason, it can be called only by root users.
|
|
|
|
//until things change, this is commented.
|
|
|
|
struct priv *p = vo->priv;
|
2015-11-07 12:41:40 +00:00
|
|
|
if (drmDropMaster(p->kms->fd)) {
|
2015-04-19 07:39:58 +00:00
|
|
|
MP_WARN(vo, "Failed to drop DRM master: %s\n", mp_strerror(errno));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void acquire_vt(void *data)
|
|
|
|
{
|
|
|
|
struct vo *vo = data;
|
|
|
|
if (USE_MASTER) {
|
|
|
|
struct priv *p = vo->priv;
|
2015-11-07 12:41:40 +00:00
|
|
|
if (drmSetMaster(p->kms->fd)) {
|
2015-04-19 07:39:58 +00:00
|
|
|
MP_WARN(vo, "Failed to acquire DRM master: %s\n", mp_strerror(errno));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-07 12:41:40 +00:00
|
|
|
crtc_setup(vo);
|
2015-04-19 07:39:58 +00:00
|
|
|
}
|
|
|
|
|
2016-07-20 18:42:30 +00:00
|
|
|
static void wait_events(struct vo *vo, int64_t until_time_us)
|
2015-04-17 17:59:31 +00:00
|
|
|
{
|
|
|
|
struct priv *p = vo->priv;
|
2015-06-28 14:02:22 +00:00
|
|
|
if (p->vt_switcher_active) {
|
|
|
|
int64_t wait_us = until_time_us - mp_time_us();
|
|
|
|
int timeout_ms = MPCLAMP((wait_us + 500) / 1000, 0, 10000);
|
|
|
|
vt_switcher_poll(&p->vt_switcher, timeout_ms);
|
vo_drm: fallback to vo_wait_default if VT switcher is not available
When the drm video output is used under VT with a terminal multiplexer
like screen, the VT_SETMODE ioctl call will fail since the controlling
terminal is a pseudoterminal instead of a real one, thus the VT switcher
will be unavailable.
The problem is, the wait_events function inside vo_drm.c will test for
this, and will do nothing if the switcher is not active. Normally, this
would not be noticed, however, when you pause a video, or if you're playing
multiple image files, mpv will suddenly start busy waiting on a single
core.
I confirmed this by building mpv with gprof support, in a few seconds,
wait_events got called about 90 million times.
So I added a fallback, when the VT switcher is not availble, just use the
vo_wait_default function. I tested it and it's working well so far.
2017-06-07 13:58:12 +00:00
|
|
|
} else {
|
|
|
|
vo_wait_default(vo, until_time_us);
|
2015-06-28 14:02:22 +00:00
|
|
|
}
|
2015-04-17 17:59:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void wakeup(struct vo *vo)
|
|
|
|
{
|
|
|
|
struct priv *p = vo->priv;
|
2015-06-28 14:02:22 +00:00
|
|
|
if (p->vt_switcher_active)
|
|
|
|
vt_switcher_interrupt_poll(&p->vt_switcher);
|
2015-04-17 17:59:31 +00:00
|
|
|
}
|
|
|
|
|
2015-10-03 16:20:16 +00:00
|
|
|
static int reconfig(struct vo *vo, struct mp_image_params *params)
|
2015-04-15 16:14:14 +00:00
|
|
|
{
|
|
|
|
struct priv *p = vo->priv;
|
|
|
|
|
2016-10-04 20:07:19 +00:00
|
|
|
vo->dwidth = p->screen_w;
|
|
|
|
vo->dheight = p->screen_h;
|
2015-04-15 16:14:14 +00:00
|
|
|
vo_get_src_dst_rects(vo, &p->src, &p->dst, &p->osd);
|
|
|
|
|
2015-05-29 15:49:51 +00:00
|
|
|
int w = p->dst.x1 - p->dst.x0;
|
|
|
|
int h = p->dst.y1 - p->dst.y0;
|
2015-04-15 16:14:14 +00:00
|
|
|
|
|
|
|
p->sws->src = *params;
|
|
|
|
p->sws->dst = (struct mp_image_params) {
|
2018-02-19 18:23:44 +00:00
|
|
|
.imgfmt = p->imgfmt,
|
2015-04-15 16:14:14 +00:00
|
|
|
.w = w,
|
|
|
|
.h = h,
|
2015-12-19 19:04:31 +00:00
|
|
|
.p_w = 1,
|
|
|
|
.p_h = 1,
|
2015-04-15 16:14:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
talloc_free(p->cur_frame);
|
2018-02-19 18:23:44 +00:00
|
|
|
p->cur_frame = mp_image_alloc(p->imgfmt, p->screen_w, p->screen_h);
|
2015-04-15 16:14:14 +00:00
|
|
|
mp_image_params_guess_csp(&p->sws->dst);
|
|
|
|
mp_image_set_params(p->cur_frame, &p->sws->dst);
|
vo_drm: make the osd as large as the screen
Before this commit, the drm vo drew the osd over the scaled image, and
then copied the result onto the framebuffer, shifted. This made the
frame centered, but forced the osd to be only as large as the image.
This was inconsistent with other vo's, covered the image with the
progress indicator even when a black band was at the top of the screen,
made the progress indicator wrap on narrow videos, etc.
The change is to always use an image as large as the screen. The frame
is copied scaled and shifted to it, and the osd drawn over it. The
result is finally copied to the framebuffer without any shift, since it
is already as large as it.
Technically, cur_frame is an image as large as the screen and
cur_frame_cropped is a dummy reference to it, cropped to the size of
the scaled video. This way, copying the scaled image to
cur_frame_cropped positions the image in the right place in cur_frame,
which can then have the osd added to it and copied to the framebuffer.
2018-01-24 13:19:40 +00:00
|
|
|
p->cur_frame[0].w = p->screen_w;
|
|
|
|
p->cur_frame[0].h = p->screen_h;
|
|
|
|
|
|
|
|
talloc_free(p->cur_frame_cropped);
|
|
|
|
p->cur_frame_cropped = mp_image_new_dummy_ref(p->cur_frame);
|
|
|
|
mp_image_crop_rc(p->cur_frame_cropped, p->dst);
|
2015-04-15 16:14:14 +00:00
|
|
|
|
2018-02-08 10:55:22 +00:00
|
|
|
talloc_free(p->last_input);
|
|
|
|
p->last_input = NULL;
|
|
|
|
|
2015-04-15 16:14:14 +00:00
|
|
|
if (mp_sws_reinit(p->sws) < 0)
|
|
|
|
return -1;
|
|
|
|
|
2019-04-11 21:26:06 +00:00
|
|
|
p->vsync_info.vsync_duration = 0;
|
|
|
|
p->vsync_info.skipped_vsyncs = -1;
|
|
|
|
p->vsync_info.last_queue_display_time = -1;
|
|
|
|
|
2015-04-15 16:14:14 +00:00
|
|
|
vo->want_redraw = true;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-04-11 21:26:06 +00:00
|
|
|
static void wait_on_flip(struct vo *vo)
|
2015-04-15 16:14:14 +00:00
|
|
|
{
|
|
|
|
struct priv *p = vo->priv;
|
|
|
|
|
2019-04-11 21:26:06 +00:00
|
|
|
// poll page flip finish event
|
|
|
|
while (p->waiting_for_flip) {
|
|
|
|
const int timeout_ms = 3000;
|
|
|
|
struct pollfd fds[1] = { { .events = POLLIN, .fd = p->kms->fd } };
|
|
|
|
poll(fds, 1, timeout_ms);
|
|
|
|
if (fds[0].revents & POLLIN) {
|
|
|
|
const int ret = drmHandleEvent(p->kms->fd, &p->ev);
|
|
|
|
if (ret != 0) {
|
|
|
|
MP_ERR(vo, "drmHandleEvent failed: %i\n", ret);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct framebuffer *get_new_fb(struct vo *vo)
|
|
|
|
{
|
|
|
|
struct priv *p = vo->priv;
|
|
|
|
|
|
|
|
p->front_buf++;
|
2019-09-28 09:17:48 +00:00
|
|
|
p->front_buf %= p->buf_count;
|
2019-04-11 21:26:06 +00:00
|
|
|
|
|
|
|
return &p->bufs[p->front_buf];
|
|
|
|
}
|
|
|
|
|
|
|
|
static void draw_image(struct vo *vo, mp_image_t *mpi, struct framebuffer *front_buf)
|
|
|
|
{
|
|
|
|
struct priv *p = vo->priv;
|
|
|
|
|
|
|
|
if (p->active && front_buf != NULL) {
|
2015-10-29 11:42:24 +00:00
|
|
|
if (mpi) {
|
|
|
|
struct mp_image src = *mpi;
|
|
|
|
struct mp_rect src_rc = p->src;
|
|
|
|
src_rc.x0 = MP_ALIGN_DOWN(src_rc.x0, mpi->fmt.align_x);
|
|
|
|
src_rc.y0 = MP_ALIGN_DOWN(src_rc.y0, mpi->fmt.align_y);
|
|
|
|
mp_image_crop_rc(&src, src_rc);
|
vo_drm: make the osd as large as the screen
Before this commit, the drm vo drew the osd over the scaled image, and
then copied the result onto the framebuffer, shifted. This made the
frame centered, but forced the osd to be only as large as the image.
This was inconsistent with other vo's, covered the image with the
progress indicator even when a black band was at the top of the screen,
made the progress indicator wrap on narrow videos, etc.
The change is to always use an image as large as the screen. The frame
is copied scaled and shifted to it, and the osd drawn over it. The
result is finally copied to the framebuffer without any shift, since it
is already as large as it.
Technically, cur_frame is an image as large as the screen and
cur_frame_cropped is a dummy reference to it, cropped to the size of
the scaled video. This way, copying the scaled image to
cur_frame_cropped positions the image in the right place in cur_frame,
which can then have the osd added to it and copied to the framebuffer.
2018-01-24 13:19:40 +00:00
|
|
|
|
|
|
|
mp_image_clear(p->cur_frame, 0, 0, p->cur_frame->w, p->dst.y0);
|
|
|
|
mp_image_clear(p->cur_frame, 0, p->dst.y1, p->cur_frame->w, p->cur_frame->h);
|
|
|
|
mp_image_clear(p->cur_frame, 0, p->dst.y0, p->dst.x0, p->dst.y1);
|
|
|
|
mp_image_clear(p->cur_frame, p->dst.x1, p->dst.y0, p->cur_frame->w, p->dst.y1);
|
|
|
|
|
|
|
|
mp_sws_scale(p->sws, p->cur_frame_cropped, &src);
|
2015-10-29 11:42:24 +00:00
|
|
|
osd_draw_on_image(vo->osd, p->osd, src.pts, 0, p->cur_frame);
|
|
|
|
} else {
|
|
|
|
mp_image_clear(p->cur_frame, 0, 0, p->cur_frame->w, p->cur_frame->h);
|
|
|
|
osd_draw_on_image(vo->osd, p->osd, 0, 0, p->cur_frame);
|
|
|
|
}
|
2015-04-17 17:59:31 +00:00
|
|
|
|
2019-12-07 18:17:21 +00:00
|
|
|
if (p->drm_format == DRM_FORMAT_XRGB2101010) {
|
2018-02-19 18:23:44 +00:00
|
|
|
// Pack GBRP10 image into XRGB2101010 for DRM
|
|
|
|
const int w = p->cur_frame->w;
|
|
|
|
const int h = p->cur_frame->h;
|
|
|
|
|
|
|
|
const int g_padding = p->cur_frame->stride[0]/sizeof(uint16_t) - w;
|
|
|
|
const int b_padding = p->cur_frame->stride[1]/sizeof(uint16_t) - w;
|
|
|
|
const int r_padding = p->cur_frame->stride[2]/sizeof(uint16_t) - w;
|
|
|
|
const int fbuf_padding = front_buf->stride/sizeof(uint32_t) - w;
|
|
|
|
|
|
|
|
uint16_t *g_ptr = (uint16_t*)p->cur_frame->planes[0];
|
|
|
|
uint16_t *b_ptr = (uint16_t*)p->cur_frame->planes[1];
|
|
|
|
uint16_t *r_ptr = (uint16_t*)p->cur_frame->planes[2];
|
|
|
|
uint32_t *fbuf_ptr = (uint32_t*)front_buf->map;
|
|
|
|
for (unsigned y = 0; y < h; ++y) {
|
|
|
|
for (unsigned x = 0; x < w; ++x) {
|
|
|
|
*fbuf_ptr++ = (*r_ptr++ << 20) | (*g_ptr++ << 10) | (*b_ptr++);
|
|
|
|
}
|
|
|
|
g_ptr += g_padding;
|
|
|
|
b_ptr += b_padding;
|
|
|
|
r_ptr += r_padding;
|
|
|
|
fbuf_ptr += fbuf_padding;
|
|
|
|
}
|
2019-12-07 18:17:21 +00:00
|
|
|
} else { // p->drm_format == DRM_FORMAT_XRGB8888
|
2018-02-19 18:23:44 +00:00
|
|
|
memcpy_pic(front_buf->map, p->cur_frame->planes[0],
|
|
|
|
p->cur_frame->w * BYTES_PER_PIXEL, p->cur_frame->h,
|
|
|
|
front_buf->stride,
|
|
|
|
p->cur_frame->stride[0]);
|
|
|
|
}
|
2015-04-17 17:59:31 +00:00
|
|
|
}
|
2015-04-15 16:14:14 +00:00
|
|
|
|
|
|
|
if (mpi != p->last_input) {
|
|
|
|
talloc_free(p->last_input);
|
|
|
|
p->last_input = mpi;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-11 21:26:06 +00:00
|
|
|
static void enqueue_frame(struct vo *vo, struct framebuffer *fb)
|
|
|
|
{
|
|
|
|
struct priv *p = vo->priv;
|
|
|
|
|
|
|
|
p->vsync.sbc++;
|
|
|
|
struct kms_frame *new_frame = talloc(p, struct kms_frame);
|
|
|
|
new_frame->fb = fb;
|
|
|
|
new_frame->vsync = p->vsync;
|
|
|
|
MP_TARRAY_APPEND(p, p->fb_queue, p->fb_queue_len, new_frame);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void dequeue_frame(struct vo *vo)
|
2015-04-15 16:14:14 +00:00
|
|
|
{
|
|
|
|
struct priv *p = vo->priv;
|
2019-04-11 21:26:06 +00:00
|
|
|
|
|
|
|
talloc_free(p->fb_queue[0]);
|
|
|
|
MP_TARRAY_REMOVE_AT(p->fb_queue, p->fb_queue_len, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void swapchain_step(struct vo *vo)
|
|
|
|
{
|
|
|
|
struct priv *p = vo->priv;
|
|
|
|
|
|
|
|
if (p->fb_queue_len > 0) {
|
|
|
|
dequeue_frame(vo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void draw_frame(struct vo *vo, struct vo_frame *frame)
|
|
|
|
{
|
|
|
|
struct priv *p = vo->priv;
|
|
|
|
|
|
|
|
if (!p->active)
|
2015-04-21 09:50:44 +00:00
|
|
|
return;
|
2015-04-15 16:14:14 +00:00
|
|
|
|
2019-04-11 21:26:06 +00:00
|
|
|
p->still = frame->still;
|
|
|
|
|
|
|
|
// we redraw the entire image when OSD needs to be redrawn
|
|
|
|
const bool repeat = frame->repeat && !frame->redraw;
|
|
|
|
|
|
|
|
struct framebuffer *fb = &p->bufs[p->front_buf];
|
|
|
|
if (!repeat) {
|
|
|
|
fb = get_new_fb(vo);
|
|
|
|
draw_image(vo, mp_image_new_ref(frame->current), fb);
|
|
|
|
}
|
|
|
|
|
|
|
|
enqueue_frame(vo, fb);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void queue_flip(struct vo *vo, struct kms_frame *frame)
|
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
struct priv *p = vo->priv;
|
|
|
|
|
|
|
|
p->cur_fb = frame->fb;
|
|
|
|
|
|
|
|
// Alloc and fill the data struct for the page flip callback
|
2019-07-29 17:32:29 +00:00
|
|
|
struct drm_pflip_cb_closure *data = talloc(p, struct drm_pflip_cb_closure);
|
|
|
|
data->frame_vsync = &frame->vsync;
|
|
|
|
data->vsync = &p->vsync;
|
|
|
|
data->vsync_info = &p->vsync_info;
|
|
|
|
data->waiting_for_flip = &p->waiting_for_flip;
|
2019-12-07 17:23:42 +00:00
|
|
|
data->log = vo->log;
|
2019-04-11 21:26:06 +00:00
|
|
|
|
|
|
|
ret = drmModePageFlip(p->kms->fd, p->kms->crtc_id,
|
|
|
|
p->cur_fb->fb,
|
|
|
|
DRM_MODE_PAGE_FLIP_EVENT, data);
|
2015-04-15 16:14:14 +00:00
|
|
|
if (ret) {
|
2018-02-24 20:34:32 +00:00
|
|
|
MP_WARN(vo, "Failed to queue page flip: %s\n", mp_strerror(errno));
|
2015-04-15 16:14:14 +00:00
|
|
|
} else {
|
2019-04-11 21:26:06 +00:00
|
|
|
p->waiting_for_flip = true;
|
2015-04-20 16:57:24 +00:00
|
|
|
}
|
2019-04-11 21:26:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void flip_page(struct vo *vo)
|
|
|
|
{
|
|
|
|
struct priv *p = vo->priv;
|
|
|
|
const bool drain = p->paused || p->still;
|
|
|
|
|
|
|
|
if (!p->active)
|
|
|
|
return;
|
|
|
|
|
2019-09-28 09:17:48 +00:00
|
|
|
while (drain || p->fb_queue_len > p->swapchain_depth) {
|
2019-04-11 21:26:06 +00:00
|
|
|
if (p->waiting_for_flip) {
|
|
|
|
wait_on_flip(vo);
|
|
|
|
swapchain_step(vo);
|
2015-04-20 16:57:24 +00:00
|
|
|
}
|
2019-04-11 21:26:06 +00:00
|
|
|
if (p->fb_queue_len <= 1)
|
|
|
|
break;
|
|
|
|
if (!p->fb_queue[1] || !p->fb_queue[1]->fb) {
|
|
|
|
MP_ERR(vo, "Hole in swapchain?\n");
|
|
|
|
swapchain_step(vo);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
queue_flip(vo, p->fb_queue[1]);
|
2015-04-15 16:14:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-04-17 17:59:31 +00:00
|
|
|
static void uninit(struct vo *vo)
|
|
|
|
{
|
|
|
|
struct priv *p = vo->priv;
|
|
|
|
|
2015-11-07 12:41:40 +00:00
|
|
|
crtc_release(vo);
|
|
|
|
|
2019-04-11 21:26:06 +00:00
|
|
|
while (p->fb_queue_len > 0) {
|
|
|
|
swapchain_step(vo);
|
|
|
|
}
|
|
|
|
|
2015-11-07 12:41:40 +00:00
|
|
|
if (p->kms) {
|
2019-09-28 09:17:48 +00:00
|
|
|
for (unsigned int i = 0; i < p->buf_count; i++)
|
2016-10-06 18:01:31 +00:00
|
|
|
fb_destroy(p->kms->fd, &p->bufs[i]);
|
2015-11-07 12:41:40 +00:00
|
|
|
kms_destroy(p->kms);
|
|
|
|
p->kms = NULL;
|
2015-04-17 17:59:31 +00:00
|
|
|
}
|
|
|
|
|
2015-06-28 14:02:22 +00:00
|
|
|
if (p->vt_switcher_active)
|
|
|
|
vt_switcher_destroy(&p->vt_switcher);
|
|
|
|
|
2015-04-17 17:59:31 +00:00
|
|
|
talloc_free(p->last_input);
|
|
|
|
talloc_free(p->cur_frame);
|
vo_drm: make the osd as large as the screen
Before this commit, the drm vo drew the osd over the scaled image, and
then copied the result onto the framebuffer, shifted. This made the
frame centered, but forced the osd to be only as large as the image.
This was inconsistent with other vo's, covered the image with the
progress indicator even when a black band was at the top of the screen,
made the progress indicator wrap on narrow videos, etc.
The change is to always use an image as large as the screen. The frame
is copied scaled and shifted to it, and the osd drawn over it. The
result is finally copied to the framebuffer without any shift, since it
is already as large as it.
Technically, cur_frame is an image as large as the screen and
cur_frame_cropped is a dummy reference to it, cropped to the size of
the scaled video. This way, copying the scaled image to
cur_frame_cropped positions the image in the right place in cur_frame,
which can then have the osd added to it and copied to the framebuffer.
2018-01-24 13:19:40 +00:00
|
|
|
talloc_free(p->cur_frame_cropped);
|
2015-04-17 17:59:31 +00:00
|
|
|
}
|
|
|
|
|
2015-04-15 16:14:14 +00:00
|
|
|
static int preinit(struct vo *vo)
|
|
|
|
{
|
|
|
|
struct priv *p = vo->priv;
|
|
|
|
p->sws = mp_sws_alloc(vo);
|
2019-10-31 14:18:57 +00:00
|
|
|
p->sws->log = vo->log;
|
|
|
|
mp_sws_enable_cmdline_opts(p->sws, vo->global);
|
2015-04-20 16:57:24 +00:00
|
|
|
p->ev.version = DRM_EVENT_CONTEXT_VERSION;
|
2019-07-29 17:32:29 +00:00
|
|
|
p->ev.page_flip_handler = &drm_pflip_cb;
|
2015-04-15 16:14:14 +00:00
|
|
|
|
2015-11-07 20:11:04 +00:00
|
|
|
p->vt_switcher_active = vt_switcher_init(&p->vt_switcher, vo->log);
|
2015-06-28 14:02:22 +00:00
|
|
|
if (p->vt_switcher_active) {
|
|
|
|
vt_switcher_acquire(&p->vt_switcher, acquire_vt, vo);
|
|
|
|
vt_switcher_release(&p->vt_switcher, release_vt, vo);
|
|
|
|
} else {
|
|
|
|
MP_WARN(vo, "Failed to set up VT switcher. Terminal switching will be unavailable.\n");
|
|
|
|
}
|
2015-04-19 07:39:58 +00:00
|
|
|
|
2018-06-28 13:23:19 +00:00
|
|
|
p->kms = kms_create(vo->log,
|
|
|
|
vo->opts->drm_opts->drm_connector_spec,
|
2018-06-02 10:53:58 +00:00
|
|
|
vo->opts->drm_opts->drm_mode_spec,
|
2018-06-28 13:23:19 +00:00
|
|
|
0, 0, false);
|
2015-11-07 12:41:40 +00:00
|
|
|
if (!p->kms) {
|
|
|
|
MP_ERR(vo, "Failed to create KMS.\n");
|
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
|
2018-02-19 18:23:44 +00:00
|
|
|
if (vo->opts->drm_opts->drm_format == DRM_OPTS_FORMAT_XRGB2101010) {
|
2019-12-07 18:17:21 +00:00
|
|
|
p->drm_format = DRM_FORMAT_XRGB2101010;
|
2018-02-19 18:23:44 +00:00
|
|
|
p->imgfmt = IMGFMT_XRGB2101010;
|
|
|
|
} else {
|
2019-12-07 18:17:21 +00:00
|
|
|
p->drm_format = DRM_FORMAT_XRGB8888;;
|
2018-02-19 18:23:44 +00:00
|
|
|
p->imgfmt = IMGFMT_XRGB8888;
|
|
|
|
}
|
|
|
|
|
2019-09-28 09:17:48 +00:00
|
|
|
p->swapchain_depth = vo->opts->swapchain_depth;
|
|
|
|
p->buf_count = p->swapchain_depth + 1;
|
2019-04-11 21:26:06 +00:00
|
|
|
if (!fb_setup_buffers(vo)) {
|
|
|
|
MP_ERR(vo, "Failed to set up buffers.\n");
|
2015-04-17 17:59:31 +00:00
|
|
|
goto err;
|
2015-11-07 12:41:40 +00:00
|
|
|
}
|
2015-04-15 16:14:14 +00:00
|
|
|
|
2019-12-06 15:28:03 +00:00
|
|
|
uint64_t has_dumb = 0;
|
|
|
|
if (drmGetCap(p->kms->fd, DRM_CAP_DUMB_BUFFER, &has_dumb) < 0
|
|
|
|
|| has_dumb == 0) {
|
2016-10-04 20:07:19 +00:00
|
|
|
MP_ERR(vo, "Card \"%d\" does not support dumb buffers.\n",
|
|
|
|
p->kms->card_no);
|
2015-04-17 17:59:31 +00:00
|
|
|
goto err;
|
2015-11-07 12:41:40 +00:00
|
|
|
}
|
2015-04-15 16:14:14 +00:00
|
|
|
|
2016-10-04 20:07:19 +00:00
|
|
|
p->screen_w = p->bufs[0].width;
|
|
|
|
p->screen_h = p->bufs[0].height;
|
2015-04-15 16:14:14 +00:00
|
|
|
|
2015-11-07 20:11:04 +00:00
|
|
|
if (!crtc_setup(vo)) {
|
2016-10-04 20:07:19 +00:00
|
|
|
MP_ERR(vo, "Cannot set CRTC: %s\n", mp_strerror(errno));
|
2015-04-17 17:59:31 +00:00
|
|
|
goto err;
|
2015-04-15 16:14:14 +00:00
|
|
|
}
|
|
|
|
|
drm_vo: pixel aspect from --monitoraspect
When pixels are non-square, the appropriate value of vo->monitor_par is
necessary to determine the destination rectangle, which in turn tells
how to scale the video along the x and y axis. Before this commit, the
drm driver only used --monitorpixelaspect. For example, to play a video
with the right aspect on a 4:3 screen and 640:400 pixels,
--monitorpixelaspect=5:6 had to be given.
With this commit, vo->monitor_par is determined from the size of the
screen in pixels and the --monitoraspect parameter. The latter is
usually easier to determine than --monitorpixelaspect, since it is
simply the proportion between the width and the height of the screen,
in most cases 16:9 or 4:3. If --monitoraspect is not given,
--monitorpixelaspect is used if given, otherwise pixel aspect is
assumed 1:1.
2018-02-15 12:33:19 +00:00
|
|
|
if (vo->opts->force_monitor_aspect != 0.0) {
|
|
|
|
vo->monitor_par = p->screen_w / (double) p->screen_h /
|
|
|
|
vo->opts->force_monitor_aspect;
|
|
|
|
} else {
|
|
|
|
vo->monitor_par = 1 / vo->opts->monitor_pixel_aspect;
|
|
|
|
}
|
|
|
|
mp_verbose(vo->log, "Monitor pixel aspect: %g\n", vo->monitor_par);
|
2018-02-09 11:14:30 +00:00
|
|
|
|
2019-04-11 21:26:06 +00:00
|
|
|
p->vsync_info.vsync_duration = 0;
|
|
|
|
p->vsync_info.skipped_vsyncs = -1;
|
|
|
|
p->vsync_info.last_queue_display_time = -1;
|
|
|
|
|
2015-04-15 16:14:14 +00:00
|
|
|
return 0;
|
|
|
|
|
2015-04-17 17:59:31 +00:00
|
|
|
err:
|
|
|
|
uninit(vo);
|
|
|
|
return -1;
|
2015-04-15 16:14:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int query_format(struct vo *vo, int format)
|
|
|
|
{
|
|
|
|
return sws_isSupportedInput(imgfmt2pixfmt(format));
|
|
|
|
}
|
|
|
|
|
2016-09-24 12:59:31 +00:00
|
|
|
static int control(struct vo *vo, uint32_t request, void *arg)
|
2015-04-15 16:14:14 +00:00
|
|
|
{
|
|
|
|
struct priv *p = vo->priv;
|
|
|
|
switch (request) {
|
2015-04-26 15:30:49 +00:00
|
|
|
case VOCTRL_SCREENSHOT_WIN:
|
2016-09-24 12:59:31 +00:00
|
|
|
*(struct mp_image**)arg = mp_image_new_copy(p->cur_frame);
|
2015-04-26 15:30:49 +00:00
|
|
|
return VO_TRUE;
|
2015-05-08 20:37:45 +00:00
|
|
|
case VOCTRL_SET_PANSCAN:
|
|
|
|
if (vo->config_ok)
|
2015-10-03 16:20:16 +00:00
|
|
|
reconfig(vo, vo->params);
|
2015-05-08 20:37:45 +00:00
|
|
|
return VO_TRUE;
|
2016-09-24 12:59:31 +00:00
|
|
|
case VOCTRL_GET_DISPLAY_FPS: {
|
2016-10-03 21:56:35 +00:00
|
|
|
double fps = kms_get_display_fps(p->kms);
|
2016-09-24 12:59:31 +00:00
|
|
|
if (fps <= 0)
|
|
|
|
break;
|
|
|
|
*(double*)arg = fps;
|
|
|
|
return VO_TRUE;
|
|
|
|
}
|
2019-04-11 21:26:06 +00:00
|
|
|
case VOCTRL_PAUSE:
|
|
|
|
vo->want_redraw = true;
|
|
|
|
p->paused = true;
|
|
|
|
return VO_TRUE;
|
|
|
|
case VOCTRL_RESUME:
|
|
|
|
p->paused = false;
|
|
|
|
p->vsync_info.last_queue_display_time = -1;
|
|
|
|
p->vsync_info.skipped_vsyncs = 0;
|
|
|
|
p->vsync.ust = 0;
|
|
|
|
p->vsync.msc = 0;
|
|
|
|
return VO_TRUE;
|
2015-04-15 16:14:14 +00:00
|
|
|
}
|
|
|
|
return VO_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define OPT_BASE_STRUCT struct priv
|
|
|
|
|
|
|
|
const struct vo_driver video_out_drm = {
|
|
|
|
.name = "drm",
|
2020-02-11 20:45:16 +00:00
|
|
|
.description = "Direct Rendering Manager (software scaling)",
|
2015-04-15 16:14:14 +00:00
|
|
|
.preinit = preinit,
|
|
|
|
.query_format = query_format,
|
|
|
|
.reconfig = reconfig,
|
|
|
|
.control = control,
|
2019-04-11 21:26:06 +00:00
|
|
|
.draw_frame = draw_frame,
|
2015-04-15 16:14:14 +00:00
|
|
|
.flip_page = flip_page,
|
2019-04-11 21:26:06 +00:00
|
|
|
.get_vsync = get_vsync,
|
2015-04-15 16:14:14 +00:00
|
|
|
.uninit = uninit,
|
2015-04-17 17:59:31 +00:00
|
|
|
.wait_events = wait_events,
|
|
|
|
.wakeup = wakeup,
|
2015-04-15 16:14:14 +00:00
|
|
|
.priv_size = sizeof(struct priv),
|
|
|
|
};
|