return r;
}
-uint32_t drmModeGetHotplug(int fd)
-{
- struct drm_mode_hotplug arg;
- arg.counter = 0;
-
- ioctl(fd, DRM_IOCTL_MODE_HOTPLUG, &arg);
- return arg.counter;
-}
-
int drmModeAddFB(int fd, uint32_t width, uint32_t height, uint8_t depth,
uint8_t bpp, uint32_t pitch, uint32_t bo_handle,
uint32_t *buf_id)
*/
extern drmModeResPtr drmModeGetResources(int fd);
-/**
- * Retrives the hotplug counter
- */
-extern uint32_t drmModeGetHotplug(int fd);
-
/*
* FrameBuffer manipulation.
*/
}
EXPORT_SYMBOL(drm_mode_config_cleanup);
-int drm_mode_hotplug_ioctl(struct drm_device *dev,
- void *data, struct drm_file *file_priv)
-{
- struct drm_mode_hotplug *arg = data;
-
- arg->counter = dev->mode_config.hotplug_counter;
-
- return 0;
-}
-
/**
* drm_crtc_convert_to_umode - convert a drm_display_mode into a modeinfo
* @out: drm_mode_modeinfo struct to return to the user
DRM_IOCTL_DEF(DRM_IOCTL_MODE_ATTACHMODE, drm_mode_attachmode_ioctl, DRM_MASTER|DRM_CONTROL_ALLOW),
DRM_IOCTL_DEF(DRM_IOCTL_MODE_DETACHMODE, drm_mode_detachmode_ioctl, DRM_MASTER|DRM_CONTROL_ALLOW),
DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETPROPERTY, drm_mode_getproperty_ioctl, DRM_MASTER | DRM_CONTROL_ALLOW),
- DRM_IOCTL_DEF(DRM_IOCTL_MODE_HOTPLUG, drm_mode_hotplug_ioctl, DRM_CONTROL_ALLOW),
- DRM_IOCTL_DEF(DRM_IOCTL_WAIT_HOTPLUG, drm_wait_hotplug, 0),
DRM_IOCTL_DEF(DRM_IOCTL_MODE_REPLACEFB, drm_mode_replacefb, DRM_MASTER|DRM_ROOT_ONLY|DRM_CONTROL_ALLOW),
DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETENCODER, drm_mode_getencoder, DRM_MASTER|DRM_CONTROL_ALLOW),
}
EXPORT_SYMBOL(drm_vblank_init);
-int drm_wait_hotplug(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
- union drm_wait_hotplug *hotplugwait = data;
- struct timeval now;
- int ret = 0;
- unsigned int flags;
-
- if ((!dev->irq) || (!dev->irq_enabled))
- return -EINVAL;
-
- flags = hotplugwait->request.type;
-
- if (flags & _DRM_HOTPLUG_SIGNAL) {
- unsigned long irqflags;
- struct list_head *hotplug_sigs = dev->hotplug_sigs;
- struct drm_hotplug_sig *hotplug_sig;
-
- hotplug_sig = drm_calloc(1, sizeof(struct drm_hotplug_sig),
- DRM_MEM_DRIVER);
- if (!hotplug_sig)
- return -ENOMEM;
-
- atomic_inc(&dev->hotplug_signal_pending);
-
- hotplug_sig->info.si_signo = hotplugwait->request.signal;
- hotplug_sig->task = current;
- hotplug_sig->counter =
- hotplugwait->reply.counter =
- dev->mode_config.hotplug_counter;
-
- spin_lock_irqsave(&dev->hotplug_lock, irqflags);
-
- list_add_tail(&hotplug_sig->head, hotplug_sigs);
-
- spin_unlock_irqrestore(&dev->hotplug_lock, irqflags);
- } else {
- int cur_hotplug = dev->mode_config.hotplug_counter;
-
- DRM_WAIT_ON(ret, dev->hotplug_queue, 3 * DRM_HZ,
- dev->mode_config.hotplug_counter > cur_hotplug);
-
- do_gettimeofday(&now);
-
- hotplugwait->reply.tval_sec = now.tv_sec;
- hotplugwait->reply.tval_usec = now.tv_usec;
- hotplugwait->reply.counter = dev->mode_config.hotplug_counter;
- }
-
- return ret;
-}
-
static void drm_hotplug_cleanup(struct drm_device *dev)
{
if (dev->hotplug_sigs)
struct drm_wait_vblank_reply reply;
};
-/* Handle monitor hotplug.
- *
- * May want to extend this later to pass reply information which
- * details the connectors which generated the hotplug event.
- * Some chipsets can't determine that though, and we'd need to leave
- * it to the higher levels to determine exactly what changed.
- */
-enum drm_hotplug_seq_type {
- _DRM_HOTPLUG_SIGNAL = 0x00000001, /**< Send signal instead of blocking */
-};
-struct drm_wait_hotplug_request {
- enum drm_hotplug_seq_type type;
- unsigned long signal;
-};
-
-struct drm_wait_hotplug_reply {
- enum drm_hotplug_seq_type type;
- unsigned int counter;
- long tval_sec;
- long tval_usec;
-};
-
-/**
- * DRM_IOCTL_WAIT_HOTPLUG ioctl argument type.
- *
- * \sa drmWaitHotplug().
- */
-union drm_wait_hotplug {
- struct drm_wait_hotplug_request request;
- struct drm_wait_hotplug_reply reply;
-};
enum drm_modeset_ctl_cmd {
_DRM_PRE_MODESET = 1,
#define DRM_IOCTL_MODE_GETPROPERTY DRM_IOWR(0xAB, struct drm_mode_get_property)
#define DRM_IOCTL_MODE_CURSOR DRM_IOWR(0xAC, struct drm_mode_cursor)
-#define DRM_IOCTL_MODE_HOTPLUG DRM_IOWR(0xAD, struct drm_mode_hotplug)
-#define DRM_IOCTL_WAIT_HOTPLUG DRM_IOWR(0xAE, union drm_wait_hotplug)
#define DRM_IOCTL_MODE_REPLACEFB DRM_IOWR(0xAF, struct drm_mode_fb_cmd)
#define DRM_IOCTL_MODE_GETENCODER DRM_IOWR(0xB0, struct drm_mode_get_encoder)
uint32_t handle;
};
-/*
- * oh so ugly hotplug
- */
-struct drm_mode_hotplug {
- uint32_t counter;
-};
-
struct drm_mode_crtc_lut {
uint32_t crtc_id;
uint32_t gamma_size;