1 /* -*- mode: C; c-file-style: "k&r"; tab-width 4; indent-tabs-mode: t; -*- */
4 * Copyright (C) 2012 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>
29 #ifndef FREEDRENO_PRIV_H_
30 #define FREEDRENO_PRIV_H_
38 #include <sys/ioctl.h>
42 #include "xf86atomic.h"
46 #include "freedreno_drmif.h"
55 struct fd_device *dev;
60 /* device properties: */
61 struct kgsl_version version;
62 struct kgsl_devinfo devinfo;
64 /* list of bo's that are referenced in ringbuffer but not
67 struct list_head submit_list;
69 /* list of bo's that have been submitted but timestamp has
70 * not passed yet (so still ref'd in active cmdstream)
72 struct list_head pending_list;
74 /* if we are the 2d pipe, and want to wait on a timestamp
75 * from 3d, we need to also internally open the 3d pipe:
80 void fd_pipe_add_submit(struct fd_pipe *pipe, struct fd_bo *bo);
81 void fd_pipe_pre_submit(struct fd_pipe *pipe);
82 void fd_pipe_post_submit(struct fd_pipe *pipe, uint32_t timestamp);
83 void fd_pipe_process_pending(struct fd_pipe *pipe, uint32_t timestamp);
86 struct fd_device *dev;
93 /* timestamp (per pipe) for bo's in a pipe's pending_list: */
94 uint32_t timestamp[FD_PIPE_MAX];
95 /* list-node for pipe's submit_list or pending_list */
96 struct list_head list[FD_PIPE_MAX];
100 /* not exposed publicly, because won't be needed when we have
101 * a proper kernel driver
103 uint32_t fd_bo_gpuaddr(struct fd_bo *bo, uint32_t offset);
104 void fb_bo_set_timestamp(struct fd_bo *bo, uint32_t timestamp);
105 uint32_t fd_bo_get_timestamp(struct fd_bo *bo);
107 #define ALIGN(v,a) (((v) + (a) - 1) & ~((a) - 1))
108 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
110 #define enable_debug 1 /* TODO make dynamic */
112 #define INFO_MSG(fmt, ...) \
113 do { drmMsg("[I] "fmt " (%s:%d)\n", \
114 ##__VA_ARGS__, __FUNCTION__, __LINE__); } while (0)
115 #define DEBUG_MSG(fmt, ...) \
116 do if (enable_debug) { drmMsg("[D] "fmt " (%s:%d)\n", \
117 ##__VA_ARGS__, __FUNCTION__, __LINE__); } while (0)
118 #define WARN_MSG(fmt, ...) \
119 do { drmMsg("[W] "fmt " (%s:%d)\n", \
120 ##__VA_ARGS__, __FUNCTION__, __LINE__); } while (0)
121 #define ERROR_MSG(fmt, ...) \
122 do { drmMsg("[E] " fmt " (%s:%d)\n", \
123 ##__VA_ARGS__, __FUNCTION__, __LINE__); } while (0)
125 #endif /* FREEDRENO_PRIV_H_ */