diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2015-02-03 16:59:54 +0000 |
---|---|---|
committer | Xiang, Haihao <haihao.xiang@intel.com> | 2015-02-04 11:06:57 +0800 |
commit | 31ca7cfd23045f9702780032ec9b30209a2e7fee (patch) | |
tree | 16f9fd470a01df0c74ad6949b099b026b0fb1c29 /src/i965_output_dri.c | |
parent | a83bf50faa7b2c65e4ee5a4e8e58ac7a999f862e (diff) | |
download | libva-intel-driver-31ca7cfd23045f9702780032ec9b30209a2e7fee.tar.gz |
dri: Update region's width/height on every PutSurface
Currently we expect that if a surface changes size, we will be given a
new buffer with a new name. This is not always true as the ddx may try
to keep the same buffer for the client if it is large enough for the new
size. Since we always know the width/height of the buffer, we can pass
that information along every time into the intel_region struct.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Cc: Dmitry Ermilov <dmitry.ermilov@intel.com>
Reviewed-by: Sean V Kelley <seanvk@posteo.de>
Tested-by: Sean V Kelley <seanvk@posteo.de>
Diffstat (limited to 'src/i965_output_dri.c')
-rw-r--r-- | src/i965_output_dri.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/src/i965_output_dri.c b/src/i965_output_dri.c index 9bba3330..d36fec5b 100644 --- a/src/i965_output_dri.c +++ b/src/i965_output_dri.c @@ -123,7 +123,6 @@ i965_put_surface_dri( union dri_buffer *buffer; struct intel_region *dest_region; struct object_surface *obj_surface; - bool new_region = false; uint32_t name; int i, ret; @@ -146,27 +145,21 @@ i965_put_surface_dri( assert(buffer); dest_region = render_state->draw_region; + if (dest_region == NULL) { + dest_region = (struct intel_region *)calloc(1, sizeof(*dest_region)); + assert(dest_region); + render_state->draw_region = dest_region; + } - if (dest_region) { - assert(dest_region->bo); + if (dest_region->bo) { dri_bo_flink(dest_region->bo, &name); - if (buffer->dri2.name != name) { - new_region = True; dri_bo_unreference(dest_region->bo); - } - } else { - dest_region = (struct intel_region *)calloc(1, sizeof(*dest_region)); - assert(dest_region); - render_state->draw_region = dest_region; - new_region = True; + dest_region->bo = NULL; + } } - if (new_region) { - dest_region->x = dri_drawable->x; - dest_region->y = dri_drawable->y; - dest_region->width = dri_drawable->width; - dest_region->height = dri_drawable->height; + if (dest_region->bo == NULL) { dest_region->cpp = buffer->dri2.cpp; dest_region->pitch = buffer->dri2.pitch; @@ -177,6 +170,11 @@ i965_put_surface_dri( assert(ret == 0); } + dest_region->x = dri_drawable->x; + dest_region->y = dri_drawable->y; + dest_region->width = dri_drawable->width; + dest_region->height = dri_drawable->height; + if (!(flags & VA_SRC_COLOR_MASK)) flags |= VA_SRC_BT601; |