aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_bufs.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-10-14 03:39:08 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-10-14 03:39:08 -0400
commit2d65a9f48fcdf7866aab6457bc707ca233e0c791 (patch)
treef93e5838d6ac2e59434367f4ff905f7d9c45fc2b /drivers/gpu/drm/drm_bufs.c
parentda92da3638a04894afdca8b99e973ddd20268471 (diff)
parentdfda0df3426483cf5fc7441f23f318edbabecb03 (diff)
Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux
Pull drm updates from Dave Airlie: "This is the main git pull for the drm, I pretty much froze major pulls at -rc5/6 time, and haven't had much fallout, so will probably continue doing that. Lots of changes all over, big internal header cleanup to make it clear drm features are legacy things and what are things that modern KMS drivers should be using. Also big move to use the new generic fences in all the TTM drivers. core: atomic prep work, vblank rework changes, allows immediate vblank disables major header reworking and cleanups to better delinate legacy interfaces from what KMS drivers should be using. cursor planes locking fixes ttm: move to generic fences (affects all TTM drivers) ppc64 caching fixes radeon: userptr support, uvd for old asics, reset rework for fence changes better buffer placement changes, dpm feature enablement hdmi audio support fixes intel: Cherryview work, 180 degree rotation, skylake prep work, execlist command submission full ppgtt prep work cursor improvements edid caching, vdd handling improvements nouveau: fence reworking kepler memory clock work gt21x clock work fan control improvements hdmi infoframe fixes DP audio ast: ppc64 fixes caching fix rcar: rcar-du DT support ipuv3: prep work for capture support msm: LVDS support for mdp4, new panel, gpu refactoring exynos: exynos3250 SoC support, drop bad mmap interface, mipi dsi changes, and component match support" * 'drm-next' of git://people.freedesktop.org/~airlied/linux: (640 commits) drm/mst: rework payload table allocation to conform better. drm/ast: Fix HW cursor image drm/radeon/kv: add uvd/vce info to dpm debugfs output drm/radeon/ci: add uvd/vce info to dpm debugfs output drm/radeon: export reservation_object from dmabuf to ttm drm/radeon: cope with foreign fences inside the reservation object drm/radeon: cope with foreign fences inside display drm/core: use helper to check driver features drm/radeon/cik: write gfx ucode version to ucode addr reg drm/radeon/si: print full CS when we hit a packet 0 drm/radeon: remove unecessary includes drm/radeon/combios: declare legacy_connector_convert as static drm/radeon/atombios: declare connector convert tables as static drm/radeon: drop btc_get_max_clock_from_voltage_dependency_table drm/radeon/dpm: drop clk/voltage dependency filters for BTC drm/radeon/dpm: drop clk/voltage dependency filters for CI drm/radeon/dpm: drop clk/voltage dependency filters for SI drm/radeon/dpm: drop clk/voltage dependency filters for NI drm/radeon: disable audio when we disable hdmi (v2) drm/radeon: split audio enable between eg and r600 (v2) ...
Diffstat (limited to 'drivers/gpu/drm/drm_bufs.c')
-rw-r--r--drivers/gpu/drm/drm_bufs.c94
1 files changed, 46 insertions, 48 deletions
diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
index 61acb8f6756d..569064a00693 100644
--- a/drivers/gpu/drm/drm_bufs.c
+++ b/drivers/gpu/drm/drm_bufs.c
@@ -1,18 +1,13 @@
1/**
2 * \file drm_bufs.c
3 * Generic buffer template
4 *
5 * \author Rickard E. (Rik) Faith <faith@valinux.com>
6 * \author Gareth Hughes <gareth@valinux.com>
7 */
8
9/* 1/*
10 * Created: Thu Nov 23 03:10:50 2000 by gareth@valinux.com 2 * Legacy: Generic DRM Buffer Management
11 * 3 *
12 * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. 4 * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
13 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. 5 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
14 * All Rights Reserved. 6 * All Rights Reserved.
15 * 7 *
8 * Author: Rickard E. (Rik) Faith <faith@valinux.com>
9 * Author: Gareth Hughes <gareth@valinux.com>
10 *
16 * Permission is hereby granted, free of charge, to any person obtaining a 11 * Permission is hereby granted, free of charge, to any person obtaining a
17 * copy of this software and associated documentation files (the "Software"), 12 * copy of this software and associated documentation files (the "Software"),
18 * to deal in the Software without restriction, including without limitation 13 * to deal in the Software without restriction, including without limitation
@@ -39,6 +34,7 @@
39#include <linux/export.h> 34#include <linux/export.h>
40#include <asm/shmparam.h> 35#include <asm/shmparam.h>
41#include <drm/drmP.h> 36#include <drm/drmP.h>
37#include "drm_legacy.h"
42 38
43static struct drm_map_list *drm_find_matching_map(struct drm_device *dev, 39static struct drm_map_list *drm_find_matching_map(struct drm_device *dev,
44 struct drm_local_map *map) 40 struct drm_local_map *map)
@@ -365,9 +361,9 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset,
365 return 0; 361 return 0;
366} 362}
367 363
368int drm_addmap(struct drm_device * dev, resource_size_t offset, 364int drm_legacy_addmap(struct drm_device * dev, resource_size_t offset,
369 unsigned int size, enum drm_map_type type, 365 unsigned int size, enum drm_map_type type,
370 enum drm_map_flags flags, struct drm_local_map ** map_ptr) 366 enum drm_map_flags flags, struct drm_local_map **map_ptr)
371{ 367{
372 struct drm_map_list *list; 368 struct drm_map_list *list;
373 int rc; 369 int rc;
@@ -377,8 +373,7 @@ int drm_addmap(struct drm_device * dev, resource_size_t offset,
377 *map_ptr = list->map; 373 *map_ptr = list->map;
378 return rc; 374 return rc;
379} 375}
380 376EXPORT_SYMBOL(drm_legacy_addmap);
381EXPORT_SYMBOL(drm_addmap);
382 377
383/** 378/**
384 * Ioctl to specify a range of memory that is available for mapping by a 379 * Ioctl to specify a range of memory that is available for mapping by a
@@ -391,8 +386,8 @@ EXPORT_SYMBOL(drm_addmap);
391 * \return zero on success or a negative value on error. 386 * \return zero on success or a negative value on error.
392 * 387 *
393 */ 388 */
394int drm_addmap_ioctl(struct drm_device *dev, void *data, 389int drm_legacy_addmap_ioctl(struct drm_device *dev, void *data,
395 struct drm_file *file_priv) 390 struct drm_file *file_priv)
396{ 391{
397 struct drm_map *map = data; 392 struct drm_map *map = data;
398 struct drm_map_list *maplist; 393 struct drm_map_list *maplist;
@@ -429,9 +424,9 @@ int drm_addmap_ioctl(struct drm_device *dev, void *data,
429 * its being used, and free any associate resource (such as MTRR's) if it's not 424 * its being used, and free any associate resource (such as MTRR's) if it's not
430 * being on use. 425 * being on use.
431 * 426 *
432 * \sa drm_addmap 427 * \sa drm_legacy_addmap
433 */ 428 */
434int drm_rmmap_locked(struct drm_device *dev, struct drm_local_map *map) 429int drm_legacy_rmmap_locked(struct drm_device *dev, struct drm_local_map *map)
435{ 430{
436 struct drm_map_list *r_list = NULL, *list_t; 431 struct drm_map_list *r_list = NULL, *list_t;
437 drm_dma_handle_t dmah; 432 drm_dma_handle_t dmah;
@@ -478,26 +473,26 @@ int drm_rmmap_locked(struct drm_device *dev, struct drm_local_map *map)
478 dmah.vaddr = map->handle; 473 dmah.vaddr = map->handle;
479 dmah.busaddr = map->offset; 474 dmah.busaddr = map->offset;
480 dmah.size = map->size; 475 dmah.size = map->size;
481 __drm_pci_free(dev, &dmah); 476 __drm_legacy_pci_free(dev, &dmah);
482 break; 477 break;
483 } 478 }
484 kfree(map); 479 kfree(map);
485 480
486 return 0; 481 return 0;
487} 482}
488EXPORT_SYMBOL(drm_rmmap_locked); 483EXPORT_SYMBOL(drm_legacy_rmmap_locked);
489 484
490int drm_rmmap(struct drm_device *dev, struct drm_local_map *map) 485int drm_legacy_rmmap(struct drm_device *dev, struct drm_local_map *map)
491{ 486{
492 int ret; 487 int ret;
493 488
494 mutex_lock(&dev->struct_mutex); 489 mutex_lock(&dev->struct_mutex);
495 ret = drm_rmmap_locked(dev, map); 490 ret = drm_legacy_rmmap_locked(dev, map);
496 mutex_unlock(&dev->struct_mutex); 491 mutex_unlock(&dev->struct_mutex);
497 492
498 return ret; 493 return ret;
499} 494}
500EXPORT_SYMBOL(drm_rmmap); 495EXPORT_SYMBOL(drm_legacy_rmmap);
501 496
502/* The rmmap ioctl appears to be unnecessary. All mappings are torn down on 497/* The rmmap ioctl appears to be unnecessary. All mappings are torn down on
503 * the last close of the device, and this is necessary for cleanup when things 498 * the last close of the device, and this is necessary for cleanup when things
@@ -514,8 +509,8 @@ EXPORT_SYMBOL(drm_rmmap);
514 * \param arg pointer to a struct drm_map structure. 509 * \param arg pointer to a struct drm_map structure.
515 * \return zero on success or a negative value on error. 510 * \return zero on success or a negative value on error.
516 */ 511 */
517int drm_rmmap_ioctl(struct drm_device *dev, void *data, 512int drm_legacy_rmmap_ioctl(struct drm_device *dev, void *data,
518 struct drm_file *file_priv) 513 struct drm_file *file_priv)
519{ 514{
520 struct drm_map *request = data; 515 struct drm_map *request = data;
521 struct drm_local_map *map = NULL; 516 struct drm_local_map *map = NULL;
@@ -546,7 +541,7 @@ int drm_rmmap_ioctl(struct drm_device *dev, void *data,
546 return 0; 541 return 0;
547 } 542 }
548 543
549 ret = drm_rmmap_locked(dev, map); 544 ret = drm_legacy_rmmap_locked(dev, map);
550 545
551 mutex_unlock(&dev->struct_mutex); 546 mutex_unlock(&dev->struct_mutex);
552 547
@@ -599,7 +594,8 @@ static void drm_cleanup_buf_error(struct drm_device * dev,
599 * reallocates the buffer list of the same size order to accommodate the new 594 * reallocates the buffer list of the same size order to accommodate the new
600 * buffers. 595 * buffers.
601 */ 596 */
602int drm_addbufs_agp(struct drm_device * dev, struct drm_buf_desc * request) 597int drm_legacy_addbufs_agp(struct drm_device *dev,
598 struct drm_buf_desc *request)
603{ 599{
604 struct drm_device_dma *dma = dev->dma; 600 struct drm_device_dma *dma = dev->dma;
605 struct drm_buf_entry *entry; 601 struct drm_buf_entry *entry;
@@ -759,10 +755,11 @@ int drm_addbufs_agp(struct drm_device * dev, struct drm_buf_desc * request)
759 atomic_dec(&dev->buf_alloc); 755 atomic_dec(&dev->buf_alloc);
760 return 0; 756 return 0;
761} 757}
762EXPORT_SYMBOL(drm_addbufs_agp); 758EXPORT_SYMBOL(drm_legacy_addbufs_agp);
763#endif /* __OS_HAS_AGP */ 759#endif /* __OS_HAS_AGP */
764 760
765int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request) 761int drm_legacy_addbufs_pci(struct drm_device *dev,
762 struct drm_buf_desc *request)
766{ 763{
767 struct drm_device_dma *dma = dev->dma; 764 struct drm_device_dma *dma = dev->dma;
768 int count; 765 int count;
@@ -964,9 +961,10 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request)
964 return 0; 961 return 0;
965 962
966} 963}
967EXPORT_SYMBOL(drm_addbufs_pci); 964EXPORT_SYMBOL(drm_legacy_addbufs_pci);
968 965
969static int drm_addbufs_sg(struct drm_device * dev, struct drm_buf_desc * request) 966static int drm_legacy_addbufs_sg(struct drm_device *dev,
967 struct drm_buf_desc *request)
970{ 968{
971 struct drm_device_dma *dma = dev->dma; 969 struct drm_device_dma *dma = dev->dma;
972 struct drm_buf_entry *entry; 970 struct drm_buf_entry *entry;
@@ -1135,8 +1133,8 @@ static int drm_addbufs_sg(struct drm_device * dev, struct drm_buf_desc * request
1135 * addbufs_sg() or addbufs_pci() for AGP, scatter-gather or consistent 1133 * addbufs_sg() or addbufs_pci() for AGP, scatter-gather or consistent
1136 * PCI memory respectively. 1134 * PCI memory respectively.
1137 */ 1135 */
1138int drm_addbufs(struct drm_device *dev, void *data, 1136int drm_legacy_addbufs(struct drm_device *dev, void *data,
1139 struct drm_file *file_priv) 1137 struct drm_file *file_priv)
1140{ 1138{
1141 struct drm_buf_desc *request = data; 1139 struct drm_buf_desc *request = data;
1142 int ret; 1140 int ret;
@@ -1149,15 +1147,15 @@ int drm_addbufs(struct drm_device *dev, void *data,
1149 1147
1150#if __OS_HAS_AGP 1148#if __OS_HAS_AGP
1151 if (request->flags & _DRM_AGP_BUFFER) 1149 if (request->flags & _DRM_AGP_BUFFER)
1152 ret = drm_addbufs_agp(dev, request); 1150 ret = drm_legacy_addbufs_agp(dev, request);
1153 else 1151 else
1154#endif 1152#endif
1155 if (request->flags & _DRM_SG_BUFFER) 1153 if (request->flags & _DRM_SG_BUFFER)
1156 ret = drm_addbufs_sg(dev, request); 1154 ret = drm_legacy_addbufs_sg(dev, request);
1157 else if (request->flags & _DRM_FB_BUFFER) 1155 else if (request->flags & _DRM_FB_BUFFER)
1158 ret = -EINVAL; 1156 ret = -EINVAL;
1159 else 1157 else
1160 ret = drm_addbufs_pci(dev, request); 1158 ret = drm_legacy_addbufs_pci(dev, request);
1161 1159
1162 return ret; 1160 return ret;
1163} 1161}
@@ -1179,8 +1177,8 @@ int drm_addbufs(struct drm_device *dev, void *data,
1179 * lock, preventing of allocating more buffers after this call. Information 1177 * lock, preventing of allocating more buffers after this call. Information
1180 * about each requested buffer is then copied into user space. 1178 * about each requested buffer is then copied into user space.
1181 */ 1179 */
1182int drm_infobufs(struct drm_device *dev, void *data, 1180int drm_legacy_infobufs(struct drm_device *dev, void *data,
1183 struct drm_file *file_priv) 1181 struct drm_file *file_priv)
1184{ 1182{
1185 struct drm_device_dma *dma = dev->dma; 1183 struct drm_device_dma *dma = dev->dma;
1186 struct drm_buf_info *request = data; 1184 struct drm_buf_info *request = data;
@@ -1260,8 +1258,8 @@ int drm_infobufs(struct drm_device *dev, void *data,
1260 * 1258 *
1261 * \note This ioctl is deprecated and mostly never used. 1259 * \note This ioctl is deprecated and mostly never used.
1262 */ 1260 */
1263int drm_markbufs(struct drm_device *dev, void *data, 1261int drm_legacy_markbufs(struct drm_device *dev, void *data,
1264 struct drm_file *file_priv) 1262 struct drm_file *file_priv)
1265{ 1263{
1266 struct drm_device_dma *dma = dev->dma; 1264 struct drm_device_dma *dma = dev->dma;
1267 struct drm_buf_desc *request = data; 1265 struct drm_buf_desc *request = data;
@@ -1307,8 +1305,8 @@ int drm_markbufs(struct drm_device *dev, void *data,
1307 * Calls free_buffer() for each used buffer. 1305 * Calls free_buffer() for each used buffer.
1308 * This function is primarily used for debugging. 1306 * This function is primarily used for debugging.
1309 */ 1307 */
1310int drm_freebufs(struct drm_device *dev, void *data, 1308int drm_legacy_freebufs(struct drm_device *dev, void *data,
1311 struct drm_file *file_priv) 1309 struct drm_file *file_priv)
1312{ 1310{
1313 struct drm_device_dma *dma = dev->dma; 1311 struct drm_device_dma *dma = dev->dma;
1314 struct drm_buf_free *request = data; 1312 struct drm_buf_free *request = data;
@@ -1340,7 +1338,7 @@ int drm_freebufs(struct drm_device *dev, void *data,
1340 task_pid_nr(current)); 1338 task_pid_nr(current));
1341 return -EINVAL; 1339 return -EINVAL;
1342 } 1340 }
1343 drm_free_buffer(dev, buf); 1341 drm_legacy_free_buffer(dev, buf);
1344 } 1342 }
1345 1343
1346 return 0; 1344 return 0;
@@ -1360,8 +1358,8 @@ int drm_freebufs(struct drm_device *dev, void *data,
1360 * offset equal to 0, which drm_mmap() interpretes as PCI buffers and calls 1358 * offset equal to 0, which drm_mmap() interpretes as PCI buffers and calls
1361 * drm_mmap_dma(). 1359 * drm_mmap_dma().
1362 */ 1360 */
1363int drm_mapbufs(struct drm_device *dev, void *data, 1361int drm_legacy_mapbufs(struct drm_device *dev, void *data,
1364 struct drm_file *file_priv) 1362 struct drm_file *file_priv)
1365{ 1363{
1366 struct drm_device_dma *dma = dev->dma; 1364 struct drm_device_dma *dma = dev->dma;
1367 int retcode = 0; 1365 int retcode = 0;
@@ -1448,7 +1446,7 @@ int drm_mapbufs(struct drm_device *dev, void *data,
1448 return retcode; 1446 return retcode;
1449} 1447}
1450 1448
1451int drm_dma_ioctl(struct drm_device *dev, void *data, 1449int drm_legacy_dma_ioctl(struct drm_device *dev, void *data,
1452 struct drm_file *file_priv) 1450 struct drm_file *file_priv)
1453{ 1451{
1454 if (drm_core_check_feature(dev, DRIVER_MODESET)) 1452 if (drm_core_check_feature(dev, DRIVER_MODESET))
@@ -1460,7 +1458,7 @@ int drm_dma_ioctl(struct drm_device *dev, void *data,
1460 return -EINVAL; 1458 return -EINVAL;
1461} 1459}
1462 1460
1463struct drm_local_map *drm_getsarea(struct drm_device *dev) 1461struct drm_local_map *drm_legacy_getsarea(struct drm_device *dev)
1464{ 1462{
1465 struct drm_map_list *entry; 1463 struct drm_map_list *entry;
1466 1464
@@ -1472,4 +1470,4 @@ struct drm_local_map *drm_getsarea(struct drm_device *dev)
1472 } 1470 }
1473 return NULL; 1471 return NULL;
1474} 1472}
1475EXPORT_SYMBOL(drm_getsarea); 1473EXPORT_SYMBOL(drm_legacy_getsarea);