Merge branch 'master' into screencontent

This commit is contained in:
emersion 2018-05-31 12:33:27 +01:00
commit 21928cbe61
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
39 changed files with 163 additions and 144 deletions

View file

@ -52,7 +52,6 @@ struct gbm_bo *get_drm_surface_front(struct wlr_drm_surface *surf);
void post_drm_surface(struct wlr_drm_surface *surf);
struct gbm_bo *copy_drm_surface_mgpu(struct wlr_drm_surface *dest,
struct gbm_bo *src);
bool export_drm_bo(struct gbm_bo *bo,
struct wlr_dmabuf_buffer_attribs *attribs);
bool export_drm_bo(struct gbm_bo *bo, struct wlr_dmabuf_attributes *attribs);
#endif

View file

@ -24,7 +24,7 @@ struct wlr_output_impl {
uint32_t size, uint16_t *r, uint16_t *g, uint16_t *b);
uint32_t (*get_gamma_size)(struct wlr_output *output);
bool (*export_dmabuf)(struct wlr_output *output,
struct wlr_dmabuf_buffer_attribs *attribs);
struct wlr_dmabuf_attributes *attribs);
};
void wlr_output_init(struct wlr_output *output, struct wlr_backend *backend,

View file

@ -0,0 +1,36 @@
#ifndef WLR_RENDER_DMABUF_H
#define WLR_RENDER_DMABUF_H
#include <stdint.h>
// So we don't have to pull in linux specific drm headers
#ifndef DRM_FORMAT_MOD_INVALID
#define DRM_FORMAT_MOD_INVALID ((1ULL<<56) - 1)
#endif
#define WLR_DMABUF_MAX_PLANES 4
enum wlr_dmabuf_attributes_flags {
WLR_DMABUF_ATTRIBUTES_FLAGS_Y_INVERT = 1,
WLR_DMABUF_ATTRIBUTES_FLAGS_INTERLACED = 2,
WLR_DMABUF_ATTRIBUTES_FLAGS_BOTTOM_FIRST = 4,
};
struct wlr_dmabuf_attributes {
int32_t width, height;
uint32_t format;
uint32_t flags; // enum wlr_dmabuf_attributes_flags
uint64_t modifier;
int n_planes;
uint32_t offset[WLR_DMABUF_MAX_PLANES];
uint32_t stride[WLR_DMABUF_MAX_PLANES];
int fd[WLR_DMABUF_MAX_PLANES];
};
/**
* Closes all file descriptors in the DMA-BUF attributes.
*/
void wlr_dmabuf_attributes_finish(struct wlr_dmabuf_attributes *attribs);
#endif

View file

@ -6,7 +6,7 @@
#include <pixman.h>
#include <stdbool.h>
#include <wayland-server.h>
#include <wlr/types/wlr_linux_dmabuf.h>
#include <wlr/render/dmabuf.h>
struct wlr_egl {
EGLDisplay display;
@ -66,14 +66,14 @@ EGLImageKHR wlr_egl_create_image_from_wl_drm(struct wlr_egl *egl,
* of the dmabuf with wlr_egl_check_import_dmabuf once first.
*/
EGLImageKHR wlr_egl_create_image_from_dmabuf(struct wlr_egl *egl,
struct wlr_dmabuf_buffer_attribs *attributes);
struct wlr_dmabuf_attributes *attributes);
/**
* Try to import the given dmabuf. On success return true false otherwise.
* If this succeeds the dmabuf can be used for rendering on a texture
*/
bool wlr_egl_check_import_dmabuf(struct wlr_egl *egl,
struct wlr_dmabuf_buffer *dmabuf);
struct wlr_dmabuf_attributes *attributes);
/**
* Get the available dmabuf formats
@ -88,7 +88,7 @@ int wlr_egl_get_dmabuf_modifiers(struct wlr_egl *egl, int format,
bool wlr_egl_export_image_to_dmabuf(struct wlr_egl *egl, EGLImageKHR image,
int32_t width, int32_t height, uint32_t flags,
struct wlr_dmabuf_buffer_attribs *attribs);
struct wlr_dmabuf_attributes *attribs);
/**
* Destroys an EGL image created with the given wlr_egl.

View file

@ -14,6 +14,6 @@ struct wlr_texture *wlr_gles2_texture_from_pixels(struct wlr_egl *egl,
struct wlr_texture *wlr_gles2_texture_from_wl_drm(struct wlr_egl *egl,
struct wl_resource *data);
struct wlr_texture *wlr_gles2_texture_from_dmabuf(struct wlr_egl *egl,
struct wlr_dmabuf_buffer_attribs *attribs);
struct wlr_dmabuf_attributes *attribs);
#endif

View file

@ -8,8 +8,8 @@
#include <wlr/render/wlr_renderer.h>
#include <wlr/render/wlr_texture.h>
#include <wlr/types/wlr_box.h>
#include <wlr/types/wlr_linux_dmabuf.h>
#include <wlr/types/wlr_output.h>
#include <wlr/render/dmabuf.h>
struct wlr_renderer_impl {
void (*begin)(struct wlr_renderer *renderer, uint32_t width,
@ -31,7 +31,7 @@ struct wlr_renderer_impl {
void (*wl_drm_buffer_get_size)(struct wlr_renderer *renderer,
struct wl_resource *buffer, int *width, int *height);
bool (*check_import_dmabuf)(struct wlr_renderer *renderer,
struct wlr_dmabuf_buffer *dmabuf);
struct wlr_dmabuf_attributes *attribs);
int (*get_dmabuf_formats)(struct wlr_renderer *renderer, int **formats);
int (*get_dmabuf_modifiers)(struct wlr_renderer *renderer, int format,
uint64_t **modifiers);
@ -47,7 +47,7 @@ struct wlr_renderer_impl {
struct wlr_texture *(*texture_from_wl_drm)(struct wlr_renderer *renderer,
struct wl_resource *data);
struct wlr_texture *(*texture_from_dmabuf)(struct wlr_renderer *renderer,
struct wlr_dmabuf_buffer_attribs *attribs);
struct wlr_dmabuf_attributes *attribs);
void (*destroy)(struct wlr_renderer *renderer);
void (*init_wl_display)(struct wlr_renderer *renderer,
struct wl_display *wl_display);
@ -63,7 +63,7 @@ struct wlr_texture_impl {
uint32_t height, uint32_t src_x, uint32_t src_y, uint32_t dst_x,
uint32_t dst_y, const void *data);
bool (*to_dmabuf)(struct wlr_texture *texture,
struct wlr_dmabuf_buffer_attribs *attribs);
struct wlr_dmabuf_attributes *attribs);
void (*destroy)(struct wlr_texture *texture);
};

View file

@ -89,7 +89,7 @@ int wlr_renderer_get_dmabuf_modifiers(struct wlr_renderer *renderer, int format,
* If this succeeds the dmabuf can be used for rendering on a texture
*/
bool wlr_renderer_check_import_dmabuf(struct wlr_renderer *renderer,
struct wlr_dmabuf_buffer *dmabuf);
struct wlr_dmabuf_attributes *attributes);
/**
* Reads out of pixels of the currently bound surface into data. `stride` is in
* bytes.

View file

@ -5,7 +5,7 @@
#include <EGL/eglext.h>
#include <stdint.h>
#include <wayland-server-protocol.h>
#include <wlr/types/wlr_linux_dmabuf.h>
#include <wlr/render/dmabuf.h>
struct wlr_renderer;
struct wlr_texture_impl;
@ -33,7 +33,7 @@ struct wlr_texture *wlr_texture_from_wl_drm(struct wlr_renderer *renderer,
* Create a new texture from a DMA-BUF. The returned texture is immutable.
*/
struct wlr_texture *wlr_texture_from_dmabuf(struct wlr_renderer *renderer,
struct wlr_dmabuf_buffer_attribs *attribs);
struct wlr_dmabuf_attributes *attribs);
/**
* Get the texture width and height.
@ -49,7 +49,7 @@ bool wlr_texture_write_pixels(struct wlr_texture *texture,
const void *data);
bool wlr_texture_to_dmabuf(struct wlr_texture *texture,
struct wlr_dmabuf_buffer_attribs *attribs);
struct wlr_dmabuf_attributes *attribs);
/**
* Destroys this wlr_texture.

View file

@ -2,7 +2,7 @@
#define WLR_TYPES_WLR_EXPORT_DMABUF_V1_H
#include <wayland-server.h>
#include <wlr/types/wlr_linux_dmabuf.h>
#include <wlr/render/dmabuf.h>
struct wlr_export_dmabuf_manager_v1;
@ -11,7 +11,7 @@ struct wlr_export_dmabuf_frame_v1 {
struct wlr_export_dmabuf_manager_v1 *manager;
struct wl_list link;
struct wlr_dmabuf_buffer_attribs attribs;
struct wlr_dmabuf_attributes attribs;
struct wlr_output *output;
struct wl_listener output_swap_buffers;

View file

@ -1,48 +1,18 @@
#ifndef WLR_TYPES_WLR_LINUX_DMABUF_H
#define WLR_TYPES_WLR_LINUX_DMABUF_H
#define WLR_LINUX_DMABUF_MAX_PLANES 4
#include <stdint.h>
#include <wayland-server-protocol.h>
/* So we don't have to pull in linux specific drm headers */
#ifndef DRM_FORMAT_MOD_INVALID
#define DRM_FORMAT_MOD_INVALID ((1ULL<<56) - 1)
#endif
enum {
WLR_DMABUF_BUFFER_ATTRIBS_FLAGS_Y_INVERT = 1,
WLR_DMABUF_BUFFER_ATTRIBS_FLAGS_INTERLACED = 2,
WLR_DMABUF_BUFFER_ATTRIBS_FLAGS_BOTTOM_FIRST = 4,
};
struct wlr_dmabuf_buffer_attribs {
/* set via params_add */
int n_planes;
uint32_t offset[WLR_LINUX_DMABUF_MAX_PLANES];
uint32_t stride[WLR_LINUX_DMABUF_MAX_PLANES];
uint64_t modifier[WLR_LINUX_DMABUF_MAX_PLANES];
int fd[WLR_LINUX_DMABUF_MAX_PLANES];
/* set via params_create */
int32_t width, height;
uint32_t format;
uint32_t flags;
};
#include <wlr/render/dmabuf.h>
struct wlr_dmabuf_buffer {
struct wlr_renderer *renderer;
struct wl_resource *buffer_resource;
struct wl_resource *params_resource;
struct wlr_dmabuf_buffer_attribs attributes;
struct wlr_dmabuf_attributes attributes;
bool has_modifier;
};
/**
* Closes all file descriptors in the DMA-BUF attributes.
*/
void wlr_dmabuf_buffer_attribs_finish(
struct wlr_dmabuf_buffer_attribs *attribs);
/**
* Returns true if the given resource was created via the linux-dmabuf
* buffer protocol, false otherwise

View file

@ -170,7 +170,7 @@ void wlr_output_set_gamma(struct wlr_output *output,
uint32_t size, uint16_t *r, uint16_t *g, uint16_t *b);
uint32_t wlr_output_get_gamma_size(struct wlr_output *output);
bool wlr_output_export_dmabuf(struct wlr_output *output,
struct wlr_dmabuf_buffer_attribs *attribs);
struct wlr_dmabuf_attributes *attribs);
void wlr_output_set_fullscreen_surface(struct wlr_output *output,
struct wlr_surface *surface);
struct wlr_output *wlr_output_from_resource(struct wl_resource *resource);