Skip to content

Commit

Permalink
Merge tag 'topic/drm-misc-2016-04-01' of git://anongit.freedesktop.or…
Browse files Browse the repository at this point in the history
…g/drm-intel into drm-next

* tag 'topic/drm-misc-2016-04-01' of git://anongit.freedesktop.org/drm-intel:
  drm: Add new DCS commands in the enum list
  drm: Make uapi headers C89 pendantic compliant
  drm/atomic: export drm_atomic_helper_wait_for_fences()
  drm: Untangle __KERNEL__ guards
  drm: Move DRM_MODE_OBJECT_* to uapi headers
  drm: align #include directives with libdrm in uapi headers
  drm: Make drm.h uapi header safe for C++
  vgacon: dummy implementation for vgacon_text_force
  drm/sysfs: Nuke TV/DVI property files
  drm/ttm: Remove TTM_HAS_AGP
  drm: bridge/dw-hdmi: Remove pre_enable/post_disable dummy funcs
  Revert "drm: Don't pass negative delta to ktime_sub_ns()"
  drm/atmel: Fixup drm_connector_/unplug/unregister/_all
  drm: Rename drm_connector_unplug_all() to drm_connector_unregister_all()
  drm: bridge: Make (pre/post) enable/disable callbacks optional
  • Loading branch information
