st/egl: Move modeset interface to native_modeset.h.

native.h is getting more and more complex.  Move the independent modeset
interface to native_modeset.h to simplify native.h a little.
This commit is contained in:
Chia-I Wu 2010-03-05 10:40:15 +08:00
parent e38f28dded
commit 89a75b7634
2 changed files with 89 additions and 55 deletions

View file

@ -34,6 +34,8 @@
#include "pipe/p_context.h"
#include "pipe/p_state.h"
#include "native_modeset.h"
/**
* Only color buffers are listed. The others are allocated privately through,
* for example, st_renderbuffer_alloc_storage().
@ -122,18 +124,6 @@ struct native_config {
boolean scanout_bit;
};
struct native_connector {
int dummy;
};
struct native_mode {
const char *desc;
int width, height;
int refresh_rate;
};
struct native_display_modeset;
/**
* A pipe winsys abstracts the OS. A pipe screen abstracts the graphcis
* hardware. A native display consists of a pipe winsys, a pipe screen, and
@ -205,49 +195,6 @@ struct native_display {
const struct native_display_modeset *modeset;
};
/**
* Mode setting interface of the native display. It exposes the mode setting
* capabilities of the underlying graphics hardware.
*/
struct native_display_modeset {
/**
* Get the available physical connectors and the number of CRTCs.
*/
const struct native_connector **(*get_connectors)(struct native_display *ndpy,
int *num_connectors,
int *num_crtcs);
/**
* Get the current supported modes of a connector. The returned modes may
* change every time this function is called and those from previous calls
* might become invalid.
*/
const struct native_mode **(*get_modes)(struct native_display *ndpy,
const struct native_connector *nconn,
int *num_modes);
/**
* Create a scan-out surface. Required unless no config has
* GLX_SCREEN_BIT_MESA set.
*/
struct native_surface *(*create_scanout_surface)(struct native_display *ndpy,
const struct native_config *nconf,
uint width, uint height);
/**
* Program the CRTC to output the surface to the given connectors with the
* given mode. When surface is not given, the CRTC is disabled.
*
* This interface does not export a way to query capabilities of the CRTCs.
* The native display usually needs to dynamically map the index to a CRTC
* that supports the given connectors.
*/
boolean (*program)(struct native_display *ndpy, int crtc_idx,
struct native_surface *nsurf, uint x, uint y,
const struct native_connector **nconns, int num_nconns,
const struct native_mode *nmode);
};
/**
* The handler for events that a native display may generate. The events are
* generated asynchronously and the handler may be called by any thread at any

View file

@ -0,0 +1,87 @@
/*
* Mesa 3-D graphics library
* Version: 7.8
*
* Copyright (C) 2009-2010 Chia-I Wu <olv@0xlab.org>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef _NATIVE_MODESET_H_
#define _NATIVE_MODESET_H_
#include "pipe/p_compiler.h"
struct native_display;
struct native_surface;
struct native_config;
struct native_connector {
int dummy;
};
struct native_mode {
const char *desc;
int width, height;
int refresh_rate;
};
/**
* Mode setting interface of the native display. It exposes the mode setting
* capabilities of the underlying graphics hardware.
*/
struct native_display_modeset {
/**
* Get the available physical connectors and the number of CRTCs.
*/
const struct native_connector **(*get_connectors)(struct native_display *ndpy,
int *num_connectors,
int *num_crtcs);
/**
* Get the current supported modes of a connector. The returned modes may
* change every time this function is called and those from previous calls
* might become invalid.
*/
const struct native_mode **(*get_modes)(struct native_display *ndpy,
const struct native_connector *nconn,
int *num_modes);
/**
* Create a scan-out surface. Required unless no config has
* GLX_SCREEN_BIT_MESA set.
*/
struct native_surface *(*create_scanout_surface)(struct native_display *ndpy,
const struct native_config *nconf,
uint width, uint height);
/**
* Program the CRTC to output the surface to the given connectors with the
* given mode. When surface is not given, the CRTC is disabled.
*
* This interface does not export a way to query capabilities of the CRTCs.
* The native display usually needs to dynamically map the index to a CRTC
* that supports the given connectors.
*/
boolean (*program)(struct native_display *ndpy, int crtc_idx,
struct native_surface *nsurf, uint x, uint y,
const struct native_connector **nconns, int num_nconns,
const struct native_mode *nmode);
};
#endif /* _NATIVE_MODESET_H_ */