Home | History | Annotate | Line # | Download | only in drm
drm_legacy.h revision 1.1
      1 /*	$NetBSD: drm_legacy.h,v 1.1 2018/08/27 01:34:42 riastradh Exp $	*/
      2 
      3 #ifndef __DRM_LEGACY_H__
      4 #define __DRM_LEGACY_H__
      5 
      6 /*
      7  * Copyright (c) 2014 David Herrmann <dh.herrmann (at) gmail.com>
      8  *
      9  * Permission is hereby granted, free of charge, to any person obtaining a
     10  * copy of this software and associated documentation files (the "Software"),
     11  * to deal in the Software without restriction, including without limitation
     12  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
     13  * and/or sell copies of the Software, and to permit persons to whom the
     14  * Software is furnished to do so, subject to the following conditions:
     15  *
     16  * The above copyright notice and this permission notice shall be included in
     17  * all copies or substantial portions of the Software.
     18  *
     19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     20  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     21  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
     22  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
     23  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
     24  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
     25  * OTHER DEALINGS IN THE SOFTWARE.
     26  */
     27 
     28 /*
     29  * This file contains legacy interfaces that modern drm drivers
     30  * should no longer be using. They cannot be removed as legacy
     31  * drivers use them, and removing them are API breaks.
     32  */
     33 #include <linux/list.h>
     34 #include <drm/drm_legacy.h>
     35 
     36 struct agp_memory;
     37 struct drm_device;
     38 struct drm_file;
     39 
     40 /*
     41  * Generic DRM Contexts
     42  */
     43 
     44 #define DRM_KERNEL_CONTEXT		0
     45 #define DRM_RESERVED_CONTEXTS		1
     46 
     47 void drm_legacy_ctxbitmap_init(struct drm_device *dev);
     48 void drm_legacy_ctxbitmap_cleanup(struct drm_device *dev);
     49 void drm_legacy_ctxbitmap_free(struct drm_device *dev, int ctx_handle);
     50 void drm_legacy_ctxbitmap_flush(struct drm_device *dev, struct drm_file *file);
     51 
     52 int drm_legacy_resctx(struct drm_device *d, void *v, struct drm_file *f);
     53 int drm_legacy_addctx(struct drm_device *d, void *v, struct drm_file *f);
     54 int drm_legacy_getctx(struct drm_device *d, void *v, struct drm_file *f);
     55 int drm_legacy_switchctx(struct drm_device *d, void *v, struct drm_file *f);
     56 int drm_legacy_newctx(struct drm_device *d, void *v, struct drm_file *f);
     57 int drm_legacy_rmctx(struct drm_device *d, void *v, struct drm_file *f);
     58 
     59 int drm_legacy_setsareactx(struct drm_device *d, void *v, struct drm_file *f);
     60 int drm_legacy_getsareactx(struct drm_device *d, void *v, struct drm_file *f);
     61 
     62 /*
     63  * Generic Buffer Management
     64  */
     65 
     66 #define DRM_MAP_HASH_OFFSET 0x10000000
     67 
     68 int drm_legacy_addmap_ioctl(struct drm_device *d, void *v, struct drm_file *f);
     69 int drm_legacy_rmmap_ioctl(struct drm_device *d, void *v, struct drm_file *f);
     70 int drm_legacy_addbufs(struct drm_device *d, void *v, struct drm_file *f);
     71 int drm_legacy_infobufs(struct drm_device *d, void *v, struct drm_file *f);
     72 int drm_legacy_markbufs(struct drm_device *d, void *v, struct drm_file *f);
     73 int drm_legacy_freebufs(struct drm_device *d, void *v, struct drm_file *f);
     74 int drm_legacy_mapbufs(struct drm_device *d, void *v, struct drm_file *f);
     75 int drm_legacy_dma_ioctl(struct drm_device *d, void *v, struct drm_file *f);
     76 
     77 void drm_legacy_vma_flush(struct drm_device *d);
     78 
     79 /*
     80  * AGP Support
     81  */
     82 
     83 struct drm_agp_mem {
     84 	unsigned long handle;
     85 	struct agp_memory *memory;
     86 	unsigned long bound;
     87 	int pages;
     88 	struct list_head head;
     89 };
     90 
     91 /*
     92  * Generic Userspace Locking-API
     93  */
     94 
     95 int drm_legacy_i_have_hw_lock(struct drm_device *d, struct drm_file *f);
     96 int drm_legacy_lock(struct drm_device *d, void *v, struct drm_file *f);
     97 int drm_legacy_unlock(struct drm_device *d, void *v, struct drm_file *f);
     98 int drm_legacy_lock_free(struct drm_lock_data *lock, unsigned int ctx);
     99 
    100 /* DMA support */
    101 int drm_legacy_dma_setup(struct drm_device *dev);
    102 void drm_legacy_dma_takedown(struct drm_device *dev);
    103 void drm_legacy_free_buffer(struct drm_device *dev,
    104 			    struct drm_buf * buf);
    105 void drm_legacy_reclaim_buffers(struct drm_device *dev,
    106 				struct drm_file *filp);
    107 
    108 /* Scatter Gather Support */
    109 void drm_legacy_sg_cleanup(struct drm_device *dev);
    110 int drm_legacy_sg_alloc(struct drm_device *dev, void *data,
    111 			struct drm_file *file_priv);
    112 int drm_legacy_sg_free(struct drm_device *dev, void *data,
    113 		       struct drm_file *file_priv);
    114 
    115 #endif /* __DRM_LEGACY_H__ */
    116