root/drivers/staging/media/ipu3/ipu3-css-pool.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /* SPDX-License-Identifier: GPL-2.0 */
   2 /* Copyright (C) 2018 Intel Corporation */
   3 
   4 #ifndef __IPU3_UTIL_H
   5 #define __IPU3_UTIL_H
   6 
   7 struct device;
   8 struct imgu_device;
   9 
  10 #define IPU3_CSS_POOL_SIZE              4
  11 
  12 /**
  13  * imgu_css_map - store DMA mapping info for buffer
  14  *
  15  * @size:               size of the buffer in bytes.
  16  * @vaddr:              kernel virtual address.
  17  * @daddr:              iova dma address to access IPU3.
  18  * @vma:                private, a pointer to &struct vm_struct,
  19  *                      used for imgu_dmamap_free.
  20  */
  21 struct imgu_css_map {
  22         size_t size;
  23         void *vaddr;
  24         dma_addr_t daddr;
  25         struct vm_struct *vma;
  26 };
  27 
  28 /**
  29  * imgu_css_pool - circular buffer pool definition
  30  *
  31  * @entry:              array with IPU3_CSS_POOL_SIZE elements.
  32  * @entry.param:        a &struct imgu_css_map for storing the mem mapping.
  33  * @entry.valid:        used to mark if the entry has valid data.
  34  * @last:               write pointer, initialized to IPU3_CSS_POOL_SIZE.
  35  */
  36 struct imgu_css_pool {
  37         struct {
  38                 struct imgu_css_map param;
  39                 bool valid;
  40         } entry[IPU3_CSS_POOL_SIZE];
  41         u32 last;
  42 };
  43 
  44 int imgu_css_dma_buffer_resize(struct imgu_device *imgu,
  45                                struct imgu_css_map *map, size_t size);
  46 void imgu_css_pool_cleanup(struct imgu_device *imgu,
  47                            struct imgu_css_pool *pool);
  48 int imgu_css_pool_init(struct imgu_device *imgu, struct imgu_css_pool *pool,
  49                        size_t size);
  50 void imgu_css_pool_get(struct imgu_css_pool *pool);
  51 void imgu_css_pool_put(struct imgu_css_pool *pool);
  52 const struct imgu_css_map *imgu_css_pool_last(struct imgu_css_pool *pool,
  53                                               u32 last);
  54 
  55 #endif

/* [<][>][^][v][top][bottom][index][help] */