egl: inline simple DRI_IMAGE usage
Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30472>
This commit is contained in:
committed by
Marge Bot
parent
caa44dffbe
commit
89c6c150cc
@@ -2088,7 +2088,6 @@ dri2_create_image_khr_renderbuffer(_EGLDisplay *disp, _EGLContext *ctx,
|
||||
EGLClientBuffer buffer,
|
||||
const EGLint *attr_list)
|
||||
{
|
||||
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
|
||||
struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx);
|
||||
GLuint renderbuffer = (GLuint)(uintptr_t)buffer;
|
||||
__DRIimage *dri_image;
|
||||
@@ -2104,7 +2103,7 @@ dri2_create_image_khr_renderbuffer(_EGLDisplay *disp, _EGLContext *ctx,
|
||||
}
|
||||
|
||||
unsigned error = ~0;
|
||||
dri_image = dri2_dpy->image->createImageFromRenderbuffer(
|
||||
dri_image = dri_create_image_from_renderbuffer(
|
||||
dri2_ctx->dri_context, renderbuffer, NULL, &error);
|
||||
|
||||
assert(!!dri_image == (error == __DRI_IMAGE_ERROR_SUCCESS));
|
||||
@@ -2165,9 +2164,9 @@ dri2_create_image_wayland_wl_buffer(_EGLDisplay *disp, _EGLContext *ctx,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dri_image = dri2_dpy->image->fromPlanar(buffer->driver_buffer, plane, NULL);
|
||||
dri_image = dri2_from_planar(buffer->driver_buffer, plane, NULL);
|
||||
if (dri_image == NULL && plane == 0)
|
||||
dri_image = dri2_dpy->image->dupImage(buffer->driver_buffer, NULL);
|
||||
dri_image = dri2_dup_image(buffer->driver_buffer, NULL);
|
||||
if (dri_image == NULL) {
|
||||
_eglError(EGL_BAD_PARAMETER, "dri2_create_image_wayland_wl_buffer");
|
||||
return NULL;
|
||||
@@ -2219,7 +2218,6 @@ dri2_create_image_khr_texture(_EGLDisplay *disp, _EGLContext *ctx,
|
||||
EGLenum target, EGLClientBuffer buffer,
|
||||
const EGLint *attr_list)
|
||||
{
|
||||
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
|
||||
struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx);
|
||||
struct dri2_egl_image *dri2_img;
|
||||
GLuint texture = (GLuint)(uintptr_t)buffer;
|
||||
@@ -2281,7 +2279,7 @@ dri2_create_image_khr_texture(_EGLDisplay *disp, _EGLContext *ctx,
|
||||
|
||||
_eglInitImage(&dri2_img->base, disp);
|
||||
|
||||
dri2_img->dri_image = dri2_dpy->image->createImageFromTexture(
|
||||
dri2_img->dri_image = dri2_create_from_texture(
|
||||
dri2_ctx->dri_context, gl_target, texture, depth, attrs.GLTextureLevel,
|
||||
&error, NULL);
|
||||
dri2_create_image_khr_texture_error(error);
|
||||
@@ -2357,7 +2355,7 @@ dri2_create_image_mesa_drm_buffer(_EGLDisplay *disp, _EGLContext *ctx,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dri_image = dri2_dpy->image->createImageFromNames(
|
||||
dri_image = dri2_from_names(
|
||||
dri2_dpy->dri_screen_render_gpu, attrs.Width, attrs.Height, fourcc,
|
||||
(int *) &name, 1, (int *) &pitch, 0, NULL);
|
||||
|
||||
@@ -2604,7 +2602,7 @@ dri2_query_dma_buf_formats(_EGLDisplay *disp, EGLint max, EGLint *formats,
|
||||
dri2_dpy->image->queryDmaBufFormats == NULL)
|
||||
goto fail;
|
||||
|
||||
if (!dri2_dpy->image->queryDmaBufFormats(dri2_dpy->dri_screen_render_gpu,
|
||||
if (!dri_query_dma_buf_formats(dri2_dpy->dri_screen_render_gpu,
|
||||
max, formats, count))
|
||||
goto fail;
|
||||
|
||||
@@ -2654,7 +2652,7 @@ dri2_query_dma_buf_modifiers(_EGLDisplay *disp, EGLint format, EGLint max,
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
if (dri2_dpy->image->queryDmaBufModifiers(
|
||||
if (dri_query_dma_buf_modifiers(
|
||||
dri2_dpy->dri_screen_render_gpu, format, max, modifiers,
|
||||
(unsigned int *)external_only, count) == false)
|
||||
return dri2_egl_error_unlock(dri2_dpy, EGL_BAD_PARAMETER,
|
||||
@@ -2732,7 +2730,7 @@ dri2_create_image_dma_buf(_EGLDisplay *disp, _EGLContext *ctx,
|
||||
if (attrs.ProtectedContent)
|
||||
flags |= __DRI_IMAGE_PROTECTED_CONTENT_FLAG;
|
||||
|
||||
dri_image = dri2_dpy->image->createImageFromDmaBufs(
|
||||
dri_image = dri2_from_dma_bufs(
|
||||
dri2_dpy->dri_screen_render_gpu, attrs.Width, attrs.Height,
|
||||
attrs.DMABufFourCC.Value, modifier, fds, num_fds, pitches, offsets,
|
||||
attrs.DMABufYuvColorSpaceHint.Value, attrs.DMABufSampleRangeHint.Value,
|
||||
@@ -2807,7 +2805,7 @@ dri2_create_drm_image_mesa(_EGLDisplay *disp, const EGLint *attr_list)
|
||||
_eglInitImage(&dri2_img->base, disp);
|
||||
|
||||
dri2_img->dri_image =
|
||||
dri2_dpy->image->createImage(dri2_dpy->dri_screen_render_gpu, attrs.Width,
|
||||
dri_create_image(dri2_dpy->dri_screen_render_gpu, attrs.Width,
|
||||
attrs.Height, format, NULL, 0, dri_use, dri2_img);
|
||||
if (dri2_img->dri_image == NULL) {
|
||||
free(dri2_img);
|
||||
@@ -2831,17 +2829,17 @@ dri2_export_drm_image_mesa(_EGLDisplay *disp, _EGLImage *img, EGLint *name,
|
||||
struct dri2_egl_display *dri2_dpy = dri2_egl_display_lock(disp);
|
||||
struct dri2_egl_image *dri2_img = dri2_egl_image(img);
|
||||
|
||||
if (name && !dri2_dpy->image->queryImage(dri2_img->dri_image,
|
||||
if (name && !dri2_query_image(dri2_img->dri_image,
|
||||
__DRI_IMAGE_ATTRIB_NAME, name))
|
||||
return dri2_egl_error_unlock(dri2_dpy, EGL_BAD_ALLOC,
|
||||
"dri2_export_drm_image_mesa");
|
||||
|
||||
if (handle)
|
||||
dri2_dpy->image->queryImage(dri2_img->dri_image,
|
||||
dri2_query_image(dri2_img->dri_image,
|
||||
__DRI_IMAGE_ATTRIB_HANDLE, handle);
|
||||
|
||||
if (stride)
|
||||
dri2_dpy->image->queryImage(dri2_img->dri_image,
|
||||
dri2_query_image(dri2_img->dri_image,
|
||||
__DRI_IMAGE_ATTRIB_STRIDE, stride);
|
||||
|
||||
mtx_unlock(&dri2_dpy->lock);
|
||||
@@ -2859,11 +2857,10 @@ dri2_export_drm_image_mesa(_EGLDisplay *disp, _EGLImage *img, EGLint *name,
|
||||
static bool
|
||||
dri2_can_export_dma_buf_image(_EGLDisplay *disp, _EGLImage *img)
|
||||
{
|
||||
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
|
||||
struct dri2_egl_image *dri2_img = dri2_egl_image(img);
|
||||
EGLint fourcc;
|
||||
|
||||
if (!dri2_dpy->image->queryImage(dri2_img->dri_image,
|
||||
if (!dri2_query_image(dri2_img->dri_image,
|
||||
__DRI_IMAGE_ATTRIB_FOURCC, &fourcc)) {
|
||||
return false;
|
||||
}
|
||||
@@ -2885,13 +2882,13 @@ dri2_export_dma_buf_image_query_mesa(_EGLDisplay *disp, _EGLImage *img,
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
dri2_dpy->image->queryImage(dri2_img->dri_image,
|
||||
dri2_query_image(dri2_img->dri_image,
|
||||
__DRI_IMAGE_ATTRIB_NUM_PLANES, &num_planes);
|
||||
if (nplanes)
|
||||
*nplanes = num_planes;
|
||||
|
||||
if (fourcc)
|
||||
dri2_dpy->image->queryImage(dri2_img->dri_image,
|
||||
dri2_query_image(dri2_img->dri_image,
|
||||
__DRI_IMAGE_ATTRIB_FOURCC, fourcc);
|
||||
|
||||
if (modifiers) {
|
||||
@@ -2899,9 +2896,9 @@ dri2_export_dma_buf_image_query_mesa(_EGLDisplay *disp, _EGLImage *img,
|
||||
uint64_t modifier = DRM_FORMAT_MOD_INVALID;
|
||||
bool query;
|
||||
|
||||
query = dri2_dpy->image->queryImage(
|
||||
query = dri2_query_image(
|
||||
dri2_img->dri_image, __DRI_IMAGE_ATTRIB_MODIFIER_UPPER, &mod_hi);
|
||||
query &= dri2_dpy->image->queryImage(
|
||||
query &= dri2_query_image(
|
||||
dri2_img->dri_image, __DRI_IMAGE_ATTRIB_MODIFIER_LOWER, &mod_lo);
|
||||
if (query)
|
||||
modifier = combine_u32_into_u64(mod_hi, mod_lo);
|
||||
@@ -2934,23 +2931,23 @@ dri2_export_dma_buf_image_mesa(_EGLDisplay *disp, _EGLImage *img, int *fds,
|
||||
*/
|
||||
if (fds) {
|
||||
/* Query nplanes so that we know how big the given array is. */
|
||||
dri2_dpy->image->queryImage(dri2_img->dri_image,
|
||||
dri2_query_image(dri2_img->dri_image,
|
||||
__DRI_IMAGE_ATTRIB_NUM_PLANES, &nplanes);
|
||||
memset(fds, -1, nplanes * sizeof(int));
|
||||
}
|
||||
|
||||
/* rework later to provide multiple fds/strides/offsets */
|
||||
if (fds)
|
||||
dri2_dpy->image->queryImage(dri2_img->dri_image, __DRI_IMAGE_ATTRIB_FD,
|
||||
dri2_query_image(dri2_img->dri_image, __DRI_IMAGE_ATTRIB_FD,
|
||||
fds);
|
||||
|
||||
if (strides)
|
||||
dri2_dpy->image->queryImage(dri2_img->dri_image,
|
||||
dri2_query_image(dri2_img->dri_image,
|
||||
__DRI_IMAGE_ATTRIB_STRIDE, strides);
|
||||
|
||||
if (offsets) {
|
||||
int img_offset;
|
||||
bool ret = dri2_dpy->image->queryImage(
|
||||
bool ret = dri2_query_image(
|
||||
dri2_img->dri_image, __DRI_IMAGE_ATTRIB_OFFSET, &img_offset);
|
||||
if (ret)
|
||||
offsets[0] = img_offset;
|
||||
@@ -3004,7 +3001,7 @@ dri2_destroy_image_khr(_EGLDisplay *disp, _EGLImage *image)
|
||||
struct dri2_egl_display *dri2_dpy = dri2_egl_display_lock(disp);
|
||||
struct dri2_egl_image *dri2_img = dri2_egl_image(image);
|
||||
|
||||
dri2_dpy->image->destroyImage(dri2_img->dri_image);
|
||||
dri2_destroy_image(dri2_img->dri_image);
|
||||
free(dri2_img);
|
||||
|
||||
mtx_unlock(&dri2_dpy->lock);
|
||||
@@ -3024,11 +3021,11 @@ dri2_wl_reference_buffer(void *user_data, uint32_t name, int fd,
|
||||
int dri_components = 0;
|
||||
|
||||
if (fd == -1)
|
||||
img = dri2_dpy->image->createImageFromNames(
|
||||
img = dri2_from_names(
|
||||
dri2_dpy->dri_screen_render_gpu, buffer->width, buffer->height,
|
||||
buffer->format, (int *)&name, 1, buffer->stride, buffer->offset, NULL);
|
||||
else
|
||||
img = dri2_dpy->image->createImageFromDmaBufs(
|
||||
img = dri2_from_dma_bufs(
|
||||
dri2_dpy->dri_screen_render_gpu, buffer->width, buffer->height,
|
||||
buffer->format, DRM_FORMAT_MOD_INVALID, &fd, 1, buffer->stride,
|
||||
buffer->offset, 0, 0, 0, 0, 0, NULL, NULL);
|
||||
@@ -3036,7 +3033,7 @@ dri2_wl_reference_buffer(void *user_data, uint32_t name, int fd,
|
||||
if (img == NULL)
|
||||
return;
|
||||
|
||||
dri2_dpy->image->queryImage(img, __DRI_IMAGE_ATTRIB_COMPONENTS,
|
||||
dri2_query_image(img, __DRI_IMAGE_ATTRIB_COMPONENTS,
|
||||
&dri_components);
|
||||
|
||||
buffer->driver_format = NULL;
|
||||
@@ -3045,7 +3042,7 @@ dri2_wl_reference_buffer(void *user_data, uint32_t name, int fd,
|
||||
buffer->driver_format = &wl_drm_components[i];
|
||||
|
||||
if (buffer->driver_format == NULL)
|
||||
dri2_dpy->image->destroyImage(img);
|
||||
dri2_destroy_image(img);
|
||||
else
|
||||
buffer->driver_buffer = img;
|
||||
}
|
||||
@@ -3053,10 +3050,7 @@ dri2_wl_reference_buffer(void *user_data, uint32_t name, int fd,
|
||||
static void
|
||||
dri2_wl_release_buffer(void *user_data, struct wl_drm_buffer *buffer)
|
||||
{
|
||||
_EGLDisplay *disp = user_data;
|
||||
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
|
||||
|
||||
dri2_dpy->image->destroyImage(buffer->driver_buffer);
|
||||
dri2_destroy_image(buffer->driver_buffer);
|
||||
}
|
||||
|
||||
static EGLBoolean
|
||||
@@ -3541,7 +3535,7 @@ dri2_query_supported_compression_rates(_EGLDisplay *disp, _EGLConfig *config,
|
||||
dri2_dpy->image->queryCompressionRates) {
|
||||
const __DRIconfig *dri_conf =
|
||||
dri2_get_dri_config(conf, EGL_WINDOW_BIT, EGL_GL_COLORSPACE_LINEAR);
|
||||
if (!dri2_dpy->image->queryCompressionRates(
|
||||
if (!dri2_query_compression_rates(
|
||||
dri2_dpy->dri_screen_render_gpu, dri_conf, rate_size, dri_rates,
|
||||
num_rate))
|
||||
return EGL_FALSE;
|
||||
|
||||
@@ -619,7 +619,7 @@ dri2_flush_drawable_for_swapbuffers(_EGLDisplay *disp, _EGLSurface *draw);
|
||||
const __DRIconfig *
|
||||
dri2_get_dri_config(struct dri2_egl_config *conf, EGLint surface_type,
|
||||
EGLenum colorspace);
|
||||
|
||||
#include "dri_util.h"
|
||||
static inline void
|
||||
dri2_set_WL_bind_wayland_display(_EGLDisplay *disp)
|
||||
{
|
||||
@@ -632,7 +632,7 @@ dri2_set_WL_bind_wayland_display(_EGLDisplay *disp)
|
||||
int capabilities;
|
||||
|
||||
capabilities =
|
||||
dri2_dpy->image->getCapabilities(dri2_dpy->dri_screen_render_gpu);
|
||||
dri2_get_capabilities(dri2_dpy->dri_screen_render_gpu);
|
||||
disp->Extensions.WL_bind_wayland_display =
|
||||
(capabilities & __DRI_IMAGE_CAP_GLOBAL_NAMES) != 0;
|
||||
} else {
|
||||
|
||||
@@ -59,7 +59,7 @@ droid_create_image_from_buffer_info(
|
||||
{
|
||||
unsigned error;
|
||||
|
||||
return dri2_dpy->image->createImageFromDmaBufs(
|
||||
return dri2_from_dma_bufs(
|
||||
dri2_dpy->dri_screen_render_gpu, width, height, buf_info->drm_fourcc,
|
||||
buf_info->modifier, buf_info->fds, buf_info->num_planes,
|
||||
buf_info->strides, buf_info->offsets, color_info->yuv_color_space,
|
||||
@@ -125,7 +125,7 @@ handle_in_fence_fd(struct dri2_egl_surface *dri2_surf, __DRIimage *img)
|
||||
|
||||
if (dri2_dpy->image->base.version >= 21 &&
|
||||
dri2_dpy->image->setInFenceFd != NULL) {
|
||||
dri2_dpy->image->setInFenceFd(img, dri2_surf->in_fence_fd);
|
||||
dri2_set_in_fence_fd(img, dri2_surf->in_fence_fd);
|
||||
} else {
|
||||
sync_wait(dri2_surf->in_fence_fd, -1);
|
||||
}
|
||||
@@ -189,8 +189,6 @@ static EGLBoolean
|
||||
droid_window_enqueue_buffer(_EGLDisplay *disp,
|
||||
struct dri2_egl_surface *dri2_surf)
|
||||
{
|
||||
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
|
||||
|
||||
/* Queue the buffer with stored out fence fd. The ANativeWindow or buffer
|
||||
* consumer may choose to wait for the fence to signal before accessing
|
||||
* it. If fence fd value is -1, buffer can be accessed by consumer
|
||||
@@ -209,7 +207,7 @@ droid_window_enqueue_buffer(_EGLDisplay *disp,
|
||||
dri2_surf->back = NULL;
|
||||
|
||||
if (dri2_surf->dri_image_back) {
|
||||
dri2_dpy->image->destroyImage(dri2_surf->dri_image_back);
|
||||
dri2_destroy_image(dri2_surf->dri_image_back);
|
||||
dri2_surf->dri_image_back = NULL;
|
||||
}
|
||||
|
||||
@@ -396,7 +394,6 @@ droid_create_pbuffer_surface(_EGLDisplay *disp, _EGLConfig *conf,
|
||||
static EGLBoolean
|
||||
droid_destroy_surface(_EGLDisplay *disp, _EGLSurface *surf)
|
||||
{
|
||||
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
|
||||
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf);
|
||||
|
||||
dri2_egl_surface_free_local_buffers(dri2_surf);
|
||||
@@ -411,14 +408,14 @@ droid_destroy_surface(_EGLDisplay *disp, _EGLSurface *surf)
|
||||
if (dri2_surf->dri_image_back) {
|
||||
_eglLog(_EGL_DEBUG, "%s : %d : destroy dri_image_back", __func__,
|
||||
__LINE__);
|
||||
dri2_dpy->image->destroyImage(dri2_surf->dri_image_back);
|
||||
dri2_destroy_image(dri2_surf->dri_image_back);
|
||||
dri2_surf->dri_image_back = NULL;
|
||||
}
|
||||
|
||||
if (dri2_surf->dri_image_front) {
|
||||
_eglLog(_EGL_DEBUG, "%s : %d : destroy dri_image_front", __func__,
|
||||
__LINE__);
|
||||
dri2_dpy->image->destroyImage(dri2_surf->dri_image_front);
|
||||
dri2_destroy_image(dri2_surf->dri_image_front);
|
||||
dri2_surf->dri_image_front = NULL;
|
||||
}
|
||||
|
||||
@@ -491,7 +488,7 @@ get_front_bo(struct dri2_egl_surface *dri2_surf, unsigned int format)
|
||||
_EGL_DEBUG,
|
||||
"DRI driver requested unsupported front buffer for window surface");
|
||||
} else if (dri2_surf->base.Type == EGL_PBUFFER_BIT) {
|
||||
dri2_surf->dri_image_front = dri2_dpy->image->createImage(
|
||||
dri2_surf->dri_image_front = dri_create_image(
|
||||
dri2_dpy->dri_screen_render_gpu, dri2_surf->base.Width,
|
||||
dri2_surf->base.Height, format, NULL, 0, 0, NULL);
|
||||
if (!dri2_surf->dri_image_front) {
|
||||
@@ -941,7 +938,7 @@ droid_display_shared_buffer(__DRIdrawable *driDrawable, int fence_fd,
|
||||
dri2_surf->back = NULL;
|
||||
|
||||
if (dri2_surf->dri_image_back) {
|
||||
dri2_dpy->image->destroyImage(dri2_surf->dri_image_back);
|
||||
dri2_destroy_image(dri2_surf->dri_image_back);
|
||||
dri2_surf->dri_image_back = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ static __DRIimage *
|
||||
device_alloc_image(struct dri2_egl_display *dri2_dpy,
|
||||
struct dri2_egl_surface *dri2_surf)
|
||||
{
|
||||
return dri2_dpy->image->createImage(
|
||||
return dri_create_image(
|
||||
dri2_dpy->dri_screen_render_gpu, dri2_surf->base.Width,
|
||||
dri2_surf->base.Height, dri2_surf->visual, NULL, 0, 0, NULL);
|
||||
}
|
||||
@@ -57,11 +57,8 @@ device_alloc_image(struct dri2_egl_display *dri2_dpy,
|
||||
static void
|
||||
device_free_images(struct dri2_egl_surface *dri2_surf)
|
||||
{
|
||||
struct dri2_egl_display *dri2_dpy =
|
||||
dri2_egl_display(dri2_surf->base.Resource.Display);
|
||||
|
||||
if (dri2_surf->front) {
|
||||
dri2_dpy->image->destroyImage(dri2_surf->front);
|
||||
dri2_destroy_image(dri2_surf->front);
|
||||
dri2_surf->front = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -364,7 +364,6 @@ dri2_drm_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx,
|
||||
EGLClientBuffer buffer,
|
||||
const EGLint *attr_list)
|
||||
{
|
||||
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
|
||||
struct gbm_dri_bo *dri_bo = gbm_dri_bo((struct gbm_bo *)buffer);
|
||||
struct dri2_egl_image *dri2_img;
|
||||
|
||||
@@ -376,7 +375,7 @@ dri2_drm_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx,
|
||||
|
||||
_eglInitImage(&dri2_img->base, disp);
|
||||
|
||||
dri2_img->dri_image = dri2_dpy->image->dupImage(dri_bo->image, dri2_img);
|
||||
dri2_img->dri_image = dri2_dup_image(dri_bo->image, dri2_img);
|
||||
if (dri2_img->dri_image == NULL) {
|
||||
free(dri2_img);
|
||||
_eglError(EGL_BAD_ALLOC, "dri2_create_image_khr_pixmap");
|
||||
|
||||
@@ -44,7 +44,7 @@ static __DRIimage *
|
||||
surfaceless_alloc_image(struct dri2_egl_display *dri2_dpy,
|
||||
struct dri2_egl_surface *dri2_surf)
|
||||
{
|
||||
return dri2_dpy->image->createImage(
|
||||
return dri_create_image(
|
||||
dri2_dpy->dri_screen_render_gpu, dri2_surf->base.Width,
|
||||
dri2_surf->base.Height, dri2_surf->visual, NULL, 0, 0, NULL);
|
||||
}
|
||||
@@ -52,11 +52,8 @@ surfaceless_alloc_image(struct dri2_egl_display *dri2_dpy,
|
||||
static void
|
||||
surfaceless_free_images(struct dri2_egl_surface *dri2_surf)
|
||||
{
|
||||
struct dri2_egl_display *dri2_dpy =
|
||||
dri2_egl_display(dri2_surf->base.Resource.Display);
|
||||
|
||||
if (dri2_surf->front) {
|
||||
dri2_dpy->image->destroyImage(dri2_surf->front);
|
||||
dri2_destroy_image(dri2_surf->front);
|
||||
dri2_surf->front = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -854,9 +854,9 @@ dri2_wl_destroy_surface(_EGLDisplay *disp, _EGLSurface *surf)
|
||||
if (dri2_surf->color_buffers[i].wl_buffer)
|
||||
wl_buffer_destroy(dri2_surf->color_buffers[i].wl_buffer);
|
||||
if (dri2_surf->color_buffers[i].dri_image)
|
||||
dri2_dpy->image->destroyImage(dri2_surf->color_buffers[i].dri_image);
|
||||
dri2_destroy_image(dri2_surf->color_buffers[i].dri_image);
|
||||
if (dri2_surf->color_buffers[i].linear_copy)
|
||||
dri2_dpy->image->destroyImage(dri2_surf->color_buffers[i].linear_copy);
|
||||
dri2_destroy_image(dri2_surf->color_buffers[i].linear_copy);
|
||||
if (dri2_surf->color_buffers[i].data)
|
||||
munmap(dri2_surf->color_buffers[i].data,
|
||||
dri2_surf->color_buffers[i].data_size);
|
||||
@@ -919,9 +919,9 @@ dri2_wl_release_buffers(struct dri2_egl_surface *dri2_surf)
|
||||
}
|
||||
}
|
||||
if (dri2_surf->color_buffers[i].dri_image)
|
||||
dri2_dpy->image->destroyImage(dri2_surf->color_buffers[i].dri_image);
|
||||
dri2_destroy_image(dri2_surf->color_buffers[i].dri_image);
|
||||
if (dri2_surf->color_buffers[i].linear_copy)
|
||||
dri2_dpy->image->destroyImage(dri2_surf->color_buffers[i].linear_copy);
|
||||
dri2_destroy_image(dri2_surf->color_buffers[i].linear_copy);
|
||||
if (dri2_surf->color_buffers[i].data)
|
||||
munmap(dri2_surf->color_buffers[i].data,
|
||||
dri2_surf->color_buffers[i].data_size);
|
||||
@@ -974,15 +974,13 @@ get_surface_specific_modifiers(struct dri2_egl_surface *dri2_surf,
|
||||
static void
|
||||
update_surface(struct dri2_egl_surface *dri2_surf, __DRIimage *dri_img)
|
||||
{
|
||||
struct dri2_egl_display *dri2_dpy =
|
||||
dri2_egl_display(dri2_surf->base.Resource.Display);
|
||||
int compression_rate;
|
||||
|
||||
if (!dri_img)
|
||||
return;
|
||||
|
||||
/* Update the surface with the actual compression rate */
|
||||
dri2_dpy->image->queryImage(dri_img, __DRI_IMAGE_ATTRIB_COMPRESSION_RATE,
|
||||
dri2_query_image(dri_img, __DRI_IMAGE_ATTRIB_COMPRESSION_RATE,
|
||||
&compression_rate);
|
||||
dri2_surf->base.CompressionRate = compression_rate;
|
||||
}
|
||||
@@ -1225,13 +1223,13 @@ get_back_bo(struct dri2_egl_surface *dri2_surf)
|
||||
int offsets[4];
|
||||
unsigned error;
|
||||
|
||||
if (!dri2_dpy->image->queryImage(linear_copy_display_gpu_image,
|
||||
if (!dri2_query_image(linear_copy_display_gpu_image,
|
||||
__DRI_IMAGE_ATTRIB_NUM_PLANES,
|
||||
&num_planes))
|
||||
num_planes = 1;
|
||||
|
||||
for (i = 0; i < num_planes; i++) {
|
||||
__DRIimage *image = dri2_dpy->image->fromPlanar(
|
||||
__DRIimage *image = dri2_from_planar(
|
||||
linear_copy_display_gpu_image, i, NULL);
|
||||
|
||||
if (!image) {
|
||||
@@ -1240,27 +1238,27 @@ get_back_bo(struct dri2_egl_surface *dri2_surf)
|
||||
}
|
||||
|
||||
buffer_fds[i] = -1;
|
||||
ret &= dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_FD,
|
||||
ret &= dri2_query_image(image, __DRI_IMAGE_ATTRIB_FD,
|
||||
&buffer_fds[i]);
|
||||
ret &= dri2_dpy->image->queryImage(
|
||||
ret &= dri2_query_image(
|
||||
image, __DRI_IMAGE_ATTRIB_STRIDE, &strides[i]);
|
||||
ret &= dri2_dpy->image->queryImage(
|
||||
ret &= dri2_query_image(
|
||||
image, __DRI_IMAGE_ATTRIB_OFFSET, &offsets[i]);
|
||||
|
||||
if (image != linear_copy_display_gpu_image)
|
||||
dri2_dpy->image->destroyImage(image);
|
||||
dri2_destroy_image(image);
|
||||
|
||||
if (!ret) {
|
||||
do {
|
||||
if (buffer_fds[i] != -1)
|
||||
close(buffer_fds[i]);
|
||||
} while (--i >= 0);
|
||||
dri2_dpy->image->destroyImage(linear_copy_display_gpu_image);
|
||||
dri2_destroy_image(linear_copy_display_gpu_image);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
ret &= dri2_dpy->image->queryImage(linear_copy_display_gpu_image,
|
||||
ret &= dri2_query_image(linear_copy_display_gpu_image,
|
||||
__DRI_IMAGE_ATTRIB_FOURCC,
|
||||
&fourcc);
|
||||
if (!ret) {
|
||||
@@ -1268,7 +1266,7 @@ get_back_bo(struct dri2_egl_surface *dri2_surf)
|
||||
if (buffer_fds[i] != -1)
|
||||
close(buffer_fds[i]);
|
||||
} while (--i >= 0);
|
||||
dri2_dpy->image->destroyImage(linear_copy_display_gpu_image);
|
||||
dri2_destroy_image(linear_copy_display_gpu_image);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1276,7 +1274,7 @@ get_back_bo(struct dri2_egl_surface *dri2_surf)
|
||||
* need to make it visible to render GPU
|
||||
*/
|
||||
dri2_surf->back->linear_copy =
|
||||
dri2_dpy->image->createImageFromDmaBufs(
|
||||
dri2_from_dma_bufs(
|
||||
dri2_dpy->dri_screen_render_gpu,
|
||||
dri2_surf->base.Width, dri2_surf->base.Height,
|
||||
fourcc, linear_mod,
|
||||
@@ -1290,7 +1288,7 @@ get_back_bo(struct dri2_egl_surface *dri2_surf)
|
||||
if (buffer_fds[i] != -1)
|
||||
close(buffer_fds[i]);
|
||||
}
|
||||
dri2_dpy->image->destroyImage(linear_copy_display_gpu_image);
|
||||
dri2_destroy_image(linear_copy_display_gpu_image);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1333,15 +1331,13 @@ get_back_bo(struct dri2_egl_surface *dri2_surf)
|
||||
static void
|
||||
back_bo_to_dri_buffer(struct dri2_egl_surface *dri2_surf, __DRIbuffer *buffer)
|
||||
{
|
||||
struct dri2_egl_display *dri2_dpy =
|
||||
dri2_egl_display(dri2_surf->base.Resource.Display);
|
||||
__DRIimage *image;
|
||||
int name, pitch;
|
||||
|
||||
image = dri2_surf->back->dri_image;
|
||||
|
||||
dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_NAME, &name);
|
||||
dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_STRIDE, &pitch);
|
||||
dri2_query_image(image, __DRI_IMAGE_ATTRIB_NAME, &name);
|
||||
dri2_query_image(image, __DRI_IMAGE_ATTRIB_STRIDE, &pitch);
|
||||
|
||||
buffer->attachment = __DRI_BUFFER_BACK_LEFT;
|
||||
buffer->name = name;
|
||||
@@ -1393,9 +1389,9 @@ update_buffers(struct dri2_egl_surface *dri2_surf)
|
||||
dri2_surf->color_buffers[i].wl_buffer &&
|
||||
dri2_surf->color_buffers[i].age > BUFFER_TRIM_AGE_HYSTERESIS) {
|
||||
wl_buffer_destroy(dri2_surf->color_buffers[i].wl_buffer);
|
||||
dri2_dpy->image->destroyImage(dri2_surf->color_buffers[i].dri_image);
|
||||
dri2_destroy_image(dri2_surf->color_buffers[i].dri_image);
|
||||
if (dri2_dpy->fd_render_gpu != dri2_dpy->fd_display_gpu)
|
||||
dri2_dpy->image->destroyImage(
|
||||
dri2_destroy_image(
|
||||
dri2_surf->color_buffers[i].linear_copy);
|
||||
dri2_surf->color_buffers[i].wl_buffer = NULL;
|
||||
dri2_surf->color_buffers[i].dri_image = NULL;
|
||||
@@ -1484,22 +1480,22 @@ create_wl_buffer(struct dri2_egl_display *dri2_dpy,
|
||||
uint64_t modifier = DRM_FORMAT_MOD_INVALID;
|
||||
int mod_hi, mod_lo;
|
||||
|
||||
query = dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_WIDTH, &width);
|
||||
query = dri2_query_image(image, __DRI_IMAGE_ATTRIB_WIDTH, &width);
|
||||
query &=
|
||||
dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_HEIGHT, &height);
|
||||
dri2_query_image(image, __DRI_IMAGE_ATTRIB_HEIGHT, &height);
|
||||
query &=
|
||||
dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_FOURCC, &fourcc);
|
||||
dri2_query_image(image, __DRI_IMAGE_ATTRIB_FOURCC, &fourcc);
|
||||
if (!query)
|
||||
return NULL;
|
||||
|
||||
query = dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_NUM_PLANES,
|
||||
query = dri2_query_image(image, __DRI_IMAGE_ATTRIB_NUM_PLANES,
|
||||
&num_planes);
|
||||
if (!query)
|
||||
num_planes = 1;
|
||||
|
||||
query = dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_MODIFIER_UPPER,
|
||||
query = dri2_query_image(image, __DRI_IMAGE_ATTRIB_MODIFIER_UPPER,
|
||||
&mod_hi);
|
||||
query &= dri2_dpy->image->queryImage(
|
||||
query &= dri2_query_image(
|
||||
image, __DRI_IMAGE_ATTRIB_MODIFIER_LOWER, &mod_lo);
|
||||
if (query) {
|
||||
modifier = combine_u32_into_u64(mod_hi, mod_lo);
|
||||
@@ -1546,20 +1542,20 @@ create_wl_buffer(struct dri2_egl_display *dri2_dpy,
|
||||
int stride, offset;
|
||||
int fd = -1;
|
||||
|
||||
p_image = dri2_dpy->image->fromPlanar(image, i, NULL);
|
||||
p_image = dri2_from_planar(image, i, NULL);
|
||||
if (!p_image) {
|
||||
assert(i == 0);
|
||||
p_image = image;
|
||||
}
|
||||
|
||||
query =
|
||||
dri2_dpy->image->queryImage(p_image, __DRI_IMAGE_ATTRIB_FD, &fd);
|
||||
query &= dri2_dpy->image->queryImage(
|
||||
dri2_query_image(p_image, __DRI_IMAGE_ATTRIB_FD, &fd);
|
||||
query &= dri2_query_image(
|
||||
p_image, __DRI_IMAGE_ATTRIB_STRIDE, &stride);
|
||||
query &= dri2_dpy->image->queryImage(
|
||||
query &= dri2_query_image(
|
||||
p_image, __DRI_IMAGE_ATTRIB_OFFSET, &offset);
|
||||
if (image != p_image)
|
||||
dri2_dpy->image->destroyImage(p_image);
|
||||
dri2_destroy_image(p_image);
|
||||
|
||||
if (!query) {
|
||||
if (fd >= 0)
|
||||
@@ -1593,9 +1589,9 @@ create_wl_buffer(struct dri2_egl_display *dri2_dpy,
|
||||
if (num_planes > 1)
|
||||
return NULL;
|
||||
|
||||
query = dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_FD, &fd);
|
||||
query = dri2_query_image(image, __DRI_IMAGE_ATTRIB_FD, &fd);
|
||||
query &=
|
||||
dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_STRIDE, &stride);
|
||||
dri2_query_image(image, __DRI_IMAGE_ATTRIB_STRIDE, &stride);
|
||||
if (!query) {
|
||||
if (fd >= 0)
|
||||
close(fd);
|
||||
@@ -1719,7 +1715,7 @@ dri2_wl_swap_buffers_with_damage(_EGLDisplay *disp, _EGLSurface *draw,
|
||||
if (dri2_dpy->fd_render_gpu != dri2_dpy->fd_display_gpu) {
|
||||
_EGLContext *ctx = _eglGetCurrentContext();
|
||||
struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx);
|
||||
dri2_dpy->image->blitImage(
|
||||
dri2_blit_image(
|
||||
dri2_ctx->dri_context, dri2_surf->current->linear_copy,
|
||||
dri2_surf->current->dri_image, 0, 0, dri2_surf->base.Width,
|
||||
dri2_surf->base.Height, 0, 0, dri2_surf->base.Width,
|
||||
@@ -1778,7 +1774,7 @@ dri2_wl_create_wayland_buffer_from_image(_EGLDisplay *disp, _EGLImage *img)
|
||||
int fourcc;
|
||||
|
||||
/* Check the upstream display supports this buffer's format. */
|
||||
dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_FOURCC, &fourcc);
|
||||
dri2_query_image(image, __DRI_IMAGE_ATTRIB_FOURCC, &fourcc);
|
||||
if (!server_supports_fourcc(&dri2_dpy->formats, fourcc))
|
||||
goto bad_format;
|
||||
|
||||
|
||||
@@ -1348,7 +1348,7 @@ dri2_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx,
|
||||
|
||||
_eglInitImage(&dri2_img->base, disp);
|
||||
|
||||
dri2_img->dri_image = dri2_dpy->image->createImageFromNames(
|
||||
dri2_img->dri_image = dri2_from_names(
|
||||
dri2_dpy->dri_screen_render_gpu, buffers_reply->width,
|
||||
buffers_reply->height, fourcc, (int *) &buffers[0].name, 1,
|
||||
(int *) &buffers[0].pitch, 0, dri2_img);
|
||||
|
||||
Reference in New Issue
Block a user