Home | History | Annotate | Download | only in linux
      1 /*
      2  * include/linux/omap_ion.h
      3  *
      4  * Copyright (C) 2011 Google, Inc.
      5  *
      6  * This software is licensed under the terms of the GNU General Public
      7  * License version 2, as published by the Free Software Foundation, and
      8  * may be copied, distributed, and modified under those terms.
      9  *
     10  * This program is distributed in the hope that it will be useful,
     11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     13  * GNU General Public License for more details.
     14  *
     15  */
     16 
     17 #ifndef _LINUX_OMAP_ION_H
     18 #define _LINUX_OMAP_ION_H
     19 
     20 #include <linux/types.h>
     21 
     22 /**
     23  * struct omap_ion_tiler_alloc_data - metadata passed from userspace for allocations
     24  * @w:		width of the allocation
     25  * @h:		height of the allocation
     26  * @fmt:	format of the data (8, 16, 32bit or page)
     27  * @flags:	flags passed to heap
     28  * @stride:	stride of the allocation, returned to caller from kernel
     29  * @handle:	pointer that will be populated with a cookie to use to refer
     30  *		to this allocation
     31  *
     32  * Provided by userspace as an argument to the ioctl
     33  */
     34 struct omap_ion_tiler_alloc_data {
     35 	size_t w;
     36 	size_t h;
     37 	int fmt;
     38 	unsigned int flags;
     39 	struct ion_handle *handle;
     40 	size_t stride;
     41 	size_t offset;
     42 };
     43 
     44 #ifdef __KERNEL__
     45 int omap_ion_tiler_alloc(struct ion_client *client,
     46 			 struct omap_ion_tiler_alloc_data *data);
     47 /* given a handle in the tiler, return a list of tiler pages that back it */
     48 int omap_tiler_pages(struct ion_client *client, struct ion_handle *handle,
     49 		     int *n, u32 ** tiler_pages);
     50 #endif /* __KERNEL__ */
     51 
     52 /* additional heaps used only on omap */
     53 enum {
     54 	OMAP_ION_HEAP_TYPE_TILER = ION_HEAP_TYPE_CUSTOM + 1,
     55 };
     56 
     57 #define OMAP_ION_HEAP_TILER_MASK (1 << OMAP_ION_HEAP_TYPE_TILER)
     58 
     59 enum {
     60 	OMAP_ION_TILER_ALLOC,
     61 };
     62 
     63 /**
     64  * These should match the defines in the tiler driver
     65  */
     66 enum {
     67 	TILER_PIXEL_FMT_MIN   = 0,
     68 	TILER_PIXEL_FMT_8BIT  = 0,
     69 	TILER_PIXEL_FMT_16BIT = 1,
     70 	TILER_PIXEL_FMT_32BIT = 2,
     71 	TILER_PIXEL_FMT_PAGE  = 3,
     72 	TILER_PIXEL_FMT_MAX   = 3
     73 };
     74 
     75 /**
     76  * List of heaps in the system
     77  */
     78 enum {
     79 	OMAP_ION_HEAP_LARGE_SURFACES,
     80 	OMAP_ION_HEAP_TILER,
     81 	OMAP_ION_HEAP_SECURE_INPUT,
     82 };
     83 
     84 #endif /* _LINUX_ION_H */
     85 
     86