]>
git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blob - drivers/gpu/drm/msm/msm_ringbuffer.h
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
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__
23 #define rbmemptr(ring, member) \
24 ((ring)->memptrs_iova + offsetof(struct msm_rbmemptrs, member))
26 struct msm_rbmemptrs
{
27 volatile uint32_t rptr
;
28 volatile uint32_t fence
;
31 struct msm_ringbuffer
{
34 struct drm_gem_object
*bo
;
35 uint32_t *start
, *end
, *cur
, *next
;
36 struct list_head submits
;
39 uint32_t hangcheck_fence
;
40 struct msm_rbmemptrs
*memptrs
;
41 uint64_t memptrs_iova
;
42 struct msm_fence_context
*fctx
;
46 struct msm_ringbuffer
*msm_ringbuffer_new(struct msm_gpu
*gpu
, int id
,
47 void *memptrs
, uint64_t memptrs_iova
);
48 void msm_ringbuffer_destroy(struct msm_ringbuffer
*ring
);
50 /* ringbuffer helpers (the parts that are same for a3xx/a2xx/z180..) */
53 OUT_RING(struct msm_ringbuffer
*ring
, uint32_t data
)
56 * ring->next points to the current command being written - it won't be
57 * committed as ring->cur until the flush
59 if (ring
->next
== ring
->end
)
60 ring
->next
= ring
->start
;
61 *(ring
->next
++) = data
;
64 #endif /* __MSM_RINGBUFFER_H__ */