summaryrefslogtreecommitdiff
path: root/bsd-core/r128/Makefile
AgeCommit message (Expand)Author
2005-04-26Convert NOMAN to the new preferred spelling NO_MAN to quiet warnings.Eric Anholt
2002-10-30Kernel support for vblank syncing on Rage 128 and Matrox.Eric Anholt
2002-08-30Remove some extra symlinking for kernel module building that hasn't beenEric Anholt
2002-07-05merged bsd-3-0-0-branchAlan Hourihane
2002-01-27Import of XFree86 4.2.0David Dawes
/a> 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72

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

#define CPY(field) dst.field = src.field

namespace kms
{
Videomode drm_mode_to_video_mode(const drmModeModeInfo& drmmode)
{
	Videomode mode = { };

	auto& src = drmmode;
	auto& dst = mode;

	CPY(clock);

	CPY(hdisplay);
	CPY(hsync_start);
	CPY(hsync_end);
	CPY(htotal);
	CPY(hskew);

	CPY(vdisplay);
	CPY(vsync_start);
	CPY(vsync_end);
	CPY(vtotal);
	CPY(vscan);

	CPY(vrefresh);

	CPY(flags);
	CPY(type);

	mode.name = drmmode.name;

	return mode;
}

drmModeModeInfo video_mode_to_drm_mode(const Videomode& mode)
{
	drmModeModeInfo drmmode = { };

	auto& src = mode;
	auto& dst = drmmode;

	CPY(clock);

	CPY(hdisplay);
	CPY(hsync_start);
	CPY(hsync_end);
	CPY(htotal);
	CPY(hskew);

	CPY(vdisplay);
	CPY(vsync_start);
	CPY(vsync_end);
	CPY(vtotal);
	CPY(vscan);

	CPY(vrefresh);

	CPY(flags);
	CPY(type);

	strncpy(drmmode.name, mode.name.c_str(), sizeof(drmmode.name));
	drmmode.name[sizeof(drmmode.name) - 1] = 0;

	return drmmode;
}
}