xf86drmMode.h revision 7a0d67332f33bc21290d63bc7c8150b0cf0a4b21
/*
* \file xf86drmMode.h
* Header for DRM modesetting interface.
*
* \author Jakob Bornecrantz <wallbraker@gmail.com>
*
* \par Acknowledgements:
* Feb 2007, Dave Airlie <airlied@linux.ie>
*/
/*
* Copyright (c) 2007-2008 Tungsten Graphics, Inc., Cedar Park, Texas.
* Copyright (c) 2007-2008 Dave Airlie <airlied@linux.ie>
* Copyright (c) 2007-2008 Jakob Bornecrantz <wallbraker@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*
*/
#include <drm.h>
/*
* This is the interface for modesetting for drm.
*
* In order to use this interface you must include either <stdint.h> or another
* header defining uint32_t, int32_t and uint16_t.
*
* It aims to provide a randr1.2 compatible interface for modesettings in the
* kernel, the interface is also ment to be used by libraries like EGL.
*
* More information can be found in randrproto.txt which can be found here:
*
* There are some major diffrences to be noted. Unlike the randr1.2 proto you
* need to create the memory object of the framebuffer yourself with the ttm
* buffer object interface. This object needs to be pinned.
*/
/*
* If we pickup an old version of drm.h which doesn't include drm_mode.h
* we should redefine defines. This is so that builds doesn't breaks with
* new libdrm on old kernels.
*/
#ifndef _DRM_MODE_H
#define DRM_DISPLAY_INFO_LEN 32
#define DRM_CONNECTOR_NAME_LEN 32
#define DRM_DISPLAY_MODE_LEN 32
#define DRM_PROP_NAME_LEN 32
#define DRM_MODE_TYPE_BUILTIN (1<<0)
/* Video mode flags */
/* bit compatible with the xorg definitions. */
#define DRM_MODE_FLAG_PHSYNC (1<<0)
/* DPMS flags */
/* bit compatible with the xorg definitions. */
#define DRM_MODE_DPMS_ON 0
#define DRM_MODE_DPMS_STANDBY 1
#define DRM_MODE_DPMS_SUSPEND 2
#define DRM_MODE_DPMS_OFF 3
/* Scaling mode options */
#define DRM_MODE_SCALE_NON_GPU 0
#define DRM_MODE_SCALE_FULLSCREEN 1
#define DRM_MODE_SCALE_NO_SCALE 2
#define DRM_MODE_SCALE_ASPECT 3
/* Dithering mode options */
#define DRM_MODE_DITHERING_OFF 0
#define DRM_MODE_DITHERING_ON 1
#define DRM_MODE_ENCODER_NONE 0
#define DRM_MODE_ENCODER_DAC 1
#define DRM_MODE_ENCODER_TMDS 2
#define DRM_MODE_ENCODER_LVDS 3
#define DRM_MODE_ENCODER_TVDAC 4
#define DRM_MODE_SUBCONNECTOR_Automatic 0
#define DRM_MODE_SUBCONNECTOR_Unknown 0
#define DRM_MODE_SUBCONNECTOR_DVID 3
#define DRM_MODE_SUBCONNECTOR_DVIA 4
#define DRM_MODE_SUBCONNECTOR_Composite 5
#define DRM_MODE_SUBCONNECTOR_SVIDEO 6
#define DRM_MODE_SUBCONNECTOR_Component 8
#define DRM_MODE_CONNECTOR_Unknown 0
#define DRM_MODE_CONNECTOR_VGA 1
#define DRM_MODE_CONNECTOR_DVII 2
#define DRM_MODE_CONNECTOR_DVID 3
#define DRM_MODE_CONNECTOR_DVIA 4
#define DRM_MODE_CONNECTOR_Composite 5
#define DRM_MODE_CONNECTOR_SVIDEO 6
#define DRM_MODE_CONNECTOR_LVDS 7
#define DRM_MODE_CONNECTOR_Component 8
#define DRM_MODE_CONNECTOR_9PinDIN 9
#define DRM_MODE_CONNECTOR_DisplayPort 10
#define DRM_MODE_CONNECTOR_HDMIA 11
#define DRM_MODE_CONNECTOR_HDMIB 12
#define DRM_MODE_PROP_PENDING (1<<0)
#define DRM_MODE_CURSOR_BO (1<<0)
#endif /* _DRM_MODE_H */
typedef struct _drmModeRes {
int count_fbs;
int count_crtcs;
int count_connectors;
int count_encoders;
} drmModeRes, *drmModeResPtr;
typedef struct _drmModeModeInfo {
char name[DRM_DISPLAY_MODE_LEN];
typedef struct _drmModeFB {
/* driver specific handle */
} drmModeFB, *drmModeFBPtr;
typedef struct _drmModePropertyBlob {
void *data;
typedef struct _drmModeProperty {
char name[DRM_PROP_NAME_LEN];
int count_values;
int count_enums;
struct drm_mode_property_enum *enums;
int count_blobs;
typedef struct _drmModeCrtc {
uint32_t x, y; /**< Position on the framebuffer */
int mode_valid;
int gamma_size; /**< Number of gamma stops */
typedef struct _drmModeEncoder {
typedef enum {
DRM_MODE_CONNECTED = 1,
typedef enum {
typedef struct _drmModeConnector {
int count_modes;
int count_props;
int count_encoders;
/**
* Retrives all of the resources associated with a card.
*/
/*
* FrameBuffer manipulation.
*/
/**
* Retrive information about framebuffer bufferId
*/
/**
* Creates a new framebuffer with an buffer object as its scanout buffer.
*/
/**
* Destroies the given framebuffer.
*/
/*
* Crtc functions
*/
/**
* Retrive information about the ctrt crtcId
*/
/**
* Set the mode on a crtc crtcId with the given mode modeId.
*/
/*
* Cursor functions
*/
/**
* Set the cursor on crtc
*/
/**
* Move the cursor on crtc
*/
/**
* Encoder functions
*/
/*
* Connector manipulation
*/
/**
* Retrive information about the connector connectorId.
*/
/**
* Attaches the given mode to an connector.
*/
/**
* Detaches a mode from the connector
* must be unused, by the given mode.
*/
extern int drmCheckModesettingSupported(const char *busid);