diff options
| author | Thierry Reding <treding@nvidia.com> | 2013-09-26 10:08:22 -0400 |
|---|---|---|
| committer | Thierry Reding <treding@nvidia.com> | 2013-10-31 04:20:06 -0400 |
| commit | c88c363072c6dcd5427077f799b2711a10f616e4 (patch) | |
| tree | a50c1338b64d4a8a9d0bfe039e1e9a3402e3722b /drivers/gpu/host1x | |
| parent | 08943e6cbcd4d35d349a821d77c2e34ac0a4e549 (diff) | |
drm/tegra: Rename host1x_drm_context to tegra_drm_context
The structure represents a context associated with a particular process
that has opened the Tegra DRM device and requested a channel. This is a
very DRM-specific notion and has nothing to do with host1x. Rename the
structure to more clearly mark the boundaries between the two.
Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'drivers/gpu/host1x')
| -rw-r--r-- | drivers/gpu/host1x/drm/drm.c | 34 | ||||
| -rw-r--r-- | drivers/gpu/host1x/drm/drm.h | 8 | ||||
| -rw-r--r-- | drivers/gpu/host1x/drm/gr2d.c | 6 |
3 files changed, 28 insertions, 20 deletions
diff --git a/drivers/gpu/host1x/drm/drm.c b/drivers/gpu/host1x/drm/drm.c index f057cbad2ebe..f5c1db306c18 100644 --- a/drivers/gpu/host1x/drm/drm.c +++ b/drivers/gpu/host1x/drm/drm.c | |||
| @@ -306,7 +306,7 @@ static int tegra_drm_open(struct drm_device *drm, struct drm_file *filp) | |||
| 306 | return 0; | 306 | return 0; |
| 307 | } | 307 | } |
| 308 | 308 | ||
| 309 | static void host1x_drm_context_free(struct host1x_drm_context *context) | 309 | static void tegra_drm_context_free(struct tegra_drm_context *context) |
| 310 | { | 310 | { |
| 311 | context->client->ops->close_channel(context); | 311 | context->client->ops->close_channel(context); |
| 312 | kfree(context); | 312 | kfree(context); |
| @@ -320,10 +320,15 @@ static void tegra_drm_lastclose(struct drm_device *drm) | |||
| 320 | } | 320 | } |
| 321 | 321 | ||
| 322 | #ifdef CONFIG_DRM_TEGRA_STAGING | 322 | #ifdef CONFIG_DRM_TEGRA_STAGING |
| 323 | static struct tegra_drm_context *tegra_drm_get_context(__u64 context) | ||
| 324 | { | ||
| 325 | return (struct tegra_drm_context *)(uintptr_t)context; | ||
| 326 | } | ||
| 327 | |||
| 323 | static bool tegra_drm_file_owns_context(struct tegra_drm_file *file, | 328 | static bool tegra_drm_file_owns_context(struct tegra_drm_file *file, |
| 324 | struct host1x_drm_context *context) | 329 | struct tegra_drm_context *context) |
| 325 | { | 330 | { |
| 326 | struct host1x_drm_context *ctx; | 331 | struct tegra_drm_context *ctx; |
| 327 | 332 | ||
| 328 | list_for_each_entry(ctx, &file->contexts, list) | 333 | list_for_each_entry(ctx, &file->contexts, list) |
| 329 | if (ctx == context) | 334 | if (ctx == context) |
| @@ -413,7 +418,7 @@ static int tegra_open_channel(struct drm_device *drm, void *data, | |||
| 413 | struct tegra_drm_file *fpriv = file->driver_priv; | 418 | struct tegra_drm_file *fpriv = file->driver_priv; |
| 414 | struct tegra_drm *tegra = drm->dev_private; | 419 | struct tegra_drm *tegra = drm->dev_private; |
| 415 | struct drm_tegra_open_channel *args = data; | 420 | struct drm_tegra_open_channel *args = data; |
| 416 | struct host1x_drm_context *context; | 421 | struct tegra_drm_context *context; |
| 417 | struct host1x_client *client; | 422 | struct host1x_client *client; |
| 418 | int err = -ENODEV; | 423 | int err = -ENODEV; |
| 419 | 424 | ||
| @@ -442,14 +447,15 @@ static int tegra_close_channel(struct drm_device *drm, void *data, | |||
| 442 | { | 447 | { |
| 443 | struct drm_tegra_close_channel *args = data; | 448 | struct drm_tegra_close_channel *args = data; |
| 444 | struct tegra_drm_file *fpriv = file->driver_priv; | 449 | struct tegra_drm_file *fpriv = file->driver_priv; |
| 445 | struct host1x_drm_context *context = | 450 | struct tegra_drm_context *context; |
| 446 | (struct host1x_drm_context *)(uintptr_t)args->context; | 451 | |
| 452 | context = tegra_drm_get_context(args->context); | ||
| 447 | 453 | ||
| 448 | if (!tegra_drm_file_owns_context(fpriv, context)) | 454 | if (!tegra_drm_file_owns_context(fpriv, context)) |
| 449 | return -EINVAL; | 455 | return -EINVAL; |
| 450 | 456 | ||
| 451 | list_del(&context->list); | 457 | list_del(&context->list); |
| 452 | host1x_drm_context_free(context); | 458 | tegra_drm_context_free(context); |
| 453 | 459 | ||
| 454 | return 0; | 460 | return 0; |
| 455 | } | 461 | } |
| @@ -459,10 +465,11 @@ static int tegra_get_syncpt(struct drm_device *drm, void *data, | |||
| 459 | { | 465 | { |
| 460 | struct tegra_drm_file *fpriv = file->driver_priv; | 466 | struct tegra_drm_file *fpriv = file->driver_priv; |
| 461 | struct drm_tegra_get_syncpt *args = data; | 467 | struct drm_tegra_get_syncpt *args = data; |
| 462 | struct host1x_drm_context *context = | 468 | struct tegra_drm_context *context; |
| 463 | (struct host1x_drm_context *)(uintptr_t)args->context; | ||
| 464 | struct host1x_syncpt *syncpt; | 469 | struct host1x_syncpt *syncpt; |
| 465 | 470 | ||
| 471 | context = tegra_drm_get_context(args->context); | ||
| 472 | |||
| 466 | if (!tegra_drm_file_owns_context(fpriv, context)) | 473 | if (!tegra_drm_file_owns_context(fpriv, context)) |
| 467 | return -ENODEV; | 474 | return -ENODEV; |
| 468 | 475 | ||
| @@ -480,8 +487,9 @@ static int tegra_submit(struct drm_device *drm, void *data, | |||
| 480 | { | 487 | { |
| 481 | struct tegra_drm_file *fpriv = file->driver_priv; | 488 | struct tegra_drm_file *fpriv = file->driver_priv; |
| 482 | struct drm_tegra_submit *args = data; | 489 | struct drm_tegra_submit *args = data; |
| 483 | struct host1x_drm_context *context = | 490 | struct tegra_drm_context *context; |
| 484 | (struct host1x_drm_context *)(uintptr_t)args->context; | 491 | |
| 492 | context = tegra_drm_get_context(args->context); | ||
| 485 | 493 | ||
| 486 | if (!tegra_drm_file_owns_context(fpriv, context)) | 494 | if (!tegra_drm_file_owns_context(fpriv, context)) |
| 487 | return -ENODEV; | 495 | return -ENODEV; |
| @@ -563,14 +571,14 @@ static void tegra_drm_disable_vblank(struct drm_device *drm, int pipe) | |||
| 563 | static void tegra_drm_preclose(struct drm_device *drm, struct drm_file *file) | 571 | static void tegra_drm_preclose(struct drm_device *drm, struct drm_file *file) |
| 564 | { | 572 | { |
| 565 | struct tegra_drm_file *fpriv = file->driver_priv; | 573 | struct tegra_drm_file *fpriv = file->driver_priv; |
| 566 | struct host1x_drm_context *context, *tmp; | 574 | struct tegra_drm_context *context, *tmp; |
| 567 | struct drm_crtc *crtc; | 575 | struct drm_crtc *crtc; |
| 568 | 576 | ||
| 569 | list_for_each_entry(crtc, &drm->mode_config.crtc_list, head) | 577 | list_for_each_entry(crtc, &drm->mode_config.crtc_list, head) |
| 570 | tegra_dc_cancel_page_flip(crtc, file); | 578 | tegra_dc_cancel_page_flip(crtc, file); |
| 571 | 579 | ||
| 572 | list_for_each_entry_safe(context, tmp, &fpriv->contexts, list) | 580 | list_for_each_entry_safe(context, tmp, &fpriv->contexts, list) |
| 573 | host1x_drm_context_free(context); | 581 | tegra_drm_context_free(context); |
| 574 | 582 | ||
| 575 | kfree(fpriv); | 583 | kfree(fpriv); |
| 576 | } | 584 | } |
diff --git a/drivers/gpu/host1x/drm/drm.h b/drivers/gpu/host1x/drm/drm.h index 74869d3e2d8c..dd6b98b18640 100644 --- a/drivers/gpu/host1x/drm/drm.h +++ b/drivers/gpu/host1x/drm/drm.h | |||
| @@ -46,7 +46,7 @@ struct tegra_drm { | |||
| 46 | 46 | ||
| 47 | struct host1x_client; | 47 | struct host1x_client; |
| 48 | 48 | ||
| 49 | struct host1x_drm_context { | 49 | struct tegra_drm_context { |
| 50 | struct host1x_client *client; | 50 | struct host1x_client *client; |
| 51 | struct host1x_channel *channel; | 51 | struct host1x_channel *channel; |
| 52 | struct list_head list; | 52 | struct list_head list; |
| @@ -56,9 +56,9 @@ struct host1x_client_ops { | |||
| 56 | int (*drm_init)(struct host1x_client *client, struct drm_device *drm); | 56 | int (*drm_init)(struct host1x_client *client, struct drm_device *drm); |
| 57 | int (*drm_exit)(struct host1x_client *client); | 57 | int (*drm_exit)(struct host1x_client *client); |
| 58 | int (*open_channel)(struct host1x_client *client, | 58 | int (*open_channel)(struct host1x_client *client, |
| 59 | struct host1x_drm_context *context); | 59 | struct tegra_drm_context *context); |
| 60 | void (*close_channel)(struct host1x_drm_context *context); | 60 | void (*close_channel)(struct tegra_drm_context *context); |
| 61 | int (*submit)(struct host1x_drm_context *context, | 61 | int (*submit)(struct tegra_drm_context *context, |
| 62 | struct drm_tegra_submit *args, struct drm_device *drm, | 62 | struct drm_tegra_submit *args, struct drm_device *drm, |
| 63 | struct drm_file *file); | 63 | struct drm_file *file); |
| 64 | }; | 64 | }; |
diff --git a/drivers/gpu/host1x/drm/gr2d.c b/drivers/gpu/host1x/drm/gr2d.c index 5f838b191d05..06507c838d43 100644 --- a/drivers/gpu/host1x/drm/gr2d.c +++ b/drivers/gpu/host1x/drm/gr2d.c | |||
| @@ -58,7 +58,7 @@ static int gr2d_client_exit(struct host1x_client *client) | |||
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | static int gr2d_open_channel(struct host1x_client *client, | 60 | static int gr2d_open_channel(struct host1x_client *client, |
| 61 | struct host1x_drm_context *context) | 61 | struct tegra_drm_context *context) |
| 62 | { | 62 | { |
| 63 | struct gr2d *gr2d = to_gr2d(client); | 63 | struct gr2d *gr2d = to_gr2d(client); |
| 64 | 64 | ||
| @@ -70,7 +70,7 @@ static int gr2d_open_channel(struct host1x_client *client, | |||
| 70 | return 0; | 70 | return 0; |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | static void gr2d_close_channel(struct host1x_drm_context *context) | 73 | static void gr2d_close_channel(struct tegra_drm_context *context) |
| 74 | { | 74 | { |
| 75 | host1x_channel_put(context->channel); | 75 | host1x_channel_put(context->channel); |
| 76 | } | 76 | } |
| @@ -94,7 +94,7 @@ static struct host1x_bo *host1x_bo_lookup(struct drm_device *drm, | |||
| 94 | return &bo->base; | 94 | return &bo->base; |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | static int gr2d_submit(struct host1x_drm_context *context, | 97 | static int gr2d_submit(struct tegra_drm_context *context, |
| 98 | struct drm_tegra_submit *args, struct drm_device *drm, | 98 | struct drm_tegra_submit *args, struct drm_device *drm, |
| 99 | struct drm_file *file) | 99 | struct drm_file *file) |
| 100 | { | 100 | { |
