13bfa90b6Smrg/*
23bfa90b6Smrg * Copyright 2011 VMWare, Inc.
33bfa90b6Smrg * All Rights Reserved.
43bfa90b6Smrg *
53bfa90b6Smrg * Permission is hereby granted, free of charge, to any person obtaining a
63bfa90b6Smrg * copy of this software and associated documentation files (the
73bfa90b6Smrg * "Software"), to deal in the Software without restriction, including
83bfa90b6Smrg * without limitation the rights to use, copy, modify, merge, publish,
93bfa90b6Smrg * distribute, sub license, and/or sell copies of the Software, and to
103bfa90b6Smrg * permit persons to whom the Software is furnished to do so, subject to
113bfa90b6Smrg * the following conditions:
123bfa90b6Smrg *
133bfa90b6Smrg * The above copyright notice and this permission notice (including the
143bfa90b6Smrg * next paragraph) shall be included in all copies or substantial portions
153bfa90b6Smrg * of the Software.
163bfa90b6Smrg *
173bfa90b6Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
183bfa90b6Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
193bfa90b6Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
203bfa90b6Smrg * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
213bfa90b6Smrg * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
223bfa90b6Smrg * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
233bfa90b6Smrg * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
243bfa90b6Smrg *
253bfa90b6Smrg * Author: Jakob Bornecrantz <wallbraker@gmail.com>
263bfa90b6Smrg * Author: Thomas Hellstrom <thellstrom@vmware.com>
273bfa90b6Smrg */
283bfa90b6Smrg
293bfa90b6Smrg#ifndef _VMWGFX_DRMI_H_
303bfa90b6Smrg#define _VMWGFX_DRMI_H_
313bfa90b6Smrg
323bfa90b6Smrg#include <xorg-server.h>
333bfa90b6Smrg#include <regionstr.h>
343bfa90b6Smrg#include <stdint.h>
353bfa90b6Smrg#include "vmwgfx_drm.h"
363bfa90b6Smrg
373bfa90b6Smrgstruct vmwgfx_dma_ctx;
383bfa90b6Smrg
393bfa90b6Smrgextern int
403bfa90b6Smrgvmwgfx_present_readback(int drm_fd, uint32_t fb_id, RegionPtr region);
413bfa90b6Smrg
423bfa90b6Smrgextern int
433bfa90b6Smrgvmwgfx_present(int drm_fd, uint32_t fb_id, unsigned int dst_x,
443bfa90b6Smrg	       unsigned int dst_y, RegionPtr region, uint32_t handle);
453bfa90b6Smrg
463bfa90b6Smrgstruct vmwgfx_dmabuf {
473bfa90b6Smrg  uint32_t handle;
483bfa90b6Smrg  uint32_t gmr_id;
493bfa90b6Smrg  uint32_t gmr_offset;
503bfa90b6Smrg  size_t size;
513bfa90b6Smrg};
523bfa90b6Smrg
533bfa90b6Smrgextern struct vmwgfx_dmabuf*
543bfa90b6Smrgvmwgfx_dmabuf_alloc(int drm_fd, size_t size);
553bfa90b6Smrgextern void
563bfa90b6Smrgvmwgfx_dmabuf_destroy(struct vmwgfx_dmabuf *buf);
573bfa90b6Smrgextern void *
583bfa90b6Smrgvmwgfx_dmabuf_map(struct vmwgfx_dmabuf *buf);
593bfa90b6Smrgextern void
603bfa90b6Smrgvmwgfx_dmabuf_unmap(struct vmwgfx_dmabuf *buf);
613bfa90b6Smrg
623bfa90b6Smrgextern int
6322f7e8e5Smrgvmwgfx_dma(int host_x, int host_y,
643bfa90b6Smrg	   RegionPtr region, struct vmwgfx_dmabuf *buf,
653bfa90b6Smrg	   uint32_t buf_pitch, uint32_t surface_handle, int to_surface);
663bfa90b6Smrg
673bfa90b6Smrgextern int
683bfa90b6Smrgvmwgfx_num_streams(int drm_fd, uint32_t *ntot, uint32_t *nfree);
693bfa90b6Smrg
703bfa90b6Smrgextern int
713bfa90b6Smrgvmwgfx_claim_stream(int drm_fd, uint32_t *out);
723bfa90b6Smrg
733bfa90b6Smrgextern int
743bfa90b6Smrgvmwgfx_unref_stream(int drm_fd, uint32_t stream_id);
753bfa90b6Smrg
763bfa90b6Smrgint
773bfa90b6Smrgvmwgfx_cursor_bypass(int drm_fd, int xhot, int yhot);
783bfa90b6Smrg
793bfa90b6Smrgint
803bfa90b6Smrgvmwgfx_max_fb_size(int drm_fd, size_t *size);
813bfa90b6Smrg
823bfa90b6Smrgint
833bfa90b6Smrgvmwgfx_update_gui_layout(int drm_fd, unsigned int num_rects,
843bfa90b6Smrg			 struct drm_vmw_rect *rects);
853bfa90b6Smrgint
863bfa90b6Smrgvmwgfx_get_param(int drm_fd, uint32_t param, uint64_t *out);
8722f7e8e5Smrg
8822f7e8e5Smrg#ifdef HAVE_LIBDRM_2_4_38
8922f7e8e5Smrgint
9022f7e8e5Smrgvmwgfx_prime_fd_to_handle(int drm_fd, int prime_fd, uint32_t *handle);
9122f7e8e5Smrg
9222f7e8e5Smrgvoid
9322f7e8e5Smrgvmwgfx_prime_release_handle(int drm_fd, uint32_t handle);
9422f7e8e5Smrg#endif /* HAVE_LIBDRM_2_4_38 */
953bfa90b6Smrg#endif
96