Rename batch->op in skiaserve

Change-Id: Ib831b9a6bcf4f37c0f077b26f68b1cefef81bb73
Reviewed-on: https://skia-review.googlesource.com/6351
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Brian Salomon 2016-12-20 16:48:59 -05:00 committed by Skia Commit-Bot
parent f4e27f68b0
commit 144a5c518a
9 changed files with 51 additions and 55 deletions

View File

@ -1205,8 +1205,6 @@ if (skia_enable_tools) {
"tools/skiaserve/Request.cpp",
"tools/skiaserve/Response.cpp",
"tools/skiaserve/skiaserve.cpp",
"tools/skiaserve/urlhandlers/BatchBoundsHandler.cpp",
"tools/skiaserve/urlhandlers/BatchesHandler.cpp",
"tools/skiaserve/urlhandlers/BreakHandler.cpp",
"tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
"tools/skiaserve/urlhandlers/CmdHandler.cpp",
@ -1216,6 +1214,8 @@ if (skia_enable_tools) {
"tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
"tools/skiaserve/urlhandlers/ImgHandler.cpp",
"tools/skiaserve/urlhandlers/InfoHandler.cpp",
"tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
"tools/skiaserve/urlhandlers/OpsHandler.cpp",
"tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
"tools/skiaserve/urlhandlers/PostHandler.cpp",
"tools/skiaserve/urlhandlers/QuitHandler.cpp",

View File

@ -86,7 +86,7 @@ SkDebugCanvas::SkDebugCanvas(int width, int height)
, fOverrideFilterQuality(false)
, fFilterQuality(kNone_SkFilterQuality)
, fClipVizColor(SK_ColorTRANSPARENT)
, fDrawGpuBatchBounds(false) {
, fDrawGpuOpBounds(false) {
fUserMatrix.reset();
// SkPicturePlayback uses the base-class' quickReject calls to cull clipped
@ -233,9 +233,9 @@ void SkDebugCanvas::drawTo(SkCanvas* canvas, int index, int m) {
}
#if SK_SUPPORT_GPU
// If we have a GPU backend we can also visualize the batching information
// If we have a GPU backend we can also visualize the op information
GrAuditTrail* at = nullptr;
if (fDrawGpuBatchBounds || m != -1) {
if (fDrawGpuOpBounds || m != -1) {
at = this->getAuditTrail(canvas);
}
#endif
@ -246,7 +246,7 @@ void SkDebugCanvas::drawTo(SkCanvas* canvas, int index, int m) {
}
#if SK_SUPPORT_GPU
// We need to flush any pending operations, or they might batch with commands below.
// We need to flush any pending operations, or they might combine with commands below.
// Previous operations were not registered with the audit trail when they were
// created, so if we allow them to combine, the audit trail will fail to find them.
canvas->flush();
@ -334,7 +334,7 @@ void SkDebugCanvas::drawTo(SkCanvas* canvas, int index, int m) {
canvas->restoreToCount(saveCount);
#if SK_SUPPORT_GPU
// draw any batches if required and issue a full reset onto GrAuditTrail
// draw any ops if required and issue a full reset onto GrAuditTrail
if (at) {
// just in case there is global reordering, we flush the canvas before querying
// GrAuditTrail
@ -343,10 +343,10 @@ void SkDebugCanvas::drawTo(SkCanvas* canvas, int index, int m) {
// we pick three colorblind-safe colors, 75% alpha
static const SkColor kTotalBounds = SkColorSetARGB(0xC0, 0x6A, 0x3D, 0x9A);
static const SkColor kOpBatchBounds = SkColorSetARGB(0xC0, 0xE3, 0x1A, 0x1C);
static const SkColor kOtherBatchBounds = SkColorSetARGB(0xC0, 0xFF, 0x7F, 0x00);
static const SkColor kCommandOpBounds = SkColorSetARGB(0xC0, 0xE3, 0x1A, 0x1C);
static const SkColor kOtherOpBounds = SkColorSetARGB(0xC0, 0xFF, 0x7F, 0x00);
// get the render target of the top device so we can ignore batches drawn offscreen
// get the render target of the top device so we can ignore ops drawn offscreen
GrRenderTargetContext* rtc = canvas->internal_private_accessTopLayerRenderTargetContext();
GrGpuResource::UniqueID rtID = rtc->accessRenderTarget()->uniqueID();
@ -355,7 +355,7 @@ void SkDebugCanvas::drawTo(SkCanvas* canvas, int index, int m) {
if (m == -1) {
at->getBoundsByClientID(&childrenBounds, index);
} else {
// the client wants us to draw the mth batch
// the client wants us to draw the mth op
at->getBoundsByOpListID(&childrenBounds.push_back(), m);
}
SkPaint paint;
@ -369,13 +369,13 @@ void SkDebugCanvas::drawTo(SkCanvas* canvas, int index, int m) {
paint.setColor(kTotalBounds);
canvas->drawRect(childrenBounds[i].fBounds, paint);
for (int j = 0; j < childrenBounds[i].fOps.count(); j++) {
const GrAuditTrail::OpInfo::Op& batch = childrenBounds[i].fOps[j];
if (batch.fClientID != index) {
paint.setColor(kOtherBatchBounds);
const GrAuditTrail::OpInfo::Op& op = childrenBounds[i].fOps[j];
if (op.fClientID != index) {
paint.setColor(kOtherOpBounds);
} else {
paint.setColor(kOpBatchBounds);
paint.setColor(kCommandOpBounds);
}
canvas->drawRect(batch.fBounds, paint);
canvas->drawRect(op.fBounds, paint);
}
}
}
@ -429,7 +429,7 @@ GrAuditTrail* SkDebugCanvas::getAuditTrail(SkCanvas* canvas) {
return at;
}
void SkDebugCanvas::drawAndCollectBatches(int n, SkCanvas* canvas) {
void SkDebugCanvas::drawAndCollectOps(int n, SkCanvas* canvas) {
#if SK_SUPPORT_GPU
GrAuditTrail* at = this->getAuditTrail(canvas);
if (at) {
@ -460,7 +460,7 @@ void SkDebugCanvas::cleanupAuditTrail(SkCanvas* canvas) {
}
Json::Value SkDebugCanvas::toJSON(UrlDataManager& urlDataManager, int n, SkCanvas* canvas) {
this->drawAndCollectBatches(n, canvas);
this->drawAndCollectOps(n, canvas);
// now collect json
#if SK_SUPPORT_GPU
@ -488,8 +488,8 @@ Json::Value SkDebugCanvas::toJSON(UrlDataManager& urlDataManager, int n, SkCanva
return result;
}
Json::Value SkDebugCanvas::toJSONBatchList(int n, SkCanvas* canvas) {
this->drawAndCollectBatches(n, canvas);
Json::Value SkDebugCanvas::toJSONOpList(int n, SkCanvas* canvas) {
this->drawAndCollectOps(n, canvas);
Json::Value parsedFromString;
#if SK_SUPPORT_GPU

View File

@ -47,11 +47,9 @@ public:
SkColor getClipVizColor() const { return fClipVizColor; }
void setDrawGpuBatchBounds(bool drawGpuBatchBounds) {
fDrawGpuBatchBounds = drawGpuBatchBounds;
}
void setDrawGpuOpBounds(bool drawGpuOpBounds) { fDrawGpuOpBounds = drawGpuOpBounds; }
bool getDrawGpuBatchBounds() const { return fDrawGpuBatchBounds; }
bool getDrawGpuOpBounds() const { return fDrawGpuOpBounds; }
bool getAllowSimplifyClip() const { return fAllowSimplifyClip; }
@ -72,7 +70,7 @@ public:
Executes the draw calls up to the specified index.
@param canvas The canvas being drawn to
@param index The index of the final command being executed
@param m an optional Mth gpu batch to highlight, or -1
@param m an optional Mth gpu op to highlight, or -1
*/
void drawTo(SkCanvas *canvas, int index, int m = -1);
@ -164,11 +162,11 @@ public:
*/
Json::Value toJSON(UrlDataManager &urlDataManager, int n, SkCanvas *);
Json::Value toJSONBatchList(int n, SkCanvas *);
Json::Value toJSONOpList(int n, SkCanvas*);
////////////////////////////////////////////////////////////////////////////////
// Inherited from SkCanvas
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// Inherited from SkCanvas
////////////////////////////////////////////////////////////////////////////////
static const int kVizImageHeight = 256;
static const int kVizImageWidth = 256;
@ -286,7 +284,7 @@ private:
bool fOverrideFilterQuality;
SkFilterQuality fFilterQuality;
SkColor fClipVizColor;
bool fDrawGpuBatchBounds;
bool fDrawGpuOpBounds;
/**
The active saveLayer commands at a given point in the renderering.
@ -318,7 +316,7 @@ private:
GrAuditTrail* getAuditTrail(SkCanvas*);
void drawAndCollectBatches(int n, SkCanvas*);
void drawAndCollectOps(int n, SkCanvas*);
void cleanupAuditTrail(SkCanvas*);
typedef SkCanvas INHERITED;

View File

@ -259,7 +259,7 @@ sk_sp<SkData> Request::getJsonOps(int n) {
SkCanvas* canvas = this->getCanvas();
Json::Value root = fDebugCanvas->toJSON(fUrlDataManager, n, canvas);
root["mode"] = Json::Value(fGPUEnabled ? "gpu" : "cpu");
root["drawGpuBatchBounds"] = Json::Value(fDebugCanvas->getDrawGpuBatchBounds());
root["drawGpuBatchBounds"] = Json::Value(fDebugCanvas->getDrawGpuOpBounds());
root["colorMode"] = Json::Value(fColorMode);
SkDynamicMemoryWStream stream;
stream.writeText(Json::FastWriter().write(root).c_str());
@ -267,11 +267,11 @@ sk_sp<SkData> Request::getJsonOps(int n) {
return stream.detachAsData();
}
sk_sp<SkData> Request::getJsonBatchList(int n) {
sk_sp<SkData> Request::getJsonOpList(int n) {
SkCanvas* canvas = this->getCanvas();
SkASSERT(fGPUEnabled);
Json::Value result = fDebugCanvas->toJSONBatchList(n, canvas);
Json::Value result = fDebugCanvas->toJSONOpList(n, canvas);
SkDynamicMemoryWStream stream;
stream.writeText(Json::FastWriter().write(result).c_str());

View File

@ -37,7 +37,7 @@ struct Request {
Request(SkString rootUrl);
~Request();
// draws to skia draw op N, highlighting the Mth batch(-1 means no highlight)
// draws to canvas operation N, highlighting the Mth GrOp. m = -1 means no highlight.
sk_sp<SkData> drawToPng(int n, int m = -1);
sk_sp<SkData> writeOutSkp();
SkCanvas* getCanvas();
@ -53,8 +53,8 @@ struct Request {
// Returns the json list of ops as an SkData
sk_sp<SkData> getJsonOps(int n);
// Returns a json list of batches as an SkData
sk_sp<SkData> getJsonBatchList(int n);
// Returns a json list of ops as an SkData
sk_sp<SkData> getJsonOpList(int n);
// Returns json with the viewMatrix and clipRect
sk_sp<SkData> getJsonInfo(int n);

View File

@ -42,8 +42,8 @@ public:
fHandlers.push_back(new DownloadHandler);
fHandlers.push_back(new DataHandler);
fHandlers.push_back(new BreakHandler);
fHandlers.push_back(new BatchesHandler);
fHandlers.push_back(new BatchBoundsHandler);
fHandlers.push_back(new OpsHandler);
fHandlers.push_back(new OpBoundsHandler);
fHandlers.push_back(new ColorModeHandler);
fHandlers.push_back(new QuitHandler);
}

View File

@ -7,21 +7,20 @@
#include "UrlHandler.h"
#include "microhttpd.h"
#include "../Request.h"
#include "../Response.h"
#include "microhttpd.h"
using namespace Response;
bool BatchBoundsHandler::canHandle(const char* method, const char* url) {
bool OpBoundsHandler::canHandle(const char* method, const char* url) {
static const char* kBasePath = "/batchBounds/";
return 0 == strcmp(method, MHD_HTTP_METHOD_POST) &&
0 == strncmp(url, kBasePath, strlen(kBasePath));
}
int BatchBoundsHandler::handle(Request* request, MHD_Connection* connection,
const char* url, const char* method,
const char* upload_data, size_t* upload_data_size) {
int OpBoundsHandler::handle(Request* request, MHD_Connection* connection, const char* url,
const char* method, const char* upload_data, size_t* upload_data_size) {
SkTArray<SkString> commands;
SkStrSplit(url, "/", &commands);
@ -32,6 +31,6 @@ int BatchBoundsHandler::handle(Request* request, MHD_Connection* connection,
int enabled;
sscanf(commands[1].c_str(), "%d", &enabled);
request->fDebugCanvas->setDrawGpuBatchBounds(SkToBool(enabled));
request->fDebugCanvas->setDrawGpuOpBounds(SkToBool(enabled));
return SendOK(connection);
}

View File

@ -7,20 +7,19 @@
#include "UrlHandler.h"
#include "microhttpd.h"
#include "../Request.h"
#include "../Response.h"
#include "microhttpd.h"
using namespace Response;
bool BatchesHandler::canHandle(const char* method, const char* url) {
bool OpsHandler::canHandle(const char* method, const char* url) {
const char* kBasePath = "/batches";
return 0 == strncmp(url, kBasePath, strlen(kBasePath));
}
int BatchesHandler::handle(Request* request, MHD_Connection* connection,
const char* url, const char* method,
const char* upload_data, size_t* upload_data_size) {
int OpsHandler::handle(Request* request, MHD_Connection* connection, const char* url,
const char* method, const char* upload_data, size_t* upload_data_size) {
SkTArray<SkString> commands;
SkStrSplit(url, "/", &commands);
@ -32,7 +31,7 @@ int BatchesHandler::handle(Request* request, MHD_Connection* connection,
if (0 == strcmp(method, MHD_HTTP_METHOD_GET)) {
int n = request->getLastOp();
sk_sp<SkData> data(request->getJsonBatchList(n));
sk_sp<SkData> data(request->getJsonOpList(n));
return SendData(connection, data.get(), "application/json");
}

View File

@ -112,9 +112,9 @@ public:
};
/*
* Returns a json descripton of all the batches in the image
* Returns a json descripton of all the GPU ops in the image
*/
class BatchesHandler : public UrlHandler {
class OpsHandler : public UrlHandler {
public:
bool canHandle(const char* method, const char* url) override;
int handle(Request* request, MHD_Connection* connection,
@ -123,9 +123,9 @@ public:
};
/*
* Enables drawing of batch bounds
* Enables drawing of gpu op bounds
*/
class BatchBoundsHandler : public UrlHandler {
class OpBoundsHandler : public UrlHandler {
public:
bool canHandle(const char* method, const char* url) override;
int handle(Request* request, MHD_Connection* connection,