From 4aaf431a115940e996c117b1d1946a83e2a207fe Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Tue, 1 Jul 2025 14:30:44 +0100 Subject: [PATCH] dri: Garbage-collect old DRI interfaces We don't use these in the tree, so declaring them only adds to misdirection and annoyance. Signed-off-by: Daniel Stone Part-of: --- src/gallium/frontends/dri/dri_helpers.c | 13 - src/gallium/frontends/dri/dri_helpers.h | 2 - src/gallium/frontends/dri/dri_screen.h | 4 - src/gallium/frontends/dri/dri_util.h | 1 - src/gallium/include/mesa_interface.h | 427 ------------------------ 5 files changed, 447 deletions(-) diff --git a/src/gallium/frontends/dri/dri_helpers.c b/src/gallium/frontends/dri/dri_helpers.c index 52698621a62..2496608cfc1 100644 --- a/src/gallium/frontends/dri/dri_helpers.c +++ b/src/gallium/frontends/dri/dri_helpers.c @@ -239,19 +239,6 @@ dri_server_wait_sync(struct dri_context *_ctx, void *_fence, unsigned flags) ctx->fence_server_sync(ctx, fence->pipe_fence); } -const __DRI2fenceExtension dri2FenceExtension = { - .base = { __DRI2_FENCE, 2 }, - - .create_fence = dri_create_fence, - .get_fence_from_cl_event = dri_get_fence_from_cl_event, - .destroy_fence = dri_destroy_fence, - .client_wait_sync = dri_client_wait_sync, - .server_wait_sync = dri_server_wait_sync, - .get_capabilities = dri_fence_get_caps, - .create_fence_fd = dri_create_fence_fd, - .get_fence_fd = dri_get_fence_fd, -}; - struct dri_image * dri_create_image_from_renderbuffer(struct dri_context *dri_ctx, int renderbuffer, void *loaderPrivate, diff --git a/src/gallium/frontends/dri/dri_helpers.h b/src/gallium/frontends/dri/dri_helpers.h index 6f4dfb21a51..7258dc36e93 100644 --- a/src/gallium/frontends/dri/dri_helpers.h +++ b/src/gallium/frontends/dri/dri_helpers.h @@ -40,8 +40,6 @@ struct dri2_format_mapping { } planes[3]; }; -extern const __DRI2fenceExtension dri2FenceExtension; - const struct dri2_format_mapping * dri2_get_mapping_by_fourcc(int fourcc); diff --git a/src/gallium/frontends/dri/dri_screen.h b/src/gallium/frontends/dri/dri_screen.h index d813ca7778b..70266bc9a90 100644 --- a/src/gallium/frontends/dri/dri_screen.h +++ b/src/gallium/frontends/dri/dri_screen.h @@ -112,10 +112,6 @@ struct dri_screen bool swrast_no_present; - /* DRI exts that vary based on gallium pipe_screen caps. */ - __DRIimageExtension image_extension; - __DRI2bufferDamageExtension buffer_damage_extension; - /* DRI exts on this screen. Populated at init time based on device caps. */ const __DRIextension *screen_extensions[14]; diff --git a/src/gallium/frontends/dri/dri_util.h b/src/gallium/frontends/dri/dri_util.h index 78eed29a035..86886d76d7b 100644 --- a/src/gallium/frontends/dri/dri_util.h +++ b/src/gallium/frontends/dri/dri_util.h @@ -128,7 +128,6 @@ driGetAPIMask(struct dri_screen *screen); PUBLIC struct dri_drawable * dri_create_drawable(struct dri_screen *psp, const struct dri_config *config, bool isPixmap, void *loaderPrivate); -extern const __DRIimageDriverExtension driImageDriverExtension; PUBLIC void driDestroyScreen(struct dri_screen *psp); PUBLIC int driGetConfigAttrib(const struct dri_config *config, unsigned int attrib, unsigned int *value); diff --git a/src/gallium/include/mesa_interface.h b/src/gallium/include/mesa_interface.h index a9f8aaeaa0b..7c212b701e0 100644 --- a/src/gallium/include/mesa_interface.h +++ b/src/gallium/include/mesa_interface.h @@ -121,14 +121,6 @@ typedef signed long (*__DRIblobCacheGet) (const void *key, signed long keySize, void *value, signed long valueSize); -/** - * Extension for fences / synchronization objects. - * * - * Not used by the X server. - */ - -#define __DRI2_FENCE "DRI2_Fence" - #define __DRI2_FENCE_FLAG_FLUSH_COMMANDS (1 << 0) /** @@ -138,126 +130,6 @@ typedef signed long #define __DRI_FENCE_CAP_NATIVE_FD 1 /*@}*/ -typedef struct { - __DRIextension base; - - /** - * Create and insert a fence into the command stream of the context. - */ - void *(*create_fence)(struct dri_context *ctx); - - /** - * Get a fence associated with the OpenCL event object. - * This can be NULL, meaning that OpenCL interoperability is not supported. - */ - void *(*get_fence_from_cl_event)(struct dri_screen *screen, intptr_t cl_event); - - /** - * Destroy a fence. - */ - void (*destroy_fence)(struct dri_screen *screen, void *fence); - - /** - * This function waits and doesn't return until the fence is signalled - * or the timeout expires. It returns true if the fence has been signaled. - * - * \param ctx the context where commands are flushed - * \param fence the fence - * \param flags a combination of __DRI2_FENCE_FLAG_xxx flags - * \param timeout the timeout in ns or __DRI2_FENCE_TIMEOUT_INFINITE - */ - unsigned char (*client_wait_sync)(struct dri_context *ctx, void *fence, - unsigned flags, uint64_t timeout); - - /** - * This function enqueues a wait command into the command stream of - * the context and then returns. When the execution reaches the wait - * command, no further execution will be done in the context until - * the fence is signaled. This is a no-op if the device doesn't support - * parallel execution of contexts. - * - * \param ctx the context where the waiting is done - * \param fence the fence - * \param flags a combination of __DRI2_FENCE_FLAG_xxx flags that make - * sense with this function (right now there are none) - */ - void (*server_wait_sync)(struct dri_context *ctx, void *fence, unsigned flags); - - /** - * Query for general capabilities of the driver that concern fences. - * Returns a bitmask of __DRI_FENCE_CAP_x - * - * \since 2 - */ - unsigned (*get_capabilities)(struct dri_screen *screen); - - /** - * Create an fd (file descriptor) associated fence. If the fence fd - * is -1, this behaves similarly to create_fence() except that when - * rendering is flushed the driver creates a fence fd. Otherwise, - * the driver wraps an existing fence fd. - * - * This is used to implement the EGL_ANDROID_native_fence_sync extension. - * - * \since 2 - * - * \param ctx the context associated with the fence - * \param fd the fence fd or -1 - */ - void *(*create_fence_fd)(struct dri_context *ctx, int fd); - - /** - * For fences created with create_fence_fd(), after rendering is flushed, - * this retrieves the native fence fd. Caller takes ownership of the - * fd and will close() it when it is no longer needed. - * - * \since 2 - * - * \param screen the screen associated with the fence - * \param fence the fence - */ - int (*get_fence_fd)(struct dri_screen *screen, void *fence); -} __DRI2fenceExtension; - -/** - * Extension for limiting window system back buffer rendering to user-defined - * scissor region. - * - * Not used by the X server. - */ -typedef struct { - __DRIextension base; - - /** - * Provides an array of rectangles representing an overriding scissor region - * for rendering operations performed to the specified drawable. These - * rectangles do not replace client API scissor regions or draw - * co-ordinates, but instead inform the driver of the overall bounds of all - * operations which will be issued before the next flush. - * - * Any rendering operations writing pixels outside this region to the - * drawable will have an undefined effect on the entire drawable. - * - * This entrypoint may only be called after the drawable has either been - * newly created or flushed, and before any rendering operations which write - * pixels to the drawable. Calling this entrypoint at any other time will - * have an undefined effect on the entire drawable. - * - * Calling this entrypoint with @nrects 0 and @rects NULL will reset the - * region to the buffer's full size. This entrypoint may be called once to - * reset the region, followed by a second call with a populated region, - * before a rendering call is made. - * - * Used to implement EGL_KHR_partial_update. - * - * \param drawable affected drawable - * \param nrects number of rectangles provided - * \param rects the array of rectangles, lower-left origin - */ - void (*set_damage_region)(struct dri_drawable *drawable, unsigned int nrects, - int *rects); -} __DRI2bufferDamageExtension; - /*@}*/ /** @@ -894,288 +766,6 @@ enum __DRIFixedRateCompression { /* Available in version 16 */ #define __DRI_IMAGE_FORMAT_MODIFIER_ATTRIB_PLANE_COUNT 0x0001 -typedef struct { - __DRIextension base; - - void (*destroyImage)(struct dri_image *image); - - unsigned char (*queryImage)(struct dri_image *image, int attrib, int *value); - - /** - * The new struct dri_image will share the content with the old one, see dup(2). - */ - struct dri_image *(*dupImage)(struct dri_image *image, void *loaderPrivate); - - /** - * Validate that a struct dri_image can be used a certain way. - * - * \since 2 - */ - unsigned char (*validateUsage)(struct dri_image *image, unsigned int use); - - /** - * Create an image from a series of GEM names; uses FourCC for format - * and byte stride. - * - * \since 5 - */ - struct dri_image *(*createImageFromNames)(struct dri_screen *screen, - int width, int height, int fourcc, - int *names, int num_names, - int *strides, int *offsets, - void *loaderPrivate); - - /** - * Create an image out of a sub-region of a parent image. This - * entry point lets us create individual dri_image structures for different - * planes in a planar buffer (typically yuv), for example. While a - * sub-image shares the underlying buffer object with the parent - * image and other sibling sub-images, the life times of parent and - * sub-images are not dependent. Destroying the parent or a - * sub-image doesn't affect other images. The underlying buffer - * object is free when no struct dri_image remains that references it. - * - * Sub-images may overlap, but rendering to overlapping sub-images - * is undefined. - * - * \since 5 - */ - struct dri_image *(*fromPlanar)(struct dri_image *image, int plane, - void *loaderPrivate); - - /** - * Create image from texture. - * - * \since 6 - */ - struct dri_image *(*createImageFromTexture)(struct dri_context *context, - int target, - unsigned texture, - int depth, - int level, - unsigned *error, - void *loaderPrivate); - - /** - * Blit a part of a struct dri_image to another and flushes - * - * flush_flag: - * 0: no flush - * __BLIT_FLAG_FLUSH: flush after the blit operation - * __BLIT_FLAG_FINISH: flush and wait the blit finished - * - * \since 9 - */ - void (*blitImage)(struct dri_context *context, struct dri_image *dst, struct dri_image *src, - int dstx0, int dsty0, int dstwidth, int dstheight, - int srcx0, int srcy0, int srcwidth, int srcheight, - int flush_flag); - - /** - * Query for general capabilities of the driver that concern - * buffer sharing and image importing. - * - * \since 10 - */ - int (*getCapabilities)(struct dri_screen *screen); - - /** - * Returns a map of the specified region of a struct dri_image for the specified usage. - * - * flags may include __DRI_IMAGE_TRANSFER_READ, which will populate the - * mapping with the current buffer content. If __DRI_IMAGE_TRANSFER_READ - * is not included in the flags, the buffer content at map time is - * undefined. Users wanting to modify the mapping must include - * __DRI_IMAGE_TRANSFER_WRITE; if __DRI_IMAGE_TRANSFER_WRITE is not - * included, behaviour when writing the mapping is undefined. - * - * Returns the byte stride in *stride, and an opaque pointer to data - * tracking the mapping in **data, which must be passed to unmapImage(). - * - * \since 12 - */ - void *(*mapImage)(struct dri_context *context, struct dri_image *image, - int x0, int y0, int width, int height, - unsigned int flags, int *stride, void **data); - - /** - * Unmap a previously mapped struct dri_image - * - * \since 12 - */ - void (*unmapImage)(struct dri_context *context, struct dri_image *image, void *data); - - /* - * dmabuf format query to support EGL_EXT_image_dma_buf_import_modifiers. - * - * \param max Maximum number of formats that can be accomodated into - * \param formats. If zero, no formats are returned - - * instead, the driver returns the total number of - * supported dmabuf formats in \param count. - * \param formats Buffer to fill formats into. - * \param count Count of formats returned, or, total number of - * supported formats in case \param max is zero. - * - * Returns true on success. - * - * \since 15 - */ - bool (*queryDmaBufFormats)(struct dri_screen *screen, int max, int *formats, - int *count); - - /* - * dmabuf format modifier query for a given format to support - * EGL_EXT_image_dma_buf_import_modifiers. - * - * \param fourcc The format to query modifiers for. If this format - * is not supported by the driver, return false. - * \param max Maximum number of modifiers that can be accomodated in - * \param modifiers. If zero, no modifiers are returned - - * instead, the driver returns the total number of - * modifiers for \param format in \param count. - * \param modifiers Buffer to fill modifiers into. - * \param count Count of the modifiers returned, or, total number of - * supported modifiers for \param fourcc in case - * \param max is zero. - * - * Returns true upon success. - * - * \since 15 - */ - bool (*queryDmaBufModifiers)(struct dri_screen *screen, int fourcc, int max, - uint64_t *modifiers, - unsigned int *external_only, int *count); - - /** - * dmabuf format modifier attribute query for a given format and modifier. - * - * \param fourcc The format to query. If this format is not supported by - * the driver, return false. - * \param modifier The modifier to query. If this format+modifier is not - * supported by the driver, return false. - * \param attrib The __DRI_IMAGE_FORMAT_MODIFIER_ATTRIB to query. - * \param value A pointer to where to store the result of the query. - * - * Returns true upon success. - * - * \since 16 - */ - bool (*queryDmaBufFormatModifierAttribs)(struct dri_screen *screen, - uint32_t fourcc, uint64_t modifier, - int attrib, uint64_t *value); - - /** - * Create a DRI image from the given renderbuffer. - * - * \param context the current DRI context - * \param renderbuffer the GL name of the renderbuffer - * \param loaderPrivate for callbacks into the loader related to the image - * \param error will be set to one of __DRI_IMAGE_ERROR_xxx - * \return the newly created image on success, or NULL otherwise - */ - struct dri_image *(*createImageFromRenderbuffer)(struct dri_context *context, - int renderbuffer, - void *loaderPrivate, - unsigned *error); - - /** - * Creates a DRI image from an array of dmabuf fds and their modifiers. - * - * See __DRI_IMAGE_*_FLAG for valid definitions of flags. - */ - struct dri_image *(*createImageFromDmaBufs)(struct dri_screen *screen, - int width, int height, int fourcc, - uint64_t modifier, - int *fds, int num_fds, - int *strides, int *offsets, - enum __DRIYUVColorSpace color_space, - enum __DRISampleRange sample_range, - enum __DRIChromaSiting horiz_siting, - enum __DRIChromaSiting vert_siting, - uint32_t flags, - unsigned *error, - void *loaderPrivate); - - /** - * Creates an image with implementation's favorite modifiers and the - * provided usage flags. - * - * Passing either zero modifiers, or a modifier list consisting only - * of DRM_FORMAT_MOD_INVALID, allows the implementation to select a - * layout with implicit modifiers. - * - * The created image should be destroyed with destroyImage(). - * - * Returns the new DRIimage. The chosen modifier can be obtained later on - * and passed back to things like the kernel's AddFB2 interface. - * - * \since 19 - */ - struct dri_image *(*createImage)(struct dri_screen *screen, - int width, int height, int format, - const uint64_t *modifiers, - const unsigned int modifier_count, - unsigned int use, - void *loaderPrivate); - - /** - * Set an in-fence-fd on the image. If a fence-fd is already set - * (but not yet consumed), the existing and new fence will be merged - * - * This does *not* take ownership of the fd. The fd does not need - * to be kept alive once the call has returned. - * - * \since 21 - */ - void (*setInFenceFd)(struct dri_image *image, int fd); - - /* - * Query supported compression rates for a given format for - * EGL_EXT_surface_compression. - * - * \param config Config for which to query the supported compression - * rates. - * \param max Maximum number of rates that can be accomodated into - * \param rates. If zero, no rates are returned - - * instead, the driver returns the total number of - * supported compression rates in \param count. - * \param rates Buffer to fill rates into. - * \param count Count of rates returned, or, total number of - * supported rates in case \param max is zero. - * - * Returns true on success. - * - * \since 22 - */ - bool (*queryCompressionRates)(struct dri_screen *screen, const struct dri_config *config, - int max, enum __DRIFixedRateCompression *rates, - int *count); - - /* - * Query list of modifiers that are associated with given fixed-rate - * compression bitrate. - * - * \param format The format to query - * \param rate Compression rate to query for - * \param max Maximum number of modifiers that can be accomodated in - * \param modifiers. If zero, no modifiers are returned - - * instead, the driver returns the total number of - * modifiers for \param format in \param count. - * \param modifiers Buffer to fill modifiers into. - * \param count Count of the modifiers returned, or, total number of - * supported modifiers for \param fourcc in case - * \param max is zero. - * - * Returns true on success. - * - * \since 22 - */ - bool (*queryCompressionModifiers)(struct dri_screen *screen, uint32_t format, - enum __DRIFixedRateCompression rate, - int max, uint64_t *modifiers, int *count); -} __DRIimageExtension; - - /** * This extension must be implemented by the loader and passed to the * driver at screen creation time. The EGLImage entry points in the @@ -1397,23 +987,6 @@ typedef struct { void (*destroyLoaderImageState)(void *loaderPrivate); } __DRIimageLoaderExtension; -/** - * Main DRI3 interface extension. - * - * Not used by the X server. - */ - -typedef struct { - __DRIextension base; - - /* Common DRI functions, shared with DRI2 */ - __DRIcreateNewScreen2Func createNewScreen2; - __DRIcreateNewDrawableFunc createNewDrawable; - __DRIcreateContextAttribsFunc createContextAttribs; - __DRIgetAPIMaskFunc getAPIMask; - __DRIcreateNewScreen3Func createNewScreen3; -} __DRIimageDriverExtension; - /** * Background callable loader extension. *