2 * Copyright 2007 Jérôme Glisse
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
25 * Jerome Glisse <glisse@freedesktop.org>
30 /* struct amd_cbuffer are for command buffer, this is the structure passed
31 * around during command validation (ie check that user have the right to
32 * execute the given command).
36 struct list_head list;
39 struct drm_buffer_object *bo;
50 struct drm_bo_kmap_obj cdw_kmap;
52 struct amd_cmd_bo *cdw_bo;
53 struct amd_cmd_bo bo_unused;
54 struct amd_cmd_bo bo_used;
55 struct amd_cmd_bo *bo;
62 uint32_t numof_p0_checkers;
63 uint32_t numof_p3_checkers;
64 int (*check)(struct drm_device *dev, struct amd_cmd *cmd);
65 int (**check_p0)(struct drm_device *dev, struct amd_cmd *cmd,
67 int (**check_p3)(struct drm_device *dev, struct amd_cmd *cmd,
68 int cdw_id, int op, int count);
71 int amd_cmd_check(struct drm_device *dev, struct amd_cmd *cmd);
72 int amd_ioctl_cmd(struct drm_device *dev, void *data, struct drm_file *file);
74 static inline struct amd_cmd_bo *amd_cmd_get_bo(struct amd_cmd *cmd, int i)
76 if (i < cmd->bo_count && cmd->bo[i].type == DRM_AMD_CMD_BO_TYPE_DATA) {
77 list_del(&cmd->bo[i].list);
78 list_add_tail(&cmd->bo[i].list, &cmd->bo_used.list);
84 /* struct amd_fb amd is for storing amd framebuffer informations
88 struct drm_device *dev;
89 struct drm_crtc *crtc;
90 struct drm_display_mode *fb_mode;
91 struct drm_framebuffer *fb;