Back to index

libdrm  2.4.37
intel_bufmgr_priv.h
Go to the documentation of this file.
00001 /*
00002  * Copyright © 2008 Intel Corporation
00003  *
00004  * Permission is hereby granted, free of charge, to any person obtaining a
00005  * copy of this software and associated documentation files (the "Software"),
00006  * to deal in the Software without restriction, including without limitation
00007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00008  * and/or sell copies of the Software, and to permit persons to whom the
00009  * Software is furnished to do so, subject to the following conditions:
00010  *
00011  * The above copyright notice and this permission notice (including the next
00012  * paragraph) shall be included in all copies or substantial portions of the
00013  * Software.
00014  *
00015  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00016  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00017  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
00018  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00019  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
00020  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
00021  * IN THE SOFTWARE.
00022  *
00023  * Authors:
00024  *    Eric Anholt <eric@anholt.net>
00025  *
00026  */
00027 
00034 #ifndef INTEL_BUFMGR_PRIV_H
00035 #define INTEL_BUFMGR_PRIV_H
00036 
00042 struct _drm_intel_bufmgr {
00050        drm_intel_bo *(*bo_alloc) (drm_intel_bufmgr *bufmgr, const char *name,
00051                                unsigned long size, unsigned int alignment);
00052 
00059        drm_intel_bo *(*bo_alloc_for_render) (drm_intel_bufmgr *bufmgr,
00060                                          const char *name,
00061                                          unsigned long size,
00062                                          unsigned int alignment);
00063 
00079        drm_intel_bo *(*bo_alloc_tiled) (drm_intel_bufmgr *bufmgr,
00080                                     const char *name,
00081                                     int x, int y, int cpp,
00082                                     uint32_t *tiling_mode,
00083                                     unsigned long *pitch,
00084                                     unsigned long flags);
00085 
00087        void (*bo_reference) (drm_intel_bo *bo);
00088 
00093        void (*bo_unreference) (drm_intel_bo *bo);
00094 
00102        int (*bo_map) (drm_intel_bo *bo, int write_enable);
00103 
00108        int (*bo_unmap) (drm_intel_bo *bo);
00109 
00116        int (*bo_subdata) (drm_intel_bo *bo, unsigned long offset,
00117                         unsigned long size, const void *data);
00118 
00125        int (*bo_get_subdata) (drm_intel_bo *bo, unsigned long offset,
00126                             unsigned long size, void *data);
00127 
00135        void (*bo_wait_rendering) (drm_intel_bo *bo);
00136 
00140        void (*destroy) (drm_intel_bufmgr *bufmgr);
00141 
00162        int (*bo_emit_reloc) (drm_intel_bo *bo, uint32_t offset,
00163                            drm_intel_bo *target_bo, uint32_t target_offset,
00164                            uint32_t read_domains, uint32_t write_domain);
00165        int (*bo_emit_reloc_fence)(drm_intel_bo *bo, uint32_t offset,
00166                                drm_intel_bo *target_bo,
00167                                uint32_t target_offset,
00168                                uint32_t read_domains,
00169                                uint32_t write_domain);
00170 
00172        int (*bo_exec) (drm_intel_bo *bo, int used,
00173                      drm_clip_rect_t *cliprects, int num_cliprects,
00174                      int DR4);
00175 
00179        int (*bo_mrb_exec) (drm_intel_bo *bo, int used,
00180                          drm_clip_rect_t *cliprects, int num_cliprects,
00181                          int DR4, unsigned flags);
00182 
00189        int (*bo_pin) (drm_intel_bo *bo, uint32_t alignment);
00190 
00196        int (*bo_unpin) (drm_intel_bo *bo);
00197 
00204        int (*bo_set_tiling) (drm_intel_bo *bo, uint32_t * tiling_mode,
00205                            uint32_t stride);
00206 
00214        int (*bo_get_tiling) (drm_intel_bo *bo, uint32_t * tiling_mode,
00215                            uint32_t * swizzle_mode);
00216 
00223        int (*bo_flink) (drm_intel_bo *bo, uint32_t * name);
00224 
00229        int (*bo_busy) (drm_intel_bo *bo);
00230 
00243        int (*bo_madvise) (drm_intel_bo *bo, int madv);
00244 
00245        int (*check_aperture_space) (drm_intel_bo ** bo_array, int count);
00246 
00254        int (*bo_disable_reuse) (drm_intel_bo *bo);
00255 
00261        int (*bo_is_reusable) (drm_intel_bo *bo);
00262 
00274        int (*get_pipe_from_crtc_id) (drm_intel_bufmgr *bufmgr, int crtc_id);
00275 
00277        int (*bo_references) (drm_intel_bo *bo, drm_intel_bo *target_bo);
00278 
00280        int debug;
00281 };
00282 
00283 struct _drm_intel_context {
00284        unsigned int ctx_id;
00285        struct _drm_intel_bufmgr *bufmgr;
00286 };
00287 
00288 #define ALIGN(value, alignment)    ((value + alignment - 1) & ~(alignment - 1))
00289 #define ROUND_UP_TO(x, y)   (((x) + (y) - 1) / (y) * (y))
00290 #define ROUND_UP_TO_MB(x)   ROUND_UP_TO((x), 1024*1024)
00291 
00292 #endif /* INTEL_BUFMGR_PRIV_H */