summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2021-12-07 11:20:39 +1000
committerMarge Bot <emma+marge@anholt.net>2021-12-08 19:06:48 +0000
commit37fb8058fb82af0b0d484ef3a991bb4afd01c92d (patch)
tree7aa77d0544b81bbd6472df89c8f17cb03449daca
parent4e13c7d46ae57907be22baee4807d4cf017c4b73 (diff)
mesa/st: move pixel/bitmap functions to direct call
Acked-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14100>
-rw-r--r--src/mesa/main/dd.h53
-rw-r--r--src/mesa/main/debug.c5
-rw-r--r--src/mesa/main/dlist.c9
-rw-r--r--src/mesa/main/drawpix.c12
-rw-r--r--src/mesa/main/rastpos.c6
-rw-r--r--src/mesa/main/readpix.c7
-rw-r--r--src/mesa/state_tracker/st_cb_bitmap.c25
-rw-r--r--src/mesa/state_tracker/st_cb_bitmap.h12
-rw-r--r--src/mesa/state_tracker/st_cb_bitmap_shader.c1
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c18
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.h11
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels_shader.c1
-rw-r--r--src/mesa/state_tracker/st_cb_rasterpos.c9
-rw-r--r--src/mesa/state_tracker/st_cb_rasterpos.h6
-rw-r--r--src/mesa/state_tracker/st_cb_readpixels.c7
-rw-r--r--src/mesa/state_tracker/st_cb_readpixels.h11
-rw-r--r--src/mesa/state_tracker/st_context.c6
17 files changed, 56 insertions, 143 deletions
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index f613238a6c0..22fd2e60a36 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -135,59 +135,6 @@ struct dd_function_table {
void (*Flush)(struct gl_context *ctx, unsigned gallium_flush_flags);
/**
- * Execute glRasterPos, updating the ctx->Current.Raster fields
- */
- void (*RasterPos)( struct gl_context *ctx, const GLfloat v[4] );
-
- /**
- * \name Image-related functions
- */
- /*@{*/
-
- /**
- * Called by glDrawPixels().
- * \p unpack describes how to unpack the source image data.
- */
- void (*DrawPixels)( struct gl_context *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid *pixels );
-
- /**
- * Called by glReadPixels().
- */
- void (*ReadPixels)( struct gl_context *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- GLvoid *dest );
-
- /**
- * Called by glCopyPixels().
- */
- void (*CopyPixels)( struct gl_context *ctx, GLint srcx, GLint srcy,
- GLsizei width, GLsizei height,
- GLint dstx, GLint dsty, GLenum type );
-
- /**
- * Called by glBitmap().
- */
- void (*Bitmap)( struct gl_context *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- const struct gl_pixelstore_attrib *unpack,
- const GLubyte *bitmap );
-
- /**
- * Called by display list code for optimized glCallLists/glBitmap rendering
- * The driver must support texture rectangles of width 1024 or more.
- */
- void (*DrawAtlasBitmaps)(struct gl_context *ctx,
- const struct gl_bitmap_atlas *atlas,
- GLuint count, const GLubyte *ids);
- /*@}*/
-
- /**
* Called by glCopyImageSubData().
*
* This function should copy one 2-D slice from src_teximage or
diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c
index 7c4b7385eab..525d250cb3a 100644
--- a/src/mesa/main/debug.c
+++ b/src/mesa/main/debug.c
@@ -39,6 +39,7 @@
#include "texobj.h"
#include "state_tracker/st_cb_texture.h"
+#include "state_tracker/st_cb_readpixels.h"
static const char *
tex_target_name(GLenum tgt)
@@ -326,8 +327,8 @@ _mesa_write_renderbuffer_image(const struct gl_renderbuffer *rb)
buffer = malloc(rb->Width * rb->Height * 4);
- ctx->Driver.ReadPixels(ctx, 0, 0, rb->Width, rb->Height,
- format, type, &ctx->DefaultPacking, buffer);
+ st_ReadPixels(ctx, 0, 0, rb->Width, rb->Height,
+ format, type, &ctx->DefaultPacking, buffer);
/* make filename */
snprintf(s, sizeof(s), "/tmp/renderbuffer%u.ppm", rb->Name);
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index ba25b814562..347f66a2960 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -77,6 +77,7 @@
#include "util/u_memory.h"
#include "state_tracker/st_cb_texture.h"
+#include "state_tracker/st_cb_bitmap.h"
#define USE_BITMAP_ATLAS 1
@@ -13466,8 +13467,7 @@ _mesa_GenLists(GLsizei range)
}
if (USE_BITMAP_ATLAS &&
- range > 16 &&
- ctx->Driver.DrawAtlasBitmaps) {
+ range > 16) {
/* "range > 16" is a rough heuristic to guess when glGenLists might be
* used to allocate display lists for glXUseXFont or wglUseFontBitmaps.
* Create the empty atlas now.
@@ -13813,8 +13813,7 @@ render_bitmap_atlas(struct gl_context *ctx, GLsizei n, GLenum type,
if (!USE_BITMAP_ATLAS ||
!ctx->Current.RasterPosValid ||
ctx->List.ListBase == 0 ||
- type != GL_UNSIGNED_BYTE ||
- !ctx->Driver.DrawAtlasBitmaps) {
+ type != GL_UNSIGNED_BYTE) {
/* unsupported */
return false;
}
@@ -13851,7 +13850,7 @@ render_bitmap_atlas(struct gl_context *ctx, GLsizei n, GLenum type,
}
}
- ctx->Driver.DrawAtlasBitmaps(ctx, atlas, n, (const GLubyte *) lists);
+ st_DrawAtlasBitmaps(ctx, atlas, n, (const GLubyte *) lists);
return true;
}
diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c
index 9df1406e1e6..bcd81d2c145 100644
--- a/src/mesa/main/drawpix.c
+++ b/src/mesa/main/drawpix.c
@@ -39,6 +39,8 @@
#include "util/u_math.h"
#include "util/rounding.h"
+#include "state_tracker/st_cb_bitmap.h"
+#include "state_tracker/st_cb_drawpixels.h"
/*
* Execute glDrawPixels
@@ -166,8 +168,8 @@ _mesa_DrawPixels( GLsizei width, GLsizei height,
}
}
- ctx->Driver.DrawPixels(ctx, x, y, width, height, format, type,
- &ctx->Unpack, pixels);
+ st_DrawPixels(ctx, x, y, width, height, format, type,
+ &ctx->Unpack, pixels);
}
}
else if (ctx->RenderMode == GL_FEEDBACK) {
@@ -288,8 +290,8 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height,
if (width > 0 && height > 0) {
GLint destx = lroundf(ctx->Current.RasterPos[0]);
GLint desty = lroundf(ctx->Current.RasterPos[1]);
- ctx->Driver.CopyPixels( ctx, srcx, srcy, width, height, destx, desty,
- type );
+ st_CopyPixels( ctx, srcx, srcy, width, height, destx, desty,
+ type );
}
}
else if (ctx->RenderMode == GL_FEEDBACK) {
@@ -369,7 +371,7 @@ _mesa_Bitmap( GLsizei width, GLsizei height,
}
}
- ctx->Driver.Bitmap( ctx, x, y, width, height, &ctx->Unpack, bitmap );
+ st_Bitmap( ctx, x, y, width, height, &ctx->Unpack, bitmap );
}
}
else if (ctx->RenderMode == GL_FEEDBACK) {
diff --git a/src/mesa/main/rastpos.c b/src/mesa/main/rastpos.c
index 4fd16fac390..9a863a071d8 100644
--- a/src/mesa/main/rastpos.c
+++ b/src/mesa/main/rastpos.c
@@ -39,7 +39,7 @@
#include "main/viewport.h"
#include "util/bitscan.h"
-
+#include "state_tracker/st_cb_rasterpos.h"
/**
* Clip a point against the view volume.
@@ -388,7 +388,7 @@ compute_texgen(struct gl_context *ctx, const GLfloat vObj[4], const GLfloat vEye
/**
- * glRasterPos transformation. Typically called via ctx->Driver.RasterPos().
+ * glRasterPos transformation.
*
* \param vObj vertex position in object space
*/
@@ -544,7 +544,7 @@ rasterpos(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
if (ctx->NewState)
_mesa_update_state( ctx );
- ctx->Driver.RasterPos(ctx, p);
+ st_RasterPos(ctx, p);
}
diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
index c0912fbe130..324ca9da22a 100644
--- a/src/mesa/main/readpix.c
+++ b/src/mesa/main/readpix.c
@@ -44,6 +44,7 @@
#include "pixeltransfer.h"
#include "state_tracker/st_cb_fbo.h"
+#include "state_tracker/st_cb_readpixels.h"
/**
* Return true if the conversion L=R+G+B is needed.
@@ -863,7 +864,7 @@ read_depth_stencil_pixels(struct gl_context *ctx,
/**
- * Software fallback routine for ctx->Driver.ReadPixels().
+ * Software fallback routine.
* By time we get here, all error checking will have been done.
*/
void
@@ -1173,8 +1174,8 @@ read_pixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format,
if (ctx->Pack.BufferObj)
ctx->Pack.BufferObj->UsageHistory |= USAGE_PIXEL_PACK_BUFFER;
- ctx->Driver.ReadPixels(ctx, x, y, width, height,
- format, type, &clippedPacking, pixels);
+ st_ReadPixels(ctx, x, y, width, height,
+ format, type, &clippedPacking, pixels);
}
void GLAPIENTRY
diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c
index f538c081fae..b4b038c3bc9 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/src/mesa/state_tracker/st_cb_bitmap.c
@@ -593,14 +593,10 @@ init_bitmap_state(struct st_context *st)
reset_cache(st);
}
-
-/**
- * Called via ctx->Driver.Bitmap()
- */
-static void
+void
st_Bitmap(struct gl_context *ctx, GLint x, GLint y,
GLsizei width, GLsizei height,
- const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap )
+ const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap)
{
struct st_context *st = st_context(ctx);
struct pipe_resource *pt;
@@ -644,11 +640,7 @@ st_Bitmap(struct gl_context *ctx, GLint x, GLint y,
}
}
-
-/**
- * Called via ctx->Driver.DrawAtlasBitmap()
- */
-static void
+void
st_DrawAtlasBitmaps(struct gl_context *ctx,
const struct gl_bitmap_atlas *atlas,
GLuint count, const GLubyte *ids)
@@ -781,17 +773,6 @@ out:
st->dirty |= ST_NEW_FS_CONSTANTS;
}
-
-
-/** Per-context init */
-void
-st_init_bitmap_functions(struct dd_function_table *functions)
-{
- functions->Bitmap = st_Bitmap;
- functions->DrawAtlasBitmaps = st_DrawAtlasBitmaps;
-}
-
-
/** Per-context tear-down */
void
st_destroy_bitmap(struct st_context *st)
diff --git a/src/mesa/state_tracker/st_cb_bitmap.h b/src/mesa/state_tracker/st_cb_bitmap.h
index d2b53c9bcaa..b9f9f1bf96e 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.h
+++ b/src/mesa/state_tracker/st_cb_bitmap.h
@@ -36,9 +36,9 @@ struct dd_function_table;
struct st_context;
struct gl_program;
struct st_program;
-
-extern void
-st_init_bitmap_functions(struct dd_function_table *functions);
+struct gl_bitmap_atlas;
+struct gl_context;
+struct gl_pixelstore_attrib;
extern void
st_destroy_bitmap(struct st_context *st);
@@ -51,4 +51,10 @@ st_get_bitmap_shader(const struct tgsi_token *tokens,
unsigned tex_target, unsigned sampler_index,
bool use_texcoord, bool swizzle_xxxx);
+void st_Bitmap(struct gl_context *ctx, GLint x, GLint y,
+ GLsizei width, GLsizei height,
+ const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap);
+void st_DrawAtlasBitmaps(struct gl_context *ctx,
+ const struct gl_bitmap_atlas *atlas,
+ GLuint count, const GLubyte *ids);
#endif /* ST_CB_BITMAP_H */
diff --git a/src/mesa/state_tracker/st_cb_bitmap_shader.c b/src/mesa/state_tracker/st_cb_bitmap_shader.c
index ab9a10748e9..bbd1a485720 100644
--- a/src/mesa/state_tracker/st_cb_bitmap_shader.c
+++ b/src/mesa/state_tracker/st_cb_bitmap_shader.c
@@ -26,6 +26,7 @@
*
**************************************************************************/
+#include "main/macros.h"
#include "st_cb_bitmap.h"
#include "tgsi/tgsi_transform.h"
#include "tgsi/tgsi_scan.h"
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index d94035da88f..89fa7f5fd17 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -1272,11 +1272,7 @@ setup_sampler_swizzle(struct pipe_sampler_view *sv, GLenum format, GLenum type)
}
}
-
-/**
- * Called via ctx->Driver.DrawPixels()
- */
-static void
+void
st_DrawPixels(struct gl_context *ctx, GLint x, GLint y,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
@@ -1675,8 +1671,7 @@ blit_copy_pixels(struct gl_context *ctx, GLint srcx, GLint srcy,
return GL_FALSE;
}
-
-static void
+void
st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
GLsizei width, GLsizei height,
GLint dstx, GLint dsty, GLenum type)
@@ -1947,15 +1942,6 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
pipe_resource_reference(&pt, NULL);
}
-
-
-void st_init_drawpixels_functions(struct dd_function_table *functions)
-{
- functions->DrawPixels = st_DrawPixels;
- functions->CopyPixels = st_CopyPixels;
-}
-
-
void
st_destroy_drawpix(struct st_context *st)
{
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.h b/src/mesa/state_tracker/st_cb_drawpixels.h
index 88142c3f9ab..75f712240fa 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.h
+++ b/src/mesa/state_tracker/st_cb_drawpixels.h
@@ -34,8 +34,9 @@
struct dd_function_table;
struct st_context;
+struct gl_context;
+struct gl_pixelstore_attrib;
-extern void st_init_drawpixels_functions(struct dd_function_table *functions);
extern void
st_destroy_drawpix(struct st_context *st);
@@ -50,4 +51,12 @@ st_get_drawpix_shader(const struct tgsi_token *tokens, bool use_texcoord,
extern void
st_make_passthrough_vertex_shader(struct st_context *st);
+void st_DrawPixels(struct gl_context *ctx, GLint x, GLint y,
+ GLsizei width, GLsizei height,
+ GLenum format, GLenum type,
+ const struct gl_pixelstore_attrib *unpack, const void *pixels);
+void st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
+ GLsizei width, GLsizei height,
+ GLint dstx, GLint dsty, GLenum type);
+
#endif /* ST_CB_DRAWPIXELS_H */
diff --git a/src/mesa/state_tracker/st_cb_drawpixels_shader.c b/src/mesa/state_tracker/st_cb_drawpixels_shader.c
index 83dcfeab4da..bcd9874a869 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels_shader.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels_shader.c
@@ -26,6 +26,7 @@
*
**************************************************************************/
+#include "main/macros.h"
#include "st_cb_drawpixels.h"
#include "tgsi/tgsi_transform.h"
#include "tgsi/tgsi_scan.h"
diff --git a/src/mesa/state_tracker/st_cb_rasterpos.c b/src/mesa/state_tracker/st_cb_rasterpos.c
index 39a7107886e..4319b3a3c94 100644
--- a/src/mesa/state_tracker/st_cb_rasterpos.c
+++ b/src/mesa/state_tracker/st_cb_rasterpos.c
@@ -216,7 +216,7 @@ new_draw_rastpos_stage(struct gl_context *ctx, struct draw_context *draw)
}
-static void
+void
st_RasterPos(struct gl_context *ctx, const GLfloat v[4])
{
struct st_context *st = st_context(ctx);
@@ -276,10 +276,3 @@ st_RasterPos(struct gl_context *ctx, const GLfloat v[4])
draw_set_rasterize_stage(draw, st->selection_stage);
}
}
-
-
-
-void st_init_rasterpos_functions(struct dd_function_table *functions)
-{
- functions->RasterPos = st_RasterPos;
-}
diff --git a/src/mesa/state_tracker/st_cb_rasterpos.h b/src/mesa/state_tracker/st_cb_rasterpos.h
index f8cd1cf0aaa..8a8f8f9ddfd 100644
--- a/src/mesa/state_tracker/st_cb_rasterpos.h
+++ b/src/mesa/state_tracker/st_cb_rasterpos.h
@@ -28,10 +28,6 @@
#ifndef ST_CB_RASTERPOS_H
#define ST_CB_RASTERPOS_H
-
-struct dd_function_table;
-
-extern void st_init_rasterpos_functions(struct dd_function_table *functions);
-
+void st_RasterPos(struct gl_context *ctx, const GLfloat v[4]);
#endif /* ST_CB_RASTERPOS_H */
diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c
index aed41ce32a6..120abee8aa3 100644
--- a/src/mesa/state_tracker/st_cb_readpixels.c
+++ b/src/mesa/state_tracker/st_cb_readpixels.c
@@ -408,7 +408,7 @@ try_cached_readpixels(struct st_context *st, struct st_renderbuffer *strb,
* texture layouts during texture uploads/downloads, so the blit
* we do here should be free in such cases.
*/
-static void
+void
st_ReadPixels(struct gl_context *ctx, GLint x, GLint y,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
@@ -566,8 +566,3 @@ st_ReadPixels(struct gl_context *ctx, GLint x, GLint y,
fallback:
_mesa_readpixels(ctx, x, y, width, height, format, type, pack, pixels);
}
-
-void st_init_readpixels_functions(struct dd_function_table *functions)
-{
- functions->ReadPixels = st_ReadPixels;
-}
diff --git a/src/mesa/state_tracker/st_cb_readpixels.h b/src/mesa/state_tracker/st_cb_readpixels.h
index 14ec36c0ab3..1ba9424e0de 100644
--- a/src/mesa/state_tracker/st_cb_readpixels.h
+++ b/src/mesa/state_tracker/st_cb_readpixels.h
@@ -31,10 +31,11 @@
#include "main/glheader.h"
-struct dd_function_table;
-
-extern void
-st_init_readpixels_functions(struct dd_function_table *functions);
-
+void
+st_ReadPixels(struct gl_context *ctx, GLint x, GLint y,
+ GLsizei width, GLsizei height,
+ GLenum format, GLenum type,
+ const struct gl_pixelstore_attrib *pack,
+ void *pixels);
#endif /* ST_CB_READPIXELS_H */
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 49f499e51c5..e3e2c74150f 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -50,7 +50,6 @@
#include "st_cb_condrender.h"
#include "st_cb_copyimage.h"
#include "st_cb_drawpixels.h"
-#include "st_cb_rasterpos.h"
#include "st_cb_drawtex.h"
#include "st_cb_eglimage.h"
#include "st_cb_feedback.h"
@@ -59,7 +58,6 @@
#include "st_cb_perfquery.h"
#include "st_cb_program.h"
#include "st_cb_queryobj.h"
-#include "st_cb_readpixels.h"
#include "st_cb_flush.h"
#include "st_cb_viewport.h"
#include "st_atom.h"
@@ -930,10 +928,7 @@ st_init_driver_functions(struct pipe_screen *screen,
st_init_draw_functions(screen, functions);
st_init_blit_functions(functions);
st_init_bufferobject_functions(screen, functions);
- st_init_bitmap_functions(functions);
st_init_copy_image_functions(functions);
- st_init_drawpixels_functions(functions);
- st_init_rasterpos_functions(functions);
st_init_drawtex_functions(functions);
@@ -941,7 +936,6 @@ st_init_driver_functions(struct pipe_screen *screen,
st_init_msaa_functions(functions);
st_init_program_functions(functions);
- st_init_readpixels_functions(functions);
st_init_flush_functions(screen, functions);
st_init_viewport_functions(functions);
st_init_compute_functions(functions);