mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 19:40:10 +01:00
dri: make DRI_IMAGE public
Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30450>
This commit is contained in:
parent
7dded1ad88
commit
10a80782e0
6 changed files with 118 additions and 46 deletions
|
|
@ -942,7 +942,7 @@ from_dri_compression_rate(enum __DRIFixedRateCompression rate)
|
|||
}
|
||||
|
||||
static __DRIimage *
|
||||
dri2_create_image_from_winsys(__DRIscreen *_screen,
|
||||
dri_create_image_from_winsys(__DRIscreen *_screen,
|
||||
int width, int height, const struct dri2_format_mapping *map,
|
||||
int num_handles, struct winsys_handle *whandle,
|
||||
unsigned bind,
|
||||
|
|
@ -1147,8 +1147,8 @@ dri2_get_modifier_num_planes(__DRIscreen *_screen,
|
|||
}
|
||||
}
|
||||
|
||||
static __DRIimage *
|
||||
dri2_create_image(__DRIscreen *_screen,
|
||||
__DRIimage *
|
||||
dri_create_image(__DRIscreen *_screen,
|
||||
int width, int height,
|
||||
int format,
|
||||
const uint64_t *modifiers,
|
||||
|
|
@ -1466,7 +1466,7 @@ dri2_query_image_by_resource_param(__DRIimage *image, int attrib, int *value)
|
|||
}
|
||||
}
|
||||
|
||||
static GLboolean
|
||||
GLboolean
|
||||
dri2_query_image(__DRIimage *image, int attrib, int *value)
|
||||
{
|
||||
if (dri2_query_image_common(image, attrib, value))
|
||||
|
|
@ -1479,7 +1479,7 @@ dri2_query_image(__DRIimage *image, int attrib, int *value)
|
|||
return GL_FALSE;
|
||||
}
|
||||
|
||||
static __DRIimage *
|
||||
__DRIimage *
|
||||
dri2_dup_image(__DRIimage *image, void *loaderPrivate)
|
||||
{
|
||||
__DRIimage *img;
|
||||
|
|
@ -1505,7 +1505,7 @@ dri2_dup_image(__DRIimage *image, void *loaderPrivate)
|
|||
return img;
|
||||
}
|
||||
|
||||
static GLboolean
|
||||
GLboolean
|
||||
dri2_validate_usage(__DRIimage *image, unsigned int use)
|
||||
{
|
||||
if (!image || !image->texture)
|
||||
|
|
@ -1533,7 +1533,7 @@ dri2_validate_usage(__DRIimage *image, unsigned int use)
|
|||
return screen->check_resource_capability(screen, image->texture, bind);
|
||||
}
|
||||
|
||||
static __DRIimage *
|
||||
__DRIimage *
|
||||
dri2_from_names(__DRIscreen *screen, int width, int height, int fourcc,
|
||||
int *names, int num_names, int *strides, int *offsets,
|
||||
void *loaderPrivate)
|
||||
|
|
@ -1556,7 +1556,7 @@ dri2_from_names(__DRIscreen *screen, int width, int height, int fourcc,
|
|||
whandle.format = map->pipe_format;
|
||||
whandle.modifier = DRM_FORMAT_MOD_INVALID;
|
||||
|
||||
img = dri2_create_image_from_winsys(screen, width, height, map,
|
||||
img = dri_create_image_from_winsys(screen, width, height, map,
|
||||
1, &whandle, 0, loaderPrivate);
|
||||
if (img == NULL)
|
||||
return NULL;
|
||||
|
|
@ -1568,7 +1568,7 @@ dri2_from_names(__DRIscreen *screen, int width, int height, int fourcc,
|
|||
return img;
|
||||
}
|
||||
|
||||
static __DRIimage *
|
||||
__DRIimage *
|
||||
dri2_from_planar(__DRIimage *image, int plane, void *loaderPrivate)
|
||||
{
|
||||
__DRIimage *img;
|
||||
|
|
@ -1607,8 +1607,8 @@ dri2_from_planar(__DRIimage *image, int plane, void *loaderPrivate)
|
|||
return img;
|
||||
}
|
||||
|
||||
static bool
|
||||
dri2_query_dma_buf_modifiers(__DRIscreen *_screen, int fourcc, int max,
|
||||
bool
|
||||
dri_query_dma_buf_modifiers(__DRIscreen *_screen, int fourcc, int max,
|
||||
uint64_t *modifiers, unsigned int *external_only,
|
||||
int *count)
|
||||
{
|
||||
|
|
@ -1645,7 +1645,7 @@ dri2_query_dma_buf_modifiers(__DRIscreen *_screen, int fourcc, int max,
|
|||
return false;
|
||||
}
|
||||
|
||||
static bool
|
||||
bool
|
||||
dri2_query_dma_buf_format_modifier_attribs(__DRIscreen *_screen,
|
||||
uint32_t fourcc, uint64_t modifier,
|
||||
int attrib, uint64_t *value)
|
||||
|
|
@ -1669,7 +1669,7 @@ dri2_query_dma_buf_format_modifier_attribs(__DRIscreen *_screen,
|
|||
}
|
||||
}
|
||||
|
||||
static __DRIimage *
|
||||
__DRIimage *
|
||||
dri2_from_dma_bufs(__DRIscreen *screen,
|
||||
int width, int height, int fourcc,
|
||||
uint64_t modifier, int *fds, int num_fds,
|
||||
|
|
@ -1726,7 +1726,7 @@ dri2_from_dma_bufs(__DRIscreen *screen,
|
|||
whandles[i].plane = i;
|
||||
}
|
||||
|
||||
img = dri2_create_image_from_winsys(screen, width, height, map,
|
||||
img = dri_create_image_from_winsys(screen, width, height, map,
|
||||
num_fds, whandles, flags,
|
||||
loaderPrivate);
|
||||
if (img == NULL) {
|
||||
|
|
@ -1803,7 +1803,7 @@ dri2_query_compression_modifiers(__DRIscreen *_screen, uint32_t fourcc,
|
|||
return true;
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
dri2_blit_image(__DRIcontext *context, __DRIimage *dst, __DRIimage *src,
|
||||
int dstx0, int dsty0, int dstwidth, int dstheight,
|
||||
int srcx0, int srcy0, int srcwidth, int srcheight,
|
||||
|
|
@ -1857,7 +1857,7 @@ dri2_blit_image(__DRIcontext *context, __DRIimage *dst, __DRIimage *src,
|
|||
}
|
||||
}
|
||||
|
||||
static void *
|
||||
void *
|
||||
dri2_map_image(__DRIcontext *context, __DRIimage *image,
|
||||
int x0, int y0, int width, int height,
|
||||
unsigned int flags, int *stride, void **data)
|
||||
|
|
@ -1901,7 +1901,7 @@ dri2_map_image(__DRIcontext *context, __DRIimage *image,
|
|||
return map;
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
dri2_unmap_image(__DRIcontext *context, __DRIimage *image, void *data)
|
||||
{
|
||||
struct dri_context *ctx = dri_context(context);
|
||||
|
|
@ -1915,7 +1915,7 @@ dri2_unmap_image(__DRIcontext *context, __DRIimage *image, void *data)
|
|||
pipe_texture_unmap(pipe, (struct pipe_transfer *)data);
|
||||
}
|
||||
|
||||
static int
|
||||
int
|
||||
dri2_get_capabilities(__DRIscreen *_screen)
|
||||
{
|
||||
struct dri_screen *screen = dri_screen(_screen);
|
||||
|
|
@ -1927,9 +1927,9 @@ dri2_get_capabilities(__DRIscreen *_screen)
|
|||
static const __DRIimageExtension dri2ImageExtensionTempl = {
|
||||
.base = { __DRI_IMAGE, 22 },
|
||||
|
||||
.createImageFromRenderbuffer = dri2_create_image_from_renderbuffer,
|
||||
.createImageFromRenderbuffer = dri_create_image_from_renderbuffer,
|
||||
.destroyImage = dri2_destroy_image,
|
||||
.createImage = dri2_create_image,
|
||||
.createImage = dri_create_image,
|
||||
.queryImage = dri2_query_image,
|
||||
.dupImage = dri2_dup_image,
|
||||
.validateUsage = dri2_validate_usage,
|
||||
|
|
@ -1951,9 +1951,9 @@ static const __DRIimageExtension dri2ImageExtensionTempl = {
|
|||
const __DRIimageExtension driVkImageExtension = {
|
||||
.base = { __DRI_IMAGE, 20 },
|
||||
|
||||
.createImageFromRenderbuffer = dri2_create_image_from_renderbuffer,
|
||||
.createImageFromRenderbuffer = dri_create_image_from_renderbuffer,
|
||||
.destroyImage = dri2_destroy_image,
|
||||
.createImage = dri2_create_image,
|
||||
.createImage = dri_create_image,
|
||||
.queryImage = dri2_query_image,
|
||||
.dupImage = dri2_dup_image,
|
||||
.validateUsage = dri2_validate_usage,
|
||||
|
|
@ -1965,17 +1965,17 @@ const __DRIimageExtension driVkImageExtension = {
|
|||
.getCapabilities = dri2_get_capabilities,
|
||||
.mapImage = dri2_map_image,
|
||||
.unmapImage = dri2_unmap_image,
|
||||
.queryDmaBufFormats = dri2_query_dma_buf_formats,
|
||||
.queryDmaBufModifiers = dri2_query_dma_buf_modifiers,
|
||||
.queryDmaBufFormats = dri_query_dma_buf_formats,
|
||||
.queryDmaBufModifiers = dri_query_dma_buf_modifiers,
|
||||
.queryDmaBufFormatModifierAttribs = dri2_query_dma_buf_format_modifier_attribs,
|
||||
};
|
||||
|
||||
const __DRIimageExtension driVkImageExtensionSw = {
|
||||
.base = { __DRI_IMAGE, 20 },
|
||||
|
||||
.createImageFromRenderbuffer = dri2_create_image_from_renderbuffer,
|
||||
.createImageFromRenderbuffer = dri_create_image_from_renderbuffer,
|
||||
.destroyImage = dri2_destroy_image,
|
||||
.createImage = dri2_create_image,
|
||||
.createImage = dri_create_image,
|
||||
.queryImage = dri2_query_image,
|
||||
.dupImage = dri2_dup_image,
|
||||
.validateUsage = dri2_validate_usage,
|
||||
|
|
@ -2142,9 +2142,9 @@ dri2_init_screen_extensions(struct dri_screen *screen,
|
|||
if (pscreen->get_param(pscreen, PIPE_CAP_DMABUF) & DRM_PRIME_CAP_IMPORT) {
|
||||
screen->image_extension.createImageFromDmaBufs = dri2_from_dma_bufs;
|
||||
screen->image_extension.queryDmaBufFormats =
|
||||
dri2_query_dma_buf_formats;
|
||||
dri_query_dma_buf_formats;
|
||||
screen->image_extension.queryDmaBufModifiers =
|
||||
dri2_query_dma_buf_modifiers;
|
||||
dri_query_dma_buf_modifiers;
|
||||
if (!is_kms_screen) {
|
||||
screen->image_extension.queryDmaBufFormatModifierAttribs =
|
||||
dri2_query_dma_buf_format_modifier_attribs;
|
||||
|
|
|
|||
|
|
@ -257,7 +257,7 @@ const __DRI2fenceExtension dri2FenceExtension = {
|
|||
};
|
||||
|
||||
__DRIimage *
|
||||
dri2_create_image_from_renderbuffer(__DRIcontext *context,
|
||||
dri_create_image_from_renderbuffer(__DRIcontext *context,
|
||||
int renderbuffer, void *loaderPrivate,
|
||||
unsigned *error)
|
||||
{
|
||||
|
|
@ -700,7 +700,7 @@ dri2_yuv_dma_buf_supported(struct dri_screen *screen,
|
|||
}
|
||||
|
||||
bool
|
||||
dri2_query_dma_buf_formats(__DRIscreen *_screen, int max, int *formats,
|
||||
dri_query_dma_buf_formats(__DRIscreen *_screen, int max, int *formats,
|
||||
int *count)
|
||||
{
|
||||
struct dri_screen *screen = dri_screen(_screen);
|
||||
|
|
|
|||
|
|
@ -52,9 +52,6 @@ dri2_get_mapping_by_format(int format);
|
|||
enum pipe_format
|
||||
dri2_get_pipe_format_for_dri_format(int format);
|
||||
|
||||
bool
|
||||
dri2_query_dma_buf_formats(__DRIscreen *_screen, int max, int *formats,
|
||||
int *count);
|
||||
bool
|
||||
dri2_yuv_dma_buf_supported(struct dri_screen *screen,
|
||||
const struct dri2_format_mapping *map);
|
||||
|
|
@ -62,18 +59,6 @@ dri2_yuv_dma_buf_supported(struct dri_screen *screen,
|
|||
bool
|
||||
dri2_validate_egl_image(struct dri_screen *screen, void *handle);
|
||||
|
||||
__DRIimage *
|
||||
dri2_create_image_from_renderbuffer(__DRIcontext *context,
|
||||
int renderbuffer, void *loaderPrivate,
|
||||
unsigned *error);
|
||||
|
||||
void
|
||||
dri2_destroy_image(__DRIimage *img);
|
||||
|
||||
__DRIimage *
|
||||
dri2_create_from_texture(__DRIcontext *context, int target, unsigned texture,
|
||||
int depth, int level, unsigned *error,
|
||||
void *loaderPrivate);
|
||||
#endif
|
||||
|
||||
/* vim: set sw=3 ts=8 sts=3 expandtab: */
|
||||
|
|
|
|||
|
|
@ -212,4 +212,74 @@ PUBLIC int
|
|||
dri_interop_flush_objects(__DRIcontext *_ctx,
|
||||
unsigned count, struct mesa_glinterop_export_in *objects,
|
||||
struct mesa_glinterop_flush_out *out);
|
||||
|
||||
PUBLIC __DRIimage *
|
||||
dri_create_image_from_renderbuffer(__DRIcontext *context,
|
||||
int renderbuffer, void *loaderPrivate,
|
||||
unsigned *error);
|
||||
|
||||
PUBLIC void
|
||||
dri2_destroy_image(__DRIimage *img);
|
||||
|
||||
PUBLIC __DRIimage *
|
||||
dri2_create_from_texture(__DRIcontext *context, int target, unsigned texture,
|
||||
int depth, int level, unsigned *error,
|
||||
void *loaderPrivate);
|
||||
|
||||
PUBLIC __DRIimage *
|
||||
dri_create_image(__DRIscreen *_screen,
|
||||
int width, int height,
|
||||
int format,
|
||||
const uint64_t *modifiers,
|
||||
const unsigned _count,
|
||||
unsigned int use,
|
||||
void *loaderPrivate);
|
||||
PUBLIC GLboolean
|
||||
dri2_query_image(__DRIimage *image, int attrib, int *value);
|
||||
PUBLIC __DRIimage *
|
||||
dri2_dup_image(__DRIimage *image, void *loaderPrivate);
|
||||
PUBLIC GLboolean
|
||||
dri2_validate_usage(__DRIimage *image, unsigned int use);
|
||||
PUBLIC __DRIimage *
|
||||
dri2_from_names(__DRIscreen *screen, int width, int height, int fourcc,
|
||||
int *names, int num_names, int *strides, int *offsets,
|
||||
void *loaderPrivate);
|
||||
PUBLIC __DRIimage *
|
||||
dri2_from_planar(__DRIimage *image, int plane, void *loaderPrivate);
|
||||
PUBLIC __DRIimage *
|
||||
dri2_from_dma_bufs(__DRIscreen *screen,
|
||||
int width, int height, int fourcc,
|
||||
uint64_t modifier, int *fds, int num_fds,
|
||||
int *strides, int *offsets,
|
||||
enum __DRIYUVColorSpace yuv_color_space,
|
||||
enum __DRISampleRange sample_range,
|
||||
enum __DRIChromaSiting horizontal_siting,
|
||||
enum __DRIChromaSiting vertical_siting,
|
||||
uint32_t dri_flags,
|
||||
unsigned *error,
|
||||
void *loaderPrivate);
|
||||
PUBLIC void
|
||||
dri2_blit_image(__DRIcontext *context, __DRIimage *dst, __DRIimage *src,
|
||||
int dstx0, int dsty0, int dstwidth, int dstheight,
|
||||
int srcx0, int srcy0, int srcwidth, int srcheight,
|
||||
int flush_flag);
|
||||
PUBLIC int
|
||||
dri2_get_capabilities(__DRIscreen *_screen);
|
||||
PUBLIC void *
|
||||
dri2_map_image(__DRIcontext *context, __DRIimage *image,
|
||||
int x0, int y0, int width, int height,
|
||||
unsigned int flags, int *stride, void **data);
|
||||
PUBLIC void
|
||||
dri2_unmap_image(__DRIcontext *context, __DRIimage *image, void *data);
|
||||
PUBLIC bool
|
||||
dri_query_dma_buf_formats(__DRIscreen *_screen, int max, int *formats,
|
||||
int *count);
|
||||
PUBLIC bool
|
||||
dri_query_dma_buf_modifiers(__DRIscreen *_screen, int fourcc, int max,
|
||||
uint64_t *modifiers, unsigned int *external_only,
|
||||
int *count);
|
||||
PUBLIC bool
|
||||
dri2_query_dma_buf_format_modifier_attribs(__DRIscreen *_screen,
|
||||
uint32_t fourcc, uint64_t modifier,
|
||||
int attrib, uint64_t *value);
|
||||
#endif /* _DRI_UTIL_H_ */
|
||||
|
|
|
|||
|
|
@ -506,7 +506,7 @@ drisw_update_tex_buffer(struct dri_drawable *drawable,
|
|||
static __DRIimageExtension driSWImageExtension = {
|
||||
.base = { __DRI_IMAGE, 6 },
|
||||
|
||||
.createImageFromRenderbuffer = dri2_create_image_from_renderbuffer,
|
||||
.createImageFromRenderbuffer = dri_create_image_from_renderbuffer,
|
||||
.createImageFromTexture = dri2_create_from_texture,
|
||||
.destroyImage = dri2_destroy_image,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -24,6 +24,23 @@
|
|||
dri_interop_export_object;
|
||||
dri_interop_flush_objects;
|
||||
dri_loader_get_extensions;
|
||||
dri_create_image_from_renderbuffer;
|
||||
dri2_destroy_image;
|
||||
dri2_create_from_texture;
|
||||
dri2_create_image;
|
||||
dri2_query_image;
|
||||
dri2_dup_image;
|
||||
dri2_validate_usage;
|
||||
dri2_from_names;
|
||||
dri2_from_planar;
|
||||
dri2_from_dma_bufs;
|
||||
dri2_blit_image;
|
||||
dri2_get_capabilities;
|
||||
dri2_map_image;
|
||||
dri2_unmap_image;
|
||||
dri_query_dma_buf_formats;
|
||||
dri_query_dma_buf_modifiers;
|
||||
dri2_query_dma_buf_format_modifier_attribs;
|
||||
@nouveau_drm_screen_create@
|
||||
@radeon_drm_winsys_create@
|
||||
@amdgpu_winsys_create@
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue