render: rename wlr_renderer_get_dmabuf_formats

Rename wlr_renderer_get_dmabuf_formats to
wlr_renderer_get_dmabuf_texture_formats. This makes it clear the formats
are only suitable for creating wlr_textures.
This commit is contained in:
Simon Ser 2020-11-18 14:53:13 +01:00
parent c045253927
commit 49115e9d5d
7 changed files with 23 additions and 19 deletions

View file

@ -77,7 +77,7 @@ struct wlr_egl {
struct wl_display *wl_display; struct wl_display *wl_display;
struct wlr_drm_format_set dmabuf_formats; struct wlr_drm_format_set dmabuf_texture_formats;
struct wlr_drm_format_set dmabuf_render_formats; struct wlr_drm_format_set dmabuf_render_formats;
EGLBoolean **external_only_dmabuf_formats; EGLBoolean **external_only_dmabuf_formats;
}; };
@ -126,7 +126,8 @@ EGLImageKHR wlr_egl_create_image_from_dmabuf(struct wlr_egl *egl,
/** /**
* Get DMA-BUF formats suitable for sampling usage. * Get DMA-BUF formats suitable for sampling usage.
*/ */
const struct wlr_drm_format_set *wlr_egl_get_dmabuf_formats(struct wlr_egl *egl); const struct wlr_drm_format_set *wlr_egl_get_dmabuf_texture_formats(
struct wlr_egl *egl);
/** /**
* Get DMA-BUF formats suitable for rendering usage. * Get DMA-BUF formats suitable for rendering usage.
*/ */

View file

@ -50,7 +50,7 @@ struct wlr_renderer_impl {
struct wl_resource *resource); struct wl_resource *resource);
void (*wl_drm_buffer_get_size)(struct wlr_renderer *renderer, void (*wl_drm_buffer_get_size)(struct wlr_renderer *renderer,
struct wl_resource *buffer, int *width, int *height); struct wl_resource *buffer, int *width, int *height);
const struct wlr_drm_format_set *(*get_dmabuf_formats)( const struct wlr_drm_format_set *(*get_dmabuf_texture_formats)(
struct wlr_renderer *renderer); struct wlr_renderer *renderer);
const struct wlr_drm_format_set *(*get_dmabuf_render_formats)( const struct wlr_drm_format_set *(*get_dmabuf_render_formats)(
struct wlr_renderer *renderer); struct wlr_renderer *renderer);

View file

