mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-20 06:47:19 -04:00
wip: backend props
This commit is contained in:
parent
214df8eda0
commit
16cec14591
5 changed files with 20 additions and 24 deletions
|
|
@ -13,7 +13,6 @@
|
||||||
#include <wlr/config.h>
|
#include <wlr/config.h>
|
||||||
#include <wlr/render/wlr_renderer.h>
|
#include <wlr/render/wlr_renderer.h>
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
#include "backend/backend.h"
|
|
||||||
#include "backend/multi.h"
|
#include "backend/multi.h"
|
||||||
#include "render/allocator/allocator.h"
|
#include "render/allocator/allocator.h"
|
||||||
#include "util/env.h"
|
#include "util/env.h"
|
||||||
|
|
@ -116,7 +115,12 @@ static struct wlr_session *session_create_and_wait(struct wl_display *disp) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const struct wlr_backend_props *wlr_backend_get_props(struct wlr_backend *backend) {
|
||||||
|
return backend->impl->get_props(backend);
|
||||||
|
}
|
||||||
|
|
||||||
clockid_t wlr_backend_get_presentation_clock(struct wlr_backend *backend) {
|
clockid_t wlr_backend_get_presentation_clock(struct wlr_backend *backend) {
|
||||||
|
return wlr_backend_get_props(backend)->presentation_clock;
|
||||||
if (backend->impl->get_presentation_clock) {
|
if (backend->impl->get_presentation_clock) {
|
||||||
return backend->impl->get_presentation_clock(backend);
|
return backend->impl->get_presentation_clock(backend);
|
||||||
}
|
}
|
||||||
|
|
@ -130,14 +134,6 @@ int wlr_backend_get_drm_fd(struct wlr_backend *backend) {
|
||||||
return backend->impl->get_drm_fd(backend);
|
return backend->impl->get_drm_fd(backend);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t backend_get_buffer_caps(struct wlr_backend *backend) {
|
|
||||||
if (!backend->impl->get_buffer_caps) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return backend->impl->get_buffer_caps(backend);
|
|
||||||
}
|
|
||||||
|
|
||||||
static size_t parse_outputs_env(const char *name) {
|
static size_t parse_outputs_env(const char *name) {
|
||||||
const char *outputs_str = getenv(name);
|
const char *outputs_str = getenv(name);
|
||||||
if (outputs_str == NULL) {
|
if (outputs_str == NULL) {
|
||||||
|
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
#ifndef BACKEND_WLR_BACKEND_H
|
|
||||||
#define BACKEND_WLR_BACKEND_H
|
|
||||||
|
|
||||||
#include <wlr/backend.h>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the supported buffer capabilities.
|
|
||||||
*
|
|
||||||
* This functions returns a bitfield of supported wlr_buffer_cap.
|
|
||||||
*/
|
|
||||||
uint32_t backend_get_buffer_caps(struct wlr_backend *backend);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -30,6 +30,16 @@ struct wlr_backend {
|
||||||
} events;
|
} events;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Backend properties.
|
||||||
|
*/
|
||||||
|
struct wlr_backend_props {
|
||||||
|
/* Supported buffer capabilities, bitfield of enum wlr_buffer_cap */
|
||||||
|
uint32_t buffer_caps;
|
||||||
|
/* Clock used for presentation feedback */
|
||||||
|
clockid_t presentation_clock;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Automatically initializes the most suitable backend given the environment.
|
* Automatically initializes the most suitable backend given the environment.
|
||||||
* Will always return a multi-backend. The backend is created but not started.
|
* Will always return a multi-backend. The backend is created but not started.
|
||||||
|
|
@ -51,6 +61,10 @@ bool wlr_backend_start(struct wlr_backend *backend);
|
||||||
* automatically when the struct wl_display is destroyed.
|
* automatically when the struct wl_display is destroyed.
|
||||||
*/
|
*/
|
||||||
void wlr_backend_destroy(struct wlr_backend *backend);
|
void wlr_backend_destroy(struct wlr_backend *backend);
|
||||||
|
/**
|
||||||
|
* Get backend properties.
|
||||||
|
*/
|
||||||
|
const struct wlr_backend_props *wlr_backend_get_props(struct wlr_backend *backend);
|
||||||
/**
|
/**
|
||||||
* Returns the clock used by the backend for presentation feedback.
|
* Returns the clock used by the backend for presentation feedback.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
struct wlr_backend_impl {
|
struct wlr_backend_impl {
|
||||||
bool (*start)(struct wlr_backend *backend);
|
bool (*start)(struct wlr_backend *backend);
|
||||||
void (*destroy)(struct wlr_backend *backend);
|
void (*destroy)(struct wlr_backend *backend);
|
||||||
clockid_t (*get_presentation_clock)(struct wlr_backend *backend);
|
const struct wlr_backend_props *(*get_props)(struct wlr_backend *backend);
|
||||||
int (*get_drm_fd)(struct wlr_backend *backend);
|
int (*get_drm_fd)(struct wlr_backend *backend);
|
||||||
uint32_t (*get_buffer_caps)(struct wlr_backend *backend);
|
uint32_t (*get_buffer_caps)(struct wlr_backend *backend);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
#include <xf86drm.h>
|
#include <xf86drm.h>
|
||||||
#include <xf86drmMode.h>
|
#include <xf86drmMode.h>
|
||||||
#include "backend/backend.h"
|
|
||||||
#include "render/allocator/allocator.h"
|
#include "render/allocator/allocator.h"
|
||||||
#include "render/allocator/drm_dumb.h"
|
#include "render/allocator/drm_dumb.h"
|
||||||
#include "render/allocator/shm.h"
|
#include "render/allocator/shm.h"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue