1f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/*
2f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Mesa 3-D graphics library
3f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Version:  7.8
4f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org *
5f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Copyright (C) 2009-2010 Chia-I Wu <olv@0xlab.org>
6f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org *
7f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Permission is hereby granted, free of charge, to any person obtaining a
8f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * copy of this software and associated documentation files (the "Software"),
9f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * to deal in the Software without restriction, including without limitation
10f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * and/or sell copies of the Software, and to permit persons to whom the
12f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Software is furnished to do so, subject to the following conditions:
13f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org *
14f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * The above copyright notice and this permission notice shall be included
15f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * in all copies or substantial portions of the Software.
16f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org *
17f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * DEALINGS IN THE SOFTWARE.
24f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */
25f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
26f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#ifndef _NATIVE_MODESET_H_
27f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define _NATIVE_MODESET_H_
28f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
29f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "pipe/p_compiler.h"
30f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
31f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct native_display;
32f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct native_surface;
33f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct native_config;
34f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
35f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct native_connector {
36f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   int dummy;
37f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org};
38f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
39f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct native_mode {
40f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   const char *desc;
41f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   int width, height;
42f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   int refresh_rate; /* HZ * 1000 */
43f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org};
44f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
45f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/**
46f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Mode setting interface of the native display.  It exposes the mode setting
47f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * capabilities of the underlying graphics hardware.
48f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */
49f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct native_display_modeset {
50f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   /**
51f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    * Get the available physical connectors and the number of CRTCs.
52f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    */
53f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   const struct native_connector **(*get_connectors)(struct native_display *ndpy,
54f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                                     int *num_connectors,
55f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                                     int *num_crtcs);
56f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
57f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   /**
58f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    * Get the current supported modes of a connector.  The returned modes may
59f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    * change every time this function is called and those from previous calls
60f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    * might become invalid.
61f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    */
62f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   const struct native_mode **(*get_modes)(struct native_display *ndpy,
63f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                           const struct native_connector *nconn,
64f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                           int *num_modes);
65f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
66f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   /**
67f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    * Create a scan-out surface.  Required unless no config has scanout_bit
68f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    * set.
69f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    */
70f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct native_surface *(*create_scanout_surface)(struct native_display *ndpy,
71f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                                    const struct native_config *nconf,
72f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                                    uint width, uint height);
73f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
74f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   /**
75f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    * Program the CRTC to output the surface to the given connectors with the
76f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    * given mode.  When surface is not given, the CRTC is disabled.
77f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    *
78f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    * This interface does not export a way to query capabilities of the CRTCs.
79f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    * The native display usually needs to dynamically map the index to a CRTC
80f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    * that supports the given connectors.
81f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    */
82f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   boolean (*program)(struct native_display *ndpy, int crtc_idx,
83f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                      struct native_surface *nsurf, uint x, uint y,
84f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                      const struct native_connector **nconns, int num_nconns,
85f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                      const struct native_mode *nmode);
86f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org};
87f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
88f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#endif /* _NATIVE_MODESET_H_ */
89