aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/host1x
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-09-05 13:17:26 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-09-05 13:17:26 -0400
commita09e9a7a4b907f2dfa9bdb2b98a1828ab4b340b2 (patch)
treec7a2df4e887573648eeaf8f7939889046990d3f6 /drivers/gpu/host1x
parent9ab073bc45b8b523cc39658925bb44bef35ca657 (diff)
parent86a7e1224a68511d3a1ae0b7e11581b9d37723ae (diff)
Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux
Pull drm tree changes from Dave Airlie: "This is the main drm pull request, I have some overlap with sound and arm-soc, the sound patch is acked and may conflict based on -next reports but should be a trivial fixup, which I'll leave to you! Highlights: - new drivers: MSM driver from Rob Clark - non-drm: switcheroo and hdmi audio driver support for secondary GPU poweroff, so drivers can use runtime PM to poweroff the GPUs. This can save 5 or 6W on some optimus laptops. - drm core: combined GEM and TTM VMA manager per-filp mmap permission tracking initial rendernode support (via a runtime enable for now, until we get api stable), remove old proc support, lots of cleanups of legacy code hdmi vendor infoframes and 4k modes lots of gem/prime locking and races fixes async pageflip scaffolding drm bridge objects - i915: Haswell PC8+ support and eLLC support, HDMI 4K support, initial per-process VMA pieces, watermark reworks, convert to generic hdmi infoframes, encoder reworking, fastboot support, - radeon: CIK PM support, remove 3d blit code in favour of DMA engines, Berlin GPU support, HDMI audio fixes - nouveau: secondary GPU power down support for optimus laptops, lots of fixes, use MSI, VP3 engine support - exynos: runtime pm support for g2d, DT support, remove non-DT, - tda998x i2c driver: lots of fixes for sync issues - gma500: lots of cleanups - rcar: add LVDS support, fbdev emulation, - tegra: just minor fixes" * 'drm-next' of git://people.freedesktop.org/~airlied/linux: (684 commits) drm/exynos: Fix build error with exynos_drm_connector.c drm/exynos: Remove non-DT support in exynos_drm_fimd drm/exynos: Remove non-DT support in exynos_hdmi drm/exynos: Remove non-DT support in exynos_drm_g2d drm/exynos: Remove non-DT support in exynos_hdmiphy drm/exynos: Remove non-DT support in exynos_ddc drm/exynos: Make Exynos DRM drivers depend on OF drm/exynos: Consider fallback option to allocation fail drm/exynos: fimd: move platform data parsing to separate function drm/exynos: fimd: get signal polarities from device tree drm/exynos: fimd: replace struct fb_videomode with videomode drm/exynos: check a pixel format to a particular window layer drm/exynos: fix fimd pixel format setting drm/exynos: Add NULL pointer check drm/exynos: Remove redundant error messages drm/exynos: Add missing of.h header include drm/exynos: Remove redundant NULL check in exynos_drm_buf drm/exynos: add device tree support for rotator drm/exynos: Add missing includes drm/exynos: add runtime pm interfaces to g2d driver ...
Diffstat (limited to 'drivers/gpu/host1x')
-rw-r--r--drivers/gpu/host1x/dev.c2
-rw-r--r--drivers/gpu/host1x/dev.h2
-rw-r--r--drivers/gpu/host1x/drm/dc.c2
-rw-r--r--drivers/gpu/host1x/drm/drm.c7
-rw-r--r--drivers/gpu/host1x/drm/gem.c16
-rw-r--r--drivers/gpu/host1x/drm/gem.h3
-rw-r--r--drivers/gpu/host1x/drm/hdmi.c27
-rw-r--r--drivers/gpu/host1x/drm/rgb.c14
-rw-r--r--drivers/gpu/host1x/job.c15
9 files changed, 31 insertions, 57 deletions
diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c
index 28e28a23d444..471630299878 100644
--- a/drivers/gpu/host1x/dev.c
+++ b/drivers/gpu/host1x/dev.c
@@ -43,7 +43,7 @@ void host1x_set_drm_data(struct device *dev, void *data)
43void *host1x_get_drm_data(struct device *dev) 43void *host1x_get_drm_data(struct device *dev)
44{ 44{
45 struct host1x *host1x = dev_get_drvdata(dev); 45 struct host1x *host1x = dev_get_drvdata(dev);
46 return host1x->drm_data; 46 return host1x ? host1x->drm_data : NULL;
47} 47}
48 48
49void host1x_sync_writel(struct host1x *host1x, u32 v, u32 r) 49void host1x_sync_writel(struct host1x *host1x, u32 v, u32 r)
diff --git a/drivers/gpu/host1x/dev.h b/drivers/gpu/host1x/dev.h
index 790ddf114e58..bed90a8131be 100644
--- a/drivers/gpu/host1x/dev.h
+++ b/drivers/gpu/host1x/dev.h
@@ -301,8 +301,8 @@ static inline void host1x_hw_show_mlocks(struct host1x *host, struct output *o)
301 host->debug_op->show_mlocks(host, o); 301 host->debug_op->show_mlocks(host, o);
302} 302}
303 303
304extern struct platform_driver tegra_hdmi_driver;
305extern struct platform_driver tegra_dc_driver; 304extern struct platform_driver tegra_dc_driver;
305extern struct platform_driver tegra_hdmi_driver;
306extern struct platform_driver tegra_gr2d_driver; 306extern struct platform_driver tegra_gr2d_driver;
307 307
308#endif 308#endif
diff --git a/drivers/gpu/host1x/drm/dc.c b/drivers/gpu/host1x/drm/dc.c
index 5360e5a57ecc..b1a05ad901c3 100644
--- a/drivers/gpu/host1x/drm/dc.c
+++ b/drivers/gpu/host1x/drm/dc.c
@@ -235,7 +235,7 @@ void tegra_dc_cancel_page_flip(struct drm_crtc *crtc, struct drm_file *file)
235} 235}
236 236
237static int tegra_dc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, 237static int tegra_dc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb,
238 struct drm_pending_vblank_event *event) 238 struct drm_pending_vblank_event *event, uint32_t page_flip_flags)
239{ 239{
240 struct tegra_dc *dc = to_tegra_dc(crtc); 240 struct tegra_dc *dc = to_tegra_dc(crtc);
241 struct drm_device *drm = crtc->dev; 241 struct drm_device *drm = crtc->dev;
diff --git a/drivers/gpu/host1x/drm/drm.c b/drivers/gpu/host1x/drm/drm.c
index e184b00faacd..8c61ceeaa12d 100644
--- a/drivers/gpu/host1x/drm/drm.c
+++ b/drivers/gpu/host1x/drm/drm.c
@@ -356,7 +356,7 @@ static int tegra_gem_mmap(struct drm_device *drm, void *data,
356 356
357 bo = to_tegra_bo(gem); 357 bo = to_tegra_bo(gem);
358 358
359 args->offset = tegra_bo_get_mmap_offset(bo); 359 args->offset = drm_vma_node_offset_addr(&bo->gem.vma_node);
360 360
361 drm_gem_object_unreference(gem); 361 drm_gem_object_unreference(gem);
362 362
@@ -487,7 +487,7 @@ static int tegra_submit(struct drm_device *drm, void *data,
487} 487}
488#endif 488#endif
489 489
490static struct drm_ioctl_desc tegra_drm_ioctls[] = { 490static const struct drm_ioctl_desc tegra_drm_ioctls[] = {
491#ifdef CONFIG_DRM_TEGRA_STAGING 491#ifdef CONFIG_DRM_TEGRA_STAGING
492 DRM_IOCTL_DEF_DRV(TEGRA_GEM_CREATE, tegra_gem_create, DRM_UNLOCKED | DRM_AUTH), 492 DRM_IOCTL_DEF_DRV(TEGRA_GEM_CREATE, tegra_gem_create, DRM_UNLOCKED | DRM_AUTH),
493 DRM_IOCTL_DEF_DRV(TEGRA_GEM_MMAP, tegra_gem_mmap, DRM_UNLOCKED), 493 DRM_IOCTL_DEF_DRV(TEGRA_GEM_MMAP, tegra_gem_mmap, DRM_UNLOCKED),
@@ -508,7 +508,6 @@ static const struct file_operations tegra_drm_fops = {
508 .unlocked_ioctl = drm_ioctl, 508 .unlocked_ioctl = drm_ioctl,
509 .mmap = tegra_drm_mmap, 509 .mmap = tegra_drm_mmap,
510 .poll = drm_poll, 510 .poll = drm_poll,
511 .fasync = drm_fasync,
512 .read = drm_read, 511 .read = drm_read,
513#ifdef CONFIG_COMPAT 512#ifdef CONFIG_COMPAT
514 .compat_ioctl = drm_compat_ioctl, 513 .compat_ioctl = drm_compat_ioctl,
@@ -633,7 +632,7 @@ struct drm_driver tegra_drm_driver = {
633 .gem_vm_ops = &tegra_bo_vm_ops, 632 .gem_vm_ops = &tegra_bo_vm_ops,
634 .dumb_create = tegra_bo_dumb_create, 633 .dumb_create = tegra_bo_dumb_create,
635 .dumb_map_offset = tegra_bo_dumb_map_offset, 634 .dumb_map_offset = tegra_bo_dumb_map_offset,
636 .dumb_destroy = tegra_bo_dumb_destroy, 635 .dumb_destroy = drm_gem_dumb_destroy,
637 636
638 .ioctls = tegra_drm_ioctls, 637 .ioctls = tegra_drm_ioctls,
639 .num_ioctls = ARRAY_SIZE(tegra_drm_ioctls), 638 .num_ioctls = ARRAY_SIZE(tegra_drm_ioctls),
diff --git a/drivers/gpu/host1x/drm/gem.c b/drivers/gpu/host1x/drm/gem.c
index c5e9a9b494c2..59623de4ee15 100644
--- a/drivers/gpu/host1x/drm/gem.c
+++ b/drivers/gpu/host1x/drm/gem.c
@@ -106,11 +106,6 @@ static void tegra_bo_destroy(struct drm_device *drm, struct tegra_bo *bo)
106 dma_free_writecombine(drm->dev, bo->gem.size, bo->vaddr, bo->paddr); 106 dma_free_writecombine(drm->dev, bo->gem.size, bo->vaddr, bo->paddr);
107} 107}
108 108
109unsigned int tegra_bo_get_mmap_offset(struct tegra_bo *bo)
110{
111 return (unsigned int)bo->gem.map_list.hash.key << PAGE_SHIFT;
112}
113
114struct tegra_bo *tegra_bo_create(struct drm_device *drm, unsigned int size) 109struct tegra_bo *tegra_bo_create(struct drm_device *drm, unsigned int size)
115{ 110{
116 struct tegra_bo *bo; 111 struct tegra_bo *bo;
@@ -182,8 +177,7 @@ void tegra_bo_free_object(struct drm_gem_object *gem)
182{ 177{
183 struct tegra_bo *bo = to_tegra_bo(gem); 178 struct tegra_bo *bo = to_tegra_bo(gem);
184 179
185 if (gem->map_list.map) 180 drm_gem_free_mmap_offset(gem);
186 drm_gem_free_mmap_offset(gem);
187 181
188 drm_gem_object_release(gem); 182 drm_gem_object_release(gem);
189 tegra_bo_destroy(gem->dev, bo); 183 tegra_bo_destroy(gem->dev, bo);
@@ -228,7 +222,7 @@ int tegra_bo_dumb_map_offset(struct drm_file *file, struct drm_device *drm,
228 222
229 bo = to_tegra_bo(gem); 223 bo = to_tegra_bo(gem);
230 224
231 *offset = tegra_bo_get_mmap_offset(bo); 225 *offset = drm_vma_node_offset_addr(&bo->gem.vma_node);
232 226
233 drm_gem_object_unreference(gem); 227 drm_gem_object_unreference(gem);
234 228
@@ -262,9 +256,3 @@ int tegra_drm_mmap(struct file *file, struct vm_area_struct *vma)
262 256
263 return ret; 257 return ret;
264} 258}
265
266int tegra_bo_dumb_destroy(struct drm_file *file, struct drm_device *drm,
267 unsigned int handle)
268{
269 return drm_gem_handle_delete(file, handle);
270}
diff --git a/drivers/gpu/host1x/drm/gem.h b/drivers/gpu/host1x/drm/gem.h
index 34de2b486eb7..492533a2dacb 100644
--- a/drivers/gpu/host1x/drm/gem.h
+++ b/drivers/gpu/host1x/drm/gem.h
@@ -44,13 +44,10 @@ struct tegra_bo *tegra_bo_create_with_handle(struct drm_file *file,
44 unsigned int size, 44 unsigned int size,
45 unsigned int *handle); 45 unsigned int *handle);
46void tegra_bo_free_object(struct drm_gem_object *gem); 46void tegra_bo_free_object(struct drm_gem_object *gem);
47unsigned int tegra_bo_get_mmap_offset(struct tegra_bo *bo);
48int tegra_bo_dumb_create(struct drm_file *file, struct drm_device *drm, 47int tegra_bo_dumb_create(struct drm_file *file, struct drm_device *drm,
49 struct drm_mode_create_dumb *args); 48 struct drm_mode_create_dumb *args);
50int tegra_bo_dumb_map_offset(struct drm_file *file, struct drm_device *drm, 49int tegra_bo_dumb_map_offset(struct drm_file *file, struct drm_device *drm,
51 uint32_t handle, uint64_t *offset); 50 uint32_t handle, uint64_t *offset);
52int tegra_bo_dumb_destroy(struct drm_file *file, struct drm_device *drm,
53 unsigned int handle);
54 51
55int tegra_drm_mmap(struct file *file, struct vm_area_struct *vma); 52int tegra_drm_mmap(struct file *file, struct vm_area_struct *vma);
56 53
diff --git a/drivers/gpu/host1x/drm/hdmi.c b/drivers/gpu/host1x/drm/hdmi.c
index 01097da09f7f..644d95c7d489 100644
--- a/drivers/gpu/host1x/drm/hdmi.c
+++ b/drivers/gpu/host1x/drm/hdmi.c
@@ -551,24 +551,8 @@ static void tegra_hdmi_setup_stereo_infoframe(struct tegra_hdmi *hdmi)
551 return; 551 return;
552 } 552 }
553 553
554 memset(&frame, 0, sizeof(frame)); 554 hdmi_vendor_infoframe_init(&frame);
555 555 frame.s3d_struct = HDMI_3D_STRUCTURE_FRAME_PACKING;
556 frame.type = HDMI_INFOFRAME_TYPE_VENDOR;
557 frame.version = 0x01;
558 frame.length = 6;
559
560 frame.data[0] = 0x03; /* regid0 */
561 frame.data[1] = 0x0c; /* regid1 */
562 frame.data[2] = 0x00; /* regid2 */
563 frame.data[3] = 0x02 << 5; /* video format */
564
565 /* TODO: 74 MHz limit? */
566 if (1) {
567 frame.data[4] = 0x00 << 4; /* 3D structure */
568 } else {
569 frame.data[4] = 0x08 << 4; /* 3D structure */
570 frame.data[5] = 0x00 << 4; /* 3D ext. data */
571 }
572 556
573 err = hdmi_vendor_infoframe_pack(&frame, buffer, sizeof(buffer)); 557 err = hdmi_vendor_infoframe_pack(&frame, buffer, sizeof(buffer));
574 if (err < 0) { 558 if (err < 0) {
@@ -904,6 +888,11 @@ static int tegra_hdmi_show_regs(struct seq_file *s, void *data)
904{ 888{
905 struct drm_info_node *node = s->private; 889 struct drm_info_node *node = s->private;
906 struct tegra_hdmi *hdmi = node->info_ent->data; 890 struct tegra_hdmi *hdmi = node->info_ent->data;
891 int err;
892
893 err = clk_enable(hdmi->clk);
894 if (err)
895 return err;
907 896
908#define DUMP_REG(name) \ 897#define DUMP_REG(name) \
909 seq_printf(s, "%-56s %#05x %08lx\n", #name, name, \ 898 seq_printf(s, "%-56s %#05x %08lx\n", #name, name, \
@@ -1069,6 +1058,8 @@ static int tegra_hdmi_show_regs(struct seq_file *s, void *data)
1069 1058
1070#undef DUMP_REG 1059#undef DUMP_REG
1071 1060
1061 clk_disable(hdmi->clk);
1062
1072 return 0; 1063 return 0;
1073} 1064}
1074 1065
diff --git a/drivers/gpu/host1x/drm/rgb.c b/drivers/gpu/host1x/drm/rgb.c
index ed4416f20260..5aa66ef7a946 100644
--- a/drivers/gpu/host1x/drm/rgb.c
+++ b/drivers/gpu/host1x/drm/rgb.c
@@ -147,6 +147,13 @@ int tegra_dc_rgb_probe(struct tegra_dc *dc)
147 if (!rgb) 147 if (!rgb)
148 return -ENOMEM; 148 return -ENOMEM;
149 149
150 rgb->output.dev = dc->dev;
151 rgb->output.of_node = np;
152
153 err = tegra_output_parse_dt(&rgb->output);
154 if (err < 0)
155 return err;
156
150 rgb->clk = devm_clk_get(dc->dev, NULL); 157 rgb->clk = devm_clk_get(dc->dev, NULL);
151 if (IS_ERR(rgb->clk)) { 158 if (IS_ERR(rgb->clk)) {
152 dev_err(dc->dev, "failed to get clock\n"); 159 dev_err(dc->dev, "failed to get clock\n");
@@ -165,13 +172,6 @@ int tegra_dc_rgb_probe(struct tegra_dc *dc)
165 return err; 172 return err;
166 } 173 }
167 174
168 rgb->output.dev = dc->dev;
169 rgb->output.of_node = np;
170
171 err = tegra_output_parse_dt(&rgb->output);
172 if (err < 0)
173 return err;
174
175 dc->rgb = &rgb->output; 175 dc->rgb = &rgb->output;
176 176
177 return 0; 177 return 0;
diff --git a/drivers/gpu/host1x/job.c b/drivers/gpu/host1x/job.c
index cc807667d8f1..c4e1050f2252 100644
--- a/drivers/gpu/host1x/job.c
+++ b/drivers/gpu/host1x/job.c
@@ -42,12 +42,12 @@ struct host1x_job *host1x_job_alloc(struct host1x_channel *ch,
42 42
43 /* Check that we're not going to overflow */ 43 /* Check that we're not going to overflow */
44 total = sizeof(struct host1x_job) + 44 total = sizeof(struct host1x_job) +
45 num_relocs * sizeof(struct host1x_reloc) + 45 (u64)num_relocs * sizeof(struct host1x_reloc) +
46 num_unpins * sizeof(struct host1x_job_unpin_data) + 46 (u64)num_unpins * sizeof(struct host1x_job_unpin_data) +
47 num_waitchks * sizeof(struct host1x_waitchk) + 47 (u64)num_waitchks * sizeof(struct host1x_waitchk) +
48 num_cmdbufs * sizeof(struct host1x_job_gather) + 48 (u64)num_cmdbufs * sizeof(struct host1x_job_gather) +
49 num_unpins * sizeof(dma_addr_t) + 49 (u64)num_unpins * sizeof(dma_addr_t) +
50 num_unpins * sizeof(u32 *); 50 (u64)num_unpins * sizeof(u32 *);
51 if (total > ULONG_MAX) 51 if (total > ULONG_MAX)
52 return NULL; 52 return NULL;
53 53
@@ -466,9 +466,8 @@ static inline int copy_gathers(struct host1x_job *job, struct device *dev)
466 &job->gather_copy, 466 &job->gather_copy,
467 GFP_KERNEL); 467 GFP_KERNEL);
468 if (!job->gather_copy_mapped) { 468 if (!job->gather_copy_mapped) {
469 int err = PTR_ERR(job->gather_copy_mapped);
470 job->gather_copy_mapped = NULL; 469 job->gather_copy_mapped = NULL;
471 return err; 470 return -ENOMEM;
472 } 471 }
473 472
474 job->gather_copy_size = size; 473 job->gather_copy_size = size;