summaryrefslogtreecommitdiff
path: root/kms++/src/videomode.cpp
blob: 16330bb700dfb5e2c484b79d4dc5d9d2d82dba40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <xf86drm.h>
#include <xf86drmMode.h>

#include <kms++/kms++.h>
#include "helpers.h"

using namespace std;

namespace kms
{

unique_ptr<Blob> Videomode::to_blob(Card& card) const
{
	drmModeModeInfo drm_mode = video_mode_to_drm_mode(*this);

	return unique_ptr<Blob>(new Blob(card, &drm_mode, sizeof(drm_mode)));
}

bool Videomode::interlace() const
{
	return flags & DRM_MODE_FLAG_INTERLACE;
}

float Videomode::calculated_vrefresh() const
{
	return (clock * 1000.0) / (htotal * vtotal) * (interlace() ? 2 : 1);
}

}