10ed5401bSmrg/*
20ed5401bSmrg * Copyright © 2014 NVIDIA Corporation
30ed5401bSmrg *
40ed5401bSmrg * Permission is hereby granted, free of charge, to any person obtaining a
50ed5401bSmrg * copy of this software and associated documentation files (the "Software"),
60ed5401bSmrg * to deal in the Software without restriction, including without limitation
70ed5401bSmrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
80ed5401bSmrg * and/or sell copies of the Software, and to permit persons to whom the
90ed5401bSmrg * Software is furnished to do so, subject to the following conditions:
100ed5401bSmrg *
110ed5401bSmrg * The above copyright notice and this permission notice shall be included in
120ed5401bSmrg * all copies or substantial portions of the Software.
130ed5401bSmrg *
140ed5401bSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
150ed5401bSmrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
160ed5401bSmrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
170ed5401bSmrg * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
180ed5401bSmrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
190ed5401bSmrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
200ed5401bSmrg * OTHER DEALINGS IN THE SOFTWARE.
210ed5401bSmrg */
220ed5401bSmrg
230ed5401bSmrg#ifndef TEGRA_DRM_TEST_H
240ed5401bSmrg#define TEGRA_DRM_TEST_H
250ed5401bSmrg
260ed5401bSmrg#include <stdint.h>
270ed5401bSmrg#include <stdlib.h>
280ed5401bSmrg
290ed5401bSmrg#include "xf86drmMode.h"
300ed5401bSmrg
310ed5401bSmrgstruct drm_screen {
320ed5401bSmrg    int fd;
330ed5401bSmrg
340ed5401bSmrg    unsigned int width;
350ed5401bSmrg    unsigned int height;
360ed5401bSmrg    unsigned int pitch;
370ed5401bSmrg    unsigned int depth;
380ed5401bSmrg    unsigned int bpp;
390ed5401bSmrg
400ed5401bSmrg    drmModeModeInfo mode;
410ed5401bSmrg    uint32_t connector;
420ed5401bSmrg    uint32_t old_fb;
430ed5401bSmrg    uint32_t format;
440ed5401bSmrg    uint32_t crtc;
450ed5401bSmrg};
460ed5401bSmrg
470ed5401bSmrgstruct drm_framebuffer {
480ed5401bSmrg    unsigned int width;
490ed5401bSmrg    unsigned int height;
500ed5401bSmrg    unsigned int pitch;
510ed5401bSmrg    uint32_t format;
520ed5401bSmrg    uint32_t handle;
530ed5401bSmrg    void *data;
540ed5401bSmrg    int fd;
550ed5401bSmrg};
560ed5401bSmrg
570ed5401bSmrgint drm_screen_open(struct drm_screen **screenp, int fd);
580ed5401bSmrgint drm_screen_close(struct drm_screen *screen);
590ed5401bSmrgint drm_screen_set_framebuffer(struct drm_screen *screen,
600ed5401bSmrg                               struct drm_framebuffer *fb);
610ed5401bSmrg
620ed5401bSmrgint drm_framebuffer_new(struct drm_framebuffer **fbp,
630ed5401bSmrg                        struct drm_screen *screen, uint32_t handle,
640ed5401bSmrg                        unsigned int width, unsigned int height,
650ed5401bSmrg                        unsigned int pitch, uint32_t format,
660ed5401bSmrg                        void *data);
670ed5401bSmrgint drm_framebuffer_free(struct drm_framebuffer *fb);
680ed5401bSmrg
690ed5401bSmrgint drm_open(const char *path);
700ed5401bSmrgvoid drm_close(int fd);
710ed5401bSmrg
720ed5401bSmrg#endif
73