Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright 2013 Red Hat Inc.
0003  *
0004  * Permission is hereby granted, free of charge, to any person obtaining a
0005  * copy of this software and associated documentation files (the "Software"),
0006  * to deal in the Software without restriction, including without limitation
0007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
0008  * and/or sell copies of the Software, and to permit persons to whom the
0009  * Software is furnished to do so, subject to the following conditions:
0010  *
0011  * The above copyright notice and this permission notice shall be included in
0012  * all copies or substantial portions of the Software.
0013  *
0014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0015  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
0017  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
0018  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
0019  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
0020  * OTHER DEALINGS IN THE SOFTWARE.
0021  *
0022  * Authors: Dave Airlie
0023  *          Alon Levy
0024  */
0025 #ifndef QXL_OBJECT_H
0026 #define QXL_OBJECT_H
0027 
0028 #include "qxl_drv.h"
0029 
0030 static inline int qxl_bo_reserve(struct qxl_bo *bo)
0031 {
0032     int r;
0033 
0034     r = ttm_bo_reserve(&bo->tbo, true, false, NULL);
0035     if (unlikely(r != 0)) {
0036         if (r != -ERESTARTSYS) {
0037             struct drm_device *ddev = bo->tbo.base.dev;
0038 
0039             dev_err(ddev->dev, "%p reserve failed\n", bo);
0040         }
0041         return r;
0042     }
0043     return 0;
0044 }
0045 
0046 static inline void qxl_bo_unreserve(struct qxl_bo *bo)
0047 {
0048     ttm_bo_unreserve(&bo->tbo);
0049 }
0050 
0051 static inline unsigned long qxl_bo_size(struct qxl_bo *bo)
0052 {
0053     return bo->tbo.base.size;
0054 }
0055 
0056 extern int qxl_bo_create(struct qxl_device *qdev,
0057              unsigned long size,
0058              bool kernel, bool pinned, u32 domain,
0059              u32 priority,
0060              struct qxl_surface *surf,
0061              struct qxl_bo **bo_ptr);
0062 int qxl_bo_vmap(struct qxl_bo *bo, struct iosys_map *map);
0063 int qxl_bo_vmap_locked(struct qxl_bo *bo, struct iosys_map *map);
0064 int qxl_bo_vunmap(struct qxl_bo *bo);
0065 void qxl_bo_vunmap_locked(struct qxl_bo *bo);
0066 void *qxl_bo_kmap_atomic_page(struct qxl_device *qdev, struct qxl_bo *bo, int page_offset);
0067 void qxl_bo_kunmap_atomic_page(struct qxl_device *qdev, struct qxl_bo *bo, void *map);
0068 extern struct qxl_bo *qxl_bo_ref(struct qxl_bo *bo);
0069 extern void qxl_bo_unref(struct qxl_bo **bo);
0070 extern int qxl_bo_pin(struct qxl_bo *bo);
0071 extern int qxl_bo_unpin(struct qxl_bo *bo);
0072 extern void qxl_ttm_placement_from_domain(struct qxl_bo *qbo, u32 domain);
0073 extern bool qxl_ttm_bo_is_qxl_bo(struct ttm_buffer_object *bo);
0074 
0075 #endif