linux/drivers/staging/media/ipu3/ipu3-css-pool.h
<<
>>
Prefs
   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
   7struct device;
   8struct 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 */
  21struct 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 */
  36struct 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
  44int imgu_css_dma_buffer_resize(struct imgu_device *imgu,
  45                               struct imgu_css_map *map, size_t size);
  46void imgu_css_pool_cleanup(struct imgu_device *imgu,
  47                           struct imgu_css_pool *pool);
  48int imgu_css_pool_init(struct imgu_device *imgu, struct imgu_css_pool *pool,
  49                       size_t size);
  50void imgu_css_pool_get(struct imgu_css_pool *pool);
  51void imgu_css_pool_put(struct imgu_css_pool *pool);
  52const struct imgu_css_map *imgu_css_pool_last(struct imgu_css_pool *pool,
  53                                              u32 last);
  54
  55#endif
  56