[Mesa-dev] [PATCH 3/4] gallium/swrast: rename "resource_create_front" method
Karl Lessard
karl at kubx.ca
Sat Jan 21 04:33:17 UTC 2017
Rename pipe_screen "resource_create_front" method to "resource_create2"
since it is not only invoked for front buffer creation (I'm not a big
fan of the '2' suffix but nothing else came up to my mind...)
Signed-off-by: Karl Lessard <karl at kubx.ca>
---
src/gallium/drivers/llvmpipe/lp_texture.c | 19 ++++++++++---------
src/gallium/drivers/softpipe/sp_texture.c | 16 ++++++++--------
src/gallium/include/pipe/p_screen.h | 12 ++++++++----
src/gallium/state_trackers/dri/drisw.c | 4 ++--
4 files changed, 28 insertions(+), 23 deletions(-)
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c
index 9dfff77..99122eb 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.c
+++ b/src/gallium/drivers/llvmpipe/lp_texture.c
@@ -201,7 +201,7 @@ llvmpipe_can_create_resource(struct pipe_screen *screen,
static boolean
llvmpipe_displaytarget_layout(struct llvmpipe_screen *screen,
struct llvmpipe_resource *lpr,
- const void *map_front_private)
+ const void *winsys_private)
{
struct sw_winsys *winsys = screen->winsys;
@@ -216,13 +216,13 @@ llvmpipe_displaytarget_layout(struct llvmpipe_screen *screen,
lpr->base.format,
width, height,
64,
- map_front_private,
+ winsys_private,
&lpr->row_stride[0] );
if (lpr->dt == NULL)
return FALSE;
- if (!map_front_private) {
+ if (!winsys_private) {
void *map = winsys->displaytarget_map(winsys, lpr->dt,
PIPE_TRANSFER_WRITE);
@@ -237,9 +237,9 @@ llvmpipe_displaytarget_layout(struct llvmpipe_screen *screen,
static struct pipe_resource *
-llvmpipe_resource_create_front(struct pipe_screen *_screen,
- const struct pipe_resource *templat,
- const void *map_front_private)
+llvmpipe_resource_create2(struct pipe_screen *_screen,
+ const struct pipe_resource *templat,
+ const void *winsys_private)
{
struct llvmpipe_screen *screen = llvmpipe_screen(_screen);
struct llvmpipe_resource *lpr = CALLOC_STRUCT(llvmpipe_resource);
@@ -257,7 +257,7 @@ llvmpipe_resource_create_front(struct pipe_screen *_screen,
PIPE_BIND_SCANOUT |
PIPE_BIND_SHARED)) {
/* displayable surface */
- if (!llvmpipe_displaytarget_layout(screen, lpr, map_front_private))
+ if (!llvmpipe_displaytarget_layout(screen, lpr, winsys_private))
goto fail;
}
else {
@@ -303,11 +303,12 @@ llvmpipe_resource_create_front(struct pipe_screen *_screen,
FREE(lpr);
return NULL;
}
+
static struct pipe_resource *
llvmpipe_resource_create(struct pipe_screen *_screen,
const struct pipe_resource *templat)
{
- return llvmpipe_resource_create_front(_screen, templat, NULL);
+ return llvmpipe_resource_create2(_screen, templat, NULL);
}
static void
@@ -802,7 +803,7 @@ llvmpipe_init_screen_resource_funcs(struct pipe_screen *screen)
#endif
screen->resource_create = llvmpipe_resource_create;
- screen->resource_create_front = llvmpipe_resource_create_front;
+ screen->resource_create2 = llvmpipe_resource_create2;
screen->resource_destroy = llvmpipe_resource_destroy;
screen->resource_from_handle = llvmpipe_resource_from_handle;
screen->resource_get_handle = llvmpipe_resource_get_handle;
diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c
index 8dca158..57ccb0e 100644
--- a/src/gallium/drivers/softpipe/sp_texture.c
+++ b/src/gallium/drivers/softpipe/sp_texture.c
@@ -128,7 +128,7 @@ softpipe_can_create_resource(struct pipe_screen *screen,
static boolean
softpipe_displaytarget_layout(struct pipe_screen *screen,
struct softpipe_resource *spr,
- const void *map_front_private)
+ const void *winsys_private)
{
struct sw_winsys *winsys = softpipe_screen(screen)->winsys;
@@ -140,7 +140,7 @@ softpipe_displaytarget_layout(struct pipe_screen *screen,
spr->base.width0,
spr->base.height0,
64,
- map_front_private,
+ winsys_private,
&spr->stride[0] );
return spr->dt != NULL;
@@ -151,9 +151,9 @@ softpipe_displaytarget_layout(struct pipe_screen *screen,
* Create new pipe_resource given the template information.
*/
static struct pipe_resource *
-softpipe_resource_create_front(struct pipe_screen *screen,
- const struct pipe_resource *templat,
- const void *map_front_private)
+softpipe_resource_create2(struct pipe_screen *screen,
+ const struct pipe_resource *templat,
+ const void *winsys_private)
{
struct softpipe_resource *spr = CALLOC_STRUCT(softpipe_resource);
if (!spr)
@@ -172,7 +172,7 @@ softpipe_resource_create_front(struct pipe_screen *screen,
if (spr->base.bind & (PIPE_BIND_DISPLAY_TARGET |
PIPE_BIND_SCANOUT |
PIPE_BIND_SHARED)) {
- if (!softpipe_displaytarget_layout(screen, spr, map_front_private))
+ if (!softpipe_displaytarget_layout(screen, spr, winsys_private))
goto fail;
}
else {
@@ -191,7 +191,7 @@ static struct pipe_resource *
softpipe_resource_create(struct pipe_screen *screen,
const struct pipe_resource *templat)
{
- return softpipe_resource_create_front(screen, templat, NULL);
+ return softpipe_resource_create2(screen, templat, NULL);
}
static void
@@ -527,7 +527,7 @@ void
softpipe_init_screen_texture_funcs(struct pipe_screen *screen)
{
screen->resource_create = softpipe_resource_create;
- screen->resource_create_front = softpipe_resource_create_front;
+ screen->resource_create2 = softpipe_resource_create2;
screen->resource_destroy = softpipe_resource_destroy;
screen->resource_from_handle = softpipe_resource_from_handle;
screen->resource_get_handle = softpipe_resource_get_handle;
diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h
index b6203f1..27c51d7 100644
--- a/src/gallium/include/pipe/p_screen.h
+++ b/src/gallium/include/pipe/p_screen.h
@@ -171,11 +171,15 @@ struct pipe_screen {
* Create a new texture object, using the given template info.
*/
struct pipe_resource * (*resource_create)(struct pipe_screen *,
- const struct pipe_resource *templat);
+ const struct pipe_resource *templat);
- struct pipe_resource * (*resource_create_front)(struct pipe_screen *,
- const struct pipe_resource *templat,
- const void *map_front_private);
+ /**
+ * A variant of (*resource_create) where a private object destined to the
+ * underlying window system could also be passed.
+ */
+ struct pipe_resource * (*resource_create2)(struct pipe_screen *,
+ const struct pipe_resource *templat,
+ const void *winsys_private);
/**
* Create a texture from a winsys_handle. The handle is often created in
diff --git a/src/gallium/state_trackers/dri/drisw.c b/src/gallium/state_trackers/dri/drisw.c
index 072ba07..61987a1 100644
--- a/src/gallium/state_trackers/dri/drisw.c
+++ b/src/gallium/state_trackers/dri/drisw.c
@@ -315,9 +315,9 @@ drisw_allocate_textures(struct dri_context *stctx,
templ.format = format;
templ.bind = bind;
- if (pscreen->resource_create_front) {
+ if (pscreen->resource_create2) {
drawable->textures[statts[i]] =
- pscreen->resource_create_front(pscreen, &templ, (const void *)drawable->drisw_reference);
+ pscreen->resource_create2(pscreen, &templ, (const void *)drawable->drisw_reference);
} else {
drawable->textures[statts[i]] =
--
2.7.4
More information about the mesa-dev
mailing list