Linux 4.2.1
[linux/fpc-iii.git] / drivers / gpu / drm / msm / msm_ringbuffer.h
blob6e0e1049fa4f8945051fde067d7eabcd275f719c
1 /*
2 * Copyright (C) 2013 Red Hat
3 * Author: Rob Clark <robdclark@gmail.com>
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
14 * You should have received a copy of the GNU General Public License along with
15 * this program. If not, see <http://www.gnu.org/licenses/>.
18 #ifndef __MSM_RINGBUFFER_H__
19 #define __MSM_RINGBUFFER_H__
21 #include "msm_drv.h"
23 struct msm_ringbuffer {
24 struct msm_gpu *gpu;
25 int size;
26 struct drm_gem_object *bo;
27 uint32_t *start, *end, *cur;
30 struct msm_ringbuffer *msm_ringbuffer_new(struct msm_gpu *gpu, int size);
31 void msm_ringbuffer_destroy(struct msm_ringbuffer *ring);
33 /* ringbuffer helpers (the parts that are same for a3xx/a2xx/z180..) */
35 static inline void
36 OUT_RING(struct msm_ringbuffer *ring, uint32_t data)
38 if (ring->cur == ring->end)
39 ring->cur = ring->start;
40 *(ring->cur++) = data;
43 #endif /* __MSM_RINGBUFFER_H__ */