commit 3a508b1

Michael Forney  ·  2013-11-20 10:09:22 +0000 UTC
parent b04381c
intel: Adapt to libintelbatch changes
1 files changed,  +26, -13
+26, -13
  1@@ -25,16 +25,14 @@
  2 #include "wld-private.h"
  3 
  4 #include <unistd.h>
  5-#include <intelbatch/batch.h>
  6-#include <intelbatch/blt.h>
  7-#include <intelbatch/mi.h>
  8+#include <intelbatch.h>
  9 #include <intel_bufmgr.h>
 10 #include <i915_drm.h>
 11 
 12 struct intel_context
 13 {
 14     drm_intel_bufmgr * bufmgr;
 15-    struct intel_batch batch;
 16+    struct intel_batch * batch;
 17 };
 18 
 19 struct intel_drawable
 20@@ -120,16 +118,31 @@ struct intel_context * intel_create_context(int drm_fd)
 21     context = malloc(sizeof *context);
 22 
 23     if (!context)
 24-        return NULL;
 25+        goto error0;
 26 
 27     context->bufmgr = drm_intel_bufmgr_gem_init(drm_fd, INTEL_BATCH_SIZE);
 28-    intel_batch_initialize(&context->batch, context->bufmgr);
 29+
 30+    if (!context->bufmgr)
 31+        goto error1;
 32+
 33+    context->batch = intel_batch_new(context->bufmgr);
 34+
 35+    if (!context->batch)
 36+        goto error2;
 37 
 38     return context;
 39+
 40+  error2:
 41+    drm_intel_bufmgr_destroy(context->bufmgr);
 42+  error1:
 43+    free(context);
 44+  error0:
 45+    return NULL;
 46 }
 47 
 48 void intel_destroy_context(struct intel_context * context)
 49 {
 50+    intel_batch_destroy(context->batch);
 51     drm_intel_bufmgr_destroy(context->bufmgr);
 52     free(context);
 53 }
 54@@ -210,7 +223,7 @@ void intel_fill_rectangle(struct wld_drawable * drawable, uint32_t color,
 55 {
 56     struct intel_drawable * intel = (void *) drawable;
 57 
 58-    xy_color_blt(&intel->context->batch, intel->bo, intel->base.pitch,
 59+    xy_color_blt(intel->context->batch, intel->bo, intel->base.pitch,
 60                  x, y, x + width, y + height, color);
 61 }
 62 
 63@@ -223,7 +236,7 @@ void intel_copy_rectangle(struct wld_drawable * src_drawable,
 64     struct intel_drawable * src = (void *) src_drawable;
 65     struct intel_drawable * dst = (void *) dst_drawable;
 66 
 67-    xy_src_copy_blt(&dst->context->batch,
 68+    xy_src_copy_blt(dst->context->batch,
 69                     src->bo, src->base.pitch, src_x, src_y,
 70                     dst->bo, dst->base.pitch, dst_x, dst_y, width, height);
 71 }
 72@@ -245,7 +258,7 @@ void intel_draw_text_utf8(struct wld_drawable * drawable,
 73     uint8_t byte_index;
 74     int32_t origin_x = x;
 75 
 76-    xy_setup_blt(&intel->context->batch, true, INTEL_BLT_RASTER_OPERATION_SRC,
 77+    xy_setup_blt(intel->context->batch, true, INTEL_BLT_RASTER_OPERATION_SRC,
 78                  0, color, intel->bo, intel->base.pitch);
 79 
 80     while ((ret = FcUtf8ToUcs4((FcChar8 *) text, &c, length)) > 0 && c != '\0')
 81@@ -273,7 +286,7 @@ void intel_draw_text_utf8(struct wld_drawable * drawable,
 82         }
 83 
 84       retry:
 85-        ret = xy_text_immediate_blt(&intel->context->batch, intel->bo,
 86+        ret = xy_text_immediate_blt(intel->context->batch, intel->bo,
 87                                     origin_x + glyph->x, y + glyph->y,
 88                                     origin_x + glyph->x + glyph->bitmap.width,
 89                                     y + glyph->y + glyph->bitmap.rows,
 90@@ -282,8 +295,8 @@ void intel_draw_text_utf8(struct wld_drawable * drawable,
 91 
 92         if (ret == INTEL_BATCH_NO_SPACE)
 93         {
 94-            intel_batch_flush(&intel->context->batch);
 95-            xy_setup_blt(&intel->context->batch, true,
 96+            intel_batch_flush(intel->context->batch);
 97+            xy_setup_blt(intel->context->batch, true,
 98                          INTEL_BLT_RASTER_OPERATION_SRC, 0, color,
 99                          intel->bo, intel->base.pitch);
100             goto retry;
101@@ -335,7 +348,7 @@ void intel_flush(struct wld_drawable * drawable)
102 {
103     struct intel_drawable * intel = (void *) drawable;
104 
105-    intel_batch_flush(&intel->context->batch);
106+    intel_batch_flush(intel->context->batch);
107 }
108 
109 void intel_destroy(struct wld_drawable * drawable)