Dave Airlie committed Apr 5, 2016
2 parents 9735a22 + 249c4f5 commit e7c8e54
Show file tree
Hide file tree
Showing 29 changed files with 75 additions and 234 deletions.
2 changes: 0 additions & 2 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -556,12 +556,10 @@ static struct pci_driver amdgpu_kms_pci_driver = {
static int __init amdgpu_init(void)
{
amdgpu_sync_init();
#ifdef CONFIG_VGA_CONSOLE
if (vgacon_text_force()) {
DRM_ERROR("VGACON disables amdgpu kernel modesetting.\n");
return -EINVAL;
}
#endif
DRM_INFO("amdgpu kernel modesetting enabled.\n");
driver = &kms_driver;
pdriver = &amdgpu_kms_pci_driver;
Expand Down
2 changes: 0 additions & 2 deletions drivers/gpu/drm/ast/ast_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,8 @@ static struct drm_driver driver = {

static int __init ast_init(void)
{
#ifdef CONFIG_VGA_CONSOLE
if (vgacon_text_force() && ast_modeset == -1)
return -EINVAL;
#endif

if (ast_modeset == 0)
return -EINVAL;
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ static int atmel_hlcdc_dc_connector_plug_all(struct drm_device *dev)
static void atmel_hlcdc_dc_connector_unplug_all(struct drm_device *dev)
{
mutex_lock(&dev->mode_config.mutex);
drm_connector_unplug_all(dev);
drm_connector_unregister_all(dev);
mutex_unlock(&dev->mode_config.mutex);
}

Expand Down
7 changes: 0 additions & 7 deletions drivers/gpu/drm/bridge/dw-hdmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1413,11 +1413,6 @@ static void dw_hdmi_bridge_enable(struct drm_bridge *bridge)
mutex_unlock(&hdmi->mutex);
}

static void dw_hdmi_bridge_nop(struct drm_bridge *bridge)
{
/* do nothing */
}

static enum drm_connector_status
dw_hdmi_connector_detect(struct drm_connector *connector, bool force)
{
Expand Down Expand Up @@ -1536,8 +1531,6 @@ static const struct drm_connector_helper_funcs dw_hdmi_connector_helper_funcs =
static const struct drm_bridge_funcs dw_hdmi_bridge_funcs = {
.enable = dw_hdmi_bridge_enable,
.disable = dw_hdmi_bridge_disable,
.pre_enable = dw_hdmi_bridge_nop,
.post_disable = dw_hdmi_bridge_nop,
.mode_set = dw_hdmi_bridge_mode_set,
};

Expand Down
2 changes: 0 additions & 2 deletions drivers/gpu/drm/cirrus/cirrus_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,8 @@ static struct pci_driver cirrus_pci_driver = {

static int __init cirrus_init(void)
{
#ifdef CONFIG_VGA_CONSOLE
if (vgacon_text_force() && cirrus_modeset == -1)
return -EINVAL;
#endif

if (cirrus_modeset == 0)
return -EINVAL;
Expand Down
15 changes: 13 additions & 2 deletions drivers/gpu/drm/drm_atomic_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,17 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev,
}
EXPORT_SYMBOL(drm_atomic_helper_commit_modeset_enables);

static void wait_for_fences(struct drm_device *dev,
/**
* drm_atomic_helper_wait_for_fences - wait for fences stashed in plane state
* @dev: DRM device
* @state: atomic state object with old state structures
*
* For implicit sync, driver should fish the exclusive fence out from the
* incoming fb's and stash it in the drm_plane_state. This is called after
* drm_atomic_helper_swap_state() so it uses the current plane state (and
* just uses the atomic state to find the changed planes)
*/
void drm_atomic_helper_wait_for_fences(struct drm_device *dev,
struct drm_atomic_state *state)
{
struct drm_plane *plane;
Expand All @@ -1002,6 +1012,7 @@ static void wait_for_fences(struct drm_device *dev,
plane->state->fence = NULL;
}
}
EXPORT_SYMBOL(drm_atomic_helper_wait_for_fences);

/**
* drm_atomic_helper_framebuffer_changed - check if framebuffer has changed
Expand Down Expand Up @@ -1163,7 +1174,7 @@ int drm_atomic_helper_commit(struct drm_device *dev,
* current layout.
*/

wait_for_fences(dev, state);
drm_atomic_helper_wait_for_fences(dev, state);

drm_atomic_helper_commit_modeset_disables(dev, state);

Expand Down
18 changes: 9 additions & 9 deletions drivers/gpu/drm/drm_crtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1067,25 +1067,25 @@ void drm_connector_unregister(struct drm_connector *connector)
}
EXPORT_SYMBOL(drm_connector_unregister);


/**
* drm_connector_unplug_all - unregister connector userspace interfaces
* drm_connector_unregister_all - unregister connector userspace interfaces
* @dev: drm device
*
* This function unregisters all connector userspace interfaces in sysfs. Should
* be call when the device is disconnected, e.g. from an usb driver's
* ->disconnect callback.
* This functions unregisters all connectors from sysfs and other places so
* that userspace can no longer access them. Drivers should call this as the
* first step tearing down the device instace, or when the underlying
* physical device disappeared (e.g. USB unplug), right before calling
* drm_dev_unregister().
*/
void drm_connector_unplug_all(struct drm_device *dev)
void drm_connector_unregister_all(struct drm_device *dev)
{
struct drm_connector *connector;

/* FIXME: taking the mode config mutex ends up in a clash with sysfs */
list_for_each_entry(connector, &dev->mode_config.connector_list, head)
drm_for_each_connector(connector, dev)
drm_connector_unregister(connector);

}
EXPORT_SYMBOL(drm_connector_unplug_all);
EXPORT_SYMBOL(drm_connector_unregister_all);

/**
* drm_encoder_init - Init a preallocated encoder
Expand Down
5 changes: 1 addition & 4 deletions drivers/gpu/drm/drm_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -863,10 +863,7 @@ int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
/* Subtract time delta from raw timestamp to get final
* vblank_time timestamp for end of vblank.
*/
if (delta_ns < 0)
etime = ktime_add_ns(etime, -delta_ns);
else
etime = ktime_sub_ns(etime, delta_ns);
etime = ktime_sub_ns(etime, delta_ns);
*vblank_time = ktime_to_timeval(etime);

DRM_DEBUG_VBL("crtc %u : v 0x%x p(%d,%d)@ %ld.%ld -> %ld.%ld [e %d us, %d rep]\n",
Expand Down
156 changes: 0 additions & 156 deletions drivers/gpu/drm/drm_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,102 +287,6 @@ static ssize_t modes_show(struct device *device,
return written;
}

static ssize_t tv_subconnector_show(struct device *device,
struct device_attribute *attr,
char *buf)
{
struct drm_connector *connector = to_drm_connector(device);
struct drm_device *dev = connector->dev;
struct drm_property *prop;
uint64_t subconnector;
int ret;

prop = dev->mode_config.tv_subconnector_property;
if (!prop) {
DRM_ERROR("Unable to find subconnector property\n");
return 0;
}

ret = drm_object_property_get_value(&connector->base, prop, &subconnector);
if (ret)
return 0;

return snprintf(buf, PAGE_SIZE, "%s",
drm_get_tv_subconnector_name((int)subconnector));
}

static ssize_t tv_select_subconnector_show(struct device *device,
struct device_attribute *attr,
char *buf)
{
struct drm_connector *connector = to_drm_connector(device);
struct drm_device *dev = connector->dev;
struct drm_property *prop;
uint64_t subconnector;
int ret;

prop = dev->mode_config.tv_select_subconnector_property;
if (!prop) {
DRM_ERROR("Unable to find select subconnector property\n");
return 0;
}

ret = drm_object_property_get_value(&connector->base, prop, &subconnector);
if (ret)
return 0;

return snprintf(buf, PAGE_SIZE, "%s",
drm_get_tv_select_name((int)subconnector));
}

static ssize_t dvii_subconnector_show(struct device *device,
struct device_attribute *attr,
char *buf)
{
struct drm_connector *connector = to_drm_connector(device);
struct drm_device *dev = connector->dev;
struct drm_property *prop;
uint64_t subconnector;
int ret;

prop = dev->mode_config.dvi_i_subconnector_property;
if (!prop) {
DRM_ERROR("Unable to find subconnector property\n");
return 0;
}

ret = drm_object_property_get_value(&connector->base, prop, &subconnector);
if (ret)
return 0;

return snprintf(buf, PAGE_SIZE, "%s",
drm_get_dvi_i_subconnector_name((int)subconnector));
}

static ssize_t dvii_select_subconnector_show(struct device *device,
struct device_attribute *attr,
char *buf)
{
struct drm_connector *connector = to_drm_connector(device);
struct drm_device *dev = connector->dev;
struct drm_property *prop;
uint64_t subconnector;
int ret;

prop = dev->mode_config.dvi_i_select_subconnector_property;
if (!prop) {
DRM_ERROR("Unable to find select subconnector property\n");
return 0;
}

ret = drm_object_property_get_value(&connector->base, prop, &subconnector);
if (ret)
return 0;

return snprintf(buf, PAGE_SIZE, "%s",
drm_get_dvi_i_select_name((int)subconnector));
}

static DEVICE_ATTR_RW(status);
static DEVICE_ATTR_RO(enabled);
static DEVICE_ATTR_RO(dpms);
Expand All @@ -396,54 +300,6 @@ static struct attribute *connector_dev_attrs[] = {
NULL
};

static DEVICE_ATTR_RO(tv_subconnector);
static DEVICE_ATTR_RO(tv_select_subconnector);

static struct attribute *connector_tv_dev_attrs[] = {
&dev_attr_tv_subconnector.attr,
&dev_attr_tv_select_subconnector.attr,
NULL
};

static DEVICE_ATTR_RO(dvii_subconnector);
static DEVICE_ATTR_RO(dvii_select_subconnector);

static struct attribute *connector_dvii_dev_attrs[] = {
&dev_attr_dvii_subconnector.attr,
&dev_attr_dvii_select_subconnector.attr,
NULL
};

/* Connector type related helpers */
static int kobj_connector_type(struct kobject *kobj)
{
struct device *dev = kobj_to_dev(kobj);
struct drm_connector *connector = to_drm_connector(dev);

return connector->connector_type;
}

static umode_t connector_is_dvii(struct kobject *kobj,
struct attribute *attr, int idx)
{
return kobj_connector_type(kobj) == DRM_MODE_CONNECTOR_DVII ?
attr->mode : 0;
}

static umode_t connector_is_tv(struct kobject *kobj,
struct attribute *attr, int idx)
{
switch (kobj_connector_type(kobj)) {
case DRM_MODE_CONNECTOR_Composite:
case DRM_MODE_CONNECTOR_SVIDEO:
case DRM_MODE_CONNECTOR_Component:
case DRM_MODE_CONNECTOR_TV:
return attr->mode;
}

return 0;
}

static struct bin_attribute edid_attr = {
.attr.name = "edid",
.attr.mode = 0444,
Expand All @@ -461,20 +317,8 @@ static const struct attribute_group connector_dev_group = {
.bin_attrs = connector_bin_attrs,
};

static const struct attribute_group connector_tv_dev_group = {
.attrs = connector_tv_dev_attrs,
.is_visible = connector_is_tv,
};

static const struct attribute_group connector_dvii_dev_group = {
.attrs = connector_dvii_dev_attrs,
.is_visible = connector_is_dvii,
};

static const struct attribute_group *connector_dev_groups[] = {
&connector_dev_group,
&connector_tv_dev_group,
&connector_dvii_dev_group,
NULL
};

Expand Down
2 changes: 0 additions & 2 deletions drivers/gpu/drm/i915/i915_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1742,10 +1742,8 @@ static int __init i915_init(void)
if (i915.modeset == 0)
driver.driver_features &= ~DRIVER_MODESET;

#ifdef CONFIG_VGA_CONSOLE
if (vgacon_text_force() && i915.modeset == -1)
driver.driver_features &= ~DRIVER_MODESET;
#endif

if (!(driver.driver_features & DRIVER_MODESET)) {
/* Silently fail loading to not upset userspace. */
Expand Down
2 changes: 0 additions & 2 deletions drivers/gpu/drm/mgag200/mgag200_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,8 @@ static struct pci_driver mgag200_pci_driver = {

static int __init mgag200_init(void)
{
#ifdef CONFIG_VGA_CONSOLE
if (vgacon_text_force() && mgag200_modeset == -1)
return -EINVAL;
#endif

if (mgag200_modeset == 0)
return -EINVAL;
Expand Down
2 changes: 0 additions & 2 deletions drivers/gpu/drm/nouveau/nouveau_drm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1083,10 +1083,8 @@ nouveau_drm_init(void)
nouveau_display_options();

if (nouveau_modeset == -1) {
#ifdef CONFIG_VGA_CONSOLE
if (vgacon_text_force())
nouveau_modeset = 0;
#endif
}

if (!nouveau_modeset)
Expand Down
2 changes: 0 additions & 2 deletions drivers/gpu/drm/qxl/qxl_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,10 +272,8 @@ static struct drm_driver qxl_driver = {

static int __init qxl_init(void)
{
#ifdef CONFIG_VGA_CONSOLE
if (vgacon_text_force() && qxl_modeset == -1)
return -EINVAL;
#endif

if (qxl_modeset == 0)
return -EINVAL;
Expand Down
2 changes: 0 additions & 2 deletions drivers/gpu/drm/radeon/radeon_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -566,12 +566,10 @@ static struct pci_driver radeon_kms_pci_driver = {

static int __init radeon_init(void)
{
#ifdef CONFIG_VGA_CONSOLE
if (vgacon_text_force() && radeon_modeset == -1) {
DRM_INFO("VGACON disable radeon kernel modesetting.\n");
radeon_modeset = 0;
}
#endif
/* set to modesetting by default if not nomodeset */
if (radeon_modeset == -1)
radeon_modeset = 1;
Expand Down
5 changes: 1 addition & 4 deletions drivers/gpu/drm/rcar-du/rcar_du_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,7 @@ static int rcar_du_remove(struct platform_device *pdev)
struct rcar_du_device *rcdu = platform_get_drvdata(pdev);
struct drm_device *ddev = rcdu->ddev;

mutex_lock(&ddev->mode_config.mutex);
drm_connector_unplug_all(ddev);
mutex_unlock(&ddev->mode_config.mutex);

drm_connector_unregister_all(ddev);
drm_dev_unregister(ddev);

if (rcdu->fbdev)
Expand Down
Loading

0 comments on commit e7c8e54

Please sign in to comment.