Merge drm/drm-next into drm-misc-next
[linux-2.6-block.git] / drivers / gpu / drm / tegra / drm.c
index b2dc3c6fefcbe0a2398360b37f2a2e8d300e7059..f96c237b22426c11bd6638ab14b0eddc07d253bf 100644 (file)
@@ -175,7 +175,7 @@ int tegra_drm_submit(struct tegra_drm_context *context,
        struct drm_tegra_syncpt syncpt;
        struct host1x *host1x = dev_get_drvdata(drm->dev->parent);
        struct drm_gem_object **refs;
-       struct host1x_syncpt *sp;
+       struct host1x_syncpt *sp = NULL;
        struct host1x_job *job;
        unsigned int num_refs;
        int err;
@@ -302,8 +302,8 @@ int tegra_drm_submit(struct tegra_drm_context *context,
                goto fail;
        }
 
-       /* check whether syncpoint ID is valid */
-       sp = host1x_syncpt_get(host1x, syncpt.id);
+       /* Syncpoint ref will be dropped on job release. */
+       sp = host1x_syncpt_get_by_id(host1x, syncpt.id);
        if (!sp) {
                err = -ENOENT;
                goto fail;
@@ -312,7 +312,7 @@ int tegra_drm_submit(struct tegra_drm_context *context,
        job->is_addr_reg = context->client->ops->is_addr_reg;
        job->is_valid_class = context->client->ops->is_valid_class;
        job->syncpt_incrs = syncpt.incrs;
-       job->syncpt_id = syncpt.id;
+       job->syncpt = sp;
        job->timeout = 10000;
 
        if (args->timeout && args->timeout < 10000)
@@ -384,7 +384,7 @@ static int tegra_syncpt_read(struct drm_device *drm, void *data,
        struct drm_tegra_syncpt_read *args = data;
        struct host1x_syncpt *sp;
 
-       sp = host1x_syncpt_get(host, args->id);
+       sp = host1x_syncpt_get_by_id_noref(host, args->id);
        if (!sp)
                return -EINVAL;
 
@@ -399,7 +399,7 @@ static int tegra_syncpt_incr(struct drm_device *drm, void *data,
        struct drm_tegra_syncpt_incr *args = data;
        struct host1x_syncpt *sp;
 
-       sp = host1x_syncpt_get(host1x, args->id);
+       sp = host1x_syncpt_get_by_id_noref(host1x, args->id);
        if (!sp)
                return -EINVAL;
 
@@ -413,7 +413,7 @@ static int tegra_syncpt_wait(struct drm_device *drm, void *data,
        struct drm_tegra_syncpt_wait *args = data;
        struct host1x_syncpt *sp;
 
-       sp = host1x_syncpt_get(host1x, args->id);
+       sp = host1x_syncpt_get_by_id_noref(host1x, args->id);
        if (!sp)
                return -EINVAL;
 
@@ -1122,9 +1122,8 @@ static int host1x_drm_probe(struct host1x_device *dev)
 
        drm->mode_config.min_width = 0;
        drm->mode_config.min_height = 0;
-
-       drm->mode_config.max_width = 4096;
-       drm->mode_config.max_height = 4096;
+       drm->mode_config.max_width = 0;
+       drm->mode_config.max_height = 0;
 
        drm->mode_config.normalize_zpos = true;
 
@@ -1141,6 +1140,14 @@ static int host1x_drm_probe(struct host1x_device *dev)
        if (err < 0)
                goto fbdev;
 
+       /*
+        * Now that all display controller have been initialized, the maximum
+        * supported resolution is known and the bitmask for horizontal and
+        * vertical bitfields can be computed.
+        */
+       tegra->hmask = drm->mode_config.max_width - 1;
+       tegra->vmask = drm->mode_config.max_height - 1;
+
        if (tegra->use_explicit_iommu) {
                u64 carveout_start, carveout_end, gem_start, gem_end;
                u64 dma_mask = dma_get_mask(&dev->dev);