|
@@ -1,18 +1,13 @@
|
|
|
-/**
|
|
|
- * \file drm_bufs.c
|
|
|
- * Generic buffer template
|
|
|
- *
|
|
|
- * \author Rickard E. (Rik) Faith <faith@valinux.com>
|
|
|
- * \author Gareth Hughes <gareth@valinux.com>
|
|
|
- */
|
|
|
-
|
|
|
/*
|
|
|
- * Created: Thu Nov 23 03:10:50 2000 by gareth@valinux.com
|
|
|
+ * Legacy: Generic DRM Buffer Management
|
|
|
*
|
|
|
* Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
|
|
|
* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
|
|
|
* All Rights Reserved.
|
|
|
*
|
|
|
+ * Author: Rickard E. (Rik) Faith <faith@valinux.com>
|
|
|
+ * Author: Gareth Hughes <gareth@valinux.com>
|
|
|
+ *
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
@@ -39,6 +34,7 @@
|
|
|
#include <linux/export.h>
|
|
|
#include <asm/shmparam.h>
|
|
|
#include <drm/drmP.h>
|
|
|
+#include "drm_legacy.h"
|
|
|
|
|
|
static struct drm_map_list *drm_find_matching_map(struct drm_device *dev,
|
|
|
struct drm_local_map *map)
|
|
@@ -365,9 +361,9 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset,
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-int drm_addmap(struct drm_device * dev, resource_size_t offset,
|
|
|
- unsigned int size, enum drm_map_type type,
|
|
|
- enum drm_map_flags flags, struct drm_local_map ** map_ptr)
|
|
|
+int drm_legacy_addmap(struct drm_device * dev, resource_size_t offset,
|
|
|
+ unsigned int size, enum drm_map_type type,
|
|
|
+ enum drm_map_flags flags, struct drm_local_map **map_ptr)
|
|
|
{
|
|
|
struct drm_map_list *list;
|
|
|
int rc;
|
|
@@ -377,8 +373,7 @@ int drm_addmap(struct drm_device * dev, resource_size_t offset,
|
|
|
*map_ptr = list->map;
|
|
|
return rc;
|
|
|
}
|
|
|
-
|
|
|
-EXPORT_SYMBOL(drm_addmap);
|
|
|
+EXPORT_SYMBOL(drm_legacy_addmap);
|
|
|
|
|
|
/**
|
|
|
* Ioctl to specify a range of memory that is available for mapping by a
|
|
@@ -391,8 +386,8 @@ EXPORT_SYMBOL(drm_addmap);
|
|
|
* \return zero on success or a negative value on error.
|
|
|
*
|
|
|
*/
|
|
|
-int drm_addmap_ioctl(struct drm_device *dev, void *data,
|
|
|
- struct drm_file *file_priv)
|
|
|
+int drm_legacy_addmap_ioctl(struct drm_device *dev, void *data,
|
|
|
+ struct drm_file *file_priv)
|
|
|
{
|
|
|
struct drm_map *map = data;
|
|
|
struct drm_map_list *maplist;
|
|
@@ -429,9 +424,9 @@ int drm_addmap_ioctl(struct drm_device *dev, void *data,
|
|
|
* its being used, and free any associate resource (such as MTRR's) if it's not
|
|
|
* being on use.
|
|
|
*
|
|
|
- * \sa drm_addmap
|
|
|
+ * \sa drm_legacy_addmap
|
|
|
*/
|
|
|
-int drm_rmmap_locked(struct drm_device *dev, struct drm_local_map *map)
|
|
|
+int drm_legacy_rmmap_locked(struct drm_device *dev, struct drm_local_map *map)
|
|
|
{
|
|
|
struct drm_map_list *r_list = NULL, *list_t;
|
|
|
drm_dma_handle_t dmah;
|
|
@@ -485,19 +480,19 @@ int drm_rmmap_locked(struct drm_device *dev, struct drm_local_map *map)
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
-EXPORT_SYMBOL(drm_rmmap_locked);
|
|
|
+EXPORT_SYMBOL(drm_legacy_rmmap_locked);
|
|
|
|
|
|
-int drm_rmmap(struct drm_device *dev, struct drm_local_map *map)
|
|
|
+int drm_legacy_rmmap(struct drm_device *dev, struct drm_local_map *map)
|
|
|
{
|
|
|
int ret;
|
|
|
|
|
|
mutex_lock(&dev->struct_mutex);
|
|
|
- ret = drm_rmmap_locked(dev, map);
|
|
|
+ ret = drm_legacy_rmmap_locked(dev, map);
|
|
|
mutex_unlock(&dev->struct_mutex);
|
|
|
|
|
|
return ret;
|
|
|
}
|
|
|
-EXPORT_SYMBOL(drm_rmmap);
|
|
|
+EXPORT_SYMBOL(drm_legacy_rmmap);
|
|
|
|
|
|
/* The rmmap ioctl appears to be unnecessary. All mappings are torn down on
|
|
|
* the last close of the device, and this is necessary for cleanup when things
|
|
@@ -514,8 +509,8 @@ EXPORT_SYMBOL(drm_rmmap);
|
|
|
* \param arg pointer to a struct drm_map structure.
|
|
|
* \return zero on success or a negative value on error.
|
|
|
*/
|
|
|
-int drm_rmmap_ioctl(struct drm_device *dev, void *data,
|
|
|
- struct drm_file *file_priv)
|
|
|
+int drm_legacy_rmmap_ioctl(struct drm_device *dev, void *data,
|
|
|
+ struct drm_file *file_priv)
|
|
|
{
|
|
|
struct drm_map *request = data;
|
|
|
struct drm_local_map *map = NULL;
|
|
@@ -546,7 +541,7 @@ int drm_rmmap_ioctl(struct drm_device *dev, void *data,
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
- ret = drm_rmmap_locked(dev, map);
|
|
|
+ ret = drm_legacy_rmmap_locked(dev, map);
|
|
|
|
|
|
mutex_unlock(&dev->struct_mutex);
|
|
|
|
|
@@ -599,7 +594,8 @@ static void drm_cleanup_buf_error(struct drm_device * dev,
|
|
|
* reallocates the buffer list of the same size order to accommodate the new
|
|
|
* buffers.
|
|
|
*/
|
|
|
-int drm_addbufs_agp(struct drm_device * dev, struct drm_buf_desc * request)
|
|
|
+int drm_legacy_addbufs_agp(struct drm_device *dev,
|
|
|
+ struct drm_buf_desc *request)
|
|
|
{
|
|
|
struct drm_device_dma *dma = dev->dma;
|
|
|
struct drm_buf_entry *entry;
|
|
@@ -759,10 +755,11 @@ int drm_addbufs_agp(struct drm_device * dev, struct drm_buf_desc * request)
|
|
|
atomic_dec(&dev->buf_alloc);
|
|
|
return 0;
|
|
|
}
|
|
|
-EXPORT_SYMBOL(drm_addbufs_agp);
|
|
|
+EXPORT_SYMBOL(drm_legacy_addbufs_agp);
|
|
|
#endif /* __OS_HAS_AGP */
|
|
|
|
|
|
-int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request)
|
|
|
+int drm_legacy_addbufs_pci(struct drm_device *dev,
|
|
|
+ struct drm_buf_desc *request)
|
|
|
{
|
|
|
struct drm_device_dma *dma = dev->dma;
|
|
|
int count;
|
|
@@ -964,9 +961,10 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request)
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
-EXPORT_SYMBOL(drm_addbufs_pci);
|
|
|
+EXPORT_SYMBOL(drm_legacy_addbufs_pci);
|
|
|
|
|
|
-static int drm_addbufs_sg(struct drm_device * dev, struct drm_buf_desc * request)
|
|
|
+static int drm_legacy_addbufs_sg(struct drm_device *dev,
|
|
|
+ struct drm_buf_desc *request)
|
|
|
{
|
|
|
struct drm_device_dma *dma = dev->dma;
|
|
|
struct drm_buf_entry *entry;
|
|
@@ -1135,8 +1133,8 @@ static int drm_addbufs_sg(struct drm_device * dev, struct drm_buf_desc * request
|
|
|
* addbufs_sg() or addbufs_pci() for AGP, scatter-gather or consistent
|
|
|
* PCI memory respectively.
|
|
|
*/
|
|
|
-int drm_addbufs(struct drm_device *dev, void *data,
|
|
|
- struct drm_file *file_priv)
|
|
|
+int drm_legacy_addbufs(struct drm_device *dev, void *data,
|
|
|
+ struct drm_file *file_priv)
|
|
|
{
|
|
|
struct drm_buf_desc *request = data;
|
|
|
int ret;
|
|
@@ -1149,15 +1147,15 @@ int drm_addbufs(struct drm_device *dev, void *data,
|
|
|
|
|
|
#if __OS_HAS_AGP
|
|
|
if (request->flags & _DRM_AGP_BUFFER)
|
|
|
- ret = drm_addbufs_agp(dev, request);
|
|
|
+ ret = drm_legacy_addbufs_agp(dev, request);
|
|
|
else
|
|
|
#endif
|
|
|
if (request->flags & _DRM_SG_BUFFER)
|
|
|
- ret = drm_addbufs_sg(dev, request);
|
|
|
+ ret = drm_legacy_addbufs_sg(dev, request);
|
|
|
else if (request->flags & _DRM_FB_BUFFER)
|
|
|
ret = -EINVAL;
|
|
|
else
|
|
|
- ret = drm_addbufs_pci(dev, request);
|
|
|
+ ret = drm_legacy_addbufs_pci(dev, request);
|
|
|
|
|
|
return ret;
|
|
|
}
|
|
@@ -1179,8 +1177,8 @@ int drm_addbufs(struct drm_device *dev, void *data,
|
|
|
* lock, preventing of allocating more buffers after this call. Information
|
|
|
* about each requested buffer is then copied into user space.
|
|
|
*/
|
|
|
-int drm_infobufs(struct drm_device *dev, void *data,
|
|
|
- struct drm_file *file_priv)
|
|
|
+int drm_legacy_infobufs(struct drm_device *dev, void *data,
|
|
|
+ struct drm_file *file_priv)
|
|
|
{
|
|
|
struct drm_device_dma *dma = dev->dma;
|
|
|
struct drm_buf_info *request = data;
|
|
@@ -1260,8 +1258,8 @@ int drm_infobufs(struct drm_device *dev, void *data,
|
|
|
*
|
|
|
* \note This ioctl is deprecated and mostly never used.
|
|
|
*/
|
|
|
-int drm_markbufs(struct drm_device *dev, void *data,
|
|
|
- struct drm_file *file_priv)
|
|
|
+int drm_legacy_markbufs(struct drm_device *dev, void *data,
|
|
|
+ struct drm_file *file_priv)
|
|
|
{
|
|
|
struct drm_device_dma *dma = dev->dma;
|
|
|
struct drm_buf_desc *request = data;
|
|
@@ -1307,8 +1305,8 @@ int drm_markbufs(struct drm_device *dev, void *data,
|
|
|
* Calls free_buffer() for each used buffer.
|
|
|
* This function is primarily used for debugging.
|
|
|
*/
|
|
|
-int drm_freebufs(struct drm_device *dev, void *data,
|
|
|
- struct drm_file *file_priv)
|
|
|
+int drm_legacy_freebufs(struct drm_device *dev, void *data,
|
|
|
+ struct drm_file *file_priv)
|
|
|
{
|
|
|
struct drm_device_dma *dma = dev->dma;
|
|
|
struct drm_buf_free *request = data;
|
|
@@ -1360,8 +1358,8 @@ int drm_freebufs(struct drm_device *dev, void *data,
|
|
|
* offset equal to 0, which drm_mmap() interpretes as PCI buffers and calls
|
|
|
* drm_mmap_dma().
|
|
|
*/
|
|
|
-int drm_mapbufs(struct drm_device *dev, void *data,
|
|
|
- struct drm_file *file_priv)
|
|
|
+int drm_legacy_mapbufs(struct drm_device *dev, void *data,
|
|
|
+ struct drm_file *file_priv)
|
|
|
{
|
|
|
struct drm_device_dma *dma = dev->dma;
|
|
|
int retcode = 0;
|
|
@@ -1448,7 +1446,7 @@ int drm_mapbufs(struct drm_device *dev, void *data,
|
|
|
return retcode;
|
|
|
}
|
|
|
|
|
|
-int drm_dma_ioctl(struct drm_device *dev, void *data,
|
|
|
+int drm_legacy_dma_ioctl(struct drm_device *dev, void *data,
|
|
|
struct drm_file *file_priv)
|
|
|
{
|
|
|
if (drm_core_check_feature(dev, DRIVER_MODESET))
|
|
@@ -1460,7 +1458,7 @@ int drm_dma_ioctl(struct drm_device *dev, void *data,
|
|
|
return -EINVAL;
|
|
|
}
|
|
|
|
|
|
-struct drm_local_map *drm_getsarea(struct drm_device *dev)
|
|
|
+struct drm_local_map *drm_legacy_getsarea(struct drm_device *dev)
|
|
|
{
|
|
|
struct drm_map_list *entry;
|
|
|
|
|
@@ -1472,4 +1470,4 @@ struct drm_local_map *drm_getsarea(struct drm_device *dev)
|
|
|
}
|
|
|
return NULL;
|
|
|
}
|
|
|
-EXPORT_SYMBOL(drm_getsarea);
|
|
|
+EXPORT_SYMBOL(drm_legacy_getsarea);
|