weston/libweston/compositor-drm.h

149 lines
4.6 KiB
C
Raw Normal View History

drm: port the drm backend to the new init api Preparing for libweston and for the separation of the code base into libweston vs. weston the compositor, we must remove all uses weston_config structures from the backends. We have decided that all option and config input happens in the compositor (main.c), and configuration is passed in for the backends as structs. Most other backends have already converted, and this patch converts the DRM-backend to the libweston-style init API. The libweston-style init API includes a header for each backend (here compositor-drm.h) defining the configuration interface. The compositor (main.c) prepares a configuration struct to be passed through libweston core to the backend during initialization. A complication with the DRM-backend is that outputs can be hotplugged, and their configuration needs to be fetched from the compositor (main.c). For this, the config struct contains a callback member. The output configuration API is subject to change later, this is just a temporary API to get libweston forward. As weston_compositor's user_data was not previously used for anything, and the output configuration callback needs data, the user_data is set to the 'config' pointer. This pointer is only used in drm_configure_output() in main.c. [Bryce: lots of stuff and rebasing] Signed-off-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net> Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Tested-by: Benoit Gschwind <gschwind@gnu-log.net> [Pekka: write commit message] [Pekka: squash in "drm: Don't hang onto the backend config object post-backend_init" from Bryce Harrington] [Pekka: drop the compositor.h hunk] [Pekka: do not #include inside extern "C"] [Pekka: remove incorrect comment about weston_drm_backend_config ownership.] Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-04-30 01:40:34 +03:00
/*
* Copyright © 2008-2011 Kristian Høgsberg
* Copyright © 2011 Intel Corporation
* Copyright © 2015 Giulio Camuffo
*
* 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 (including the
* next paragraph) 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 THE AUTHORS OR COPYRIGHT HOLDERS
* 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 WESTON_COMPOSITOR_DRM_H
#define WESTON_COMPOSITOR_DRM_H
#include "compositor.h"
weston: Port DRM backend to new output handling API This is a complete port of the DRM backend that uses the recently added output handling API for output configuration. Output can be configured at runtime by passing the necessary configuration parameters, which can be filled in manually or obtained from the configuration file using previously added functionality. It is required that the scale and transform values are set using the previously added functionality. After everything has been set, output needs to be enabled manually using weston_output_enable(). v2: - Added missing drmModeFreeCrtc() to drm_output_enable() cleanup list in case of failure. - Split drm_backend_disable() into drm_backend_deinit() to accomodate for changes in the first patch in the series. Moved restoring original crtc to drm_output_destroy(). v3: - Moved origcrtc allocation to drm_output_set_mode(). - Swapped connector_get_current_mode() and drm_output_add_mode() calls in drm_output_set_mode() to match current weston. - Moved crtc_allocator and connector_allocator update from drm_output_enable() to create_output_for_connector() to avoid problems when more than one monitor is connected at startup and crtc allocator wasn't updated before create_output_for_connector() was called second time, resulting in one screen being turned off. - Moved crtc_allocator and connector_allocator update from drm_output_deinit() to drm_output_destroy(), as it should not be called on drm_output_disable(). - Use weston_compositor_add_pending_output(). - Bump weston_drm_backend_config version to 2. v4: - Reset output->original_crtc to NULL if drm_output_set_mode() fails. - Remove unneeded log message when disabling an output when a pageflip is pending. - Document that create_output_for_connector() takes ownership of the connector. - Free the connector if create output conditionals are not met in create_outputs() and update_outputs(). Signed-off-by: Armin Krezović <krezovic.armin@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-09-30 15:11:05 +03:00
#include "plugin-registry.h"
drm: port the drm backend to the new init api Preparing for libweston and for the separation of the code base into libweston vs. weston the compositor, we must remove all uses weston_config structures from the backends. We have decided that all option and config input happens in the compositor (main.c), and configuration is passed in for the backends as structs. Most other backends have already converted, and this patch converts the DRM-backend to the libweston-style init API. The libweston-style init API includes a header for each backend (here compositor-drm.h) defining the configuration interface. The compositor (main.c) prepares a configuration struct to be passed through libweston core to the backend during initialization. A complication with the DRM-backend is that outputs can be hotplugged, and their configuration needs to be fetched from the compositor (main.c). For this, the config struct contains a callback member. The output configuration API is subject to change later, this is just a temporary API to get libweston forward. As weston_compositor's user_data was not previously used for anything, and the output configuration callback needs data, the user_data is set to the 'config' pointer. This pointer is only used in drm_configure_output() in main.c. [Bryce: lots of stuff and rebasing] Signed-off-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net> Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Tested-by: Benoit Gschwind <gschwind@gnu-log.net> [Pekka: write commit message] [Pekka: squash in "drm: Don't hang onto the backend config object post-backend_init" from Bryce Harrington] [Pekka: drop the compositor.h hunk] [Pekka: do not #include inside extern "C"] [Pekka: remove incorrect comment about weston_drm_backend_config ownership.] Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-04-30 01:40:34 +03:00
#ifdef __cplusplus
extern "C" {
#endif
#define WESTON_DRM_BACKEND_CONFIG_VERSION 3
drm: port the drm backend to the new init api Preparing for libweston and for the separation of the code base into libweston vs. weston the compositor, we must remove all uses weston_config structures from the backends. We have decided that all option and config input happens in the compositor (main.c), and configuration is passed in for the backends as structs. Most other backends have already converted, and this patch converts the DRM-backend to the libweston-style init API. The libweston-style init API includes a header for each backend (here compositor-drm.h) defining the configuration interface. The compositor (main.c) prepares a configuration struct to be passed through libweston core to the backend during initialization. A complication with the DRM-backend is that outputs can be hotplugged, and their configuration needs to be fetched from the compositor (main.c). For this, the config struct contains a callback member. The output configuration API is subject to change later, this is just a temporary API to get libweston forward. As weston_compositor's user_data was not previously used for anything, and the output configuration callback needs data, the user_data is set to the 'config' pointer. This pointer is only used in drm_configure_output() in main.c. [Bryce: lots of stuff and rebasing] Signed-off-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net> Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Tested-by: Benoit Gschwind <gschwind@gnu-log.net> [Pekka: write commit message] [Pekka: squash in "drm: Don't hang onto the backend config object post-backend_init" from Bryce Harrington] [Pekka: drop the compositor.h hunk] [Pekka: do not #include inside extern "C"] [Pekka: remove incorrect comment about weston_drm_backend_config ownership.] Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-04-30 01:40:34 +03:00
struct libinput_device;
drm: port the drm backend to the new init api Preparing for libweston and for the separation of the code base into libweston vs. weston the compositor, we must remove all uses weston_config structures from the backends. We have decided that all option and config input happens in the compositor (main.c), and configuration is passed in for the backends as structs. Most other backends have already converted, and this patch converts the DRM-backend to the libweston-style init API. The libweston-style init API includes a header for each backend (here compositor-drm.h) defining the configuration interface. The compositor (main.c) prepares a configuration struct to be passed through libweston core to the backend during initialization. A complication with the DRM-backend is that outputs can be hotplugged, and their configuration needs to be fetched from the compositor (main.c). For this, the config struct contains a callback member. The output configuration API is subject to change later, this is just a temporary API to get libweston forward. As weston_compositor's user_data was not previously used for anything, and the output configuration callback needs data, the user_data is set to the 'config' pointer. This pointer is only used in drm_configure_output() in main.c. [Bryce: lots of stuff and rebasing] Signed-off-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net> Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Tested-by: Benoit Gschwind <gschwind@gnu-log.net> [Pekka: write commit message] [Pekka: squash in "drm: Don't hang onto the backend config object post-backend_init" from Bryce Harrington] [Pekka: drop the compositor.h hunk] [Pekka: do not #include inside extern "C"] [Pekka: remove incorrect comment about weston_drm_backend_config ownership.] Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-04-30 01:40:34 +03:00
enum weston_drm_backend_output_mode {
/** The output is disabled */
WESTON_DRM_BACKEND_OUTPUT_OFF,
/** The output will use the current active mode */
WESTON_DRM_BACKEND_OUTPUT_CURRENT,
/** The output will use the preferred mode. A modeline can be provided
* by setting weston_backend_output_config::modeline in the form of
* "WIDTHxHEIGHT" or in the form of an explicit modeline calculated
* using e.g. the cvt tool. If a valid modeline is supplied it will be
* used, if invalid or NULL the preferred available mode will be used. */
WESTON_DRM_BACKEND_OUTPUT_PREFERRED,
};
weston: Port DRM backend to new output handling API This is a complete port of the DRM backend that uses the recently added output handling API for output configuration. Output can be configured at runtime by passing the necessary configuration parameters, which can be filled in manually or obtained from the configuration file using previously added functionality. It is required that the scale and transform values are set using the previously added functionality. After everything has been set, output needs to be enabled manually using weston_output_enable(). v2: - Added missing drmModeFreeCrtc() to drm_output_enable() cleanup list in case of failure. - Split drm_backend_disable() into drm_backend_deinit() to accomodate for changes in the first patch in the series. Moved restoring original crtc to drm_output_destroy(). v3: - Moved origcrtc allocation to drm_output_set_mode(). - Swapped connector_get_current_mode() and drm_output_add_mode() calls in drm_output_set_mode() to match current weston. - Moved crtc_allocator and connector_allocator update from drm_output_enable() to create_output_for_connector() to avoid problems when more than one monitor is connected at startup and crtc allocator wasn't updated before create_output_for_connector() was called second time, resulting in one screen being turned off. - Moved crtc_allocator and connector_allocator update from drm_output_deinit() to drm_output_destroy(), as it should not be called on drm_output_disable(). - Use weston_compositor_add_pending_output(). - Bump weston_drm_backend_config version to 2. v4: - Reset output->original_crtc to NULL if drm_output_set_mode() fails. - Remove unneeded log message when disabling an output when a pageflip is pending. - Document that create_output_for_connector() takes ownership of the connector. - Free the connector if create output conditionals are not met in create_outputs() and update_outputs(). Signed-off-by: Armin Krezović <krezovic.armin@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-09-30 15:11:05 +03:00
#define WESTON_DRM_OUTPUT_API_NAME "weston_drm_output_api_v1"
struct weston_drm_output_api {
/** The mode to be used by the output. Refer to the documentation
* of WESTON_DRM_BACKEND_OUTPUT_PREFERRED for details.
*
* Returns 0 on success, -1 on failure.
*/
int (*set_mode)(struct weston_output *output,
enum weston_drm_backend_output_mode mode,
const char *modeline);
drm: port the drm backend to the new init api Preparing for libweston and for the separation of the code base into libweston vs. weston the compositor, we must remove all uses weston_config structures from the backends. We have decided that all option and config input happens in the compositor (main.c), and configuration is passed in for the backends as structs. Most other backends have already converted, and this patch converts the DRM-backend to the libweston-style init API. The libweston-style init API includes a header for each backend (here compositor-drm.h) defining the configuration interface. The compositor (main.c) prepares a configuration struct to be passed through libweston core to the backend during initialization. A complication with the DRM-backend is that outputs can be hotplugged, and their configuration needs to be fetched from the compositor (main.c). For this, the config struct contains a callback member. The output configuration API is subject to change later, this is just a temporary API to get libweston forward. As weston_compositor's user_data was not previously used for anything, and the output configuration callback needs data, the user_data is set to the 'config' pointer. This pointer is only used in drm_configure_output() in main.c. [Bryce: lots of stuff and rebasing] Signed-off-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net> Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Tested-by: Benoit Gschwind <gschwind@gnu-log.net> [Pekka: write commit message] [Pekka: squash in "drm: Don't hang onto the backend config object post-backend_init" from Bryce Harrington] [Pekka: drop the compositor.h hunk] [Pekka: do not #include inside extern "C"] [Pekka: remove incorrect comment about weston_drm_backend_config ownership.] Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-04-30 01:40:34 +03:00
/** The pixel format to be used by the output. Valid values are:
* - NULL - The format set at backend creation time will be used;
* - "xrgb8888";
* - "rgb565"
* - "xrgb2101010"
*/
weston: Port DRM backend to new output handling API This is a complete port of the DRM backend that uses the recently added output handling API for output configuration. Output can be configured at runtime by passing the necessary configuration parameters, which can be filled in manually or obtained from the configuration file using previously added functionality. It is required that the scale and transform values are set using the previously added functionality. After everything has been set, output needs to be enabled manually using weston_output_enable(). v2: - Added missing drmModeFreeCrtc() to drm_output_enable() cleanup list in case of failure. - Split drm_backend_disable() into drm_backend_deinit() to accomodate for changes in the first patch in the series. Moved restoring original crtc to drm_output_destroy(). v3: - Moved origcrtc allocation to drm_output_set_mode(). - Swapped connector_get_current_mode() and drm_output_add_mode() calls in drm_output_set_mode() to match current weston. - Moved crtc_allocator and connector_allocator update from drm_output_enable() to create_output_for_connector() to avoid problems when more than one monitor is connected at startup and crtc allocator wasn't updated before create_output_for_connector() was called second time, resulting in one screen being turned off. - Moved crtc_allocator and connector_allocator update from drm_output_deinit() to drm_output_destroy(), as it should not be called on drm_output_disable(). - Use weston_compositor_add_pending_output(). - Bump weston_drm_backend_config version to 2. v4: - Reset output->original_crtc to NULL if drm_output_set_mode() fails. - Remove unneeded log message when disabling an output when a pageflip is pending. - Document that create_output_for_connector() takes ownership of the connector. - Free the connector if create output conditionals are not met in create_outputs() and update_outputs(). Signed-off-by: Armin Krezović <krezovic.armin@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-09-30 15:11:05 +03:00
void (*set_gbm_format)(struct weston_output *output,
const char *gbm_format);
drm: port the drm backend to the new init api Preparing for libweston and for the separation of the code base into libweston vs. weston the compositor, we must remove all uses weston_config structures from the backends. We have decided that all option and config input happens in the compositor (main.c), and configuration is passed in for the backends as structs. Most other backends have already converted, and this patch converts the DRM-backend to the libweston-style init API. The libweston-style init API includes a header for each backend (here compositor-drm.h) defining the configuration interface. The compositor (main.c) prepares a configuration struct to be passed through libweston core to the backend during initialization. A complication with the DRM-backend is that outputs can be hotplugged, and their configuration needs to be fetched from the compositor (main.c). For this, the config struct contains a callback member. The output configuration API is subject to change later, this is just a temporary API to get libweston forward. As weston_compositor's user_data was not previously used for anything, and the output configuration callback needs data, the user_data is set to the 'config' pointer. This pointer is only used in drm_configure_output() in main.c. [Bryce: lots of stuff and rebasing] Signed-off-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net> Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Tested-by: Benoit Gschwind <gschwind@gnu-log.net> [Pekka: write commit message] [Pekka: squash in "drm: Don't hang onto the backend config object post-backend_init" from Bryce Harrington] [Pekka: drop the compositor.h hunk] [Pekka: do not #include inside extern "C"] [Pekka: remove incorrect comment about weston_drm_backend_config ownership.] Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-04-30 01:40:34 +03:00
/** The seat to be used by the output. Set to NULL to use the
weston: Port DRM backend to new output handling API This is a complete port of the DRM backend that uses the recently added output handling API for output configuration. Output can be configured at runtime by passing the necessary configuration parameters, which can be filled in manually or obtained from the configuration file using previously added functionality. It is required that the scale and transform values are set using the previously added functionality. After everything has been set, output needs to be enabled manually using weston_output_enable(). v2: - Added missing drmModeFreeCrtc() to drm_output_enable() cleanup list in case of failure. - Split drm_backend_disable() into drm_backend_deinit() to accomodate for changes in the first patch in the series. Moved restoring original crtc to drm_output_destroy(). v3: - Moved origcrtc allocation to drm_output_set_mode(). - Swapped connector_get_current_mode() and drm_output_add_mode() calls in drm_output_set_mode() to match current weston. - Moved crtc_allocator and connector_allocator update from drm_output_enable() to create_output_for_connector() to avoid problems when more than one monitor is connected at startup and crtc allocator wasn't updated before create_output_for_connector() was called second time, resulting in one screen being turned off. - Moved crtc_allocator and connector_allocator update from drm_output_deinit() to drm_output_destroy(), as it should not be called on drm_output_disable(). - Use weston_compositor_add_pending_output(). - Bump weston_drm_backend_config version to 2. v4: - Reset output->original_crtc to NULL if drm_output_set_mode() fails. - Remove unneeded log message when disabling an output when a pageflip is pending. - Document that create_output_for_connector() takes ownership of the connector. - Free the connector if create output conditionals are not met in create_outputs() and update_outputs(). Signed-off-by: Armin Krezović <krezovic.armin@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-09-30 15:11:05 +03:00
* default seat.
*/
void (*set_seat)(struct weston_output *output,
const char *seat);
drm: port the drm backend to the new init api Preparing for libweston and for the separation of the code base into libweston vs. weston the compositor, we must remove all uses weston_config structures from the backends. We have decided that all option and config input happens in the compositor (main.c), and configuration is passed in for the backends as structs. Most other backends have already converted, and this patch converts the DRM-backend to the libweston-style init API. The libweston-style init API includes a header for each backend (here compositor-drm.h) defining the configuration interface. The compositor (main.c) prepares a configuration struct to be passed through libweston core to the backend during initialization. A complication with the DRM-backend is that outputs can be hotplugged, and their configuration needs to be fetched from the compositor (main.c). For this, the config struct contains a callback member. The output configuration API is subject to change later, this is just a temporary API to get libweston forward. As weston_compositor's user_data was not previously used for anything, and the output configuration callback needs data, the user_data is set to the 'config' pointer. This pointer is only used in drm_configure_output() in main.c. [Bryce: lots of stuff and rebasing] Signed-off-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net> Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Tested-by: Benoit Gschwind <gschwind@gnu-log.net> [Pekka: write commit message] [Pekka: squash in "drm: Don't hang onto the backend config object post-backend_init" from Bryce Harrington] [Pekka: drop the compositor.h hunk] [Pekka: do not #include inside extern "C"] [Pekka: remove incorrect comment about weston_drm_backend_config ownership.] Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-04-30 01:40:34 +03:00
};
weston: Port DRM backend to new output handling API This is a complete port of the DRM backend that uses the recently added output handling API for output configuration. Output can be configured at runtime by passing the necessary configuration parameters, which can be filled in manually or obtained from the configuration file using previously added functionality. It is required that the scale and transform values are set using the previously added functionality. After everything has been set, output needs to be enabled manually using weston_output_enable(). v2: - Added missing drmModeFreeCrtc() to drm_output_enable() cleanup list in case of failure. - Split drm_backend_disable() into drm_backend_deinit() to accomodate for changes in the first patch in the series. Moved restoring original crtc to drm_output_destroy(). v3: - Moved origcrtc allocation to drm_output_set_mode(). - Swapped connector_get_current_mode() and drm_output_add_mode() calls in drm_output_set_mode() to match current weston. - Moved crtc_allocator and connector_allocator update from drm_output_enable() to create_output_for_connector() to avoid problems when more than one monitor is connected at startup and crtc allocator wasn't updated before create_output_for_connector() was called second time, resulting in one screen being turned off. - Moved crtc_allocator and connector_allocator update from drm_output_deinit() to drm_output_destroy(), as it should not be called on drm_output_disable(). - Use weston_compositor_add_pending_output(). - Bump weston_drm_backend_config version to 2. v4: - Reset output->original_crtc to NULL if drm_output_set_mode() fails. - Remove unneeded log message when disabling an output when a pageflip is pending. - Document that create_output_for_connector() takes ownership of the connector. - Free the connector if create output conditionals are not met in create_outputs() and update_outputs(). Signed-off-by: Armin Krezović <krezovic.armin@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-09-30 15:11:05 +03:00
static inline const struct weston_drm_output_api *
weston_drm_output_get_api(struct weston_compositor *compositor)
{
const void *api;
api = weston_plugin_api_get(compositor, WESTON_DRM_OUTPUT_API_NAME,
sizeof(struct weston_drm_output_api));
return (const struct weston_drm_output_api *)api;
}
drm: port the drm backend to the new init api Preparing for libweston and for the separation of the code base into libweston vs. weston the compositor, we must remove all uses weston_config structures from the backends. We have decided that all option and config input happens in the compositor (main.c), and configuration is passed in for the backends as structs. Most other backends have already converted, and this patch converts the DRM-backend to the libweston-style init API. The libweston-style init API includes a header for each backend (here compositor-drm.h) defining the configuration interface. The compositor (main.c) prepares a configuration struct to be passed through libweston core to the backend during initialization. A complication with the DRM-backend is that outputs can be hotplugged, and their configuration needs to be fetched from the compositor (main.c). For this, the config struct contains a callback member. The output configuration API is subject to change later, this is just a temporary API to get libweston forward. As weston_compositor's user_data was not previously used for anything, and the output configuration callback needs data, the user_data is set to the 'config' pointer. This pointer is only used in drm_configure_output() in main.c. [Bryce: lots of stuff and rebasing] Signed-off-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net> Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Tested-by: Benoit Gschwind <gschwind@gnu-log.net> [Pekka: write commit message] [Pekka: squash in "drm: Don't hang onto the backend config object post-backend_init" from Bryce Harrington] [Pekka: drop the compositor.h hunk] [Pekka: do not #include inside extern "C"] [Pekka: remove incorrect comment about weston_drm_backend_config ownership.] Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-04-30 01:40:34 +03:00
/** The backend configuration struct.
*
* weston_drm_backend_config contains the configuration used by a DRM
* backend.
*/
struct weston_drm_backend_config {
struct weston_backend_config base;
/** The tty to be used. Set to 0 to use the current tty. */
int tty;
/** Whether to use the pixman renderer instead of the OpenGL ES renderer. */
bool use_pixman;
/** The seat to be used for input and output.
*
* If NULL the default "seat0" will be used. The backend will
* take ownership of the seat_id pointer and will free it on
* backend destruction.
*/
char *seat_id;
/** The pixel format of the framebuffer to be used.
*
* Valid values are:
* - NULL - The default format ("xrgb8888") will be used;
* - "xrgb8888";
* - "rgb565"
* - "xrgb2101010"
* The backend will take ownership of the format pointer and will free
* it on backend destruction.
*/
char *gbm_format;
/** Callback used to configure input devices.
*
* This function will be called by the backend when a new input device
* needs to be configured.
* If NULL the device will use the default configuration.
*/
void (*configure_device)(struct weston_compositor *compositor,
struct libinput_device *device);
compositor-drm: pageflip timeout implementation Weston will not repaint until previous update has been acked by a pageflip event coming from the drm driver. However, some buggy drivers won’t return those events or will stop sending them at some point and Weston output repaints will completely freeze. To ease developers’ task in testing their drivers, this patch makes compositor-drm use a timer to detect cases where those pageflip events stop coming. This timeout implementation is software only and includes basic features usually found in a watchdog. We simply exit Weston gracefully with a log message and an exit code when the timout is reached. The timeout value can be set via weston.ini by adding a pageflip-timeout=<MILLISECONDS> entry under [core] section. Setting it to 0 disables the timeout feature. v2: - Made sure we would get both the pageflip and the vblank events before stopping the timer. - Reordered the error and success cases in drm_output_pageflip_timer_create() to be more in line with the rest of the code. v3: - Reordered (de)arming of the timer with the code around it to avoid it being rearmed before the current dearming. - Return the proper value for the dispatcher in the pageflip_timeout callback. - Also display the output name in case the timer fires. v4: - Reordered a forgotten timer rearming after its drmModePageFlip(). Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=83884 Signed-off-by: Frederic Plourde <frederic.plourde at collabora.co.uk> Signed-off-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com> Reviewed-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-03-07 16:27:54 +03:00
/** Maximum duration for a pageflip event to arrive, after which the
* compositor will consider the DRM driver crashed and will try to exit
* cleanly.
*
* It is exprimed in milliseconds, 0 means disabled. */
uint32_t pageflip_timeout;
drm: port the drm backend to the new init api Preparing for libweston and for the separation of the code base into libweston vs. weston the compositor, we must remove all uses weston_config structures from the backends. We have decided that all option and config input happens in the compositor (main.c), and configuration is passed in for the backends as structs. Most other backends have already converted, and this patch converts the DRM-backend to the libweston-style init API. The libweston-style init API includes a header for each backend (here compositor-drm.h) defining the configuration interface. The compositor (main.c) prepares a configuration struct to be passed through libweston core to the backend during initialization. A complication with the DRM-backend is that outputs can be hotplugged, and their configuration needs to be fetched from the compositor (main.c). For this, the config struct contains a callback member. The output configuration API is subject to change later, this is just a temporary API to get libweston forward. As weston_compositor's user_data was not previously used for anything, and the output configuration callback needs data, the user_data is set to the 'config' pointer. This pointer is only used in drm_configure_output() in main.c. [Bryce: lots of stuff and rebasing] Signed-off-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net> Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Tested-by: Benoit Gschwind <gschwind@gnu-log.net> [Pekka: write commit message] [Pekka: squash in "drm: Don't hang onto the backend config object post-backend_init" from Bryce Harrington] [Pekka: drop the compositor.h hunk] [Pekka: do not #include inside extern "C"] [Pekka: remove incorrect comment about weston_drm_backend_config ownership.] Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-04-30 01:40:34 +03:00
};
#ifdef __cplusplus
}
#endif
#endif /* WESTON_COMPOSITOR_DRM_H */