From: <wal...@ke...> - 2008-11-12 18:18:20
|
libdrm/xf86drmMode.c | 17 ++--------- libdrm/xf86drmMode.h | 27 +++++++----------- linux-core/drm_crtc.c | 16 ++--------- linux-core/drm_drv.c | 2 - linux-core/drm_irq.c | 52 ------------------------------------ shared-core/drm.h | 70 +++++++++++++------------------------------------ shared-core/drm_mode.h | 47 ++++++++++++++------------------ 7 files changed, 57 insertions(+), 174 deletions(-) New commits: commit 9a4cb7eab4f74747cc777a3fef31dbb46e1191e5 Author: Jakob Bornecrantz <ja...@tu...> Date: Wed Nov 12 19:17:18 2008 +0100 mode: Minor reodering and renaming diff --git a/libdrm/xf86drmMode.c b/libdrm/xf86drmMode.c index 38fdbc1..a0a164d 100644 --- a/libdrm/xf86drmMode.c +++ b/libdrm/xf86drmMode.c @@ -200,7 +200,7 @@ int drmModeAddFB(int fd, uint32_t width, uint32_t height, uint8_t depth, if ((ret = ioctl(fd, DRM_IOCTL_MODE_ADDFB, &f))) return ret; - *buf_id = f.buffer_id; + *buf_id = f.fb_id; return 0; } @@ -216,7 +216,7 @@ drmModeFBPtr drmModeGetFB(int fd, uint32_t buf) struct drm_mode_fb_cmd info; drmModeFBPtr r; - info.buffer_id = buf; + info.fb_id = buf; if (ioctl(fd, DRM_IOCTL_MODE_GETFB, &info)) return NULL; @@ -224,7 +224,7 @@ drmModeFBPtr drmModeGetFB(int fd, uint32_t buf) if (!(r = drmMalloc(sizeof(*r)))) return NULL; - r->buffer_id = info.buffer_id; + r->fb_id = info.fb_id; r->width = info.width; r->height = info.height; r->pitch = info.pitch; @@ -639,7 +639,7 @@ int drmModeReplaceFB(int fd, uint32_t buffer_id, f.bpp = bpp; f.depth = depth; f.handle = bo_handle; - f.buffer_id = buffer_id; + f.fb_id = buffer_id; if ((ret = ioctl(fd, DRM_IOCTL_MODE_REPLACEFB, &f))) return ret; diff --git a/linux-core/drm_crtc.c b/linux-core/drm_crtc.c index 255cc8c..aa0c4a9 100644 --- a/linux-core/drm_crtc.c +++ b/linux-core/drm_crtc.c @@ -1517,7 +1517,7 @@ int drm_mode_addfb(struct drm_device *dev, goto out; } - r->buffer_id = fb->base.id; + r->fb_id = fb->base.id; list_add(&fb->filp_head, &file_priv->fbs); out: @@ -1609,7 +1609,7 @@ int drm_mode_getfb(struct drm_device *dev, int ret = 0; mutex_lock(&dev->mode_config.mutex); - obj = drm_mode_object_find(dev, r->buffer_id, DRM_MODE_OBJECT_FB); + obj = drm_mode_object_find(dev, r->fb_id, DRM_MODE_OBJECT_FB); if (!obj) { DRM_ERROR("invalid framebuffer id\n"); ret = -EINVAL; @@ -2212,7 +2212,7 @@ int drm_mode_replacefb(struct drm_device *dev, /* right replace the current bo attached to this fb with a new bo */ mutex_lock(&dev->mode_config.mutex); - obj = drm_mode_object_find(dev, r->buffer_id, DRM_MODE_OBJECT_FB); + obj = drm_mode_object_find(dev, r->fb_id, DRM_MODE_OBJECT_FB); if (!obj) { ret = -EINVAL; goto out; diff --git a/shared-core/drm_mode.h b/shared-core/drm_mode.h index 6b1abd5..601d2bd 100644 --- a/shared-core/drm_mode.h +++ b/shared-core/drm_mode.h @@ -126,8 +126,8 @@ struct drm_mode_crtc { #define DRM_MODE_ENCODER_TVDAC 4 struct drm_mode_get_encoder { - uint32_t encoder_type; uint32_t encoder_id; + uint32_t encoder_type; uint32_t crtc_id; /**< Id of crtc */ @@ -216,13 +216,13 @@ struct drm_mode_get_blob { }; struct drm_mode_fb_cmd { - uint32_t buffer_id; + uint32_t fb_id; uint32_t width, height; uint32_t pitch; uint32_t bpp; - uint32_t handle; uint32_t depth; - + /* driver specific handle */ + uint32_t handle; }; struct drm_mode_mode_cmd { commit 17789a409d3e83cad9f5cf06c2bb7123b78746b2 Author: Jakob Bornecrantz <ja...@tu...> Date: Wed Nov 12 19:10:50 2008 +0100 mode: Reorder the ioctls and numbering This is to fill in the gaps left by the removal of the hotplug ioctls. And they also look better :) diff --git a/shared-core/drm.h b/shared-core/drm.h index cc6aead..7419ad6 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -747,25 +747,26 @@ struct drm_gem_open { #define DRM_IOCTL_UPDATE_DRAW DRM_IOW(0x3f, struct drm_update_draw) #define DRM_IOCTL_MODE_GETRESOURCES DRM_IOWR(0xA0, struct drm_mode_card_res) + #define DRM_IOCTL_MODE_GETCRTC DRM_IOWR(0xA1, struct drm_mode_crtc) -#define DRM_IOCTL_MODE_GETCONNECTOR DRM_IOWR(0xA2, struct drm_mode_get_connector) -#define DRM_IOCTL_MODE_SETCRTC DRM_IOWR(0xA3, struct drm_mode_crtc) -#define DRM_IOCTL_MODE_ADDFB DRM_IOWR(0xA4, struct drm_mode_fb_cmd) -#define DRM_IOCTL_MODE_RMFB DRM_IOWR(0xA5, unsigned int) -#define DRM_IOCTL_MODE_GETFB DRM_IOWR(0xA6, struct drm_mode_fb_cmd) - -#define DRM_IOCTL_MODE_SETPROPERTY DRM_IOWR(0xA7, struct drm_mode_connector_set_property) -#define DRM_IOCTL_MODE_GETPROPBLOB DRM_IOWR(0xA8, struct drm_mode_get_blob) -#define DRM_IOCTL_MODE_ATTACHMODE DRM_IOWR(0xA9, struct drm_mode_mode_cmd) -#define DRM_IOCTL_MODE_DETACHMODE DRM_IOWR(0xAA, struct drm_mode_mode_cmd) - -#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_REPLACEFB DRM_IOWR(0xAF, struct drm_mode_fb_cmd) -#define DRM_IOCTL_MODE_GETENCODER DRM_IOWR(0xB0, struct drm_mode_get_encoder) -#define DRM_IOCTL_MODE_GETGAMMA DRM_IOWR(0xB1, struct drm_mode_crtc_lut) -#define DRM_IOCTL_MODE_SETGAMMA DRM_IOWR(0xB2, struct drm_mode_crtc_lut) +#define DRM_IOCTL_MODE_SETCRTC DRM_IOWR(0xA2, struct drm_mode_crtc) +#define DRM_IOCTL_MODE_CURSOR DRM_IOWR(0xA3, struct drm_mode_cursor) +#define DRM_IOCTL_MODE_GETGAMMA DRM_IOWR(0xA4, struct drm_mode_crtc_lut) +#define DRM_IOCTL_MODE_SETGAMMA DRM_IOWR(0xA5, struct drm_mode_crtc_lut) + +#define DRM_IOCTL_MODE_GETENCODER DRM_IOWR(0xA6, struct drm_mode_get_encoder) + +#define DRM_IOCTL_MODE_GETCONNECTOR DRM_IOWR(0xA7, struct drm_mode_get_connector) +#define DRM_IOCTL_MODE_ATTACHMODE DRM_IOWR(0xA8, struct drm_mode_mode_cmd) +#define DRM_IOCTL_MODE_DETACHMODE DRM_IOWR(0xA9, struct drm_mode_mode_cmd) +#define DRM_IOCTL_MODE_GETPROPERTY DRM_IOWR(0xAA, struct drm_mode_get_property) +#define DRM_IOCTL_MODE_SETPROPERTY DRM_IOWR(0xAB, struct drm_mode_connector_set_property) +#define DRM_IOCTL_MODE_GETPROPBLOB DRM_IOWR(0xAC, struct drm_mode_get_blob) + +#define DRM_IOCTL_MODE_GETFB DRM_IOWR(0xAD, struct drm_mode_fb_cmd) +#define DRM_IOCTL_MODE_ADDFB DRM_IOWR(0xAE, struct drm_mode_fb_cmd) +#define DRM_IOCTL_MODE_RMFB DRM_IOWR(0xAF, uint32_t) +#define DRM_IOCTL_MODE_REPLACEFB DRM_IOWR(0xB0, struct drm_mode_fb_cmd) /*@}*/ commit ea849d7ca6aaedd3aba6ec7239f01426521d8604 Author: Jakob Bornecrantz <ja...@tu...> Date: Wed Nov 12 18:49:46 2008 +0100 mode: Unify userspace API to uint_t diff --git a/libdrm/xf86drmMode.h b/libdrm/xf86drmMode.h index ee45717..b68d146 100644 --- a/libdrm/xf86drmMode.h +++ b/libdrm/xf86drmMode.h @@ -77,8 +77,8 @@ typedef struct _drmModePropertyBlob { } drmModePropertyBlobRes, *drmModePropertyBlobPtr; typedef struct _drmModeProperty { - unsigned int prop_id; - unsigned int flags; + uint32_t prop_id; + uint32_t flags; char name[DRM_PROP_NAME_LEN]; int count_values; uint64_t *values; // store the blob lengths @@ -89,8 +89,8 @@ typedef struct _drmModeProperty { } drmModePropertyRes, *drmModePropertyPtr; typedef struct _drmModeCrtc { - unsigned int crtc_id; - unsigned int buffer_id; /**< FB id to connect to 0 = disconnect */ + uint32_t crtc_id; + uint32_t buffer_id; /**< FB id to connect to 0 = disconnect */ uint32_t x, y; /**< Position on the framebuffer */ uint32_t width, height; @@ -102,9 +102,9 @@ typedef struct _drmModeCrtc { } drmModeCrtc, *drmModeCrtcPtr; typedef struct _drmModeEncoder { - unsigned int encoder_id; - unsigned int encoder_type; - unsigned int crtc_id; + uint32_t encoder_id; + uint32_t encoder_type; + uint32_t crtc_id; uint32_t possible_crtcs; uint32_t possible_clones; } drmModeEncoder, *drmModeEncoderPtr; @@ -125,10 +125,10 @@ typedef enum { } drmModeSubPixel; typedef struct _drmModeConnector { - unsigned int connector_id; - unsigned int encoder_id; /**< Encoder currently connected to */ - unsigned int connector_type; - unsigned int connector_type_id; + uint32_t connector_id; + uint32_t encoder_id; /**< Encoder currently connected to */ + uint32_t connector_type; + uint32_t connector_type_id; drmModeConnection connection; uint32_t mmWidth, mmHeight; /**< HxW in millimeters */ drmModeSubPixel subpixel; commit 1ead45c8f02e7c51cfe977383726d20479385688 Author: Jakob Bornecrantz <ja...@tu...> Date: Wed Nov 12 18:40:04 2008 +0100 mode: Remove hotplug support from ioctl interface diff --git a/libdrm/xf86drmMode.c b/libdrm/xf86drmMode.c index a25b11b..38fdbc1 100644 --- a/libdrm/xf86drmMode.c +++ b/libdrm/xf86drmMode.c @@ -183,15 +183,6 @@ err_allocs: 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) diff --git a/libdrm/xf86drmMode.h b/libdrm/xf86drmMode.h index 59612a9..ee45717 100644 --- a/libdrm/xf86drmMode.h +++ b/libdrm/xf86drmMode.h @@ -158,11 +158,6 @@ extern void drmModeFreeEncoder( drmModeEncoderPtr ptr ); */ extern drmModeResPtr drmModeGetResources(int fd); -/** - * Retrives the hotplug counter - */ -extern uint32_t drmModeGetHotplug(int fd); - /* * FrameBuffer manipulation. */ diff --git a/linux-core/drm_crtc.c b/linux-core/drm_crtc.c index bc385dc..255cc8c 100644 --- a/linux-core/drm_crtc.c +++ b/linux-core/drm_crtc.c @@ -844,16 +844,6 @@ void drm_mode_config_cleanup(struct drm_device *dev) } 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 diff --git a/linux-core/drm_drv.c b/linux-core/drm_drv.c index 11044bf..a8b17f1 100644 --- a/linux-core/drm_drv.c +++ b/linux-core/drm_drv.c @@ -138,8 +138,6 @@ static struct drm_ioctl_desc drm_ioctls[] = { 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), diff --git a/linux-core/drm_irq.c b/linux-core/drm_irq.c index b317d86..103f3e2 100644 --- a/linux-core/drm_irq.c +++ b/linux-core/drm_irq.c @@ -192,58 +192,6 @@ err: } 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) diff --git a/shared-core/drm.h b/shared-core/drm.h index 42dad49..cc6aead 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -555,37 +555,6 @@ union drm_wait_vblank { 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, @@ -792,8 +761,6 @@ struct drm_gem_open { #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) diff --git a/shared-core/drm_mode.h b/shared-core/drm_mode.h index f44c9a0..6b1abd5 100644 --- a/shared-core/drm_mode.h +++ b/shared-core/drm_mode.h @@ -258,13 +258,6 @@ struct drm_mode_cursor { 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; commit 13948c635d83285909e25ffd5285165789a598b2 Author: Jakob Bornecrantz <ja...@tu...> Date: Wed Nov 12 18:16:38 2008 +0100 mode: Unify types for ids and strings diff --git a/shared-core/drm_mode.h b/shared-core/drm_mode.h index bd3d257..f44c9a0 100644 --- a/shared-core/drm_mode.h +++ b/shared-core/drm_mode.h @@ -109,8 +109,8 @@ struct drm_mode_crtc { uint64_t set_connectors_ptr; uint32_t count_connectors; - unsigned int crtc_id; /**< Id */ - unsigned int fb_id; /**< Id of framebuffer */ + uint32_t crtc_id; /**< Id */ + uint32_t fb_id; /**< Id of framebuffer */ uint32_t x, y; /**< Position on the frameuffer */ @@ -126,10 +126,10 @@ struct drm_mode_crtc { #define DRM_MODE_ENCODER_TVDAC 4 struct drm_mode_get_encoder { - unsigned int encoder_type; - unsigned int encoder_id; + uint32_t encoder_type; + uint32_t encoder_id; - unsigned int crtc_id; /**< Id of crtc */ + uint32_t crtc_id; /**< Id of crtc */ uint32_t possible_crtcs; uint32_t possible_clones; @@ -170,10 +170,10 @@ struct drm_mode_get_connector { uint32_t count_props; uint32_t count_encoders; - unsigned int encoder_id; /**< Current Encoder */ - unsigned int connector_id; /**< Id */ - unsigned int connector_type; - unsigned int connector_type_id; + uint32_t encoder_id; /**< Current Encoder */ + uint32_t connector_id; /**< Id */ + uint32_t connector_type; + uint32_t connector_type_id; uint32_t connection; uint32_t mm_width, mm_height; /**< HxW in millimeters */ @@ -188,16 +188,16 @@ struct drm_mode_get_connector { struct drm_mode_property_enum { uint64_t value; - unsigned char name[DRM_PROP_NAME_LEN]; + char name[DRM_PROP_NAME_LEN]; }; struct drm_mode_get_property { uint64_t values_ptr; /* values and blob lengths */ uint64_t enum_blob_ptr; /* enum and blob id ptrs */ - unsigned int prop_id; + uint32_t prop_id; uint32_t flags; - unsigned char name[DRM_PROP_NAME_LEN]; + char name[DRM_PROP_NAME_LEN]; uint32_t count_values; uint32_t count_enum_blobs; @@ -205,8 +205,8 @@ struct drm_mode_get_property { struct drm_mode_connector_set_property { uint64_t value; - unsigned int prop_id; - unsigned int connector_id; + uint32_t prop_id; + uint32_t connector_id; }; struct drm_mode_get_blob { @@ -216,7 +216,7 @@ struct drm_mode_get_blob { }; struct drm_mode_fb_cmd { - unsigned int buffer_id; + uint32_t buffer_id; uint32_t width, height; uint32_t pitch; uint32_t bpp; @@ -226,7 +226,7 @@ struct drm_mode_fb_cmd { }; struct drm_mode_mode_cmd { - unsigned int connector_id; + uint32_t connector_id; struct drm_mode_modeinfo mode; }; @@ -249,7 +249,7 @@ struct drm_mode_mode_cmd { */ struct drm_mode_cursor { uint32_t flags; - unsigned int crtc_id; + uint32_t crtc_id; int32_t x; int32_t y; uint32_t width; @@ -266,7 +266,7 @@ struct drm_mode_hotplug { }; struct drm_mode_crtc_lut { - unsigned int crtc_id; + uint32_t crtc_id; uint32_t gamma_size; /* pointers to arrays */ |