1 /* -*- mode: C; c-file-style: "k&r"; tab-width 4; indent-tabs-mode: t; -*- */
4 * Copyright (C) 2013 Rob Clark <robclark@freedesktop.org>
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice (including the next
14 * paragraph) shall be included in all copies or substantial portions of the
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26 * Rob Clark <robclark@freedesktop.org>
32 #include "freedreno_priv.h"
37 struct fd_device base;
40 static inline struct kgsl_device * to_kgsl_device(struct fd_device *x)
42 return (struct kgsl_device *)x;
51 /* device properties: */
52 struct kgsl_version version;
53 struct kgsl_devinfo devinfo;
55 /* list of bo's that are referenced in ringbuffer but not
58 struct list_head submit_list;
60 /* list of bo's that have been submitted but timestamp has
61 * not passed yet (so still ref'd in active cmdstream)
63 struct list_head pending_list;
65 /* if we are the 2d pipe, and want to wait on a timestamp
66 * from 3d, we need to also internally open the 3d pipe:
71 static inline struct kgsl_pipe * to_kgsl_pipe(struct fd_pipe *x)
73 return (struct kgsl_pipe *)x;
76 drm_private int is_kgsl_pipe(struct fd_pipe *pipe);
82 /* timestamp (per pipe) for bo's in a pipe's pending_list: */
83 uint32_t timestamp[FD_PIPE_MAX];
84 /* list-node for pipe's submit_list or pending_list */
85 struct list_head list[FD_PIPE_MAX];
88 static inline struct kgsl_bo * to_kgsl_bo(struct fd_bo *x)
90 return (struct kgsl_bo *)x;
94 drm_private struct fd_device * kgsl_device_new(int fd);
96 drm_private int kgsl_pipe_timestamp(struct kgsl_pipe *kgsl_pipe,
98 drm_private void kgsl_pipe_add_submit(struct kgsl_pipe *pipe,
100 drm_private void kgsl_pipe_pre_submit(struct kgsl_pipe *pipe);
101 drm_private void kgsl_pipe_post_submit(struct kgsl_pipe *pipe,
103 drm_private void kgsl_pipe_process_pending(struct kgsl_pipe *pipe,
105 drm_private struct fd_pipe * kgsl_pipe_new(struct fd_device *dev,
108 drm_private struct fd_ringbuffer * kgsl_ringbuffer_new(struct fd_pipe *pipe,
111 drm_private int kgsl_bo_new_handle(struct fd_device *dev,
112 uint32_t size, uint32_t flags, uint32_t *handle);
113 drm_private struct fd_bo * kgsl_bo_from_handle(struct fd_device *dev,
114 uint32_t size, uint32_t handle);
116 drm_private uint32_t kgsl_bo_gpuaddr(struct kgsl_bo *bo, uint32_t offset);
117 drm_private void kgsl_bo_set_timestamp(struct kgsl_bo *bo, uint32_t timestamp);
118 drm_private uint32_t kgsl_bo_get_timestamp(struct kgsl_bo *bo);
120 #endif /* KGSL_PRIV_H_ */