@ -102,7 +102,7 @@ void wlr_renderer_wl_drm_buffer_get_size(struct wlr_renderer *renderer,
* Get the DMA-BUF formats supporting sampling usage. Buffers allocated with * Get the DMA-BUF formats supporting sampling usage. Buffers allocated with
* a format from this list may be imported via wlr_texture_from_dmabuf. * a format from this list may be imported via wlr_texture_from_dmabuf.
*/ */
const struct wlr_drm_format_set *wlr_renderer_get_dmabuf_formats( const struct wlr_drm_format_set *wlr_renderer_get_dmabuf_texture_formats(
struct wlr_renderer *renderer); struct wlr_renderer *renderer);
/** /**
* Reads out of pixels of the currently bound surface into data. `stride` is in * Reads out of pixels of the currently bound surface into data. `stride` is in

View file

@ -157,13 +157,15 @@ static void init_dmabuf_formats(struct wlr_egl *egl) {
} }
if (modifiers_len == 0) { if (modifiers_len == 0) {
wlr_drm_format_set_add(&egl->dmabuf_formats, fmt, DRM_FORMAT_MOD_INVALID); wlr_drm_format_set_add(&egl->dmabuf_texture_formats, fmt,
DRM_FORMAT_MOD_INVALID);
wlr_drm_format_set_add(&egl->dmabuf_render_formats, fmt, wlr_drm_format_set_add(&egl->dmabuf_render_formats, fmt,
DRM_FORMAT_MOD_INVALID); DRM_FORMAT_MOD_INVALID);
} }
for (int j = 0; j < modifiers_len; j++) { for (int j = 0; j < modifiers_len; j++) {
wlr_drm_format_set_add(&egl->dmabuf_formats, fmt, modifiers[j]); wlr_drm_format_set_add(&egl->dmabuf_texture_formats, fmt,
modifiers[j]);
if (!external_only[j]) { if (!external_only[j]) {
wlr_drm_format_set_add(&egl->dmabuf_render_formats, fmt, wlr_drm_format_set_add(&egl->dmabuf_render_formats, fmt,
modifiers[j]); modifiers[j]);
@ -398,13 +400,13 @@ void wlr_egl_finish(struct wlr_egl *egl) {
return; return;
} }
for (size_t i = 0; i < egl->dmabuf_formats.len; i++) { for (size_t i = 0; i < egl->dmabuf_texture_formats.len; i++) {
free(egl->external_only_dmabuf_formats[i]); free(egl->external_only_dmabuf_formats[i]);
} }
free(egl->external_only_dmabuf_formats); free(egl->external_only_dmabuf_formats);
wlr_drm_format_set_finish(&egl->dmabuf_render_formats); wlr_drm_format_set_finish(&egl->dmabuf_render_formats);
wlr_drm_format_set_finish(&egl->dmabuf_formats); wlr_drm_format_set_finish(&egl->dmabuf_texture_formats);
eglMakeCurrent(egl->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); eglMakeCurrent(egl->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
if (egl->wl_display) { if (egl->wl_display) {
@ -605,8 +607,8 @@ EGLImageKHR wlr_egl_create_image_from_wl_drm(struct wlr_egl *egl,
static bool dmabuf_format_is_external_only(struct wlr_egl *egl, static bool dmabuf_format_is_external_only(struct wlr_egl *egl,
uint32_t format, uint64_t modifier) { uint32_t format, uint64_t modifier) {
for (size_t i = 0; i < egl->dmabuf_formats.len; i++) { for (size_t i = 0; i < egl->dmabuf_texture_formats.len; i++) {
struct wlr_drm_format *fmt = egl->dmabuf_formats.formats[i]; struct wlr_drm_format *fmt = egl->dmabuf_texture_formats.formats[i];
if (fmt->format == format) { if (fmt->format == format) {
if (egl->external_only_dmabuf_formats[i] == NULL) { if (egl->external_only_dmabuf_formats[i] == NULL) {
break; break;
@ -812,8 +814,9 @@ static int get_egl_dmabuf_modifiers(struct wlr_egl *egl, int format,
return num; return num;
} }
const struct wlr_drm_format_set *wlr_egl_get_dmabuf_formats(struct wlr_egl *egl) { const struct wlr_drm_format_set *wlr_egl_get_dmabuf_texture_formats(
return &egl->dmabuf_formats; struct wlr_egl *egl) {
return &egl->dmabuf_texture_formats;
} }
const struct wlr_drm_format_set *wlr_egl_get_dmabuf_render_formats( const struct wlr_drm_format_set *wlr_egl_get_dmabuf_render_formats(

View file

@ -429,10 +429,10 @@ static void gles2_wl_drm_buffer_get_size(struct wlr_renderer *wlr_renderer,
buffer, EGL_HEIGHT, height); buffer, EGL_HEIGHT, height);
} }
static const struct wlr_drm_format_set *gles2_get_dmabuf_formats( static const struct wlr_drm_format_set *gles2_get_dmabuf_texture_formats(
struct wlr_renderer *wlr_renderer) { struct wlr_renderer *wlr_renderer) {
struct wlr_gles2_renderer *renderer = gles2_get_renderer(wlr_renderer); struct wlr_gles2_renderer *renderer = gles2_get_renderer(wlr_renderer);
return wlr_egl_get_dmabuf_formats(renderer->egl); return wlr_egl_get_dmabuf_texture_formats(renderer->egl);
} }
static const struct wlr_drm_format_set *gles2_get_dmabuf_render_formats( static const struct wlr_drm_format_set *gles2_get_dmabuf_render_formats(
@ -708,7 +708,7 @@ static const struct wlr_renderer_impl renderer_impl = {
.formats = gles2_renderer_formats, .formats = gles2_renderer_formats,
.resource_is_wl_drm_buffer = gles2_resource_is_wl_drm_buffer, .resource_is_wl_drm_buffer = gles2_resource_is_wl_drm_buffer,
.wl_drm_buffer_get_size = gles2_wl_drm_buffer_get_size, .wl_drm_buffer_get_size = gles2_wl_drm_buffer_get_size,
.get_dmabuf_formats = gles2_get_dmabuf_formats, .get_dmabuf_texture_formats = gles2_get_dmabuf_texture_formats,
.get_dmabuf_render_formats = gles2_get_dmabuf_render_formats, .get_dmabuf_render_formats = gles2_get_dmabuf_render_formats,
.preferred_read_format = gles2_preferred_read_format, .preferred_read_format = gles2_preferred_read_format,
.read_pixels = gles2_read_pixels, .read_pixels = gles2_read_pixels,

View file

@ -165,12 +165,12 @@ void wlr_renderer_wl_drm_buffer_get_size(struct wlr_renderer *r,
return r->impl->wl_drm_buffer_get_size(r, buffer, width, height); return r->impl->wl_drm_buffer_get_size(r, buffer, width, height);
} }
const struct wlr_drm_format_set *wlr_renderer_get_dmabuf_formats( const struct wlr_drm_format_set *wlr_renderer_get_dmabuf_texture_formats(
struct wlr_renderer *r) { struct wlr_renderer *r) {
if (!r->impl->get_dmabuf_formats) { if (!r->impl->get_dmabuf_texture_formats) {
return NULL; return NULL;
} }
return r->impl->get_dmabuf_formats(r); return r->impl->get_dmabuf_texture_formats(r);
} }
const struct wlr_drm_format_set *wlr_renderer_get_dmabuf_render_formats( const struct wlr_drm_format_set *wlr_renderer_get_dmabuf_render_formats(

View file

@ -389,7 +389,7 @@ static void linux_dmabuf_send_formats(struct wlr_linux_dmabuf_v1 *linux_dmabuf,
struct wl_resource *resource, uint32_t version) { struct wl_resource *resource, uint32_t version) {
uint64_t modifier_invalid = DRM_FORMAT_MOD_INVALID; uint64_t modifier_invalid = DRM_FORMAT_MOD_INVALID;
const struct wlr_drm_format_set *formats = const struct wlr_drm_format_set *formats =
wlr_renderer_get_dmabuf_formats(linux_dmabuf->renderer); wlr_renderer_get_dmabuf_texture_formats(linux_dmabuf->renderer);
if (formats == NULL) { if (formats == NULL) {
return; return;
} }