18c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz/**************************************************************************
28c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz *
38c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz * Copyright © 2009 VMware, Inc., Palo Alto, CA., USA
48c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz * All Rights Reserved.
58c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz *
68c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz * Permission is hereby granted, free of charge, to any person obtaining a
78c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz * copy of this software and associated documentation files (the
88c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz * "Software"), to deal in the Software without restriction, including
98c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz * without limitation the rights to use, copy, modify, merge, publish,
108c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz * distribute, sub license, and/or sell copies of the Software, and to
118c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz * permit persons to whom the Software is furnished to do so, subject to
128c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz * the following conditions:
138c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz *
148c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz * The above copyright notice and this permission notice (including the
158c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz * next paragraph) shall be included in all copies or substantial portions
168c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz * of the Software.
178c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz *
188c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
198c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
208c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
218c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
228c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
238c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
248c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz * USE OR OTHER DEALINGS IN THE SOFTWARE.
258c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz *
268c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz **************************************************************************/
278c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz
288c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz
298c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz#ifndef INTERNAL_H_
308c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz#define INTERNAL_H_
318c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz
328c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz#include "libkms.h"
338c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz
348c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantzstruct kms_driver
358c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz{
368c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz	int (*get_prop)(struct kms_driver *kms, const unsigned key,
378c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz			unsigned *out);
388c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz	int (*destroy)(struct kms_driver *kms);
398c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz
408c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz	int (*bo_create)(struct kms_driver *kms,
418c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz			 unsigned width,
428c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz			 unsigned height,
438c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz			 enum kms_bo_type type,
448c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz			 const unsigned *attr,
458c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz			 struct kms_bo **out);
468c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz	int (*bo_get_prop)(struct kms_bo *bo, const unsigned key,
478c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz			   unsigned *out);
488c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz	int (*bo_map)(struct kms_bo *bo, void **out);
498c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz	int (*bo_unmap)(struct kms_bo *bo);
508c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz	int (*bo_destroy)(struct kms_bo *bo);
518c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz
528c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz	int fd;
538c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz};
548c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz
558c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantzstruct kms_bo
568c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz{
578c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz	struct kms_driver *kms;
588c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz	void *ptr;
598c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz	size_t size;
608c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz	size_t offset;
618c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz	size_t pitch;
628c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz	unsigned handle;
638c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz};
648c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz
65d920fa9d0b54873d53f03a006d0fe3df11136b74Jakob Bornecrantzint linux_create(int fd, struct kms_driver **out);
669042d72109d8ae448b8e0f23b93067cc37deff23Jakob Bornecrantz
678c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantzint vmwgfx_create(int fd, struct kms_driver **out);
688c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz
69bfa44bb8610f51d84b8d23f8c5ce903689d239c6Jakob Bornecrantzint intel_create(int fd, struct kms_driver **out);
70bfa44bb8610f51d84b8d23f8c5ce903689d239c6Jakob Bornecrantz
71bb994653667986757b4c906b8f144737667f7374Dave Airlieint dumb_create(int fd, struct kms_driver **out);
72bb994653667986757b4c906b8f144737667f7374Dave Airlie
73d5a2e776826f7a849f1cf654fde8611f687eb12cMarcin Kościelnickiint nouveau_create(int fd, struct kms_driver **out);
74d5a2e776826f7a849f1cf654fde8611f687eb12cMarcin Kościelnicki
75ed7d177f66885dfbc4e8410154559c4767fefa9fnobledint radeon_create(int fd, struct kms_driver **out);
76ed7d177f66885dfbc4e8410154559c4767fefa9fnobled
773732ef59eb1198d6a4cb5b8bbca6b155c53529f6Hyungwon Hwangint exynos_create(int fd, struct kms_driver **out);
783732ef59eb1198d6a4cb5b8bbca6b155c53529f6Hyungwon Hwang
798c0571a73399c372644c8d92a136a474f3e05d48Jakob Bornecrantz#endif
80