[Libva] [PATCH] dri: Update region's width/height on every PutSurface
Chris Wilson
chris at chris-wilson.co.uk
Tue Feb 3 08:59:54 PST 2015
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 at chris-wilson.co.uk>
Cc: Gwenole Beauchesne <gwenole.beauchesne at intel.com>
Cc: Dmitry Ermilov <dmitry.ermilov at intel.com>
---
src/i965_output_dri.c | 30 ++++++++++++++----------------
1 file changed, 14 insertions(+), 16 deletions(-)
diff --git a/src/i965_output_dri.c b/src/i965_output_dri.c
index 9bba333..d36fec5 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;
--
2.1.4
More information about the Libva
mailing list