Commit e40f9ee6 authored by Chris Wilson's avatar Chris Wilson

drm/i915: Remove duplicate golden render state init from execlists

Now that we use the same vfuncs for emitting the batch buffer in both
execlists and legacy, the golden render state initialisation is
identical between both.

v2: gcc wants so.ggtt_offset initialised (even though it is not used)
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1469432687-22756-28-git-send-email-chris@chris-wilson.co.uk
Link: http://patchwork.freedesktop.org/patch/msgid/1470174640-18242-19-git-send-email-chris@chris-wilson.co.uk
parent 618e4ca7
...@@ -28,6 +28,15 @@ ...@@ -28,6 +28,15 @@
#include "i915_drv.h" #include "i915_drv.h"
#include "intel_renderstate.h" #include "intel_renderstate.h"
struct render_state {
const struct intel_renderstate_rodata *rodata;
struct drm_i915_gem_object *obj;
u64 ggtt_offset;
int gen;
u32 aux_batch_size;
u32 aux_batch_offset;
};
static const struct intel_renderstate_rodata * static const struct intel_renderstate_rodata *
render_state_get_rodata(const int gen) render_state_get_rodata(const int gen)
{ {
...@@ -51,6 +60,7 @@ static int render_state_init(struct render_state *so, ...@@ -51,6 +60,7 @@ static int render_state_init(struct render_state *so,
int ret; int ret;
so->gen = INTEL_GEN(dev_priv); so->gen = INTEL_GEN(dev_priv);
so->ggtt_offset = 0; /* keep gcc quiet */
so->rodata = render_state_get_rodata(so->gen); so->rodata = render_state_get_rodata(so->gen);
if (so->rodata == NULL) if (so->rodata == NULL)
return 0; return 0;
...@@ -192,14 +202,14 @@ static int render_state_setup(struct render_state *so) ...@@ -192,14 +202,14 @@ static int render_state_setup(struct render_state *so)
#undef OUT_BATCH #undef OUT_BATCH
void i915_gem_render_state_fini(struct render_state *so) static void render_state_fini(struct render_state *so)
{ {
i915_gem_object_ggtt_unpin(so->obj); i915_gem_object_ggtt_unpin(so->obj);
i915_gem_object_put(so->obj); i915_gem_object_put(so->obj);
} }
int i915_gem_render_state_prepare(struct intel_engine_cs *engine, static int render_state_prepare(struct intel_engine_cs *engine,
struct render_state *so) struct render_state *so)
{ {
int ret; int ret;
...@@ -215,7 +225,7 @@ int i915_gem_render_state_prepare(struct intel_engine_cs *engine, ...@@ -215,7 +225,7 @@ int i915_gem_render_state_prepare(struct intel_engine_cs *engine,
ret = render_state_setup(so); ret = render_state_setup(so);
if (ret) { if (ret) {
i915_gem_render_state_fini(so); render_state_fini(so);
return ret; return ret;
} }
...@@ -227,7 +237,7 @@ int i915_gem_render_state_init(struct drm_i915_gem_request *req) ...@@ -227,7 +237,7 @@ int i915_gem_render_state_init(struct drm_i915_gem_request *req)
struct render_state so; struct render_state so;
int ret; int ret;
ret = i915_gem_render_state_prepare(req->engine, &so); ret = render_state_prepare(req->engine, &so);
if (ret) if (ret)
return ret; return ret;
...@@ -251,8 +261,7 @@ int i915_gem_render_state_init(struct drm_i915_gem_request *req) ...@@ -251,8 +261,7 @@ int i915_gem_render_state_init(struct drm_i915_gem_request *req)
} }
i915_vma_move_to_active(i915_gem_obj_to_ggtt(so.obj), req); i915_vma_move_to_active(i915_gem_obj_to_ggtt(so.obj), req);
out: out:
i915_gem_render_state_fini(&so); render_state_fini(&so);
return ret; return ret;
} }
...@@ -26,24 +26,6 @@ ...@@ -26,24 +26,6 @@
#include <linux/types.h> #include <linux/types.h>
struct intel_renderstate_rodata {
const u32 *reloc;
const u32 *batch;
const u32 batch_items;
};
struct render_state {
const struct intel_renderstate_rodata *rodata;
struct drm_i915_gem_object *obj;
u64 ggtt_offset;
int gen;
u32 aux_batch_size;
u32 aux_batch_offset;
};
int i915_gem_render_state_init(struct drm_i915_gem_request *req); int i915_gem_render_state_init(struct drm_i915_gem_request *req);
void i915_gem_render_state_fini(struct render_state *so);
int i915_gem_render_state_prepare(struct intel_engine_cs *engine,
struct render_state *so);
#endif /* _I915_GEM_RENDER_STATE_H_ */ #endif /* _I915_GEM_RENDER_STATE_H_ */
...@@ -1796,38 +1796,6 @@ static int gen8_emit_request_render(struct drm_i915_gem_request *request) ...@@ -1796,38 +1796,6 @@ static int gen8_emit_request_render(struct drm_i915_gem_request *request)
return intel_logical_ring_advance(request); return intel_logical_ring_advance(request);
} }
static int intel_lr_context_render_state_init(struct drm_i915_gem_request *req)
{
struct render_state so;
int ret;
ret = i915_gem_render_state_prepare(req->engine, &so);
if (ret)
return ret;
if (so.rodata == NULL)
return 0;
ret = req->engine->emit_bb_start(req, so.ggtt_offset,
so.rodata->batch_items * 4,
I915_DISPATCH_SECURE);
if (ret)
goto out;
ret = req->engine->emit_bb_start(req,
(so.ggtt_offset + so.aux_batch_offset),
so.aux_batch_size,
I915_DISPATCH_SECURE);
if (ret)
goto out;
i915_vma_move_to_active(i915_gem_obj_to_ggtt(so.obj), req);
out:
i915_gem_render_state_fini(&so);
return ret;
}
static int gen8_init_rcs_context(struct drm_i915_gem_request *req) static int gen8_init_rcs_context(struct drm_i915_gem_request *req)
{ {
int ret; int ret;
...@@ -1844,7 +1812,7 @@ static int gen8_init_rcs_context(struct drm_i915_gem_request *req) ...@@ -1844,7 +1812,7 @@ static int gen8_init_rcs_context(struct drm_i915_gem_request *req)
if (ret) if (ret)
DRM_ERROR("MOCS failed to program: expect performance issues.\n"); DRM_ERROR("MOCS failed to program: expect performance issues.\n");
return intel_lr_context_render_state_init(req); return i915_gem_render_state_init(req);
} }
/** /**
......
...@@ -24,12 +24,13 @@ ...@@ -24,12 +24,13 @@
#ifndef _INTEL_RENDERSTATE_H #ifndef _INTEL_RENDERSTATE_H
#define _INTEL_RENDERSTATE_H #define _INTEL_RENDERSTATE_H
#include "i915_drv.h" #include <linux/types.h>
extern const struct intel_renderstate_rodata gen6_null_state; struct intel_renderstate_rodata {
extern const struct intel_renderstate_rodata gen7_null_state; const u32 *reloc;
extern const struct intel_renderstate_rodata gen8_null_state; const u32 *batch;
extern const struct intel_renderstate_rodata gen9_null_state; const u32 batch_items;
};
#define RO_RENDERSTATE(_g) \ #define RO_RENDERSTATE(_g) \
const struct intel_renderstate_rodata gen ## _g ## _null_state = { \ const struct intel_renderstate_rodata gen ## _g ## _null_state = { \
...@@ -38,4 +39,9 @@ extern const struct intel_renderstate_rodata gen9_null_state; ...@@ -38,4 +39,9 @@ extern const struct intel_renderstate_rodata gen9_null_state;
.batch_items = sizeof(gen ## _g ## _null_state_batch)/4, \ .batch_items = sizeof(gen ## _g ## _null_state_batch)/4, \
} }
extern const struct intel_renderstate_rodata gen6_null_state;
extern const struct intel_renderstate_rodata gen7_null_state;
extern const struct intel_renderstate_rodata gen8_null_state;
extern const struct intel_renderstate_rodata gen9_null_state;
#endif /* INTEL_RENDERSTATE_H */ #endif /* INTEL_RENDERSTATE_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment