Merge tag 'topic/drm-misc-2015-02-06' of git://anongit.freedesktop.org/drm-intel...
authorDave Airlie <airlied@redhat.com>
Wed, 11 Feb 2015 05:33:02 +0000 (15:33 +1000)
committerDave Airlie <airlied@redhat.com>
Wed, 11 Feb 2015 05:33:02 +0000 (15:33 +1000)
Flushing out my drm-misc queue with a few oddball things all over.

* tag 'topic/drm-misc-2015-02-06' of git://anongit.freedesktop.org/drm-intel:
  drm: Use static attribute groups for managing connector sysfs entries
  drm: remove DRM_FORMAT_NV12MT
  drm/modes: Print the mode status in human readable form
  drm/irq: Don't disable vblank interrupts when already disabled

drivers/gpu/drm/drm_irq.c
drivers/gpu/drm/drm_sysfs.c
drivers/gpu/drm/exynos/exynos_drm_fimc.c
drivers/gpu/drm/exynos/exynos_drm_gsc.c
drivers/gpu/drm/exynos/exynos_drm_plane.c
drivers/gpu/drm/exynos/exynos_mixer.c
include/uapi/drm/drm_fourcc.h

index 75647e7f012b303fee89d7e79cdc1e01d0645d05..10574a0c3a55127cae5fb3e90d7b309defdcc681 100644 (file)
@@ -185,8 +185,15 @@ static void vblank_disable_and_save(struct drm_device *dev, int crtc)
                return;
        }
 
-       dev->driver->disable_vblank(dev, crtc);
-       vblank->enabled = false;
+       /*
+        * Only disable vblank interrupts if they're enabled. This avoids
+        * calling the ->disable_vblank() operation in atomic context with the
+        * hardware potentially runtime suspended.
+        */
+       if (vblank->enabled) {
+               dev->driver->disable_vblank(dev, crtc);
+               vblank->enabled = false;
+       }
 
        /* No further vblank irq's will be processed after
         * this point. Get current hardware vblank count and
index cc3d6d6d67e00a52d8924bfa5dba6a51dfda5f00..5c99d3773212a92928fb31c2b198f440a6e6a0b4 100644 (file)
@@ -339,19 +339,51 @@ static ssize_t select_subconnector_show(struct device *device,
                        drm_get_dvi_i_select_name((int)subconnector));
 }
 
-static struct device_attribute connector_attrs[] = {
-       __ATTR_RO(status),
-       __ATTR_RO(enabled),
-       __ATTR_RO(dpms),
-       __ATTR_RO(modes),
+static DEVICE_ATTR_RO(status);
+static DEVICE_ATTR_RO(enabled);
+static DEVICE_ATTR_RO(dpms);
+static DEVICE_ATTR_RO(modes);
+
+static struct attribute *connector_dev_attrs[] = {
+       &dev_attr_status.attr,
+       &dev_attr_enabled.attr,
+       &dev_attr_dpms.attr,
+       &dev_attr_modes.attr,
+       NULL
 };
 
 /* These attributes are for both DVI-I connectors and all types of tv-out. */
-static struct device_attribute connector_attrs_opt1[] = {
-       __ATTR_RO(subconnector),
-       __ATTR_RO(select_subconnector),
+static DEVICE_ATTR_RO(subconnector);
+static DEVICE_ATTR_RO(select_subconnector);
+
+static struct attribute *connector_opt_dev_attrs[] = {
+       &dev_attr_subconnector.attr,
+       &dev_attr_select_subconnector.attr,
+       NULL
 };
 
+static umode_t connector_opt_dev_is_visible(struct kobject *kobj,
+                                           struct attribute *attr, int idx)
+{
+       struct device *dev = kobj_to_dev(kobj);
+       struct drm_connector *connector = to_drm_connector(dev);
+
+       /*
+        * In the long run it maybe a good idea to make one set of
+        * optionals per connector type.
+        */
+       switch (connector->connector_type) {
+       case DRM_MODE_CONNECTOR_DVII:
+       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,
@@ -359,6 +391,27 @@ static struct bin_attribute edid_attr = {
        .read = edid_show,
 };
 
+static struct bin_attribute *connector_bin_attrs[] = {
+       &edid_attr,
+       NULL
+};
+
+static const struct attribute_group connector_dev_group = {
+       .attrs = connector_dev_attrs,
+       .bin_attrs = connector_bin_attrs,
+};
+
+static const struct attribute_group connector_opt_dev_group = {
+       .attrs = connector_opt_dev_attrs,
+       .is_visible = connector_opt_dev_is_visible,
+};
+
+static const struct attribute_group *connector_dev_groups[] = {
+       &connector_dev_group,
+       &connector_opt_dev_group,
+       NULL
+};
+
 /**
  * drm_sysfs_connector_add - add a connector to sysfs
  * @connector: connector to add
@@ -371,73 +424,27 @@ static struct bin_attribute edid_attr = {
 int drm_sysfs_connector_add(struct drm_connector *connector)
 {
        struct drm_device *dev = connector->dev;
-       int attr_cnt = 0;
-       int opt_cnt = 0;
-       int i;
-       int ret;
 
        if (connector->kdev)
                return 0;
 
-       connector->kdev = device_create(drm_class, dev->primary->kdev,
-                                       0, connector, "card%d-%s",
-                                       dev->primary->index, connector->name);
+       connector->kdev =
+               device_create_with_groups(drm_class, dev->primary->kdev, 0,
+                                         connector, connector_dev_groups,
+                                         "card%d-%s", dev->primary->index,
+                                         connector->name);
        DRM_DEBUG("adding \"%s\" to sysfs\n",
                  connector->name);
 
        if (IS_ERR(connector->kdev)) {
                DRM_ERROR("failed to register connector device: %ld\n", PTR_ERR(connector->kdev));
-               ret = PTR_ERR(connector->kdev);
-               goto out;
-       }
-
-       /* Standard attributes */
-
-       for (attr_cnt = 0; attr_cnt < ARRAY_SIZE(connector_attrs); attr_cnt++) {
-               ret = device_create_file(connector->kdev, &connector_attrs[attr_cnt]);
-               if (ret)
-                       goto err_out_files;
+               return PTR_ERR(connector->kdev);
        }
 
-       /* Optional attributes */
-       /*
-        * In the long run it maybe a good idea to make one set of
-        * optionals per connector type.
-        */
-       switch (connector->connector_type) {
-               case DRM_MODE_CONNECTOR_DVII:
-               case DRM_MODE_CONNECTOR_Composite:
-               case DRM_MODE_CONNECTOR_SVIDEO:
-               case DRM_MODE_CONNECTOR_Component:
-               case DRM_MODE_CONNECTOR_TV:
-                       for (opt_cnt = 0; opt_cnt < ARRAY_SIZE(connector_attrs_opt1); opt_cnt++) {
-                               ret = device_create_file(connector->kdev, &connector_attrs_opt1[opt_cnt]);
-                               if (ret)
-                                       goto err_out_files;
-                       }
-                       break;
-               default:
-                       break;
-       }
-
-       ret = sysfs_create_bin_file(&connector->kdev->kobj, &edid_attr);
-       if (ret)
-               goto err_out_files;
-
        /* Let userspace know we have a new connector */
        drm_sysfs_hotplug_event(dev);
 
        return 0;
-
-err_out_files:
-       for (i = 0; i < opt_cnt; i++)
-               device_remove_file(connector->kdev, &connector_attrs_opt1[i]);
-       for (i = 0; i < attr_cnt; i++)
-               device_remove_file(connector->kdev, &connector_attrs[i]);
-       device_unregister(connector->kdev);
-
-out:
-       return ret;
 }
 
 /**
@@ -455,16 +462,11 @@ out:
  */
 void drm_sysfs_connector_remove(struct drm_connector *connector)
 {
-       int i;
-
        if (!connector->kdev)
                return;
        DRM_DEBUG("removing \"%s\" from sysfs\n",
                  connector->name);
 
-       for (i = 0; i < ARRAY_SIZE(connector_attrs); i++)
-               device_remove_file(connector->kdev, &connector_attrs[i]);
-       sysfs_remove_bin_file(&connector->kdev->kobj, &edid_attr);
        device_unregister(connector->kdev);
        connector->kdev = NULL;
 }
index 835b6af009706135bfda7d78c264ce826f65bea4..842d6b8dc3c435ee7d836402d4169847aef75d31 100644 (file)
@@ -461,7 +461,6 @@ static int fimc_src_set_fmt_order(struct fimc_context *ctx, u32 fmt)
                cfg |= EXYNOS_MSCTRL_C_INT_IN_3PLANE;
                break;
        case DRM_FORMAT_NV12:
-       case DRM_FORMAT_NV12MT:
        case DRM_FORMAT_NV16:
                cfg |= (EXYNOS_MSCTRL_ORDER2P_LSB_CBCR |
                        EXYNOS_MSCTRL_C_INT_IN_2PLANE);
@@ -511,7 +510,6 @@ static int fimc_src_set_fmt(struct device *dev, u32 fmt)
        case DRM_FORMAT_YVU420:
        case DRM_FORMAT_NV12:
        case DRM_FORMAT_NV21:
-       case DRM_FORMAT_NV12MT:
                cfg |= EXYNOS_MSCTRL_INFORMAT_YCBCR420;
                break;
        default:
@@ -524,10 +522,7 @@ static int fimc_src_set_fmt(struct device *dev, u32 fmt)
        cfg = fimc_read(ctx, EXYNOS_CIDMAPARAM);
        cfg &= ~EXYNOS_CIDMAPARAM_R_MODE_MASK;
 
-       if (fmt == DRM_FORMAT_NV12MT)
-               cfg |= EXYNOS_CIDMAPARAM_R_MODE_64X32;
-       else
-               cfg |= EXYNOS_CIDMAPARAM_R_MODE_LINEAR;
+       cfg |= EXYNOS_CIDMAPARAM_R_MODE_LINEAR;
 
        fimc_write(ctx, cfg, EXYNOS_CIDMAPARAM);
 
@@ -812,7 +807,6 @@ static int fimc_dst_set_fmt_order(struct fimc_context *ctx, u32 fmt)
                cfg |= EXYNOS_CIOCTRL_YCBCR_3PLANE;
                break;
        case DRM_FORMAT_NV12:
-       case DRM_FORMAT_NV12MT:
        case DRM_FORMAT_NV16:
                cfg |= EXYNOS_CIOCTRL_ORDER2P_LSB_CBCR;
                cfg |= EXYNOS_CIOCTRL_YCBCR_2PLANE;
@@ -867,7 +861,6 @@ static int fimc_dst_set_fmt(struct device *dev, u32 fmt)
                case DRM_FORMAT_YUV420:
                case DRM_FORMAT_YVU420:
                case DRM_FORMAT_NV12:
-               case DRM_FORMAT_NV12MT:
                case DRM_FORMAT_NV21:
                        cfg |= EXYNOS_CITRGFMT_OUTFORMAT_YCBCR420;
                        break;
@@ -883,10 +876,7 @@ static int fimc_dst_set_fmt(struct device *dev, u32 fmt)
        cfg = fimc_read(ctx, EXYNOS_CIDMAPARAM);
        cfg &= ~EXYNOS_CIDMAPARAM_W_MODE_MASK;
 
-       if (fmt == DRM_FORMAT_NV12MT)
-               cfg |= EXYNOS_CIDMAPARAM_W_MODE_64X32;
-       else
-               cfg |= EXYNOS_CIDMAPARAM_W_MODE_LINEAR;
+       cfg |= EXYNOS_CIDMAPARAM_W_MODE_LINEAR;
 
        fimc_write(ctx, cfg, EXYNOS_CIDMAPARAM);
 
index 0261468c8019aaff655906b3a61ff52bc8ed5835..8040ed2a831f9a6f226baf8aee3ce00b213be8e6 100644 (file)
@@ -542,9 +542,6 @@ static int gsc_src_set_fmt(struct device *dev, u32 fmt)
                cfg |= (GSC_IN_CHROMA_ORDER_CBCR |
                        GSC_IN_YUV420_2P);
                break;
-       case DRM_FORMAT_NV12MT:
-               cfg |= (GSC_IN_TILE_C_16x8 | GSC_IN_TILE_MODE);
-               break;
        default:
                dev_err(ippdrv->dev, "inavlid target yuv order 0x%x.\n", fmt);
                return -EINVAL;
@@ -809,9 +806,6 @@ static int gsc_dst_set_fmt(struct device *dev, u32 fmt)
                cfg |= (GSC_OUT_CHROMA_ORDER_CBCR |
                        GSC_OUT_YUV420_2P);
                break;
-       case DRM_FORMAT_NV12MT:
-               cfg |= (GSC_OUT_TILE_C_16x8 | GSC_OUT_TILE_MODE);
-               break;
        default:
                dev_err(ippdrv->dev, "inavlid target yuv order 0x%x.\n", fmt);
                return -EINVAL;
index 358cff67e5cef86bf5415f5fd45b11a1f6a99bd0..2f43a3c4f7b7bb1362ede6d4acb0e3f35e46f37c 100644 (file)
@@ -23,7 +23,6 @@ static const uint32_t formats[] = {
        DRM_FORMAT_XRGB8888,
        DRM_FORMAT_ARGB8888,
        DRM_FORMAT_NV12,
-       DRM_FORMAT_NV12MT,
 };
 
 /*
index ed44cd4f01f7647c79eca3e3b40f79d19a82d8c9..2fd2e5d46142e0b9b41e0389866f1bff542039cb 100644 (file)
@@ -412,8 +412,6 @@ static void vp_video_buffer(struct mixer_context *ctx, int win)
        win_data = &ctx->win_data[win];
 
        switch (win_data->pixel_format) {
-       case DRM_FORMAT_NV12MT:
-               tiled_mode = true;
        case DRM_FORMAT_NV12:
                crcb_mode = false;
                buf_num = 2;
index 646ae5f39f42a75b7ac5dcf2cf7cafd51cf3341b..a284f11a8ef59432929007e93ec6d4953316c873 100644 (file)
 #define DRM_FORMAT_NV24                fourcc_code('N', 'V', '2', '4') /* non-subsampled Cr:Cb plane */
 #define DRM_FORMAT_NV42                fourcc_code('N', 'V', '4', '2') /* non-subsampled Cb:Cr plane */
 
-/* special NV12 tiled format */
-#define DRM_FORMAT_NV12MT      fourcc_code('T', 'M', '1', '2') /* 2x2 subsampled Cr:Cb plane 64x32 macroblocks */
-
 /*
  * 3 plane YCbCr
  * index 0: Y plane, [7:0] Y