[Mesa-dev] [PATCH 61/84] st/nine: Use nine_context_clear_render_target
Axel Davy
axel.davy at ens.fr
Wed Dec 7 22:55:34 UTC 2016
Enables to not wait for the worker thread for ColorFill.
Signed-off-by: Axel Davy <axel.davy at ens.fr>
---
src/gallium/state_trackers/nine/device9.c | 7 +------
src/gallium/state_trackers/nine/nine_state.c | 17 +++++++++++++++++
src/gallium/state_trackers/nine/nine_state.h | 9 +++++++++
src/gallium/state_trackers/nine/surface9.c | 11 ++---------
4 files changed, 29 insertions(+), 15 deletions(-)
diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c
index d5a2aed..bb3ad9b 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -1752,11 +1752,8 @@ NineDevice9_ColorFill( struct NineDevice9 *This,
const RECT *pRect,
D3DCOLOR color )
{
- struct pipe_context *pipe = NineDevice9_GetPipe(This);
struct NineSurface9 *surf = NineSurface9(pSurface);
- struct pipe_surface *psurf;
unsigned x, y, w, h;
- union pipe_color_union rgba;
DBG("This=%p pSurface=%p pRect=%p color=%08x\n", This,
pSurface, pRect, color);
@@ -1790,11 +1787,9 @@ NineDevice9_ColorFill( struct NineDevice9 *This,
w = surf->desc.Width;
h = surf->desc.Height;
}
- d3dcolor_to_pipe_color_union(&rgba, color);
if (surf->base.info.bind & PIPE_BIND_RENDER_TARGET) {
- psurf = NineSurface9_GetSurface(surf, 0);
- pipe->clear_render_target(pipe, psurf, &rgba, x, y, w, h, false);
+ nine_context_clear_render_target(This, surf, color, x, y, w, h);
} else {
D3DLOCKED_RECT lock;
union util_color uc;
diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c
index 4783599..265fde8 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -2679,6 +2679,23 @@ CSMT_ITEM_NO_WAIT(nine_context_blit,
context->pipe->blit(context->pipe, blit);
}
+CSMT_ITEM_NO_WAIT(nine_context_clear_render_target,
+ ARG_BIND_REF(struct NineSurface9, surface),
+ ARG_VAL(D3DCOLOR, color),
+ ARG_VAL(UINT, x),
+ ARG_VAL(UINT, y),
+ ARG_VAL(UINT, width),
+ ARG_VAL(UINT, height))
+{
+ struct nine_context *context = &device->context;
+ struct pipe_surface *surf;
+ union pipe_color_union rgba;
+
+ d3dcolor_to_pipe_color_union(&rgba, color);
+ surf = NineSurface9_GetSurface(surface, 0);
+ context->pipe->clear_render_target(context->pipe, surf, &rgba, x, y, width, height, false);
+}
+
struct pipe_query *
nine_context_create_query(struct NineDevice9 *device, unsigned query_type)
{
diff --git a/src/gallium/state_trackers/nine/nine_state.h b/src/gallium/state_trackers/nine/nine_state.h
index 912395d..421f8f9 100644
--- a/src/gallium/state_trackers/nine/nine_state.h
+++ b/src/gallium/state_trackers/nine/nine_state.h
@@ -530,6 +530,15 @@ void
nine_context_blit(struct NineDevice9 *device,
struct pipe_blit_info *blit);
+void
+nine_context_clear_render_target(struct NineDevice9 *device,
+ struct NineSurface9 *surface,
+ D3DCOLOR color,
+ UINT x,
+ UINT y,
+ UINT width,
+ UINT height);
+
struct pipe_query *
nine_context_create_query(struct NineDevice9 *device, unsigned query_type);
diff --git a/src/gallium/state_trackers/nine/surface9.c b/src/gallium/state_trackers/nine/surface9.c
index ca9fd55..6373f69 100644
--- a/src/gallium/state_trackers/nine/surface9.c
+++ b/src/gallium/state_trackers/nine/surface9.c
@@ -55,9 +55,6 @@ NineSurface9_ctor( struct NineSurface9 *This,
D3DSURFACE_DESC *pDesc )
{
HRESULT hr;
- union pipe_color_union rgba = {0};
- struct pipe_surface *surf;
- struct pipe_context *pipe;
bool allocate = !pContainer && pDesc->Format != D3DFMT_NULL;
D3DMULTISAMPLE_TYPE multisample_type;
@@ -192,12 +189,8 @@ NineSurface9_ctor( struct NineSurface9 *This,
}
/* TODO: investigate what else exactly needs to be cleared */
- if (This->base.resource && (pDesc->Usage & D3DUSAGE_RENDERTARGET)) {
- surf = NineSurface9_GetSurface(This, 0);
- pipe = nine_context_get_pipe_acquire(pParams->device);
- pipe->clear_render_target(pipe, surf, &rgba, 0, 0, pDesc->Width, pDesc->Height, false);
- nine_context_get_pipe_release(pParams->device);
- }
+ if (This->base.resource && (pDesc->Usage & D3DUSAGE_RENDERTARGET))
+ nine_context_clear_render_target(pParams->device, This, 0, 0, 0, pDesc->Width, pDesc->Height);
NineSurface9_Dump(This);
--
2.10.2
More information about the mesa-dev
mailing list